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) \
35 FourCC BoxType() const override; \
38 bool ReadWriteInternal(BoxBuffer* buffer) override; \
39 uint32_t ComputeSizeInternal() override; \
47 uint32_t minor_version;
48 std::vector<FourCC> compatible_brands;
52 FourCC
BoxType()
const override;
58 std::vector<uint8_t> system_id;
59 std::vector<uint8_t> data;
60 std::vector<uint8_t> raw_box;
66 std::vector<uint64_t> offsets;
72 uint8_t default_sample_info_size;
73 uint32_t sample_count;
74 std::vector<uint8_t> sample_info_sizes;
95 uint8_t default_iv_size;
96 std::vector<uint8_t> default_kid;
116 uint64_t creation_time;
117 uint64_t modification_time;
122 uint32_t next_track_id;
126 enum TrackHeaderFlags {
127 kTrackEnabled = 0x000001,
128 kTrackInMovie = 0x000002,
129 kTrackInPreview = 0x000004,
134 uint64_t creation_time;
135 uint64_t modification_time;
139 int16_t alternate_group;
148 uint64_t segment_duration;
150 int16_t media_rate_integer;
151 int16_t media_rate_fraction;
157 std::vector<EditListEntry> edits;
161 DECLARE_BOX_METHODS(
Edit);
178 std::vector<uint8_t> data;
191 FourCC GetActualFormat()
const {
192 return format == FOURCC_ENCV ? sinf.format.format : format;
196 uint16_t data_reference_index;
215 std::vector<uint8_t> data;
221 FourCC GetActualFormat()
const {
222 return format == FOURCC_ENCA ? sinf.format.format : format;
226 uint16_t data_reference_index;
227 uint16_t channelcount;
240 std::vector<VideoSampleEntry> video_entries;
241 std::vector<AudioSampleEntry> audio_entries;
245 uint32_t sample_count;
246 uint32_t sample_delta;
253 std::vector<DecodingTime> decoding_time;
257 uint32_t sample_count;
261 int64_t sample_offset;
268 std::vector<CompositionOffset> composition_offset;
272 uint32_t first_chunk;
273 uint32_t samples_per_chunk;
274 uint32_t sample_description_index;
281 std::vector<ChunkInfo> chunk_info;
288 uint32_t sample_size;
289 uint32_t sample_count;
290 std::vector<uint32_t> sizes;
298 std::vector<uint32_t> sizes;
305 std::vector<uint64_t> offsets;
317 std::vector<uint32_t> sample_number;
338 uint64_t creation_time;
339 uint64_t modification_time;
349 uint16_t graphicsmode;
350 uint16_t opcolor_red;
351 uint16_t opcolor_green;
352 uint16_t opcolor_blue;
364 std::vector<uint8_t> location;
371 std::vector<DataEntryUrl> data_entry;
391 DECLARE_BOX_METHODS(
Media);
399 DECLARE_BOX_METHODS(
Track);
409 uint64_t fragment_duration;
416 uint32_t default_sample_description_index;
417 uint32_t default_sample_duration;
418 uint32_t default_sample_size;
419 uint32_t default_sample_flags;
426 std::vector<TrackExtends> tracks;
430 DECLARE_BOX_METHODS(
Movie);
434 std::vector<Track> tracks;
435 std::vector<ProtectionSystemSpecificHeader> pssh;
441 uint64_t decode_time;
447 uint32_t sequence_number;
451 enum TrackFragmentFlagsMasks {
452 kBaseDataOffsetPresentMask = 0x000001,
453 kSampleDescriptionIndexPresentMask = 0x000002,
454 kDefaultSampleDurationPresentMask = 0x000008,
455 kDefaultSampleSizePresentMask = 0x000010,
456 kDefaultSampleFlagsPresentMask = 0x000020,
457 kDurationIsEmptyMask = 0x010000,
458 kDefaultBaseIsMoofMask = 0x020000,
461 enum SampleFlagsMasks {
462 kReservedMask = 0xFC000000,
463 kSampleDependsOnMask = 0x03000000,
464 kSampleIsDependedOnMask = 0x00C00000,
465 kSampleHasRedundancyMask = 0x00300000,
466 kSamplePaddingValueMask = 0x000E0000,
467 kNonKeySampleMask = 0x00010000,
468 kSampleDegradationPriorityMask = 0x0000FFFF,
474 uint32_t sample_description_index;
475 uint32_t default_sample_duration;
476 uint32_t default_sample_size;
477 uint32_t default_sample_flags;
481 enum TrackFragmentFlagsMasks {
482 kDataOffsetPresentMask = 0x000001,
483 kFirstSampleFlagsPresentMask = 0x000004,
484 kSampleDurationPresentMask = 0x000100,
485 kSampleSizePresentMask = 0x000200,
486 kSampleFlagsPresentMask = 0x000400,
487 kSampleCompTimeOffsetsPresentMask = 0x000800,
492 uint32_t sample_count;
493 uint32_t data_offset;
494 std::vector<uint32_t> sample_flags;
495 std::vector<uint32_t> sample_sizes;
496 std::vector<uint32_t> sample_durations;
497 std::vector<int64_t> sample_composition_time_offsets;
501 enum GroupDescriptionIndexBase {
502 kTrackGroupDescriptionIndexBase = 0,
503 kTrackFragmentGroupDescriptionIndexBase = 0x10000,
506 uint32_t sample_count;
507 uint32_t group_description_index;
513 uint32_t grouping_type;
514 uint32_t grouping_type_parameter;
515 std::vector<SampleToGroupEntry> entries;
524 std::vector<uint8_t> key_id;
530 uint32_t grouping_type;
531 std::vector<CencSampleEncryptionInfoEntry> entries;
538 std::vector<TrackFragmentRun> runs;
539 bool decode_time_absent;
551 std::vector<TrackFragment> tracks;
552 std::vector<ProtectionSystemSpecificHeader> pssh;
567 uint32_t referenced_size;
568 uint32_t subsegment_duration;
569 bool starts_with_sap;
571 uint32_t sap_delta_time;
574 uint64_t earliest_presentation_time;
580 uint32_t reference_id;
582 uint64_t earliest_presentation_time;
583 uint64_t first_offset;
584 std::vector<SegmentReference> references;
600 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_