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;
384 uint16_t data_reference_index;
398 std::vector<VideoSampleEntry> video_entries;
399 std::vector<AudioSampleEntry> audio_entries;
400 std::vector<TextSampleEntry> text_entries;
404 uint32_t sample_count;
405 uint32_t sample_delta;
412 std::vector<DecodingTime> decoding_time;
416 uint32_t sample_count;
420 int64_t sample_offset;
427 std::vector<CompositionOffset> composition_offset;
431 uint32_t first_chunk;
432 uint32_t samples_per_chunk;
433 uint32_t sample_description_index;
440 std::vector<ChunkInfo> chunk_info;
447 uint32_t sample_size;
448 uint32_t sample_count;
449 std::vector<uint32_t> sizes;
457 std::vector<uint32_t> sizes;
464 std::vector<uint64_t> offsets;
476 std::vector<uint32_t> sample_number;
497 uint64_t creation_time;
498 uint64_t modification_time;
507 uint16_t graphicsmode;
508 uint16_t opcolor_red;
509 uint16_t opcolor_green;
510 uint16_t opcolor_blue;
526 std::vector<uint8_t> location;
533 std::vector<DataEntryUrl> data_entry;
554 DECLARE_BOX_METHODS(
Media);
562 DECLARE_BOX_METHODS(
Track);
573 uint64_t fragment_duration;
580 uint32_t default_sample_description_index;
581 uint32_t default_sample_duration;
582 uint32_t default_sample_size;
583 uint32_t default_sample_flags;
590 std::vector<TrackExtends> tracks;
594 DECLARE_BOX_METHODS(
Movie);
599 std::vector<Track> tracks;
600 std::vector<ProtectionSystemSpecificHeader> pssh;
606 uint64_t decode_time;
612 uint32_t sequence_number;
616 enum TrackFragmentFlagsMasks {
617 kBaseDataOffsetPresentMask = 0x000001,
618 kSampleDescriptionIndexPresentMask = 0x000002,
619 kDefaultSampleDurationPresentMask = 0x000008,
620 kDefaultSampleSizePresentMask = 0x000010,
621 kDefaultSampleFlagsPresentMask = 0x000020,
622 kDurationIsEmptyMask = 0x010000,
623 kDefaultBaseIsMoofMask = 0x020000,
626 enum SampleFlagsMasks {
627 kReservedMask = 0xFC000000,
628 kSampleDependsOnMask = 0x03000000,
629 kSampleIsDependedOnMask = 0x00C00000,
630 kSampleHasRedundancyMask = 0x00300000,
631 kSamplePaddingValueMask = 0x000E0000,
632 kNonKeySampleMask = 0x00010000,
633 kSampleDegradationPriorityMask = 0x0000FFFF,
639 uint32_t sample_description_index;
640 uint32_t default_sample_duration;
641 uint32_t default_sample_size;
642 uint32_t default_sample_flags;
646 enum TrackFragmentFlagsMasks {
647 kDataOffsetPresentMask = 0x000001,
648 kFirstSampleFlagsPresentMask = 0x000004,
649 kSampleDurationPresentMask = 0x000100,
650 kSampleSizePresentMask = 0x000200,
651 kSampleFlagsPresentMask = 0x000400,
652 kSampleCompTimeOffsetsPresentMask = 0x000800,
657 uint32_t sample_count;
658 uint32_t data_offset;
659 std::vector<uint32_t> sample_flags;
660 std::vector<uint32_t> sample_sizes;
661 std::vector<uint32_t> sample_durations;
662 std::vector<int64_t> sample_composition_time_offsets;
666 enum GroupDescriptionIndexBase {
667 kTrackGroupDescriptionIndexBase = 0,
668 kTrackFragmentGroupDescriptionIndexBase = 0x10000,
671 uint32_t sample_count;
672 uint32_t group_description_index;
678 uint32_t grouping_type;
679 uint32_t grouping_type_parameter;
680 std::vector<SampleToGroupEntry> entries;
689 std::vector<uint8_t> key_id;
695 uint32_t grouping_type;
696 std::vector<CencSampleEncryptionInfoEntry> entries;
703 std::vector<TrackFragmentRun> runs;
704 bool decode_time_absent;
717 std::vector<TrackFragment> tracks;
718 std::vector<ProtectionSystemSpecificHeader> pssh;
733 uint32_t referenced_size;
734 uint32_t subsegment_duration;
735 bool starts_with_sap;
737 uint32_t sap_delta_time;
740 uint64_t earliest_presentation_time;
746 uint32_t reference_id;
748 uint64_t earliest_presentation_time;
749 uint64_t first_offset;
750 std::vector<SegmentReference> references;
767 std::string cue_current_time;
777 std::string settings;
782 std::string cue_text;
791 std::string cue_additional_text;
810 #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