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 std::vector<uint8_t> data;
277 FourCC GetActualFormat()
const {
278 return format == FOURCC_ENCA ? sinf.format.format : format;
282 uint16_t data_reference_index;
283 uint16_t channelcount;
299 std::string source_label;
305 uint16_t data_reference_index;
318 std::vector<VideoSampleEntry> video_entries;
319 std::vector<AudioSampleEntry> audio_entries;
320 std::vector<WVTTSampleEntry> wvtt_entries;
324 uint32_t sample_count;
325 uint32_t sample_delta;
332 std::vector<DecodingTime> decoding_time;
336 uint32_t sample_count;
340 int64_t sample_offset;
347 std::vector<CompositionOffset> composition_offset;
351 uint32_t first_chunk;
352 uint32_t samples_per_chunk;
353 uint32_t sample_description_index;
360 std::vector<ChunkInfo> chunk_info;
367 uint32_t sample_size;
368 uint32_t sample_count;
369 std::vector<uint32_t> sizes;
377 std::vector<uint32_t> sizes;
384 std::vector<uint64_t> offsets;
396 std::vector<uint32_t> sample_number;
417 uint64_t creation_time;
418 uint64_t modification_time;
428 uint16_t graphicsmode;
429 uint16_t opcolor_red;
430 uint16_t opcolor_green;
431 uint16_t opcolor_blue;
447 std::vector<uint8_t> location;
454 std::vector<DataEntryUrl> data_entry;
475 DECLARE_BOX_METHODS(
Media);
483 DECLARE_BOX_METHODS(
Track);
494 uint64_t fragment_duration;
501 uint32_t default_sample_description_index;
502 uint32_t default_sample_duration;
503 uint32_t default_sample_size;
504 uint32_t default_sample_flags;
511 std::vector<TrackExtends> tracks;
515 DECLARE_BOX_METHODS(
Movie);
519 std::vector<Track> tracks;
520 std::vector<ProtectionSystemSpecificHeader> pssh;
526 uint64_t decode_time;
532 uint32_t sequence_number;
536 enum TrackFragmentFlagsMasks {
537 kBaseDataOffsetPresentMask = 0x000001,
538 kSampleDescriptionIndexPresentMask = 0x000002,
539 kDefaultSampleDurationPresentMask = 0x000008,
540 kDefaultSampleSizePresentMask = 0x000010,
541 kDefaultSampleFlagsPresentMask = 0x000020,
542 kDurationIsEmptyMask = 0x010000,
543 kDefaultBaseIsMoofMask = 0x020000,
546 enum SampleFlagsMasks {
547 kReservedMask = 0xFC000000,
548 kSampleDependsOnMask = 0x03000000,
549 kSampleIsDependedOnMask = 0x00C00000,
550 kSampleHasRedundancyMask = 0x00300000,
551 kSamplePaddingValueMask = 0x000E0000,
552 kNonKeySampleMask = 0x00010000,
553 kSampleDegradationPriorityMask = 0x0000FFFF,
559 uint32_t sample_description_index;
560 uint32_t default_sample_duration;
561 uint32_t default_sample_size;
562 uint32_t default_sample_flags;
566 enum TrackFragmentFlagsMasks {
567 kDataOffsetPresentMask = 0x000001,
568 kFirstSampleFlagsPresentMask = 0x000004,
569 kSampleDurationPresentMask = 0x000100,
570 kSampleSizePresentMask = 0x000200,
571 kSampleFlagsPresentMask = 0x000400,
572 kSampleCompTimeOffsetsPresentMask = 0x000800,
577 uint32_t sample_count;
578 uint32_t data_offset;
579 std::vector<uint32_t> sample_flags;
580 std::vector<uint32_t> sample_sizes;
581 std::vector<uint32_t> sample_durations;
582 std::vector<int64_t> sample_composition_time_offsets;
586 enum GroupDescriptionIndexBase {
587 kTrackGroupDescriptionIndexBase = 0,
588 kTrackFragmentGroupDescriptionIndexBase = 0x10000,
591 uint32_t sample_count;
592 uint32_t group_description_index;
598 uint32_t grouping_type;
599 uint32_t grouping_type_parameter;
600 std::vector<SampleToGroupEntry> entries;
609 std::vector<uint8_t> key_id;
615 uint32_t grouping_type;
616 std::vector<CencSampleEncryptionInfoEntry> entries;
623 std::vector<TrackFragmentRun> runs;
624 bool decode_time_absent;
637 std::vector<TrackFragment> tracks;
638 std::vector<ProtectionSystemSpecificHeader> pssh;
653 uint32_t referenced_size;
654 uint32_t subsegment_duration;
655 bool starts_with_sap;
657 uint32_t sap_delta_time;
660 uint64_t earliest_presentation_time;
666 uint32_t reference_id;
668 uint64_t earliest_presentation_time;
669 uint64_t first_offset;
670 std::vector<SegmentReference> references;
687 std::string cue_current_time;
697 std::string settings;
702 std::string cue_text;
711 std::string cue_additional_text;
730 #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