5 #ifndef MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_
6 #define MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_
11 #include "packager/media/formats/mp4/aac_audio_specific_config.h"
12 #include "packager/media/formats/mp4/box.h"
13 #include "packager/media/formats/mp4/es_descriptor.h"
14 #include "packager/media/formats/mp4/fourccs.h"
16 namespace edash_packager {
32 #define DECLARE_BOX_METHODS(T) \
35 virtual bool ReadWrite(BoxBuffer* buffer) OVERRIDE; \
36 virtual FourCC BoxType() const OVERRIDE; \
37 virtual uint32_t ComputeSize() OVERRIDE;
43 uint32_t minor_version;
44 std::vector<FourCC> compatible_brands;
54 std::vector<uint8_t> system_id;
55 std::vector<uint8_t> data;
56 std::vector<uint8_t> raw_box;
62 std::vector<uint64_t> offsets;
68 uint8_t default_sample_info_size;
69 uint32_t sample_count;
70 std::vector<uint8_t> sample_info_sizes;
91 uint8_t default_iv_size;
92 std::vector<uint8_t> default_kid;
112 uint64_t creation_time;
113 uint64_t modification_time;
118 uint32_t next_track_id;
122 enum TrackHeaderFlags {
123 kTrackEnabled = 0x000001,
124 kTrackInMovie = 0x000002,
125 kTrackInPreview = 0x000004,
130 uint64_t creation_time;
131 uint64_t modification_time;
135 int16_t alternate_group;
144 uint64_t segment_duration;
146 int16_t media_rate_integer;
147 int16_t media_rate_fraction;
153 std::vector<EditListEntry> edits;
157 DECLARE_BOX_METHODS(
Edit);
176 std::vector<uint8_t> data;
179 uint8_t profile_indication;
180 uint8_t profile_compatibility;
184 typedef std::vector<uint8_t> SPS;
185 typedef std::vector<uint8_t> PPS;
187 std::vector<SPS> sps_list;
188 std::vector<PPS> pps_list;
202 uint16_t data_reference_index;
224 uint16_t data_reference_index;
225 uint16_t channelcount;
237 std::vector<VideoSampleEntry> video_entries;
238 std::vector<AudioSampleEntry> audio_entries;
242 uint32_t sample_count;
243 uint32_t sample_delta;
250 std::vector<DecodingTime> decoding_time;
254 uint32_t sample_count;
258 int64_t sample_offset;
265 std::vector<CompositionOffset> composition_offset;
269 uint32_t first_chunk;
270 uint32_t samples_per_chunk;
271 uint32_t sample_description_index;
278 std::vector<ChunkInfo> chunk_info;
285 uint32_t sample_size;
286 uint32_t sample_count;
287 std::vector<uint32_t> sizes;
295 std::vector<uint32_t> sizes;
302 std::vector<uint64_t> offsets;
314 std::vector<uint32_t> sample_number;
335 uint64_t creation_time;
336 uint64_t modification_time;
346 uint16_t graphicsmode;
347 uint16_t opcolor_red;
348 uint16_t opcolor_green;
349 uint16_t opcolor_blue;
361 std::vector<uint8_t> location;
368 std::vector<DataEntryUrl> data_entry;
388 DECLARE_BOX_METHODS(
Media);
396 DECLARE_BOX_METHODS(
Track);
406 uint64_t fragment_duration;
413 uint32_t default_sample_description_index;
414 uint32_t default_sample_duration;
415 uint32_t default_sample_size;
416 uint32_t default_sample_flags;
423 std::vector<TrackExtends> tracks;
427 DECLARE_BOX_METHODS(
Movie);
431 std::vector<Track> tracks;
432 std::vector<ProtectionSystemSpecificHeader> pssh;
438 uint64_t decode_time;
444 uint32_t sequence_number;
448 enum TrackFragmentFlagsMasks {
449 kBaseDataOffsetPresentMask = 0x000001,
450 kSampleDescriptionIndexPresentMask = 0x000002,
451 kDefaultSampleDurationPresentMask = 0x000008,
452 kDefaultSampleSizePresentMask = 0x000010,
453 kDefaultSampleFlagsPresentMask = 0x000020,
454 kDurationIsEmptyMask = 0x010000,
455 kDefaultBaseIsMoofMask = 0x020000,
458 enum SampleFlagsMasks {
459 kReservedMask = 0xFC000000,
460 kSampleDependsOnMask = 0x03000000,
461 kSampleIsDependedOnMask = 0x00C00000,
462 kSampleHasRedundancyMask = 0x00300000,
463 kSamplePaddingValueMask = 0x000E0000,
464 kNonKeySampleMask = 0x00010000,
465 kSampleDegradationPriorityMask = 0x0000FFFF,
471 uint32_t sample_description_index;
472 uint32_t default_sample_duration;
473 uint32_t default_sample_size;
474 uint32_t default_sample_flags;
478 enum TrackFragmentFlagsMasks {
479 kDataOffsetPresentMask = 0x000001,
480 kFirstSampleFlagsPresentMask = 0x000004,
481 kSampleDurationPresentMask = 0x000100,
482 kSampleSizePresentMask = 0x000200,
483 kSampleFlagsPresentMask = 0x000400,
484 kSampleCompTimeOffsetsPresentMask = 0x000800,
489 uint32_t sample_count;
490 uint32_t data_offset;
491 std::vector<uint32_t> sample_flags;
492 std::vector<uint32_t> sample_sizes;
493 std::vector<uint32_t> sample_durations;
494 std::vector<int64_t> sample_composition_time_offsets;
498 enum GroupDescriptionIndexBase {
499 kTrackGroupDescriptionIndexBase = 0,
500 kTrackFragmentGroupDescriptionIndexBase = 0x10000,
503 uint32_t sample_count;
504 uint32_t group_description_index;
510 uint32_t grouping_type;
511 uint32_t grouping_type_parameter;
512 std::vector<SampleToGroupEntry> entries;
521 std::vector<uint8_t> key_id;
527 uint32_t grouping_type;
528 std::vector<CencSampleEncryptionInfoEntry> entries;
535 std::vector<TrackFragmentRun> runs;
536 bool decode_time_absent;
548 std::vector<TrackFragment> tracks;
549 std::vector<ProtectionSystemSpecificHeader> pssh;
564 uint32_t referenced_size;
565 uint32_t subsegment_duration;
566 bool starts_with_sap;
568 uint32_t sap_delta_time;
571 uint64_t earliest_presentation_time;
577 uint32_t reference_id;
579 uint64_t earliest_presentation_time;
580 uint64_t first_offset;
581 std::vector<SegmentReference> references;
590 uint32_t ComputeSize();
591 FourCC BoxType()
const;
602 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_