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;
321 std::vector<uint8_t> data;
327 FourCC GetActualFormat()
const {
328 return format == FOURCC_ENCA ? sinf.format.format : format;
332 uint16_t data_reference_index;
333 uint16_t channelcount;
352 std::string source_label;
362 uint16_t data_reference_index;
376 std::vector<VideoSampleEntry> video_entries;
377 std::vector<AudioSampleEntry> audio_entries;
378 std::vector<TextSampleEntry> text_entries;
382 uint32_t sample_count;
383 uint32_t sample_delta;
390 std::vector<DecodingTime> decoding_time;
394 uint32_t sample_count;
398 int64_t sample_offset;
405 std::vector<CompositionOffset> composition_offset;
409 uint32_t first_chunk;
410 uint32_t samples_per_chunk;
411 uint32_t sample_description_index;
418 std::vector<ChunkInfo> chunk_info;
425 uint32_t sample_size;
426 uint32_t sample_count;
427 std::vector<uint32_t> sizes;
435 std::vector<uint32_t> sizes;
442 std::vector<uint64_t> offsets;
454 std::vector<uint32_t> sample_number;
475 uint64_t creation_time;
476 uint64_t modification_time;
485 uint16_t graphicsmode;
486 uint16_t opcolor_red;
487 uint16_t opcolor_green;
488 uint16_t opcolor_blue;
504 std::vector<uint8_t> location;
511 std::vector<DataEntryUrl> data_entry;
532 DECLARE_BOX_METHODS(
Media);
540 DECLARE_BOX_METHODS(
Track);
551 uint64_t fragment_duration;
558 uint32_t default_sample_description_index;
559 uint32_t default_sample_duration;
560 uint32_t default_sample_size;
561 uint32_t default_sample_flags;
568 std::vector<TrackExtends> tracks;
572 DECLARE_BOX_METHODS(
Movie);
577 std::vector<Track> tracks;
578 std::vector<ProtectionSystemSpecificHeader> pssh;
584 uint64_t decode_time;
590 uint32_t sequence_number;
594 enum TrackFragmentFlagsMasks {
595 kBaseDataOffsetPresentMask = 0x000001,
596 kSampleDescriptionIndexPresentMask = 0x000002,
597 kDefaultSampleDurationPresentMask = 0x000008,
598 kDefaultSampleSizePresentMask = 0x000010,
599 kDefaultSampleFlagsPresentMask = 0x000020,
600 kDurationIsEmptyMask = 0x010000,
601 kDefaultBaseIsMoofMask = 0x020000,
604 enum SampleFlagsMasks {
605 kReservedMask = 0xFC000000,
606 kSampleDependsOnMask = 0x03000000,
607 kSampleIsDependedOnMask = 0x00C00000,
608 kSampleHasRedundancyMask = 0x00300000,
609 kSamplePaddingValueMask = 0x000E0000,
610 kNonKeySampleMask = 0x00010000,
611 kSampleDegradationPriorityMask = 0x0000FFFF,
617 uint32_t sample_description_index;
618 uint32_t default_sample_duration;
619 uint32_t default_sample_size;
620 uint32_t default_sample_flags;
624 enum TrackFragmentFlagsMasks {
625 kDataOffsetPresentMask = 0x000001,
626 kFirstSampleFlagsPresentMask = 0x000004,
627 kSampleDurationPresentMask = 0x000100,
628 kSampleSizePresentMask = 0x000200,
629 kSampleFlagsPresentMask = 0x000400,
630 kSampleCompTimeOffsetsPresentMask = 0x000800,
635 uint32_t sample_count;
636 uint32_t data_offset;
637 std::vector<uint32_t> sample_flags;
638 std::vector<uint32_t> sample_sizes;
639 std::vector<uint32_t> sample_durations;
640 std::vector<int64_t> sample_composition_time_offsets;
644 enum GroupDescriptionIndexBase {
645 kTrackGroupDescriptionIndexBase = 0,
646 kTrackFragmentGroupDescriptionIndexBase = 0x10000,
649 uint32_t sample_count;
650 uint32_t group_description_index;
656 uint32_t grouping_type;
657 uint32_t grouping_type_parameter;
658 std::vector<SampleToGroupEntry> entries;
667 std::vector<uint8_t> key_id;
673 uint32_t grouping_type;
674 std::vector<CencSampleEncryptionInfoEntry> entries;
681 std::vector<TrackFragmentRun> runs;
682 bool decode_time_absent;
695 std::vector<TrackFragment> tracks;
696 std::vector<ProtectionSystemSpecificHeader> pssh;
711 uint32_t referenced_size;
712 uint32_t subsegment_duration;
713 bool starts_with_sap;
715 uint32_t sap_delta_time;
718 uint64_t earliest_presentation_time;
724 uint32_t reference_id;
726 uint64_t earliest_presentation_time;
727 uint64_t first_offset;
728 std::vector<SegmentReference> references;
745 std::string cue_current_time;
755 std::string settings;
760 std::string cue_text;
769 std::string cue_additional_text;
788 #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