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 FourCC GetActualFormat()
const {
210 return format == FOURCC_ENCA ? sinf.format.format : format;
214 uint16_t data_reference_index;
215 uint16_t channelcount;
227 std::vector<VideoSampleEntry> video_entries;
228 std::vector<AudioSampleEntry> audio_entries;
232 uint32_t sample_count;
233 uint32_t sample_delta;
240 std::vector<DecodingTime> decoding_time;
244 uint32_t sample_count;
248 int64_t sample_offset;
255 std::vector<CompositionOffset> composition_offset;
259 uint32_t first_chunk;
260 uint32_t samples_per_chunk;
261 uint32_t sample_description_index;
268 std::vector<ChunkInfo> chunk_info;
275 uint32_t sample_size;
276 uint32_t sample_count;
277 std::vector<uint32_t> sizes;
285 std::vector<uint32_t> sizes;
292 std::vector<uint64_t> offsets;
304 std::vector<uint32_t> sample_number;
325 uint64_t creation_time;
326 uint64_t modification_time;
336 uint16_t graphicsmode;
337 uint16_t opcolor_red;
338 uint16_t opcolor_green;
339 uint16_t opcolor_blue;
351 std::vector<uint8_t> location;
358 std::vector<DataEntryUrl> data_entry;
378 DECLARE_BOX_METHODS(
Media);
386 DECLARE_BOX_METHODS(
Track);
396 uint64_t fragment_duration;
403 uint32_t default_sample_description_index;
404 uint32_t default_sample_duration;
405 uint32_t default_sample_size;
406 uint32_t default_sample_flags;
413 std::vector<TrackExtends> tracks;
417 DECLARE_BOX_METHODS(
Movie);
421 std::vector<Track> tracks;
422 std::vector<ProtectionSystemSpecificHeader> pssh;
428 uint64_t decode_time;
434 uint32_t sequence_number;
438 enum TrackFragmentFlagsMasks {
439 kBaseDataOffsetPresentMask = 0x000001,
440 kSampleDescriptionIndexPresentMask = 0x000002,
441 kDefaultSampleDurationPresentMask = 0x000008,
442 kDefaultSampleSizePresentMask = 0x000010,
443 kDefaultSampleFlagsPresentMask = 0x000020,
444 kDurationIsEmptyMask = 0x010000,
445 kDefaultBaseIsMoofMask = 0x020000,
448 enum SampleFlagsMasks {
449 kReservedMask = 0xFC000000,
450 kSampleDependsOnMask = 0x03000000,
451 kSampleIsDependedOnMask = 0x00C00000,
452 kSampleHasRedundancyMask = 0x00300000,
453 kSamplePaddingValueMask = 0x000E0000,
454 kNonKeySampleMask = 0x00010000,
455 kSampleDegradationPriorityMask = 0x0000FFFF,
461 uint32_t sample_description_index;
462 uint32_t default_sample_duration;
463 uint32_t default_sample_size;
464 uint32_t default_sample_flags;
468 enum TrackFragmentFlagsMasks {
469 kDataOffsetPresentMask = 0x000001,
470 kFirstSampleFlagsPresentMask = 0x000004,
471 kSampleDurationPresentMask = 0x000100,
472 kSampleSizePresentMask = 0x000200,
473 kSampleFlagsPresentMask = 0x000400,
474 kSampleCompTimeOffsetsPresentMask = 0x000800,
479 uint32_t sample_count;
480 uint32_t data_offset;
481 std::vector<uint32_t> sample_flags;
482 std::vector<uint32_t> sample_sizes;
483 std::vector<uint32_t> sample_durations;
484 std::vector<int64_t> sample_composition_time_offsets;
488 enum GroupDescriptionIndexBase {
489 kTrackGroupDescriptionIndexBase = 0,
490 kTrackFragmentGroupDescriptionIndexBase = 0x10000,
493 uint32_t sample_count;
494 uint32_t group_description_index;
500 uint32_t grouping_type;
501 uint32_t grouping_type_parameter;
502 std::vector<SampleToGroupEntry> entries;
511 std::vector<uint8_t> key_id;
517 uint32_t grouping_type;
518 std::vector<CencSampleEncryptionInfoEntry> entries;
525 std::vector<TrackFragmentRun> runs;
526 bool decode_time_absent;
538 std::vector<TrackFragment> tracks;
539 std::vector<ProtectionSystemSpecificHeader> pssh;
554 uint32_t referenced_size;
555 uint32_t subsegment_duration;
556 bool starts_with_sap;
558 uint32_t sap_delta_time;
561 uint64_t earliest_presentation_time;
567 uint32_t reference_id;
569 uint64_t earliest_presentation_time;
570 uint64_t first_offset;
571 std::vector<SegmentReference> references;
580 uint32_t ComputeSize();
581 FourCC BoxType()
const;
592 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_