5 #ifndef MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_
6 #define MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_
10 #include "packager/media/formats/mp4/aac_audio_specific_config.h"
11 #include "packager/media/formats/mp4/box.h"
12 #include "packager/media/formats/mp4/es_descriptor.h"
13 #include "packager/media/formats/mp4/fourccs.h"
15 namespace edash_packager {
31 #define DECLARE_BOX_METHODS(T) \
34 bool ReadWrite(BoxBuffer* buffer) override; \
35 FourCC BoxType() const override; \
36 uint32_t ComputeSize() override;
42 uint32_t minor_version;
43 std::vector<FourCC> compatible_brands;
53 std::vector<uint8_t> system_id;
54 std::vector<uint8_t> data;
55 std::vector<uint8_t> raw_box;
61 std::vector<uint64_t> offsets;
67 uint8_t default_sample_info_size;
68 uint32_t sample_count;
69 std::vector<uint8_t> sample_info_sizes;
90 uint8_t default_iv_size;
91 std::vector<uint8_t> default_kid;
111 uint64_t creation_time;
112 uint64_t modification_time;
117 uint32_t next_track_id;
121 enum TrackHeaderFlags {
122 kTrackEnabled = 0x000001,
123 kTrackInMovie = 0x000002,
124 kTrackInPreview = 0x000004,
129 uint64_t creation_time;
130 uint64_t modification_time;
134 int16_t alternate_group;
143 uint64_t segment_duration;
145 int16_t media_rate_integer;
146 int16_t media_rate_fraction;
152 std::vector<EditListEntry> edits;
156 DECLARE_BOX_METHODS(
Edit);
172 std::vector<uint8_t> data;
185 FourCC GetActualFormat()
const {
186 return format == FOURCC_ENCV ? sinf.format.format : format;
190 uint16_t data_reference_index;
209 std::vector<uint8_t> data;
215 FourCC GetActualFormat()
const {
216 return format == FOURCC_ENCA ? sinf.format.format : format;
220 uint16_t data_reference_index;
221 uint16_t channelcount;
234 std::vector<VideoSampleEntry> video_entries;
235 std::vector<AudioSampleEntry> audio_entries;
239 uint32_t sample_count;
240 uint32_t sample_delta;
247 std::vector<DecodingTime> decoding_time;
251 uint32_t sample_count;
255 int64_t sample_offset;
262 std::vector<CompositionOffset> composition_offset;
266 uint32_t first_chunk;
267 uint32_t samples_per_chunk;
268 uint32_t sample_description_index;
275 std::vector<ChunkInfo> chunk_info;
282 uint32_t sample_size;
283 uint32_t sample_count;
284 std::vector<uint32_t> sizes;
292 std::vector<uint32_t> sizes;
299 std::vector<uint64_t> offsets;
311 std::vector<uint32_t> sample_number;
332 uint64_t creation_time;
333 uint64_t modification_time;
343 uint16_t graphicsmode;
344 uint16_t opcolor_red;
345 uint16_t opcolor_green;
346 uint16_t opcolor_blue;
358 std::vector<uint8_t> location;
365 std::vector<DataEntryUrl> data_entry;
385 DECLARE_BOX_METHODS(
Media);
393 DECLARE_BOX_METHODS(
Track);
403 uint64_t fragment_duration;
410 uint32_t default_sample_description_index;
411 uint32_t default_sample_duration;
412 uint32_t default_sample_size;
413 uint32_t default_sample_flags;
420 std::vector<TrackExtends> tracks;
424 DECLARE_BOX_METHODS(
Movie);
428 std::vector<Track> tracks;
429 std::vector<ProtectionSystemSpecificHeader> pssh;
435 uint64_t decode_time;
441 uint32_t sequence_number;
445 enum TrackFragmentFlagsMasks {
446 kBaseDataOffsetPresentMask = 0x000001,
447 kSampleDescriptionIndexPresentMask = 0x000002,
448 kDefaultSampleDurationPresentMask = 0x000008,
449 kDefaultSampleSizePresentMask = 0x000010,
450 kDefaultSampleFlagsPresentMask = 0x000020,
451 kDurationIsEmptyMask = 0x010000,
452 kDefaultBaseIsMoofMask = 0x020000,
455 enum SampleFlagsMasks {
456 kReservedMask = 0xFC000000,
457 kSampleDependsOnMask = 0x03000000,
458 kSampleIsDependedOnMask = 0x00C00000,
459 kSampleHasRedundancyMask = 0x00300000,
460 kSamplePaddingValueMask = 0x000E0000,
461 kNonKeySampleMask = 0x00010000,
462 kSampleDegradationPriorityMask = 0x0000FFFF,
468 uint32_t sample_description_index;
469 uint32_t default_sample_duration;
470 uint32_t default_sample_size;
471 uint32_t default_sample_flags;
475 enum TrackFragmentFlagsMasks {
476 kDataOffsetPresentMask = 0x000001,
477 kFirstSampleFlagsPresentMask = 0x000004,
478 kSampleDurationPresentMask = 0x000100,
479 kSampleSizePresentMask = 0x000200,
480 kSampleFlagsPresentMask = 0x000400,
481 kSampleCompTimeOffsetsPresentMask = 0x000800,
486 uint32_t sample_count;
487 uint32_t data_offset;
488 std::vector<uint32_t> sample_flags;
489 std::vector<uint32_t> sample_sizes;
490 std::vector<uint32_t> sample_durations;
491 std::vector<int64_t> sample_composition_time_offsets;
495 enum GroupDescriptionIndexBase {
496 kTrackGroupDescriptionIndexBase = 0,
497 kTrackFragmentGroupDescriptionIndexBase = 0x10000,
500 uint32_t sample_count;
501 uint32_t group_description_index;
507 uint32_t grouping_type;
508 uint32_t grouping_type_parameter;
509 std::vector<SampleToGroupEntry> entries;
518 std::vector<uint8_t> key_id;
524 uint32_t grouping_type;
525 std::vector<CencSampleEncryptionInfoEntry> entries;
532 std::vector<TrackFragmentRun> runs;
533 bool decode_time_absent;
545 std::vector<TrackFragment> tracks;
546 std::vector<ProtectionSystemSpecificHeader> pssh;
561 uint32_t referenced_size;
562 uint32_t subsegment_duration;
563 bool starts_with_sap;
565 uint32_t sap_delta_time;
568 uint64_t earliest_presentation_time;
574 uint32_t reference_id;
576 uint64_t earliest_presentation_time;
577 uint64_t first_offset;
578 std::vector<SegmentReference> references;
587 uint32_t ComputeSize();
588 FourCC BoxType()
const;
599 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_