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 {
32 #define DECLARE_BOX_METHODS(T) \
36 FourCC BoxType() const override; \
39 bool ReadWriteInternal(BoxBuffer* buffer) override; \
40 uint32_t ComputeSizeInternal() override; \
48 uint32_t minor_version;
49 std::vector<FourCC> compatible_brands;
53 FourCC
BoxType()
const override;
59 std::vector<uint8_t> system_id;
60 std::vector<uint8_t> data;
61 std::vector<uint8_t> raw_box;
67 std::vector<uint64_t> offsets;
73 uint8_t default_sample_info_size;
74 uint32_t sample_count;
75 std::vector<uint8_t> sample_info_sizes;
96 uint8_t default_iv_size;
97 std::vector<uint8_t> default_kid;
117 uint64_t creation_time;
118 uint64_t modification_time;
123 uint32_t next_track_id;
127 enum TrackHeaderFlags {
128 kTrackEnabled = 0x000001,
129 kTrackInMovie = 0x000002,
130 kTrackInPreview = 0x000004,
135 uint64_t creation_time;
136 uint64_t modification_time;
140 int16_t alternate_group;
149 uint64_t segment_duration;
151 int16_t media_rate_integer;
152 int16_t media_rate_fraction;
158 std::vector<EditListEntry> edits;
162 DECLARE_BOX_METHODS(
Edit);
179 std::vector<uint8_t> data;
192 FourCC GetActualFormat()
const {
193 return format == FOURCC_ENCV ? sinf.format.format : format;
197 uint16_t data_reference_index;
216 std::vector<uint8_t> data;
222 FourCC GetActualFormat()
const {
223 return format == FOURCC_ENCA ? sinf.format.format : format;
227 uint16_t data_reference_index;
228 uint16_t channelcount;
244 std::string source_label;
250 uint16_t data_reference_index;
261 std::vector<VideoSampleEntry> video_entries;
262 std::vector<AudioSampleEntry> audio_entries;
263 std::vector<WVTTSampleEntry> wvtt_entries;
267 uint32_t sample_count;
268 uint32_t sample_delta;
275 std::vector<DecodingTime> decoding_time;
279 uint32_t sample_count;
283 int64_t sample_offset;
290 std::vector<CompositionOffset> composition_offset;
294 uint32_t first_chunk;
295 uint32_t samples_per_chunk;
296 uint32_t sample_description_index;
303 std::vector<ChunkInfo> chunk_info;
310 uint32_t sample_size;
311 uint32_t sample_count;
312 std::vector<uint32_t> sizes;
320 std::vector<uint32_t> sizes;
327 std::vector<uint64_t> offsets;
339 std::vector<uint32_t> sample_number;
360 uint64_t creation_time;
361 uint64_t modification_time;
371 uint16_t graphicsmode;
372 uint16_t opcolor_red;
373 uint16_t opcolor_green;
374 uint16_t opcolor_blue;
390 std::vector<uint8_t> location;
397 std::vector<DataEntryUrl> data_entry;
418 DECLARE_BOX_METHODS(
Media);
426 DECLARE_BOX_METHODS(
Track);
436 uint64_t fragment_duration;
443 uint32_t default_sample_description_index;
444 uint32_t default_sample_duration;
445 uint32_t default_sample_size;
446 uint32_t default_sample_flags;
453 std::vector<TrackExtends> tracks;
457 DECLARE_BOX_METHODS(
Movie);
461 std::vector<Track> tracks;
462 std::vector<ProtectionSystemSpecificHeader> pssh;
468 uint64_t decode_time;
474 uint32_t sequence_number;
478 enum TrackFragmentFlagsMasks {
479 kBaseDataOffsetPresentMask = 0x000001,
480 kSampleDescriptionIndexPresentMask = 0x000002,
481 kDefaultSampleDurationPresentMask = 0x000008,
482 kDefaultSampleSizePresentMask = 0x000010,
483 kDefaultSampleFlagsPresentMask = 0x000020,
484 kDurationIsEmptyMask = 0x010000,
485 kDefaultBaseIsMoofMask = 0x020000,
488 enum SampleFlagsMasks {
489 kReservedMask = 0xFC000000,
490 kSampleDependsOnMask = 0x03000000,
491 kSampleIsDependedOnMask = 0x00C00000,
492 kSampleHasRedundancyMask = 0x00300000,
493 kSamplePaddingValueMask = 0x000E0000,
494 kNonKeySampleMask = 0x00010000,
495 kSampleDegradationPriorityMask = 0x0000FFFF,
501 uint32_t sample_description_index;
502 uint32_t default_sample_duration;
503 uint32_t default_sample_size;
504 uint32_t default_sample_flags;
508 enum TrackFragmentFlagsMasks {
509 kDataOffsetPresentMask = 0x000001,
510 kFirstSampleFlagsPresentMask = 0x000004,
511 kSampleDurationPresentMask = 0x000100,
512 kSampleSizePresentMask = 0x000200,
513 kSampleFlagsPresentMask = 0x000400,
514 kSampleCompTimeOffsetsPresentMask = 0x000800,
519 uint32_t sample_count;
520 uint32_t data_offset;
521 std::vector<uint32_t> sample_flags;
522 std::vector<uint32_t> sample_sizes;
523 std::vector<uint32_t> sample_durations;
524 std::vector<int64_t> sample_composition_time_offsets;
528 enum GroupDescriptionIndexBase {
529 kTrackGroupDescriptionIndexBase = 0,
530 kTrackFragmentGroupDescriptionIndexBase = 0x10000,
533 uint32_t sample_count;
534 uint32_t group_description_index;
540 uint32_t grouping_type;
541 uint32_t grouping_type_parameter;
542 std::vector<SampleToGroupEntry> entries;
551 std::vector<uint8_t> key_id;
557 uint32_t grouping_type;
558 std::vector<CencSampleEncryptionInfoEntry> entries;
565 std::vector<TrackFragmentRun> runs;
566 bool decode_time_absent;
578 std::vector<TrackFragment> tracks;
579 std::vector<ProtectionSystemSpecificHeader> pssh;
594 uint32_t referenced_size;
595 uint32_t subsegment_duration;
596 bool starts_with_sap;
598 uint32_t sap_delta_time;
601 uint64_t earliest_presentation_time;
607 uint32_t reference_id;
609 uint64_t earliest_presentation_time;
610 uint64_t first_offset;
611 std::vector<SegmentReference> references;
628 std::string cue_current_time;
638 std::string settings;
643 std::string cue_text;
652 std::string cue_additional_text;
671 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_