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;
221 std::vector<uint8_t> extra_data;
228 std::vector<VideoSampleEntry> video_entries;
229 std::vector<AudioSampleEntry> audio_entries;
233 uint32_t sample_count;
234 uint32_t sample_delta;
241 std::vector<DecodingTime> decoding_time;
245 uint32_t sample_count;
249 int64_t sample_offset;
256 std::vector<CompositionOffset> composition_offset;
260 uint32_t first_chunk;
261 uint32_t samples_per_chunk;
262 uint32_t sample_description_index;
269 std::vector<ChunkInfo> chunk_info;
276 uint32_t sample_size;
277 uint32_t sample_count;
278 std::vector<uint32_t> sizes;
286 std::vector<uint32_t> sizes;
293 std::vector<uint64_t> offsets;
305 std::vector<uint32_t> sample_number;
326 uint64_t creation_time;
327 uint64_t modification_time;
337 uint16_t graphicsmode;
338 uint16_t opcolor_red;
339 uint16_t opcolor_green;
340 uint16_t opcolor_blue;
352 std::vector<uint8_t> location;
359 std::vector<DataEntryUrl> data_entry;
379 DECLARE_BOX_METHODS(
Media);
387 DECLARE_BOX_METHODS(
Track);
397 uint64_t fragment_duration;
404 uint32_t default_sample_description_index;
405 uint32_t default_sample_duration;
406 uint32_t default_sample_size;
407 uint32_t default_sample_flags;
414 std::vector<TrackExtends> tracks;
418 DECLARE_BOX_METHODS(
Movie);
422 std::vector<Track> tracks;
423 std::vector<ProtectionSystemSpecificHeader> pssh;
429 uint64_t decode_time;
435 uint32_t sequence_number;
439 enum TrackFragmentFlagsMasks {
440 kBaseDataOffsetPresentMask = 0x000001,
441 kSampleDescriptionIndexPresentMask = 0x000002,
442 kDefaultSampleDurationPresentMask = 0x000008,
443 kDefaultSampleSizePresentMask = 0x000010,
444 kDefaultSampleFlagsPresentMask = 0x000020,
445 kDurationIsEmptyMask = 0x010000,
446 kDefaultBaseIsMoofMask = 0x020000,
449 enum SampleFlagsMasks {
450 kReservedMask = 0xFC000000,
451 kSampleDependsOnMask = 0x03000000,
452 kSampleIsDependedOnMask = 0x00C00000,
453 kSampleHasRedundancyMask = 0x00300000,
454 kSamplePaddingValueMask = 0x000E0000,
455 kNonKeySampleMask = 0x00010000,
456 kSampleDegradationPriorityMask = 0x0000FFFF,
462 uint32_t sample_description_index;
463 uint32_t default_sample_duration;
464 uint32_t default_sample_size;
465 uint32_t default_sample_flags;
469 enum TrackFragmentFlagsMasks {
470 kDataOffsetPresentMask = 0x000001,
471 kFirstSampleFlagsPresentMask = 0x000004,
472 kSampleDurationPresentMask = 0x000100,
473 kSampleSizePresentMask = 0x000200,
474 kSampleFlagsPresentMask = 0x000400,
475 kSampleCompTimeOffsetsPresentMask = 0x000800,
480 uint32_t sample_count;
481 uint32_t data_offset;
482 std::vector<uint32_t> sample_flags;
483 std::vector<uint32_t> sample_sizes;
484 std::vector<uint32_t> sample_durations;
485 std::vector<int64_t> sample_composition_time_offsets;
489 enum GroupDescriptionIndexBase {
490 kTrackGroupDescriptionIndexBase = 0,
491 kTrackFragmentGroupDescriptionIndexBase = 0x10000,
494 uint32_t sample_count;
495 uint32_t group_description_index;
501 uint32_t grouping_type;
502 uint32_t grouping_type_parameter;
503 std::vector<SampleToGroupEntry> entries;
512 std::vector<uint8_t> key_id;
518 uint32_t grouping_type;
519 std::vector<CencSampleEncryptionInfoEntry> entries;
526 std::vector<TrackFragmentRun> runs;
527 bool decode_time_absent;
539 std::vector<TrackFragment> tracks;
540 std::vector<ProtectionSystemSpecificHeader> pssh;
555 uint32_t referenced_size;
556 uint32_t subsegment_duration;
557 bool starts_with_sap;
559 uint32_t sap_delta_time;
562 uint64_t earliest_presentation_time;
568 uint32_t reference_id;
570 uint64_t earliest_presentation_time;
571 uint64_t first_offset;
572 std::vector<SegmentReference> references;
581 uint32_t ComputeSize();
582 FourCC BoxType()
const;
593 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_