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);
230 uint32_t ComputeSize()
const;
238 uint32_t ComputeSize()
const;
247 DECLARE_BOX_METHODS(
ID3v2);
268 std::vector<uint8_t> data;
281 FourCC GetActualFormat()
const {
282 return format == FOURCC_ENCV ? sinf.format.format : format;
286 uint16_t data_reference_index;
305 uint32_t sampling_frequency;
306 uint32_t max_bitrate;
307 uint32_t avg_bitrate;
308 uint8_t pcm_sample_depth;
309 std::vector<uint8_t> extra_data;
315 std::vector<uint8_t> data;
320 uint8_t sample_rate_code;
321 uint8_t bit_stream_identification;
323 uint8_t audio_service;
324 uint8_t bit_stream_mode;
325 uint8_t audio_coding_mode;
326 uint8_t lfe_channel_on;
328 uint8_t number_dependent_substreams;
331 uint16_t channel_location;
340 std::vector<uint8_t> data;
342 size_t number_independent_substreams;
343 std::vector<IndependentSubstream> independent_substreams;
349 FourCC GetActualFormat()
const {
350 return format == FOURCC_ENCA ? sinf.format.format : format;
354 uint16_t data_reference_index;
355 uint16_t channelcount;
374 std::string source_label;
380 uint16_t data_reference_index;
393 std::vector<VideoSampleEntry> video_entries;
394 std::vector<AudioSampleEntry> audio_entries;
395 std::vector<WVTTSampleEntry> wvtt_entries;
399 uint32_t sample_count;
400 uint32_t sample_delta;
407 std::vector<DecodingTime> decoding_time;
411 uint32_t sample_count;
415 int64_t sample_offset;
422 std::vector<CompositionOffset> composition_offset;
426 uint32_t first_chunk;
427 uint32_t samples_per_chunk;
428 uint32_t sample_description_index;
435 std::vector<ChunkInfo> chunk_info;
442 uint32_t sample_size;
443 uint32_t sample_count;
444 std::vector<uint32_t> sizes;
452 std::vector<uint32_t> sizes;
459 std::vector<uint64_t> offsets;
471 std::vector<uint32_t> sample_number;
492 uint64_t creation_time;
493 uint64_t modification_time;
502 uint16_t graphicsmode;
503 uint16_t opcolor_red;
504 uint16_t opcolor_green;
505 uint16_t opcolor_blue;
521 std::vector<uint8_t> location;
528 std::vector<DataEntryUrl> data_entry;
549 DECLARE_BOX_METHODS(
Media);
557 DECLARE_BOX_METHODS(
Track);
568 uint64_t fragment_duration;
575 uint32_t default_sample_description_index;
576 uint32_t default_sample_duration;
577 uint32_t default_sample_size;
578 uint32_t default_sample_flags;
585 std::vector<TrackExtends> tracks;
589 DECLARE_BOX_METHODS(
Movie);
594 std::vector<Track> tracks;
595 std::vector<ProtectionSystemSpecificHeader> pssh;
601 uint64_t decode_time;
607 uint32_t sequence_number;
611 enum TrackFragmentFlagsMasks {
612 kBaseDataOffsetPresentMask = 0x000001,
613 kSampleDescriptionIndexPresentMask = 0x000002,
614 kDefaultSampleDurationPresentMask = 0x000008,
615 kDefaultSampleSizePresentMask = 0x000010,
616 kDefaultSampleFlagsPresentMask = 0x000020,
617 kDurationIsEmptyMask = 0x010000,
618 kDefaultBaseIsMoofMask = 0x020000,
621 enum SampleFlagsMasks {
622 kReservedMask = 0xFC000000,
623 kSampleDependsOnMask = 0x03000000,
624 kSampleIsDependedOnMask = 0x00C00000,
625 kSampleHasRedundancyMask = 0x00300000,
626 kSamplePaddingValueMask = 0x000E0000,
627 kNonKeySampleMask = 0x00010000,
628 kSampleDegradationPriorityMask = 0x0000FFFF,
634 uint32_t sample_description_index;
635 uint32_t default_sample_duration;
636 uint32_t default_sample_size;
637 uint32_t default_sample_flags;
641 enum TrackFragmentFlagsMasks {
642 kDataOffsetPresentMask = 0x000001,
643 kFirstSampleFlagsPresentMask = 0x000004,
644 kSampleDurationPresentMask = 0x000100,
645 kSampleSizePresentMask = 0x000200,
646 kSampleFlagsPresentMask = 0x000400,
647 kSampleCompTimeOffsetsPresentMask = 0x000800,
652 uint32_t sample_count;
653 uint32_t data_offset;
654 std::vector<uint32_t> sample_flags;
655 std::vector<uint32_t> sample_sizes;
656 std::vector<uint32_t> sample_durations;
657 std::vector<int64_t> sample_composition_time_offsets;
661 enum GroupDescriptionIndexBase {
662 kTrackGroupDescriptionIndexBase = 0,
663 kTrackFragmentGroupDescriptionIndexBase = 0x10000,
666 uint32_t sample_count;
667 uint32_t group_description_index;
673 uint32_t grouping_type;
674 uint32_t grouping_type_parameter;
675 std::vector<SampleToGroupEntry> entries;
684 std::vector<uint8_t> key_id;
690 uint32_t grouping_type;
691 std::vector<CencSampleEncryptionInfoEntry> entries;
698 std::vector<TrackFragmentRun> runs;
699 bool decode_time_absent;
712 std::vector<TrackFragment> tracks;
713 std::vector<ProtectionSystemSpecificHeader> pssh;
728 uint32_t referenced_size;
729 uint32_t subsegment_duration;
730 bool starts_with_sap;
732 uint32_t sap_delta_time;
735 uint64_t earliest_presentation_time;
741 uint32_t reference_id;
743 uint64_t earliest_presentation_time;
744 uint64_t first_offset;
745 std::vector<SegmentReference> references;
762 std::string cue_current_time;
772 std::string settings;
777 std::string cue_text;
786 std::string cue_additional_text;
805 #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