Shaka Packager SDK
box_definitions.h
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef PACKAGER_MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_
6 #define PACKAGER_MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_
7 
8 #include <vector>
9 
10 #include "packager/media/base/decrypt_config.h"
11 #include "packager/media/base/fourccs.h"
12 #include "packager/media/codecs/aac_audio_specific_config.h"
13 #include "packager/media/codecs/es_descriptor.h"
14 #include "packager/media/formats/mp4/box.h"
15 
16 namespace shaka {
17 namespace media {
18 
19 class BufferReader;
20 
21 namespace mp4 {
22 
23 enum TrackType {
24  kInvalid = 0,
25  kVideo,
26  kAudio,
27  kHint,
28  kText,
29  kSubtitle,
30 };
31 
32 class BoxBuffer;
33 
34 #define DECLARE_BOX_METHODS(T) \
35  public: \
36  T(); \
37  ~T() override; \
38  \
39  FourCC BoxType() const override; \
40  \
41  private: \
42  bool ReadWriteInternal(BoxBuffer* buffer) override; \
43  size_t ComputeSizeInternal() override; \
44  \
45  public:
46 
47 struct FileType : Box {
48  DECLARE_BOX_METHODS(FileType);
49 
50  FourCC major_brand = FOURCC_NULL;
51  uint32_t minor_version = 0;
52  std::vector<FourCC> compatible_brands;
53 };
54 
56  FourCC BoxType() const override;
57 };
58 
60  DECLARE_BOX_METHODS(ProtectionSystemSpecificHeader);
61 
62  std::vector<uint8_t> raw_box;
63 };
64 
66  DECLARE_BOX_METHODS(SampleAuxiliaryInformationOffset);
67 
68  std::vector<uint64_t> offsets;
69 };
70 
72  DECLARE_BOX_METHODS(SampleAuxiliaryInformationSize);
73 
74  uint8_t default_sample_info_size = 0;
75  uint32_t sample_count = 0;
76  std::vector<uint8_t> sample_info_sizes;
77 };
78 
86  bool ReadWrite(uint8_t iv_size, bool has_subsamples, BoxBuffer* buffer);
93  bool ParseFromBuffer(uint8_t iv_size,
94  bool has_subsamples,
95  BufferReader* reader);
97  uint32_t ComputeSize() const;
100  uint32_t GetTotalSizeOfSubsamples() const;
101 
102  std::vector<uint8_t> initialization_vector;
103  std::vector<SubsampleEntry> subsamples;
104 };
105 
107  static const uint8_t kInvalidIvSize = 1;
108 
109  enum SampleEncryptionFlags {
110  kUseSubsampleEncryption = 2,
111  };
112 
113  DECLARE_BOX_METHODS(SampleEncryption);
120  uint8_t iv_size,
121  std::vector<SampleEncryptionEntry>* sample_encryption_entries) const;
122 
125  std::vector<uint8_t> sample_encryption_data;
126 
127  uint8_t iv_size = kInvalidIvSize;
128  std::vector<SampleEncryptionEntry> sample_encryption_entries;
129 };
130 
131 struct OriginalFormat : Box {
132  DECLARE_BOX_METHODS(OriginalFormat);
133 
134  FourCC format = FOURCC_NULL;
135 };
136 
137 struct SchemeType : FullBox {
138  DECLARE_BOX_METHODS(SchemeType);
139 
140  FourCC type = FOURCC_NULL;
141  uint32_t version = 0u;
142 };
143 
145  DECLARE_BOX_METHODS(TrackEncryption);
146 
147  uint8_t default_is_protected = 0;
148  uint8_t default_per_sample_iv_size = 0;
149  // Default to a vector of 16 zeros.
150  std::vector<uint8_t> default_kid = std::vector<uint8_t>(16, 0);
151 
152  // For pattern-based encryption.
153  uint8_t default_crypt_byte_block = 0;
154  uint8_t default_skip_byte_block = 0;
155 
156  // Present only if
157  // |default_is_protected == 1 && default_per_sample_iv_size == 0|.
158  std::vector<uint8_t> default_constant_iv;
159 };
160 
161 struct SchemeInfo : Box {
162  DECLARE_BOX_METHODS(SchemeInfo);
163 
164  TrackEncryption track_encryption;
165 };
166 
168  DECLARE_BOX_METHODS(ProtectionSchemeInfo);
169 
170  OriginalFormat format;
171  SchemeType type;
172  SchemeInfo info;
173 };
174 
176  DECLARE_BOX_METHODS(MovieHeader);
177 
178  uint64_t creation_time = 0;
179  uint64_t modification_time = 0;
180  uint32_t timescale = 0;
181  uint64_t duration = 0;
182  int32_t rate = 1 << 16;
183  int16_t volume = 1 << 8;
184  uint32_t next_track_id = 0;
185 };
186 
188  enum TrackHeaderFlags {
189  kTrackEnabled = 0x000001,
190  kTrackInMovie = 0x000002,
191  kTrackInPreview = 0x000004,
192  };
193 
194  DECLARE_BOX_METHODS(TrackHeader);
195 
196  uint64_t creation_time = 0;
197  uint64_t modification_time = 0;
198  uint32_t track_id = 0;
199  uint64_t duration = 0;
200  int16_t layer = 0;
201  int16_t alternate_group = 0;
202  int16_t volume = -1;
203  // width and height specify the track's visual presentation size as
204  // fixed-point 16.16 values.
205  uint32_t width = 0;
206  uint32_t height = 0;
207 };
208 
210  uint64_t segment_duration = 0;
211  int64_t media_time = 0;
212  int16_t media_rate_integer = 0;
213  int16_t media_rate_fraction = 0;
214 };
215 
216 struct EditList : FullBox {
217  DECLARE_BOX_METHODS(EditList);
218 
219  std::vector<EditListEntry> edits;
220 };
221 
222 struct Edit : Box {
223  DECLARE_BOX_METHODS(Edit);
224 
225  EditList list;
226 };
227 
229  DECLARE_BOX_METHODS(HandlerReference);
230 
231  FourCC handler_type = FOURCC_NULL;
232 };
233 
234 struct Language {
235  bool ReadWrite(BoxBuffer* buffer);
236  uint32_t ComputeSize() const;
237 
238  std::string code;
239 };
240 
242 struct ID3v2 : FullBox {
243  DECLARE_BOX_METHODS(ID3v2);
244 
245  Language language;
246  std::vector<uint8_t> id3v2_data;
247 };
248 
249 struct Metadata : FullBox {
250  DECLARE_BOX_METHODS(Metadata);
251 
252  HandlerReference handler;
253  ID3v2 id3v2;
254 };
255 
256 // This defines a common structure for various CodecConfiguration boxes:
257 // AVCConfiguration, HEVCConfiguration and VPCodecConfiguration.
258 // Note that unlike the other two CodecConfiguration boxes, VPCodecConfiguration
259 // box inherits from FullBox instead of Box, according to VP Codec ISO Media
260 // File Format Binding specification. It will be handled properly in the
261 // implementation.
263  DECLARE_BOX_METHODS(CodecConfiguration);
264 
265  FourCC box_type = FOURCC_NULL;
266  // Contains full codec configuration record, including possible extension
267  // boxes.
268  std::vector<uint8_t> data;
269 };
270 
272  DECLARE_BOX_METHODS(PixelAspectRatio);
273 
274  uint32_t h_spacing = 0u;
275  uint32_t v_spacing = 0u;
276 };
277 
279  DECLARE_BOX_METHODS(VideoSampleEntry);
280 
281  // Returns actual format of this sample entry.
282  FourCC GetActualFormat() const {
283  return format == FOURCC_encv ? sinf.format.format : format;
284  }
285  // Returns the box type of codec configuration box from video format.
286  FourCC GetCodecConfigurationBoxType(FourCC format) const;
287 
288  // Convert |extra_codec_configs| to vector.
289  std::vector<uint8_t> ExtraCodecConfigsAsVector() const;
290  // Parse |extra_codec_configs| from vector.
291  bool ParseExtraCodecConfigsVector(const std::vector<uint8_t>& data);
292 
293  FourCC format = FOURCC_NULL;
294  // data_reference_index is 1-based and "dref" box is mandatory so it is
295  // always present.
296  uint16_t data_reference_index = 1u;
297  uint16_t width = 0u;
298  uint16_t height = 0u;
299 
300  PixelAspectRatio pixel_aspect;
302  CodecConfiguration codec_configuration;
303  // Some codecs, e.g. Dolby Vision, have extra codec configuration boxes that
304  // need to be propagated to muxers.
305  std::vector<CodecConfiguration> extra_codec_configs;
306 };
307 
309  DECLARE_BOX_METHODS(ElementaryStreamDescriptor);
310 
311  AACAudioSpecificConfig aac_audio_specific_config;
312  ESDescriptor es_descriptor;
313 };
314 
315 struct DTSSpecific : Box {
316  DECLARE_BOX_METHODS(DTSSpecific);
317 
318  uint32_t sampling_frequency = 0u;
319  uint32_t max_bitrate = 0u;
320  uint32_t avg_bitrate = 0u;
321  uint8_t pcm_sample_depth = 0u;
322  std::vector<uint8_t> extra_data;
323 };
324 
325 struct AC3Specific : Box {
326  DECLARE_BOX_METHODS(AC3Specific);
327 
328  std::vector<uint8_t> data;
329 };
330 
331 struct EC3Specific : Box {
332  DECLARE_BOX_METHODS(EC3Specific);
333 
334  std::vector<uint8_t> data;
335 };
336 
337 struct AC4Specific : Box {
338  DECLARE_BOX_METHODS(AC4Specific);
339 
340  std::vector<uint8_t> data;
341 };
342 
343 struct OpusSpecific : Box {
344  DECLARE_BOX_METHODS(OpusSpecific);
345 
346  std::vector<uint8_t> opus_identification_header;
347  // The number of priming samples. Extracted from |opus_identification_header|.
348  uint16_t preskip = 0u;
349 };
350 
351 // FLAC specific decoder configuration box:
352 // https://github.com/xiph/flac/blob/master/doc/isoflac.txt
353 // We do not care about the actual data inside, which is simply copied over.
355  DECLARE_BOX_METHODS(FlacSpecific);
356 
357  std::vector<uint8_t> data;
358 };
359 
361  DECLARE_BOX_METHODS(AudioSampleEntry);
362 
363  // Returns actual format of this sample entry.
364  FourCC GetActualFormat() const {
365  return format == FOURCC_enca ? sinf.format.format : format;
366  }
367 
368  FourCC format = FOURCC_NULL;
369  // data_reference_index is 1-based and "dref" box is mandatory so it is
370  // always present.
371  uint16_t data_reference_index = 1u;
372  uint16_t channelcount = 2u;
373  uint16_t samplesize = 16u;
374  uint32_t samplerate = 0u;
375 
377 
379  DTSSpecific ddts;
380  AC3Specific dac3;
381  EC3Specific dec3;
382  AC4Specific dac4;
383  OpusSpecific dops;
384  FlacSpecific dfla;
385 };
386 
388  DECLARE_BOX_METHODS(WebVTTConfigurationBox);
389 
390  std::string config;
391 };
392 
394  DECLARE_BOX_METHODS(WebVTTSourceLabelBox);
395 
396  std::string source_label;
397 };
398 
400  DECLARE_BOX_METHODS(TextSampleEntry);
401 
402  // Specifies fourcc of this sample entry. It needs to be set on write, e.g.
403  // set to 'wvtt' to write WVTTSampleEntry; On read, it is recovered from box
404  // header.
405  FourCC format = FOURCC_NULL;
406 
407  // data_reference_index is 1-based and "dref" box is mandatory so it is
408  // always present.
409  uint16_t data_reference_index = 1u;
410 
411  // Sub fields for ttml text sample entry.
412  std::string namespace_;
413  std::string schema_location;
414  // Optional MPEG4BitRateBox.
415 
416  // Sub boxes for wvtt text sample entry.
417  WebVTTConfigurationBox config;
418  WebVTTSourceLabelBox label;
419  // Optional MPEG4BitRateBox.
420 };
421 
423  DECLARE_BOX_METHODS(SampleDescription);
424 
425  TrackType type = kInvalid;
426  // TODO(kqyang): Clean up the code to have one single member, e.g. by creating
427  // SampleEntry struct, std::vector<SampleEntry> sample_entries.
428  std::vector<VideoSampleEntry> video_entries;
429  std::vector<AudioSampleEntry> audio_entries;
430  std::vector<TextSampleEntry> text_entries;
431 };
432 
433 struct DecodingTime {
434  uint32_t sample_count;
435  uint32_t sample_delta;
436 };
437 
438 // stts.
440  DECLARE_BOX_METHODS(DecodingTimeToSample);
441 
442  std::vector<DecodingTime> decoding_time;
443 };
444 
446  uint32_t sample_count;
447  // If version == 0, sample_offset is uint32_t;
448  // If version == 1, sample_offset is int32_t.
449  // Use int64_t so both can be supported properly.
450  int64_t sample_offset;
451 };
452 
453 // ctts. Optional.
455  DECLARE_BOX_METHODS(CompositionTimeToSample);
456 
457  std::vector<CompositionOffset> composition_offset;
458 };
459 
460 struct ChunkInfo {
461  uint32_t first_chunk;
462  uint32_t samples_per_chunk;
463  uint32_t sample_description_index;
464 };
465 
466 // stsc.
468  DECLARE_BOX_METHODS(SampleToChunk);
469 
470  std::vector<ChunkInfo> chunk_info;
471 };
472 
473 // stsz.
474 struct SampleSize : FullBox {
475  DECLARE_BOX_METHODS(SampleSize);
476 
477  uint32_t sample_size = 0u;
478  uint32_t sample_count = 0u;
479  std::vector<uint32_t> sizes;
480 };
481 
482 // stz2.
484  DECLARE_BOX_METHODS(CompactSampleSize);
485 
486  uint8_t field_size = 0u;
487  std::vector<uint32_t> sizes;
488 };
489 
490 // co64.
492  DECLARE_BOX_METHODS(ChunkLargeOffset);
493 
494  std::vector<uint64_t> offsets;
495 };
496 
497 // stco.
499  DECLARE_BOX_METHODS(ChunkOffset);
500 };
501 
502 // stss. Optional.
503 struct SyncSample : FullBox {
504  DECLARE_BOX_METHODS(SyncSample);
505 
506  std::vector<uint32_t> sample_number;
507 };
508 
510  bool ReadWrite(BoxBuffer* buffer);
511  uint32_t ComputeSize() const;
512 
513  uint8_t is_protected = 0u;
514  uint8_t per_sample_iv_size = 0u;
515  std::vector<uint8_t> key_id;
516 
517  // For pattern-based encryption.
518  uint8_t crypt_byte_block = 0u;
519  uint8_t skip_byte_block = 0u;
520 
521  // Present only if |is_protected == 1 && per_sample_iv_size == 0|.
522  std::vector<uint8_t> constant_iv;
523 };
524 
526  bool ReadWrite(BoxBuffer* buffer);
527  uint32_t ComputeSize() const;
528 
529  int16_t roll_distance = 0;
530 };
531 
533  DECLARE_BOX_METHODS(SampleGroupDescription);
534 
535  template <typename T>
536  bool ReadWriteEntries(BoxBuffer* buffer, std::vector<T>* entries);
537 
538  uint32_t grouping_type = 0;
539  // Only present if grouping_type == 'seig'.
540  std::vector<CencSampleEncryptionInfoEntry>
541  cenc_sample_encryption_info_entries;
542  // Only present if grouping_type == 'roll'.
543  std::vector<AudioRollRecoveryEntry> audio_roll_recovery_entries;
544 };
545 
547  enum GroupDescriptionIndexBase {
548  kTrackGroupDescriptionIndexBase = 0,
549  kTrackFragmentGroupDescriptionIndexBase = 0x10000,
550  };
551 
552  uint32_t sample_count = 0u;
553  uint32_t group_description_index = 0u;
554 };
555 
557  DECLARE_BOX_METHODS(SampleToGroup);
558 
559  uint32_t grouping_type = 0u;
560  uint32_t grouping_type_parameter = 0u; // Version 1 only.
561  std::vector<SampleToGroupEntry> entries;
562 };
563 
564 struct SampleTable : Box {
565  DECLARE_BOX_METHODS(SampleTable);
566 
567  SampleDescription description;
568  DecodingTimeToSample decoding_time_to_sample;
569  CompositionTimeToSample composition_time_to_sample;
570  SampleToChunk sample_to_chunk;
571  // Either SampleSize or CompactSampleSize must present. Store in SampleSize.
572  SampleSize sample_size;
573  // Either ChunkOffset or ChunkLargeOffset must present. Store in
574  // ChunkLargeOffset.
575  ChunkLargeOffset chunk_large_offset;
576  SyncSample sync_sample;
577  std::vector<SampleGroupDescription> sample_group_descriptions;
578  std::vector<SampleToGroup> sample_to_groups;
579 };
580 
582  DECLARE_BOX_METHODS(MediaHeader);
583 
584  uint64_t creation_time = 0u;
585  uint64_t modification_time = 0u;
586  uint32_t timescale = 0u;
587  uint64_t duration = 0u;
588  Language language;
589 };
590 
592  DECLARE_BOX_METHODS(VideoMediaHeader);
593 
594  uint16_t graphicsmode = 0u;
595  uint16_t opcolor_red = 0u;
596  uint16_t opcolor_green = 0u;
597  uint16_t opcolor_blue = 0u;
598 };
599 
601  DECLARE_BOX_METHODS(SoundMediaHeader);
602 
603  uint16_t balance = 0u;
604 };
605 
607  DECLARE_BOX_METHODS(NullMediaHeader);
608 };
609 
611  DECLARE_BOX_METHODS(SubtitleMediaHeader);
612 };
613 
615  DECLARE_BOX_METHODS(DataEntryUrl);
616 
617  std::vector<uint8_t> location;
618 };
619 
621  DECLARE_BOX_METHODS(DataReference);
622 
623  // Can be either url or urn box. Fix to url box for now.
624  std::vector<DataEntryUrl> data_entry = std::vector<DataEntryUrl>(1);
625 };
626 
628  DECLARE_BOX_METHODS(DataInformation);
629 
630  DataReference dref;
631 };
632 
634  DECLARE_BOX_METHODS(MediaInformation);
635 
636  DataInformation dinf;
637  SampleTable sample_table;
638  // Exactly one specific meida header shall be present, vmhd, smhd, hmhd, nmhd.
639  VideoMediaHeader vmhd;
640  SoundMediaHeader smhd;
641  NullMediaHeader nmhd;
642  SubtitleMediaHeader sthd;
643 };
644 
645 struct Media : Box {
646  DECLARE_BOX_METHODS(Media);
647 
648  MediaHeader header;
649  HandlerReference handler;
650  MediaInformation information;
651 };
652 
653 struct Track : Box {
654  DECLARE_BOX_METHODS(Track);
655 
656  TrackHeader header;
657  Media media;
658  Edit edit;
659  SampleEncryption sample_encryption;
660 };
661 
663  DECLARE_BOX_METHODS(MovieExtendsHeader);
664 
665  uint64_t fragment_duration = 0u;
666 };
667 
669  DECLARE_BOX_METHODS(TrackExtends);
670 
671  uint32_t track_id = 0u;
672  uint32_t default_sample_description_index = 0u;
673  uint32_t default_sample_duration = 0u;
674  uint32_t default_sample_size = 0u;
675  uint32_t default_sample_flags = 0u;
676 };
677 
678 struct MovieExtends : Box {
679  DECLARE_BOX_METHODS(MovieExtends);
680 
681  MovieExtendsHeader header;
682  std::vector<TrackExtends> tracks;
683 };
684 
685 struct Movie : Box {
686  DECLARE_BOX_METHODS(Movie);
687 
688  MovieHeader header;
689  Metadata metadata; // Used to hold version information.
690  MovieExtends extends;
691  std::vector<Track> tracks;
692  std::vector<ProtectionSystemSpecificHeader> pssh;
693 };
694 
696  DECLARE_BOX_METHODS(TrackFragmentDecodeTime);
697 
698  uint64_t decode_time = 0u;
699 };
700 
702  DECLARE_BOX_METHODS(MovieFragmentHeader);
703 
704  uint32_t sequence_number = 0u;
705 };
706 
708  enum TrackFragmentFlagsMasks {
709  kBaseDataOffsetPresentMask = 0x000001,
710  kSampleDescriptionIndexPresentMask = 0x000002,
711  kDefaultSampleDurationPresentMask = 0x000008,
712  kDefaultSampleSizePresentMask = 0x000010,
713  kDefaultSampleFlagsPresentMask = 0x000020,
714  kDurationIsEmptyMask = 0x010000,
715  kDefaultBaseIsMoofMask = 0x020000,
716  };
717 
718  enum SampleFlagsMasks {
719  kReservedMask = 0xFC000000,
720  kSampleDependsOnMask = 0x03000000,
721  kSampleIsDependedOnMask = 0x00C00000,
722  kSampleHasRedundancyMask = 0x00300000,
723  kSamplePaddingValueMask = 0x000E0000,
724  kNonKeySampleMask = 0x00010000,
725  kSampleDegradationPriorityMask = 0x0000FFFF,
726  };
727 
728  DECLARE_BOX_METHODS(TrackFragmentHeader);
729 
730  uint32_t track_id = 0u;
731  uint32_t sample_description_index = 0u;
732  uint32_t default_sample_duration = 0u;
733  uint32_t default_sample_size = 0u;
734  uint32_t default_sample_flags = 0u;
735 };
736 
738  enum TrackFragmentFlagsMasks {
739  kDataOffsetPresentMask = 0x000001,
740  kFirstSampleFlagsPresentMask = 0x000004,
741  kSampleDurationPresentMask = 0x000100,
742  kSampleSizePresentMask = 0x000200,
743  kSampleFlagsPresentMask = 0x000400,
744  kSampleCompTimeOffsetsPresentMask = 0x000800,
745  };
746 
747  DECLARE_BOX_METHODS(TrackFragmentRun);
748 
749  uint32_t sample_count = 0u;
750  uint32_t data_offset = 0u;
751  std::vector<uint32_t> sample_flags;
752  std::vector<uint32_t> sample_sizes;
753  std::vector<uint32_t> sample_durations;
754  std::vector<int64_t> sample_composition_time_offsets;
755 };
756 
757 struct TrackFragment : Box {
758  DECLARE_BOX_METHODS(TrackFragment);
759 
760  TrackFragmentHeader header;
761  std::vector<TrackFragmentRun> runs;
762  bool decode_time_absent = false;
763  TrackFragmentDecodeTime decode_time;
764  std::vector<SampleGroupDescription> sample_group_descriptions;
765  std::vector<SampleToGroup> sample_to_groups;
766  SampleAuxiliaryInformationSize auxiliary_size;
767  SampleAuxiliaryInformationOffset auxiliary_offset;
768  SampleEncryption sample_encryption;
769 };
770 
771 struct MovieFragment : Box {
772  DECLARE_BOX_METHODS(MovieFragment);
773 
774  MovieFragmentHeader header;
775  std::vector<TrackFragment> tracks;
776  std::vector<ProtectionSystemSpecificHeader> pssh;
777 };
778 
780  enum SAPType {
781  TypeUnknown = 0,
782  Type1 = 1, // T(ept) = T(dec) = T(sap) = T(ptf)
783  Type2 = 2, // T(ept) = T(dec) = T(sap) < T(ptf)
784  Type3 = 3, // T(ept) < T(dec) = T(sap) <= T(ptf)
785  Type4 = 4, // T(ept) <= T(ptf) < T(dec) = T(sap)
786  Type5 = 5, // T(ept) = T(dec) < T(sap)
787  Type6 = 6, // T(ept) < T(dec) < T(sap)
788  };
789 
790  bool reference_type = false;
791  uint32_t referenced_size = 0u;
792  uint32_t subsegment_duration = 0u;
793  bool starts_with_sap = false;
794  SAPType sap_type = TypeUnknown;
795  uint32_t sap_delta_time = 0u;
796  // We add this field to keep track of earliest_presentation_time in this
797  // subsegment. It is not part of SegmentReference.
798  uint64_t earliest_presentation_time = 0u;
799 };
800 
802  DECLARE_BOX_METHODS(SegmentIndex);
803 
804  uint32_t reference_id = 0u;
805  uint32_t timescale = 0u;
806  uint64_t earliest_presentation_time = 0u;
807  uint64_t first_offset = 0u;
808  std::vector<SegmentReference> references;
809 };
810 
811 // The actual data is parsed and written separately.
812 struct MediaData : Box {
813  DECLARE_BOX_METHODS(MediaData);
814 
815  uint32_t data_size = 0u;
816 };
817 
818 // Using negative value as "not set". It is very unlikely that 2^31 cues happen
819 // at once.
820 const int kCueSourceIdNotSet = -1;
821 
822 struct CueSourceIDBox : Box {
823  DECLARE_BOX_METHODS(CueSourceIDBox);
824 
825  int32_t source_id = kCueSourceIdNotSet;
826 };
827 
828 struct CueTimeBox : Box {
829  DECLARE_BOX_METHODS(CueTimeBox);
830 
831  std::string cue_current_time;
832 };
833 
834 struct CueIDBox : Box {
835  DECLARE_BOX_METHODS(CueIDBox);
836 
837  std::string cue_id;
838 };
839 
840 struct CueSettingsBox : Box {
841  DECLARE_BOX_METHODS(CueSettingsBox);
842 
843  std::string settings;
844 };
845 
846 struct CuePayloadBox : Box {
847  DECLARE_BOX_METHODS(CuePayloadBox);
848 
849  std::string cue_text;
850 };
851 
852 struct VTTEmptyCueBox : Box {
853  DECLARE_BOX_METHODS(VTTEmptyCueBox);
854 };
855 
857  DECLARE_BOX_METHODS(VTTAdditionalTextBox);
858 
859  std::string cue_additional_text;
860 };
861 
862 struct VTTCueBox : Box {
863  DECLARE_BOX_METHODS(VTTCueBox);
864 
865  CueSourceIDBox cue_source_id;
866  CueIDBox cue_id;
867  CueTimeBox cue_time;
868  CueSettingsBox cue_settings;
869  CuePayloadBox cue_payload;
870 };
871 
872 #undef DECLARE_BOX
873 
874 } // namespace mp4
875 } // namespace media
876 } // namespace shaka
877 
878 #endif // PACKAGER_MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_
shaka::media::mp4::AudioRollRecoveryEntry
Definition: box_definitions.h:525
shaka::media::mp4::BoxBuffer
Definition: box_buffer.h:25
shaka::media::mp4::CencSampleEncryptionInfoEntry
Definition: box_definitions.h:509
shaka::media::mp4::SoundMediaHeader
Definition: box_definitions.h:600
shaka::media::mp4::SampleEncryption::sample_encryption_data
std::vector< uint8_t > sample_encryption_data
Definition: box_definitions.h:125
shaka::media::mp4::HandlerReference
Definition: box_definitions.h:228
shaka::media::mp4::AudioSampleEntry
Definition: box_definitions.h:360
shaka::media::mp4::SampleEncryptionEntry
Definition: box_definitions.h:79
shaka::media::mp4::SampleAuxiliaryInformationOffset
Definition: box_definitions.h:65
shaka::media::mp4::SampleEncryption
Definition: box_definitions.h:106
shaka::media::mp4::NullMediaHeader
Definition: box_definitions.h:606
shaka::media::mp4::CueTimeBox
Definition: box_definitions.h:828
shaka::media::mp4::SyncSample
Definition: box_definitions.h:503
shaka::media::mp4::VTTAdditionalTextBox
Definition: box_definitions.h:856
shaka::media::mp4::DataInformation
Definition: box_definitions.h:627
shaka::media::mp4::TrackHeader
Definition: box_definitions.h:187
shaka::media::mp4::TrackEncryption
Definition: box_definitions.h:144
shaka::media::ESDescriptor
Definition: es_descriptor.h:173
shaka::media::mp4::SampleEncryptionEntry::ComputeSize
uint32_t ComputeSize() const
Definition: box_definitions.cc:304
shaka::media::mp4::MovieExtendsHeader
Definition: box_definitions.h:662
shaka::media::mp4::MediaInformation
Definition: box_definitions.h:633
shaka::media::mp4::MediaData
Definition: box_definitions.h:812
shaka::media::mp4::TrackFragmentDecodeTime
Definition: box_definitions.h:695
shaka::media::mp4::SampleToGroupEntry
Definition: box_definitions.h:546
shaka::media::mp4::MovieHeader
Definition: box_definitions.h:175
shaka
All the methods that are virtual are virtual for mocking.
Definition: gflags_hex_bytes.cc:11
shaka::media::mp4::SegmentReference
Definition: box_definitions.h:779
shaka::media::mp4::DecodingTime
Definition: box_definitions.h:433
shaka::media::mp4::SampleGroupDescription
Definition: box_definitions.h:532
shaka::media::mp4::DataEntryUrl
Definition: box_definitions.h:614
shaka::media::mp4::CueSourceIDBox
Definition: box_definitions.h:822
shaka::media::mp4::TrackExtends
Definition: box_definitions.h:668
shaka::media::mp4::TextSampleEntry
Definition: box_definitions.h:399
shaka::media::mp4::SchemeType
Definition: box_definitions.h:137
shaka::media::mp4::CuePayloadBox
Definition: box_definitions.h:846
shaka::media::mp4::ChunkLargeOffset
Definition: box_definitions.h:491
shaka::media::mp4::CueSettingsBox
Definition: box_definitions.h:840
shaka::media::mp4::TrackFragment
Definition: box_definitions.h:757
shaka::media::mp4::SchemeInfo
Definition: box_definitions.h:161
shaka::media::mp4::CodecConfiguration
Definition: box_definitions.h:262
shaka::media::mp4::EditList
Definition: box_definitions.h:216
shaka::media::mp4::ID3v2
Implemented per http://mp4ra.org/#/references.
Definition: box_definitions.h:242
shaka::media::mp4::SegmentType::BoxType
FourCC BoxType() const override
Definition: box_definitions.cc:169
shaka::media::mp4::SubtitleMediaHeader
Definition: box_definitions.h:610
shaka::media::mp4::SampleSize
Definition: box_definitions.h:474
shaka::media::mp4::EditListEntry
Definition: box_definitions.h:209
shaka::media::mp4::Language
Definition: box_definitions.h:234
shaka::media::AACAudioSpecificConfig
Definition: aac_audio_specific_config.h:23
shaka::media::mp4::VTTCueBox
Definition: box_definitions.h:862
shaka::media::mp4::WebVTTSourceLabelBox
Definition: box_definitions.h:393
shaka::media::mp4::FullBox
Definition: box.h:83
shaka::media::mp4::MovieExtends
Definition: box_definitions.h:678
shaka::media::mp4::Metadata
Definition: box_definitions.h:249
shaka::media::mp4::VideoSampleEntry
Definition: box_definitions.h:278
shaka::media::mp4::Media
Definition: box_definitions.h:645
shaka::media::mp4::ChunkOffset
Definition: box_definitions.h:498
shaka::media::mp4::SampleEncryptionEntry::ParseFromBuffer
bool ParseFromBuffer(uint8_t iv_size, bool has_subsamples, BufferReader *reader)
Definition: box_definitions.cc:279
shaka::media::mp4::ChunkInfo
Definition: box_definitions.h:460
shaka::media::mp4::OriginalFormat
Definition: box_definitions.h:131
shaka::media::mp4::SampleTable
Definition: box_definitions.h:564
shaka::media::mp4::VideoMediaHeader
Definition: box_definitions.h:591
shaka::media::mp4::Track
Definition: box_definitions.h:653
shaka::media::mp4::SegmentIndex
Definition: box_definitions.h:801
shaka::media::mp4::DataReference
Definition: box_definitions.h:620
shaka::media::mp4::ProtectionSystemSpecificHeader
Definition: box_definitions.h:59
shaka::media::mp4::ProtectionSchemeInfo
Definition: box_definitions.h:167
shaka::media::mp4::WebVTTConfigurationBox
Definition: box_definitions.h:387
shaka::media::mp4::SampleDescription
Definition: box_definitions.h:422
shaka::media::mp4::MovieFragment
Definition: box_definitions.h:771
shaka::media::mp4::Box
Definition: box.h:27
shaka::media::mp4::SampleEncryptionEntry::ReadWrite
bool ReadWrite(uint8_t iv_size, bool has_subsamples, BoxBuffer *buffer)
Definition: box_definitions.cc:255
shaka::media::mp4::ElementaryStreamDescriptor
Definition: box_definitions.h:308
shaka::media::BufferReader
Definition: buffer_reader.h:23
shaka::media::mp4::SegmentType
Definition: box_definitions.h:55
shaka::media::mp4::SampleToChunk
Definition: box_definitions.h:467
shaka::media::mp4::Edit
Definition: box_definitions.h:222
shaka::media::mp4::TrackFragmentHeader
Definition: box_definitions.h:707
shaka::media::mp4::CompactSampleSize
Definition: box_definitions.h:483
shaka::media::mp4::TrackFragmentRun
Definition: box_definitions.h:737
shaka::media::mp4::EC3Specific
Definition: box_definitions.h:331
shaka::media::mp4::MovieFragmentHeader
Definition: box_definitions.h:701
shaka::media::mp4::FlacSpecific
Definition: box_definitions.h:354
shaka::media::mp4::CueIDBox
Definition: box_definitions.h:834
shaka::media::mp4::CompositionOffset
Definition: box_definitions.h:445
shaka::media::mp4::PixelAspectRatio
Definition: box_definitions.h:271
shaka::media::mp4::AC4Specific
Definition: box_definitions.h:337
shaka::media::mp4::AC3Specific
Definition: box_definitions.h:325
shaka::media::mp4::SampleEncryptionEntry::GetTotalSizeOfSubsamples
uint32_t GetTotalSizeOfSubsamples() const
Definition: box_definitions.cc:314
shaka::media::mp4::MediaHeader
Definition: box_definitions.h:581
shaka::media::mp4::OpusSpecific
Definition: box_definitions.h:343
shaka::media::mp4::VTTEmptyCueBox
Definition: box_definitions.h:852
shaka::media::mp4::DTSSpecific
Definition: box_definitions.h:315
shaka::media::mp4::DecodingTimeToSample
Definition: box_definitions.h:439
shaka::media::mp4::SampleToGroup
Definition: box_definitions.h:556
shaka::media::mp4::SampleAuxiliaryInformationSize
Definition: box_definitions.h:71
shaka::media::mp4::SampleEncryption::ParseFromSampleEncryptionData
bool ParseFromSampleEncryptionData(uint8_t iv_size, std::vector< SampleEncryptionEntry > *sample_encryption_entries) const
Definition: box_definitions.cc:379
shaka::media::mp4::FileType
Definition: box_definitions.h:47
shaka::media::mp4::CompositionTimeToSample
Definition: box_definitions.h:454
shaka::media::mp4::Movie
Definition: box_definitions.h:685