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 FourCC GetActualFormat()
const {
322 return format == FOURCC_ENCA ? sinf.format.format : format;
326 uint16_t data_reference_index;
327 uint16_t channelcount;
344 std::string source_label;
350 uint16_t data_reference_index;
363 std::vector<VideoSampleEntry> video_entries;
364 std::vector<AudioSampleEntry> audio_entries;
365 std::vector<WVTTSampleEntry> wvtt_entries;
369 uint32_t sample_count;
370 uint32_t sample_delta;
377 std::vector<DecodingTime> decoding_time;
381 uint32_t sample_count;
385 int64_t sample_offset;
392 std::vector<CompositionOffset> composition_offset;
396 uint32_t first_chunk;
397 uint32_t samples_per_chunk;
398 uint32_t sample_description_index;
405 std::vector<ChunkInfo> chunk_info;
412 uint32_t sample_size;
413 uint32_t sample_count;
414 std::vector<uint32_t> sizes;
422 std::vector<uint32_t> sizes;
429 std::vector<uint64_t> offsets;
441 std::vector<uint32_t> sample_number;
462 uint64_t creation_time;
463 uint64_t modification_time;
472 uint16_t graphicsmode;
473 uint16_t opcolor_red;
474 uint16_t opcolor_green;
475 uint16_t opcolor_blue;
491 std::vector<uint8_t> location;
498 std::vector<DataEntryUrl> data_entry;
519 DECLARE_BOX_METHODS(
Media);
527 DECLARE_BOX_METHODS(
Track);
538 uint64_t fragment_duration;
545 uint32_t default_sample_description_index;
546 uint32_t default_sample_duration;
547 uint32_t default_sample_size;
548 uint32_t default_sample_flags;
555 std::vector<TrackExtends> tracks;
559 DECLARE_BOX_METHODS(
Movie);
564 std::vector<Track> tracks;
565 std::vector<ProtectionSystemSpecificHeader> pssh;
571 uint64_t decode_time;
577 uint32_t sequence_number;
581 enum TrackFragmentFlagsMasks {
582 kBaseDataOffsetPresentMask = 0x000001,
583 kSampleDescriptionIndexPresentMask = 0x000002,
584 kDefaultSampleDurationPresentMask = 0x000008,
585 kDefaultSampleSizePresentMask = 0x000010,
586 kDefaultSampleFlagsPresentMask = 0x000020,
587 kDurationIsEmptyMask = 0x010000,
588 kDefaultBaseIsMoofMask = 0x020000,
591 enum SampleFlagsMasks {
592 kReservedMask = 0xFC000000,
593 kSampleDependsOnMask = 0x03000000,
594 kSampleIsDependedOnMask = 0x00C00000,
595 kSampleHasRedundancyMask = 0x00300000,
596 kSamplePaddingValueMask = 0x000E0000,
597 kNonKeySampleMask = 0x00010000,
598 kSampleDegradationPriorityMask = 0x0000FFFF,
604 uint32_t sample_description_index;
605 uint32_t default_sample_duration;
606 uint32_t default_sample_size;
607 uint32_t default_sample_flags;
611 enum TrackFragmentFlagsMasks {
612 kDataOffsetPresentMask = 0x000001,
613 kFirstSampleFlagsPresentMask = 0x000004,
614 kSampleDurationPresentMask = 0x000100,
615 kSampleSizePresentMask = 0x000200,
616 kSampleFlagsPresentMask = 0x000400,
617 kSampleCompTimeOffsetsPresentMask = 0x000800,
622 uint32_t sample_count;
623 uint32_t data_offset;
624 std::vector<uint32_t> sample_flags;
625 std::vector<uint32_t> sample_sizes;
626 std::vector<uint32_t> sample_durations;
627 std::vector<int64_t> sample_composition_time_offsets;
631 enum GroupDescriptionIndexBase {
632 kTrackGroupDescriptionIndexBase = 0,
633 kTrackFragmentGroupDescriptionIndexBase = 0x10000,
636 uint32_t sample_count;
637 uint32_t group_description_index;
643 uint32_t grouping_type;
644 uint32_t grouping_type_parameter;
645 std::vector<SampleToGroupEntry> entries;
654 std::vector<uint8_t> key_id;
660 uint32_t grouping_type;
661 std::vector<CencSampleEncryptionInfoEntry> entries;
668 std::vector<TrackFragmentRun> runs;
669 bool decode_time_absent;
682 std::vector<TrackFragment> tracks;
683 std::vector<ProtectionSystemSpecificHeader> pssh;
698 uint32_t referenced_size;
699 uint32_t subsegment_duration;
700 bool starts_with_sap;
702 uint32_t sap_delta_time;
705 uint64_t earliest_presentation_time;
711 uint32_t reference_id;
713 uint64_t earliest_presentation_time;
714 uint64_t first_offset;
715 std::vector<SegmentReference> references;
732 std::string cue_current_time;
742 std::string settings;
747 std::string cue_text;
756 std::string cue_additional_text;
775 #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