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 FourCC GetActualFormat()
const {
316 return format == FOURCC_ENCA ? sinf.format.format : format;
320 uint16_t data_reference_index;
321 uint16_t channelcount;
337 std::string source_label;
343 uint16_t data_reference_index;
356 std::vector<VideoSampleEntry> video_entries;
357 std::vector<AudioSampleEntry> audio_entries;
358 std::vector<WVTTSampleEntry> wvtt_entries;
362 uint32_t sample_count;
363 uint32_t sample_delta;
370 std::vector<DecodingTime> decoding_time;
374 uint32_t sample_count;
378 int64_t sample_offset;
385 std::vector<CompositionOffset> composition_offset;
389 uint32_t first_chunk;
390 uint32_t samples_per_chunk;
391 uint32_t sample_description_index;
398 std::vector<ChunkInfo> chunk_info;
405 uint32_t sample_size;
406 uint32_t sample_count;
407 std::vector<uint32_t> sizes;
415 std::vector<uint32_t> sizes;
422 std::vector<uint64_t> offsets;
434 std::vector<uint32_t> sample_number;
455 uint64_t creation_time;
456 uint64_t modification_time;
465 uint16_t graphicsmode;
466 uint16_t opcolor_red;
467 uint16_t opcolor_green;
468 uint16_t opcolor_blue;
484 std::vector<uint8_t> location;
491 std::vector<DataEntryUrl> data_entry;
512 DECLARE_BOX_METHODS(
Media);
520 DECLARE_BOX_METHODS(
Track);
531 uint64_t fragment_duration;
538 uint32_t default_sample_description_index;
539 uint32_t default_sample_duration;
540 uint32_t default_sample_size;
541 uint32_t default_sample_flags;
548 std::vector<TrackExtends> tracks;
552 DECLARE_BOX_METHODS(
Movie);
557 std::vector<Track> tracks;
558 std::vector<ProtectionSystemSpecificHeader> pssh;
564 uint64_t decode_time;
570 uint32_t sequence_number;
574 enum TrackFragmentFlagsMasks {
575 kBaseDataOffsetPresentMask = 0x000001,
576 kSampleDescriptionIndexPresentMask = 0x000002,
577 kDefaultSampleDurationPresentMask = 0x000008,
578 kDefaultSampleSizePresentMask = 0x000010,
579 kDefaultSampleFlagsPresentMask = 0x000020,
580 kDurationIsEmptyMask = 0x010000,
581 kDefaultBaseIsMoofMask = 0x020000,
584 enum SampleFlagsMasks {
585 kReservedMask = 0xFC000000,
586 kSampleDependsOnMask = 0x03000000,
587 kSampleIsDependedOnMask = 0x00C00000,
588 kSampleHasRedundancyMask = 0x00300000,
589 kSamplePaddingValueMask = 0x000E0000,
590 kNonKeySampleMask = 0x00010000,
591 kSampleDegradationPriorityMask = 0x0000FFFF,
597 uint32_t sample_description_index;
598 uint32_t default_sample_duration;
599 uint32_t default_sample_size;
600 uint32_t default_sample_flags;
604 enum TrackFragmentFlagsMasks {
605 kDataOffsetPresentMask = 0x000001,
606 kFirstSampleFlagsPresentMask = 0x000004,
607 kSampleDurationPresentMask = 0x000100,
608 kSampleSizePresentMask = 0x000200,
609 kSampleFlagsPresentMask = 0x000400,
610 kSampleCompTimeOffsetsPresentMask = 0x000800,
615 uint32_t sample_count;
616 uint32_t data_offset;
617 std::vector<uint32_t> sample_flags;
618 std::vector<uint32_t> sample_sizes;
619 std::vector<uint32_t> sample_durations;
620 std::vector<int64_t> sample_composition_time_offsets;
624 enum GroupDescriptionIndexBase {
625 kTrackGroupDescriptionIndexBase = 0,
626 kTrackFragmentGroupDescriptionIndexBase = 0x10000,
629 uint32_t sample_count;
630 uint32_t group_description_index;
636 uint32_t grouping_type;
637 uint32_t grouping_type_parameter;
638 std::vector<SampleToGroupEntry> entries;
647 std::vector<uint8_t> key_id;
653 uint32_t grouping_type;
654 std::vector<CencSampleEncryptionInfoEntry> entries;
661 std::vector<TrackFragmentRun> runs;
662 bool decode_time_absent;
675 std::vector<TrackFragment> tracks;
676 std::vector<ProtectionSystemSpecificHeader> pssh;
691 uint32_t referenced_size;
692 uint32_t subsegment_duration;
693 bool starts_with_sap;
695 uint32_t sap_delta_time;
698 uint64_t earliest_presentation_time;
704 uint32_t reference_id;
706 uint64_t earliest_presentation_time;
707 uint64_t first_offset;
708 std::vector<SegmentReference> references;
725 std::string cue_current_time;
735 std::string settings;
740 std::string cue_text;
749 std::string cue_additional_text;
768 #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