5 #ifndef MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_
6 #define MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_
10 #include "packager/media/base/decrypt_config.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 {
33 #define DECLARE_BOX_METHODS(T) \
37 FourCC BoxType() const override; \
40 bool ReadWriteInternal(BoxBuffer* buffer) override; \
41 uint32_t ComputeSizeInternal() override; \
49 uint32_t minor_version;
50 std::vector<FourCC> compatible_brands;
54 FourCC
BoxType()
const override;
60 std::vector<uint8_t> system_id;
61 std::vector<uint8_t> data;
62 std::vector<uint8_t> raw_box;
68 std::vector<uint64_t> offsets;
74 uint8_t default_sample_info_size;
75 uint32_t sample_count;
76 std::vector<uint8_t> sample_info_sizes;
106 std::vector<uint8_t> initialization_vector;
107 std::vector<SubsampleEntry> subsamples;
111 enum SampleEncryptionFlags {
112 kUseSubsampleEncryption = 2,
123 std::vector<SampleEncryptionEntry>* sample_encryption_entries)
const;
130 std::vector<SampleEncryptionEntry> sample_encryption_entries;
151 uint8_t default_iv_size;
152 std::vector<uint8_t> default_kid;
172 uint64_t creation_time;
173 uint64_t modification_time;
178 uint32_t next_track_id;
182 enum TrackHeaderFlags {
183 kTrackEnabled = 0x000001,
184 kTrackInMovie = 0x000002,
185 kTrackInPreview = 0x000004,
190 uint64_t creation_time;
191 uint64_t modification_time;
195 int16_t alternate_group;
204 uint64_t segment_duration;
206 int16_t media_rate_integer;
207 int16_t media_rate_fraction;
213 std::vector<EditListEntry> edits;
217 DECLARE_BOX_METHODS(
Edit);
234 std::vector<uint8_t> data;
247 FourCC GetActualFormat()
const {
248 return format == FOURCC_ENCV ? sinf.format.format : format;
252 uint16_t data_reference_index;
271 uint32_t sampling_frequency;
272 uint32_t max_bitrate;
273 uint32_t avg_bitrate;
274 uint8_t pcm_sample_depth;
275 std::vector<uint8_t> extra_data;
281 FourCC GetActualFormat()
const {
282 return format == FOURCC_ENCA ? sinf.format.format : format;
286 uint16_t data_reference_index;
287 uint16_t channelcount;
303 std::string source_label;
309 uint16_t data_reference_index;
322 std::vector<VideoSampleEntry> video_entries;
323 std::vector<AudioSampleEntry> audio_entries;
324 std::vector<WVTTSampleEntry> wvtt_entries;
328 uint32_t sample_count;
329 uint32_t sample_delta;
336 std::vector<DecodingTime> decoding_time;
340 uint32_t sample_count;
344 int64_t sample_offset;
351 std::vector<CompositionOffset> composition_offset;
355 uint32_t first_chunk;
356 uint32_t samples_per_chunk;
357 uint32_t sample_description_index;
364 std::vector<ChunkInfo> chunk_info;
371 uint32_t sample_size;
372 uint32_t sample_count;
373 std::vector<uint32_t> sizes;
381 std::vector<uint32_t> sizes;
388 std::vector<uint64_t> offsets;
400 std::vector<uint32_t> sample_number;
421 uint64_t creation_time;
422 uint64_t modification_time;
432 uint16_t graphicsmode;
433 uint16_t opcolor_red;
434 uint16_t opcolor_green;
435 uint16_t opcolor_blue;
451 std::vector<uint8_t> location;
458 std::vector<DataEntryUrl> data_entry;
479 DECLARE_BOX_METHODS(
Media);
487 DECLARE_BOX_METHODS(
Track);
498 uint64_t fragment_duration;
505 uint32_t default_sample_description_index;
506 uint32_t default_sample_duration;
507 uint32_t default_sample_size;
508 uint32_t default_sample_flags;
515 std::vector<TrackExtends> tracks;
519 DECLARE_BOX_METHODS(
Movie);
523 std::vector<Track> tracks;
524 std::vector<ProtectionSystemSpecificHeader> pssh;
530 uint64_t decode_time;
536 uint32_t sequence_number;
540 enum TrackFragmentFlagsMasks {
541 kBaseDataOffsetPresentMask = 0x000001,
542 kSampleDescriptionIndexPresentMask = 0x000002,
543 kDefaultSampleDurationPresentMask = 0x000008,
544 kDefaultSampleSizePresentMask = 0x000010,
545 kDefaultSampleFlagsPresentMask = 0x000020,
546 kDurationIsEmptyMask = 0x010000,
547 kDefaultBaseIsMoofMask = 0x020000,
550 enum SampleFlagsMasks {
551 kReservedMask = 0xFC000000,
552 kSampleDependsOnMask = 0x03000000,
553 kSampleIsDependedOnMask = 0x00C00000,
554 kSampleHasRedundancyMask = 0x00300000,
555 kSamplePaddingValueMask = 0x000E0000,
556 kNonKeySampleMask = 0x00010000,
557 kSampleDegradationPriorityMask = 0x0000FFFF,
563 uint32_t sample_description_index;
564 uint32_t default_sample_duration;
565 uint32_t default_sample_size;
566 uint32_t default_sample_flags;
570 enum TrackFragmentFlagsMasks {
571 kDataOffsetPresentMask = 0x000001,
572 kFirstSampleFlagsPresentMask = 0x000004,
573 kSampleDurationPresentMask = 0x000100,
574 kSampleSizePresentMask = 0x000200,
575 kSampleFlagsPresentMask = 0x000400,
576 kSampleCompTimeOffsetsPresentMask = 0x000800,
581 uint32_t sample_count;
582 uint32_t data_offset;
583 std::vector<uint32_t> sample_flags;
584 std::vector<uint32_t> sample_sizes;
585 std::vector<uint32_t> sample_durations;
586 std::vector<int64_t> sample_composition_time_offsets;
590 enum GroupDescriptionIndexBase {
591 kTrackGroupDescriptionIndexBase = 0,
592 kTrackFragmentGroupDescriptionIndexBase = 0x10000,
595 uint32_t sample_count;
596 uint32_t group_description_index;
602 uint32_t grouping_type;
603 uint32_t grouping_type_parameter;
604 std::vector<SampleToGroupEntry> entries;
613 std::vector<uint8_t> key_id;
619 uint32_t grouping_type;
620 std::vector<CencSampleEncryptionInfoEntry> entries;
627 std::vector<TrackFragmentRun> runs;
628 bool decode_time_absent;
641 std::vector<TrackFragment> tracks;
642 std::vector<ProtectionSystemSpecificHeader> pssh;
657 uint32_t referenced_size;
658 uint32_t subsegment_duration;
659 bool starts_with_sap;
661 uint32_t sap_delta_time;
664 uint64_t earliest_presentation_time;
670 uint32_t reference_id;
672 uint64_t earliest_presentation_time;
673 uint64_t first_offset;
674 std::vector<SegmentReference> references;
691 std::string cue_current_time;
701 std::string settings;
706 std::string cue_text;
715 std::string cue_additional_text;
734 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_
uint32_t ComputeSize() const
bool ParseFromBuffer(uint8_t iv_size, bool has_subsamples, BufferReader *reader)
bool ReadWrite(uint8_t iv_size, bool has_subsamples, BoxBuffer *buffer)
uint32_t GetTotalSizeOfSubsamples() const