diff --git a/docs/annotated.html b/docs/annotated.html index 103de3d143..a29c6ca9c6 100644 --- a/docs/annotated.html +++ b/docs/annotated.html @@ -242,134 +242,133 @@ $(function() {  CDecryptConfig  CDecryptorSourceDecryptorSource wraps KeySource and is responsible for decryptor management  CDemuxer - CDisplayActionCompare - CEncryptionConfig - CEncryptionHandler - CEncryptionKey - CESDescriptor - CEventInfo - CFakeInputMediaHandler - CFakeMediaHandler - CFileReaderClass to read character-by-character from a file - CH264ByteToUnitStreamConverter - CH264DecRefPicMarking - CH264ModificationOfPicNum - CH264Parser - CH264Pps - CH264SEIMessage - CH264SEIRecoveryPoint - CH264SliceHeader - CH264Sps - CH264VideoSliceHeaderParser - CH264WeightingFactors - CH265ByteToUnitStreamConverter - CH265Parser - CH265Pps - CH265ReferencePictureListModifications - CH265ReferencePictureSet - CH265SliceHeader - CLongTermPicsInfo - CH265Sps - CH265VideoSliceHeaderParser - CH265VuiParameters - CH26xBitReader - CH26xByteToUnitStreamConverterA base class that is used to convert H.26x byte streams to NAL unit streams - CHEVCDecoderConfigurationRecordClass for parsing HEVC decoder configuration record - CHlsNotifyMuxerListenerMuxerListener that uses HlsNotifier - CHttpKeyFetcher - CId3Tag - CJob - CJobManager - CKeyFetcherBase class for fetching keys from the license service - CKeyFrameEvent - CKeySourceKeySource is responsible for encryption key acquisition - CLibcryptoThreadingConvenience class which initializes and terminates libcrypto threading - CLineReader - CMediaHandler - CMediaHandlerGraphTestBase - CMediaHandlerTestBase - CMediaParser - CMediaSampleClass to hold a media sample - CMkvWriterAn implementation of IMkvWriter using our File type - CMockMuxerListener - CMockOutputMediaHandler - CMpdNotifyMuxerListener - CMuxer - CMuxerFactory - CMuxerListener - CMediaRanges - CMuxerListenerFactory - CStreamData - CMuxerOptionsThis structure contains the list of configuration options for Muxer - CNalu - CNalUnitToByteStreamConverter - CNaluReader - COffsetByteQueue - COnMediaEndParameters - COnNewSegmentParameters - COriginHandler - CPackedAudioSegmenter - CPackedAudioWriter - CPeekingReader - CPlayReadyKeySourceA key source that uses playready for encryption - CPlayReadyPsshGenerator - CProducerConsumerQueue - CProgressListenerThis class listens to progress updates events - CProtectionSystemSpecificInfo - CPsshBoxBuilder - CPsshGenerator - CRange - CRawKeyPsshGenerator - CRawKeySourceA key source that uses raw keys for encryption - CReplicator - CRequestSignerAbstract class used for signature generation - CRsaPrivateKeyRsa private key, used for message signing and decryption - CRsaPublicKeyRsa public key, used for signature verification and encryption - CRsaRequestSignerRsaRequestSigner uses RSA-PSS signing - CSampleAesEc3Cryptor - CScte35Event - CSeekHead - CSegmentEventInfo - CSegmentInfo - CSegmentTestBase - CClusterParser - CStreamData - CStreamInfoAbstract class holds stream information - CSubsampleEntry - CSyncPointQueueA synchronized queue for cue points - CTextChunker - CTextPadder - CTextSample - CTextStreamInfo - CTextTrack - CTextTrackConfig - CTracksBuilder - CTrickPlayHandler - CVideoSliceHeaderParser - CVideoStreamInfoHolds video stream information - CVideoStreamInfoParameters - CVodMediaInfoDumpMuxerListener - CVP8Parser - CVP9ParserClass to parse a vp9 bit stream - CVPCodecConfigurationRecordClass for parsing or writing VP codec configuration record - CVPxFrameInfo - CVPxParser - CWebMAudioClientHelper class used to parse an Audio element inside a TrackEntry element - CWebMClusterParser - CWebMContentEncodingsClientParser for WebM ContentEncodings element - CWebMInfoParserParser for WebM Info element - CWebMListParser - CWebMMediaParser - CWebMParserClient - CWebMTracksParserParser for WebM Tracks element - CWebMVideoClientHelper class used to parse a Video element inside a TrackEntry element - CWebMWebVTTParser - CWebVttOutputHandler - CWebVttParser - CWebVttSegmentedOutputHandler - CWebVttToMp4Handler - CWidevineKeySource - CWidevinePsshGenerator + CEncryptionConfig + CEncryptionHandler + CEncryptionKey + CESDescriptor + CEventInfo + CFakeInputMediaHandler + CFakeMediaHandler + CFileReaderClass to read character-by-character from a file + CH264ByteToUnitStreamConverter + CH264DecRefPicMarking + CH264ModificationOfPicNum + CH264Parser + CH264Pps + CH264SEIMessage + CH264SEIRecoveryPoint + CH264SliceHeader + CH264Sps + CH264VideoSliceHeaderParser + CH264WeightingFactors + CH265ByteToUnitStreamConverter + CH265Parser + CH265Pps + CH265ReferencePictureListModifications + CH265ReferencePictureSet + CH265SliceHeader + CLongTermPicsInfo + CH265Sps + CH265VideoSliceHeaderParser + CH265VuiParameters + CH26xBitReader + CH26xByteToUnitStreamConverterA base class that is used to convert H.26x byte streams to NAL unit streams + CHEVCDecoderConfigurationRecordClass for parsing HEVC decoder configuration record + CHlsNotifyMuxerListenerMuxerListener that uses HlsNotifier + CHttpKeyFetcher + CId3Tag + CJob + CJobManager + CKeyFetcherBase class for fetching keys from the license service + CKeyFrameEvent + CKeySourceKeySource is responsible for encryption key acquisition + CLibcryptoThreadingConvenience class which initializes and terminates libcrypto threading + CLineReader + CMediaHandler + CMediaHandlerGraphTestBase + CMediaHandlerTestBase + CMediaParser + CMediaSampleClass to hold a media sample + CMkvWriterAn implementation of IMkvWriter using our File type + CMockMuxerListener + CMockOutputMediaHandler + CMpdNotifyMuxerListener + CMuxer + CMuxerFactory + CMuxerListener + CMediaRanges + CMuxerListenerFactory + CStreamData + CMuxerOptionsThis structure contains the list of configuration options for Muxer + CNalu + CNalUnitToByteStreamConverter + CNaluReader + COffsetByteQueue + COnMediaEndParameters + COnNewSegmentParameters + COriginHandler + CPackedAudioSegmenter + CPackedAudioWriter + CPeekingReader + CPlayReadyKeySourceA key source that uses playready for encryption + CPlayReadyPsshGenerator + CProducerConsumerQueue + CProgressListenerThis class listens to progress updates events + CProtectionSystemSpecificInfo + CPsshBoxBuilder + CPsshGenerator + CRange + CRawKeyPsshGenerator + CRawKeySourceA key source that uses raw keys for encryption + CReplicator + CRequestSignerAbstract class used for signature generation + CRsaPrivateKeyRsa private key, used for message signing and decryption + CRsaPublicKeyRsa public key, used for signature verification and encryption + CRsaRequestSignerRsaRequestSigner uses RSA-PSS signing + CSampleAesEc3Cryptor + CScte35Event + CSeekHead + CSegmentEventInfo + CSegmentInfo + CSegmentTestBase + CClusterParser + CStreamData + CStreamInfoAbstract class holds stream information + CSubsampleEntry + CSyncPointQueueA synchronized queue for cue points + CTextChunker + CTextPadder + CTextSample + CTextStreamInfo + CTextTrack + CTextTrackConfig + CTracksBuilder + CTrickPlayHandler + CVideoSliceHeaderParser + CVideoStreamInfoHolds video stream information + CVideoStreamInfoParameters + CVodMediaInfoDumpMuxerListener + CVP8Parser + CVP9ParserClass to parse a vp9 bit stream + CVPCodecConfigurationRecordClass for parsing or writing VP codec configuration record + CVPxFrameInfo + CVPxParser + CWebMAudioClientHelper class used to parse an Audio element inside a TrackEntry element + CWebMClusterParser + CWebMContentEncodingsClientParser for WebM ContentEncodings element + CWebMInfoParserParser for WebM Info element + CWebMListParser + CWebMMediaParser + CWebMParserClient + CWebMTracksParserParser for WebM Tracks element + CWebMVideoClientHelper class used to parse a Video element inside a TrackEntry element + CWebMWebVTTParser + CWebVttFileBuffer + CWebVttParser + CWebVttTextOutputHandler + CWebVttToMp4Handler + CWidevineKeySource + CWidevinePsshGenerator  Nxml  CAdaptationSetXmlNodeAdaptationSetType specified in MPD  CRepresentationBaseXmlNode @@ -432,7 +431,7 @@ $(function() { diff --git a/docs/classes.html b/docs/classes.html index df02246673..34e511036d 100644 --- a/docs/classes.html +++ b/docs/classes.html @@ -65,114 +65,114 @@ $(function() {
a | b | c | d | e | f | h | i | j | k | l | m | n | o | p | r | s | t | u | v | w | x
- - - + + - - + - - - - - + + + + - - - - - - - + + + + + + - - - - - - + + + + + + + - - - + - - - - - + + + + - - - - + + + + - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + - - - - - - - - + + + + + + + + + - - - + + - - + - - - - - + + + +
  a  
-
DecryptorSource (shaka::media)   KeyFrameInfo (shaka::media::mp4)   PeekingReader (shaka::media)   TextSample (shaka::media)   
Demuxer (shaka::media)   RawKeyParams::KeyInfo (shaka)   Period (shaka)   TextSampleEntry (shaka::media::mp4)   
AACAudioSpecificConfig (shaka::media)   DemuxStreamIdMediaSample (shaka::media::wvm)   KeySource (shaka::media)   PesPacket (shaka::media::mp2t)   TextStreamInfo (shaka::media)   
Ac3Header (shaka::media::mp2t)   DisplayActionCompare (shaka::media)   
  l  
+
DecryptorSource (shaka::media)   RawKeyParams::KeyInfo (shaka)   Period (shaka)   TextSampleEntry (shaka::media::mp4)   
Demuxer (shaka::media)   KeySource (shaka::media)   PesPacket (shaka::media::mp2t)   TextStreamInfo (shaka::media)   
AACAudioSpecificConfig (shaka::media)   DemuxStreamIdMediaSample (shaka::media::wvm)   
  l  
PesPacketGenerator (shaka::media::mp2t)   TextTrack (shaka::media)   
AC3Specific (shaka::media::mp4)   DTSSpecific (shaka::media::mp4)   PixelAspectRatio (shaka::media::mp4)   TextTrackConfig (shaka::media)   
AdaptationSet (shaka)   
  e  
+
Ac3Header (shaka::media::mp2t)   DTSSpecific (shaka::media::mp4)   PixelAspectRatio (shaka::media::mp4)   TextTrackConfig (shaka::media)   
AC3Specific (shaka::media::mp4)   
  e  
Language (shaka::media::mp4)   PlayReadyEncryptionParams (shaka)   ThreadedIoFile (shaka)   
AdaptationSetXmlNode (shaka::xml)   LibcryptoThreading (shaka::media)   PlayReadyKeySource (shaka::media)   Track (shaka::media::mp4)   
AdCueGenerator (shaka::media)   EC3Specific (shaka::media::mp4)   LineReader (shaka::media)   PlayReadyPsshGenerator (shaka::media)   TrackEncryption (shaka::media::mp4)   
AdCueGeneratorParams (shaka)   Edit (shaka::media::mp4)   LocalFile (shaka)   PrevSampleData (shaka::media::wvm)   TrackExtends (shaka::media::mp4)   
AdtsHeader (shaka::media::mp2t)   EditList (shaka::media::mp4)   H265SliceHeader::LongTermPicsInfo (shaka::media)   ProducerConsumerQueue (shaka::media)   TrackFragment (shaka::media::mp4)   
AesCbcDecryptor (shaka::media)   EditListEntry (shaka::media::mp4)   
  m  
+
AdaptationSet (shaka)   LibcryptoThreading (shaka::media)   PlayReadyKeySource (shaka::media)   Track (shaka::media::mp4)   
AdaptationSetXmlNode (shaka::xml)   EC3Specific (shaka::media::mp4)   LineReader (shaka::media)   PlayReadyPsshGenerator (shaka::media)   TrackEncryption (shaka::media::mp4)   
AdCueGenerator (shaka::media)   Edit (shaka::media::mp4)   LocalFile (shaka)   PrevSampleData (shaka::media::wvm)   TrackExtends (shaka::media::mp4)   
AdCueGeneratorParams (shaka)   EditList (shaka::media::mp4)   H265SliceHeader::LongTermPicsInfo (shaka::media)   ProducerConsumerQueue (shaka::media)   TrackFragment (shaka::media::mp4)   
AdtsHeader (shaka::media::mp2t)   EditListEntry (shaka::media::mp4)   
  m  
ProgramMapTableWriter (shaka::media::mp2t)   TrackFragmentDecodeTime (shaka::media::mp4)   
AesCbcEncryptor (shaka::media)   Element (shaka)   ProgressListener (shaka::media)   TrackFragmentHeader (shaka::media::mp4)   
AesCryptor (shaka::media)   ElementaryStreamDescriptor (shaka::media::mp4)   MasterPlaylist (shaka::hls)   ProtectionSchemeInfo (shaka::media::mp4)   TrackFragmentRun (shaka::media::mp4)   
AesCtrEncryptor (shaka::media)   EncryptionParams::EncryptedStreamAttributes (shaka)   Media (shaka::media::mp4)   ProtectionSystemSpecificHeader (shaka::media::mp4)   TrackHeader (shaka::media::mp4)   
AesEncryptor (shaka::media)   EncryptionConfig (shaka::media)   MediaData (shaka::media::mp4)   ProtectionSystemSpecificInfo (shaka::media)   TrackRunIterator (shaka::media::mp4)   
AesPatternCryptor (shaka::media)   EncryptionHandler (shaka::media)   MediaHandler (shaka::media)   PsshBoxBuilder (shaka::media)   TracksBuilder (shaka::media)   
AesRequestSigner (shaka::media)   EncryptionKey (shaka::media)   MediaHandlerGraphTestBase (shaka::media)   PsshGenerator (shaka::media)   TrickPlayHandler (shaka::media)   
AudioHeader (shaka::media::mp2t)   EncryptionParams (shaka)   MediaHandlerTestBase (shaka::media)   
  r  
+
AesCbcDecryptor (shaka::media)   Element (shaka)   ProgressListener (shaka::media)   TrackFragmentHeader (shaka::media::mp4)   
AesCbcEncryptor (shaka::media)   ElementaryStreamDescriptor (shaka::media::mp4)   MasterPlaylist (shaka::hls)   ProtectionSchemeInfo (shaka::media::mp4)   TrackFragmentRun (shaka::media::mp4)   
AesCryptor (shaka::media)   EncryptionParams::EncryptedStreamAttributes (shaka)   Media (shaka::media::mp4)   ProtectionSystemSpecificHeader (shaka::media::mp4)   TrackHeader (shaka::media::mp4)   
AesCtrEncryptor (shaka::media)   EncryptionConfig (shaka::media)   MediaData (shaka::media::mp4)   ProtectionSystemSpecificInfo (shaka::media)   TrackRunIterator (shaka::media::mp4)   
AesEncryptor (shaka::media)   EncryptionHandler (shaka::media)   MediaHandler (shaka::media)   PsshBoxBuilder (shaka::media)   TracksBuilder (shaka::media)   
AesPatternCryptor (shaka::media)   EncryptionKey (shaka::media)   MediaHandlerGraphTestBase (shaka::media)   PsshGenerator (shaka::media)   TrickPlayHandler (shaka::media)   
AesRequestSigner (shaka::media)   EncryptionParams (shaka)   MediaHandlerTestBase (shaka::media)   
  r  
TsMuxer (shaka::media::mp2t)   
AudioProgramMapTableWriter (shaka::media::mp2t)   ESDescriptor (shaka::media)   MediaHeader (shaka::media::mp4)   TsPacket (shaka::media::mp2t)   
AudioRollRecoveryEntry (shaka::media::mp4)   EsParser (shaka::media::mp2t)   MediaInformation (shaka::media::mp4)   Range (shaka::media)   TsSection (shaka::media::mp2t)   
AudioSampleEntry (shaka::media::mp4)   EsParserAudio (shaka::media::mp2t)   MediaParser (shaka::media)   RawKeyParams (shaka)   TsSectionPat (shaka::media::mp2t)   
AudioStreamInfo (shaka::media)   EsParserH264 (shaka::media::mp2t)   MediaPlaylist (shaka::hls)   RawKeyPsshGenerator (shaka::media)   TsSectionPes (shaka::media::mp2t)   
AudioTimestampHelper (shaka::media)   EsParserH265 (shaka::media::mp2t)   MediaPlaylistFactory (shaka::hls)   RawKeySource (shaka::media)   TsSectionPmt (shaka::media::mp2t)   
AVCDecoderConfigurationRecord (shaka::media)   EsParserH26x (shaka::media::mp2t)   MuxerListener::MediaRanges (shaka::media)   Replicator (shaka::media)   TsSectionPsi (shaka::media::mp2t)   
AudioHeader (shaka::media::mp2t)   ESDescriptor (shaka::media)   MediaHeader (shaka::media::mp4)   TsPacket (shaka::media::mp2t)   
AudioProgramMapTableWriter (shaka::media::mp2t)   EsParser (shaka::media::mp2t)   MediaInformation (shaka::media::mp4)   Range (shaka::media)   TsSection (shaka::media::mp2t)   
AudioRollRecoveryEntry (shaka::media::mp4)   EsParserAudio (shaka::media::mp2t)   MediaParser (shaka::media)   RawKeyParams (shaka)   TsSectionPat (shaka::media::mp2t)   
AudioSampleEntry (shaka::media::mp4)   EsParserH264 (shaka::media::mp2t)   MediaPlaylist (shaka::hls)   RawKeyPsshGenerator (shaka::media)   TsSectionPes (shaka::media::mp2t)   
AudioStreamInfo (shaka::media)   EsParserH265 (shaka::media::mp2t)   MediaPlaylistFactory (shaka::hls)   RawKeySource (shaka::media)   TsSectionPmt (shaka::media::mp2t)   
AudioTimestampHelper (shaka::media)   EsParserH26x (shaka::media::mp2t)   MuxerListener::MediaRanges (shaka::media)   Replicator (shaka::media)   TsSectionPsi (shaka::media::mp2t)   
AVCDecoderConfigurationRecord (shaka::media)   EventInfo (shaka::media)   MediaSample (shaka::media)   Representation (shaka)   TsSegmenter (shaka::media::mp2t)   
  b  
-
EventInfo (shaka::media)   MediaSample (shaka::media)   Representation (shaka)   TsSegmenter (shaka::media::mp2t)   
  f  
+
  f  
MemoryFile (shaka)   RepresentationBaseXmlNode (shaka::xml)   TsWriter (shaka::media::mp2t)   
BandwidthEstimator (shaka)   Metadata (shaka::media::mp4)   RepresentationStateChangeListener (shaka)   TwoPassSingleSegmentSegmenter (shaka::media::webm)   
BitReader (shaka::media)   FakeInputMediaHandler (shaka::media)   MkvWriter (shaka::media)   RepresentationXmlNode (shaka::xml)   
  u  
+
Metadata (shaka::media::mp4)   RepresentationStateChangeListener (shaka)   TwoPassSingleSegmentSegmenter (shaka::media::webm)   
BandwidthEstimator (shaka)   FakeInputMediaHandler (shaka::media)   MkvWriter (shaka::media)   RepresentationXmlNode (shaka::xml)   
  u  
BitWriter (shaka::media)   FakeMediaHandler (shaka::media)   MockAdaptationSet (shaka)   RequestSigner (shaka::media)   
BlockReader (shaka::media)   File (shaka)   MockMediaPlaylist (shaka::hls)   RsaPrivateKey (shaka::media)   UdpFile (shaka)   
Box (shaka::media::mp4)   FileCloser (shaka)   MockMpdBuilder (shaka)   RsaPublicKey (shaka::media)   UdpOptions (shaka)   
BoxBuffer (shaka::media::mp4)   FileReader (shaka::media)   MockMpdNotifier (shaka)   RsaRequestSigner (shaka::media)   MpdParams::UtcTiming (shaka)   
BoxReader (shaka::media::mp4)   FileType (shaka::media::mp4)   MockMuxerListener (shaka::media)   
  s  
+
BitReader (shaka::media)   FakeMediaHandler (shaka::media)   MockAdaptationSet (shaka)   RequestSigner (shaka::media)   
BitWriter (shaka::media)   File (shaka)   MockMediaPlaylist (shaka::hls)   RsaPrivateKey (shaka::media)   UdpFile (shaka)   
BlockReader (shaka::media)   FileCloser (shaka)   MockMpdBuilder (shaka)   RsaPublicKey (shaka::media)   UdpOptions (shaka)   
Box (shaka::media::mp4)   FileReader (shaka::media)   MockMpdNotifier (shaka)   RsaRequestSigner (shaka::media)   MpdParams::UtcTiming (shaka)   
BoxBuffer (shaka::media::mp4)   FileType (shaka::media::mp4)   MockMuxerListener (shaka::media)   
  s  
  v  
BufferCallbackParams (shaka)   FlacSpecific (shaka::media::mp4)   MockOutputMediaHandler (shaka::media)   
BufferReader (shaka::media)   Fragmenter (shaka::media::mp4)   MockPeriod (shaka)   SampleAesEc3Cryptor (shaka::media)   VideoMediaHeader (shaka::media::mp4)   
BufferWriter (shaka::media)   FullBox (shaka::media::mp4)   MockRepresentation (shaka)   SampleAuxiliaryInformationOffset (shaka::media::mp4)   VideoProgramMapTableWriter (shaka::media::mp2t)   
ByteQueue (shaka::media)   
  h  
+
BoxReader (shaka::media::mp4)   FlacSpecific (shaka::media::mp4)   MockOutputMediaHandler (shaka::media)   
BufferCallbackParams (shaka)   Fragmenter (shaka::media::mp4)   MockPeriod (shaka)   SampleAesEc3Cryptor (shaka::media)   VideoMediaHeader (shaka::media::mp4)   
BufferReader (shaka::media)   FullBox (shaka::media::mp4)   MockRepresentation (shaka)   SampleAuxiliaryInformationOffset (shaka::media::mp4)   VideoProgramMapTableWriter (shaka::media::mp2t)   
BufferWriter (shaka::media)   
  h  
Movie (shaka::media::mp4)   SampleAuxiliaryInformationSize (shaka::media::mp4)   VideoSampleEntry (shaka::media::mp4)   
ByteQueue (shaka::media)   MovieExtends (shaka::media::mp4)   SampleDescription (shaka::media::mp4)   VideoSliceHeaderParser (shaka::media)   
  c  
-
MovieExtends (shaka::media::mp4)   SampleDescription (shaka::media::mp4)   VideoSliceHeaderParser (shaka::media)   
H264ByteToUnitStreamConverter (shaka::media)   MovieExtendsHeader (shaka::media::mp4)   SampleEncryption (shaka::media::mp4)   EsParserH26x::VideoSliceInfo (shaka::media::mp2t)   
CallbackFile (shaka)   H264DecRefPicMarking (shaka::media)   MovieFragment (shaka::media::mp4)   SampleEncryptionEntry (shaka::media::mp4)   VideoStreamInfo (shaka::media)   
CencSampleEncryptionInfoEntry (shaka::media::mp4)   H264ModificationOfPicNum (shaka::media)   MovieFragmentHeader (shaka::media::mp4)   SampleGroupDescription (shaka::media::mp4)   VideoStreamInfoParameters (shaka::media)   
ChunkInfo (shaka::media::mp4)   H264Parser (shaka::media)   MovieHeader (shaka::media::mp4)   SampleSize (shaka::media::mp4)   VodMediaInfoDumpMuxerListener (shaka::media)   
ChunkInfoIterator (shaka::media::mp4)   H264Pps (shaka::media)   Mp2tMediaParser (shaka::media::mp2t)   SampleTable (shaka::media::mp4)   VP8Parser (shaka::media)   
ChunkingHandler (shaka::media)   H264SEIMessage (shaka::media)   MP4MediaParser (shaka::media::mp4)   SampleToChunk (shaka::media::mp4)   VP9Parser (shaka::media)   
ChunkingParams (shaka)   H264SEIRecoveryPoint (shaka::media)   MP4Muxer (shaka::media::mp4)   SampleToGroup (shaka::media::mp4)   VPCodecConfigurationRecord (shaka::media)   
ChunkLargeOffset (shaka::media::mp4)   H264SliceHeader (shaka::media)   Mp4OutputParams (shaka)   SampleToGroupEntry (shaka::media::mp4)   VPxFrameInfo (shaka::media)   
ChunkOffset (shaka::media::mp4)   H264Sps (shaka::media)   MpdBuilder (shaka)   SchemeInfo (shaka::media::mp4)   VPxParser (shaka::media)   
ClosureThread (shaka::media)   H264VideoSliceHeaderParser (shaka::media)   MpdNotifier (shaka)   SchemeType (shaka::media::mp4)   VTTAdditionalTextBox (shaka::media::mp4)   
Cluster (shaka::media)   H264WeightingFactors (shaka::media)   MpdNotifierFactory (shaka)   Scte35Event (shaka::media)   VTTCueBox (shaka::media::mp4)   
ClusterBuilder (shaka::media)   H265ByteToUnitStreamConverter (shaka::media)   MpdNotifyMuxerListener (shaka::media)   SeekHead (shaka::media)   VTTEmptyCueBox (shaka::media::mp4)   
SegmentTestBase::ClusterParser (shaka::media)   H265Parser (shaka::media)   MpdOptions (shaka)   Segmenter (shaka::media::mp4)   
  w  
+
H264ByteToUnitStreamConverter (shaka::media)   MovieExtendsHeader (shaka::media::mp4)   SampleEncryption (shaka::media::mp4)   EsParserH26x::VideoSliceInfo (shaka::media::mp2t)   
H264DecRefPicMarking (shaka::media)   MovieFragment (shaka::media::mp4)   SampleEncryptionEntry (shaka::media::mp4)   VideoStreamInfo (shaka::media)   
CallbackFile (shaka)   H264ModificationOfPicNum (shaka::media)   MovieFragmentHeader (shaka::media::mp4)   SampleGroupDescription (shaka::media::mp4)   VideoStreamInfoParameters (shaka::media)   
CencSampleEncryptionInfoEntry (shaka::media::mp4)   H264Parser (shaka::media)   MovieHeader (shaka::media::mp4)   SampleSize (shaka::media::mp4)   VodMediaInfoDumpMuxerListener (shaka::media)   
ChunkInfo (shaka::media::mp4)   H264Pps (shaka::media)   Mp2tMediaParser (shaka::media::mp2t)   SampleTable (shaka::media::mp4)   VP8Parser (shaka::media)   
ChunkInfoIterator (shaka::media::mp4)   H264SEIMessage (shaka::media)   MP4MediaParser (shaka::media::mp4)   SampleToChunk (shaka::media::mp4)   VP9Parser (shaka::media)   
ChunkingHandler (shaka::media)   H264SEIRecoveryPoint (shaka::media)   MP4Muxer (shaka::media::mp4)   SampleToGroup (shaka::media::mp4)   VPCodecConfigurationRecord (shaka::media)   
ChunkingParams (shaka)   H264SliceHeader (shaka::media)   Mp4OutputParams (shaka)   SampleToGroupEntry (shaka::media::mp4)   VPxFrameInfo (shaka::media)   
ChunkLargeOffset (shaka::media::mp4)   H264Sps (shaka::media)   MpdBuilder (shaka)   SchemeInfo (shaka::media::mp4)   VPxParser (shaka::media)   
ChunkOffset (shaka::media::mp4)   H264VideoSliceHeaderParser (shaka::media)   MpdNotifier (shaka)   SchemeType (shaka::media::mp4)   VTTAdditionalTextBox (shaka::media::mp4)   
ClosureThread (shaka::media)   H264WeightingFactors (shaka::media)   MpdNotifierFactory (shaka)   Scte35Event (shaka::media)   VTTCueBox (shaka::media::mp4)   
Cluster (shaka::media)   H265ByteToUnitStreamConverter (shaka::media)   MpdNotifyMuxerListener (shaka::media)   SeekHead (shaka::media)   VTTEmptyCueBox (shaka::media::mp4)   
ClusterBuilder (shaka::media)   H265Parser (shaka::media)   MpdOptions (shaka)   Segmenter (shaka::media::mp4)   
  w  
CodecConfiguration (shaka::media::mp4)   H265Pps (shaka::media)   MpdParams (shaka)   Segmenter (shaka::media::webm)   
CombinedMuxerListener (shaka::media)   H265ReferencePictureListModifications (shaka::media)   MpdWriter (shaka)   SegmentEventInfo (shaka::media)   WebMAudioClient (shaka::media)   
CompactSampleSize (shaka::media::mp4)   H265ReferencePictureSet (shaka::media)   MultiSegmentSegmenter (shaka::media::mp4)   SegmentIndex (shaka::media::mp4)   WebMClusterParser (shaka::media)   
CompositionOffset (shaka::media::mp4)   H265SliceHeader (shaka::media)   MultiSegmentSegmenter (shaka::media::webm)   SegmentInfo (shaka)   WebMContentEncodingsClient (shaka::media)   
CompositionOffsetIterator (shaka::media::mp4)   H265Sps (shaka::media)   Muxer (shaka::media)   SegmentInfo (shaka::media)   WebMInfoParser (shaka::media)   
CompositionTimeToSample (shaka::media::mp4)   H265VideoSliceHeaderParser (shaka::media)   MuxerFactory (shaka::media)   SegmentReference (shaka::media::mp4)   WebMListParser (shaka::media)   
ContentEncoding (shaka::media)   H265VuiParameters (shaka::media)   MuxerListener (shaka::media)   SegmentTestBase (shaka::media)   WebMMediaParser (shaka::media)   
ContentProtectionElement (shaka)   H26xBitReader (shaka::media)   MuxerListenerFactory (shaka::media)   SegmentType (shaka::media::mp4)   WebMMuxer (shaka::media::webm)   
ContinuityCounter (shaka::media::mp2t)   H26xByteToUnitStreamConverter (shaka::media)   MuxerOptions (shaka::media)   SimpleHlsNotifier (shaka::hls)   WebMParserClient (shaka::media)   
CueAlignmentHandler (shaka::media)   HandlerReference (shaka::media::mp4)   
  n  
+
SegmentTestBase::ClusterParser (shaka::media)   H265Pps (shaka::media)   MpdParams (shaka)   Segmenter (shaka::media::webm)   
CodecConfiguration (shaka::media::mp4)   H265ReferencePictureListModifications (shaka::media)   MpdWriter (shaka)   SegmentEventInfo (shaka::media)   WebMAudioClient (shaka::media)   
CombinedMuxerListener (shaka::media)   H265ReferencePictureSet (shaka::media)   MultiSegmentSegmenter (shaka::media::mp4)   SegmentIndex (shaka::media::mp4)   WebMClusterParser (shaka::media)   
CompactSampleSize (shaka::media::mp4)   H265SliceHeader (shaka::media)   MultiSegmentSegmenter (shaka::media::webm)   SegmentInfo (shaka)   WebMContentEncodingsClient (shaka::media)   
CompositionOffset (shaka::media::mp4)   H265Sps (shaka::media)   Muxer (shaka::media)   SegmentInfo (shaka::media)   WebMInfoParser (shaka::media)   
CompositionOffsetIterator (shaka::media::mp4)   H265VideoSliceHeaderParser (shaka::media)   MuxerFactory (shaka::media)   SegmentReference (shaka::media::mp4)   WebMListParser (shaka::media)   
CompositionTimeToSample (shaka::media::mp4)   H265VuiParameters (shaka::media)   MuxerListener (shaka::media)   SegmentTestBase (shaka::media)   WebMMediaParser (shaka::media)   
ContentEncoding (shaka::media)   H26xBitReader (shaka::media)   MuxerListenerFactory (shaka::media)   SegmentType (shaka::media::mp4)   WebMMuxer (shaka::media::webm)   
ContentProtectionElement (shaka)   H26xByteToUnitStreamConverter (shaka::media)   MuxerOptions (shaka::media)   SimpleHlsNotifier (shaka::hls)   WebMParserClient (shaka::media)   
ContinuityCounter (shaka::media::mp2t)   HandlerReference (shaka::media::mp4)   
  n  
SimpleMpdNotifier (shaka)   WebMTracksParser (shaka::media)   
CueEvent (shaka::media)   HEVCDecoderConfigurationRecord (shaka::media)   SingleSegmentSegmenter (shaka::media::webm)   WebMVideoClient (shaka::media)   
CueEventInfo (shaka::media)   HlsEntry (shaka::hls)   Nalu (shaka::media)   SingleSegmentSegmenter (shaka::media::mp4)   WebMWebVTTParser (shaka::media)   
CueIDBox (shaka::media::mp4)   HlsNotifier (shaka::hls)   NalUnitToByteStreamConverter (shaka::media)   SoundMediaHeader (shaka::media::mp4)   WebVTTConfigurationBox (shaka::media::mp4)   
CuePayloadBox (shaka::media::mp4)   HlsNotifyMuxerListener (shaka::media)   NaluReader (shaka::media)   Status (shaka)   WebVttOutputHandler (shaka::media)   
Cuepoint (shaka)   HlsParams (shaka)   
  o  
-
StreamData (shaka::media)   WebVttParser (shaka::media)   
CueSettingsBox (shaka::media::mp4)   HttpKeyFetcher (shaka::media)   MuxerListenerFactory::StreamData (shaka::media)   WebVttSegmentedOutputHandler (shaka::media)   
CueSourceIDBox (shaka::media::mp4)   
  i  
-
OffsetByteQueue (shaka::media)   StreamDescriptor (shaka)   WebVTTSourceLabelBox (shaka::media::mp4)   
CueTimeBox (shaka::media::mp4)   EncryptionParams::EncryptedStreamAttributes::OneOf (shaka)   StreamInfo (shaka::media)   WebVttToMp4Handler (shaka::media)   
CueAlignmentHandler (shaka::media)   HEVCDecoderConfigurationRecord (shaka::media)   SingleSegmentSegmenter (shaka::media::webm)   WebMVideoClient (shaka::media)   
CueEvent (shaka::media)   HlsEntry (shaka::hls)   Nalu (shaka::media)   SingleSegmentSegmenter (shaka::media::mp4)   WebMWebVTTParser (shaka::media)   
CueEventInfo (shaka::media)   HlsNotifier (shaka::hls)   NalUnitToByteStreamConverter (shaka::media)   SoundMediaHeader (shaka::media::mp4)   WebVTTConfigurationBox (shaka::media::mp4)   
CueIDBox (shaka::media::mp4)   HlsNotifyMuxerListener (shaka::media)   NaluReader (shaka::media)   Status (shaka)   WebVttFileBuffer (shaka::media)   
CuePayloadBox (shaka::media::mp4)   HlsParams (shaka)   
  o  
+
MuxerListenerFactory::StreamData (shaka::media)   WebVttParser (shaka::media)   
Cuepoint (shaka)   HttpKeyFetcher (shaka::media)   StreamData (shaka::media)   WebVTTSourceLabelBox (shaka::media::mp4)   
CueSettingsBox (shaka::media::mp4)   
  i  
+
OffsetByteQueue (shaka::media)   StreamDescriptor (shaka)   WebVttTextOutputHandler (shaka::media)   
CueSourceIDBox (shaka::media::mp4)   EncryptionParams::EncryptedStreamAttributes::OneOf (shaka)   StreamInfo (shaka::media)   WebVttToMp4Handler (shaka::media)   
CueTimeBox (shaka::media::mp4)   Id3Tag (shaka::media)   OnMediaEndParameters (shaka::media)   SubsampleEntry (shaka::media)   WidevineDecryptionParams (shaka)   
  d  
-
Id3Tag (shaka::media)   OnMediaEndParameters (shaka::media)   SubsampleEntry (shaka::media)   WidevineDecryptionParams (shaka)   
ID3v2 (shaka::media::mp4)   OnNewSegmentParameters (shaka::media)   SubtitleMediaHeader (shaka::media::mp4)   WidevineEncryptionParams (shaka)   
DataEntryUrl (shaka::media::mp4)   IoCache (shaka)   OpusSpecific (shaka::media::mp4)   SyncPointQueue (shaka::media)   WidevineKeySource (shaka::media)   
DataInformation (shaka::media::mp4)   
  j  
+
ID3v2 (shaka::media::mp4)   OnNewSegmentParameters (shaka::media)   SubtitleMediaHeader (shaka::media::mp4)   WidevineEncryptionParams (shaka)   
IoCache (shaka)   OpusSpecific (shaka::media::mp4)   SyncPointQueue (shaka::media)   WidevineKeySource (shaka::media)   
DataEntryUrl (shaka::media::mp4)   
  j  
OriginalFormat (shaka::media::mp4)   SyncSample (shaka::media::mp4)   WidevinePsshGenerator (shaka::media)   
DataReference (shaka::media::mp4)   OriginHandler (shaka::media)   SyncSampleIterator (shaka::media::mp4)   WidevineSigner (shaka)   
DecoderConfigurationRecord (shaka::media)   Job (shaka::media)   
  p  
+
DataInformation (shaka::media::mp4)   OriginHandler (shaka::media)   SyncSampleIterator (shaka::media::mp4)   WidevineSigner (shaka)   
DataReference (shaka::media::mp4)   Job (shaka::media)   
  p  
  t  
WvmMediaParser (shaka::media::wvm)   
DecodingTime (shaka::media::mp4)   JobManager (shaka::media)   
  x  
+
DecoderConfigurationRecord (shaka::media)   JobManager (shaka::media)   
  x  
DecodingTimeIterator (shaka::media::mp4)   
  k  
+
DecodingTime (shaka::media::mp4)   
  k  
Packager (shaka)   Tag (shaka::hls)   
DecodingTimeToSample (shaka::media::mp4)   PackagingParams (shaka)   TestParams (shaka)   XmlDeleter (shaka::xml)   
DecryptConfig (shaka::media)   KeyFetcher (shaka::media)   PackedAudioSegmenter (shaka::media)   TextChunker (shaka::media)   XmlNode (shaka::xml)   
DecryptionParams (shaka)   KeyFrameEvent (shaka::media)   PackedAudioWriter (shaka::media)   TextPadder (shaka::media)   
DecodingTimeIterator (shaka::media::mp4)   PackagingParams (shaka)   TestParams (shaka)   XmlDeleter (shaka::xml)   
DecodingTimeToSample (shaka::media::mp4)   KeyFetcher (shaka::media)   PackedAudioSegmenter (shaka::media)   TextChunker (shaka::media)   XmlNode (shaka::xml)   
DecryptConfig (shaka::media)   KeyFrameEvent (shaka::media)   PackedAudioWriter (shaka::media)   TextPadder (shaka::media)   
DecryptionParams (shaka)   KeyFrameInfo (shaka::media::mp4)   PeekingReader (shaka::media)   TextSample (shaka::media)   
a | b | c | d | e | f | h | i | j | k | l | m | n | o | p | r | s | t | u | v | w | x
diff --git a/docs/d0/d00/structshaka_1_1media_1_1mp4_1_1HandlerReference-members.html b/docs/d0/d00/structshaka_1_1media_1_1mp4_1_1HandlerReference-members.html index 213877a799..5a4c206e2e 100644 --- a/docs/d0/d00/structshaka_1_1media_1_1mp4_1_1HandlerReference-members.html +++ b/docs/d0/d00/structshaka_1_1media_1_1mp4_1_1HandlerReference-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/d0/d04/classshaka_1_1media_1_1RsaRequestSigner-members.html b/docs/d0/d04/classshaka_1_1media_1_1RsaRequestSigner-members.html index 1941feaa21..498f99eb1f 100644 --- a/docs/d0/d04/classshaka_1_1media_1_1RsaRequestSigner-members.html +++ b/docs/d0/d04/classshaka_1_1media_1_1RsaRequestSigner-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d0/d05/muxer__listener__factory_8cc_source.html b/docs/d0/d05/muxer__listener__factory_8cc_source.html index aca3b2ec51..281350d1f5 100644 --- a/docs/d0/d05/muxer__listener__factory_8cc_source.html +++ b/docs/d0/d05/muxer__listener__factory_8cc_source.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d0/d06/mpd__flags_8cc_source.html b/docs/d0/d06/mpd__flags_8cc_source.html index 32010d7b63..9f3d79168a 100644 --- a/docs/d0/d06/mpd__flags_8cc_source.html +++ b/docs/d0/d06/mpd__flags_8cc_source.html @@ -69,7 +69,7 @@ $(function() {
1 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 //
7 // Defines Mpd flags.
8 
9 #include "packager/app/mpd_flags.h"
10 
11 // TODO(kqyang): Rename to generate_static_live_mpd.
12 DEFINE_bool(generate_static_mpd,
13  false,
14  "Set to true to generate static mpd. If segment_template is "
15  "specified in stream descriptors, shaka-packager generates dynamic "
16  "mpd by default; if this flag is enabled, shaka-packager generates "
17  "static mpd instead. Note that if segment_template is not "
18  "specified, shaka-packager always generates static mpd regardless "
19  "of the value of this flag.");
20 // TODO(rkuroiwa, kqyang): Remove the 'Exclusive' statements once
21 // --output_media_info can work together with --mpd_output.
22 DEFINE_bool(output_media_info,
23  false,
24  "Create a human readable format of MediaInfo. The output file name "
25  "will be the name specified by output flag, suffixed with "
26  "'.media_info'. Exclusive with --mpd_output.");
27 DEFINE_string(mpd_output, "",
28  "MPD output file name. Exclusive with --output_media_info.");
29 DEFINE_string(base_urls,
30  "",
31  "Comma separated BaseURLs for the MPD. The values will be added "
32  "as <BaseURL> element(s) immediately under the <MPD> element.");
33 DEFINE_double(min_buffer_time,
34  2.0,
35  "Specifies, in seconds, a common duration used in the definition "
36  "of the MPD Representation data rate.");
37 DEFINE_double(minimum_update_period,
38  5.0,
39  "Indicates to the player how often to refresh the media "
40  "presentation description in seconds. This value is used for "
41  "dynamic MPD only.");
42 DEFINE_double(suggested_presentation_delay,
43  0.0,
44  "Specifies a delay, in seconds, to be added to the media "
45  "presentation time. This value is used for dynamic MPD only.");
46 DEFINE_string(utc_timings,
47  "",
48  "Comma separated UTCTiming schemeIdUri and value pairs for the "
49  "MPD. This value is used for dynamic MPD only.");
50 DEFINE_bool(generate_dash_if_iop_compliant_mpd,
51  true,
52  "Try to generate DASH-IF IOP compliant MPD. This is best effort "
53  "and does not guarantee compliance.");
54 DEFINE_bool(
55  allow_approximate_segment_timeline,
56  false,
57  "For live profile only. "
58  "If enabled, segments with close duration (i.e. with difference less than "
59  "one sample) are considered to have the same duration. This enables MPD "
60  "generator to generate less SegmentTimeline entries. If all segments are "
61  "of the same duration except the last one, we will do further optimization "
62  "to use SegmentTemplate@duration instead and omit SegmentTimeline "
63  "completely."
64  "Ignored if $Time$ is used in segment template, since $Time$ requires "
65  "accurate Segment Timeline.");
diff --git a/docs/d0/d0e/classshaka_1_1media_1_1HttpKeyFetcher-members.html b/docs/d0/d0e/classshaka_1_1media_1_1HttpKeyFetcher-members.html index a9369d6b70..2a78a1e098 100644 --- a/docs/d0/d0e/classshaka_1_1media_1_1HttpKeyFetcher-members.html +++ b/docs/d0/d0e/classshaka_1_1media_1_1HttpKeyFetcher-members.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/d0/d0e/hevc__decoder__configuration__record_8h_source.html b/docs/d0/d0e/hevc__decoder__configuration__record_8h_source.html index ec668efe3f..00c27bf1d2 100644 --- a/docs/d0/d0e/hevc__decoder__configuration__record_8h_source.html +++ b/docs/d0/d0e/hevc__decoder__configuration__record_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d0/d0e/muxer__options_8h_source.html b/docs/d0/d0e/muxer__options_8h_source.html index d84359c261..75c5b5f4eb 100644 --- a/docs/d0/d0e/muxer__options_8h_source.html +++ b/docs/d0/d0e/muxer__options_8h_source.html @@ -66,18 +66,19 @@ $(function() {
muxer_options.h
-
1 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #ifndef PACKAGER_MEDIA_BASE_MUXER_OPTIONS_H_
8 #define PACKAGER_MEDIA_BASE_MUXER_OPTIONS_H_
9 
10 #include <stdint.h>
11 
12 #include <string>
13 
14 #include "packager/media/public/mp4_output_params.h"
15 
16 namespace shaka {
17 namespace media {
18 
20 struct MuxerOptions {
21  MuxerOptions();
22  ~MuxerOptions();
23 
26 
30  std::string output_file_name;
31 
36  std::string segment_template;
37 
39  std::string temp_dir;
40 
43  uint32_t bandwidth = 0;
44 };
45 
46 } // namespace media
47 } // namespace shaka
48 
49 #endif // PACKAGER_MEDIA_BASE_MUXER_OPTIONS_H_
+
1 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #ifndef PACKAGER_MEDIA_BASE_MUXER_OPTIONS_H_
8 #define PACKAGER_MEDIA_BASE_MUXER_OPTIONS_H_
9 
10 #include <stdint.h>
11 
12 #include <string>
13 
14 #include "packager/media/public/mp4_output_params.h"
15 
16 namespace shaka {
17 namespace media {
18 
20 struct MuxerOptions {
21  MuxerOptions();
22  ~MuxerOptions();
23 
26 
30  std::string output_file_name;
31 
37  size_t output_file_index = 0;
38 
43  std::string segment_template;
44 
46  std::string temp_dir;
47 
50  uint32_t bandwidth = 0;
51 };
52 
53 } // namespace media
54 } // namespace shaka
55 
56 #endif // PACKAGER_MEDIA_BASE_MUXER_OPTIONS_H_
+
All the methods that are virtual are virtual for mocking.
This structure contains the list of configuration options for Muxer.
Definition: muxer_options.h:20
MP4 (ISO-BMFF) output related parameters.
Mp4OutputParams mp4_params
MP4 (ISO-BMFF) specific parameters.
Definition: muxer_options.h:25
-
std::string temp_dir
Specify temporary directory for intermediate files.
Definition: muxer_options.h:39
- - +
std::string temp_dir
Specify temporary directory for intermediate files.
Definition: muxer_options.h:46
+ +
diff --git a/docs/d0/d0f/classshaka_1_1media_1_1mp2t_1_1TsSectionPmt-members.html b/docs/d0/d0f/classshaka_1_1media_1_1mp2t_1_1TsSectionPmt-members.html index 837194620c..1c3dea5683 100644 --- a/docs/d0/d0f/classshaka_1_1media_1_1mp2t_1_1TsSectionPmt-members.html +++ b/docs/d0/d0f/classshaka_1_1media_1_1mp2t_1_1TsSectionPmt-members.html @@ -89,7 +89,7 @@ $(function() {
diff --git a/docs/d0/d10/classshaka_1_1media_1_1WidevinePsshGenerator-members.html b/docs/d0/d10/classshaka_1_1media_1_1WidevinePsshGenerator-members.html index 895d522451..2bce86e2ec 100644 --- a/docs/d0/d10/classshaka_1_1media_1_1WidevinePsshGenerator-members.html +++ b/docs/d0/d10/classshaka_1_1media_1_1WidevinePsshGenerator-members.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/d0/d11/structshaka_1_1media_1_1VPxFrameInfo.html b/docs/d0/d11/structshaka_1_1media_1_1VPxFrameInfo.html index 25a9b0fdb9..8ed99cf96f 100644 --- a/docs/d0/d11/structshaka_1_1media_1_1VPxFrameInfo.html +++ b/docs/d0/d11/structshaka_1_1media_1_1VPxFrameInfo.html @@ -97,7 +97,7 @@ uint32_t height diff --git a/docs/d0/d17/structshaka_1_1media_1_1StreamData-members.html b/docs/d0/d17/structshaka_1_1media_1_1StreamData-members.html index bc4a0bd93c..e8ac4c6290 100644 --- a/docs/d0/d17/structshaka_1_1media_1_1StreamData-members.html +++ b/docs/d0/d17/structshaka_1_1media_1_1StreamData-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/docs/d0/d1a/text__sample_8h_source.html b/docs/d0/d1a/text__sample_8h_source.html index 97bf20a35e..899b910430 100644 --- a/docs/d0/d1a/text__sample_8h_source.html +++ b/docs/d0/d1a/text__sample_8h_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d0/d1e/classshaka_1_1media_1_1H265ByteToUnitStreamConverter-members.html b/docs/d0/d1e/classshaka_1_1media_1_1H265ByteToUnitStreamConverter-members.html index d5d20ca89e..8da6745363 100644 --- a/docs/d0/d1e/classshaka_1_1media_1_1H265ByteToUnitStreamConverter-members.html +++ b/docs/d0/d1e/classshaka_1_1media_1_1H265ByteToUnitStreamConverter-members.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/d0/d1f/structshaka_1_1media_1_1mp4_1_1VTTCueBox-members.html b/docs/d0/d1f/structshaka_1_1media_1_1mp4_1_1VTTCueBox-members.html index 5ad31df2e8..8157348136 100644 --- a/docs/d0/d1f/structshaka_1_1media_1_1mp4_1_1VTTCueBox-members.html +++ b/docs/d0/d1f/structshaka_1_1media_1_1mp4_1_1VTTCueBox-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/d0/d26/classshaka_1_1media_1_1mp2t_1_1TsSectionPat.html b/docs/d0/d26/classshaka_1_1media_1_1mp2t_1_1TsSectionPat.html index 5ef5466e51..48458523ff 100644 --- a/docs/d0/d26/classshaka_1_1media_1_1mp2t_1_1TsSectionPat.html +++ b/docs/d0/d26/classshaka_1_1media_1_1mp2t_1_1TsSectionPat.html @@ -130,7 +130,7 @@ void Reset () override diff --git a/docs/d0/d27/structshaka_1_1media_1_1MuxerOptions.html b/docs/d0/d27/structshaka_1_1media_1_1MuxerOptions.html index 7365ee1b6a..98c1b9df4a 100644 --- a/docs/d0/d27/structshaka_1_1media_1_1MuxerOptions.html +++ b/docs/d0/d27/structshaka_1_1media_1_1MuxerOptions.html @@ -83,6 +83,8 @@ Public Attributes   std::string output_file_name   +size_t output_file_index = 0 +  std::string segment_template   @@ -110,7 +112,24 @@ std::string 

User-specified bit rate for the media stream. If zero, the muxer will attempt to estimate.

-

Definition at line 43 of file muxer_options.h.

+

Definition at line 50 of file muxer_options.h.

+ +
+ + +

◆ output_file_index

+ +
+
+ + + + +
size_t shaka::media::MuxerOptions::output_file_index = 0
+
+

Output file index. With one file per Representation per Period, there could be more than one file generated with Ad Cues present. This is the 0-based index of the output file. TODO(kqyang): Remove when the EPT adjustment logic in Fragmenter::FinalizeFragment is removed.

+ +

Definition at line 37 of file muxer_options.h.

@@ -144,7 +163,7 @@ std::string 

Specify output segment name pattern for generated segments. It can furthermore be configured by using a subset of the SegmentTemplate identifiers: $RepresentationID$, $Number$, $Bandwidth$ and $Time. Optional.

-

Definition at line 36 of file muxer_options.h.

+

Definition at line 43 of file muxer_options.h.

@@ -155,7 +174,7 @@ std::string  diff --git a/docs/d0/d2b/representation_8h_source.html b/docs/d0/d2b/representation_8h_source.html index 35178ec92e..75f11cfc33 100644 --- a/docs/d0/d2b/representation_8h_source.html +++ b/docs/d0/d2b/representation_8h_source.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d0/d30/mock__mpd__notifier_8h_source.html b/docs/d0/d30/mock__mpd__notifier_8h_source.html index 6563d7f0b2..9ef1cb18a8 100644 --- a/docs/d0/d30/mock__mpd__notifier_8h_source.html +++ b/docs/d0/d30/mock__mpd__notifier_8h_source.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/d0/d32/mp2t__common_8h_source.html b/docs/d0/d32/mp2t__common_8h_source.html index b4c767cd4e..f0ba909d9d 100644 --- a/docs/d0/d32/mp2t__common_8h_source.html +++ b/docs/d0/d32/mp2t__common_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d0/d33/classshaka_1_1MockRepresentation.html b/docs/d0/d33/classshaka_1_1MockRepresentation.html index 22fa632139..1158b1249b 100644 --- a/docs/d0/d33/classshaka_1_1MockRepresentation.html +++ b/docs/d0/d33/classshaka_1_1MockRepresentation.html @@ -152,7 +152,7 @@ Additional Inherited Members diff --git a/docs/d0/d35/es__descriptor_8cc_source.html b/docs/d0/d35/es__descriptor_8cc_source.html index 121997a354..7e97b7c063 100644 --- a/docs/d0/d35/es__descriptor_8cc_source.html +++ b/docs/d0/d35/es__descriptor_8cc_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d0/d37/unionshaka_1_1EncryptionParams_1_1EncryptedStreamAttributes_1_1OneOf.html b/docs/d0/d37/unionshaka_1_1EncryptionParams_1_1EncryptedStreamAttributes_1_1OneOf.html index ce18bfe111..eaa0fb85b7 100644 --- a/docs/d0/d37/unionshaka_1_1EncryptionParams_1_1EncryptedStreamAttributes_1_1OneOf.html +++ b/docs/d0/d37/unionshaka_1_1EncryptionParams_1_1EncryptedStreamAttributes_1_1OneOf.html @@ -105,7 +105,7 @@ struct { diff --git a/docs/d0/d3a/hls__notify__muxer__listener_8cc_source.html b/docs/d0/d3a/hls__notify__muxer__listener_8cc_source.html index ed4bc52417..079200fe3e 100644 --- a/docs/d0/d3a/hls__notify__muxer__listener_8cc_source.html +++ b/docs/d0/d3a/hls__notify__muxer__listener_8cc_source.html @@ -94,7 +94,7 @@ $(function() { diff --git a/docs/d0/d3a/webm__constants_8h_source.html b/docs/d0/d3a/webm__constants_8h_source.html index 94f9a0476f..0b8806972b 100644 --- a/docs/d0/d3a/webm__constants_8h_source.html +++ b/docs/d0/d3a/webm__constants_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d0/d3c/structshaka_1_1media_1_1mp4_1_1ProtectionSystemSpecificHeader.html b/docs/d0/d3c/structshaka_1_1media_1_1mp4_1_1ProtectionSystemSpecificHeader.html index 7358d8c93c..1d393856c1 100644 --- a/docs/d0/d3c/structshaka_1_1media_1_1mp4_1_1ProtectionSystemSpecificHeader.html +++ b/docs/d0/d3c/structshaka_1_1media_1_1mp4_1_1ProtectionSystemSpecificHeader.html @@ -107,10 +107,10 @@ std::vector< uint8_t >    - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

@@ -121,7 +121,7 @@ Additional Inherited Members

Detailed Description

-

Definition at line 57 of file box_definitions.h.

+

Definition at line 58 of file box_definitions.h.

Member Function Documentation

◆ BoxType()

@@ -149,7 +149,7 @@ Additional Inherited Members

Implements shaka::media::mp4::Box.

-

Definition at line 161 of file box_definitions.cc.

+

Definition at line 162 of file box_definitions.cc.

@@ -160,7 +160,7 @@ Additional Inherited Members diff --git a/docs/d0/d42/aes__cryptor_8h_source.html b/docs/d0/d42/aes__cryptor_8h_source.html index a2490e4e40..b8e5bd0332 100644 --- a/docs/d0/d42/aes__cryptor_8h_source.html +++ b/docs/d0/d42/aes__cryptor_8h_source.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/d0/d42/widevine__encryption__flags_8cc_source.html b/docs/d0/d42/widevine__encryption__flags_8cc_source.html index 8cb4d6c6ce..8574547204 100644 --- a/docs/d0/d42/widevine__encryption__flags_8cc_source.html +++ b/docs/d0/d42/widevine__encryption__flags_8cc_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d0/d43/structshaka_1_1Mp4OutputParams.html b/docs/d0/d43/structshaka_1_1Mp4OutputParams.html index 915414ccb8..a8a8a27f50 100644 --- a/docs/d0/d43/structshaka_1_1Mp4OutputParams.html +++ b/docs/d0/d43/structshaka_1_1Mp4OutputParams.html @@ -148,7 +148,7 @@ static constexpr int kSing diff --git a/docs/d0/d46/fourccs_8h_source.html b/docs/d0/d46/fourccs_8h_source.html index 7012b0871c..21b7fb7162 100644 --- a/docs/d0/d46/fourccs_8h_source.html +++ b/docs/d0/d46/fourccs_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d0/d48/structshaka_1_1media_1_1SegmentInfo-members.html b/docs/d0/d48/structshaka_1_1media_1_1SegmentInfo-members.html index 9e43e80833..736e353d22 100644 --- a/docs/d0/d48/structshaka_1_1media_1_1SegmentInfo-members.html +++ b/docs/d0/d48/structshaka_1_1media_1_1SegmentInfo-members.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d0/d49/vod__media__info__dump__muxer__listener_8cc_source.html b/docs/d0/d49/vod__media__info__dump__muxer__listener_8cc_source.html index c898de93e7..ec0396b679 100644 --- a/docs/d0/d49/vod__media__info__dump__muxer__listener_8cc_source.html +++ b/docs/d0/d49/vod__media__info__dump__muxer__listener_8cc_source.html @@ -83,11 +83,11 @@ $(function() {
virtual bool Open()=0
Internal open. Should not be used directly.
void OnMediaEnd(const MediaRanges &media_ranges, float duration_seconds) override
void OnEncryptionInfoReady(bool is_initial_encryption_info, FourCC protection_scheme, const std::vector< uint8_t > &default_key_id, const std::vector< uint8_t > &iv, const std::vector< ProtectionSystemSpecificInfo > &key_system_info) override
-
std::string segment_template
Definition: muxer_options.h:36
+
std::string segment_template
Definition: muxer_options.h:43
diff --git a/docs/d0/d4b/structshaka_1_1media_1_1mp4_1_1MediaInformation-members.html b/docs/d0/d4b/structshaka_1_1media_1_1mp4_1_1MediaInformation-members.html index 445ee52d08..f765f6de49 100644 --- a/docs/d0/d4b/structshaka_1_1media_1_1mp4_1_1MediaInformation-members.html +++ b/docs/d0/d4b/structshaka_1_1media_1_1mp4_1_1MediaInformation-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/d0/d4c/structshaka_1_1media_1_1StreamData.html b/docs/d0/d4c/structshaka_1_1media_1_1StreamData.html index 5e5341ef8d..8c401697f9 100644 --- a/docs/d0/d4c/structshaka_1_1media_1_1StreamData.html +++ b/docs/d0/d4c/structshaka_1_1media_1_1StreamData.html @@ -121,14 +121,14 @@ std::shared_ptr< const

Detailed Description

-

Definition at line 65 of file media_handler.h.

+

Definition at line 67 of file media_handler.h.


The documentation for this struct was generated from the following file: diff --git a/docs/d0/d4d/classshaka_1_1media_1_1AudioTimestampHelper.html b/docs/d0/d4d/classshaka_1_1media_1_1AudioTimestampHelper.html index 3e3a937e79..24c66cb82d 100644 --- a/docs/d0/d4d/classshaka_1_1media_1_1AudioTimestampHelper.html +++ b/docs/d0/d4d/classshaka_1_1media_1_1AudioTimestampHelper.html @@ -107,7 +107,7 @@ int64_t GetFramesToTarget< diff --git a/docs/d0/d4e/libcrypto__threading_8cc_source.html b/docs/d0/d4e/libcrypto__threading_8cc_source.html index 53bfb38262..eb19515142 100644 --- a/docs/d0/d4e/libcrypto__threading_8cc_source.html +++ b/docs/d0/d4e/libcrypto__threading_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d0/d53/classshaka_1_1media_1_1mp2t_1_1TsMuxer-members.html b/docs/d0/d53/classshaka_1_1media_1_1mp2t_1_1TsMuxer-members.html index 627f1d5f42..f5c3b2a652 100644 --- a/docs/d0/d53/classshaka_1_1media_1_1mp2t_1_1TsMuxer-members.html +++ b/docs/d0/d53/classshaka_1_1media_1_1mp2t_1_1TsMuxer-members.html @@ -90,7 +90,7 @@ $(function() { muxer_listener() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected next_output_stream_index() const (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected num_input_streams() const (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected - OnFlushRequest(size_t input_stream_index) overrideshaka::media::Muxerinlineprotectedvirtual + OnFlushRequest(size_t input_stream_index) overrideshaka::media::Muxerprotectedvirtual options() const (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected Process(std::unique_ptr< StreamData > stream_data) overrideshaka::media::Muxerprotectedvirtual @@ -108,7 +108,7 @@ $(function() { diff --git a/docs/d0/d59/classshaka_1_1media_1_1Job.html b/docs/d0/d59/classshaka_1_1media_1_1Job.html index 8523ba3ee0..95436c2c8e 100644 --- a/docs/d0/d59/classshaka_1_1media_1_1Job.html +++ b/docs/d0/d59/classshaka_1_1media_1_1Job.html @@ -103,7 +103,7 @@ base::WaitableEvent * wait diff --git a/docs/d0/d5b/classshaka_1_1media_1_1MpdNotifyMuxerListener-members.html b/docs/d0/d5b/classshaka_1_1media_1_1MpdNotifyMuxerListener-members.html index 6fd120a707..4da43dc95f 100644 --- a/docs/d0/d5b/classshaka_1_1media_1_1MpdNotifyMuxerListener-members.html +++ b/docs/d0/d5b/classshaka_1_1media_1_1MpdNotifyMuxerListener-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/docs/d0/d65/ad__cue__generator__flags_8cc_source.html b/docs/d0/d65/ad__cue__generator__flags_8cc_source.html index 3aec1448a3..3eaf0ae5d2 100644 --- a/docs/d0/d65/ad__cue__generator__flags_8cc_source.html +++ b/docs/d0/d65/ad__cue__generator__flags_8cc_source.html @@ -69,7 +69,7 @@ $(function() {
1 // Copyright 2017 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 //
7 // Defines cuepoint generator flags.
8 
9 #include "packager/app/ad_cue_generator_flags.h"
10 
11 DEFINE_string(ad_cues,
12  "",
13  "List of cuepoint markers."
14  "This flag accepts semicolon separated pairs and components in "
15  "the pair are separated by a comma and the second component "
16  "duration is optional. For example --ad_cues "
17  "{start_time}[,{duration}][;{start_time}[,{duration}]]..."
18  "The start_time represents the start of the cue marker in "
19  "seconds relative to the start of the program.");
diff --git a/docs/d0/d73/structshaka_1_1media_1_1mp4_1_1VideoSampleEntry.html b/docs/d0/d73/structshaka_1_1media_1_1mp4_1_1VideoSampleEntry.html index d381f8fef7..ca075ac953 100644 --- a/docs/d0/d73/structshaka_1_1media_1_1mp4_1_1VideoSampleEntry.html +++ b/docs/d0/d73/structshaka_1_1media_1_1mp4_1_1VideoSampleEntry.html @@ -107,16 +107,16 @@ FourCC GetCodecConfigurati

Public Attributes

-FourCC format +FourCC format = FOURCC_NULL   -uint16_t data_reference_index +uint16_t data_reference_index = 1u   -uint16_t width +uint16_t width = 0u   -uint16_t height +uint16_t height = 0u   PixelAspectRatio pixel_aspect @@ -164,7 +164,7 @@ Additional Inherited Members

Implements shaka::media::mp4::Box.

-

Definition at line 1431 of file box_definitions.cc.

+

Definition at line 1463 of file box_definitions.cc.

@@ -175,7 +175,7 @@ Additional Inherited Members diff --git a/docs/d0/d7c/structshaka_1_1media_1_1mp4_1_1SampleToGroup.html b/docs/d0/d7c/structshaka_1_1media_1_1mp4_1_1SampleToGroup.html index dfd3152749..f61407b700 100644 --- a/docs/d0/d7c/structshaka_1_1media_1_1mp4_1_1SampleToGroup.html +++ b/docs/d0/d7c/structshaka_1_1media_1_1mp4_1_1SampleToGroup.html @@ -103,20 +103,20 @@ Public Member Functions

Public Attributes

-uint32_t grouping_type +uint32_t grouping_type = 0u   -uint32_t grouping_type_parameter +uint32_t grouping_type_parameter = 0u   std::vector< SampleToGroupEntryentries   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

@@ -127,7 +127,7 @@ Additional Inherited Members

Detailed Description

-

Definition at line 530 of file box_definitions.h.

+

Definition at line 535 of file box_definitions.h.

Member Function Documentation

◆ BoxType()

@@ -155,7 +155,7 @@ Additional Inherited Members

Implements shaka::media::mp4::Box.

-

Definition at line 1078 of file box_definitions.cc.

+

Definition at line 1096 of file box_definitions.cc.

@@ -166,7 +166,7 @@ Additional Inherited Members diff --git a/docs/d0/d7d/decryptor__source_8h_source.html b/docs/d0/d7d/decryptor__source_8h_source.html index f55efbbaca..94f4a7160d 100644 --- a/docs/d0/d7d/decryptor__source_8h_source.html +++ b/docs/d0/d7d/decryptor__source_8h_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d0/d80/classshaka_1_1media_1_1AesCbcEncryptor-members.html b/docs/d0/d80/classshaka_1_1media_1_1AesCbcEncryptor-members.html index 1954f45757..a9d30c2b5e 100644 --- a/docs/d0/d80/classshaka_1_1media_1_1AesCbcEncryptor-members.html +++ b/docs/d0/d80/classshaka_1_1media_1_1AesCbcEncryptor-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/docs/d0/d86/structshaka_1_1media_1_1ProtectionSystemSpecificInfo.html b/docs/d0/d86/structshaka_1_1media_1_1ProtectionSystemSpecificInfo.html index b4a9bbbb4b..4ea68d61fd 100644 --- a/docs/d0/d86/structshaka_1_1media_1_1ProtectionSystemSpecificInfo.html +++ b/docs/d0/d86/structshaka_1_1media_1_1ProtectionSystemSpecificInfo.html @@ -141,7 +141,7 @@ std::vector< uint8_t >  diff --git a/docs/d0/d9a/structshaka_1_1media_1_1mp4_1_1Movie.html b/docs/d0/d9a/structshaka_1_1media_1_1mp4_1_1Movie.html index 758579782c..62b414eb01 100644 --- a/docs/d0/d9a/structshaka_1_1media_1_1mp4_1_1Movie.html +++ b/docs/d0/d9a/structshaka_1_1media_1_1mp4_1_1Movie.html @@ -124,7 +124,7 @@ Additional Inherited Members

Detailed Description

-

Definition at line 654 of file box_definitions.h.

+

Definition at line 659 of file box_definitions.h.

Member Function Documentation

◆ BoxType()

@@ -152,7 +152,7 @@ Additional Inherited Members

Implements shaka::media::mp4::Box.

-

Definition at line 2188 of file box_definitions.cc.

+

Definition at line 2246 of file box_definitions.cc.

@@ -163,7 +163,7 @@ Additional Inherited Members diff --git a/docs/d0/da2/classshaka_1_1media_1_1AACAudioSpecificConfig.html b/docs/d0/da2/classshaka_1_1media_1_1AACAudioSpecificConfig.html index 089cbbed64..5da30ae1db 100644 --- a/docs/d0/da2/classshaka_1_1media_1_1AACAudioSpecificConfig.html +++ b/docs/d0/da2/classshaka_1_1media_1_1AACAudioSpecificConfig.html @@ -330,7 +330,7 @@ static const size_t  diff --git a/docs/d0/da2/classshaka_1_1media_1_1RequestSigner-members.html b/docs/d0/da2/classshaka_1_1media_1_1RequestSigner-members.html index 1c21fbf61f..b9bb041f47 100644 --- a/docs/d0/da2/classshaka_1_1media_1_1RequestSigner-members.html +++ b/docs/d0/da2/classshaka_1_1media_1_1RequestSigner-members.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/d0/da2/structshaka_1_1xml_1_1XmlDeleter-members.html b/docs/d0/da2/structshaka_1_1xml_1_1XmlDeleter-members.html index e8d3d79b5f..e6b81de138 100644 --- a/docs/d0/da2/structshaka_1_1xml_1_1XmlDeleter-members.html +++ b/docs/d0/da2/structshaka_1_1xml_1_1XmlDeleter-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d0/da6/stream__descriptor_8cc_source.html b/docs/d0/da6/stream__descriptor_8cc_source.html index b968f8e0f9..5682b3787c 100644 --- a/docs/d0/da6/stream__descriptor_8cc_source.html +++ b/docs/d0/da6/stream__descriptor_8cc_source.html @@ -86,7 +86,7 @@ $(function() { diff --git a/docs/d0/da8/classshaka_1_1media_1_1PackedAudioWriter-members.html b/docs/d0/da8/classshaka_1_1media_1_1PackedAudioWriter-members.html index 196058e83a..abb57e360b 100644 --- a/docs/d0/da8/classshaka_1_1media_1_1PackedAudioWriter-members.html +++ b/docs/d0/da8/classshaka_1_1media_1_1PackedAudioWriter-members.html @@ -90,7 +90,7 @@ $(function() { muxer_listener() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected next_output_stream_index() const (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected num_input_streams() const (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected - OnFlushRequest(size_t input_stream_index) overrideshaka::media::Muxerinlineprotectedvirtual + OnFlushRequest(size_t input_stream_index) overrideshaka::media::Muxerprotectedvirtual options() const (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected PackedAudioWriter(const MuxerOptions &muxer_options)shaka::media::PackedAudioWriterexplicit @@ -109,7 +109,7 @@ $(function() { diff --git a/docs/d0/da8/structshaka_1_1HlsParams.html b/docs/d0/da8/structshaka_1_1HlsParams.html index fd9e55f927..986bfa1c7d 100644 --- a/docs/d0/da8/structshaka_1_1HlsParams.html +++ b/docs/d0/da8/structshaka_1_1HlsParams.html @@ -192,7 +192,7 @@ std::string  diff --git a/docs/d0/dab/classshaka_1_1media_1_1mp4_1_1SingleSegmentSegmenter.html b/docs/d0/dab/classshaka_1_1media_1_1mp4_1_1SingleSegmentSegmenter.html index c5e2f96293..64b59d90f1 100644 --- a/docs/d0/dab/classshaka_1_1media_1_1mp4_1_1SingleSegmentSegmenter.html +++ b/docs/d0/dab/classshaka_1_1media_1_1mp4_1_1SingleSegmentSegmenter.html @@ -247,7 +247,7 @@ void set_progress_target diff --git a/docs/d0/dac/classshaka_1_1media_1_1EncryptionHandler-members.html b/docs/d0/dac/classshaka_1_1media_1_1EncryptionHandler-members.html index 58705fcc8c..dfbad42f2c 100644 --- a/docs/d0/dac/classshaka_1_1media_1_1EncryptionHandler-members.html +++ b/docs/d0/dac/classshaka_1_1media_1_1EncryptionHandler-members.html @@ -98,7 +98,7 @@ $(function() { diff --git a/docs/d0/dae/file__util_8h_source.html b/docs/d0/dae/file__util_8h_source.html index e24d2e4910..4f4afab99b 100644 --- a/docs/d0/dae/file__util_8h_source.html +++ b/docs/d0/dae/file__util_8h_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d0/db4/structshaka_1_1RawKeyParams.html b/docs/d0/db4/structshaka_1_1RawKeyParams.html index b0f32ef4de..2aa7a64b00 100644 --- a/docs/d0/db4/structshaka_1_1RawKeyParams.html +++ b/docs/d0/db4/structshaka_1_1RawKeyParams.html @@ -159,7 +159,7 @@ Public Attributes diff --git a/docs/d0/dbb/classshaka_1_1media_1_1mp2t_1_1Ac3Header-members.html b/docs/d0/dbb/classshaka_1_1media_1_1mp2t_1_1Ac3Header-members.html index 1bd06d2f6e..7071f275e3 100644 --- a/docs/d0/dbb/classshaka_1_1media_1_1mp2t_1_1Ac3Header-members.html +++ b/docs/d0/dbb/classshaka_1_1media_1_1mp2t_1_1Ac3Header-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/docs/d0/dbc/bit__writer_8h_source.html b/docs/d0/dbc/bit__writer_8h_source.html index 5a49309d45..359ed8df89 100644 --- a/docs/d0/dbc/bit__writer_8h_source.html +++ b/docs/d0/dbc/bit__writer_8h_source.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/d0/dbc/webvtt__parser_8h_source.html b/docs/d0/dbc/webvtt__parser_8h_source.html index f6e3b5d6f7..db4e968376 100644 --- a/docs/d0/dbc/webvtt__parser_8h_source.html +++ b/docs/d0/dbc/webvtt__parser_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d0/dbd/classshaka_1_1media_1_1webm_1_1MultiSegmentSegmenter-members.html b/docs/d0/dbd/classshaka_1_1media_1_1webm_1_1MultiSegmentSegmenter-members.html index 13e0035a95..bd1a704250 100644 --- a/docs/d0/dbd/classshaka_1_1media_1_1webm_1_1MultiSegmentSegmenter-members.html +++ b/docs/d0/dbd/classshaka_1_1media_1_1webm_1_1MultiSegmentSegmenter-members.html @@ -100,7 +100,7 @@ $(function() { diff --git a/docs/d0/dbe/structshaka_1_1RawKeyParams_1_1KeyInfo.html b/docs/d0/dbe/structshaka_1_1RawKeyParams_1_1KeyInfo.html index 2661129ded..6e511825ee 100644 --- a/docs/d0/dbe/structshaka_1_1RawKeyParams_1_1KeyInfo.html +++ b/docs/d0/dbe/structshaka_1_1RawKeyParams_1_1KeyInfo.html @@ -88,7 +88,7 @@ std::vector< uint8_t >  diff --git a/docs/d0/dc0/structshaka_1_1media_1_1SegmentInfo.html b/docs/d0/dc0/structshaka_1_1media_1_1SegmentInfo.html index 9ce56fb179..3d7a04284b 100644 --- a/docs/d0/dc0/structshaka_1_1media_1_1SegmentInfo.html +++ b/docs/d0/dc0/structshaka_1_1media_1_1SegmentInfo.html @@ -90,14 +90,14 @@ std::shared_ptr<

Detailed Description

-

Definition at line 53 of file media_handler.h.

+

Definition at line 55 of file media_handler.h.


The documentation for this struct was generated from the following file: diff --git a/docs/d0/dc1/structshaka_1_1media_1_1mp4_1_1VTTEmptyCueBox-members.html b/docs/d0/dc1/structshaka_1_1media_1_1mp4_1_1VTTEmptyCueBox-members.html index db2fdb09d8..06a125803a 100644 --- a/docs/d0/dc1/structshaka_1_1media_1_1mp4_1_1VTTEmptyCueBox-members.html +++ b/docs/d0/dc1/structshaka_1_1media_1_1mp4_1_1VTTEmptyCueBox-members.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/d0/dc8/classshaka_1_1xml_1_1AdaptationSetXmlNode-members.html b/docs/d0/dc8/classshaka_1_1xml_1_1AdaptationSetXmlNode-members.html index 12712a2265..da9edec7f5 100644 --- a/docs/d0/dc8/classshaka_1_1xml_1_1AdaptationSetXmlNode-members.html +++ b/docs/d0/dc8/classshaka_1_1xml_1_1AdaptationSetXmlNode-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/docs/d0/dce/classshaka_1_1media_1_1RsaPrivateKey.html b/docs/d0/dce/classshaka_1_1media_1_1RsaPrivateKey.html index 93c2edc845..2200593e7b 100644 --- a/docs/d0/dce/classshaka_1_1media_1_1RsaPrivateKey.html +++ b/docs/d0/dce/classshaka_1_1media_1_1RsaPrivateKey.html @@ -203,7 +203,7 @@ Static Public Member Functions diff --git a/docs/d0/dd0/structshaka_1_1media_1_1mp4_1_1CueSettingsBox.html b/docs/d0/dd0/structshaka_1_1media_1_1mp4_1_1CueSettingsBox.html index 6453c9d467..e8638bfb74 100644 --- a/docs/d0/dd0/structshaka_1_1media_1_1mp4_1_1CueSettingsBox.html +++ b/docs/d0/dd0/structshaka_1_1media_1_1mp4_1_1CueSettingsBox.html @@ -112,7 +112,7 @@ Additional Inherited Members

Detailed Description

-

Definition at line 802 of file box_definitions.h.

+

Definition at line 814 of file box_definitions.h.

Member Function Documentation

◆ BoxType()

@@ -140,7 +140,7 @@ Additional Inherited Members

Implements shaka::media::mp4::Box.

-

Definition at line 2639 of file box_definitions.cc.

+

Definition at line 2711 of file box_definitions.cc.

@@ -151,7 +151,7 @@ Additional Inherited Members diff --git a/docs/d0/dd6/webm__crypto__helpers_8cc_source.html b/docs/d0/dd6/webm__crypto__helpers_8cc_source.html index 1aef6ed563..be6c7f144f 100644 --- a/docs/d0/dd6/webm__crypto__helpers_8cc_source.html +++ b/docs/d0/dd6/webm__crypto__helpers_8cc_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d0/dd8/classshaka_1_1media_1_1AesCtrEncryptor.html b/docs/d0/dd8/classshaka_1_1media_1_1AesCtrEncryptor.html index 36c9521a73..3f6eafcbdd 100644 --- a/docs/d0/dd8/classshaka_1_1media_1_1AesCtrEncryptor.html +++ b/docs/d0/dd8/classshaka_1_1media_1_1AesCtrEncryptor.html @@ -141,7 +141,7 @@ AES_KEY * mutable_aes_key< diff --git a/docs/d0/dea/classshaka_1_1media_1_1SyncPointQueue.html b/docs/d0/dea/classshaka_1_1media_1_1SyncPointQueue.html index 36544e72f8..06b539852e 100644 --- a/docs/d0/dea/classshaka_1_1media_1_1SyncPointQueue.html +++ b/docs/d0/dea/classshaka_1_1media_1_1SyncPointQueue.html @@ -211,7 +211,7 @@ void  diff --git a/docs/d0/dee/segmenter__test__base_8h_source.html b/docs/d0/dee/segmenter__test__base_8h_source.html index 0499ef06b4..ba45c953e9 100644 --- a/docs/d0/dee/segmenter__test__base_8h_source.html +++ b/docs/d0/dee/segmenter__test__base_8h_source.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/d0/df3/packager__util_8cc_source.html b/docs/d0/df3/packager__util_8cc_source.html index dcbb737e35..87d92699b5 100644 --- a/docs/d0/df3/packager__util_8cc_source.html +++ b/docs/d0/df3/packager__util_8cc_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d0/df4/classshaka_1_1hls_1_1MasterPlaylist-members.html b/docs/d0/df4/classshaka_1_1hls_1_1MasterPlaylist-members.html index fd9fa6e5c5..78ce7dac4a 100644 --- a/docs/d0/df4/classshaka_1_1hls_1_1MasterPlaylist-members.html +++ b/docs/d0/df4/classshaka_1_1hls_1_1MasterPlaylist-members.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d0/dfc/structshaka_1_1media_1_1mp4_1_1AudioSampleEntry-members.html b/docs/d0/dfc/structshaka_1_1media_1_1mp4_1_1AudioSampleEntry-members.html index ed9d3f98c3..28d0be49a8 100644 --- a/docs/d0/dfc/structshaka_1_1media_1_1mp4_1_1AudioSampleEntry-members.html +++ b/docs/d0/dfc/structshaka_1_1media_1_1mp4_1_1AudioSampleEntry-members.html @@ -97,7 +97,7 @@ $(function() { diff --git a/docs/d1/d03/structshaka_1_1media_1_1MuxerListener_1_1MediaRanges.html b/docs/d1/d03/structshaka_1_1media_1_1MuxerListener_1_1MediaRanges.html index ef71e47c72..4b07ff5cf8 100644 --- a/docs/d1/d03/structshaka_1_1media_1_1MuxerListener_1_1MediaRanges.html +++ b/docs/d1/d03/structshaka_1_1media_1_1MuxerListener_1_1MediaRanges.html @@ -113,7 +113,7 @@ base::Optional< diff --git a/docs/d1/d07/structshaka_1_1AdCueGeneratorParams-members.html b/docs/d1/d07/structshaka_1_1AdCueGeneratorParams-members.html index 8f75777445..5b5b696d8e 100644 --- a/docs/d1/d07/structshaka_1_1AdCueGeneratorParams-members.html +++ b/docs/d1/d07/structshaka_1_1AdCueGeneratorParams-members.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d1/d07/structshaka_1_1Cuepoint-members.html b/docs/d1/d07/structshaka_1_1Cuepoint-members.html index 15b45ad451..bcf615f8cf 100644 --- a/docs/d1/d07/structshaka_1_1Cuepoint-members.html +++ b/docs/d1/d07/structshaka_1_1Cuepoint-members.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d1/d0a/classshaka_1_1media_1_1MkvWriter.html b/docs/d1/d0a/classshaka_1_1media_1_1MkvWriter.html index 9dbbbd0a5d..bc8eed64fb 100644 --- a/docs/d1/d0a/classshaka_1_1media_1_1MkvWriter.html +++ b/docs/d1/d0a/classshaka_1_1media_1_1MkvWriter.html @@ -363,7 +363,7 @@ Public Member Functions diff --git a/docs/d1/d0a/structshaka_1_1media_1_1H264Sps.html b/docs/d1/d0a/structshaka_1_1media_1_1H264Sps.html index ca913b5868..4e6b8961c1 100644 --- a/docs/d1/d0a/structshaka_1_1media_1_1H264Sps.html +++ b/docs/d1/d0a/structshaka_1_1media_1_1H264Sps.html @@ -218,7 +218,7 @@ int chroma_array_type< diff --git a/docs/d1/d0b/hevc__decoder__configuration__record_8cc_source.html b/docs/d1/d0b/hevc__decoder__configuration__record_8cc_source.html index fa6963e83c..d45e7e829c 100644 --- a/docs/d1/d0b/hevc__decoder__configuration__record_8cc_source.html +++ b/docs/d1/d0b/hevc__decoder__configuration__record_8cc_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d1/d12/classshaka_1_1media_1_1mp2t_1_1EsParserH264-members.html b/docs/d1/d12/classshaka_1_1media_1_1mp2t_1_1EsParserH264-members.html index 3ab0925b8f..c878ab5174 100644 --- a/docs/d1/d12/classshaka_1_1media_1_1mp2t_1_1EsParserH264-members.html +++ b/docs/d1/d12/classshaka_1_1media_1_1mp2t_1_1EsParserH264-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/d1/d12/range_8h_source.html b/docs/d1/d12/range_8h_source.html index bab9c4b58b..9198375a15 100644 --- a/docs/d1/d12/range_8h_source.html +++ b/docs/d1/d12/range_8h_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d1/d13/status_8h_source.html b/docs/d1/d13/status_8h_source.html index 11b4ccef7e..0e40de1745 100644 --- a/docs/d1/d13/status_8h_source.html +++ b/docs/d1/d13/status_8h_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/d1/d17/structshaka_1_1WidevineDecryptionParams-members.html b/docs/d1/d17/structshaka_1_1WidevineDecryptionParams-members.html index 1dfc522f2d..024eab1d14 100644 --- a/docs/d1/d17/structshaka_1_1WidevineDecryptionParams-members.html +++ b/docs/d1/d17/structshaka_1_1WidevineDecryptionParams-members.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d1/d1c/two__pass__single__segment__segmenter_8cc_source.html b/docs/d1/d1c/two__pass__single__segment__segmenter_8cc_source.html index cb1be0021d..28db51ec12 100644 --- a/docs/d1/d1c/two__pass__single__segment__segmenter_8cc_source.html +++ b/docs/d1/d1c/two__pass__single__segment__segmenter_8cc_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d1/d1d/muxer__flags_8cc_source.html b/docs/d1/d1d/muxer__flags_8cc_source.html index 554cee453e..e99bc15ff3 100644 --- a/docs/d1/d1d/muxer__flags_8cc_source.html +++ b/docs/d1/d1d/muxer__flags_8cc_source.html @@ -69,7 +69,7 @@ $(function() {
1 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 //
7 // Defines Muxer flags.
8 
9 #include "packager/app/muxer_flags.h"
10 
11 DEFINE_double(clear_lead,
12  10.0f,
13  "Clear lead in seconds if encryption is enabled.");
14 DEFINE_double(segment_duration,
15  10.0f,
16  "Segment duration in seconds. If single_segment is specified, "
17  "this parameter sets the duration of a subsegment; otherwise, "
18  "this parameter sets the duration of a segment. Actual segment "
19  "durations may not be exactly as requested.");
20 DEFINE_bool(segment_sap_aligned,
21  true,
22  "Force segments to begin with stream access points.");
23 DEFINE_double(fragment_duration,
24  10.0f,
25  "Fragment duration in seconds. Should not be larger than "
26  "the segment duration. Actual fragment durations may not be "
27  "exactly as requested.");
28 DEFINE_bool(fragment_sap_aligned,
29  true,
30  "Force fragments to begin with stream access points. This flag "
31  "implies segment_sap_aligned.");
32 DEFINE_int32(num_subsegments_per_sidx,
33  1,
34  "For ISO BMFF only. Set the number of subsegments in each "
35  "SIDX box. If 0, a single SIDX box is used per segment; if "
36  "-1, no SIDX box is used; Otherwise, the muxer packs N "
37  "subsegments in the root SIDX of the segment, with "
38  "segment_duration/N/fragment_duration fragments per "
39  "subsegment.");
40 DEFINE_string(temp_dir,
41  "",
42  "Specify a directory in which to store temporary (intermediate) "
43  " files. Used only if single_segment=true.");
44 DEFINE_bool(mp4_include_pssh_in_stream,
45  true,
46  "MP4 only: include pssh in the encrypted stream.");
47 DEFINE_bool(mp4_use_decoding_timestamp_in_timeline,
48  false,
49  "If set, decoding timestamp instead of presentation timestamp will "
50  "be used when generating media timeline, e.g. timestamps in sidx "
51  "and mpd. This is to workaround a Chromium bug that decoding "
52  "timestamp is used in buffered range, https://crbug.com/398130.");
diff --git a/docs/d1/d1e/hls__notifier_8h_source.html b/docs/d1/d1e/hls__notifier_8h_source.html index ae20678ad9..aef40eb04c 100644 --- a/docs/d1/d1e/hls__notifier_8h_source.html +++ b/docs/d1/d1e/hls__notifier_8h_source.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/d1/d1f/classshaka_1_1media_1_1KeySource.html b/docs/d1/d1f/classshaka_1_1media_1_1KeySource.html index e23736a023..5137c93554 100644 --- a/docs/d1/d1f/classshaka_1_1media_1_1KeySource.html +++ b/docs/d1/d1f/classshaka_1_1media_1_1KeySource.html @@ -343,7 +343,7 @@ Protected Member Functions diff --git a/docs/d1/d20/classshaka_1_1media_1_1mp4_1_1DecodingTimeIterator.html b/docs/d1/d20/classshaka_1_1media_1_1mp4_1_1DecodingTimeIterator.html index 611fb15e38..12c7c1b545 100644 --- a/docs/d1/d20/classshaka_1_1media_1_1mp4_1_1DecodingTimeIterator.html +++ b/docs/d1/d20/classshaka_1_1media_1_1mp4_1_1DecodingTimeIterator.html @@ -220,7 +220,7 @@ Public Member Functions diff --git a/docs/d1/d25/classshaka_1_1media_1_1MediaHandlerTestBase-members.html b/docs/d1/d25/classshaka_1_1media_1_1MediaHandlerTestBase-members.html index 668caadbc5..c5e7d49769 100644 --- a/docs/d1/d25/classshaka_1_1media_1_1MediaHandlerTestBase-members.html +++ b/docs/d1/d25/classshaka_1_1media_1_1MediaHandlerTestBase-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/d1/d27/key__fetcher_8h_source.html b/docs/d1/d27/key__fetcher_8h_source.html index b7efe3a18b..2173bed149 100644 --- a/docs/d1/d27/key__fetcher_8h_source.html +++ b/docs/d1/d27/key__fetcher_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d1/d28/classshaka_1_1media_1_1mp2t_1_1AdtsHeader-members.html b/docs/d1/d28/classshaka_1_1media_1_1mp2t_1_1AdtsHeader-members.html index e5fe5294e2..0216af4879 100644 --- a/docs/d1/d28/classshaka_1_1media_1_1mp2t_1_1AdtsHeader-members.html +++ b/docs/d1/d28/classshaka_1_1media_1_1mp2t_1_1AdtsHeader-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/docs/d1/d2a/decryptor__source_8cc_source.html b/docs/d1/d2a/decryptor__source_8cc_source.html index 9cfe5cbfaf..705cdf38de 100644 --- a/docs/d1/d2a/decryptor__source_8cc_source.html +++ b/docs/d1/d2a/decryptor__source_8cc_source.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/d1/d2b/file__util_8cc_source.html b/docs/d1/d2b/file__util_8cc_source.html index a993081adc..10118481a0 100644 --- a/docs/d1/d2b/file__util_8cc_source.html +++ b/docs/d1/d2b/file__util_8cc_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d1/d2c/structshaka_1_1media_1_1mp4_1_1DataReference-members.html b/docs/d1/d2c/structshaka_1_1media_1_1mp4_1_1DataReference-members.html index a9e6ea2c5b..afe7dc8ae0 100644 --- a/docs/d1/d2c/structshaka_1_1media_1_1mp4_1_1DataReference-members.html +++ b/docs/d1/d2c/structshaka_1_1media_1_1mp4_1_1DataReference-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/d1/d2d/structshaka_1_1media_1_1mp4_1_1Box.html b/docs/d1/d2d/structshaka_1_1media_1_1mp4_1_1Box.html index 3d21b70223..f6bb00bc82 100644 --- a/docs/d1/d2d/structshaka_1_1media_1_1mp4_1_1Box.html +++ b/docs/d1/d2d/structshaka_1_1media_1_1mp4_1_1Box.html @@ -372,7 +372,7 @@ class BoxBuffer diff --git a/docs/d1/d30/classshaka_1_1media_1_1mp2t_1_1TsSectionPes.html b/docs/d1/d30/classshaka_1_1media_1_1mp2t_1_1TsSectionPes.html index 5183aa089e..66c4cb1400 100644 --- a/docs/d1/d30/classshaka_1_1media_1_1mp2t_1_1TsSectionPes.html +++ b/docs/d1/d30/classshaka_1_1media_1_1mp2t_1_1TsSectionPes.html @@ -118,7 +118,7 @@ Additional Inherited Members diff --git a/docs/d1/d31/classshaka_1_1xml_1_1XmlNode.html b/docs/d1/d31/classshaka_1_1xml_1_1XmlNode.html index 2e73c57d54..bc15b43f3c 100644 --- a/docs/d1/d31/classshaka_1_1xml_1_1XmlNode.html +++ b/docs/d1/d31/classshaka_1_1xml_1_1XmlNode.html @@ -407,7 +407,7 @@ bool  diff --git a/docs/d1/d34/structshaka_1_1media_1_1SubsampleEntry.html b/docs/d1/d34/structshaka_1_1media_1_1SubsampleEntry.html index 863ce985c5..cf3c3ececb 100644 --- a/docs/d1/d34/structshaka_1_1media_1_1SubsampleEntry.html +++ b/docs/d1/d34/structshaka_1_1media_1_1SubsampleEntry.html @@ -98,7 +98,7 @@ uint32_t cipher_bytes< diff --git a/docs/d1/d35/classshaka_1_1hls_1_1Tag-members.html b/docs/d1/d35/classshaka_1_1hls_1_1Tag-members.html index 1b6128e933..49b23b418a 100644 --- a/docs/d1/d35/classshaka_1_1hls_1_1Tag-members.html +++ b/docs/d1/d35/classshaka_1_1hls_1_1Tag-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d1/d36/classshaka_1_1media_1_1FakeMediaHandler.html b/docs/d1/d36/classshaka_1_1media_1_1FakeMediaHandler.html index 527d494627..bf80ad8f80 100644 --- a/docs/d1/d36/classshaka_1_1media_1_1FakeMediaHandler.html +++ b/docs/d1/d36/classshaka_1_1media_1_1FakeMediaHandler.html @@ -175,7 +175,7 @@ std::vector< std::unique_ptr<

Detailed Description

-

Definition at line 179 of file media_handler_test_base.h.

+

Definition at line 178 of file media_handler_test_base.h.

Member Function Documentation

◆ InitializeInternal()

@@ -203,7 +203,7 @@ std::vector< std::unique_ptr< shaka::media::MediaHandler.

-

Definition at line 117 of file media_handler_test_base.cc.

+

Definition at line 97 of file media_handler_test_base.cc.

@@ -234,7 +234,7 @@ std::vector< std::unique_ptr< shaka::media::MediaHandler.

-

Definition at line 121 of file media_handler_test_base.cc.

+

Definition at line 101 of file media_handler_test_base.cc.

@@ -245,7 +245,7 @@ std::vector< std::unique_ptr< diff --git a/docs/d1/d37/es__parser__h264_8h_source.html b/docs/d1/d37/es__parser__h264_8h_source.html index b7aae7a9ae..bc046370d8 100644 --- a/docs/d1/d37/es__parser__h264_8h_source.html +++ b/docs/d1/d37/es__parser__h264_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d1/d3b/mpd__generator__flags_8h_source.html b/docs/d1/d3b/mpd__generator__flags_8h_source.html index 93296fd5d0..88eab2e200 100644 --- a/docs/d1/d3b/mpd__generator__flags_8h_source.html +++ b/docs/d1/d3b/mpd__generator__flags_8h_source.html @@ -69,7 +69,7 @@ $(function() {
1 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #ifndef APP_MPD_GENERATOR_FLAGS_H_
8 #define APP_MPD_GENERATOR_FLAGS_H_
9 
10 #include <gflags/gflags.h>
11 
12 DEFINE_string(input, "", "Comma separated list of MediaInfo input files.");
13 DEFINE_string(output, "", "MPD output file name.");
14 DEFINE_string(base_urls,
15  "",
16  "Comma separated BaseURLs for the MPD. The values will be added "
17  "as <BaseURL> element(s) immediately under the <MPD> element.");
18 #endif // APP_MPD_GENERATOR_FLAGS_H_
diff --git a/docs/d1/d3e/structshaka_1_1media_1_1mp4_1_1MovieExtends.html b/docs/d1/d3e/structshaka_1_1media_1_1mp4_1_1MovieExtends.html index 99a7547b89..48919982bf 100644 --- a/docs/d1/d3e/structshaka_1_1media_1_1mp4_1_1MovieExtends.html +++ b/docs/d1/d3e/structshaka_1_1media_1_1mp4_1_1MovieExtends.html @@ -115,7 +115,7 @@ Additional Inherited Members

Detailed Description

-

Definition at line 647 of file box_definitions.h.

+

Definition at line 652 of file box_definitions.h.

Member Function Documentation

◆ BoxType()

@@ -143,7 +143,7 @@ Additional Inherited Members

Implements shaka::media::mp4::Box.

-

Definition at line 2160 of file box_definitions.cc.

+

Definition at line 2216 of file box_definitions.cc.

@@ -154,7 +154,7 @@ Additional Inherited Members diff --git a/docs/d1/d40/classshaka_1_1MpdWriter-members.html b/docs/d1/d40/classshaka_1_1MpdWriter-members.html index f0294dbf3f..f60e664f9b 100644 --- a/docs/d1/d40/classshaka_1_1MpdWriter-members.html +++ b/docs/d1/d40/classshaka_1_1MpdWriter-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d1/d41/structshaka_1_1media_1_1Scte35Event.html b/docs/d1/d41/structshaka_1_1media_1_1Scte35Event.html index 775bf0c768..7ab3498b11 100644 --- a/docs/d1/d41/structshaka_1_1media_1_1Scte35Event.html +++ b/docs/d1/d41/structshaka_1_1media_1_1Scte35Event.html @@ -90,14 +90,14 @@ std::string cue_data

Detailed Description

-

Definition at line 34 of file media_handler.h.

+

Definition at line 36 of file media_handler.h.


The documentation for this struct was generated from the following file: diff --git a/docs/d1/d45/classshaka_1_1hls_1_1MediaPlaylistFactory-members.html b/docs/d1/d45/classshaka_1_1hls_1_1MediaPlaylistFactory-members.html index c222d6dbe2..b60b5b5223 100644 --- a/docs/d1/d45/classshaka_1_1hls_1_1MediaPlaylistFactory-members.html +++ b/docs/d1/d45/classshaka_1_1hls_1_1MediaPlaylistFactory-members.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d1/d45/decoding__time__iterator_8cc_source.html b/docs/d1/d45/decoding__time__iterator_8cc_source.html index 560b37dcb5..00693a8e25 100644 --- a/docs/d1/d45/decoding__time__iterator_8cc_source.html +++ b/docs/d1/d45/decoding__time__iterator_8cc_source.html @@ -72,11 +72,11 @@ $(function() {
DecodingTimeIterator(const DecodingTimeToSample &decoding_time_to_sample)
Create DecodingTimeIterator from decoding time to sample box.
- + diff --git a/docs/d1/d48/text__track__config_8h_source.html b/docs/d1/d48/text__track__config_8h_source.html index 4ae892ade7..cc97229f69 100644 --- a/docs/d1/d48/text__track__config_8h_source.html +++ b/docs/d1/d48/text__track__config_8h_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d1/d4f/classshaka_1_1media_1_1OffsetByteQueue-members.html b/docs/d1/d4f/classshaka_1_1media_1_1OffsetByteQueue-members.html index 88adebfc7e..7df7e0405d 100644 --- a/docs/d1/d4f/classshaka_1_1media_1_1OffsetByteQueue-members.html +++ b/docs/d1/d4f/classshaka_1_1media_1_1OffsetByteQueue-members.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/d1/d4f/structshaka_1_1DecryptionParams.html b/docs/d1/d4f/structshaka_1_1DecryptionParams.html index 3f73451339..a9be375aed 100644 --- a/docs/d1/d4f/structshaka_1_1DecryptionParams.html +++ b/docs/d1/d4f/structshaka_1_1DecryptionParams.html @@ -114,7 +114,7 @@ Public Attributes diff --git a/docs/d1/d5a/structshaka_1_1media_1_1EncryptionKey-members.html b/docs/d1/d5a/structshaka_1_1media_1_1EncryptionKey-members.html index f36f5c1c34..df49c598ff 100644 --- a/docs/d1/d5a/structshaka_1_1media_1_1EncryptionKey-members.html +++ b/docs/d1/d5a/structshaka_1_1media_1_1EncryptionKey-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d1/d6e/structshaka_1_1media_1_1mp4_1_1TrackFragmentHeader.html b/docs/d1/d6e/structshaka_1_1media_1_1mp4_1_1TrackFragmentHeader.html index c7bb709d71..928d5ad4af 100644 --- a/docs/d1/d6e/structshaka_1_1media_1_1mp4_1_1TrackFragmentHeader.html +++ b/docs/d1/d6e/structshaka_1_1media_1_1mp4_1_1TrackFragmentHeader.html @@ -131,26 +131,26 @@ Public Member Functions

Public Attributes

-uint32_t track_id +uint32_t track_id = 0u   -uint32_t sample_description_index +uint32_t sample_description_index = 0u   -uint32_t default_sample_duration +uint32_t default_sample_duration = 0u   -uint32_t default_sample_size +uint32_t default_sample_size = 0u   -uint32_t default_sample_flags +uint32_t default_sample_flags = 0u   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

@@ -161,7 +161,7 @@ Additional Inherited Members

Detailed Description

-

Definition at line 676 of file box_definitions.h.

+

Definition at line 681 of file box_definitions.h.

Member Function Documentation

◆ BoxType()

@@ -189,7 +189,7 @@ Additional Inherited Members

Implements shaka::media::mp4::Box.

-

Definition at line 2262 of file box_definitions.cc.

+

Definition at line 2323 of file box_definitions.cc.

@@ -200,7 +200,7 @@ Additional Inherited Members diff --git a/docs/d1/d70/vp8__parser_8cc_source.html b/docs/d1/d70/vp8__parser_8cc_source.html index b36138180d..8a8b61e83b 100644 --- a/docs/d1/d70/vp8__parser_8cc_source.html +++ b/docs/d1/d70/vp8__parser_8cc_source.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d1/d72/language__utils_8cc_source.html b/docs/d1/d72/language__utils_8cc_source.html index 2145cfea53..14b0858825 100644 --- a/docs/d1/d72/language__utils_8cc_source.html +++ b/docs/d1/d72/language__utils_8cc_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/d1/d74/classshaka_1_1media_1_1PackedAudioSegmenter-members.html b/docs/d1/d74/classshaka_1_1media_1_1PackedAudioSegmenter-members.html index 3b8e7177d8..6535244e0d 100644 --- a/docs/d1/d74/classshaka_1_1media_1_1PackedAudioSegmenter-members.html +++ b/docs/d1/d74/classshaka_1_1media_1_1PackedAudioSegmenter-members.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/d1/d74/mp2t__media__parser_8cc_source.html b/docs/d1/d74/mp2t__media__parser_8cc_source.html index 2bd23dca7d..f95529ad9e 100644 --- a/docs/d1/d74/mp2t__media__parser_8cc_source.html +++ b/docs/d1/d74/mp2t__media__parser_8cc_source.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/d1/d79/classshaka_1_1media_1_1H265VideoSliceHeaderParser.html b/docs/d1/d79/classshaka_1_1media_1_1H265VideoSliceHeaderParser.html index 3b5d06318e..33207970fe 100644 --- a/docs/d1/d79/classshaka_1_1media_1_1H265VideoSliceHeaderParser.html +++ b/docs/d1/d79/classshaka_1_1media_1_1H265VideoSliceHeaderParser.html @@ -130,7 +130,7 @@ int64_t  diff --git a/docs/d1/d79/structshaka_1_1media_1_1Scte35Event-members.html b/docs/d1/d79/structshaka_1_1media_1_1Scte35Event-members.html index 4a9e30e8bf..bf1bbfb461 100644 --- a/docs/d1/d79/structshaka_1_1media_1_1Scte35Event-members.html +++ b/docs/d1/d79/structshaka_1_1media_1_1Scte35Event-members.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d1/d7d/webm__video__client_8cc_source.html b/docs/d1/d7d/webm__video__client_8cc_source.html index 70d07f17e9..ca6dfb499b 100644 --- a/docs/d1/d7d/webm__video__client_8cc_source.html +++ b/docs/d1/d7d/webm__video__client_8cc_source.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/d1/d7e/classshaka_1_1hls_1_1Tag.html b/docs/d1/d7e/classshaka_1_1hls_1_1Tag.html index 21ef28a2c4..d83c1602d5 100644 --- a/docs/d1/d7e/classshaka_1_1hls_1_1Tag.html +++ b/docs/d1/d7e/classshaka_1_1hls_1_1Tag.html @@ -109,7 +109,7 @@ void  diff --git a/docs/d1/d7e/classshaka_1_1media_1_1BlockReader-members.html b/docs/d1/d7e/classshaka_1_1media_1_1BlockReader-members.html index a1b43bfd7c..ceabe44c10 100644 --- a/docs/d1/d7e/classshaka_1_1media_1_1BlockReader-members.html +++ b/docs/d1/d7e/classshaka_1_1media_1_1BlockReader-members.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d1/d81/structshaka_1_1media_1_1H265ReferencePictureSet-members.html b/docs/d1/d81/structshaka_1_1media_1_1H265ReferencePictureSet-members.html index b8df9dcdf6..638593c13f 100644 --- a/docs/d1/d81/structshaka_1_1media_1_1H265ReferencePictureSet-members.html +++ b/docs/d1/d81/structshaka_1_1media_1_1H265ReferencePictureSet-members.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/d1/d82/classshaka_1_1media_1_1WebMParserClient-members.html b/docs/d1/d82/classshaka_1_1media_1_1WebMParserClient-members.html index 43d653665d..92152b8577 100644 --- a/docs/d1/d82/classshaka_1_1media_1_1WebMParserClient-members.html +++ b/docs/d1/d82/classshaka_1_1media_1_1WebMParserClient-members.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/d1/d87/classshaka_1_1hls_1_1MasterPlaylist.html b/docs/d1/d87/classshaka_1_1hls_1_1MasterPlaylist.html index 16283c7c5b..0caef278b6 100644 --- a/docs/d1/d87/classshaka_1_1hls_1_1MasterPlaylist.html +++ b/docs/d1/d87/classshaka_1_1hls_1_1MasterPlaylist.html @@ -181,7 +181,7 @@ Public Member Functions diff --git a/docs/d1/d8e/webm__audio__client_8cc_source.html b/docs/d1/d8e/webm__audio__client_8cc_source.html index 732291b776..810fa8d5cf 100644 --- a/docs/d1/d8e/webm__audio__client_8cc_source.html +++ b/docs/d1/d8e/webm__audio__client_8cc_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d1/d8f/retired__flags_8h_source.html b/docs/d1/d8f/retired__flags_8h_source.html index d7f33cbff1..4bee5c0331 100644 --- a/docs/d1/d8f/retired__flags_8h_source.html +++ b/docs/d1/d8f/retired__flags_8h_source.html @@ -69,7 +69,7 @@ $(function() {
1 // Copyright 2017 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include <gflags/gflags.h>
8 
9 DECLARE_string(profile);
10 DECLARE_bool(single_segment);
11 DECLARE_bool(webm_subsample_encryption);
12 DECLARE_double(availability_time_offset);
13 DECLARE_string(playready_key_id);
14 DECLARE_string(playready_key);
diff --git a/docs/d1/d91/classshaka_1_1media_1_1H26xBitReader-members.html b/docs/d1/d91/classshaka_1_1media_1_1H26xBitReader-members.html index 4f4e19362d..9c80ae3508 100644 --- a/docs/d1/d91/classshaka_1_1media_1_1H26xBitReader-members.html +++ b/docs/d1/d91/classshaka_1_1media_1_1H26xBitReader-members.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/d1/d95/structshaka_1_1WidevineEncryptionParams-members.html b/docs/d1/d95/structshaka_1_1WidevineEncryptionParams-members.html index dd0cca8499..b58b6a8430 100644 --- a/docs/d1/d95/structshaka_1_1WidevineEncryptionParams-members.html +++ b/docs/d1/d95/structshaka_1_1WidevineEncryptionParams-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d1/d9d/classshaka_1_1media_1_1ByteQueue-members.html b/docs/d1/d9d/classshaka_1_1media_1_1ByteQueue-members.html index 278cb09e28..e8dc10fb1b 100644 --- a/docs/d1/d9d/classshaka_1_1media_1_1ByteQueue-members.html +++ b/docs/d1/d9d/classshaka_1_1media_1_1ByteQueue-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d1/d9d/tracks__builder_8h_source.html b/docs/d1/d9d/tracks__builder_8h_source.html index f9b16a020a..cc3c8f392f 100644 --- a/docs/d1/d9d/tracks__builder_8h_source.html +++ b/docs/d1/d9d/tracks__builder_8h_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d1/d9e/structshaka_1_1media_1_1mp4_1_1CodecConfiguration-members.html b/docs/d1/d9e/structshaka_1_1media_1_1mp4_1_1CodecConfiguration-members.html index 810574b2e7..2391a35b5d 100644 --- a/docs/d1/d9e/structshaka_1_1media_1_1mp4_1_1CodecConfiguration-members.html +++ b/docs/d1/d9e/structshaka_1_1media_1_1mp4_1_1CodecConfiguration-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/docs/d1/da1/classshaka_1_1media_1_1mp4_1_1BoxBuffer.html b/docs/d1/da1/classshaka_1_1media_1_1mp4_1_1BoxBuffer.html index e8c9cc5679..584935e0cd 100644 --- a/docs/d1/da1/classshaka_1_1media_1_1mp4_1_1BoxBuffer.html +++ b/docs/d1/da1/classshaka_1_1media_1_1mp4_1_1BoxBuffer.html @@ -587,7 +587,7 @@ bool ReadWriteInt64 (i diff --git a/docs/d1/da1/structshaka_1_1media_1_1wvm_1_1DemuxStreamIdMediaSample.html b/docs/d1/da1/structshaka_1_1media_1_1wvm_1_1DemuxStreamIdMediaSample.html index 50abd08cae..d4e15d3ae9 100644 --- a/docs/d1/da1/structshaka_1_1media_1_1wvm_1_1DemuxStreamIdMediaSample.html +++ b/docs/d1/da1/structshaka_1_1media_1_1wvm_1_1DemuxStreamIdMediaSample.html @@ -92,7 +92,7 @@ std::shared_ptr< diff --git a/docs/d1/da2/classshaka_1_1media_1_1NalUnitToByteStreamConverter-members.html b/docs/d1/da2/classshaka_1_1media_1_1NalUnitToByteStreamConverter-members.html index 8c09ac22c4..f9e06db9dd 100644 --- a/docs/d1/da2/classshaka_1_1media_1_1NalUnitToByteStreamConverter-members.html +++ b/docs/d1/da2/classshaka_1_1media_1_1NalUnitToByteStreamConverter-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d1/da5/classshaka_1_1media_1_1VPCodecConfigurationRecord.html b/docs/d1/da5/classshaka_1_1media_1_1VPCodecConfigurationRecord.html index 506794b26e..d6477a3e89 100644 --- a/docs/d1/da5/classshaka_1_1media_1_1VPCodecConfigurationRecord.html +++ b/docs/d1/da5/classshaka_1_1media_1_1VPCodecConfigurationRecord.html @@ -345,7 +345,7 @@ uint8_t chroma_location diff --git a/docs/d1/dad/classshaka_1_1media_1_1Demuxer-members.html b/docs/d1/dad/classshaka_1_1media_1_1Demuxer-members.html index ea959344d2..f77efa13cd 100644 --- a/docs/d1/dad/classshaka_1_1media_1_1Demuxer-members.html +++ b/docs/d1/dad/classshaka_1_1media_1_1Demuxer-members.html @@ -105,7 +105,7 @@ $(function() { diff --git a/docs/d1/db0/structshaka_1_1media_1_1mp4_1_1VideoMediaHeader.html b/docs/d1/db0/structshaka_1_1media_1_1mp4_1_1VideoMediaHeader.html index ce11fae619..0aef44a113 100644 --- a/docs/d1/db0/structshaka_1_1media_1_1mp4_1_1VideoMediaHeader.html +++ b/docs/d1/db0/structshaka_1_1media_1_1mp4_1_1VideoMediaHeader.html @@ -103,23 +103,23 @@ Public Member Functions

Public Attributes

-uint16_t graphicsmode +uint16_t graphicsmode = 0u   -uint16_t opcolor_red +uint16_t opcolor_red = 0u   -uint16_t opcolor_green +uint16_t opcolor_green = 0u   -uint16_t opcolor_blue +uint16_t opcolor_blue = 0u   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

@@ -130,7 +130,7 @@ Additional Inherited Members

Detailed Description

-

Definition at line 565 of file box_definitions.h.

+

Definition at line 570 of file box_definitions.h.

Member Function Documentation

◆ BoxType()

@@ -158,7 +158,7 @@ Additional Inherited Members

Implements shaka::media::mp4::Box.

-

Definition at line 1913 of file box_definitions.cc.

+

Definition at line 1949 of file box_definitions.cc.

@@ -169,7 +169,7 @@ Additional Inherited Members diff --git a/docs/d1/db2/decoder__configuration__record_8h_source.html b/docs/d1/db2/decoder__configuration__record_8h_source.html index 18944a7b69..87f43a5284 100644 --- a/docs/d1/db2/decoder__configuration__record_8h_source.html +++ b/docs/d1/db2/decoder__configuration__record_8h_source.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/d1/dba/classshaka_1_1media_1_1mp2t_1_1AudioHeader.html b/docs/d1/dba/classshaka_1_1media_1_1mp2t_1_1AudioHeader.html index 3532ea8172..59703c70ed 100644 --- a/docs/d1/dba/classshaka_1_1media_1_1mp2t_1_1AudioHeader.html +++ b/docs/d1/dba/classshaka_1_1media_1_1mp2t_1_1AudioHeader.html @@ -425,7 +425,7 @@ Public Member Functions diff --git a/docs/d1/dbe/classshaka_1_1media_1_1PlayReadyKeySource-members.html b/docs/d1/dbe/classshaka_1_1media_1_1PlayReadyKeySource-members.html index 07feafaede..4d970914f4 100644 --- a/docs/d1/dbe/classshaka_1_1media_1_1PlayReadyKeySource-members.html +++ b/docs/d1/dbe/classshaka_1_1media_1_1PlayReadyKeySource-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/d1/dc2/h26x__bit__reader_8h_source.html b/docs/d1/dc2/h26x__bit__reader_8h_source.html index c7d5404084..4e0718922c 100644 --- a/docs/d1/dc2/h26x__bit__reader_8h_source.html +++ b/docs/d1/dc2/h26x__bit__reader_8h_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d1/dd5/classshaka_1_1media_1_1Cluster.html b/docs/d1/dd5/classshaka_1_1media_1_1Cluster.html index 800d1d8b86..c761dbef5b 100644 --- a/docs/d1/dd5/classshaka_1_1media_1_1Cluster.html +++ b/docs/d1/dd5/classshaka_1_1media_1_1Cluster.html @@ -92,7 +92,7 @@ int size () const diff --git a/docs/d1/dd6/structshaka_1_1media_1_1mp4_1_1DataInformation-members.html b/docs/d1/dd6/structshaka_1_1media_1_1mp4_1_1DataInformation-members.html index 2e96269599..973ded215f 100644 --- a/docs/d1/dd6/structshaka_1_1media_1_1mp4_1_1DataInformation-members.html +++ b/docs/d1/dd6/structshaka_1_1media_1_1mp4_1_1DataInformation-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/d1/dd8/structshaka_1_1PackagingParams-members.html b/docs/d1/dd8/structshaka_1_1PackagingParams-members.html index 22d4446976..014e998437 100644 --- a/docs/d1/dd8/structshaka_1_1PackagingParams-members.html +++ b/docs/d1/dd8/structshaka_1_1PackagingParams-members.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/d1/dda/structshaka_1_1media_1_1EncryptionConfig-members.html b/docs/d1/dda/structshaka_1_1media_1_1EncryptionConfig-members.html index 73cd357682..d8c71e530e 100644 --- a/docs/d1/dda/structshaka_1_1media_1_1EncryptionConfig-members.html +++ b/docs/d1/dda/structshaka_1_1media_1_1EncryptionConfig-members.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/d1/de2/classshaka_1_1media_1_1VideoStreamInfo-members.html b/docs/d1/de2/classshaka_1_1media_1_1VideoStreamInfo-members.html index 5e8b90115a..3aa7d6f165 100644 --- a/docs/d1/de2/classshaka_1_1media_1_1VideoStreamInfo-members.html +++ b/docs/d1/de2/classshaka_1_1media_1_1VideoStreamInfo-members.html @@ -116,7 +116,7 @@ $(function() { diff --git a/docs/d1/de2/composition__offset__iterator_8cc_source.html b/docs/d1/de2/composition__offset__iterator_8cc_source.html index a3359c6b26..09d68016a2 100644 --- a/docs/d1/de2/composition__offset__iterator_8cc_source.html +++ b/docs/d1/de2/composition__offset__iterator_8cc_source.html @@ -66,7 +66,7 @@ $(function() {
composition_offset_iterator.cc
-
1 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include "packager/media/formats/mp4/composition_offset_iterator.h"
8 
9 #include "packager/base/logging.h"
10 
11 namespace shaka {
12 namespace media {
13 namespace mp4 {
14 
16  const CompositionTimeToSample& composition_time_to_sample)
17  : sample_index_(0),
18  composition_offset_table_(composition_time_to_sample.composition_offset),
19  iterator_(composition_offset_table_.begin()) {}
20 CompositionOffsetIterator::~CompositionOffsetIterator() {}
21 
23  ++sample_index_;
24  if (sample_index_ >= iterator_->sample_count) {
25  ++iterator_;
26  if (iterator_ == composition_offset_table_.end())
27  return false;
28  sample_index_ = 0;
29  }
30  return true;
31 }
32 
34  return iterator_ != composition_offset_table_.end() &&
35  sample_index_ < iterator_->sample_count;
36 }
37 
38 int64_t CompositionOffsetIterator::SampleOffset(uint32_t sample) const {
39  uint32_t current_sample = 0;
40  std::vector<CompositionOffset>::const_iterator it =
41  composition_offset_table_.begin();
42  for (; it != composition_offset_table_.end(); ++it) {
43  current_sample += it->sample_count;
44  if (current_sample >= sample)
45  return it->sample_offset;
46  }
47  DCHECK_LE(sample, current_sample) << " Sample is invalid";
48  return 0;
49 }
50 
52  uint32_t num_samples = 0;
53  std::vector<CompositionOffset>::const_iterator it =
54  composition_offset_table_.begin();
55  for (; it != composition_offset_table_.end(); ++it) {
56  num_samples += it->sample_count;
57  }
58  return num_samples;
59 }
60 
61 } // namespace mp4
62 } // namespace media
63 } // namespace shaka
+
1 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include "packager/media/formats/mp4/composition_offset_iterator.h"
8 
9 #include "packager/base/logging.h"
10 
11 namespace shaka {
12 namespace media {
13 namespace mp4 {
14 
16  const CompositionTimeToSample& composition_time_to_sample)
17  : sample_index_(0),
18  composition_offset_table_(composition_time_to_sample.composition_offset),
19  iterator_(composition_offset_table_.begin()) {}
20 CompositionOffsetIterator::~CompositionOffsetIterator() {}
21 
23  ++sample_index_;
24  if (sample_index_ >= iterator_->sample_count) {
25  ++iterator_;
26  if (iterator_ == composition_offset_table_.end())
27  return false;
28  sample_index_ = 0;
29  }
30  return true;
31 }
32 
34  return iterator_ != composition_offset_table_.end() &&
35  sample_index_ < iterator_->sample_count;
36 }
37 
38 int64_t CompositionOffsetIterator::SampleOffset(uint32_t sample) const {
39  uint32_t current_sample = 0;
40  std::vector<CompositionOffset>::const_iterator it =
41  composition_offset_table_.begin();
42  for (; it != composition_offset_table_.end(); ++it) {
43  current_sample += it->sample_count;
44  if (current_sample >= sample)
45  return it->sample_offset;
46  }
47  DCHECK_LE(sample, current_sample) << " Sample is invalid";
48  return 0;
49 }
50 
52  uint32_t num_samples = 0;
53  std::vector<CompositionOffset>::const_iterator it =
54  composition_offset_table_.begin();
55  for (; it != composition_offset_table_.end(); ++it) {
56  num_samples += it->sample_count;
57  }
58  return num_samples;
59 }
60 
61 } // namespace mp4
62 } // namespace media
63 } // namespace shaka
All the methods that are virtual are virtual for mocking.
@@ -76,7 +76,7 @@ $(function() {
diff --git a/docs/d1/de4/classshaka_1_1media_1_1KeyFetcher-members.html b/docs/d1/de4/classshaka_1_1media_1_1KeyFetcher-members.html index cf71d56599..68b63d1735 100644 --- a/docs/d1/de4/classshaka_1_1media_1_1KeyFetcher-members.html +++ b/docs/d1/de4/classshaka_1_1media_1_1KeyFetcher-members.html @@ -75,7 +75,7 @@ $(function() {
diff --git a/docs/d1/de7/classshaka_1_1xml_1_1AdaptationSetXmlNode.html b/docs/d1/de7/classshaka_1_1xml_1_1AdaptationSetXmlNode.html index 96d52af6a0..779c7d1892 100644 --- a/docs/d1/de7/classshaka_1_1xml_1_1AdaptationSetXmlNode.html +++ b/docs/d1/de7/classshaka_1_1xml_1_1AdaptationSetXmlNode.html @@ -179,7 +179,7 @@ Additional Inherited Members diff --git a/docs/d1/de7/structshaka_1_1media_1_1H265ReferencePictureListModifications-members.html b/docs/d1/de7/structshaka_1_1media_1_1H265ReferencePictureListModifications-members.html index 1e7153ff62..50ace7fe7a 100644 --- a/docs/d1/de7/structshaka_1_1media_1_1H265ReferencePictureListModifications-members.html +++ b/docs/d1/de7/structshaka_1_1media_1_1H265ReferencePictureListModifications-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d1/de9/classshaka_1_1media_1_1ProgressListener-members.html b/docs/d1/de9/classshaka_1_1media_1_1ProgressListener-members.html index 876ae45f9e..c0482d30ed 100644 --- a/docs/d1/de9/classshaka_1_1media_1_1ProgressListener-members.html +++ b/docs/d1/de9/classshaka_1_1media_1_1ProgressListener-members.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d1/dee/classshaka_1_1media_1_1mp4_1_1BoxReader.html b/docs/d1/dee/classshaka_1_1media_1_1mp4_1_1BoxReader.html index c2a4194cad..156b1680ef 100644 --- a/docs/d1/dee/classshaka_1_1media_1_1mp4_1_1BoxReader.html +++ b/docs/d1/dee/classshaka_1_1media_1_1mp4_1_1BoxReader.html @@ -454,7 +454,7 @@ template<typename T > diff --git a/docs/d1/dee/structshaka_1_1media_1_1mp4_1_1SampleTable.html b/docs/d1/dee/structshaka_1_1media_1_1mp4_1_1SampleTable.html index a86a01011a..55e5c2eb5d 100644 --- a/docs/d1/dee/structshaka_1_1media_1_1mp4_1_1SampleTable.html +++ b/docs/d1/dee/structshaka_1_1media_1_1mp4_1_1SampleTable.html @@ -136,7 +136,7 @@ Additional Inherited Members

Detailed Description

-

Definition at line 538 of file box_definitions.h.

+

Definition at line 543 of file box_definitions.h.

Member Function Documentation

◆ BoxType()

@@ -164,7 +164,7 @@ Additional Inherited Members

Implements shaka::media::mp4::Box.

-

Definition at line 1114 of file box_definitions.cc.

+

Definition at line 1135 of file box_definitions.cc.

@@ -175,7 +175,7 @@ Additional Inherited Members diff --git a/docs/d1/df0/aes__encryptor_8h_source.html b/docs/d1/df0/aes__encryptor_8h_source.html index 8e2111b364..0927534dd7 100644 --- a/docs/d1/df0/aes__encryptor_8h_source.html +++ b/docs/d1/df0/aes__encryptor_8h_source.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d1/df3/structshaka_1_1MpdOptions.html b/docs/d1/df3/structshaka_1_1MpdOptions.html index ae0a645db1..0b7b7d5f70 100644 --- a/docs/d1/df3/structshaka_1_1MpdOptions.html +++ b/docs/d1/df3/structshaka_1_1MpdOptions.html @@ -117,7 +117,7 @@ MpdType mpd_type = Mpd diff --git a/docs/d1/df5/nalu__reader_8cc_source.html b/docs/d1/df5/nalu__reader_8cc_source.html index 3ec4548076..e5adb9998b 100644 --- a/docs/d1/df5/nalu__reader_8cc_source.html +++ b/docs/d1/df5/nalu__reader_8cc_source.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/d1/df9/structshaka_1_1media_1_1mp4_1_1VideoMediaHeader-members.html b/docs/d1/df9/structshaka_1_1media_1_1mp4_1_1VideoMediaHeader-members.html index 4e7f0f1895..5c0ba4378f 100644 --- a/docs/d1/df9/structshaka_1_1media_1_1mp4_1_1VideoMediaHeader-members.html +++ b/docs/d1/df9/structshaka_1_1media_1_1mp4_1_1VideoMediaHeader-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/docs/d2/d02/timestamp_8h_source.html b/docs/d2/d02/timestamp_8h_source.html index ff27a68317..a7feae5c12 100644 --- a/docs/d2/d02/timestamp_8h_source.html +++ b/docs/d2/d02/timestamp_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d2/d0b/classshaka_1_1media_1_1SeekHead-members.html b/docs/d2/d0b/classshaka_1_1media_1_1SeekHead-members.html index 363d13a91e..b1588b8c26 100644 --- a/docs/d2/d0b/classshaka_1_1media_1_1SeekHead-members.html +++ b/docs/d2/d0b/classshaka_1_1media_1_1SeekHead-members.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/d2/d0f/classshaka_1_1MpdBuilder-members.html b/docs/d2/d0f/classshaka_1_1MpdBuilder-members.html index eb1a372f4c..63a8223f86 100644 --- a/docs/d2/d0f/classshaka_1_1MpdBuilder-members.html +++ b/docs/d2/d0f/classshaka_1_1MpdBuilder-members.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/d2/d0f/structshaka_1_1media_1_1wvm_1_1PrevSampleData.html b/docs/d2/d0f/structshaka_1_1media_1_1wvm_1_1PrevSampleData.html index 8d9f84236a..bfca5af681 100644 --- a/docs/d2/d0f/structshaka_1_1media_1_1wvm_1_1PrevSampleData.html +++ b/docs/d2/d0f/structshaka_1_1media_1_1wvm_1_1PrevSampleData.html @@ -108,7 +108,7 @@ int64_t video_sample_durat diff --git a/docs/d2/d11/classshaka_1_1media_1_1MuxerListener-members.html b/docs/d2/d11/classshaka_1_1media_1_1MuxerListener-members.html index 0a46ee66a1..8874366124 100644 --- a/docs/d2/d11/classshaka_1_1media_1_1MuxerListener-members.html +++ b/docs/d2/d11/classshaka_1_1media_1_1MuxerListener-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/d2/d17/ts__section__pat_8cc_source.html b/docs/d2/d17/ts__section__pat_8cc_source.html index 1c1c8bb170..d9fe36e6e8 100644 --- a/docs/d2/d17/ts__section__pat_8cc_source.html +++ b/docs/d2/d17/ts__section__pat_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d2/d1f/structshaka_1_1ChunkingParams.html b/docs/d2/d1f/structshaka_1_1ChunkingParams.html index bda9ce0a92..4954386082 100644 --- a/docs/d2/d1f/structshaka_1_1ChunkingParams.html +++ b/docs/d2/d1f/structshaka_1_1ChunkingParams.html @@ -150,7 +150,7 @@ double  diff --git a/docs/d2/d20/classshaka_1_1Status.html b/docs/d2/d20/classshaka_1_1Status.html index 75c417c1c6..2b99026333 100644 --- a/docs/d2/d20/classshaka_1_1Status.html +++ b/docs/d2/d20/classshaka_1_1Status.html @@ -193,7 +193,7 @@ static const Status< diff --git a/docs/d2/d23/threaded__io__file_8cc_source.html b/docs/d2/d23/threaded__io__file_8cc_source.html index 4d686c28a7..2261dfbad9 100644 --- a/docs/d2/d23/threaded__io__file_8cc_source.html +++ b/docs/d2/d23/threaded__io__file_8cc_source.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/d2/d24/classshaka_1_1media_1_1PsshBoxBuilder.html b/docs/d2/d24/classshaka_1_1media_1_1PsshBoxBuilder.html index c36ed3001f..7109387f7f 100644 --- a/docs/d2/d24/classshaka_1_1media_1_1PsshBoxBuilder.html +++ b/docs/d2/d24/classshaka_1_1media_1_1PsshBoxBuilder.html @@ -160,7 +160,7 @@ Static Public Member Functions diff --git a/docs/d2/d24/packager__util_8h_source.html b/docs/d2/d24/packager__util_8h_source.html index b015550106..2bdafd9068 100644 --- a/docs/d2/d24/packager__util_8h_source.html +++ b/docs/d2/d24/packager__util_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d2/d26/classshaka_1_1media_1_1LineReader-members.html b/docs/d2/d26/classshaka_1_1media_1_1LineReader-members.html index a47de4fab8..1e40b7759e 100644 --- a/docs/d2/d26/classshaka_1_1media_1_1LineReader-members.html +++ b/docs/d2/d26/classshaka_1_1media_1_1LineReader-members.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d2/d2a/classshaka_1_1IoCache-members.html b/docs/d2/d2a/classshaka_1_1IoCache-members.html index 4cd9b5cc81..bf1c586ea1 100644 --- a/docs/d2/d2a/classshaka_1_1IoCache-members.html +++ b/docs/d2/d2a/classshaka_1_1IoCache-members.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/d2/d30/tracks__builder_8cc_source.html b/docs/d2/d30/tracks__builder_8cc_source.html index 07180219b3..6c882dcf58 100644 --- a/docs/d2/d30/tracks__builder_8cc_source.html +++ b/docs/d2/d30/tracks__builder_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d2/d33/video__slice__header__parser_8h_source.html b/docs/d2/d33/video__slice__header__parser_8h_source.html index ca251aa4d9..e2d717453a 100644 --- a/docs/d2/d33/video__slice__header__parser_8h_source.html +++ b/docs/d2/d33/video__slice__header__parser_8h_source.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d2/d35/classshaka_1_1media_1_1WidevineKeySource-members.html b/docs/d2/d35/classshaka_1_1media_1_1WidevineKeySource-members.html index 6d79aa50f5..cc423169e0 100644 --- a/docs/d2/d35/classshaka_1_1media_1_1WidevineKeySource-members.html +++ b/docs/d2/d35/classshaka_1_1media_1_1WidevineKeySource-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/docs/d2/d37/classshaka_1_1media_1_1Job-members.html b/docs/d2/d37/classshaka_1_1media_1_1Job-members.html index 90588fb08d..09fa812374 100644 --- a/docs/d2/d37/classshaka_1_1media_1_1Job-members.html +++ b/docs/d2/d37/classshaka_1_1media_1_1Job-members.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/d2/d3b/manifest__flags_8cc_source.html b/docs/d2/d3b/manifest__flags_8cc_source.html index eb526e7941..71bdf71d9e 100644 --- a/docs/d2/d3b/manifest__flags_8cc_source.html +++ b/docs/d2/d3b/manifest__flags_8cc_source.html @@ -69,7 +69,7 @@ $(function() {
1 // Copyright 2018 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include "packager/app/manifest_flags.h"
8 
9 DEFINE_double(time_shift_buffer_depth,
10  1800.0,
11  "Guaranteed duration of the time shifting buffer for HLS LIVE "
12  "playlists and DASH dynamic media presentations, in seconds.");
13 DEFINE_uint64(
14  preserved_segments_outside_live_window,
15  50,
16  "Segments outside the live window (defined by '--time_shift_buffer_depth') "
17  "are automatically removed except for the most recent X segments defined "
18  "by this parameter. This is needed to accommodate latencies in various "
19  "stages of content serving pipeline, so that the segments stay accessible "
20  "as they may still be accessed by the player."
21  "The segments are not removed if the value is zero.");
22 DEFINE_string(default_language,
23  "",
24  "For DASH, any audio/text tracks tagged with this language will "
25  "have <Role ... value=\"main\" /> in the manifest; For HLS, the "
26  "first audio/text rendition in a group tagged with this language "
27  "will have 'DEFAULT' attribute set to 'YES'. This allows the "
28  "player to choose the correct default language for the content.");
diff --git a/docs/d2/d3c/muxer__factory_8cc_source.html b/docs/d2/d3c/muxer__factory_8cc_source.html index dbd54b213a..4cc6936f59 100644 --- a/docs/d2/d3c/muxer__factory_8cc_source.html +++ b/docs/d2/d3c/muxer__factory_8cc_source.html @@ -75,14 +75,14 @@ $(function() {
Mp4OutputParams mp4_params
MP4 (ISO-BMFF) specific parameters.
Definition: muxer_options.h:25
std::string output
Definition: packager.h:79
void OverrideClock(base::Clock *clock)
-
std::string temp_dir
Specify temporary directory for intermediate files.
Definition: muxer_options.h:39
+
std::string temp_dir
Specify temporary directory for intermediate files.
Definition: muxer_options.h:46
- - + + diff --git a/docs/d2/d3c/structshaka_1_1media_1_1mp4_1_1TrackFragmentHeader-members.html b/docs/d2/d3c/structshaka_1_1media_1_1mp4_1_1TrackFragmentHeader-members.html index d8a058df16..f1f09b5ac1 100644 --- a/docs/d2/d3c/structshaka_1_1media_1_1mp4_1_1TrackFragmentHeader-members.html +++ b/docs/d2/d3c/structshaka_1_1media_1_1mp4_1_1TrackFragmentHeader-members.html @@ -109,7 +109,7 @@ $(function() { diff --git a/docs/d2/d42/webvtt__to__mp4__handler_8h_source.html b/docs/d2/d42/webvtt__to__mp4__handler_8h_source.html index 0745bf0eea..b66d0178e1 100644 --- a/docs/d2/d42/webvtt__to__mp4__handler_8h_source.html +++ b/docs/d2/d42/webvtt__to__mp4__handler_8h_source.html @@ -66,16 +66,15 @@ $(function() {
webvtt_to_mp4_handler.h
-
1 // Copyright 2017 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #ifndef PACKAGER_MEDIA_FORMATS_WEBVTT_WEBVTT_MP4_CUE_HANDLER_H_
8 #define PACKAGER_MEDIA_FORMATS_WEBVTT_WEBVTT_MP4_CUE_HANDLER_H_
9 
10 #include <stdint.h>
11 
12 #include <list>
13 #include <queue>
14 
15 #include "packager/media/base/buffer_writer.h"
16 #include "packager/media/base/media_handler.h"
17 
18 namespace shaka {
19 namespace media {
20 
21 class DisplayAction;
22 
24  public:
25  bool operator()(const std::shared_ptr<DisplayAction>& left,
26  const std::shared_ptr<DisplayAction>& right) const;
27 };
28 
29 // Take text samples, convert them to Mp4 boxes, and send them down stream.
30 // Virtual methods should only be overridden for testing only.
32  public:
33  WebVttToMp4Handler() = default;
34 
35  protected:
36  // |Process| and |OnFlushRequest| need to be protected so that it can be
37  // called for testing.
38  Status Process(std::unique_ptr<StreamData> stream_data) override;
39  Status OnFlushRequest(size_t input_stream_index) override;
40 
41  // This is made protected-virtual so that we can override it for testing.
42  virtual void WriteCue(const std::string& id,
43  const std::string& settings,
44  const std::string& payload,
45  BufferWriter* out);
46 
47  private:
48  WebVttToMp4Handler(const WebVttToMp4Handler&) = delete;
49  WebVttToMp4Handler& operator=(const WebVttToMp4Handler&) = delete;
50 
51  Status InitializeInternal() override;
52 
53  // Merge and send all samples in the queue downstream while the head of the
54  // queue's time is less than |cutoff|. |cutoff| is needed as we can only
55  // merge and send samples when we are sure no new samples will appear before
56  // the next action.
57  Status ProcessUpToTime(int64_t cutoff_time);
58 
59  // Merge together all TextSamples in |samples| into a single MP4 box and
60  // pass the box downstream.
61  Status MergeAndSendSamples(const std::list<const TextSample*>& samples,
62  int64_t start_time,
63  int64_t end_time);
64 
65  Status SendEmptySample(int64_t start_time, int64_t end_time);
66 
67  // Get a new id for the next action.
68  uint64_t NextActionId();
69 
70  int64_t next_change_ = 0;
71 
72  // This is the current state of the box we are writing.
73  BufferWriter box_writer_;
74 
75  // |actions_| is a time sorted list of actions that affect the timeline (e.g.
76  // adding or removing a cue). |active_| is the list of all cues that are
77  // currently on screen.
78  // When the cue is to be on screen, it is added to |active_|. When it is time
79  // for the cue to come off screen, it is removed from |active_|.
80  // As |actions_| has a shared pointer to the cue, |active_| can use normal
81  // pointers as the pointer will be valid and it makes the |remove| call
82  // easier.
83 
84  std::priority_queue<std::shared_ptr<DisplayAction>,
85  std::vector<std::shared_ptr<DisplayAction>>,
87  actions_;
88  std::list<const TextSample*> active_;
89 
90  uint64_t next_id_ = 0;
91 };
92 
93 } // namespace media
94 } // namespace shaka
95 #endif // PACKAGER_MEDIA_FORMATS_WEBVTT_WEBVTT_MP4_CUE_HANDLER_H_
- +
1 // Copyright 2017 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #ifndef PACKAGER_MEDIA_FORMATS_WEBVTT_WEBVTT_MP4_CUE_HANDLER_H_
8 #define PACKAGER_MEDIA_FORMATS_WEBVTT_WEBVTT_MP4_CUE_HANDLER_H_
9 
10 #include <stdint.h>
11 
12 #include <list>
13 #include <queue>
14 
15 #include "packager/media/base/buffer_writer.h"
16 #include "packager/media/base/media_handler.h"
17 
18 namespace shaka {
19 namespace media {
20 
21 // A media handler that should come after the cue aligner and segmenter and
22 // should come before the muxer. This handler is to convert text samples
23 // to media samples so that they can be sent to a mp4 muxer.
25  public:
26  WebVttToMp4Handler() = default;
27  virtual ~WebVttToMp4Handler() override = default;
28 
29  private:
30  WebVttToMp4Handler(const WebVttToMp4Handler&) = delete;
31  WebVttToMp4Handler& operator=(const WebVttToMp4Handler&) = delete;
32 
33  Status InitializeInternal() override;
34  Status Process(std::unique_ptr<StreamData> stream_data) override;
35 
36  Status OnStreamInfo(std::unique_ptr<StreamData> stream_data);
37  Status OnCueEvent(std::unique_ptr<StreamData> stream_data);
38  Status OnSegmentInfo(std::unique_ptr<StreamData> stream_data);
39  Status OnTextSample(std::unique_ptr<StreamData> stream_data);
40 
41  Status DispatchCurrentSegment(int64_t segment_start, int64_t segment_end);
42  Status MergeDispatchSamples(int64_t start_in_seconds,
43  int64_t end_in_seconds,
44  const std::list<const TextSample*>& state);
45 
46  std::list<std::shared_ptr<const TextSample>> current_segment_;
47 
48  // This is the current state of the box we are writing.
49  BufferWriter box_writer_;
50 };
51 
52 } // namespace media
53 } // namespace shaka
54 #endif // PACKAGER_MEDIA_FORMATS_WEBVTT_WEBVTT_MP4_CUE_HANDLER_H_
All the methods that are virtual are virtual for mocking.
- +
diff --git a/docs/d2/d45/program__map__table__writer_8cc_source.html b/docs/d2/d45/program__map__table__writer_8cc_source.html index 9d711c4cab..b82a1ff2a5 100644 --- a/docs/d2/d45/program__map__table__writer_8cc_source.html +++ b/docs/d2/d45/program__map__table__writer_8cc_source.html @@ -75,7 +75,7 @@ $(function() {
diff --git a/docs/d2/d4c/nal__unit__to__byte__stream__converter_8cc_source.html b/docs/d2/d4c/nal__unit__to__byte__stream__converter_8cc_source.html index b993dde6f3..d8917a9be6 100644 --- a/docs/d2/d4c/nal__unit__to__byte__stream__converter_8cc_source.html +++ b/docs/d2/d4c/nal__unit__to__byte__stream__converter_8cc_source.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/d2/d4d/file_8h_source.html b/docs/d2/d4d/file_8h_source.html index 2f563212b9..cad110a0be 100644 --- a/docs/d2/d4d/file_8h_source.html +++ b/docs/d2/d4d/file_8h_source.html @@ -93,7 +93,7 @@ $(function() { diff --git a/docs/d2/d4f/structshaka_1_1Element-members.html b/docs/d2/d4f/structshaka_1_1Element-members.html index 51690838c8..f7fe9b2377 100644 --- a/docs/d2/d4f/structshaka_1_1Element-members.html +++ b/docs/d2/d4f/structshaka_1_1Element-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d2/d51/classshaka_1_1MockMpdNotifier-members.html b/docs/d2/d51/classshaka_1_1MockMpdNotifier-members.html index d0d8bd82db..4bc16b6506 100644 --- a/docs/d2/d51/classshaka_1_1MockMpdNotifier-members.html +++ b/docs/d2/d51/classshaka_1_1MockMpdNotifier-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/docs/d2/d57/master__playlist_8h_source.html b/docs/d2/d57/master__playlist_8h_source.html index e246b507ca..f87f093eab 100644 --- a/docs/d2/d57/master__playlist_8h_source.html +++ b/docs/d2/d57/master__playlist_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d2/d59/structshaka_1_1media_1_1H264SliceHeader.html b/docs/d2/d59/structshaka_1_1media_1_1H264SliceHeader.html index f72f5b99be..581752da48 100644 --- a/docs/d2/d59/structshaka_1_1media_1_1H264SliceHeader.html +++ b/docs/d2/d59/structshaka_1_1media_1_1H264SliceHeader.html @@ -240,7 +240,7 @@ int slice_beta_offset_div2 diff --git a/docs/d2/d5b/classshaka_1_1media_1_1KeySource-members.html b/docs/d2/d5b/classshaka_1_1media_1_1KeySource-members.html index ab7e9345f4..2bef7bf900 100644 --- a/docs/d2/d5b/classshaka_1_1media_1_1KeySource-members.html +++ b/docs/d2/d5b/classshaka_1_1media_1_1KeySource-members.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/d2/d5c/classshaka_1_1SimpleMpdNotifier-members.html b/docs/d2/d5c/classshaka_1_1SimpleMpdNotifier-members.html index e4dbfefe8f..8f1af15a5a 100644 --- a/docs/d2/d5c/classshaka_1_1SimpleMpdNotifier-members.html +++ b/docs/d2/d5c/classshaka_1_1SimpleMpdNotifier-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/docs/d2/d61/structshaka_1_1media_1_1H264ModificationOfPicNum-members.html b/docs/d2/d61/structshaka_1_1media_1_1H264ModificationOfPicNum-members.html index 6d811a12a3..124bcb764b 100644 --- a/docs/d2/d61/structshaka_1_1media_1_1H264ModificationOfPicNum-members.html +++ b/docs/d2/d61/structshaka_1_1media_1_1H264ModificationOfPicNum-members.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d2/d62/simple__mpd__notifier_8h_source.html b/docs/d2/d62/simple__mpd__notifier_8h_source.html index c92f8e8913..e299a19b94 100644 --- a/docs/d2/d62/simple__mpd__notifier_8h_source.html +++ b/docs/d2/d62/simple__mpd__notifier_8h_source.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/d2/d62/structshaka_1_1media_1_1mp4_1_1Movie-members.html b/docs/d2/d62/structshaka_1_1media_1_1mp4_1_1Movie-members.html index 98f6615e45..b71743f70d 100644 --- a/docs/d2/d62/structshaka_1_1media_1_1mp4_1_1Movie-members.html +++ b/docs/d2/d62/structshaka_1_1media_1_1mp4_1_1Movie-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/d2/d6a/classshaka_1_1media_1_1AesCryptor-members.html b/docs/d2/d6a/classshaka_1_1media_1_1AesCryptor-members.html index 4ab8226edc..2fcdcb30d2 100644 --- a/docs/d2/d6a/classshaka_1_1media_1_1AesCryptor-members.html +++ b/docs/d2/d6a/classshaka_1_1media_1_1AesCryptor-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/d2/d70/structshaka_1_1media_1_1mp4_1_1SchemeInfo.html b/docs/d2/d70/structshaka_1_1media_1_1mp4_1_1SchemeInfo.html index 8a0a0de352..5dbe975233 100644 --- a/docs/d2/d70/structshaka_1_1media_1_1mp4_1_1SchemeInfo.html +++ b/docs/d2/d70/structshaka_1_1media_1_1mp4_1_1SchemeInfo.html @@ -140,7 +140,7 @@ Additional Inherited Members

Implements shaka::media::mp4::Box.

-

Definition at line 469 of file box_definitions.cc.

+

Definition at line 482 of file box_definitions.cc.

@@ -151,7 +151,7 @@ Additional Inherited Members diff --git a/docs/d2/d71/classshaka_1_1media_1_1CombinedMuxerListener-members.html b/docs/d2/d71/classshaka_1_1media_1_1CombinedMuxerListener-members.html index 3b0bd9faf7..c809635e7e 100644 --- a/docs/d2/d71/classshaka_1_1media_1_1CombinedMuxerListener-members.html +++ b/docs/d2/d71/classshaka_1_1media_1_1CombinedMuxerListener-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/docs/d2/d7b/simple__mpd__notifier_8cc_source.html b/docs/d2/d7b/simple__mpd__notifier_8cc_source.html index 3c0da1430a..527666459a 100644 --- a/docs/d2/d7b/simple__mpd__notifier_8cc_source.html +++ b/docs/d2/d7b/simple__mpd__notifier_8cc_source.html @@ -94,7 +94,7 @@ $(function() { diff --git a/docs/d2/d7b/structshaka_1_1StreamDescriptor.html b/docs/d2/d7b/structshaka_1_1StreamDescriptor.html index 6e991bca37..35bbab418a 100644 --- a/docs/d2/d7b/structshaka_1_1StreamDescriptor.html +++ b/docs/d2/d7b/structshaka_1_1StreamDescriptor.html @@ -325,7 +325,7 @@ std::string  diff --git a/docs/d2/d7e/aac__audio__specific__config_8h_source.html b/docs/d2/d7e/aac__audio__specific__config_8h_source.html index e4b82cad0d..ee9858c35f 100644 --- a/docs/d2/d7e/aac__audio__specific__config_8h_source.html +++ b/docs/d2/d7e/aac__audio__specific__config_8h_source.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/d2/d7f/structshaka_1_1media_1_1mp4_1_1CuePayloadBox.html b/docs/d2/d7f/structshaka_1_1media_1_1mp4_1_1CuePayloadBox.html index 8b8ee5495c..2eebb31d2a 100644 --- a/docs/d2/d7f/structshaka_1_1media_1_1mp4_1_1CuePayloadBox.html +++ b/docs/d2/d7f/structshaka_1_1media_1_1mp4_1_1CuePayloadBox.html @@ -112,7 +112,7 @@ Additional Inherited Members

Detailed Description

-

Definition at line 807 of file box_definitions.h.

+

Definition at line 820 of file box_definitions.h.

Member Function Documentation

◆ BoxType()

@@ -140,7 +140,7 @@ Additional Inherited Members

Implements shaka::media::mp4::Box.

-

Definition at line 2658 of file box_definitions.cc.

+

Definition at line 2730 of file box_definitions.cc.

@@ -151,7 +151,7 @@ Additional Inherited Members diff --git a/docs/d2/d82/structshaka_1_1BufferCallbackParams-members.html b/docs/d2/d82/structshaka_1_1BufferCallbackParams-members.html index 222dbfe80b..eab5989734 100644 --- a/docs/d2/d82/structshaka_1_1BufferCallbackParams-members.html +++ b/docs/d2/d82/structshaka_1_1BufferCallbackParams-members.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d2/d8a/hls__notify__muxer__listener_8h_source.html b/docs/d2/d8a/hls__notify__muxer__listener_8h_source.html index b09754c7b9..875307ff40 100644 --- a/docs/d2/d8a/hls__notify__muxer__listener_8h_source.html +++ b/docs/d2/d8a/hls__notify__muxer__listener_8h_source.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/d2/d91/structshaka_1_1media_1_1mp4_1_1CuePayloadBox-members.html b/docs/d2/d91/structshaka_1_1media_1_1mp4_1_1CuePayloadBox-members.html index a29be34b0a..0575e4b0c9 100644 --- a/docs/d2/d91/structshaka_1_1media_1_1mp4_1_1CuePayloadBox-members.html +++ b/docs/d2/d91/structshaka_1_1media_1_1mp4_1_1CuePayloadBox-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/d2/d92/box__reader_8h_source.html b/docs/d2/d92/box__reader_8h_source.html index 4d8755b17e..c41061e10f 100644 --- a/docs/d2/d92/box__reader_8h_source.html +++ b/docs/d2/d92/box__reader_8h_source.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/d2/d93/classshaka_1_1media_1_1mp2t_1_1PesPacket.html b/docs/d2/d93/classshaka_1_1media_1_1mp2t_1_1PesPacket.html index f7603dbf18..4ec89b9fbe 100644 --- a/docs/d2/d93/classshaka_1_1media_1_1mp2t_1_1PesPacket.html +++ b/docs/d2/d93/classshaka_1_1media_1_1mp2t_1_1PesPacket.html @@ -447,7 +447,7 @@ const std::vector< uint8_t > &  diff --git a/docs/d2/d9d/structshaka_1_1FileCloser-members.html b/docs/d2/d9d/structshaka_1_1FileCloser-members.html index 7b1692d8c2..a8bbb4a7ee 100644 --- a/docs/d2/d9d/structshaka_1_1FileCloser-members.html +++ b/docs/d2/d9d/structshaka_1_1FileCloser-members.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d2/da0/classshaka_1_1media_1_1TrickPlayHandler-members.html b/docs/d2/da0/classshaka_1_1media_1_1TrickPlayHandler-members.html index 0889fdb624..3347d4957e 100644 --- a/docs/d2/da0/classshaka_1_1media_1_1TrickPlayHandler-members.html +++ b/docs/d2/da0/classshaka_1_1media_1_1TrickPlayHandler-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/docs/d2/da6/threaded__io__file_8h_source.html b/docs/d2/da6/threaded__io__file_8h_source.html index 7ba3c5312c..d2fae60c12 100644 --- a/docs/d2/da6/threaded__io__file_8h_source.html +++ b/docs/d2/da6/threaded__io__file_8h_source.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/d2/da8/mp4_2segmenter_8cc_source.html b/docs/d2/da8/mp4_2segmenter_8cc_source.html index c729c18d7f..0bbd33299a 100644 --- a/docs/d2/da8/mp4_2segmenter_8cc_source.html +++ b/docs/d2/da8/mp4_2segmenter_8cc_source.html @@ -66,11 +66,11 @@ $(function() {
segmenter.cc
-
1 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include "packager/media/formats/mp4/segmenter.h"
8 
9 #include <algorithm>
10 
11 #include "packager/base/logging.h"
12 #include "packager/media/base/buffer_writer.h"
13 #include "packager/media/base/id3_tag.h"
14 #include "packager/media/base/media_sample.h"
15 #include "packager/media/base/muxer_options.h"
16 #include "packager/media/base/muxer_util.h"
17 #include "packager/media/base/stream_info.h"
18 #include "packager/media/chunking/chunking_handler.h"
19 #include "packager/media/event/progress_listener.h"
20 #include "packager/media/formats/mp4/box_definitions.h"
21 #include "packager/media/formats/mp4/fragmenter.h"
22 #include "packager/media/formats/mp4/key_frame_info.h"
23 #include "packager/version/version.h"
24 
25 namespace shaka {
26 namespace media {
27 namespace mp4 {
28 
29 namespace {
30 
31 uint64_t Rescale(uint64_t time_in_old_scale,
32  uint32_t old_scale,
33  uint32_t new_scale) {
34  return static_cast<double>(time_in_old_scale) / old_scale * new_scale;
35 }
36 
37 } // namespace
38 
39 Segmenter::Segmenter(const MuxerOptions& options,
40  std::unique_ptr<FileType> ftyp,
41  std::unique_ptr<Movie> moov)
42  : options_(options),
43  ftyp_(std::move(ftyp)),
44  moov_(std::move(moov)),
45  moof_(new MovieFragment()),
46  fragment_buffer_(new BufferWriter()),
47  sidx_(new SegmentIndex()) {}
48 
49 Segmenter::~Segmenter() {}
50 
52  const std::vector<std::shared_ptr<const StreamInfo>>& streams,
53  MuxerListener* muxer_listener,
54  ProgressListener* progress_listener) {
55  DCHECK_LT(0u, streams.size());
56  muxer_listener_ = muxer_listener;
57  progress_listener_ = progress_listener;
58  moof_->header.sequence_number = 0;
59 
60  moof_->tracks.resize(streams.size());
61  fragmenters_.resize(streams.size());
62  stream_durations_.resize(streams.size());
63 
64  for (uint32_t i = 0; i < streams.size(); ++i) {
65  moof_->tracks[i].header.track_id = i + 1;
66  if (streams[i]->stream_type() == kStreamVideo) {
67  // Use the first video stream as the reference stream (which is 1-based).
68  if (sidx_->reference_id == 0)
69  sidx_->reference_id = i + 1;
70  }
71  fragmenters_[i].reset(new Fragmenter(streams[i], &moof_->tracks[i]));
72  }
73 
74  if (options_.mp4_params.use_decoding_timestamp_in_timeline) {
75  for (uint32_t i = 0; i < streams.size(); ++i)
76  fragmenters_[i]->set_use_decoding_timestamp_in_timeline(true);
77  }
78 
79  // Choose the first stream if there is no VIDEO.
80  if (sidx_->reference_id == 0)
81  sidx_->reference_id = 1;
82  sidx_->timescale = streams[GetReferenceStreamId()]->time_scale();
83 
84  // Use media duration as progress target.
85  progress_target_ = streams[GetReferenceStreamId()]->duration();
86 
87  // Use the reference stream's time scale as movie time scale.
88  moov_->header.timescale = sidx_->timescale;
89  moof_->header.sequence_number = 1;
90 
91  // Fill in version information.
92  const std::string version = GetPackagerVersion();
93  if (!version.empty()) {
94  moov_->metadata.handler.handler_type = FOURCC_ID32;
95  moov_->metadata.id3v2.language.code = "eng";
96 
97  Id3Tag id3_tag;
98  id3_tag.AddPrivateFrame(GetPackagerProjectUrl(), version);
99  CHECK(id3_tag.WriteToVector(&moov_->metadata.id3v2.id3v2_data));
100  }
101  return DoInitialize();
102 }
103 
105  // Set movie duration. Note that the duration in mvhd, tkhd, mdhd should not
106  // be touched, i.e. kept at 0. The updated moov box will be written to output
107  // file for VOD and static live case only.
108  moov_->extends.header.fragment_duration = 0;
109  for (size_t i = 0; i < stream_durations_.size(); ++i) {
110  uint64_t duration =
111  Rescale(stream_durations_[i], moov_->tracks[i].media.header.timescale,
112  moov_->header.timescale);
113  if (duration > moov_->extends.header.fragment_duration)
114  moov_->extends.header.fragment_duration = duration;
115  }
116  return DoFinalize();
117 }
118 
119 Status Segmenter::AddSample(size_t stream_id, const MediaSample& sample) {
120  // Set default sample duration if it has not been set yet.
121  if (moov_->extends.tracks[stream_id].default_sample_duration == 0) {
122  moov_->extends.tracks[stream_id].default_sample_duration =
123  sample.duration();
124  }
125 
126  DCHECK_LT(stream_id, fragmenters_.size());
127  Fragmenter* fragmenter = fragmenters_[stream_id].get();
128  if (fragmenter->fragment_finalized()) {
129  return Status(error::FRAGMENT_FINALIZED,
130  "Current fragment is finalized already.");
131  }
132 
133  Status status = fragmenter->AddSample(sample);
134  if (!status.ok())
135  return status;
136 
137  if (sample_duration_ == 0)
138  sample_duration_ = sample.duration();
139  stream_durations_[stream_id] += sample.duration();
140  return Status::OK;
141 }
142 
144  const SegmentInfo& segment_info) {
145  if (segment_info.key_rotation_encryption_config) {
146  FinalizeFragmentForKeyRotation(
147  stream_id, segment_info.is_encrypted,
148  *segment_info.key_rotation_encryption_config);
149  }
150 
151  DCHECK_LT(stream_id, fragmenters_.size());
152  Fragmenter* fragmenter = fragmenters_[stream_id].get();
153  DCHECK(fragmenter);
154  Status status = fragmenter->FinalizeFragment();
155  if (!status.ok())
156  return status;
157 
158  // Check if all tracks are ready for fragmentation.
159  for (const std::unique_ptr<Fragmenter>& fragmenter : fragmenters_) {
160  if (!fragmenter->fragment_finalized())
161  return Status::OK;
162  }
163 
164  MediaData mdat;
165  // Data offset relative to 'moof': moof size + mdat header size.
166  // The code will also update box sizes for moof_ and its child boxes.
167  uint64_t data_offset = moof_->ComputeSize() + mdat.HeaderSize();
168  // 'traf' should follow 'mfhd' moof header box.
169  uint64_t next_traf_position = moof_->HeaderSize() + moof_->header.box_size();
170  for (size_t i = 0; i < moof_->tracks.size(); ++i) {
171  TrackFragment& traf = moof_->tracks[i];
172  if (traf.auxiliary_offset.offsets.size() > 0) {
173  DCHECK_EQ(traf.auxiliary_offset.offsets.size(), 1u);
174  DCHECK(!traf.sample_encryption.sample_encryption_entries.empty());
175 
176  next_traf_position += traf.box_size();
177  // SampleEncryption 'senc' box should be the last box in 'traf'.
178  // |auxiliary_offset| should point to the data of SampleEncryption.
179  traf.auxiliary_offset.offsets[0] =
180  next_traf_position - traf.sample_encryption.box_size() +
181  traf.sample_encryption.HeaderSize() +
182  sizeof(uint32_t); // for sample count field in 'senc'
183  }
184  traf.runs[0].data_offset = data_offset + mdat.data_size;
185  mdat.data_size += static_cast<uint32_t>(fragmenters_[i]->data()->Size());
186  }
187 
188  // Generate segment reference.
189  sidx_->references.resize(sidx_->references.size() + 1);
190  fragmenters_[GetReferenceStreamId()]->GenerateSegmentReference(
191  &sidx_->references[sidx_->references.size() - 1]);
192  sidx_->references[sidx_->references.size() - 1].referenced_size =
193  data_offset + mdat.data_size;
194 
195  const uint64_t moof_start_offset = fragment_buffer_->Size();
196 
197  // Write the fragment to buffer.
198  moof_->Write(fragment_buffer_.get());
199  mdat.WriteHeader(fragment_buffer_.get());
200 
201  bool first_key_frame = true;
202  for (const std::unique_ptr<Fragmenter>& fragmenter : fragmenters_) {
203  // https://goo.gl/xcFus6 6. Trick play requirements
204  // 6.10. If using fMP4, I-frame segments must include the 'moof' header
205  // associated with the I-frame. It also implies that only the first key
206  // frame can be included.
207  if (!fragmenter->key_frame_infos().empty() && first_key_frame) {
208  const KeyFrameInfo& key_frame_info =
209  fragmenter->key_frame_infos().front();
210  first_key_frame = false;
211  key_frame_infos_.push_back(
212  {key_frame_info.timestamp, moof_start_offset,
213  fragment_buffer_->Size() - moof_start_offset + key_frame_info.size});
214  }
215  fragment_buffer_->AppendBuffer(*fragmenter->data());
216  }
217 
218  // Increase sequence_number for next fragment.
219  ++moof_->header.sequence_number;
220 
221  for (std::unique_ptr<Fragmenter>& fragmenter : fragmenters_)
222  fragmenter->ClearFragmentFinalized();
223  if (!segment_info.is_subsegment) {
224  Status status = DoFinalizeSegment();
225  // Reset segment information to initial state.
226  sidx_->references.clear();
227  key_frame_infos_.clear();
228  return status;
229  }
230  return Status::OK;
231 }
232 
233 uint32_t Segmenter::GetReferenceTimeScale() const {
234  return moov_->header.timescale;
235 }
236 
237 double Segmenter::GetDuration() const {
238  uint64_t duration = moov_->extends.header.fragment_duration;
239  if (duration == 0) {
240  // Handling the case where this is not properly initialized.
241  return 0.0;
242  }
243  return static_cast<double>(duration) / moov_->header.timescale;
244 }
245 
246 void Segmenter::UpdateProgress(uint64_t progress) {
247  accumulated_progress_ += progress;
248 
249  if (!progress_listener_) return;
250  if (progress_target_ == 0) return;
251  // It might happen that accumulated progress exceeds progress_target due to
252  // computation errors, e.g. rounding error. Cap it so it never reports > 100%
253  // progress.
254  if (accumulated_progress_ >= progress_target_) {
255  progress_listener_->OnProgress(1.0);
256  } else {
257  progress_listener_->OnProgress(static_cast<double>(accumulated_progress_) /
258  progress_target_);
259  }
260 }
261 
262 void Segmenter::SetComplete() {
263  if (!progress_listener_) return;
264  progress_listener_->OnProgress(1.0);
265 }
266 
267 uint32_t Segmenter::GetReferenceStreamId() {
268  DCHECK(sidx_);
269  return sidx_->reference_id - 1;
270 }
271 
272 void Segmenter::FinalizeFragmentForKeyRotation(
273  size_t stream_id,
274  bool fragment_encrypted,
275  const EncryptionConfig& encryption_config) {
276  if (options_.mp4_params.include_pssh_in_stream) {
277  const std::vector<ProtectionSystemSpecificInfo>& system_info =
278  encryption_config.key_system_info;
279  moof_->pssh.resize(system_info.size());
280  for (size_t i = 0; i < system_info.size(); i++)
281  moof_->pssh[i].raw_box = system_info[i].psshs;
282  } else {
283  LOG(WARNING)
284  << "Key rotation and no pssh in stream may not work well together.";
285  }
286 
287  // Skip the following steps if the current fragment is not going to be
288  // encrypted. 'pssh' box needs to be included in the fragment, which is
289  // performed above, regardless of whether the fragment is encrypted. This is
290  // necessary for two reasons: 1) Requesting keys before reaching encrypted
291  // content avoids playback delay due to license requests; 2) In Chrome, CDM
292  // must be initialized before starting the playback and CDM can only be
293  // initialized with a valid 'pssh'.
294  if (!fragment_encrypted)
295  return;
296 
297  DCHECK_LT(stream_id, moof_->tracks.size());
298  TrackFragment& traf = moof_->tracks[stream_id];
299  traf.sample_group_descriptions.resize(traf.sample_group_descriptions.size() +
300  1);
301  SampleGroupDescription& sample_group_description =
302  traf.sample_group_descriptions.back();
303  sample_group_description.grouping_type = FOURCC_seig;
304 
305  sample_group_description.cenc_sample_encryption_info_entries.resize(1);
306  CencSampleEncryptionInfoEntry& sample_group_entry =
307  sample_group_description.cenc_sample_encryption_info_entries.back();
308  sample_group_entry.is_protected = 1;
309  sample_group_entry.per_sample_iv_size = encryption_config.per_sample_iv_size;
310  sample_group_entry.constant_iv = encryption_config.constant_iv;
311  sample_group_entry.crypt_byte_block = encryption_config.crypt_byte_block;
312  sample_group_entry.skip_byte_block = encryption_config.skip_byte_block;
313  sample_group_entry.key_id = encryption_config.key_id;
314 }
315 
316 } // namespace mp4
317 } // namespace media
318 } // namespace shaka
+
1 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include "packager/media/formats/mp4/segmenter.h"
8 
9 #include <algorithm>
10 
11 #include "packager/base/logging.h"
12 #include "packager/media/base/buffer_writer.h"
13 #include "packager/media/base/id3_tag.h"
14 #include "packager/media/base/media_sample.h"
15 #include "packager/media/base/muxer_options.h"
16 #include "packager/media/base/muxer_util.h"
17 #include "packager/media/base/stream_info.h"
18 #include "packager/media/chunking/chunking_handler.h"
19 #include "packager/media/event/progress_listener.h"
20 #include "packager/media/formats/mp4/box_definitions.h"
21 #include "packager/media/formats/mp4/fragmenter.h"
22 #include "packager/media/formats/mp4/key_frame_info.h"
23 #include "packager/version/version.h"
24 
25 namespace shaka {
26 namespace media {
27 namespace mp4 {
28 
29 namespace {
30 
31 uint64_t Rescale(uint64_t time_in_old_scale,
32  uint32_t old_scale,
33  uint32_t new_scale) {
34  return static_cast<double>(time_in_old_scale) / old_scale * new_scale;
35 }
36 
37 } // namespace
38 
39 Segmenter::Segmenter(const MuxerOptions& options,
40  std::unique_ptr<FileType> ftyp,
41  std::unique_ptr<Movie> moov)
42  : options_(options),
43  ftyp_(std::move(ftyp)),
44  moov_(std::move(moov)),
45  moof_(new MovieFragment()),
46  fragment_buffer_(new BufferWriter()),
47  sidx_(new SegmentIndex()) {}
48 
49 Segmenter::~Segmenter() {}
50 
52  const std::vector<std::shared_ptr<const StreamInfo>>& streams,
53  MuxerListener* muxer_listener,
54  ProgressListener* progress_listener) {
55  DCHECK_LT(0u, streams.size());
56  muxer_listener_ = muxer_listener;
57  progress_listener_ = progress_listener;
58  moof_->header.sequence_number = 0;
59 
60  moof_->tracks.resize(streams.size());
61  fragmenters_.resize(streams.size());
62  stream_durations_.resize(streams.size());
63 
64  for (uint32_t i = 0; i < streams.size(); ++i) {
65  moof_->tracks[i].header.track_id = i + 1;
66  if (streams[i]->stream_type() == kStreamVideo) {
67  // Use the first video stream as the reference stream (which is 1-based).
68  if (sidx_->reference_id == 0)
69  sidx_->reference_id = i + 1;
70  }
71  fragmenters_[i].reset(new Fragmenter(streams[i], &moof_->tracks[i]));
72  }
73 
74  if (options_.mp4_params.use_decoding_timestamp_in_timeline) {
75  for (uint32_t i = 0; i < streams.size(); ++i)
76  fragmenters_[i]->set_use_decoding_timestamp_in_timeline(true);
77  }
78  // Only allow |EPT| to be adjusted for the first file.
79  if (options_.output_file_index == 0) {
80  for (uint32_t i = 0; i < streams.size(); ++i)
81  fragmenters_[i]->set_allow_adjust_earliest_presentation_time(true);
82  }
83 
84  // Choose the first stream if there is no VIDEO.
85  if (sidx_->reference_id == 0)
86  sidx_->reference_id = 1;
87  sidx_->timescale = streams[GetReferenceStreamId()]->time_scale();
88 
89  // Use media duration as progress target.
90  progress_target_ = streams[GetReferenceStreamId()]->duration();
91 
92  // Use the reference stream's time scale as movie time scale.
93  moov_->header.timescale = sidx_->timescale;
94  moof_->header.sequence_number = 1;
95 
96  // Fill in version information.
97  const std::string version = GetPackagerVersion();
98  if (!version.empty()) {
99  moov_->metadata.handler.handler_type = FOURCC_ID32;
100  moov_->metadata.id3v2.language.code = "eng";
101 
102  Id3Tag id3_tag;
103  id3_tag.AddPrivateFrame(GetPackagerProjectUrl(), version);
104  CHECK(id3_tag.WriteToVector(&moov_->metadata.id3v2.id3v2_data));
105  }
106  return DoInitialize();
107 }
108 
110  // Set movie duration. Note that the duration in mvhd, tkhd, mdhd should not
111  // be touched, i.e. kept at 0. The updated moov box will be written to output
112  // file for VOD and static live case only.
113  moov_->extends.header.fragment_duration = 0;
114  for (size_t i = 0; i < stream_durations_.size(); ++i) {
115  uint64_t duration =
116  Rescale(stream_durations_[i], moov_->tracks[i].media.header.timescale,
117  moov_->header.timescale);
118  if (duration > moov_->extends.header.fragment_duration)
119  moov_->extends.header.fragment_duration = duration;
120  }
121  return DoFinalize();
122 }
123 
124 Status Segmenter::AddSample(size_t stream_id, const MediaSample& sample) {
125  // Set default sample duration if it has not been set yet.
126  if (moov_->extends.tracks[stream_id].default_sample_duration == 0) {
127  moov_->extends.tracks[stream_id].default_sample_duration =
128  sample.duration();
129  }
130 
131  DCHECK_LT(stream_id, fragmenters_.size());
132  Fragmenter* fragmenter = fragmenters_[stream_id].get();
133  if (fragmenter->fragment_finalized()) {
134  return Status(error::FRAGMENT_FINALIZED,
135  "Current fragment is finalized already.");
136  }
137 
138  Status status = fragmenter->AddSample(sample);
139  if (!status.ok())
140  return status;
141 
142  if (sample_duration_ == 0)
143  sample_duration_ = sample.duration();
144  stream_durations_[stream_id] += sample.duration();
145  return Status::OK;
146 }
147 
149  const SegmentInfo& segment_info) {
150  if (segment_info.key_rotation_encryption_config) {
151  FinalizeFragmentForKeyRotation(
152  stream_id, segment_info.is_encrypted,
153  *segment_info.key_rotation_encryption_config);
154  }
155 
156  DCHECK_LT(stream_id, fragmenters_.size());
157  Fragmenter* fragmenter = fragmenters_[stream_id].get();
158  DCHECK(fragmenter);
159  Status status = fragmenter->FinalizeFragment();
160  if (!status.ok())
161  return status;
162 
163  // Check if all tracks are ready for fragmentation.
164  for (const std::unique_ptr<Fragmenter>& fragmenter : fragmenters_) {
165  if (!fragmenter->fragment_finalized())
166  return Status::OK;
167  }
168 
169  MediaData mdat;
170  // Data offset relative to 'moof': moof size + mdat header size.
171  // The code will also update box sizes for moof_ and its child boxes.
172  uint64_t data_offset = moof_->ComputeSize() + mdat.HeaderSize();
173  // 'traf' should follow 'mfhd' moof header box.
174  uint64_t next_traf_position = moof_->HeaderSize() + moof_->header.box_size();
175  for (size_t i = 0; i < moof_->tracks.size(); ++i) {
176  TrackFragment& traf = moof_->tracks[i];
177  if (traf.auxiliary_offset.offsets.size() > 0) {
178  DCHECK_EQ(traf.auxiliary_offset.offsets.size(), 1u);
179  DCHECK(!traf.sample_encryption.sample_encryption_entries.empty());
180 
181  next_traf_position += traf.box_size();
182  // SampleEncryption 'senc' box should be the last box in 'traf'.
183  // |auxiliary_offset| should point to the data of SampleEncryption.
184  traf.auxiliary_offset.offsets[0] =
185  next_traf_position - traf.sample_encryption.box_size() +
186  traf.sample_encryption.HeaderSize() +
187  sizeof(uint32_t); // for sample count field in 'senc'
188  }
189  traf.runs[0].data_offset = data_offset + mdat.data_size;
190  mdat.data_size += static_cast<uint32_t>(fragmenters_[i]->data()->Size());
191  }
192 
193  // Generate segment reference.
194  sidx_->references.resize(sidx_->references.size() + 1);
195  fragmenters_[GetReferenceStreamId()]->GenerateSegmentReference(
196  &sidx_->references[sidx_->references.size() - 1]);
197  sidx_->references[sidx_->references.size() - 1].referenced_size =
198  data_offset + mdat.data_size;
199 
200  const uint64_t moof_start_offset = fragment_buffer_->Size();
201 
202  // Write the fragment to buffer.
203  moof_->Write(fragment_buffer_.get());
204  mdat.WriteHeader(fragment_buffer_.get());
205 
206  bool first_key_frame = true;
207  for (const std::unique_ptr<Fragmenter>& fragmenter : fragmenters_) {
208  // https://goo.gl/xcFus6 6. Trick play requirements
209  // 6.10. If using fMP4, I-frame segments must include the 'moof' header
210  // associated with the I-frame. It also implies that only the first key
211  // frame can be included.
212  if (!fragmenter->key_frame_infos().empty() && first_key_frame) {
213  const KeyFrameInfo& key_frame_info =
214  fragmenter->key_frame_infos().front();
215  first_key_frame = false;
216  key_frame_infos_.push_back(
217  {key_frame_info.timestamp, moof_start_offset,
218  fragment_buffer_->Size() - moof_start_offset + key_frame_info.size});
219  }
220  fragment_buffer_->AppendBuffer(*fragmenter->data());
221  }
222 
223  // Increase sequence_number for next fragment.
224  ++moof_->header.sequence_number;
225 
226  for (std::unique_ptr<Fragmenter>& fragmenter : fragmenters_)
227  fragmenter->ClearFragmentFinalized();
228  if (!segment_info.is_subsegment) {
229  Status status = DoFinalizeSegment();
230  // Reset segment information to initial state.
231  sidx_->references.clear();
232  key_frame_infos_.clear();
233  return status;
234  }
235  return Status::OK;
236 }
237 
238 uint32_t Segmenter::GetReferenceTimeScale() const {
239  return moov_->header.timescale;
240 }
241 
242 double Segmenter::GetDuration() const {
243  uint64_t duration = moov_->extends.header.fragment_duration;
244  if (duration == 0) {
245  // Handling the case where this is not properly initialized.
246  return 0.0;
247  }
248  return static_cast<double>(duration) / moov_->header.timescale;
249 }
250 
251 void Segmenter::UpdateProgress(uint64_t progress) {
252  accumulated_progress_ += progress;
253 
254  if (!progress_listener_) return;
255  if (progress_target_ == 0) return;
256  // It might happen that accumulated progress exceeds progress_target due to
257  // computation errors, e.g. rounding error. Cap it so it never reports > 100%
258  // progress.
259  if (accumulated_progress_ >= progress_target_) {
260  progress_listener_->OnProgress(1.0);
261  } else {
262  progress_listener_->OnProgress(static_cast<double>(accumulated_progress_) /
263  progress_target_);
264  }
265 }
266 
267 void Segmenter::SetComplete() {
268  if (!progress_listener_) return;
269  progress_listener_->OnProgress(1.0);
270 }
271 
272 uint32_t Segmenter::GetReferenceStreamId() {
273  DCHECK(sidx_);
274  return sidx_->reference_id - 1;
275 }
276 
277 void Segmenter::FinalizeFragmentForKeyRotation(
278  size_t stream_id,
279  bool fragment_encrypted,
280  const EncryptionConfig& encryption_config) {
281  if (options_.mp4_params.include_pssh_in_stream) {
282  const std::vector<ProtectionSystemSpecificInfo>& system_info =
283  encryption_config.key_system_info;
284  moof_->pssh.resize(system_info.size());
285  for (size_t i = 0; i < system_info.size(); i++)
286  moof_->pssh[i].raw_box = system_info[i].psshs;
287  } else {
288  LOG(WARNING)
289  << "Key rotation and no pssh in stream may not work well together.";
290  }
291 
292  // Skip the following steps if the current fragment is not going to be
293  // encrypted. 'pssh' box needs to be included in the fragment, which is
294  // performed above, regardless of whether the fragment is encrypted. This is
295  // necessary for two reasons: 1) Requesting keys before reaching encrypted
296  // content avoids playback delay due to license requests; 2) In Chrome, CDM
297  // must be initialized before starting the playback and CDM can only be
298  // initialized with a valid 'pssh'.
299  if (!fragment_encrypted)
300  return;
301 
302  DCHECK_LT(stream_id, moof_->tracks.size());
303  TrackFragment& traf = moof_->tracks[stream_id];
304  traf.sample_group_descriptions.resize(traf.sample_group_descriptions.size() +
305  1);
306  SampleGroupDescription& sample_group_description =
307  traf.sample_group_descriptions.back();
308  sample_group_description.grouping_type = FOURCC_seig;
309 
310  sample_group_description.cenc_sample_encryption_info_entries.resize(1);
311  CencSampleEncryptionInfoEntry& sample_group_entry =
312  sample_group_description.cenc_sample_encryption_info_entries.back();
313  sample_group_entry.is_protected = 1;
314  sample_group_entry.per_sample_iv_size = encryption_config.per_sample_iv_size;
315  sample_group_entry.constant_iv = encryption_config.constant_iv;
316  sample_group_entry.crypt_byte_block = encryption_config.crypt_byte_block;
317  sample_group_entry.skip_byte_block = encryption_config.skip_byte_block;
318  sample_group_entry.key_id = encryption_config.key_id;
319 }
320 
321 } // namespace mp4
322 } // namespace media
323 } // namespace shaka
uint32_t HeaderSize() const final
Definition: box.cc:75
- +
virtual bool WriteToVector(std::vector< uint8_t > *output)
Definition: id3_tag.cc:67
- +
STL namespace.
virtual void AddPrivateFrame(const std::string &owner, const std::string &data)
Definition: id3_tag.cc:49
All the methods that are virtual are virtual for mocking.
@@ -85,18 +85,18 @@ $(function() {
uint32_t box_size()
Definition: box.h:55
virtual uint32_t HeaderSize() const
Definition: box.cc:55
- +
Class to hold a media sample.
Definition: media_sample.h:22
- + - +
void UpdateProgress(uint64_t progress)
Update segmentation progress using ProgressListener.
Definition: segmenter.cc:270
void WriteHeader(BufferWriter *writer)
Definition: box.cc:38
diff --git a/docs/d2/da9/classshaka_1_1media_1_1BufferWriter-members.html b/docs/d2/da9/classshaka_1_1media_1_1BufferWriter-members.html index bca0fda9ba..717e819ddc 100644 --- a/docs/d2/da9/classshaka_1_1media_1_1BufferWriter-members.html +++ b/docs/d2/da9/classshaka_1_1media_1_1BufferWriter-members.html @@ -93,7 +93,7 @@ $(function() {
diff --git a/docs/d2/dae/classshaka_1_1MockAdaptationSet-members.html b/docs/d2/dae/classshaka_1_1MockAdaptationSet-members.html index 4138f9d3a1..dfa22a49c6 100644 --- a/docs/d2/dae/classshaka_1_1MockAdaptationSet-members.html +++ b/docs/d2/dae/classshaka_1_1MockAdaptationSet-members.html @@ -108,7 +108,7 @@ $(function() { diff --git a/docs/d2/dae/webm__muxer_8cc_source.html b/docs/d2/dae/webm__muxer_8cc_source.html index 03d371e0d2..626c5bfa06 100644 --- a/docs/d2/dae/webm__muxer_8cc_source.html +++ b/docs/d2/dae/webm__muxer_8cc_source.html @@ -67,7 +67,7 @@ $(function() {
1 // Copyright 2015 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include "packager/media/formats/webm/webm_muxer.h"
8 
9 #include "packager/media/base/fourccs.h"
10 #include "packager/media/base/media_sample.h"
11 #include "packager/media/base/stream_info.h"
12 #include "packager/media/formats/webm/mkv_writer.h"
13 #include "packager/media/formats/webm/multi_segment_segmenter.h"
14 #include "packager/media/formats/webm/single_segment_segmenter.h"
15 #include "packager/media/formats/webm/two_pass_single_segment_segmenter.h"
16 
17 namespace shaka {
18 namespace media {
19 namespace webm {
20 
21 WebMMuxer::WebMMuxer(const MuxerOptions& options) : Muxer(options) {}
22 WebMMuxer::~WebMMuxer() {}
23 
24 Status WebMMuxer::InitializeMuxer() {
25  CHECK_EQ(streams().size(), 1U);
26 
27  if (streams()[0]->is_encrypted() &&
28  streams()[0]->encryption_config().protection_scheme != FOURCC_cenc) {
29  LOG(ERROR) << "WebM does not support protection scheme other than 'cenc'.";
30  return Status(error::INVALID_ARGUMENT,
31  "WebM does not support protection scheme other than 'cenc'.");
32  }
33 
34  if (!options().segment_template.empty()) {
35  segmenter_.reset(new MultiSegmentSegmenter(options()));
36  } else {
37  segmenter_.reset(new TwoPassSingleSegmentSegmenter(options()));
38  }
39 
40  Status initialized = segmenter_->Initialize(
41  *streams()[0], progress_listener(), muxer_listener());
42  if (!initialized.ok())
43  return initialized;
44 
45  FireOnMediaStartEvent();
46  return Status::OK;
47 }
48 
49 Status WebMMuxer::Finalize() {
50  DCHECK(segmenter_);
51  Status segmenter_finalized = segmenter_->Finalize();
52 
53  if (!segmenter_finalized.ok())
54  return segmenter_finalized;
55 
56  FireOnMediaEndEvent();
57  LOG(INFO) << "WEBM file '" << options().output_file_name << "' finalized.";
58  return Status::OK;
59 }
60 
61 Status WebMMuxer::AddSample(size_t stream_id, const MediaSample& sample) {
62  DCHECK(segmenter_);
63  DCHECK_EQ(stream_id, 0u);
64  return segmenter_->AddSample(sample);
65 }
66 
67 Status WebMMuxer::FinalizeSegment(size_t stream_id,
68  const SegmentInfo& segment_info) {
69  DCHECK(segmenter_);
70  DCHECK_EQ(stream_id, 0u);
71 
72  if (segment_info.key_rotation_encryption_config) {
73  NOTIMPLEMENTED() << "Key rotation is not implemented for WebM.";
74  return Status(error::UNIMPLEMENTED,
75  "Key rotation is not implemented for WebM");
76  }
77  return segmenter_->FinalizeSegment(segment_info.start_timestamp,
78  segment_info.duration,
79  segment_info.is_subsegment);
80 }
81 
82 void WebMMuxer::FireOnMediaStartEvent() {
83  if (!muxer_listener())
84  return;
85 
86  DCHECK(!streams().empty()) << "Media started without a stream.";
87 
88  const uint32_t timescale = streams().front()->time_scale();
89  muxer_listener()->OnMediaStart(options(), *streams().front(), timescale,
90  MuxerListener::kContainerWebM);
91 }
92 
93 void WebMMuxer::FireOnMediaEndEvent() {
94  if (!muxer_listener())
95  return;
96 
97  MuxerListener::MediaRanges media_range;
98 
99  uint64_t init_range_start = 0;
100  uint64_t init_range_end = 0;
101  const bool has_init_range =
102  segmenter_->GetInitRangeStartAndEnd(&init_range_start, &init_range_end);
103  if (has_init_range) {
104  Range r;
105  r.start = init_range_start;
106  r.end = init_range_end;
107  media_range.init_range = r;
108  }
109 
110  uint64_t index_range_start = 0;
111  uint64_t index_range_end = 0;
112  const bool has_index_range = segmenter_->GetIndexRangeStartAndEnd(
113  &index_range_start, &index_range_end);
114  if (has_index_range) {
115  Range r;
116  r.start = index_range_start;
117  r.end = index_range_end;
118  media_range.index_range = r;
119  }
120 
121  media_range.subsegment_ranges = segmenter_->GetSegmentRanges();
122 
123  const float duration_seconds = segmenter_->GetDurationInSeconds();
124  muxer_listener()->OnMediaEnd(media_range, duration_seconds);
125 }
126 
127 } // namespace webm
128 } // namespace media
129 } // namespace shaka
base::Optional< Range > init_range
Range of the initialization section of a segment.
- +
base::Optional< Range > index_range
Range of the index section of a segment.
@@ -86,7 +86,7 @@ $(function() {
diff --git a/docs/d2/db1/master__playlist_8cc_source.html b/docs/d2/db1/master__playlist_8cc_source.html index 67ab64f652..25f61b228a 100644 --- a/docs/d2/db1/master__playlist_8cc_source.html +++ b/docs/d2/db1/master__playlist_8cc_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d2/db1/structshaka_1_1media_1_1mp4_1_1SampleToGroup-members.html b/docs/d2/db1/structshaka_1_1media_1_1mp4_1_1SampleToGroup-members.html index 784b35dfcc..2187e6cdb9 100644 --- a/docs/d2/db1/structshaka_1_1media_1_1mp4_1_1SampleToGroup-members.html +++ b/docs/d2/db1/structshaka_1_1media_1_1mp4_1_1SampleToGroup-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/docs/d2/db6/structshaka_1_1media_1_1mp4_1_1FileType-members.html b/docs/d2/db6/structshaka_1_1media_1_1mp4_1_1FileType-members.html index b2191c3f65..2e76698bdc 100644 --- a/docs/d2/db6/structshaka_1_1media_1_1mp4_1_1FileType-members.html +++ b/docs/d2/db6/structshaka_1_1media_1_1mp4_1_1FileType-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/docs/d2/db8/structshaka_1_1media_1_1mp4_1_1CueSourceIDBox-members.html b/docs/d2/db8/structshaka_1_1media_1_1mp4_1_1CueSourceIDBox-members.html index c311ae8ce9..22a978ed00 100644 --- a/docs/d2/db8/structshaka_1_1media_1_1mp4_1_1CueSourceIDBox-members.html +++ b/docs/d2/db8/structshaka_1_1media_1_1mp4_1_1CueSourceIDBox-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/d2/dba/classshaka_1_1media_1_1SegmentTestBase.html b/docs/d2/dba/classshaka_1_1media_1_1SegmentTestBase.html index 74cd93ef4e..9d313ea37f 100644 --- a/docs/d2/dba/classshaka_1_1media_1_1SegmentTestBase.html +++ b/docs/d2/dba/classshaka_1_1media_1_1SegmentTestBase.html @@ -159,7 +159,7 @@ bool single_segment_ diff --git a/docs/d2/dbb/classshaka_1_1media_1_1TextChunker-members.html b/docs/d2/dbb/classshaka_1_1media_1_1TextChunker-members.html index 79e8c10582..2f5035d764 100644 --- a/docs/d2/dbb/classshaka_1_1media_1_1TextChunker-members.html +++ b/docs/d2/dbb/classshaka_1_1media_1_1TextChunker-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/docs/d2/dbf/status__macros_8h_source.html b/docs/d2/dbf/status__macros_8h_source.html index 0d4bdc38c6..3d34261e82 100644 --- a/docs/d2/dbf/status__macros_8h_source.html +++ b/docs/d2/dbf/status__macros_8h_source.html @@ -69,7 +69,7 @@ $(function() {
1 // Copyright 2018 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #ifndef PACKAGER_STATUS_MACROS_H_
8 #define PACKAGER_STATUS_MACROS_H_
9 
10 #include "packager/status.h"
11 
12 // Evaluates an expression that produces a `Status`. If the status is not
13 // ok, returns it from the current function.
14 #define RETURN_IF_ERROR(expr) \
15  do { \
16  /* Using _status below to avoid capture problems if expr is "status". */ \
17  shaka::Status _status = (expr); \
18  if (!_status.ok()) \
19  return _status; \
20  } while (0)
21 
22 // TODO(kqyang): Support build Status and update Status message through "<<".
23 
24 #endif // PACKAGER_STATUS_MACROS_H_
diff --git a/docs/d2/dc3/structshaka_1_1media_1_1mp4_1_1Track-members.html b/docs/d2/dc3/structshaka_1_1media_1_1mp4_1_1Track-members.html index dfc422ec1a..40bf77c2ab 100644 --- a/docs/d2/dc3/structshaka_1_1media_1_1mp4_1_1Track-members.html +++ b/docs/d2/dc3/structshaka_1_1media_1_1mp4_1_1Track-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/docs/d2/dc7/media__handler__test__base_8cc_source.html b/docs/d2/dc7/media__handler__test__base_8cc_source.html index 164e747cb1..6d3b0f63ed 100644 --- a/docs/d2/dc7/media__handler__test__base_8cc_source.html +++ b/docs/d2/dc7/media__handler__test__base_8cc_source.html @@ -66,30 +66,30 @@ $(function() {
media_handler_test_base.cc
-
1 // Copyright 2017 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include "packager/media/base/media_handler_test_base.h"
8 
9 #include "packager/media/base/audio_stream_info.h"
10 #include "packager/media/base/text_stream_info.h"
11 #include "packager/media/base/video_stream_info.h"
12 #include "packager/status_test_util.h"
13 
14 namespace {
15 
16 const int kTrackId = 1;
17 const uint64_t kDuration = 10000;
18 const char kCodecString[] = "codec string";
19 const uint8_t kSampleBits = 1;
20 const uint8_t kNumChannels = 2;
21 const uint32_t kSamplingFrequency = 48000;
22 const uint64_t kSeekPrerollNs = 12345;
23 const uint64_t kCodecDelayNs = 56789;
24 const uint32_t kMaxBitrate = 13579;
25 const uint32_t kAvgBitrate = 13000;
26 const char kLanguage[] = "eng";
27 const uint16_t kWidth = 10u;
28 const uint16_t kHeight = 20u;
29 const uint32_t kPixelWidth = 2u;
30 const uint32_t kPixelHeight = 3u;
31 const int16_t kTrickPlayFactor = 0;
32 const uint8_t kNaluLengthSize = 1u;
33 const bool kEncrypted = true;
34 
35 // Use H264 code config.
36 const uint8_t kCodecConfig[]{
37  // clang-format off
38  // Header
39  0x01, 0x64, 0x00, 0x1e, 0xff,
40  // SPS count (ignore top three bits)
41  0xe1,
42  // SPS
43  0x00, 0x19, // Size
44  0x67, 0x64, 0x00, 0x1e, 0xac, 0xd9, 0x40, 0xa0, 0x2f, 0xf9, 0x70, 0x11,
45  0x00, 0x00, 0x03, 0x03, 0xe9, 0x00, 0x00, 0xea, 0x60, 0x0f, 0x16, 0x2d,
46  0x96,
47  // PPS count
48  0x01,
49  // PPS
50  0x00, 0x06, // Size
51  0x68, 0xeb, 0xe3, 0xcb, 0x22, 0xc0,
52  // clang-format on
53 };
54 
55 // Mock data, we don't really care about what is inside.
56 const uint8_t kData[]{
57  0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
58 };
59 
60 } // namespace
61 
62 namespace shaka {
63 namespace media {
64 
65 std::string StreamDataTypeToString(StreamDataType stream_data_type) {
66  switch (stream_data_type) {
67  case StreamDataType::kStreamInfo:
68  return "stream info";
69  case StreamDataType::kMediaSample:
70  return "media sample";
71  case StreamDataType::kTextSample:
72  return "text sample";
73  case StreamDataType::kSegmentInfo:
74  return "segment info";
75  case StreamDataType::kScte35Event:
76  return "scte35 event";
77  case StreamDataType::kCueEvent:
78  return "cue event";
79  case StreamDataType::kUnknown:
80  return "unknown";
81  }
82  return "unknown";
83 }
84 
85 std::string BoolToString(bool value) {
86  return value ? "true" : "false";
87 }
88 
89 bool FakeInputMediaHandler::ValidateOutputStreamIndex(size_t index) const {
90  return true;
91 }
92 
93 Status FakeInputMediaHandler::InitializeInternal() {
94  return Status::OK;
95 }
96 
97 Status FakeInputMediaHandler::Process(std::unique_ptr<StreamData> stream_data) {
98  return Status(error::INTERNAL_ERROR,
99  "FakeInputMediaHandler should never be a downstream handler.");
100 }
101 
102 Status MockOutputMediaHandler::InitializeInternal() {
103  return Status::OK;
104 }
105 
106 Status MockOutputMediaHandler::Process(
107  std::unique_ptr<StreamData> stream_data) {
108  OnProcess(stream_data.get());
109  return Status::OK;
110 }
111 
112 Status MockOutputMediaHandler::OnFlushRequest(size_t index) {
113  OnFlush(index);
114  return Status::OK;
115 }
116 
118  return Status::OK;
119 }
120 
121 Status FakeMediaHandler::Process(std::unique_ptr<StreamData> stream_data) {
122  stream_data_vector_.push_back(std::move(stream_data));
123  return Status::OK;
124 }
125 
126 Status FakeMediaHandler::OnFlushRequest(size_t input_stream_index) {
127  return Status::OK;
128 }
129 
130 bool FakeMediaHandler::ValidateOutputStreamIndex(size_t stream_index) const {
131  return true;
132 }
133 
134 bool MediaHandlerTestBase::IsVideoCodec(Codec codec) const {
135  return codec >= kCodecVideo && codec < kCodecVideoMaxPlusOne;
136 }
137 
138 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo(
139  uint32_t time_scale) const {
140  return GetVideoStreamInfo(time_scale, kCodecVP9, kWidth, kHeight);
141 }
142 
143 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo(
144  uint32_t time_scale,
145  uint32_t width,
146  uint64_t height) const {
147  return GetVideoStreamInfo(time_scale, kCodecVP9, width, height);
148 }
149 
150 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo(
151  uint32_t time_scale,
152  Codec codec) const {
153  return GetVideoStreamInfo(time_scale, codec, kWidth, kHeight);
154 }
155 
156 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo(
157  uint32_t time_scale,
158  Codec codec,
159  uint32_t width,
160  uint64_t height) const {
161  return std::unique_ptr<VideoStreamInfo>(new VideoStreamInfo(
162  kTrackId, time_scale, kDuration, codec, H26xStreamFormat::kUnSpecified,
163  kCodecString, kCodecConfig, sizeof(kCodecConfig), width, height,
164  kPixelWidth, kPixelHeight, kTrickPlayFactor, kNaluLengthSize, kLanguage,
165  !kEncrypted));
166 }
167 
168 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetAudioStreamInfo(
169  uint32_t time_scale) const {
170  return GetAudioStreamInfo(time_scale, kCodecAAC);
171 }
172 
173 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetAudioStreamInfo(
174  uint32_t time_scale,
175  Codec codec) const {
176  return std::unique_ptr<AudioStreamInfo>(new AudioStreamInfo(
177  kTrackId, time_scale, kDuration, codec, kCodecString, kCodecConfig,
178  sizeof(kCodecConfig), kSampleBits, kNumChannels, kSamplingFrequency,
179  kSeekPrerollNs, kCodecDelayNs, kMaxBitrate, kAvgBitrate, kLanguage,
180  !kEncrypted));
181 }
182 
183 std::shared_ptr<MediaSample> MediaHandlerTestBase::GetMediaSample(
184  int64_t timestamp,
185  int64_t duration,
186  bool is_keyframe) const {
187  return GetMediaSample(timestamp, duration, is_keyframe, kData, sizeof(kData));
188 }
189 
190 std::shared_ptr<MediaSample> MediaHandlerTestBase::GetMediaSample(
191  int64_t timestamp,
192  int64_t duration,
193  bool is_keyframe,
194  const uint8_t* data,
195  size_t data_length) const {
196  std::shared_ptr<MediaSample> sample =
197  MediaSample::CopyFrom(data, data_length, nullptr, 0, is_keyframe);
198  sample->set_dts(timestamp);
199  sample->set_pts(timestamp);
200  sample->set_duration(duration);
201 
202  return sample;
203 }
204 
205 std::unique_ptr<SegmentInfo> MediaHandlerTestBase::GetSegmentInfo(
206  int64_t start_timestamp,
207  int64_t duration,
208  bool is_subsegment) const {
209  std::unique_ptr<SegmentInfo> info(new SegmentInfo);
210  info->start_timestamp = start_timestamp;
211  info->duration = duration;
212  info->is_subsegment = is_subsegment;
213 
214  return info;
215 }
216 
217 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetTextStreamInfo() const {
218  // Assume that text will use milliseconds.
219  const uint64_t kTimeScaleMs = 1000;
220 
221  // None of this information is actually used by the text out handler.
222  // The stream info is just needed to signal the start of the stream.
223  return std::unique_ptr<StreamInfo>(
224  new TextStreamInfo(0, kTimeScaleMs, 0, kUnknownCodec, "", "", 0, 0, ""));
225 }
226 
227 std::unique_ptr<TextSample> MediaHandlerTestBase::GetTextSample(
228  const std::string& id,
229  int64_t start,
230  int64_t end,
231  const std::string& payload) const {
232  std::unique_ptr<TextSample> sample(new TextSample);
233  sample->set_id(id);
234  sample->SetTime(start, end);
235  sample->AppendPayload(payload);
236 
237  return sample;
238 }
239 
240 std::unique_ptr<CueEvent> MediaHandlerTestBase::GetCueEvent(
241  double time_in_seconds) const {
242  std::unique_ptr<CueEvent> event(new CueEvent);
243  event->time_in_seconds = time_in_seconds;
244 
245  return event;
246 }
247 
248 Status MediaHandlerTestBase::SetUpAndInitializeGraph(
249  std::shared_ptr<MediaHandler> handler,
250  size_t input_count,
251  size_t output_count) {
252  DCHECK(handler);
253  DCHECK_EQ(nullptr, handler_);
254  DCHECK(inputs_.empty());
255  DCHECK(outputs_.empty());
256 
257  handler_ = std::move(handler);
258 
259  Status status;
260 
261  // Add and connect all the requested inputs.
262  for (size_t i = 0; i < input_count; i++) {
263  inputs_.emplace_back(new FakeInputMediaHandler);
264  }
265 
266  for (auto& input : inputs_) {
267  status.Update(input->AddHandler(handler_));
268  }
269 
270  if (!status.ok()) {
271  return status;
272  }
273 
274  // Add and connect all the requested outputs.
275  for (size_t i = 0; i < output_count; i++) {
276  outputs_.emplace_back(new testing::NiceMock<MockOutputMediaHandler>);
277  }
278 
279  for (auto& output : outputs_) {
280  status.Update(handler_->AddHandler(output));
281  }
282 
283  if (!status.ok()) {
284  return status;
285  }
286 
287  // Initialize the graph.
288  for (auto& input : inputs_) {
289  status.Update(input->Initialize());
290  }
291 
292  // In the case that there are no inputs, the start of the graph
293  // is at |handler_| so it needs to be initialized or else the graph
294  // won't be initialized.
295  if (inputs_.empty()) {
296  status.Update(handler_->Initialize());
297  }
298 
299  return status;
300 }
301 
302 FakeInputMediaHandler* MediaHandlerTestBase::Input(size_t index) {
303  DCHECK_LT(index, inputs_.size());
304  return inputs_[index].get();
305 }
306 
307 MockOutputMediaHandler* MediaHandlerTestBase::Output(size_t index) {
308  DCHECK_LT(index, outputs_.size());
309  return outputs_[index].get();
310 }
311 
312 MediaHandlerGraphTestBase::MediaHandlerGraphTestBase()
313  : next_handler_(new FakeMediaHandler),
314  some_handler_(new FakeMediaHandler) {}
315 
317  size_t num_inputs,
318  size_t num_outputs,
319  std::shared_ptr<MediaHandler> handler) {
320  // Input handler is not really used anywhere but just to satisfy one input
321  // one output restriction for the encryption handler.
322  auto input_handler = std::make_shared<FakeMediaHandler>();
323  for (size_t i = 0; i < num_inputs; ++i)
324  ASSERT_OK(input_handler->SetHandler(i, handler));
325  // All outputs are routed to |next_handler_|.
326  for (size_t i = 0; i < num_outputs; ++i)
327  ASSERT_OK(handler->SetHandler(i, next_handler_));
328 }
329 
330 const std::vector<std::unique_ptr<StreamData>>&
332  return next_handler_->stream_data_vector();
333 }
334 
336  next_handler_->clear_stream_data_vector();
337 }
338 
339 } // namespace media
340 } // namespace shaka
- +
1 // Copyright 2017 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include "packager/media/base/media_handler_test_base.h"
8 
9 #include "packager/media/base/audio_stream_info.h"
10 #include "packager/media/base/text_stream_info.h"
11 #include "packager/media/base/video_stream_info.h"
12 #include "packager/status_test_util.h"
13 
14 namespace {
15 
16 const int kTrackId = 1;
17 const uint64_t kDuration = 10000;
18 const char kCodecString[] = "codec string";
19 const uint8_t kSampleBits = 1;
20 const uint8_t kNumChannels = 2;
21 const uint32_t kSamplingFrequency = 48000;
22 const uint64_t kSeekPrerollNs = 12345;
23 const uint64_t kCodecDelayNs = 56789;
24 const uint32_t kMaxBitrate = 13579;
25 const uint32_t kAvgBitrate = 13000;
26 const char kLanguage[] = "eng";
27 const uint16_t kWidth = 10u;
28 const uint16_t kHeight = 20u;
29 const uint32_t kPixelWidth = 2u;
30 const uint32_t kPixelHeight = 3u;
31 const int16_t kTrickPlayFactor = 0;
32 const uint8_t kNaluLengthSize = 1u;
33 const bool kEncrypted = true;
34 
35 // Use H264 code config.
36 const uint8_t kCodecConfig[]{
37  // clang-format off
38  // Header
39  0x01, 0x64, 0x00, 0x1e, 0xff,
40  // SPS count (ignore top three bits)
41  0xe1,
42  // SPS
43  0x00, 0x19, // Size
44  0x67, 0x64, 0x00, 0x1e, 0xac, 0xd9, 0x40, 0xa0, 0x2f, 0xf9, 0x70, 0x11,
45  0x00, 0x00, 0x03, 0x03, 0xe9, 0x00, 0x00, 0xea, 0x60, 0x0f, 0x16, 0x2d,
46  0x96,
47  // PPS count
48  0x01,
49  // PPS
50  0x00, 0x06, // Size
51  0x68, 0xeb, 0xe3, 0xcb, 0x22, 0xc0,
52  // clang-format on
53 };
54 
55 // Mock data, we don't really care about what is inside.
56 const uint8_t kData[]{
57  0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
58 };
59 
60 } // namespace
61 
62 namespace shaka {
63 namespace media {
64 
65 std::string BoolToString(bool value) {
66  return value ? "true" : "false";
67 }
68 
69 bool FakeInputMediaHandler::ValidateOutputStreamIndex(size_t index) const {
70  return true;
71 }
72 
73 Status FakeInputMediaHandler::InitializeInternal() {
74  return Status::OK;
75 }
76 
77 Status FakeInputMediaHandler::Process(std::unique_ptr<StreamData> stream_data) {
78  return Status(error::INTERNAL_ERROR,
79  "FakeInputMediaHandler should never be a downstream handler.");
80 }
81 
82 Status MockOutputMediaHandler::InitializeInternal() {
83  return Status::OK;
84 }
85 
86 Status MockOutputMediaHandler::Process(
87  std::unique_ptr<StreamData> stream_data) {
88  OnProcess(stream_data.get());
89  return Status::OK;
90 }
91 
92 Status MockOutputMediaHandler::OnFlushRequest(size_t index) {
93  OnFlush(index);
94  return Status::OK;
95 }
96 
98  return Status::OK;
99 }
100 
101 Status FakeMediaHandler::Process(std::unique_ptr<StreamData> stream_data) {
102  stream_data_vector_.push_back(std::move(stream_data));
103  return Status::OK;
104 }
105 
106 Status FakeMediaHandler::OnFlushRequest(size_t input_stream_index) {
107  return Status::OK;
108 }
109 
110 bool FakeMediaHandler::ValidateOutputStreamIndex(size_t stream_index) const {
111  return true;
112 }
113 
114 bool MediaHandlerTestBase::IsVideoCodec(Codec codec) const {
115  return codec >= kCodecVideo && codec < kCodecVideoMaxPlusOne;
116 }
117 
118 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo(
119  uint32_t time_scale) const {
120  return GetVideoStreamInfo(time_scale, kCodecVP9, kWidth, kHeight);
121 }
122 
123 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo(
124  uint32_t time_scale,
125  uint32_t width,
126  uint64_t height) const {
127  return GetVideoStreamInfo(time_scale, kCodecVP9, width, height);
128 }
129 
130 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo(
131  uint32_t time_scale,
132  Codec codec) const {
133  return GetVideoStreamInfo(time_scale, codec, kWidth, kHeight);
134 }
135 
136 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo(
137  uint32_t time_scale,
138  Codec codec,
139  uint32_t width,
140  uint64_t height) const {
141  return std::unique_ptr<VideoStreamInfo>(new VideoStreamInfo(
142  kTrackId, time_scale, kDuration, codec, H26xStreamFormat::kUnSpecified,
143  kCodecString, kCodecConfig, sizeof(kCodecConfig), width, height,
144  kPixelWidth, kPixelHeight, kTrickPlayFactor, kNaluLengthSize, kLanguage,
145  !kEncrypted));
146 }
147 
148 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetAudioStreamInfo(
149  uint32_t time_scale) const {
150  return GetAudioStreamInfo(time_scale, kCodecAAC);
151 }
152 
153 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetAudioStreamInfo(
154  uint32_t time_scale,
155  Codec codec) const {
156  return std::unique_ptr<AudioStreamInfo>(new AudioStreamInfo(
157  kTrackId, time_scale, kDuration, codec, kCodecString, kCodecConfig,
158  sizeof(kCodecConfig), kSampleBits, kNumChannels, kSamplingFrequency,
159  kSeekPrerollNs, kCodecDelayNs, kMaxBitrate, kAvgBitrate, kLanguage,
160  !kEncrypted));
161 }
162 
163 std::shared_ptr<MediaSample> MediaHandlerTestBase::GetMediaSample(
164  int64_t timestamp,
165  int64_t duration,
166  bool is_keyframe) const {
167  return GetMediaSample(timestamp, duration, is_keyframe, kData, sizeof(kData));
168 }
169 
170 std::shared_ptr<MediaSample> MediaHandlerTestBase::GetMediaSample(
171  int64_t timestamp,
172  int64_t duration,
173  bool is_keyframe,
174  const uint8_t* data,
175  size_t data_length) const {
176  std::shared_ptr<MediaSample> sample =
177  MediaSample::CopyFrom(data, data_length, nullptr, 0, is_keyframe);
178  sample->set_dts(timestamp);
179  sample->set_pts(timestamp);
180  sample->set_duration(duration);
181 
182  return sample;
183 }
184 
185 std::unique_ptr<SegmentInfo> MediaHandlerTestBase::GetSegmentInfo(
186  int64_t start_timestamp,
187  int64_t duration,
188  bool is_subsegment) const {
189  std::unique_ptr<SegmentInfo> info(new SegmentInfo);
190  info->start_timestamp = start_timestamp;
191  info->duration = duration;
192  info->is_subsegment = is_subsegment;
193 
194  return info;
195 }
196 
197 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetTextStreamInfo() const {
198  // Assume that text will use milliseconds.
199  const uint64_t kTimeScaleMs = 1000;
200 
201  // None of this information is actually used by the text out handler.
202  // The stream info is just needed to signal the start of the stream.
203  return std::unique_ptr<StreamInfo>(
204  new TextStreamInfo(0, kTimeScaleMs, 0, kUnknownCodec, "", "", 0, 0, ""));
205 }
206 
207 std::unique_ptr<TextSample> MediaHandlerTestBase::GetTextSample(
208  const std::string& id,
209  int64_t start,
210  int64_t end,
211  const std::string& payload) const {
212  std::unique_ptr<TextSample> sample(new TextSample);
213  sample->set_id(id);
214  sample->SetTime(start, end);
215  sample->AppendPayload(payload);
216 
217  return sample;
218 }
219 
220 std::unique_ptr<CueEvent> MediaHandlerTestBase::GetCueEvent(
221  double time_in_seconds) const {
222  std::unique_ptr<CueEvent> event(new CueEvent);
223  event->time_in_seconds = time_in_seconds;
224 
225  return event;
226 }
227 
228 Status MediaHandlerTestBase::SetUpAndInitializeGraph(
229  std::shared_ptr<MediaHandler> handler,
230  size_t input_count,
231  size_t output_count) {
232  DCHECK(handler);
233  DCHECK_EQ(nullptr, handler_);
234  DCHECK(inputs_.empty());
235  DCHECK(outputs_.empty());
236 
237  handler_ = std::move(handler);
238 
239  Status status;
240 
241  // Add and connect all the requested inputs.
242  for (size_t i = 0; i < input_count; i++) {
243  inputs_.emplace_back(new FakeInputMediaHandler);
244  }
245 
246  for (auto& input : inputs_) {
247  status.Update(input->AddHandler(handler_));
248  }
249 
250  if (!status.ok()) {
251  return status;
252  }
253 
254  // Add and connect all the requested outputs.
255  for (size_t i = 0; i < output_count; i++) {
256  outputs_.emplace_back(new testing::NiceMock<MockOutputMediaHandler>);
257  }
258 
259  for (auto& output : outputs_) {
260  status.Update(handler_->AddHandler(output));
261  }
262 
263  if (!status.ok()) {
264  return status;
265  }
266 
267  // Initialize the graph.
268  for (auto& input : inputs_) {
269  status.Update(input->Initialize());
270  }
271 
272  // In the case that there are no inputs, the start of the graph
273  // is at |handler_| so it needs to be initialized or else the graph
274  // won't be initialized.
275  if (inputs_.empty()) {
276  status.Update(handler_->Initialize());
277  }
278 
279  return status;
280 }
281 
282 FakeInputMediaHandler* MediaHandlerTestBase::Input(size_t index) {
283  DCHECK_LT(index, inputs_.size());
284  return inputs_[index].get();
285 }
286 
287 MockOutputMediaHandler* MediaHandlerTestBase::Output(size_t index) {
288  DCHECK_LT(index, outputs_.size());
289  return outputs_[index].get();
290 }
291 
292 MediaHandlerGraphTestBase::MediaHandlerGraphTestBase()
293  : next_handler_(new FakeMediaHandler),
294  some_handler_(new FakeMediaHandler) {}
295 
297  size_t num_inputs,
298  size_t num_outputs,
299  std::shared_ptr<MediaHandler> handler) {
300  // Input handler is not really used anywhere but just to satisfy one input
301  // one output restriction for the encryption handler.
302  auto input_handler = std::make_shared<FakeMediaHandler>();
303  for (size_t i = 0; i < num_inputs; ++i)
304  ASSERT_OK(input_handler->SetHandler(i, handler));
305  // All outputs are routed to |next_handler_|.
306  for (size_t i = 0; i < num_outputs; ++i)
307  ASSERT_OK(handler->SetHandler(i, next_handler_));
308 }
309 
310 const std::vector<std::unique_ptr<StreamData>>&
312  return next_handler_->stream_data_vector();
313 }
314 
316  next_handler_->clear_stream_data_vector();
317 }
318 
319 } // namespace media
320 } // namespace shaka
+
All the methods that are virtual are virtual for mocking.
-
void ClearOutputStreamDataVector()
Clear the output stream data vector.
- +
void ClearOutputStreamDataVector()
Clear the output stream data vector.
+ - -
Status OnFlushRequest(size_t input_stream_index) override
Event handler for flush request at the specific input stream index.
- - + +
Status OnFlushRequest(size_t input_stream_index) override
Event handler for flush request at the specific input stream index.
+ +
void Update(Status new_status)
Definition: status.cc:76
static std::shared_ptr< MediaSample > CopyFrom(const uint8_t *data, size_t size, bool is_key_frame)
Definition: media_sample.cc:42
-
Status Process(std::unique_ptr< StreamData > stream_data) override
+
Status Process(std::unique_ptr< StreamData > stream_data) override
-
const std::vector< std::unique_ptr< StreamData > > & GetOutputStreamDataVector() const
+
const std::vector< std::unique_ptr< StreamData > > & GetOutputStreamDataVector() const
Holds video stream information.
Holds audio stream information.
-
bool ValidateOutputStreamIndex(size_t stream_index) const override
Validate if the stream at the specified index actually exists.
-
void SetUpGraph(size_t num_inputs, size_t num_outputs, std::shared_ptr< MediaHandler > handler)
Setup a graph using |handler| with |num_inputs| and |num_outputs|.
+
bool ValidateOutputStreamIndex(size_t stream_index) const override
Validate if the stream at the specified index actually exists.
+
void SetUpGraph(size_t num_inputs, size_t num_outputs, std::shared_ptr< MediaHandler > handler)
Setup a graph using |handler| with |num_inputs| and |num_outputs|.
diff --git a/docs/d2/dc7/structshaka_1_1MpdOptions-members.html b/docs/d2/dc7/structshaka_1_1MpdOptions-members.html index 1f5ed2d58b..2394a972d9 100644 --- a/docs/d2/dc7/structshaka_1_1MpdOptions-members.html +++ b/docs/d2/dc7/structshaka_1_1MpdOptions-members.html @@ -76,7 +76,7 @@ $(function() {
diff --git a/docs/d2/dcd/program__map__table__writer_8h_source.html b/docs/d2/dcd/program__map__table__writer_8h_source.html index 10411e6001..0101379e6b 100644 --- a/docs/d2/dcd/program__map__table__writer_8h_source.html +++ b/docs/d2/dcd/program__map__table__writer_8h_source.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d2/dcd/structshaka_1_1media_1_1mp4_1_1EditList-members.html b/docs/d2/dcd/structshaka_1_1media_1_1mp4_1_1EditList-members.html index 7e4ee00983..89d0b090a4 100644 --- a/docs/d2/dcd/structshaka_1_1media_1_1mp4_1_1EditList-members.html +++ b/docs/d2/dcd/structshaka_1_1media_1_1mp4_1_1EditList-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/d2/dcd/tag_8h_source.html b/docs/d2/dcd/tag_8h_source.html index cedd838e57..84fbc075fe 100644 --- a/docs/d2/dcd/tag_8h_source.html +++ b/docs/d2/dcd/tag_8h_source.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/d2/dce/structshaka_1_1WidevineSigner-members.html b/docs/d2/dce/structshaka_1_1WidevineSigner-members.html index 2013330018..a10bd3a457 100644 --- a/docs/d2/dce/structshaka_1_1WidevineSigner-members.html +++ b/docs/d2/dce/structshaka_1_1WidevineSigner-members.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/d2/dd5/classshaka_1_1media_1_1webm_1_1MultiSegmentSegmenter.html b/docs/d2/dd5/classshaka_1_1media_1_1webm_1_1MultiSegmentSegmenter.html index 7f74184ce0..390851f8c7 100644 --- a/docs/d2/dd5/classshaka_1_1media_1_1webm_1_1MultiSegmentSegmenter.html +++ b/docs/d2/dd5/classshaka_1_1media_1_1webm_1_1MultiSegmentSegmenter.html @@ -263,7 +263,7 @@ uint64_t duration () c diff --git a/docs/d2/dd6/mkv__writer_8h_source.html b/docs/d2/dd6/mkv__writer_8h_source.html index 8a7fdb6a20..c69f289a60 100644 --- a/docs/d2/dd6/mkv__writer_8h_source.html +++ b/docs/d2/dd6/mkv__writer_8h_source.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/d2/dd7/structshaka_1_1RawKeyParams-members.html b/docs/d2/dd7/structshaka_1_1RawKeyParams-members.html index de5182f89a..d610eb6440 100644 --- a/docs/d2/dd7/structshaka_1_1RawKeyParams-members.html +++ b/docs/d2/dd7/structshaka_1_1RawKeyParams-members.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/d2/dd8/classshaka_1_1media_1_1ChunkingHandler-members.html b/docs/d2/dd8/classshaka_1_1media_1_1ChunkingHandler-members.html index f9095d7dfe..f32d6926c7 100644 --- a/docs/d2/dd8/classshaka_1_1media_1_1ChunkingHandler-members.html +++ b/docs/d2/dd8/classshaka_1_1media_1_1ChunkingHandler-members.html @@ -98,7 +98,7 @@ $(function() { diff --git a/docs/d2/ddb/classshaka_1_1media_1_1WebMMediaParser.html b/docs/d2/ddb/classshaka_1_1media_1_1WebMMediaParser.html index c09c85bd46..f31fafdcd5 100644 --- a/docs/d2/ddb/classshaka_1_1media_1_1WebMMediaParser.html +++ b/docs/d2/ddb/classshaka_1_1media_1_1WebMMediaParser.html @@ -231,7 +231,7 @@ Additional Inherited Members diff --git a/docs/d2/ddc/hls__audio__util_8h_source.html b/docs/d2/ddc/hls__audio__util_8h_source.html index bd4837a6b2..49c1d48270 100644 --- a/docs/d2/ddc/hls__audio__util_8h_source.html +++ b/docs/d2/ddc/hls__audio__util_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d2/de1/webvtt__timestamp_8h_source.html b/docs/d2/de1/webvtt__timestamp_8h_source.html index 44d7d3e3c9..1299eb8b07 100644 --- a/docs/d2/de1/webvtt__timestamp_8h_source.html +++ b/docs/d2/de1/webvtt__timestamp_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d2/de3/classshaka_1_1media_1_1mp2t_1_1TsSectionPmt.html b/docs/d2/de3/classshaka_1_1media_1_1mp2t_1_1TsSectionPmt.html index 556c384ecb..84548fbc05 100644 --- a/docs/d2/de3/classshaka_1_1media_1_1mp2t_1_1TsSectionPmt.html +++ b/docs/d2/de3/classshaka_1_1media_1_1mp2t_1_1TsSectionPmt.html @@ -130,7 +130,7 @@ void Reset () override diff --git a/docs/d2/de6/packager__main_8cc_source.html b/docs/d2/de6/packager__main_8cc_source.html index be39dc61e4..3ce6121974 100644 --- a/docs/d2/de6/packager__main_8cc_source.html +++ b/docs/d2/de6/packager__main_8cc_source.html @@ -66,20 +66,20 @@ $(function() {
packager_main.cc
-
1 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include <gflags/gflags.h>
8 #include <iostream>
9 
10 #include "packager/app/ad_cue_generator_flags.h"
11 #include "packager/app/crypto_flags.h"
12 #include "packager/app/hls_flags.h"
13 #include "packager/app/manifest_flags.h"
14 #include "packager/app/mpd_flags.h"
15 #include "packager/app/muxer_flags.h"
16 #include "packager/app/packager_util.h"
17 #include "packager/app/playready_key_encryption_flags.h"
18 #include "packager/app/protection_system_flags.h"
19 #include "packager/app/raw_key_encryption_flags.h"
20 #include "packager/app/stream_descriptor.h"
21 #include "packager/app/vlog_flags.h"
22 #include "packager/app/widevine_encryption_flags.h"
23 #include "packager/base/command_line.h"
24 #include "packager/base/logging.h"
25 #include "packager/base/optional.h"
26 #include "packager/base/strings/string_number_conversions.h"
27 #include "packager/base/strings/string_split.h"
28 #include "packager/base/strings/string_util.h"
29 #include "packager/base/strings/stringprintf.h"
30 #include "packager/file/file.h"
31 #include "packager/packager.h"
32 #include "packager/tools/license_notice.h"
33 
34 #if defined(OS_WIN)
35 #include <codecvt>
36 #include <functional>
37 #include <locale>
38 #endif // defined(OS_WIN)
39 
40 DEFINE_bool(dump_stream_info, false, "Dump demuxed stream info.");
41 DEFINE_bool(licenses, false, "Dump licenses.");
42 DEFINE_bool(use_fake_clock_for_muxer,
43  false,
44  "Set to true to use a fake clock for muxer. With this flag set, "
45  "creation time and modification time in outputs are set to 0. "
46  "Should only be used for testing.");
47 DEFINE_bool(override_version,
48  false,
49  "Override packager version in the generated outputs with "
50  "--test_version if it is set to true. Should be used for "
51  "testing only.");
52 DEFINE_string(test_version,
53  "",
54  "Packager version for testing. Ignored if --override_version is "
55  "false. Should be used for testing only.");
56 
57 namespace shaka {
58 namespace {
59 
60 const char kUsage[] =
61  "%s [flags] <stream_descriptor> ...\n\n"
62  " stream_descriptor consists of comma separated field_name/value pairs:\n"
63  " field_name=value,[field_name=value,]...\n"
64  " Supported field names are as follows (names in parenthesis are alias):\n"
65  " - input (in): Required input/source media file path or network stream\n"
66  " URL.\n"
67  " - stream_selector (stream): Required field with value 'audio',\n"
68  " 'video', 'text', or stream number (zero based).\n"
69  " - output (out,init_segment): Required output file (single file) or\n"
70  " initialization file path (multiple file).\n"
71  " - segment_template (segment): Optional value which specifies the\n"
72  " naming pattern for the segment files, and that the stream should be\n"
73  " split into multiple files. Its presence should be consistent across\n"
74  " streams.\n"
75  " - bandwidth (bw): Optional value which contains a user-specified\n"
76  " content bit rate for the stream, in bits/sec. If specified, this\n"
77  " value is propagated to (HLS) EXT-X-STREAM-INF:BANDWIDTH or (DASH)\n"
78  " Representation@bandwidth and the $Bandwidth$ template parameter for\n"
79  " segment names. If not specified, the bandwidth value is estimated\n"
80  " from content bitrate. Note that it only affects the generated\n"
81  " manifests/playlists; it has no effect on the media content itself.\n"
82  " - language (lang): Optional value which contains a user-specified\n"
83  " language tag. If specified, this value overrides any language\n"
84  " metadata in the input stream.\n"
85  " - output_format (format): Optional value which specifies the format\n"
86  " of the output files (MP4 or WebM). If not specified, it will be\n"
87  " derived from the file extension of the output file.\n"
88  " - skip_encryption=0|1: Optional. Defaults to 0 if not specified. If\n"
89  " it is set to 1, no encryption of the stream will be made.\n"
90  " - drm_label: Optional value for custom DRM label, which defines the\n"
91  " encryption key applied to the stream. Typical values include AUDIO,\n"
92  " SD, HD, UHD1, UHD2. For raw key, it should be a label defined in\n"
93  " --keys. If not provided, the DRM label is derived from stream type\n"
94  " (video, audio), resolution, etc.\n"
95  " Note that it is case sensitive.\n"
96  " - trick_play_factor (tpf): Optional value which specifies the trick\n"
97  " play, a.k.a. trick mode, stream sampling rate among key frames.\n"
98  " If specified, the output is a trick play stream.\n"
99  " - hls_name: Used for HLS audio to set the NAME attribute for\n"
100  " EXT-X-MEDIA. Defaults to the base of the playlist name.\n"
101  " - hls_group_id: Used for HLS audio to set the GROUP-ID attribute for\n"
102  " EXT-X-MEDIA. Defaults to 'audio' if not specified.\n"
103  " - playlist_name: The HLS playlist file to create. Usually ends with\n"
104  " '.m3u8', and is relative to --hls_master_playlist_output. If\n"
105  " unspecified, defaults to something of the form 'stream_0.m3u8',\n"
106  " 'stream_1.m3u8', 'stream_2.m3u8', etc.\n"
107  " - iframe_playlist_name: The optional HLS I-Frames only playlist file\n"
108  " to create. Usually ends with '.m3u8', and is relative to\n"
109  " hls_master_playlist_output. Should only be set for video streams. If\n"
110  " unspecified, no I-Frames only playlist is created.\n";
111 
112 // Labels for parameters in RawKey key info.
113 const char kDrmLabelLabel[] = "label";
114 const char kKeyIdLabel[] = "key_id";
115 const char kKeyLabel[] = "key";
116 
117 enum ExitStatus {
118  kSuccess = 0,
119  kArgumentValidationFailed,
120  kPackagingFailed,
121  kInternalError,
122 };
123 
124 bool GetWidevineSigner(WidevineSigner* signer) {
125  signer->signer_name = FLAGS_signer;
126  if (!FLAGS_aes_signing_key_bytes.empty()) {
127  signer->signing_key_type = WidevineSigner::SigningKeyType::kAes;
128  signer->aes.key = FLAGS_aes_signing_key_bytes;
129  signer->aes.iv = FLAGS_aes_signing_iv_bytes;
130  } else if (!FLAGS_rsa_signing_key_path.empty()) {
131  signer->signing_key_type = WidevineSigner::SigningKeyType::kRsa;
132  if (!File::ReadFileToString(FLAGS_rsa_signing_key_path.c_str(),
133  &signer->rsa.key)) {
134  LOG(ERROR) << "Failed to read from '" << FLAGS_rsa_signing_key_path
135  << "'.";
136  return false;
137  }
138  }
139  return true;
140 }
141 
142 bool GetHlsPlaylistType(const std::string& playlist_type,
143  HlsPlaylistType* playlist_type_enum) {
144  if (base::ToUpperASCII(playlist_type) == "VOD") {
145  *playlist_type_enum = HlsPlaylistType::kVod;
146  } else if (base::ToUpperASCII(playlist_type) == "LIVE") {
147  *playlist_type_enum = HlsPlaylistType::kLive;
148  } else if (base::ToUpperASCII(playlist_type) == "EVENT") {
149  *playlist_type_enum = HlsPlaylistType::kEvent;
150  } else {
151  LOG(ERROR) << "Unrecognized playlist type " << playlist_type;
152  return false;
153  }
154  return true;
155 }
156 
157 bool GetProtectionScheme(uint32_t* protection_scheme) {
158  if (FLAGS_protection_scheme == "cenc") {
159  *protection_scheme = EncryptionParams::kProtectionSchemeCenc;
160  return true;
161  }
162  if (FLAGS_protection_scheme == "cbc1") {
163  *protection_scheme = EncryptionParams::kProtectionSchemeCbc1;
164  return true;
165  }
166  if (FLAGS_protection_scheme == "cbcs") {
167  *protection_scheme = EncryptionParams::kProtectionSchemeCbcs;
168  return true;
169  }
170  if (FLAGS_protection_scheme == "cens") {
171  *protection_scheme = EncryptionParams::kProtectionSchemeCens;
172  return true;
173  }
174  LOG(ERROR) << "Unrecognized protection_scheme " << FLAGS_protection_scheme;
175  return false;
176 }
177 
178 bool ParseKeys(const std::string& keys, RawKeyParams* raw_key) {
179  for (const std::string& key_data : base::SplitString(
180  keys, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) {
181  base::StringPairs string_pairs;
182  base::SplitStringIntoKeyValuePairs(key_data, '=', ':', &string_pairs);
183 
184  std::map<std::string, std::string> value_map;
185  for (const auto& string_pair : string_pairs)
186  value_map[string_pair.first] = string_pair.second;
187  const std::string drm_label = value_map[kDrmLabelLabel];
188  if (raw_key->key_map.find(drm_label) != raw_key->key_map.end()) {
189  LOG(ERROR) << "Seeing duplicated DRM label '" << drm_label << "'.";
190  return false;
191  }
192  auto& key_info = raw_key->key_map[drm_label];
193  if (value_map[kKeyIdLabel].empty() ||
194  !base::HexStringToBytes(value_map[kKeyIdLabel], &key_info.key_id)) {
195  LOG(ERROR) << "Empty key id or invalid hex string for key id: "
196  << value_map[kKeyIdLabel];
197  return false;
198  }
199  if (value_map[kKeyLabel].empty() ||
200  !base::HexStringToBytes(value_map[kKeyLabel], &key_info.key)) {
201  LOG(ERROR) << "Empty key or invalid hex string for key: "
202  << value_map[kKeyLabel];
203  return false;
204  }
205  }
206  return true;
207 }
208 
209 bool GetRawKeyParams(RawKeyParams* raw_key) {
210  raw_key->iv = FLAGS_iv_bytes;
211  raw_key->pssh = FLAGS_pssh_bytes;
212  if (!FLAGS_keys.empty()) {
213  if (!ParseKeys(FLAGS_keys, raw_key)) {
214  LOG(ERROR) << "Failed to parse --keys " << FLAGS_keys;
215  return false;
216  }
217  } else {
218  // An empty StreamLabel specifies the default key info.
219  RawKeyParams::KeyInfo& key_info = raw_key->key_map[""];
220  key_info.key_id = FLAGS_key_id_bytes;
221  key_info.key = FLAGS_key_bytes;
222  }
223  return true;
224 }
225 
226 bool ParseAdCues(const std::string& ad_cues, std::vector<Cuepoint>* cuepoints) {
227  // Track if optional field is supplied consistently across all cue points.
228  size_t duration_count = 0;
229 
230  for (const std::string& ad_cue : base::SplitString(
231  ad_cues, ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) {
232  Cuepoint cuepoint;
233  auto split_ad_cue = base::SplitString(ad_cue, ",", base::TRIM_WHITESPACE,
234  base::SPLIT_WANT_NONEMPTY);
235  if (split_ad_cue.size() > 2) {
236  LOG(ERROR) << "Failed to parse --ad_cues " << ad_cues
237  << " Each ad cue must contain no more than 2 components.";
238  }
239  if (!base::StringToDouble(split_ad_cue.front(),
240  &cuepoint.start_time_in_seconds)) {
241  LOG(ERROR) << "Failed to parse --ad_cues " << ad_cues
242  << " Start time component must be of type double.";
243  return false;
244  }
245  if (split_ad_cue.size() > 1) {
246  duration_count++;
247  if (!base::StringToDouble(split_ad_cue[1],
248  &cuepoint.duration_in_seconds)) {
249  LOG(ERROR) << "Failed to parse --ad_cues " << ad_cues
250  << " Duration component must be of type double.";
251  return false;
252  }
253  }
254  cuepoints->push_back(cuepoint);
255  }
256 
257  if (duration_count > 0 && duration_count != cuepoints->size()) {
258  LOG(ERROR) << "Failed to parse --ad_cues " << ad_cues
259  << " Duration component is optional. However if it is supplied,"
260  << " it must be supplied consistently across all cuepoints.";
261  return false;
262  }
263  return true;
264 }
265 
266 base::Optional<PackagingParams> GetPackagingParams() {
267  PackagingParams packaging_params;
268 
269  packaging_params.temp_dir = FLAGS_temp_dir;
270 
271  AdCueGeneratorParams& ad_cue_generator_params =
272  packaging_params.ad_cue_generator_params;
273  if (!ParseAdCues(FLAGS_ad_cues, &ad_cue_generator_params.cue_points)) {
274  return base::nullopt;
275  }
276 
277  ChunkingParams& chunking_params = packaging_params.chunking_params;
278  chunking_params.segment_duration_in_seconds = FLAGS_segment_duration;
279  chunking_params.subsegment_duration_in_seconds = FLAGS_fragment_duration;
280  chunking_params.segment_sap_aligned = FLAGS_segment_sap_aligned;
281  chunking_params.subsegment_sap_aligned = FLAGS_fragment_sap_aligned;
282 
283  int num_key_providers = 0;
284  EncryptionParams& encryption_params = packaging_params.encryption_params;
285  encryption_params.generate_common_pssh = FLAGS_generate_common_pssh;
286  encryption_params.generate_playready_pssh = FLAGS_generate_playready_pssh;
287  encryption_params.generate_widevine_pssh = FLAGS_generate_widevine_pssh;
288  if (FLAGS_enable_widevine_encryption) {
289  encryption_params.key_provider = KeyProvider::kWidevine;
290  ++num_key_providers;
291  }
292  if (FLAGS_enable_playready_encryption) {
293  encryption_params.key_provider = KeyProvider::kPlayReady;
294  ++num_key_providers;
295  }
296  if (FLAGS_enable_raw_key_encryption) {
297  encryption_params.key_provider = KeyProvider::kRawKey;
298  ++num_key_providers;
299  }
300  if (num_key_providers > 1) {
301  LOG(ERROR) << "Only one of --enable_widevine_encryption, "
302  "--enable_playready_encryption, "
303  "--enable_raw_key_encryption can be enabled.";
304  return base::nullopt;
305  }
306 
307  if (encryption_params.key_provider != KeyProvider::kNone) {
308  encryption_params.clear_lead_in_seconds = FLAGS_clear_lead;
309  if (!GetProtectionScheme(&encryption_params.protection_scheme))
310  return base::nullopt;
311  encryption_params.crypto_period_duration_in_seconds =
312  FLAGS_crypto_period_duration;
313  encryption_params.vp9_subsample_encryption = FLAGS_vp9_subsample_encryption;
314  encryption_params.stream_label_func = std::bind(
315  &Packager::DefaultStreamLabelFunction, FLAGS_max_sd_pixels,
316  FLAGS_max_hd_pixels, FLAGS_max_uhd1_pixels, std::placeholders::_1);
317  }
318  switch (encryption_params.key_provider) {
319  case KeyProvider::kWidevine: {
320  WidevineEncryptionParams& widevine = encryption_params.widevine;
321  widevine.key_server_url = FLAGS_key_server_url;
322 
323  widevine.content_id = FLAGS_content_id_bytes;
324  widevine.policy = FLAGS_policy;
325  widevine.group_id = FLAGS_group_id_bytes;
326  widevine.enable_entitlement_license = FLAGS_enable_entitlement_license;
327  if (!GetWidevineSigner(&widevine.signer))
328  return base::nullopt;
329  break;
330  }
331  case KeyProvider::kPlayReady: {
332  PlayReadyEncryptionParams& playready = encryption_params.playready;
333  playready.key_server_url = FLAGS_playready_server_url;
334  playready.program_identifier = FLAGS_program_identifier;
335  playready.ca_file = FLAGS_ca_file;
336  playready.client_cert_file = FLAGS_client_cert_file;
337  playready.client_cert_private_key_file =
338  FLAGS_client_cert_private_key_file;
339  playready.client_cert_private_key_password =
340  FLAGS_client_cert_private_key_password;
341  break;
342  }
343  case KeyProvider::kRawKey: {
344  if (!GetRawKeyParams(&encryption_params.raw_key))
345  return base::nullopt;
346  break;
347  }
348  case KeyProvider::kNone:
349  break;
350  }
351 
352  num_key_providers = 0;
353  DecryptionParams& decryption_params = packaging_params.decryption_params;
354  if (FLAGS_enable_widevine_decryption) {
355  decryption_params.key_provider = KeyProvider::kWidevine;
356  ++num_key_providers;
357  }
358  if (FLAGS_enable_raw_key_decryption) {
359  decryption_params.key_provider = KeyProvider::kRawKey;
360  ++num_key_providers;
361  }
362  if (num_key_providers > 1) {
363  LOG(ERROR) << "Only one of --enable_widevine_decryption, "
364  "--enable_raw_key_decryption can be enabled.";
365  return base::nullopt;
366  }
367  switch (decryption_params.key_provider) {
368  case KeyProvider::kWidevine: {
369  WidevineDecryptionParams& widevine = decryption_params.widevine;
370  widevine.key_server_url = FLAGS_key_server_url;
371  if (!GetWidevineSigner(&widevine.signer))
372  return base::nullopt;
373  break;
374  }
375  case KeyProvider::kRawKey: {
376  if (!GetRawKeyParams(&decryption_params.raw_key))
377  return base::nullopt;
378  break;
379  }
380  case KeyProvider::kPlayReady:
381  case KeyProvider::kNone:
382  break;
383  }
384 
385  Mp4OutputParams& mp4_params = packaging_params.mp4_output_params;
386  mp4_params.num_subsegments_per_sidx = FLAGS_num_subsegments_per_sidx;
387  if (FLAGS_mp4_use_decoding_timestamp_in_timeline) {
388  LOG(WARNING) << "Flag --mp4_use_decoding_timestamp_in_timeline is set. "
389  "Note that it is a temporary hack to workaround Chromium "
390  "bug https://crbug.com/398130. The flag may be removed "
391  "when the Chromium bug is fixed.";
392  }
393  mp4_params.use_decoding_timestamp_in_timeline =
394  FLAGS_mp4_use_decoding_timestamp_in_timeline;
395  mp4_params.include_pssh_in_stream = FLAGS_mp4_include_pssh_in_stream;
396 
397  packaging_params.output_media_info = FLAGS_output_media_info;
398 
399  MpdParams& mpd_params = packaging_params.mpd_params;
400  mpd_params.mpd_output = FLAGS_mpd_output;
401  mpd_params.base_urls = base::SplitString(
402  FLAGS_base_urls, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
403  mpd_params.min_buffer_time = FLAGS_min_buffer_time;
404  mpd_params.minimum_update_period = FLAGS_minimum_update_period;
405  mpd_params.suggested_presentation_delay = FLAGS_suggested_presentation_delay;
406  mpd_params.time_shift_buffer_depth = FLAGS_time_shift_buffer_depth;
407  mpd_params.preserved_segments_outside_live_window =
408  FLAGS_preserved_segments_outside_live_window;
409 
410  if (!FLAGS_utc_timings.empty()) {
411  base::StringPairs pairs;
412  if (!base::SplitStringIntoKeyValuePairs(FLAGS_utc_timings, '=', ',',
413  &pairs)) {
414  LOG(ERROR) << "Invalid --utc_timings scheme_id_uri/value pairs.";
415  return base::nullopt;
416  }
417  for (const auto& string_pair : pairs) {
418  mpd_params.utc_timings.push_back({string_pair.first, string_pair.second});
419  }
420  }
421 
422  mpd_params.default_language = FLAGS_default_language;
423  mpd_params.generate_static_live_mpd = FLAGS_generate_static_mpd;
424  mpd_params.generate_dash_if_iop_compliant_mpd =
425  FLAGS_generate_dash_if_iop_compliant_mpd;
426  mpd_params.allow_approximate_segment_timeline =
427  FLAGS_allow_approximate_segment_timeline;
428 
429  HlsParams& hls_params = packaging_params.hls_params;
430  if (!GetHlsPlaylistType(FLAGS_hls_playlist_type, &hls_params.playlist_type)) {
431  return base::nullopt;
432  }
433  hls_params.master_playlist_output = FLAGS_hls_master_playlist_output;
434  hls_params.base_url = FLAGS_hls_base_url;
435  hls_params.key_uri = FLAGS_hls_key_uri;
436  hls_params.time_shift_buffer_depth = FLAGS_time_shift_buffer_depth;
437  hls_params.preserved_segments_outside_live_window =
438  FLAGS_preserved_segments_outside_live_window;
439  hls_params.default_language = FLAGS_default_language;
440 
441  TestParams& test_params = packaging_params.test_params;
442  test_params.dump_stream_info = FLAGS_dump_stream_info;
443  test_params.inject_fake_clock = FLAGS_use_fake_clock_for_muxer;
444  if (FLAGS_override_version)
445  test_params.injected_library_version = FLAGS_test_version;
446 
447  return packaging_params;
448 }
449 
450 int PackagerMain(int argc, char** argv) {
451  // Needed to enable VLOG/DVLOG through --vmodule or --v.
452  base::CommandLine::Init(argc, argv);
453 
454  // Set up logging.
455  logging::LoggingSettings log_settings;
456  log_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
457  CHECK(logging::InitLogging(log_settings));
458 
459  google::SetVersionString(shaka::Packager::GetLibraryVersion());
460  google::SetUsageMessage(base::StringPrintf(kUsage, argv[0]));
461  google::ParseCommandLineFlags(&argc, &argv, true);
462  if (FLAGS_licenses) {
463  for (const char* line : kLicenseNotice)
464  std::cout << line << std::endl;
465  return kSuccess;
466  }
467  if (argc < 2) {
468  google::ShowUsageWithFlags("Usage");
469  return kSuccess;
470  }
471 
474  return kArgumentValidationFailed;
475  }
476 
477  base::Optional<PackagingParams> packaging_params = GetPackagingParams();
478  if (!packaging_params)
479  return kArgumentValidationFailed;
480 
481  std::vector<StreamDescriptor> stream_descriptors;
482  for (int i = 1; i < argc; ++i) {
483  base::Optional<StreamDescriptor> stream_descriptor =
484  ParseStreamDescriptor(argv[i]);
485  if (!stream_descriptor)
486  return kArgumentValidationFailed;
487  stream_descriptors.push_back(stream_descriptor.value());
488  }
489  Packager packager;
490  Status status =
491  packager.Initialize(packaging_params.value(), stream_descriptors);
492  if (!status.ok()) {
493  LOG(ERROR) << "Failed to initialize packager: " << status.ToString();
494  return kArgumentValidationFailed;
495  }
496  status = packager.Run();
497  if (!status.ok()) {
498  LOG(ERROR) << "Packaging Error: " << status.ToString();
499  return kPackagingFailed;
500  }
501  printf("Packaging completed successfully.\n");
502  return kSuccess;
503 }
504 
505 } // namespace
506 } // namespace shaka
507 
508 #if defined(OS_WIN)
509 // Windows wmain, which converts wide character arguments to UTF-8.
510 int wmain(int argc, wchar_t* argv[], wchar_t* envp[]) {
511  std::unique_ptr<char* [], std::function<void(char**)>> utf8_argv(
512  new char*[argc], [argc](char** utf8_args) {
513  // TODO(tinskip): This leaks, but if this code is enabled, it crashes.
514  // Figure out why. I suspect gflags does something funny with the
515  // argument array.
516  // for (int idx = 0; idx < argc; ++idx)
517  // delete[] utf8_args[idx];
518  delete[] utf8_args;
519  });
520  std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
521  for (int idx = 0; idx < argc; ++idx) {
522  std::string utf8_arg(converter.to_bytes(argv[idx]));
523  utf8_arg += '\0';
524  utf8_argv[idx] = new char[utf8_arg.size()];
525  memcpy(utf8_argv[idx], &utf8_arg[0], utf8_arg.size());
526  }
527  return shaka::PackagerMain(argc, utf8_argv.get());
528 }
529 #else
530 int main(int argc, char** argv) {
531  return shaka::PackagerMain(argc, argv);
532 }
533 #endif // defined(OS_WIN)
static std::string DefaultStreamLabelFunction(int max_sd_pixels, int max_hd_pixels, int max_uhd1_pixels, const EncryptionParams::EncryptedStreamAttributes &stream_attributes)
Definition: packager.cc:993
+
1 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include <gflags/gflags.h>
8 #include <iostream>
9 
10 #include "packager/app/ad_cue_generator_flags.h"
11 #include "packager/app/crypto_flags.h"
12 #include "packager/app/hls_flags.h"
13 #include "packager/app/manifest_flags.h"
14 #include "packager/app/mpd_flags.h"
15 #include "packager/app/muxer_flags.h"
16 #include "packager/app/packager_util.h"
17 #include "packager/app/playready_key_encryption_flags.h"
18 #include "packager/app/protection_system_flags.h"
19 #include "packager/app/raw_key_encryption_flags.h"
20 #include "packager/app/stream_descriptor.h"
21 #include "packager/app/vlog_flags.h"
22 #include "packager/app/widevine_encryption_flags.h"
23 #include "packager/base/command_line.h"
24 #include "packager/base/logging.h"
25 #include "packager/base/optional.h"
26 #include "packager/base/strings/string_number_conversions.h"
27 #include "packager/base/strings/string_split.h"
28 #include "packager/base/strings/string_util.h"
29 #include "packager/base/strings/stringprintf.h"
30 #include "packager/file/file.h"
31 #include "packager/packager.h"
32 #include "packager/tools/license_notice.h"
33 
34 #if defined(OS_WIN)
35 #include <codecvt>
36 #include <functional>
37 #include <locale>
38 #endif // defined(OS_WIN)
39 
40 DEFINE_bool(dump_stream_info, false, "Dump demuxed stream info.");
41 DEFINE_bool(licenses, false, "Dump licenses.");
42 DEFINE_bool(use_fake_clock_for_muxer,
43  false,
44  "Set to true to use a fake clock for muxer. With this flag set, "
45  "creation time and modification time in outputs are set to 0. "
46  "Should only be used for testing.");
47 DEFINE_string(test_packager_version,
48  "",
49  "Packager version for testing. Should be used for testing only.");
50 
51 namespace shaka {
52 namespace {
53 
54 const char kUsage[] =
55  "%s [flags] <stream_descriptor> ...\n\n"
56  " stream_descriptor consists of comma separated field_name/value pairs:\n"
57  " field_name=value,[field_name=value,]...\n"
58  " Supported field names are as follows (names in parenthesis are alias):\n"
59  " - input (in): Required input/source media file path or network stream\n"
60  " URL.\n"
61  " - stream_selector (stream): Required field with value 'audio',\n"
62  " 'video', 'text', or stream number (zero based).\n"
63  " - output (out,init_segment): Required output file (single file) or\n"
64  " initialization file path (multiple file).\n"
65  " - segment_template (segment): Optional value which specifies the\n"
66  " naming pattern for the segment files, and that the stream should be\n"
67  " split into multiple files. Its presence should be consistent across\n"
68  " streams.\n"
69  " - bandwidth (bw): Optional value which contains a user-specified\n"
70  " content bit rate for the stream, in bits/sec. If specified, this\n"
71  " value is propagated to (HLS) EXT-X-STREAM-INF:BANDWIDTH or (DASH)\n"
72  " Representation@bandwidth and the $Bandwidth$ template parameter for\n"
73  " segment names. If not specified, the bandwidth value is estimated\n"
74  " from content bitrate. Note that it only affects the generated\n"
75  " manifests/playlists; it has no effect on the media content itself.\n"
76  " - language (lang): Optional value which contains a user-specified\n"
77  " language tag. If specified, this value overrides any language\n"
78  " metadata in the input stream.\n"
79  " - output_format (format): Optional value which specifies the format\n"
80  " of the output files (MP4 or WebM). If not specified, it will be\n"
81  " derived from the file extension of the output file.\n"
82  " - skip_encryption=0|1: Optional. Defaults to 0 if not specified. If\n"
83  " it is set to 1, no encryption of the stream will be made.\n"
84  " - drm_label: Optional value for custom DRM label, which defines the\n"
85  " encryption key applied to the stream. Typical values include AUDIO,\n"
86  " SD, HD, UHD1, UHD2. For raw key, it should be a label defined in\n"
87  " --keys. If not provided, the DRM label is derived from stream type\n"
88  " (video, audio), resolution, etc.\n"
89  " Note that it is case sensitive.\n"
90  " - trick_play_factor (tpf): Optional value which specifies the trick\n"
91  " play, a.k.a. trick mode, stream sampling rate among key frames.\n"
92  " If specified, the output is a trick play stream.\n"
93  " - hls_name: Used for HLS audio to set the NAME attribute for\n"
94  " EXT-X-MEDIA. Defaults to the base of the playlist name.\n"
95  " - hls_group_id: Used for HLS audio to set the GROUP-ID attribute for\n"
96  " EXT-X-MEDIA. Defaults to 'audio' if not specified.\n"
97  " - playlist_name: The HLS playlist file to create. Usually ends with\n"
98  " '.m3u8', and is relative to --hls_master_playlist_output. If\n"
99  " unspecified, defaults to something of the form 'stream_0.m3u8',\n"
100  " 'stream_1.m3u8', 'stream_2.m3u8', etc.\n"
101  " - iframe_playlist_name: The optional HLS I-Frames only playlist file\n"
102  " to create. Usually ends with '.m3u8', and is relative to\n"
103  " hls_master_playlist_output. Should only be set for video streams. If\n"
104  " unspecified, no I-Frames only playlist is created.\n";
105 
106 // Labels for parameters in RawKey key info.
107 const char kDrmLabelLabel[] = "label";
108 const char kKeyIdLabel[] = "key_id";
109 const char kKeyLabel[] = "key";
110 
111 enum ExitStatus {
112  kSuccess = 0,
113  kArgumentValidationFailed,
114  kPackagingFailed,
115  kInternalError,
116 };
117 
118 bool GetWidevineSigner(WidevineSigner* signer) {
119  signer->signer_name = FLAGS_signer;
120  if (!FLAGS_aes_signing_key_bytes.empty()) {
121  signer->signing_key_type = WidevineSigner::SigningKeyType::kAes;
122  signer->aes.key = FLAGS_aes_signing_key_bytes;
123  signer->aes.iv = FLAGS_aes_signing_iv_bytes;
124  } else if (!FLAGS_rsa_signing_key_path.empty()) {
125  signer->signing_key_type = WidevineSigner::SigningKeyType::kRsa;
126  if (!File::ReadFileToString(FLAGS_rsa_signing_key_path.c_str(),
127  &signer->rsa.key)) {
128  LOG(ERROR) << "Failed to read from '" << FLAGS_rsa_signing_key_path
129  << "'.";
130  return false;
131  }
132  }
133  return true;
134 }
135 
136 bool GetHlsPlaylistType(const std::string& playlist_type,
137  HlsPlaylistType* playlist_type_enum) {
138  if (base::ToUpperASCII(playlist_type) == "VOD") {
139  *playlist_type_enum = HlsPlaylistType::kVod;
140  } else if (base::ToUpperASCII(playlist_type) == "LIVE") {
141  *playlist_type_enum = HlsPlaylistType::kLive;
142  } else if (base::ToUpperASCII(playlist_type) == "EVENT") {
143  *playlist_type_enum = HlsPlaylistType::kEvent;
144  } else {
145  LOG(ERROR) << "Unrecognized playlist type " << playlist_type;
146  return false;
147  }
148  return true;
149 }
150 
151 bool GetProtectionScheme(uint32_t* protection_scheme) {
152  if (FLAGS_protection_scheme == "cenc") {
153  *protection_scheme = EncryptionParams::kProtectionSchemeCenc;
154  return true;
155  }
156  if (FLAGS_protection_scheme == "cbc1") {
157  *protection_scheme = EncryptionParams::kProtectionSchemeCbc1;
158  return true;
159  }
160  if (FLAGS_protection_scheme == "cbcs") {
161  *protection_scheme = EncryptionParams::kProtectionSchemeCbcs;
162  return true;
163  }
164  if (FLAGS_protection_scheme == "cens") {
165  *protection_scheme = EncryptionParams::kProtectionSchemeCens;
166  return true;
167  }
168  LOG(ERROR) << "Unrecognized protection_scheme " << FLAGS_protection_scheme;
169  return false;
170 }
171 
172 bool ParseKeys(const std::string& keys, RawKeyParams* raw_key) {
173  for (const std::string& key_data : base::SplitString(
174  keys, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) {
175  base::StringPairs string_pairs;
176  base::SplitStringIntoKeyValuePairs(key_data, '=', ':', &string_pairs);
177 
178  std::map<std::string, std::string> value_map;
179  for (const auto& string_pair : string_pairs)
180  value_map[string_pair.first] = string_pair.second;
181  const std::string drm_label = value_map[kDrmLabelLabel];
182  if (raw_key->key_map.find(drm_label) != raw_key->key_map.end()) {
183  LOG(ERROR) << "Seeing duplicated DRM label '" << drm_label << "'.";
184  return false;
185  }
186  auto& key_info = raw_key->key_map[drm_label];
187  if (value_map[kKeyIdLabel].empty() ||
188  !base::HexStringToBytes(value_map[kKeyIdLabel], &key_info.key_id)) {
189  LOG(ERROR) << "Empty key id or invalid hex string for key id: "
190  << value_map[kKeyIdLabel];
191  return false;
192  }
193  if (value_map[kKeyLabel].empty() ||
194  !base::HexStringToBytes(value_map[kKeyLabel], &key_info.key)) {
195  LOG(ERROR) << "Empty key or invalid hex string for key: "
196  << value_map[kKeyLabel];
197  return false;
198  }
199  }
200  return true;
201 }
202 
203 bool GetRawKeyParams(RawKeyParams* raw_key) {
204  raw_key->iv = FLAGS_iv_bytes;
205  raw_key->pssh = FLAGS_pssh_bytes;
206  if (!FLAGS_keys.empty()) {
207  if (!ParseKeys(FLAGS_keys, raw_key)) {
208  LOG(ERROR) << "Failed to parse --keys " << FLAGS_keys;
209  return false;
210  }
211  } else {
212  // An empty StreamLabel specifies the default key info.
213  RawKeyParams::KeyInfo& key_info = raw_key->key_map[""];
214  key_info.key_id = FLAGS_key_id_bytes;
215  key_info.key = FLAGS_key_bytes;
216  }
217  return true;
218 }
219 
220 bool ParseAdCues(const std::string& ad_cues, std::vector<Cuepoint>* cuepoints) {
221  // Track if optional field is supplied consistently across all cue points.
222  size_t duration_count = 0;
223 
224  for (const std::string& ad_cue : base::SplitString(
225  ad_cues, ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) {
226  Cuepoint cuepoint;
227  auto split_ad_cue = base::SplitString(ad_cue, ",", base::TRIM_WHITESPACE,
228  base::SPLIT_WANT_NONEMPTY);
229  if (split_ad_cue.size() > 2) {
230  LOG(ERROR) << "Failed to parse --ad_cues " << ad_cues
231  << " Each ad cue must contain no more than 2 components.";
232  }
233  if (!base::StringToDouble(split_ad_cue.front(),
234  &cuepoint.start_time_in_seconds)) {
235  LOG(ERROR) << "Failed to parse --ad_cues " << ad_cues
236  << " Start time component must be of type double.";
237  return false;
238  }
239  if (split_ad_cue.size() > 1) {
240  duration_count++;
241  if (!base::StringToDouble(split_ad_cue[1],
242  &cuepoint.duration_in_seconds)) {
243  LOG(ERROR) << "Failed to parse --ad_cues " << ad_cues
244  << " Duration component must be of type double.";
245  return false;
246  }
247  }
248  cuepoints->push_back(cuepoint);
249  }
250 
251  if (duration_count > 0 && duration_count != cuepoints->size()) {
252  LOG(ERROR) << "Failed to parse --ad_cues " << ad_cues
253  << " Duration component is optional. However if it is supplied,"
254  << " it must be supplied consistently across all cuepoints.";
255  return false;
256  }
257  return true;
258 }
259 
260 base::Optional<PackagingParams> GetPackagingParams() {
261  PackagingParams packaging_params;
262 
263  packaging_params.temp_dir = FLAGS_temp_dir;
264 
265  AdCueGeneratorParams& ad_cue_generator_params =
266  packaging_params.ad_cue_generator_params;
267  if (!ParseAdCues(FLAGS_ad_cues, &ad_cue_generator_params.cue_points)) {
268  return base::nullopt;
269  }
270 
271  ChunkingParams& chunking_params = packaging_params.chunking_params;
272  chunking_params.segment_duration_in_seconds = FLAGS_segment_duration;
273  chunking_params.subsegment_duration_in_seconds = FLAGS_fragment_duration;
274  chunking_params.segment_sap_aligned = FLAGS_segment_sap_aligned;
275  chunking_params.subsegment_sap_aligned = FLAGS_fragment_sap_aligned;
276 
277  int num_key_providers = 0;
278  EncryptionParams& encryption_params = packaging_params.encryption_params;
279  encryption_params.generate_common_pssh = FLAGS_generate_common_pssh;
280  encryption_params.generate_playready_pssh = FLAGS_generate_playready_pssh;
281  encryption_params.generate_widevine_pssh = FLAGS_generate_widevine_pssh;
282  if (FLAGS_enable_widevine_encryption) {
283  encryption_params.key_provider = KeyProvider::kWidevine;
284  ++num_key_providers;
285  }
286  if (FLAGS_enable_playready_encryption) {
287  encryption_params.key_provider = KeyProvider::kPlayReady;
288  ++num_key_providers;
289  }
290  if (FLAGS_enable_raw_key_encryption) {
291  encryption_params.key_provider = KeyProvider::kRawKey;
292  ++num_key_providers;
293  }
294  if (num_key_providers > 1) {
295  LOG(ERROR) << "Only one of --enable_widevine_encryption, "
296  "--enable_playready_encryption, "
297  "--enable_raw_key_encryption can be enabled.";
298  return base::nullopt;
299  }
300 
301  if (encryption_params.key_provider != KeyProvider::kNone) {
302  encryption_params.clear_lead_in_seconds = FLAGS_clear_lead;
303  if (!GetProtectionScheme(&encryption_params.protection_scheme))
304  return base::nullopt;
305  encryption_params.crypto_period_duration_in_seconds =
306  FLAGS_crypto_period_duration;
307  encryption_params.vp9_subsample_encryption = FLAGS_vp9_subsample_encryption;
308  encryption_params.stream_label_func = std::bind(
309  &Packager::DefaultStreamLabelFunction, FLAGS_max_sd_pixels,
310  FLAGS_max_hd_pixels, FLAGS_max_uhd1_pixels, std::placeholders::_1);
311  }
312  switch (encryption_params.key_provider) {
313  case KeyProvider::kWidevine: {
314  WidevineEncryptionParams& widevine = encryption_params.widevine;
315  widevine.key_server_url = FLAGS_key_server_url;
316 
317  widevine.content_id = FLAGS_content_id_bytes;
318  widevine.policy = FLAGS_policy;
319  widevine.group_id = FLAGS_group_id_bytes;
320  widevine.enable_entitlement_license = FLAGS_enable_entitlement_license;
321  if (!GetWidevineSigner(&widevine.signer))
322  return base::nullopt;
323  break;
324  }
325  case KeyProvider::kPlayReady: {
326  PlayReadyEncryptionParams& playready = encryption_params.playready;
327  playready.key_server_url = FLAGS_playready_server_url;
328  playready.program_identifier = FLAGS_program_identifier;
329  playready.ca_file = FLAGS_ca_file;
330  playready.client_cert_file = FLAGS_client_cert_file;
331  playready.client_cert_private_key_file =
332  FLAGS_client_cert_private_key_file;
333  playready.client_cert_private_key_password =
334  FLAGS_client_cert_private_key_password;
335  break;
336  }
337  case KeyProvider::kRawKey: {
338  if (!GetRawKeyParams(&encryption_params.raw_key))
339  return base::nullopt;
340  break;
341  }
342  case KeyProvider::kNone:
343  break;
344  }
345 
346  num_key_providers = 0;
347  DecryptionParams& decryption_params = packaging_params.decryption_params;
348  if (FLAGS_enable_widevine_decryption) {
349  decryption_params.key_provider = KeyProvider::kWidevine;
350  ++num_key_providers;
351  }
352  if (FLAGS_enable_raw_key_decryption) {
353  decryption_params.key_provider = KeyProvider::kRawKey;
354  ++num_key_providers;
355  }
356  if (num_key_providers > 1) {
357  LOG(ERROR) << "Only one of --enable_widevine_decryption, "
358  "--enable_raw_key_decryption can be enabled.";
359  return base::nullopt;
360  }
361  switch (decryption_params.key_provider) {
362  case KeyProvider::kWidevine: {
363  WidevineDecryptionParams& widevine = decryption_params.widevine;
364  widevine.key_server_url = FLAGS_key_server_url;
365  if (!GetWidevineSigner(&widevine.signer))
366  return base::nullopt;
367  break;
368  }
369  case KeyProvider::kRawKey: {
370  if (!GetRawKeyParams(&decryption_params.raw_key))
371  return base::nullopt;
372  break;
373  }
374  case KeyProvider::kPlayReady:
375  case KeyProvider::kNone:
376  break;
377  }
378 
379  Mp4OutputParams& mp4_params = packaging_params.mp4_output_params;
380  mp4_params.num_subsegments_per_sidx = FLAGS_num_subsegments_per_sidx;
381  if (FLAGS_mp4_use_decoding_timestamp_in_timeline) {
382  LOG(WARNING) << "Flag --mp4_use_decoding_timestamp_in_timeline is set. "
383  "Note that it is a temporary hack to workaround Chromium "
384  "bug https://crbug.com/398130. The flag may be removed "
385  "when the Chromium bug is fixed.";
386  }
387  mp4_params.use_decoding_timestamp_in_timeline =
388  FLAGS_mp4_use_decoding_timestamp_in_timeline;
389  mp4_params.include_pssh_in_stream = FLAGS_mp4_include_pssh_in_stream;
390 
391  packaging_params.output_media_info = FLAGS_output_media_info;
392 
393  MpdParams& mpd_params = packaging_params.mpd_params;
394  mpd_params.mpd_output = FLAGS_mpd_output;
395  mpd_params.base_urls = base::SplitString(
396  FLAGS_base_urls, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
397  mpd_params.min_buffer_time = FLAGS_min_buffer_time;
398  mpd_params.minimum_update_period = FLAGS_minimum_update_period;
399  mpd_params.suggested_presentation_delay = FLAGS_suggested_presentation_delay;
400  mpd_params.time_shift_buffer_depth = FLAGS_time_shift_buffer_depth;
401  mpd_params.preserved_segments_outside_live_window =
402  FLAGS_preserved_segments_outside_live_window;
403 
404  if (!FLAGS_utc_timings.empty()) {
405  base::StringPairs pairs;
406  if (!base::SplitStringIntoKeyValuePairs(FLAGS_utc_timings, '=', ',',
407  &pairs)) {
408  LOG(ERROR) << "Invalid --utc_timings scheme_id_uri/value pairs.";
409  return base::nullopt;
410  }
411  for (const auto& string_pair : pairs) {
412  mpd_params.utc_timings.push_back({string_pair.first, string_pair.second});
413  }
414  }
415 
416  mpd_params.default_language = FLAGS_default_language;
417  mpd_params.generate_static_live_mpd = FLAGS_generate_static_mpd;
418  mpd_params.generate_dash_if_iop_compliant_mpd =
419  FLAGS_generate_dash_if_iop_compliant_mpd;
420  mpd_params.allow_approximate_segment_timeline =
421  FLAGS_allow_approximate_segment_timeline;
422 
423  HlsParams& hls_params = packaging_params.hls_params;
424  if (!GetHlsPlaylistType(FLAGS_hls_playlist_type, &hls_params.playlist_type)) {
425  return base::nullopt;
426  }
427  hls_params.master_playlist_output = FLAGS_hls_master_playlist_output;
428  hls_params.base_url = FLAGS_hls_base_url;
429  hls_params.key_uri = FLAGS_hls_key_uri;
430  hls_params.time_shift_buffer_depth = FLAGS_time_shift_buffer_depth;
431  hls_params.preserved_segments_outside_live_window =
432  FLAGS_preserved_segments_outside_live_window;
433  hls_params.default_language = FLAGS_default_language;
434 
435  TestParams& test_params = packaging_params.test_params;
436  test_params.dump_stream_info = FLAGS_dump_stream_info;
437  test_params.inject_fake_clock = FLAGS_use_fake_clock_for_muxer;
438  if (!FLAGS_test_packager_version.empty())
439  test_params.injected_library_version = FLAGS_test_packager_version;
440 
441  return packaging_params;
442 }
443 
444 int PackagerMain(int argc, char** argv) {
445  // Needed to enable VLOG/DVLOG through --vmodule or --v.
446  base::CommandLine::Init(argc, argv);
447 
448  // Set up logging.
449  logging::LoggingSettings log_settings;
450  log_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
451  CHECK(logging::InitLogging(log_settings));
452 
453  google::SetVersionString(shaka::Packager::GetLibraryVersion());
454  google::SetUsageMessage(base::StringPrintf(kUsage, argv[0]));
455  google::ParseCommandLineFlags(&argc, &argv, true);
456  if (FLAGS_licenses) {
457  for (const char* line : kLicenseNotice)
458  std::cout << line << std::endl;
459  return kSuccess;
460  }
461  if (argc < 2) {
462  google::ShowUsageWithFlags("Usage");
463  return kSuccess;
464  }
465 
468  return kArgumentValidationFailed;
469  }
470 
471  base::Optional<PackagingParams> packaging_params = GetPackagingParams();
472  if (!packaging_params)
473  return kArgumentValidationFailed;
474 
475  std::vector<StreamDescriptor> stream_descriptors;
476  for (int i = 1; i < argc; ++i) {
477  base::Optional<StreamDescriptor> stream_descriptor =
478  ParseStreamDescriptor(argv[i]);
479  if (!stream_descriptor)
480  return kArgumentValidationFailed;
481  stream_descriptors.push_back(stream_descriptor.value());
482  }
483  Packager packager;
484  Status status =
485  packager.Initialize(packaging_params.value(), stream_descriptors);
486  if (!status.ok()) {
487  LOG(ERROR) << "Failed to initialize packager: " << status.ToString();
488  return kArgumentValidationFailed;
489  }
490  status = packager.Run();
491  if (!status.ok()) {
492  LOG(ERROR) << "Packaging Error: " << status.ToString();
493  return kPackagingFailed;
494  }
495  printf("Packaging completed successfully.\n");
496  return kSuccess;
497 }
498 
499 } // namespace
500 } // namespace shaka
501 
502 #if defined(OS_WIN)
503 // Windows wmain, which converts wide character arguments to UTF-8.
504 int wmain(int argc, wchar_t* argv[], wchar_t* envp[]) {
505  std::unique_ptr<char* [], std::function<void(char**)>> utf8_argv(
506  new char*[argc], [argc](char** utf8_args) {
507  // TODO(tinskip): This leaks, but if this code is enabled, it crashes.
508  // Figure out why. I suspect gflags does something funny with the
509  // argument array.
510  // for (int idx = 0; idx < argc; ++idx)
511  // delete[] utf8_args[idx];
512  delete[] utf8_args;
513  });
514  std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
515  for (int idx = 0; idx < argc; ++idx) {
516  std::string utf8_arg(converter.to_bytes(argv[idx]));
517  utf8_arg += '\0';
518  utf8_argv[idx] = new char[utf8_arg.size()];
519  memcpy(utf8_argv[idx], &utf8_arg[0], utf8_arg.size());
520  }
521  return shaka::PackagerMain(argc, utf8_argv.get());
522 }
523 #else
524 int main(int argc, char** argv) {
525  return shaka::PackagerMain(argc, argv);
526 }
527 #endif // defined(OS_WIN)
static std::string DefaultStreamLabelFunction(int max_sd_pixels, int max_hd_pixels, int max_uhd1_pixels, const EncryptionParams::EncryptedStreamAttributes &stream_attributes)
Definition: packager.cc:963
HlsPlaylistType
Definition: hls_params.h:16
base::Optional< StreamDescriptor > ParseStreamDescriptor(const std::string &descriptor_string)
static bool ReadFileToString(const char *file_name, std::string *contents)
Definition: file.cc:216
bool ValidateRawKeyCryptoFlags()
bool ValidateWidevineCryptoFlags()
All the methods that are virtual are virtual for mocking.
-
static std::string GetLibraryVersion()
Definition: packager.cc:989
+
static std::string GetLibraryVersion()
Definition: packager.cc:959
static constexpr uint32_t kProtectionSchemeCenc
The protection scheme: "cenc", "cens", "cbc1", "cbcs".
diff --git a/docs/d2/de7/classshaka_1_1media_1_1TextStreamInfo-members.html b/docs/d2/de7/classshaka_1_1media_1_1TextStreamInfo-members.html index aa588e017d..bcf0d9cb58 100644 --- a/docs/d2/de7/classshaka_1_1media_1_1TextStreamInfo-members.html +++ b/docs/d2/de7/classshaka_1_1media_1_1TextStreamInfo-members.html @@ -101,7 +101,7 @@ $(function() {
diff --git a/docs/d2/de7/structshaka_1_1media_1_1mp4_1_1Edit-members.html b/docs/d2/de7/structshaka_1_1media_1_1mp4_1_1Edit-members.html index 176bfbad56..e9e34c1151 100644 --- a/docs/d2/de7/structshaka_1_1media_1_1mp4_1_1Edit-members.html +++ b/docs/d2/de7/structshaka_1_1media_1_1mp4_1_1Edit-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/d2/de9/media__handler_8cc_source.html b/docs/d2/de9/media__handler_8cc_source.html index 3e075ce590..2148f4a8dc 100644 --- a/docs/d2/de9/media__handler_8cc_source.html +++ b/docs/d2/de9/media__handler_8cc_source.html @@ -66,20 +66,20 @@ $(function() {
media_handler.cc
-
1 // Copyright 2017 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include "packager/media/base/media_handler.h"
8 
9 namespace shaka {
10 namespace media {
11 
12 Status MediaHandler::SetHandler(size_t output_stream_index,
13  std::shared_ptr<MediaHandler> handler) {
14  if (output_handlers_.find(output_stream_index) != output_handlers_.end()) {
15  return Status(error::ALREADY_EXISTS,
16  "The handler at the specified index already exists.");
17  }
18  output_handlers_[output_stream_index] =
19  std::make_pair(handler, handler->num_input_streams_++);
20  next_output_stream_index_ = output_stream_index + 1;
21  return Status::OK;
22 }
23 
25  if (initialized_)
26  return Status::OK;
27  Status status = InitializeInternal();
28  if (!status.ok())
29  return status;
30  for (auto& pair : output_handlers_) {
31  if (!ValidateOutputStreamIndex(pair.first))
32  return Status(error::INVALID_ARGUMENT, "Invalid output stream index");
33  status = pair.second.first->Initialize();
34  if (!status.ok())
35  return status;
36  }
37  initialized_ = true;
38  return Status::OK;
39 }
40 
41 Status MediaHandler::OnFlushRequest(size_t input_stream_index) {
42  // The default implementation treats the output stream index to be identical
43  // to the input stream index, which is true for most handlers.
44  const size_t output_stream_index = input_stream_index;
45  return FlushDownstream(output_stream_index);
46 }
47 
48 bool MediaHandler::ValidateOutputStreamIndex(size_t stream_index) const {
49  return stream_index < num_input_streams_;
50 }
51 
52 Status MediaHandler::Dispatch(std::unique_ptr<StreamData> stream_data) const {
53  size_t output_stream_index = stream_data->stream_index;
54  auto handler_it = output_handlers_.find(output_stream_index);
55  if (handler_it == output_handlers_.end()) {
56  return Status(error::NOT_FOUND,
57  "No output handler exist at the specified index.");
58  }
59  stream_data->stream_index = handler_it->second.second;
60  return handler_it->second.first->Process(std::move(stream_data));
61 }
62 
63 Status MediaHandler::FlushDownstream(size_t output_stream_index) {
64  auto handler_it = output_handlers_.find(output_stream_index);
65  if (handler_it == output_handlers_.end()) {
66  return Status(error::NOT_FOUND,
67  "No output handler exist at the specified index.");
68  }
69  return handler_it->second.first->OnFlushRequest(handler_it->second.second);
70 }
71 
73  for (const auto& pair : output_handlers_) {
74  Status status = pair.second.first->OnFlushRequest(pair.second.second);
75  if (!status.ok()) {
76  return status;
77  }
78  }
79  return Status::OK;
80 }
81 
82 } // namespace media
83 } // namespace shaka
virtual bool ValidateOutputStreamIndex(size_t stream_index) const
Validate if the stream at the specified index actually exists.
-
Status Dispatch(std::unique_ptr< StreamData > stream_data) const
+
1 // Copyright 2017 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include "packager/media/base/media_handler.h"
8 
9 namespace shaka {
10 namespace media {
11 
12 std::string StreamDataTypeToString(StreamDataType type) {
13  switch (type) {
14  case StreamDataType::kStreamInfo:
15  return "stream info";
16  case StreamDataType::kMediaSample:
17  return "media sample";
18  case StreamDataType::kTextSample:
19  return "text sample";
20  case StreamDataType::kSegmentInfo:
21  return "segment info";
22  case StreamDataType::kScte35Event:
23  return "scte35 event";
24  case StreamDataType::kCueEvent:
25  return "cue event";
26  case StreamDataType::kUnknown:
27  return "unknown";
28  }
29  return "unknown";
30 }
31 
32 Status MediaHandler::SetHandler(size_t output_stream_index,
33  std::shared_ptr<MediaHandler> handler) {
34  if (output_handlers_.find(output_stream_index) != output_handlers_.end()) {
35  return Status(error::ALREADY_EXISTS,
36  "The handler at the specified index already exists.");
37  }
38  output_handlers_[output_stream_index] =
39  std::make_pair(handler, handler->num_input_streams_++);
40  next_output_stream_index_ = output_stream_index + 1;
41  return Status::OK;
42 }
43 
45  if (initialized_)
46  return Status::OK;
47  Status status = InitializeInternal();
48  if (!status.ok())
49  return status;
50  for (auto& pair : output_handlers_) {
51  if (!ValidateOutputStreamIndex(pair.first))
52  return Status(error::INVALID_ARGUMENT, "Invalid output stream index");
53  status = pair.second.first->Initialize();
54  if (!status.ok())
55  return status;
56  }
57  initialized_ = true;
58  return Status::OK;
59 }
60 
61 Status MediaHandler::OnFlushRequest(size_t input_stream_index) {
62  // The default implementation treats the output stream index to be identical
63  // to the input stream index, which is true for most handlers.
64  const size_t output_stream_index = input_stream_index;
65  return FlushDownstream(output_stream_index);
66 }
67 
68 bool MediaHandler::ValidateOutputStreamIndex(size_t stream_index) const {
69  return stream_index < num_input_streams_;
70 }
71 
72 Status MediaHandler::Dispatch(std::unique_ptr<StreamData> stream_data) const {
73  size_t output_stream_index = stream_data->stream_index;
74  auto handler_it = output_handlers_.find(output_stream_index);
75  if (handler_it == output_handlers_.end()) {
76  return Status(error::NOT_FOUND,
77  "No output handler exist at the specified index.");
78  }
79  stream_data->stream_index = handler_it->second.second;
80  return handler_it->second.first->Process(std::move(stream_data));
81 }
82 
83 Status MediaHandler::FlushDownstream(size_t output_stream_index) {
84  auto handler_it = output_handlers_.find(output_stream_index);
85  if (handler_it == output_handlers_.end()) {
86  return Status(error::NOT_FOUND,
87  "No output handler exist at the specified index.");
88  }
89  return handler_it->second.first->OnFlushRequest(handler_it->second.second);
90 }
91 
93  for (const auto& pair : output_handlers_) {
94  Status status = pair.second.first->OnFlushRequest(pair.second.second);
95  if (!status.ok()) {
96  return status;
97  }
98  }
99  return Status::OK;
100 }
101 
102 } // namespace media
103 } // namespace shaka
virtual bool ValidateOutputStreamIndex(size_t stream_index) const
Validate if the stream at the specified index actually exists.
+
Status Dispatch(std::unique_ptr< StreamData > stream_data) const
virtual Status InitializeInternal()=0
-
virtual Status OnFlushRequest(size_t input_stream_index)
Event handler for flush request at the specific input stream index.
+
virtual Status OnFlushRequest(size_t input_stream_index)
Event handler for flush request at the specific input stream index.
All the methods that are virtual are virtual for mocking.
-
Status FlushAllDownstreams()
Flush all connected downstream handlers.
-
Status FlushDownstream(size_t output_stream_index)
Flush the downstream connected at the specified output stream index.
-
Status SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)
Connect downstream handler at the specified output stream index.
- +
Status FlushAllDownstreams()
Flush all connected downstream handlers.
+
Status FlushDownstream(size_t output_stream_index)
Flush the downstream connected at the specified output stream index.
+
Status SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)
Connect downstream handler at the specified output stream index.
+
diff --git a/docs/d2/de9/mock__muxer__listener_8h_source.html b/docs/d2/de9/mock__muxer__listener_8h_source.html index f2b7acc2bc..51a267e04d 100644 --- a/docs/d2/de9/mock__muxer__listener_8h_source.html +++ b/docs/d2/de9/mock__muxer__listener_8h_source.html @@ -83,7 +83,7 @@ $(function() {
diff --git a/docs/d2/deb/es__parser_8h_source.html b/docs/d2/deb/es__parser_8h_source.html index b9eeff2175..9527c8ed60 100644 --- a/docs/d2/deb/es__parser_8h_source.html +++ b/docs/d2/deb/es__parser_8h_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d2/dee/classshaka_1_1media_1_1mp2t_1_1TsSectionPes-members.html b/docs/d2/dee/classshaka_1_1media_1_1mp2t_1_1TsSectionPes-members.html index c7a89da275..371bc6b7dc 100644 --- a/docs/d2/dee/classshaka_1_1media_1_1mp2t_1_1TsSectionPes-members.html +++ b/docs/d2/dee/classshaka_1_1media_1_1mp2t_1_1TsSectionPes-members.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/d2/dee/pes__packet__generator_8cc_source.html b/docs/d2/dee/pes__packet__generator_8cc_source.html index b2c3e3b538..bcb0fbe6c8 100644 --- a/docs/d2/dee/pes__packet__generator_8cc_source.html +++ b/docs/d2/dee/pes__packet__generator_8cc_source.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/d2/df8/classshaka_1_1media_1_1SegmentTestBase_1_1ClusterParser.html b/docs/d2/df8/classshaka_1_1media_1_1SegmentTestBase_1_1ClusterParser.html index b5cd28ff53..db0b3972b8 100644 --- a/docs/d2/df8/classshaka_1_1media_1_1SegmentTestBase_1_1ClusterParser.html +++ b/docs/d2/df8/classshaka_1_1media_1_1SegmentTestBase_1_1ClusterParser.html @@ -107,7 +107,7 @@ size_t cluster_count ( diff --git a/docs/d2/dfc/classshaka_1_1media_1_1MkvWriter-members.html b/docs/d2/dfc/classshaka_1_1media_1_1MkvWriter-members.html index fbe73fc9f6..de1d6a761a 100644 --- a/docs/d2/dfc/classshaka_1_1media_1_1MkvWriter-members.html +++ b/docs/d2/dfc/classshaka_1_1media_1_1MkvWriter-members.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/d2/dfd/adts__header_8h_source.html b/docs/d2/dfd/adts__header_8h_source.html index 1b3519d1b1..b4c22eb314 100644 --- a/docs/d2/dfd/adts__header_8h_source.html +++ b/docs/d2/dfd/adts__header_8h_source.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/d3/d03/structshaka_1_1media_1_1OnNewSegmentParameters-members.html b/docs/d3/d03/structshaka_1_1media_1_1OnNewSegmentParameters-members.html index 5d128ea4fd..d90e2fdf9c 100644 --- a/docs/d3/d03/structshaka_1_1media_1_1OnNewSegmentParameters-members.html +++ b/docs/d3/d03/structshaka_1_1media_1_1OnNewSegmentParameters-members.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/d3/d07/classshaka_1_1media_1_1mp4_1_1BoxReader-members.html b/docs/d3/d07/classshaka_1_1media_1_1mp4_1_1BoxReader-members.html index c0c160e878..c98691136a 100644 --- a/docs/d3/d07/classshaka_1_1media_1_1mp4_1_1BoxReader-members.html +++ b/docs/d3/d07/classshaka_1_1media_1_1mp4_1_1BoxReader-members.html @@ -103,7 +103,7 @@ $(function() { diff --git a/docs/d3/d07/mpd__params_8h_source.html b/docs/d3/d07/mpd__params_8h_source.html index be5a6ec578..4de66b72fa 100644 --- a/docs/d3/d07/mpd__params_8h_source.html +++ b/docs/d3/d07/mpd__params_8h_source.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/d3/d09/classshaka_1_1media_1_1mp4_1_1SyncSampleIterator-members.html b/docs/d3/d09/classshaka_1_1media_1_1mp4_1_1SyncSampleIterator-members.html index aa4f0ff7e7..9f58510c19 100644 --- a/docs/d3/d09/classshaka_1_1media_1_1mp4_1_1SyncSampleIterator-members.html +++ b/docs/d3/d09/classshaka_1_1media_1_1mp4_1_1SyncSampleIterator-members.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d3/d0a/classshaka_1_1media_1_1MediaParser.html b/docs/d3/d0a/classshaka_1_1media_1_1MediaParser.html index e2985178bc..8bb9dcfcde 100644 --- a/docs/d3/d0a/classshaka_1_1media_1_1MediaParser.html +++ b/docs/d3/d0a/classshaka_1_1media_1_1MediaParser.html @@ -274,7 +274,7 @@ Public Member Functions diff --git a/docs/d3/d0c/classshaka_1_1media_1_1mp2t_1_1AdtsHeader.html b/docs/d3/d0c/classshaka_1_1media_1_1mp2t_1_1AdtsHeader.html index 75c03c081b..277ac5082d 100644 --- a/docs/d3/d0c/classshaka_1_1media_1_1mp2t_1_1AdtsHeader.html +++ b/docs/d3/d0c/classshaka_1_1media_1_1mp2t_1_1AdtsHeader.html @@ -448,7 +448,7 @@ Public Member Functions diff --git a/docs/d3/d12/classshaka_1_1media_1_1LibcryptoThreading-members.html b/docs/d3/d12/classshaka_1_1media_1_1LibcryptoThreading-members.html index 31ce7a1daa..0deaf151d8 100644 --- a/docs/d3/d12/classshaka_1_1media_1_1LibcryptoThreading-members.html +++ b/docs/d3/d12/classshaka_1_1media_1_1LibcryptoThreading-members.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d3/d12/structshaka_1_1media_1_1mp4_1_1FlacSpecific-members.html b/docs/d3/d12/structshaka_1_1media_1_1mp4_1_1FlacSpecific-members.html index 7025d670ff..3072514e32 100644 --- a/docs/d3/d12/structshaka_1_1media_1_1mp4_1_1FlacSpecific-members.html +++ b/docs/d3/d12/structshaka_1_1media_1_1mp4_1_1FlacSpecific-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/d3/d18/classshaka_1_1media_1_1mp2t_1_1TsSectionPat-members.html b/docs/d3/d18/classshaka_1_1media_1_1mp2t_1_1TsSectionPat-members.html index 4f41515431..1bd42ed385 100644 --- a/docs/d3/d18/classshaka_1_1media_1_1mp2t_1_1TsSectionPat-members.html +++ b/docs/d3/d18/classshaka_1_1media_1_1mp2t_1_1TsSectionPat-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/d3/d19/io__cache_8h_source.html b/docs/d3/d19/io__cache_8h_source.html index d9aa1455ed..1ac7a9fb00 100644 --- a/docs/d3/d19/io__cache_8h_source.html +++ b/docs/d3/d19/io__cache_8h_source.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/d3/d1a/classshaka_1_1media_1_1Replicator.html b/docs/d3/d1a/classshaka_1_1media_1_1Replicator.html index cb56c57773..05a007a324 100644 --- a/docs/d3/d1a/classshaka_1_1media_1_1Replicator.html +++ b/docs/d3/d1a/classshaka_1_1media_1_1Replicator.html @@ -156,7 +156,7 @@ const std::map< size_t, std::pair< std::shared_ptr< diff --git a/docs/d3/d1e/classshaka_1_1media_1_1FakeInputMediaHandler.html b/docs/d3/d1e/classshaka_1_1media_1_1FakeInputMediaHandler.html index 2e31602273..119f29e1df 100644 --- a/docs/d3/d1e/classshaka_1_1media_1_1FakeInputMediaHandler.html +++ b/docs/d3/d1e/classshaka_1_1media_1_1FakeInputMediaHandler.html @@ -149,7 +149,7 @@ const std::map< size_t, std::pair< std::shared_ptr<

Detailed Description

-

Definition at line 154 of file media_handler_test_base.h.

+

Definition at line 153 of file media_handler_test_base.h.


The documentation for this class was generated from the following files:
  • packager/media/base/media_handler_test_base.h
  • packager/media/base/media_handler_test_base.cc
  • @@ -157,7 +157,7 @@ const std::map< size_t, std::pair< std::shared_ptr< diff --git a/docs/d3/d35/video__slice__header__parser_8cc_source.html b/docs/d3/d35/video__slice__header__parser_8cc_source.html index 2af1201b19..2c0a2a6005 100644 --- a/docs/d3/d35/video__slice__header__parser_8cc_source.html +++ b/docs/d3/d35/video__slice__header__parser_8cc_source.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/d3/d48/packager_8cc_source.html b/docs/d3/d48/packager_8cc_source.html index 6dfcbbc591..03cfd5aabf 100644 --- a/docs/d3/d48/packager_8cc_source.html +++ b/docs/d3/d48/packager_8cc_source.html @@ -66,16 +66,16 @@ $(function() {
    packager.cc
    -
    1 // Copyright 2017 Google Inc. All rights reserved.
    2 //
    3 // Use of this source code is governed by a BSD-style
    4 // license that can be found in the LICENSE file or at
    5 // https://developers.google.com/open-source/licenses/bsd
    6 
    7 #include "packager/packager.h"
    8 
    9 #include <algorithm>
    10 
    11 #include "packager/app/job_manager.h"
    12 #include "packager/app/libcrypto_threading.h"
    13 #include "packager/app/muxer_factory.h"
    14 #include "packager/app/packager_util.h"
    15 #include "packager/app/stream_descriptor.h"
    16 #include "packager/base/at_exit.h"
    17 #include "packager/base/files/file_path.h"
    18 #include "packager/base/logging.h"
    19 #include "packager/base/optional.h"
    20 #include "packager/base/path_service.h"
    21 #include "packager/base/strings/string_util.h"
    22 #include "packager/base/strings/stringprintf.h"
    23 #include "packager/base/threading/simple_thread.h"
    24 #include "packager/base/time/clock.h"
    25 #include "packager/file/file.h"
    26 #include "packager/hls/base/hls_notifier.h"
    27 #include "packager/hls/base/simple_hls_notifier.h"
    28 #include "packager/media/ad_cue_generator/ad_cue_generator.h"
    29 #include "packager/media/base/container_names.h"
    30 #include "packager/media/base/fourccs.h"
    31 #include "packager/media/base/key_source.h"
    32 #include "packager/media/base/language_utils.h"
    33 #include "packager/media/base/muxer.h"
    34 #include "packager/media/base/muxer_options.h"
    35 #include "packager/media/base/muxer_util.h"
    36 #include "packager/media/chunking/chunking_handler.h"
    37 #include "packager/media/chunking/cue_alignment_handler.h"
    38 #include "packager/media/chunking/text_chunker.h"
    39 #include "packager/media/crypto/encryption_handler.h"
    40 #include "packager/media/demuxer/demuxer.h"
    41 #include "packager/media/event/muxer_listener_factory.h"
    42 #include "packager/media/event/vod_media_info_dump_muxer_listener.h"
    43 #include "packager/media/formats/webvtt/text_padder.h"
    44 #include "packager/media/formats/webvtt/text_readers.h"
    45 #include "packager/media/formats/webvtt/webvtt_output_handler.h"
    46 #include "packager/media/formats/webvtt/webvtt_parser.h"
    47 #include "packager/media/formats/webvtt/webvtt_to_mp4_handler.h"
    48 #include "packager/media/replicator/replicator.h"
    49 #include "packager/media/trick_play/trick_play_handler.h"
    50 #include "packager/mpd/base/media_info.pb.h"
    51 #include "packager/mpd/base/mpd_builder.h"
    52 #include "packager/mpd/base/simple_mpd_notifier.h"
    53 #include "packager/status_macros.h"
    54 #include "packager/version/version.h"
    55 
    56 namespace shaka {
    57 
    58 // TODO(kqyang): Clean up namespaces.
    59 using media::Demuxer;
    60 using media::JobManager;
    61 using media::KeySource;
    62 using media::MuxerOptions;
    63 using media::SyncPointQueue;
    64 
    65 namespace media {
    66 namespace {
    67 
    68 const char kMediaInfoSuffix[] = ".media_info";
    69 
    70 Status ChainHandlers(
    71  std::initializer_list<std::shared_ptr<MediaHandler>> list) {
    72  std::shared_ptr<MediaHandler> previous;
    73 
    74  for (auto& next : list) {
    75  // Skip null entries.
    76  if (!next) {
    77  continue;
    78  }
    79 
    80  if (previous) {
    81  RETURN_IF_ERROR(previous->AddHandler(next));
    82  }
    83 
    84  previous = std::move(next);
    85  }
    86 
    87  return Status::OK;
    88 }
    89 
    90 MuxerOptions CreateMuxerOptions(const StreamDescriptor& stream,
    91  const PackagingParams& params) {
    92  MuxerOptions options;
    93 
    94  options.mp4_params = params.mp4_output_params;
    95  options.temp_dir = params.temp_dir;
    96  options.bandwidth = stream.bandwidth;
    97  options.output_file_name = stream.output;
    98  options.segment_template = stream.segment_template;
    99 
    100  return options;
    101 }
    102 
    103 MuxerListenerFactory::StreamData ToMuxerListenerData(
    104  const StreamDescriptor& stream) {
    105  MuxerListenerFactory::StreamData data;
    106  data.media_info_output = stream.output;
    107  data.hls_group_id = stream.hls_group_id;
    108  data.hls_name = stream.hls_name;
    109  data.hls_playlist_name = stream.hls_playlist_name;
    110  data.hls_iframe_playlist_name = stream.hls_iframe_playlist_name;
    111  return data;
    112 };
    113 
    114 // TODO(rkuroiwa): Write TTML and WebVTT parser (demuxing) for a better check
    115 // and for supporting live/segmenting (muxing). With a demuxer and a muxer,
    116 // CreateAllJobs() shouldn't treat text as a special case.
    117 bool DetermineTextFileCodec(const std::string& file, std::string* out) {
    118  CHECK(out);
    119 
    120  std::string content;
    121  if (!File::ReadFileToString(file.c_str(), &content)) {
    122  LOG(ERROR) << "Failed to open file " << file
    123  << " to determine file format.";
    124  return false;
    125  }
    126 
    127  const uint8_t* content_data =
    128  reinterpret_cast<const uint8_t*>(content.data());
    129  MediaContainerName container_name =
    130  DetermineContainer(content_data, content.size());
    131 
    132  if (container_name == CONTAINER_WEBVTT) {
    133  *out = "wvtt";
    134  return true;
    135  }
    136 
    137  if (container_name == CONTAINER_TTML) {
    138  *out = "ttml";
    139  return true;
    140  }
    141 
    142  return false;
    143 }
    144 
    145 MediaContainerName GetOutputFormat(const StreamDescriptor& descriptor) {
    146  if (!descriptor.output_format.empty()) {
    147  MediaContainerName format =
    148  DetermineContainerFromFormatName(descriptor.output_format);
    149  if (format == CONTAINER_UNKNOWN) {
    150  LOG(ERROR) << "Unable to determine output format from '"
    151  << descriptor.output_format << "'.";
    152  }
    153  return format;
    154  }
    155 
    156  base::Optional<MediaContainerName> format_from_output;
    157  base::Optional<MediaContainerName> format_from_segment;
    158  if (!descriptor.output.empty()) {
    159  format_from_output = DetermineContainerFromFileName(descriptor.output);
    160  if (format_from_output.value() == CONTAINER_UNKNOWN) {
    161  LOG(ERROR) << "Unable to determine output format from '"
    162  << descriptor.output << "'.";
    163  }
    164  }
    165  if (!descriptor.segment_template.empty()) {
    166  format_from_segment =
    167  DetermineContainerFromFileName(descriptor.segment_template);
    168  if (format_from_segment.value() == CONTAINER_UNKNOWN) {
    169  LOG(ERROR) << "Unable to determine output format from '"
    170  << descriptor.segment_template << "'.";
    171  }
    172  }
    173 
    174  if (format_from_output && format_from_segment) {
    175  if (format_from_output.value() != format_from_segment.value()) {
    176  LOG(ERROR) << "Output format determined from '" << descriptor.output
    177  << "' differs from output format determined from '"
    178  << descriptor.segment_template << "'.";
    179  return CONTAINER_UNKNOWN;
    180  }
    181  }
    182 
    183  if (format_from_output)
    184  return format_from_output.value();
    185  if (format_from_segment)
    186  return format_from_segment.value();
    187  return CONTAINER_UNKNOWN;
    188 }
    189 
    190 Status ValidateStreamDescriptor(bool dump_stream_info,
    191  const StreamDescriptor& stream) {
    192  if (stream.input.empty()) {
    193  return Status(error::INVALID_ARGUMENT, "Stream input not specified.");
    194  }
    195 
    196  // The only time a stream can have no outputs, is when dump stream info is
    197  // set.
    198  if (dump_stream_info && stream.output.empty() &&
    199  stream.segment_template.empty()) {
    200  return Status::OK;
    201  }
    202 
    203  if (stream.output.empty() && stream.segment_template.empty()) {
    204  return Status(error::INVALID_ARGUMENT,
    205  "Streams must specify 'output' or 'segment template'.");
    206  }
    207 
    208  // Whenever there is output, a stream must be selected.
    209  if (stream.stream_selector.empty()) {
    210  return Status(error::INVALID_ARGUMENT,
    211  "Stream stream_selector not specified.");
    212  }
    213 
    214  // If a segment template is provided, it must be valid.
    215  if (stream.segment_template.length()) {
    216  Status template_check = ValidateSegmentTemplate(stream.segment_template);
    217  if (!template_check.ok()) {
    218  return template_check;
    219  }
    220  }
    221 
    222  // There are some specifics that must be checked based on which format
    223  // we are writing to.
    224  const MediaContainerName output_format = GetOutputFormat(stream);
    225 
    226  if (output_format == CONTAINER_UNKNOWN) {
    227  return Status(error::INVALID_ARGUMENT, "Unsupported output format.");
    228  } else if (output_format == MediaContainerName::CONTAINER_MPEG2TS) {
    229  if (stream.segment_template.empty()) {
    230  return Status(
    231  error::INVALID_ARGUMENT,
    232  "Please specify 'segment_template'. Single file TS output is "
    233  "not supported.");
    234  }
    235 
    236  // Right now the init segment is saved in |output| for multi-segment
    237  // content. However, for TS all segments must be self-initializing so
    238  // there cannot be an init segment.
    239  if (stream.output.length()) {
    240  return Status(error::INVALID_ARGUMENT,
    241  "All TS segments must be self-initializing. Stream "
    242  "descriptors 'output' or 'init_segment' are not allowed.");
    243  }
    244  } else if (output_format == CONTAINER_WEBVTT ||
    245  output_format == CONTAINER_AAC || output_format == CONTAINER_AC3 ||
    246  output_format == CONTAINER_EAC3) {
    247  // There is no need for an init segment when outputting because there is no
    248  // initialization data.
    249  if (stream.segment_template.length() && stream.output.length()) {
    250  return Status(
    251  error::INVALID_ARGUMENT,
    252  "Segmented WebVTT or PackedAudio output cannot have an init segment. "
    253  "Do not specify stream descriptors 'output' or 'init_segment' when "
    254  "using 'segment_template'.");
    255  }
    256  } else {
    257  // For any other format, if there is a segment template, there must be an
    258  // init segment provided.
    259  if (stream.segment_template.length() && stream.output.empty()) {
    260  return Status(error::INVALID_ARGUMENT,
    261  "Please specify 'init_segment'. All non-TS multi-segment "
    262  "content must provide an init segment.");
    263  }
    264  }
    265 
    266  return Status::OK;
    267 }
    268 
    269 Status ValidateParams(const PackagingParams& packaging_params,
    270  const std::vector<StreamDescriptor>& stream_descriptors) {
    271  if (!packaging_params.chunking_params.segment_sap_aligned &&
    272  packaging_params.chunking_params.subsegment_sap_aligned) {
    273  return Status(error::INVALID_ARGUMENT,
    274  "Setting segment_sap_aligned to false but "
    275  "subsegment_sap_aligned to true is not allowed.");
    276  }
    277 
    278  if (stream_descriptors.empty()) {
    279  return Status(error::INVALID_ARGUMENT,
    280  "Stream descriptors cannot be empty.");
    281  }
    282 
    283  // On demand profile generates single file segment while live profile
    284  // generates multiple segments specified using segment template.
    285  const bool on_demand_dash_profile =
    286  stream_descriptors.begin()->segment_template.empty();
    287  for (const auto& descriptor : stream_descriptors) {
    288  if (on_demand_dash_profile != descriptor.segment_template.empty()) {
    289  return Status(error::INVALID_ARGUMENT,
    290  "Inconsistent stream descriptor specification: "
    291  "segment_template should be specified for none or all "
    292  "stream descriptors.");
    293  }
    294 
    295  Status stream_check = ValidateStreamDescriptor(
    296  packaging_params.test_params.dump_stream_info, descriptor);
    297 
    298  if (!stream_check.ok()) {
    299  return stream_check;
    300  }
    301  }
    302 
    303  if (packaging_params.output_media_info && !on_demand_dash_profile) {
    304  // TODO(rkuroiwa, kqyang): Support partial media info dump for live.
    305  return Status(error::UNIMPLEMENTED,
    306  "--output_media_info is only supported for on-demand profile "
    307  "(not using segment_template).");
    308  }
    309 
    310  return Status::OK;
    311 }
    312 
    313 bool StreamDescriptorCompareFn(const StreamDescriptor& a,
    314  const StreamDescriptor& b) {
    315  if (a.input == b.input) {
    316  if (a.stream_selector == b.stream_selector) {
    317  // The MPD notifier requires that the main track comes first, so make
    318  // sure that happens.
    319  if (a.trick_play_factor == 0 || b.trick_play_factor == 0) {
    320  return a.trick_play_factor == 0;
    321  } else {
    322  return a.trick_play_factor > b.trick_play_factor;
    323  }
    324  } else {
    325  return a.stream_selector < b.stream_selector;
    326  }
    327  }
    328 
    329  return a.input < b.input;
    330 }
    331 
    332 // A fake clock that always return time 0 (epoch). Should only be used for
    333 // testing.
    334 class FakeClock : public base::Clock {
    335  public:
    336  base::Time Now() override { return base::Time(); }
    337 };
    338 
    339 bool StreamInfoToTextMediaInfo(const StreamDescriptor& stream_descriptor,
    340  MediaInfo* text_media_info) {
    341  std::string codec;
    342  if (!DetermineTextFileCodec(stream_descriptor.input, &codec)) {
    343  LOG(ERROR) << "Failed to determine the text file format for "
    344  << stream_descriptor.input;
    345  return false;
    346  }
    347 
    348  MediaInfo::TextInfo* text_info = text_media_info->mutable_text_info();
    349  text_info->set_codec(codec);
    350 
    351  const std::string& language = stream_descriptor.language;
    352  if (!language.empty()) {
    353  text_info->set_language(language);
    354  }
    355 
    356  text_media_info->set_media_file_name(stream_descriptor.output);
    357  text_media_info->set_container_type(MediaInfo::CONTAINER_TEXT);
    358 
    359  if (stream_descriptor.bandwidth != 0) {
    360  text_media_info->set_bandwidth(stream_descriptor.bandwidth);
    361  } else {
    362  // Text files are usually small and since the input is one file; there's no
    363  // way for the player to do ranged requests. So set this value to something
    364  // reasonable.
    365  const int kDefaultTextBandwidth = 256;
    366  text_media_info->set_bandwidth(kDefaultTextBandwidth);
    367  }
    368 
    369  return true;
    370 }
    371 
    375 Status CreateDemuxer(const StreamDescriptor& stream,
    376  const PackagingParams& packaging_params,
    377  std::shared_ptr<Demuxer>* new_demuxer) {
    378  std::shared_ptr<Demuxer> demuxer = std::make_shared<Demuxer>(stream.input);
    379  demuxer->set_dump_stream_info(packaging_params.test_params.dump_stream_info);
    380 
    381  if (packaging_params.decryption_params.key_provider != KeyProvider::kNone) {
    382  std::unique_ptr<KeySource> decryption_key_source(
    383  CreateDecryptionKeySource(packaging_params.decryption_params));
    384  if (!decryption_key_source) {
    385  return Status(
    386  error::INVALID_ARGUMENT,
    387  "Must define decryption key source when defining key provider");
    388  }
    389  demuxer->SetKeySource(std::move(decryption_key_source));
    390  }
    391 
    392  *new_demuxer = std::move(demuxer);
    393  return Status::OK;
    394 }
    395 
    396 std::shared_ptr<MediaHandler> CreateEncryptionHandler(
    397  const PackagingParams& packaging_params,
    398  const StreamDescriptor& stream,
    399  KeySource* key_source) {
    400  if (stream.skip_encryption) {
    401  return nullptr;
    402  }
    403 
    404  if (!key_source) {
    405  return nullptr;
    406  }
    407 
    408  // Make a copy so that we can modify it for this specific stream.
    409  EncryptionParams encryption_params = packaging_params.encryption_params;
    410 
    411  // Use Sample AES in MPEG2TS.
    412  // TODO(kqyang): Consider adding a new flag to enable Sample AES as we
    413  // will support CENC in TS in the future.
    414  if (GetOutputFormat(stream) == CONTAINER_MPEG2TS ||
    415  GetOutputFormat(stream) == CONTAINER_AAC ||
    416  GetOutputFormat(stream) == CONTAINER_AC3 ||
    417  GetOutputFormat(stream) == CONTAINER_EAC3) {
    418  VLOG(1) << "Use Apple Sample AES encryption for MPEG2TS or Packed Audio.";
    419  encryption_params.protection_scheme = kAppleSampleAesProtectionScheme;
    420  }
    421 
    422  if (!stream.drm_label.empty()) {
    423  const std::string& drm_label = stream.drm_label;
    424  encryption_params.stream_label_func =
    425  [drm_label](const EncryptionParams::EncryptedStreamAttributes&) {
    426  return drm_label;
    427  };
    428  } else if (!encryption_params.stream_label_func) {
    429  const int kDefaultMaxSdPixels = 768 * 576;
    430  const int kDefaultMaxHdPixels = 1920 * 1080;
    431  const int kDefaultMaxUhd1Pixels = 4096 * 2160;
    432  encryption_params.stream_label_func = std::bind(
    433  &Packager::DefaultStreamLabelFunction, kDefaultMaxSdPixels,
    434  kDefaultMaxHdPixels, kDefaultMaxUhd1Pixels, std::placeholders::_1);
    435  }
    436 
    437  return std::make_shared<EncryptionHandler>(encryption_params, key_source);
    438 }
    439 
    440 Status CreateMp4ToMp4TextJob(const StreamDescriptor& stream,
    441  const PackagingParams& packaging_params,
    442  std::unique_ptr<MuxerListener> muxer_listener,
    443  SyncPointQueue* sync_points,
    444  MuxerFactory* muxer_factory,
    445  std::shared_ptr<OriginHandler>* root) {
    446  // TODO(kqyang): This need to be integrated back to media pipeline since we
    447  // may want to get not only text streams from the demuxer, in which case, the
    448  // same demuxer should be used to get all streams instead of having a demuxer
    449  // specifically for text.
    450  // TODO(kqyang): Support Cue Alignment if |sync_points| is not null.
    451 
    452  std::shared_ptr<Demuxer> demuxer;
    453  RETURN_IF_ERROR(CreateDemuxer(stream, packaging_params, &demuxer));
    454  if (!stream.language.empty()) {
    455  demuxer->SetLanguageOverride(stream.stream_selector, stream.language);
    456  }
    457 
    458  auto chunker =
    459  std::make_shared<ChunkingHandler>(packaging_params.chunking_params);
    460  std::shared_ptr<Muxer> muxer =
    461  muxer_factory->CreateMuxer(GetOutputFormat(stream), stream);
    462  muxer->SetMuxerListener(std::move(muxer_listener));
    463 
    464  RETURN_IF_ERROR(chunker->AddHandler(std::move(muxer)));
    465  RETURN_IF_ERROR(
    466  demuxer->SetHandler(stream.stream_selector, std::move(chunker)));
    467 
    468  return Status::OK;
    469 }
    470 
    471 Status CreateHlsTextJob(const StreamDescriptor& stream,
    472  const PackagingParams& packaging_params,
    473  std::unique_ptr<MuxerListener> muxer_listener,
    474  SyncPointQueue* sync_points,
    475  JobManager* job_manager) {
    476  DCHECK(muxer_listener);
    477  DCHECK(job_manager);
    478 
    479  if (stream.segment_template.empty()) {
    480  return Status(error::INVALID_ARGUMENT,
    481  "Cannot output text (" + stream.input +
    482  ") to HLS with no segment template");
    483  }
    484 
    485  const float segment_length_in_seconds =
    486  packaging_params.chunking_params.segment_duration_in_seconds;
    487  const uint64_t segment_length_in_ms =
    488  static_cast<uint64_t>(segment_length_in_seconds * 1000);
    489 
    490  // Text files are usually small and since the input is one file;
    491  // there's no way for the player to do ranged requests. So set this
    492  // value to something reasonable if it is missing.
    493  MuxerOptions muxer_options = CreateMuxerOptions(stream, packaging_params);
    494  muxer_options.bandwidth = stream.bandwidth ? stream.bandwidth : 256;
    495 
    496  auto output = std::make_shared<WebVttSegmentedOutputHandler>(
    497  muxer_options, std::move(muxer_listener));
    498 
    499  std::unique_ptr<FileReader> reader;
    500  RETURN_IF_ERROR(FileReader::Open(stream.input, &reader));
    501 
    502  const int64_t kNoDuration = 0;
    503  auto parser =
    504  std::make_shared<WebVttParser>(std::move(reader), stream.language);
    505  auto padder = std::make_shared<TextPadder>(kNoDuration);
    506  auto cue_aligner = sync_points
    507  ? std::make_shared<CueAlignmentHandler>(sync_points)
    508  : nullptr;
    509  auto chunker = std::make_shared<TextChunker>(segment_length_in_ms);
    510 
    511  RETURN_IF_ERROR(
    512  ChainHandlers({parser, std::move(padder), std::move(cue_aligner),
    513  std::move(chunker), std::move(output)}));
    514 
    515  job_manager->Add("Segmented Text Job", std::move(parser));
    516 
    517  return Status::OK;
    518 }
    519 
    520 Status CreateWebVttToMp4TextJob(const StreamDescriptor& stream,
    521  const PackagingParams& packaging_params,
    522  std::unique_ptr<MuxerListener> muxer_listener,
    523  SyncPointQueue* sync_points,
    524  MuxerFactory* muxer_factory,
    525  std::shared_ptr<OriginHandler>* root) {
    526  // TODO(kqyang): Support Cue Alignment if |sync_points| is not null.
    527 
    528  std::unique_ptr<FileReader> reader;
    529  RETURN_IF_ERROR(FileReader::Open(stream.input, &reader));
    530 
    531  const int64_t kNoDuration = 0;
    532  auto parser =
    533  std::make_shared<WebVttParser>(std::move(reader), stream.language);
    534  auto padder = std::make_shared<TextPadder>(kNoDuration);
    535  auto text_to_mp4 = std::make_shared<WebVttToMp4Handler>();
    536  auto chunker =
    537  std::make_shared<ChunkingHandler>(packaging_params.chunking_params);
    538  auto muxer = muxer_factory->CreateMuxer(GetOutputFormat(stream), stream);
    539  muxer->SetMuxerListener(std::move(muxer_listener));
    540 
    541  RETURN_IF_ERROR(
    542  ChainHandlers({parser, std::move(padder), std::move(text_to_mp4),
    543  std::move(chunker), std::move(muxer)}));
    544  *root = std::move(parser);
    545 
    546  return Status::OK;
    547 }
    548 
    549 Status CreateTextJobs(
    550  const std::vector<std::reference_wrapper<const StreamDescriptor>>& streams,
    551  const PackagingParams& packaging_params,
    552  SyncPointQueue* sync_points,
    553  MuxerListenerFactory* muxer_listener_factory,
    554  MuxerFactory* muxer_factory,
    555  MpdNotifier* mpd_notifier,
    556  JobManager* job_manager) {
    557  DCHECK(muxer_listener_factory);
    558  DCHECK(job_manager);
    559  for (const StreamDescriptor& stream : streams) {
    560  if (GetOutputFormat(stream) == CONTAINER_MOV) {
    561  std::unique_ptr<MuxerListener> muxer_listener =
    562  muxer_listener_factory->CreateListener(ToMuxerListenerData(stream));
    563 
    564  std::shared_ptr<OriginHandler> root;
    565  Status status;
    566 
    567  switch (DetermineContainerFromFileName(stream.input)) {
    568  case CONTAINER_WEBVTT:
    569  status.Update(CreateWebVttToMp4TextJob(
    570  stream, packaging_params, std::move(muxer_listener), sync_points,
    571  muxer_factory, &root));
    572  break;
    573 
    574  case CONTAINER_MOV:
    575  status.Update(CreateMp4ToMp4TextJob(
    576  stream, packaging_params, std::move(muxer_listener), sync_points,
    577  muxer_factory, &root));
    578  break;
    579 
    580  default:
    581  status.Update(
    582  Status(error::INVALID_ARGUMENT,
    583  "Text output format is not support for " + stream.input));
    584  break;
    585  }
    586 
    587  if (!status.ok()) {
    588  return status;
    589  }
    590 
    591  job_manager->Add("MP4 text job", std::move(root));
    592  } else {
    593  std::unique_ptr<MuxerListener> hls_listener =
    594  muxer_listener_factory->CreateHlsListener(
    595  ToMuxerListenerData(stream));
    596 
    597  // Check input to ensure that output is possible.
    598  if (hls_listener) {
    599  if (stream.segment_template.empty() || !stream.output.empty()) {
    600  return Status(error::INVALID_ARGUMENT,
    601  "segment_template needs to be specified for HLS text "
    602  "output. Single file output is not supported yet.");
    603  }
    604  }
    605 
    606  if (mpd_notifier && !stream.segment_template.empty()) {
    607  return Status(error::INVALID_ARGUMENT,
    608  "Cannot create text output for MPD with segment output.");
    609  }
    610 
    611  // If we are outputting to HLS, then create the HLS test pipeline that
    612  // will create segmented text output.
    613  if (hls_listener) {
    614  Status status =
    615  CreateHlsTextJob(stream, packaging_params, std::move(hls_listener),
    616  sync_points, job_manager);
    617  if (!status.ok()) {
    618  return status;
    619  }
    620  }
    621 
    622  if (!stream.output.empty()) {
    623  if (!File::Copy(stream.input.c_str(), stream.output.c_str())) {
    624  std::string error;
    625  base::StringAppendF(
    626  &error, "Failed to copy the input file (%s) to output file (%s).",
    627  stream.input.c_str(), stream.output.c_str());
    628  return Status(error::FILE_FAILURE, error);
    629  }
    630 
    631  MediaInfo text_media_info;
    632  if (!StreamInfoToTextMediaInfo(stream, &text_media_info)) {
    633  return Status(error::INVALID_ARGUMENT,
    634  "Could not create media info for stream.");
    635  }
    636 
    637  // If we are outputting to MPD, just add the input to the outputted
    638  // manifest.
    639  if (mpd_notifier) {
    640  uint32_t unused;
    641  if (mpd_notifier->NotifyNewContainer(text_media_info, &unused)) {
    642  mpd_notifier->Flush();
    643  } else {
    644  return Status(error::PARSER_FAILURE,
    645  "Failed to process text file " + stream.input);
    646  }
    647  }
    648 
    649  if (packaging_params.output_media_info) {
    651  text_media_info, stream.output + kMediaInfoSuffix);
    652  }
    653  }
    654  }
    655  }
    656 
    657  return Status::OK;
    658 }
    659 
    660 Status CreateAudioVideoJobs(
    661  const std::vector<std::reference_wrapper<const StreamDescriptor>>& streams,
    662  const PackagingParams& packaging_params,
    663  KeySource* encryption_key_source,
    664  SyncPointQueue* sync_points,
    665  MuxerListenerFactory* muxer_listener_factory,
    666  MuxerFactory* muxer_factory,
    667  JobManager* job_manager) {
    668  DCHECK(muxer_listener_factory);
    669  DCHECK(muxer_factory);
    670  DCHECK(job_manager);
    671  // Store all the demuxers in a map so that we can look up a stream's demuxer.
    672  // This is step one in making this part of the pipeline less dependant on
    673  // order.
    674  std::map<std::string, std::shared_ptr<Demuxer>> sources;
    675  std::map<std::string, std::shared_ptr<MediaHandler>> cue_aligners;
    676 
    677  for (const StreamDescriptor& stream : streams) {
    678  bool seen_input_before = sources.find(stream.input) != sources.end();
    679  if (seen_input_before) {
    680  continue;
    681  }
    682 
    683  RETURN_IF_ERROR(
    684  CreateDemuxer(stream, packaging_params, &sources[stream.input]));
    685  cue_aligners[stream.input] =
    686  sync_points ? std::make_shared<CueAlignmentHandler>(sync_points)
    687  : nullptr;
    688  }
    689 
    690  for (auto& source : sources) {
    691  job_manager->Add("RemuxJob", source.second);
    692  }
    693 
    694  // Replicators are shared among all streams with the same input and stream
    695  // selector.
    696  std::shared_ptr<MediaHandler> replicator;
    697 
    698  std::string previous_input;
    699  std::string previous_selector;
    700 
    701  for (const StreamDescriptor& stream : streams) {
    702  // Get the demuxer for this stream.
    703  auto& demuxer = sources[stream.input];
    704  auto& cue_aligner = cue_aligners[stream.input];
    705 
    706  const bool new_input_file = stream.input != previous_input;
    707  const bool new_stream =
    708  new_input_file || previous_selector != stream.stream_selector;
    709  previous_input = stream.input;
    710  previous_selector = stream.stream_selector;
    711 
    712  // If the stream has no output, then there is no reason setting-up the rest
    713  // of the pipeline.
    714  if (stream.output.empty() && stream.segment_template.empty()) {
    715  continue;
    716  }
    717 
    718  // Just because it is a different stream descriptor does not mean it is a
    719  // new stream. Multiple stream descriptors may have the same stream but
    720  // only differ by trick play factor.
    721  if (new_stream) {
    722  if (!stream.language.empty()) {
    723  demuxer->SetLanguageOverride(stream.stream_selector, stream.language);
    724  }
    725 
    726  replicator = std::make_shared<Replicator>();
    727  auto chunker =
    728  std::make_shared<ChunkingHandler>(packaging_params.chunking_params);
    729  auto encryptor = CreateEncryptionHandler(packaging_params, stream,
    730  encryption_key_source);
    731 
    732  // TODO(vaage) : Create a nicer way to connect handlers to demuxers.
    733  if (sync_points) {
    734  RETURN_IF_ERROR(
    735  ChainHandlers({cue_aligner, chunker, encryptor, replicator}));
    736  RETURN_IF_ERROR(
    737  demuxer->SetHandler(stream.stream_selector, cue_aligner));
    738  } else {
    739  RETURN_IF_ERROR(ChainHandlers({chunker, encryptor, replicator}));
    740  RETURN_IF_ERROR(demuxer->SetHandler(stream.stream_selector, chunker));
    741  }
    742  }
    743 
    744  // Create the muxer (output) for this track.
    745  std::shared_ptr<Muxer> muxer =
    746  muxer_factory->CreateMuxer(GetOutputFormat(stream), stream);
    747  if (!muxer) {
    748  return Status(error::INVALID_ARGUMENT, "Failed to create muxer for " +
    749  stream.input + ":" +
    750  stream.stream_selector);
    751  }
    752 
    753  std::unique_ptr<MuxerListener> muxer_listener =
    754  muxer_listener_factory->CreateListener(ToMuxerListenerData(stream));
    755  muxer->SetMuxerListener(std::move(muxer_listener));
    756 
    757  // Trick play is optional.
    758  std::shared_ptr<MediaHandler> trick_play =
    759  stream.trick_play_factor
    760  ? std::make_shared<TrickPlayHandler>(stream.trick_play_factor)
    761  : nullptr;
    762 
    763  RETURN_IF_ERROR(ChainHandlers({replicator, trick_play, muxer}));
    764  }
    765 
    766  return Status::OK;
    767 }
    768 
    769 Status CreateAllJobs(const std::vector<StreamDescriptor>& stream_descriptors,
    770  const PackagingParams& packaging_params,
    771  MpdNotifier* mpd_notifier,
    772  KeySource* encryption_key_source,
    773  SyncPointQueue* sync_points,
    774  MuxerListenerFactory* muxer_listener_factory,
    775  MuxerFactory* muxer_factory,
    776  JobManager* job_manager) {
    777  DCHECK(muxer_factory);
    778  DCHECK(muxer_listener_factory);
    779  DCHECK(job_manager);
    780 
    781  // Group all streams based on which pipeline they will use.
    782  std::vector<std::reference_wrapper<const StreamDescriptor>> text_streams;
    783  std::vector<std::reference_wrapper<const StreamDescriptor>>
    784  audio_video_streams;
    785 
    786  for (const StreamDescriptor& stream : stream_descriptors) {
    787  // TODO: Find a better way to determine what stream type a stream
    788  // descriptor is as |stream_selector| may use an index. This would
    789  // also allow us to use a simpler audio pipeline.
    790  if (stream.stream_selector == "text") {
    791  text_streams.push_back(stream);
    792  } else {
    793  audio_video_streams.push_back(stream);
    794  }
    795  }
    796 
    797  // Audio/Video streams need to be in sorted order so that demuxers and trick
    798  // play handlers get setup correctly.
    799  std::sort(audio_video_streams.begin(), audio_video_streams.end(),
    800  media::StreamDescriptorCompareFn);
    801 
    802  RETURN_IF_ERROR(CreateTextJobs(text_streams, packaging_params, sync_points,
    803  muxer_listener_factory, muxer_factory,
    804  mpd_notifier, job_manager));
    805  RETURN_IF_ERROR(CreateAudioVideoJobs(
    806  audio_video_streams, packaging_params, encryption_key_source, sync_points,
    807  muxer_listener_factory, muxer_factory, job_manager));
    808 
    809  // Initialize processing graph.
    810  return job_manager->InitializeJobs();
    811 }
    812 
    813 } // namespace
    814 } // namespace media
    815 
    816 struct Packager::PackagerInternal {
    817  media::FakeClock fake_clock;
    818  std::unique_ptr<KeySource> encryption_key_source;
    819  std::unique_ptr<MpdNotifier> mpd_notifier;
    820  std::unique_ptr<hls::HlsNotifier> hls_notifier;
    821  BufferCallbackParams buffer_callback_params;
    822  std::unique_ptr<media::JobManager> job_manager;
    823 };
    824 
    825 Packager::Packager() {}
    826 
    827 Packager::~Packager() {}
    828 
    830  const PackagingParams& packaging_params,
    831  const std::vector<StreamDescriptor>& stream_descriptors) {
    832  // Needed by base::WorkedPool used in ThreadedIoFile.
    833  static base::AtExitManager exit;
    834  static media::LibcryptoThreading libcrypto_threading;
    835 
    836  if (internal_)
    837  return Status(error::INVALID_ARGUMENT, "Already initialized.");
    838 
    839  Status param_check =
    840  media::ValidateParams(packaging_params, stream_descriptors);
    841  if (!param_check.ok()) {
    842  return param_check;
    843  }
    844 
    845  if (!packaging_params.test_params.injected_library_version.empty()) {
    846  SetPackagerVersionForTesting(
    847  packaging_params.test_params.injected_library_version);
    848  }
    849 
    850  std::unique_ptr<PackagerInternal> internal(new PackagerInternal);
    851 
    852  // Create encryption key source if needed.
    853  if (packaging_params.encryption_params.key_provider != KeyProvider::kNone) {
    854  internal->encryption_key_source = CreateEncryptionKeySource(
    855  static_cast<media::FourCC>(
    856  packaging_params.encryption_params.protection_scheme),
    857  packaging_params.encryption_params);
    858  if (!internal->encryption_key_source)
    859  return Status(error::INVALID_ARGUMENT, "Failed to create key source.");
    860  }
    861 
    862  // Store callback params to make it available during packaging.
    863  internal->buffer_callback_params = packaging_params.buffer_callback_params;
    864 
    865  // Update MPD output and HLS output if callback param is specified.
    866  MpdParams mpd_params = packaging_params.mpd_params;
    867  HlsParams hls_params = packaging_params.hls_params;
    868  if (internal->buffer_callback_params.write_func) {
    870  internal->buffer_callback_params, mpd_params.mpd_output);
    872  internal->buffer_callback_params, hls_params.master_playlist_output);
    873  }
    874  // Both DASH and HLS require language to follow RFC5646
    875  // (https://tools.ietf.org/html/rfc5646), which requires the language to be
    876  // in the shortest form.
    877  mpd_params.default_language =
    879  hls_params.default_language =
    881 
    882  if (!mpd_params.mpd_output.empty()) {
    883  const bool on_demand_dash_profile =
    884  stream_descriptors.begin()->segment_template.empty();
    885  const double target_segment_duration =
    887  const MpdOptions mpd_options = media::GetMpdOptions(
    888  on_demand_dash_profile, mpd_params, target_segment_duration);
    889  internal->mpd_notifier.reset(new SimpleMpdNotifier(mpd_options));
    890  if (!internal->mpd_notifier->Init()) {
    891  LOG(ERROR) << "MpdNotifier failed to initialize.";
    892  return Status(error::INVALID_ARGUMENT,
    893  "Failed to initialize MpdNotifier.");
    894  }
    895  }
    896 
    897  if (!hls_params.master_playlist_output.empty()) {
    898  internal->hls_notifier.reset(new hls::SimpleHlsNotifier(hls_params));
    899  }
    900 
    901  std::unique_ptr<SyncPointQueue> sync_points;
    902  if (!packaging_params.ad_cue_generator_params.cue_points.empty()) {
    903  sync_points.reset(
    904  new SyncPointQueue(packaging_params.ad_cue_generator_params));
    905  }
    906  internal->job_manager.reset(new JobManager(std::move(sync_points)));
    907 
    908  std::vector<StreamDescriptor> streams_for_jobs;
    909 
    910  for (const StreamDescriptor& descriptor : stream_descriptors) {
    911  // We may need to overwrite some values, so make a copy first.
    912  StreamDescriptor copy = descriptor;
    913 
    914  if (internal->buffer_callback_params.read_func) {
    915  copy.input = File::MakeCallbackFileName(internal->buffer_callback_params,
    916  descriptor.input);
    917  }
    918 
    919  if (internal->buffer_callback_params.write_func) {
    920  copy.output = File::MakeCallbackFileName(internal->buffer_callback_params,
    921  descriptor.output);
    923  internal->buffer_callback_params, descriptor.segment_template);
    924  }
    925 
    926  // Update language to ISO_639_2 code if set.
    927  if (!copy.language.empty()) {
    928  copy.language = LanguageToISO_639_2(descriptor.language);
    929  if (copy.language == "und") {
    930  return Status(
    931  error::INVALID_ARGUMENT,
    932  "Unknown/invalid language specified: " + descriptor.language);
    933  }
    934  }
    935 
    936  streams_for_jobs.push_back(copy);
    937  }
    938 
    939  media::MuxerFactory muxer_factory(packaging_params);
    940  if (packaging_params.test_params.inject_fake_clock) {
    941  muxer_factory.OverrideClock(&internal->fake_clock);
    942  }
    943 
    944  media::MuxerListenerFactory muxer_listener_factory(
    945  packaging_params.output_media_info, internal->mpd_notifier.get(),
    946  internal->hls_notifier.get());
    947 
    948  Status status = media::CreateAllJobs(
    949  streams_for_jobs, packaging_params, internal->mpd_notifier.get(),
    950  internal->encryption_key_source.get(),
    951  internal->job_manager->sync_points(), &muxer_listener_factory,
    952  &muxer_factory, internal->job_manager.get());
    953 
    954  if (!status.ok()) {
    955  return status;
    956  }
    957 
    958  internal_ = std::move(internal);
    959  return Status::OK;
    960 }
    961 
    963  if (!internal_)
    964  return Status(error::INVALID_ARGUMENT, "Not yet initialized.");
    965 
    966  Status status = internal_->job_manager->RunJobs();
    967  if (!status.ok())
    968  return status;
    969 
    970  if (internal_->hls_notifier) {
    971  if (!internal_->hls_notifier->Flush())
    972  return Status(error::INVALID_ARGUMENT, "Failed to flush Hls.");
    973  }
    974  if (internal_->mpd_notifier) {
    975  if (!internal_->mpd_notifier->Flush())
    976  return Status(error::INVALID_ARGUMENT, "Failed to flush Mpd.");
    977  }
    978  return Status::OK;
    979 }
    980 
    982  if (!internal_) {
    983  LOG(INFO) << "Not yet initialized. Return directly.";
    984  return;
    985  }
    986  internal_->job_manager->CancelJobs();
    987 }
    988 
    990  return GetPackagerVersion();
    991 }
    992 
    994  int max_sd_pixels,
    995  int max_hd_pixels,
    996  int max_uhd1_pixels,
    997  const EncryptionParams::EncryptedStreamAttributes& stream_attributes) {
    998  if (stream_attributes.stream_type ==
    999  EncryptionParams::EncryptedStreamAttributes::kAudio)
    1000  return "AUDIO";
    1001  if (stream_attributes.stream_type ==
    1002  EncryptionParams::EncryptedStreamAttributes::kVideo) {
    1003  const int pixels = stream_attributes.oneof.video.width *
    1004  stream_attributes.oneof.video.height;
    1005  if (pixels <= max_sd_pixels)
    1006  return "SD";
    1007  if (pixels <= max_hd_pixels)
    1008  return "HD";
    1009  if (pixels <= max_uhd1_pixels)
    1010  return "UHD1";
    1011  return "UHD2";
    1012  }
    1013  return "";
    1014 }
    1015 
    1016 } // namespace shaka
    BufferCallbackParams buffer_callback_params
    Buffer callback params.
    Definition: packager.h:62
    +
    1 // Copyright 2017 Google Inc. All rights reserved.
    2 //
    3 // Use of this source code is governed by a BSD-style
    4 // license that can be found in the LICENSE file or at
    5 // https://developers.google.com/open-source/licenses/bsd
    6 
    7 #include "packager/packager.h"
    8 
    9 #include <algorithm>
    10 
    11 #include "packager/app/job_manager.h"
    12 #include "packager/app/libcrypto_threading.h"
    13 #include "packager/app/muxer_factory.h"
    14 #include "packager/app/packager_util.h"
    15 #include "packager/app/stream_descriptor.h"
    16 #include "packager/base/at_exit.h"
    17 #include "packager/base/files/file_path.h"
    18 #include "packager/base/logging.h"
    19 #include "packager/base/optional.h"
    20 #include "packager/base/path_service.h"
    21 #include "packager/base/strings/string_util.h"
    22 #include "packager/base/strings/stringprintf.h"
    23 #include "packager/base/threading/simple_thread.h"
    24 #include "packager/base/time/clock.h"
    25 #include "packager/file/file.h"
    26 #include "packager/hls/base/hls_notifier.h"
    27 #include "packager/hls/base/simple_hls_notifier.h"
    28 #include "packager/media/ad_cue_generator/ad_cue_generator.h"
    29 #include "packager/media/base/container_names.h"
    30 #include "packager/media/base/fourccs.h"
    31 #include "packager/media/base/key_source.h"
    32 #include "packager/media/base/language_utils.h"
    33 #include "packager/media/base/muxer.h"
    34 #include "packager/media/base/muxer_options.h"
    35 #include "packager/media/base/muxer_util.h"
    36 #include "packager/media/chunking/chunking_handler.h"
    37 #include "packager/media/chunking/cue_alignment_handler.h"
    38 #include "packager/media/chunking/text_chunker.h"
    39 #include "packager/media/crypto/encryption_handler.h"
    40 #include "packager/media/demuxer/demuxer.h"
    41 #include "packager/media/event/muxer_listener_factory.h"
    42 #include "packager/media/event/vod_media_info_dump_muxer_listener.h"
    43 #include "packager/media/formats/webvtt/text_padder.h"
    44 #include "packager/media/formats/webvtt/text_readers.h"
    45 #include "packager/media/formats/webvtt/webvtt_parser.h"
    46 #include "packager/media/formats/webvtt/webvtt_text_output_handler.h"
    47 #include "packager/media/formats/webvtt/webvtt_to_mp4_handler.h"
    48 #include "packager/media/replicator/replicator.h"
    49 #include "packager/media/trick_play/trick_play_handler.h"
    50 #include "packager/mpd/base/media_info.pb.h"
    51 #include "packager/mpd/base/mpd_builder.h"
    52 #include "packager/mpd/base/simple_mpd_notifier.h"
    53 #include "packager/status_macros.h"
    54 #include "packager/version/version.h"
    55 
    56 namespace shaka {
    57 
    58 // TODO(kqyang): Clean up namespaces.
    59 using media::Demuxer;
    60 using media::JobManager;
    61 using media::KeySource;
    62 using media::MuxerOptions;
    63 using media::SyncPointQueue;
    64 
    65 namespace media {
    66 namespace {
    67 
    68 const char kMediaInfoSuffix[] = ".media_info";
    69 
    70 Status ChainHandlers(
    71  std::initializer_list<std::shared_ptr<MediaHandler>> list) {
    72  std::shared_ptr<MediaHandler> previous;
    73 
    74  for (auto& next : list) {
    75  // Skip null entries.
    76  if (!next) {
    77  continue;
    78  }
    79 
    80  if (previous) {
    81  RETURN_IF_ERROR(previous->AddHandler(next));
    82  }
    83 
    84  previous = std::move(next);
    85  }
    86 
    87  return Status::OK;
    88 }
    89 
    90 MuxerOptions CreateMuxerOptions(const StreamDescriptor& stream,
    91  const PackagingParams& params) {
    92  MuxerOptions options;
    93 
    94  options.mp4_params = params.mp4_output_params;
    95  options.temp_dir = params.temp_dir;
    96  options.bandwidth = stream.bandwidth;
    97  options.output_file_name = stream.output;
    98  options.segment_template = stream.segment_template;
    99 
    100  return options;
    101 }
    102 
    103 MuxerListenerFactory::StreamData ToMuxerListenerData(
    104  const StreamDescriptor& stream) {
    105  MuxerListenerFactory::StreamData data;
    106  data.media_info_output = stream.output;
    107  data.hls_group_id = stream.hls_group_id;
    108  data.hls_name = stream.hls_name;
    109  data.hls_playlist_name = stream.hls_playlist_name;
    110  data.hls_iframe_playlist_name = stream.hls_iframe_playlist_name;
    111  return data;
    112 };
    113 
    114 // TODO(rkuroiwa): Write TTML and WebVTT parser (demuxing) for a better check
    115 // and for supporting live/segmenting (muxing). With a demuxer and a muxer,
    116 // CreateAllJobs() shouldn't treat text as a special case.
    117 bool DetermineTextFileCodec(const std::string& file, std::string* out) {
    118  CHECK(out);
    119 
    120  std::string content;
    121  if (!File::ReadFileToString(file.c_str(), &content)) {
    122  LOG(ERROR) << "Failed to open file " << file
    123  << " to determine file format.";
    124  return false;
    125  }
    126 
    127  const uint8_t* content_data =
    128  reinterpret_cast<const uint8_t*>(content.data());
    129  MediaContainerName container_name =
    130  DetermineContainer(content_data, content.size());
    131 
    132  if (container_name == CONTAINER_WEBVTT) {
    133  *out = "wvtt";
    134  return true;
    135  }
    136 
    137  if (container_name == CONTAINER_TTML) {
    138  *out = "ttml";
    139  return true;
    140  }
    141 
    142  return false;
    143 }
    144 
    145 MediaContainerName GetOutputFormat(const StreamDescriptor& descriptor) {
    146  if (!descriptor.output_format.empty()) {
    147  MediaContainerName format =
    148  DetermineContainerFromFormatName(descriptor.output_format);
    149  if (format == CONTAINER_UNKNOWN) {
    150  LOG(ERROR) << "Unable to determine output format from '"
    151  << descriptor.output_format << "'.";
    152  }
    153  return format;
    154  }
    155 
    156  base::Optional<MediaContainerName> format_from_output;
    157  base::Optional<MediaContainerName> format_from_segment;
    158  if (!descriptor.output.empty()) {
    159  format_from_output = DetermineContainerFromFileName(descriptor.output);
    160  if (format_from_output.value() == CONTAINER_UNKNOWN) {
    161  LOG(ERROR) << "Unable to determine output format from '"
    162  << descriptor.output << "'.";
    163  }
    164  }
    165  if (!descriptor.segment_template.empty()) {
    166  format_from_segment =
    167  DetermineContainerFromFileName(descriptor.segment_template);
    168  if (format_from_segment.value() == CONTAINER_UNKNOWN) {
    169  LOG(ERROR) << "Unable to determine output format from '"
    170  << descriptor.segment_template << "'.";
    171  }
    172  }
    173 
    174  if (format_from_output && format_from_segment) {
    175  if (format_from_output.value() != format_from_segment.value()) {
    176  LOG(ERROR) << "Output format determined from '" << descriptor.output
    177  << "' differs from output format determined from '"
    178  << descriptor.segment_template << "'.";
    179  return CONTAINER_UNKNOWN;
    180  }
    181  }
    182 
    183  if (format_from_output)
    184  return format_from_output.value();
    185  if (format_from_segment)
    186  return format_from_segment.value();
    187  return CONTAINER_UNKNOWN;
    188 }
    189 
    190 Status ValidateStreamDescriptor(bool dump_stream_info,
    191  const StreamDescriptor& stream) {
    192  if (stream.input.empty()) {
    193  return Status(error::INVALID_ARGUMENT, "Stream input not specified.");
    194  }
    195 
    196  // The only time a stream can have no outputs, is when dump stream info is
    197  // set.
    198  if (dump_stream_info && stream.output.empty() &&
    199  stream.segment_template.empty()) {
    200  return Status::OK;
    201  }
    202 
    203  if (stream.output.empty() && stream.segment_template.empty()) {
    204  return Status(error::INVALID_ARGUMENT,
    205  "Streams must specify 'output' or 'segment template'.");
    206  }
    207 
    208  // Whenever there is output, a stream must be selected.
    209  if (stream.stream_selector.empty()) {
    210  return Status(error::INVALID_ARGUMENT,
    211  "Stream stream_selector not specified.");
    212  }
    213 
    214  // If a segment template is provided, it must be valid.
    215  if (stream.segment_template.length()) {
    216  RETURN_IF_ERROR(ValidateSegmentTemplate(stream.segment_template));
    217  }
    218 
    219  if (stream.output.find('$') != std::string::npos) {
    220  // "$" is only allowed if the output file name is a template, which is
    221  // used to support one file per Representation per Period when there are
    222  // Ad Cues.
    223  RETURN_IF_ERROR(ValidateSegmentTemplate(stream.output));
    224  }
    225 
    226  // There are some specifics that must be checked based on which format
    227  // we are writing to.
    228  const MediaContainerName output_format = GetOutputFormat(stream);
    229 
    230  if (output_format == CONTAINER_UNKNOWN) {
    231  return Status(error::INVALID_ARGUMENT, "Unsupported output format.");
    232  } else if (output_format == MediaContainerName::CONTAINER_MPEG2TS) {
    233  if (stream.segment_template.empty()) {
    234  return Status(
    235  error::INVALID_ARGUMENT,
    236  "Please specify 'segment_template'. Single file TS output is "
    237  "not supported.");
    238  }
    239 
    240  // Right now the init segment is saved in |output| for multi-segment
    241  // content. However, for TS all segments must be self-initializing so
    242  // there cannot be an init segment.
    243  if (stream.output.length()) {
    244  return Status(error::INVALID_ARGUMENT,
    245  "All TS segments must be self-initializing. Stream "
    246  "descriptors 'output' or 'init_segment' are not allowed.");
    247  }
    248  } else if (output_format == CONTAINER_WEBVTT ||
    249  output_format == CONTAINER_AAC || output_format == CONTAINER_AC3 ||
    250  output_format == CONTAINER_EAC3) {
    251  // There is no need for an init segment when outputting because there is no
    252  // initialization data.
    253  if (stream.segment_template.length() && stream.output.length()) {
    254  return Status(
    255  error::INVALID_ARGUMENT,
    256  "Segmented WebVTT or PackedAudio output cannot have an init segment. "
    257  "Do not specify stream descriptors 'output' or 'init_segment' when "
    258  "using 'segment_template'.");
    259  }
    260  } else {
    261  // For any other format, if there is a segment template, there must be an
    262  // init segment provided.
    263  if (stream.segment_template.length() && stream.output.empty()) {
    264  return Status(error::INVALID_ARGUMENT,
    265  "Please specify 'init_segment'. All non-TS multi-segment "
    266  "content must provide an init segment.");
    267  }
    268  }
    269 
    270  return Status::OK;
    271 }
    272 
    273 Status ValidateParams(const PackagingParams& packaging_params,
    274  const std::vector<StreamDescriptor>& stream_descriptors) {
    275  if (!packaging_params.chunking_params.segment_sap_aligned &&
    276  packaging_params.chunking_params.subsegment_sap_aligned) {
    277  return Status(error::INVALID_ARGUMENT,
    278  "Setting segment_sap_aligned to false but "
    279  "subsegment_sap_aligned to true is not allowed.");
    280  }
    281 
    282  if (stream_descriptors.empty()) {
    283  return Status(error::INVALID_ARGUMENT,
    284  "Stream descriptors cannot be empty.");
    285  }
    286 
    287  // On demand profile generates single file segment while live profile
    288  // generates multiple segments specified using segment template.
    289  const bool on_demand_dash_profile =
    290  stream_descriptors.begin()->segment_template.empty();
    291  for (const auto& descriptor : stream_descriptors) {
    292  if (on_demand_dash_profile != descriptor.segment_template.empty()) {
    293  return Status(error::INVALID_ARGUMENT,
    294  "Inconsistent stream descriptor specification: "
    295  "segment_template should be specified for none or all "
    296  "stream descriptors.");
    297  }
    298 
    299  RETURN_IF_ERROR(ValidateStreamDescriptor(
    300  packaging_params.test_params.dump_stream_info, descriptor));
    301 
    302  if (base::StartsWith(descriptor.input, "udp://",
    303  base::CompareCase::SENSITIVE)) {
    304  const HlsParams& hls_params = packaging_params.hls_params;
    305  if (!hls_params.master_playlist_output.empty() &&
    306  hls_params.playlist_type == HlsPlaylistType::kVod) {
    307  LOG(WARNING)
    308  << "Seeing UDP input with HLS Playlist Type set to VOD. The "
    309  "playlists will only be generated when UDP socket is closed. "
    310  "If you want to do live packaging, --hls_playlist_type needs to "
    311  "be set to LIVE.";
    312  }
    313  // Skip the check for DASH as DASH defaults to 'dynamic' MPD when segment
    314  // template is provided.
    315  }
    316  }
    317 
    318  if (packaging_params.output_media_info && !on_demand_dash_profile) {
    319  // TODO(rkuroiwa, kqyang): Support partial media info dump for live.
    320  return Status(error::UNIMPLEMENTED,
    321  "--output_media_info is only supported for on-demand profile "
    322  "(not using segment_template).");
    323  }
    324 
    325  return Status::OK;
    326 }
    327 
    328 bool StreamDescriptorCompareFn(const StreamDescriptor& a,
    329  const StreamDescriptor& b) {
    330  if (a.input == b.input) {
    331  if (a.stream_selector == b.stream_selector) {
    332  // The MPD notifier requires that the main track comes first, so make
    333  // sure that happens.
    334  if (a.trick_play_factor == 0 || b.trick_play_factor == 0) {
    335  return a.trick_play_factor == 0;
    336  } else {
    337  return a.trick_play_factor > b.trick_play_factor;
    338  }
    339  } else {
    340  return a.stream_selector < b.stream_selector;
    341  }
    342  }
    343 
    344  return a.input < b.input;
    345 }
    346 
    347 // A fake clock that always return time 0 (epoch). Should only be used for
    348 // testing.
    349 class FakeClock : public base::Clock {
    350  public:
    351  base::Time Now() override { return base::Time(); }
    352 };
    353 
    354 bool StreamInfoToTextMediaInfo(const StreamDescriptor& stream_descriptor,
    355  MediaInfo* text_media_info) {
    356  std::string codec;
    357  if (!DetermineTextFileCodec(stream_descriptor.input, &codec)) {
    358  LOG(ERROR) << "Failed to determine the text file format for "
    359  << stream_descriptor.input;
    360  return false;
    361  }
    362 
    363  MediaInfo::TextInfo* text_info = text_media_info->mutable_text_info();
    364  text_info->set_codec(codec);
    365 
    366  const std::string& language = stream_descriptor.language;
    367  if (!language.empty()) {
    368  text_info->set_language(language);
    369  }
    370 
    371  text_media_info->set_media_file_name(stream_descriptor.output);
    372  text_media_info->set_container_type(MediaInfo::CONTAINER_TEXT);
    373 
    374  if (stream_descriptor.bandwidth != 0) {
    375  text_media_info->set_bandwidth(stream_descriptor.bandwidth);
    376  } else {
    377  // Text files are usually small and since the input is one file; there's no
    378  // way for the player to do ranged requests. So set this value to something
    379  // reasonable.
    380  const int kDefaultTextBandwidth = 256;
    381  text_media_info->set_bandwidth(kDefaultTextBandwidth);
    382  }
    383 
    384  return true;
    385 }
    386 
    390 Status CreateDemuxer(const StreamDescriptor& stream,
    391  const PackagingParams& packaging_params,
    392  std::shared_ptr<Demuxer>* new_demuxer) {
    393  std::shared_ptr<Demuxer> demuxer = std::make_shared<Demuxer>(stream.input);
    394  demuxer->set_dump_stream_info(packaging_params.test_params.dump_stream_info);
    395 
    396  if (packaging_params.decryption_params.key_provider != KeyProvider::kNone) {
    397  std::unique_ptr<KeySource> decryption_key_source(
    398  CreateDecryptionKeySource(packaging_params.decryption_params));
    399  if (!decryption_key_source) {
    400  return Status(
    401  error::INVALID_ARGUMENT,
    402  "Must define decryption key source when defining key provider");
    403  }
    404  demuxer->SetKeySource(std::move(decryption_key_source));
    405  }
    406 
    407  *new_demuxer = std::move(demuxer);
    408  return Status::OK;
    409 }
    410 
    411 std::shared_ptr<MediaHandler> CreateEncryptionHandler(
    412  const PackagingParams& packaging_params,
    413  const StreamDescriptor& stream,
    414  KeySource* key_source) {
    415  if (stream.skip_encryption) {
    416  return nullptr;
    417  }
    418 
    419  if (!key_source) {
    420  return nullptr;
    421  }
    422 
    423  // Make a copy so that we can modify it for this specific stream.
    424  EncryptionParams encryption_params = packaging_params.encryption_params;
    425 
    426  // Use Sample AES in MPEG2TS.
    427  // TODO(kqyang): Consider adding a new flag to enable Sample AES as we
    428  // will support CENC in TS in the future.
    429  if (GetOutputFormat(stream) == CONTAINER_MPEG2TS ||
    430  GetOutputFormat(stream) == CONTAINER_AAC ||
    431  GetOutputFormat(stream) == CONTAINER_AC3 ||
    432  GetOutputFormat(stream) == CONTAINER_EAC3) {
    433  VLOG(1) << "Use Apple Sample AES encryption for MPEG2TS or Packed Audio.";
    434  encryption_params.protection_scheme = kAppleSampleAesProtectionScheme;
    435  }
    436 
    437  if (!stream.drm_label.empty()) {
    438  const std::string& drm_label = stream.drm_label;
    439  encryption_params.stream_label_func =
    440  [drm_label](const EncryptionParams::EncryptedStreamAttributes&) {
    441  return drm_label;
    442  };
    443  } else if (!encryption_params.stream_label_func) {
    444  const int kDefaultMaxSdPixels = 768 * 576;
    445  const int kDefaultMaxHdPixels = 1920 * 1080;
    446  const int kDefaultMaxUhd1Pixels = 4096 * 2160;
    447  encryption_params.stream_label_func = std::bind(
    448  &Packager::DefaultStreamLabelFunction, kDefaultMaxSdPixels,
    449  kDefaultMaxHdPixels, kDefaultMaxUhd1Pixels, std::placeholders::_1);
    450  }
    451 
    452  return std::make_shared<EncryptionHandler>(encryption_params, key_source);
    453 }
    454 
    455 std::unique_ptr<TextChunker> CreateTextChunker(
    456  const ChunkingParams& chunking_params) {
    457  const float segment_length_in_seconds =
    458  chunking_params.segment_duration_in_seconds;
    459  const uint64_t segment_length_in_ms =
    460  static_cast<uint64_t>(segment_length_in_seconds * 1000);
    461 
    462  return std::unique_ptr<TextChunker>(new TextChunker(segment_length_in_ms));
    463 }
    464 
    465 Status CreateHlsTextJob(const StreamDescriptor& stream,
    466  const PackagingParams& packaging_params,
    467  std::unique_ptr<MuxerListener> muxer_listener,
    468  SyncPointQueue* sync_points,
    469  JobManager* job_manager) {
    470  DCHECK(muxer_listener);
    471  DCHECK(job_manager);
    472 
    473  if (stream.segment_template.empty()) {
    474  return Status(error::INVALID_ARGUMENT,
    475  "Cannot output text (" + stream.input +
    476  ") to HLS with no segment template");
    477  }
    478 
    479  // Text files are usually small and since the input is one file;
    480  // there's no way for the player to do ranged requests. So set this
    481  // value to something reasonable if it is missing.
    482  MuxerOptions muxer_options = CreateMuxerOptions(stream, packaging_params);
    483  muxer_options.bandwidth = stream.bandwidth ? stream.bandwidth : 256;
    484 
    485  auto output = std::make_shared<WebVttTextOutputHandler>(
    486  muxer_options, std::move(muxer_listener));
    487 
    488  std::unique_ptr<FileReader> reader;
    489  RETURN_IF_ERROR(FileReader::Open(stream.input, &reader));
    490 
    491  const int64_t kNoDuration = 0;
    492  auto parser =
    493  std::make_shared<WebVttParser>(std::move(reader), stream.language);
    494  auto padder = std::make_shared<TextPadder>(kNoDuration);
    495  auto cue_aligner = sync_points
    496  ? std::make_shared<CueAlignmentHandler>(sync_points)
    497  : nullptr;
    498  auto chunker = CreateTextChunker(packaging_params.chunking_params);
    499 
    500  job_manager->Add("Segmented Text Job", parser);
    501 
    502  return ChainHandlers({std::move(parser), std::move(padder),
    503  std::move(cue_aligner), std::move(chunker),
    504  std::move(output)});
    505 }
    506 
    507 Status CreateWebVttToMp4TextJob(const StreamDescriptor& stream,
    508  const PackagingParams& packaging_params,
    509  std::unique_ptr<MuxerListener> muxer_listener,
    510  SyncPointQueue* sync_points,
    511  MuxerFactory* muxer_factory,
    512  std::shared_ptr<OriginHandler>* root) {
    513  std::unique_ptr<FileReader> reader;
    514  RETURN_IF_ERROR(FileReader::Open(stream.input, &reader));
    515 
    516  const int64_t kNoDuration = 0;
    517  auto parser =
    518  std::make_shared<WebVttParser>(std::move(reader), stream.language);
    519  auto padder = std::make_shared<TextPadder>(kNoDuration);
    520 
    521  auto text_to_mp4 = std::make_shared<WebVttToMp4Handler>();
    522  auto muxer = muxer_factory->CreateMuxer(GetOutputFormat(stream), stream);
    523  muxer->SetMuxerListener(std::move(muxer_listener));
    524 
    525  // Optional Cue Alignment Handler
    526  std::shared_ptr<MediaHandler> cue_aligner;
    527  if (sync_points) {
    528  cue_aligner = std::make_shared<CueAlignmentHandler>(sync_points);
    529  }
    530 
    531  std::shared_ptr<MediaHandler> chunker =
    532  CreateTextChunker(packaging_params.chunking_params);
    533 
    534  *root = parser;
    535 
    536  return ChainHandlers({std::move(parser), std::move(padder),
    537  std::move(cue_aligner), std::move(chunker),
    538  std::move(text_to_mp4), std::move(muxer)});
    539 }
    540 
    541 Status CreateTextJobs(
    542  const std::vector<std::reference_wrapper<const StreamDescriptor>>& streams,
    543  const PackagingParams& packaging_params,
    544  SyncPointQueue* sync_points,
    545  MuxerListenerFactory* muxer_listener_factory,
    546  MuxerFactory* muxer_factory,
    547  MpdNotifier* mpd_notifier,
    548  JobManager* job_manager) {
    549  DCHECK(muxer_listener_factory);
    550  DCHECK(job_manager);
    551  for (const StreamDescriptor& stream : streams) {
    552  // There are currently four options:
    553  // TEXT WEBVTT --> TEXT WEBVTT [ supported ]
    554  // TEXT WEBVTT --> MP4 WEBVTT [ supported ]
    555  // MP4 WEBVTT --> MP4 WEBVTT [ unsupported ]
    556  // MP4 WEBVTT --> TEXT WEBVTT [ unsupported ]
    557  const auto input_container = DetermineContainerFromFileName(stream.input);
    558  const auto output_container = GetOutputFormat(stream);
    559 
    560  if (input_container != CONTAINER_WEBVTT) {
    561  return Status(error::INVALID_ARGUMENT,
    562  "Text output format is not support for " + stream.input);
    563  }
    564 
    565  if (output_container == CONTAINER_MOV) {
    566  std::unique_ptr<MuxerListener> muxer_listener =
    567  muxer_listener_factory->CreateListener(ToMuxerListenerData(stream));
    568 
    569  std::shared_ptr<OriginHandler> root;
    570  RETURN_IF_ERROR(CreateWebVttToMp4TextJob(
    571  stream, packaging_params, std::move(muxer_listener), sync_points,
    572  muxer_factory, &root));
    573 
    574  job_manager->Add("MP4 text job", std::move(root));
    575  } else {
    576  std::unique_ptr<MuxerListener> hls_listener =
    577  muxer_listener_factory->CreateHlsListener(
    578  ToMuxerListenerData(stream));
    579 
    580  // Check input to ensure that output is possible.
    581  if (hls_listener) {
    582  if (stream.segment_template.empty() || !stream.output.empty()) {
    583  return Status(error::INVALID_ARGUMENT,
    584  "segment_template needs to be specified for HLS text "
    585  "output. Single file output is not supported yet.");
    586  }
    587  }
    588 
    589  if (mpd_notifier && !stream.segment_template.empty()) {
    590  return Status(error::INVALID_ARGUMENT,
    591  "Cannot create text output for MPD with segment output.");
    592  }
    593 
    594  // If we are outputting to HLS, then create the HLS test pipeline that
    595  // will create segmented text output.
    596  if (hls_listener) {
    597  RETURN_IF_ERROR(CreateHlsTextJob(stream, packaging_params,
    598  std::move(hls_listener), sync_points,
    599  job_manager));
    600  }
    601 
    602  if (!stream.output.empty()) {
    603  if (!File::Copy(stream.input.c_str(), stream.output.c_str())) {
    604  std::string error;
    605  base::StringAppendF(
    606  &error, "Failed to copy the input file (%s) to output file (%s).",
    607  stream.input.c_str(), stream.output.c_str());
    608  return Status(error::FILE_FAILURE, error);
    609  }
    610 
    611  MediaInfo text_media_info;
    612  if (!StreamInfoToTextMediaInfo(stream, &text_media_info)) {
    613  return Status(error::INVALID_ARGUMENT,
    614  "Could not create media info for stream.");
    615  }
    616 
    617  // If we are outputting to MPD, just add the input to the outputted
    618  // manifest.
    619  if (mpd_notifier) {
    620  uint32_t unused;
    621  if (mpd_notifier->NotifyNewContainer(text_media_info, &unused)) {
    622  mpd_notifier->Flush();
    623  } else {
    624  return Status(error::PARSER_FAILURE,
    625  "Failed to process text file " + stream.input);
    626  }
    627  }
    628 
    629  if (packaging_params.output_media_info) {
    631  text_media_info, stream.output + kMediaInfoSuffix);
    632  }
    633  }
    634  }
    635  }
    636 
    637  return Status::OK;
    638 }
    639 
    640 Status CreateAudioVideoJobs(
    641  const std::vector<std::reference_wrapper<const StreamDescriptor>>& streams,
    642  const PackagingParams& packaging_params,
    643  KeySource* encryption_key_source,
    644  SyncPointQueue* sync_points,
    645  MuxerListenerFactory* muxer_listener_factory,
    646  MuxerFactory* muxer_factory,
    647  JobManager* job_manager) {
    648  DCHECK(muxer_listener_factory);
    649  DCHECK(muxer_factory);
    650  DCHECK(job_manager);
    651  // Store all the demuxers in a map so that we can look up a stream's demuxer.
    652  // This is step one in making this part of the pipeline less dependant on
    653  // order.
    654  std::map<std::string, std::shared_ptr<Demuxer>> sources;
    655  std::map<std::string, std::shared_ptr<MediaHandler>> cue_aligners;
    656 
    657  for (const StreamDescriptor& stream : streams) {
    658  bool seen_input_before = sources.find(stream.input) != sources.end();
    659  if (seen_input_before) {
    660  continue;
    661  }
    662 
    663  RETURN_IF_ERROR(
    664  CreateDemuxer(stream, packaging_params, &sources[stream.input]));
    665  cue_aligners[stream.input] =
    666  sync_points ? std::make_shared<CueAlignmentHandler>(sync_points)
    667  : nullptr;
    668  }
    669 
    670  for (auto& source : sources) {
    671  job_manager->Add("RemuxJob", source.second);
    672  }
    673 
    674  // Replicators are shared among all streams with the same input and stream
    675  // selector.
    676  std::shared_ptr<MediaHandler> replicator;
    677 
    678  std::string previous_input;
    679  std::string previous_selector;
    680 
    681  for (const StreamDescriptor& stream : streams) {
    682  // Get the demuxer for this stream.
    683  auto& demuxer = sources[stream.input];
    684  auto& cue_aligner = cue_aligners[stream.input];
    685 
    686  const bool new_input_file = stream.input != previous_input;
    687  const bool new_stream =
    688  new_input_file || previous_selector != stream.stream_selector;
    689  previous_input = stream.input;
    690  previous_selector = stream.stream_selector;
    691 
    692  // If the stream has no output, then there is no reason setting-up the rest
    693  // of the pipeline.
    694  if (stream.output.empty() && stream.segment_template.empty()) {
    695  continue;
    696  }
    697 
    698  // Just because it is a different stream descriptor does not mean it is a
    699  // new stream. Multiple stream descriptors may have the same stream but
    700  // only differ by trick play factor.
    701  if (new_stream) {
    702  if (!stream.language.empty()) {
    703  demuxer->SetLanguageOverride(stream.stream_selector, stream.language);
    704  }
    705 
    706  replicator = std::make_shared<Replicator>();
    707  auto chunker =
    708  std::make_shared<ChunkingHandler>(packaging_params.chunking_params);
    709  auto encryptor = CreateEncryptionHandler(packaging_params, stream,
    710  encryption_key_source);
    711 
    712  // TODO(vaage) : Create a nicer way to connect handlers to demuxers.
    713  if (sync_points) {
    714  RETURN_IF_ERROR(
    715  ChainHandlers({cue_aligner, chunker, encryptor, replicator}));
    716  RETURN_IF_ERROR(
    717  demuxer->SetHandler(stream.stream_selector, cue_aligner));
    718  } else {
    719  RETURN_IF_ERROR(ChainHandlers({chunker, encryptor, replicator}));
    720  RETURN_IF_ERROR(demuxer->SetHandler(stream.stream_selector, chunker));
    721  }
    722  }
    723 
    724  // Create the muxer (output) for this track.
    725  std::shared_ptr<Muxer> muxer =
    726  muxer_factory->CreateMuxer(GetOutputFormat(stream), stream);
    727  if (!muxer) {
    728  return Status(error::INVALID_ARGUMENT, "Failed to create muxer for " +
    729  stream.input + ":" +
    730  stream.stream_selector);
    731  }
    732 
    733  std::unique_ptr<MuxerListener> muxer_listener =
    734  muxer_listener_factory->CreateListener(ToMuxerListenerData(stream));
    735  muxer->SetMuxerListener(std::move(muxer_listener));
    736 
    737  // Trick play is optional.
    738  std::shared_ptr<MediaHandler> trick_play =
    739  stream.trick_play_factor
    740  ? std::make_shared<TrickPlayHandler>(stream.trick_play_factor)
    741  : nullptr;
    742 
    743  RETURN_IF_ERROR(ChainHandlers({replicator, trick_play, muxer}));
    744  }
    745 
    746  return Status::OK;
    747 }
    748 
    749 Status CreateAllJobs(const std::vector<StreamDescriptor>& stream_descriptors,
    750  const PackagingParams& packaging_params,
    751  MpdNotifier* mpd_notifier,
    752  KeySource* encryption_key_source,
    753  SyncPointQueue* sync_points,
    754  MuxerListenerFactory* muxer_listener_factory,
    755  MuxerFactory* muxer_factory,
    756  JobManager* job_manager) {
    757  DCHECK(muxer_factory);
    758  DCHECK(muxer_listener_factory);
    759  DCHECK(job_manager);
    760 
    761  // Group all streams based on which pipeline they will use.
    762  std::vector<std::reference_wrapper<const StreamDescriptor>> text_streams;
    763  std::vector<std::reference_wrapper<const StreamDescriptor>>
    764  audio_video_streams;
    765 
    766  for (const StreamDescriptor& stream : stream_descriptors) {
    767  // TODO: Find a better way to determine what stream type a stream
    768  // descriptor is as |stream_selector| may use an index. This would
    769  // also allow us to use a simpler audio pipeline.
    770  if (stream.stream_selector == "text") {
    771  text_streams.push_back(stream);
    772  } else {
    773  audio_video_streams.push_back(stream);
    774  }
    775  }
    776 
    777  // Audio/Video streams need to be in sorted order so that demuxers and trick
    778  // play handlers get setup correctly.
    779  std::sort(audio_video_streams.begin(), audio_video_streams.end(),
    780  media::StreamDescriptorCompareFn);
    781 
    782  RETURN_IF_ERROR(CreateTextJobs(text_streams, packaging_params, sync_points,
    783  muxer_listener_factory, muxer_factory,
    784  mpd_notifier, job_manager));
    785  RETURN_IF_ERROR(CreateAudioVideoJobs(
    786  audio_video_streams, packaging_params, encryption_key_source, sync_points,
    787  muxer_listener_factory, muxer_factory, job_manager));
    788 
    789  // Initialize processing graph.
    790  return job_manager->InitializeJobs();
    791 }
    792 
    793 } // namespace
    794 } // namespace media
    795 
    796 struct Packager::PackagerInternal {
    797  media::FakeClock fake_clock;
    798  std::unique_ptr<KeySource> encryption_key_source;
    799  std::unique_ptr<MpdNotifier> mpd_notifier;
    800  std::unique_ptr<hls::HlsNotifier> hls_notifier;
    801  BufferCallbackParams buffer_callback_params;
    802  std::unique_ptr<media::JobManager> job_manager;
    803 };
    804 
    805 Packager::Packager() {}
    806 
    807 Packager::~Packager() {}
    808 
    810  const PackagingParams& packaging_params,
    811  const std::vector<StreamDescriptor>& stream_descriptors) {
    812  // Needed by base::WorkedPool used in ThreadedIoFile.
    813  static base::AtExitManager exit;
    814  static media::LibcryptoThreading libcrypto_threading;
    815 
    816  if (internal_)
    817  return Status(error::INVALID_ARGUMENT, "Already initialized.");
    818 
    819  RETURN_IF_ERROR(media::ValidateParams(packaging_params, stream_descriptors));
    820 
    821  if (!packaging_params.test_params.injected_library_version.empty()) {
    822  SetPackagerVersionForTesting(
    823  packaging_params.test_params.injected_library_version);
    824  }
    825 
    826  std::unique_ptr<PackagerInternal> internal(new PackagerInternal);
    827 
    828  // Create encryption key source if needed.
    829  if (packaging_params.encryption_params.key_provider != KeyProvider::kNone) {
    830  internal->encryption_key_source = CreateEncryptionKeySource(
    831  static_cast<media::FourCC>(
    832  packaging_params.encryption_params.protection_scheme),
    833  packaging_params.encryption_params);
    834  if (!internal->encryption_key_source)
    835  return Status(error::INVALID_ARGUMENT, "Failed to create key source.");
    836  }
    837 
    838  // Store callback params to make it available during packaging.
    839  internal->buffer_callback_params = packaging_params.buffer_callback_params;
    840 
    841  // Update MPD output and HLS output if callback param is specified.
    842  MpdParams mpd_params = packaging_params.mpd_params;
    843  HlsParams hls_params = packaging_params.hls_params;
    844  if (internal->buffer_callback_params.write_func) {
    846  internal->buffer_callback_params, mpd_params.mpd_output);
    848  internal->buffer_callback_params, hls_params.master_playlist_output);
    849  }
    850  // Both DASH and HLS require language to follow RFC5646
    851  // (https://tools.ietf.org/html/rfc5646), which requires the language to be
    852  // in the shortest form.
    853  mpd_params.default_language =
    855  hls_params.default_language =
    857 
    858  if (!mpd_params.mpd_output.empty()) {
    859  const bool on_demand_dash_profile =
    860  stream_descriptors.begin()->segment_template.empty();
    861  const double target_segment_duration =
    863  const MpdOptions mpd_options = media::GetMpdOptions(
    864  on_demand_dash_profile, mpd_params, target_segment_duration);
    865  internal->mpd_notifier.reset(new SimpleMpdNotifier(mpd_options));
    866  if (!internal->mpd_notifier->Init()) {
    867  LOG(ERROR) << "MpdNotifier failed to initialize.";
    868  return Status(error::INVALID_ARGUMENT,
    869  "Failed to initialize MpdNotifier.");
    870  }
    871  }
    872 
    873  if (!hls_params.master_playlist_output.empty()) {
    874  internal->hls_notifier.reset(new hls::SimpleHlsNotifier(hls_params));
    875  }
    876 
    877  std::unique_ptr<SyncPointQueue> sync_points;
    878  if (!packaging_params.ad_cue_generator_params.cue_points.empty()) {
    879  sync_points.reset(
    880  new SyncPointQueue(packaging_params.ad_cue_generator_params));
    881  }
    882  internal->job_manager.reset(new JobManager(std::move(sync_points)));
    883 
    884  std::vector<StreamDescriptor> streams_for_jobs;
    885 
    886  for (const StreamDescriptor& descriptor : stream_descriptors) {
    887  // We may need to overwrite some values, so make a copy first.
    888  StreamDescriptor copy = descriptor;
    889 
    890  if (internal->buffer_callback_params.read_func) {
    891  copy.input = File::MakeCallbackFileName(internal->buffer_callback_params,
    892  descriptor.input);
    893  }
    894 
    895  if (internal->buffer_callback_params.write_func) {
    896  copy.output = File::MakeCallbackFileName(internal->buffer_callback_params,
    897  descriptor.output);
    899  internal->buffer_callback_params, descriptor.segment_template);
    900  }
    901 
    902  // Update language to ISO_639_2 code if set.
    903  if (!copy.language.empty()) {
    904  copy.language = LanguageToISO_639_2(descriptor.language);
    905  if (copy.language == "und") {
    906  return Status(
    907  error::INVALID_ARGUMENT,
    908  "Unknown/invalid language specified: " + descriptor.language);
    909  }
    910  }
    911 
    912  streams_for_jobs.push_back(copy);
    913  }
    914 
    915  media::MuxerFactory muxer_factory(packaging_params);
    916  if (packaging_params.test_params.inject_fake_clock) {
    917  muxer_factory.OverrideClock(&internal->fake_clock);
    918  }
    919 
    920  media::MuxerListenerFactory muxer_listener_factory(
    921  packaging_params.output_media_info, internal->mpd_notifier.get(),
    922  internal->hls_notifier.get());
    923 
    924  RETURN_IF_ERROR(media::CreateAllJobs(
    925  streams_for_jobs, packaging_params, internal->mpd_notifier.get(),
    926  internal->encryption_key_source.get(),
    927  internal->job_manager->sync_points(), &muxer_listener_factory,
    928  &muxer_factory, internal->job_manager.get()));
    929 
    930  internal_ = std::move(internal);
    931  return Status::OK;
    932 }
    933 
    935  if (!internal_)
    936  return Status(error::INVALID_ARGUMENT, "Not yet initialized.");
    937 
    938  RETURN_IF_ERROR(internal_->job_manager->RunJobs());
    939 
    940  if (internal_->hls_notifier) {
    941  if (!internal_->hls_notifier->Flush())
    942  return Status(error::INVALID_ARGUMENT, "Failed to flush Hls.");
    943  }
    944  if (internal_->mpd_notifier) {
    945  if (!internal_->mpd_notifier->Flush())
    946  return Status(error::INVALID_ARGUMENT, "Failed to flush Mpd.");
    947  }
    948  return Status::OK;
    949 }
    950 
    952  if (!internal_) {
    953  LOG(INFO) << "Not yet initialized. Return directly.";
    954  return;
    955  }
    956  internal_->job_manager->CancelJobs();
    957 }
    958 
    960  return GetPackagerVersion();
    961 }
    962 
    964  int max_sd_pixels,
    965  int max_hd_pixels,
    966  int max_uhd1_pixels,
    967  const EncryptionParams::EncryptedStreamAttributes& stream_attributes) {
    968  if (stream_attributes.stream_type ==
    969  EncryptionParams::EncryptedStreamAttributes::kAudio)
    970  return "AUDIO";
    971  if (stream_attributes.stream_type ==
    972  EncryptionParams::EncryptedStreamAttributes::kVideo) {
    973  const int pixels = stream_attributes.oneof.video.width *
    974  stream_attributes.oneof.video.height;
    975  if (pixels <= max_sd_pixels)
    976  return "SD";
    977  if (pixels <= max_hd_pixels)
    978  return "HD";
    979  if (pixels <= max_uhd1_pixels)
    980  return "UHD1";
    981  return "UHD2";
    982  }
    983  return "";
    984 }
    985 
    986 } // namespace shaka
    BufferCallbackParams buffer_callback_params
    Buffer callback params.
    Definition: packager.h:62
    std::string master_playlist_output
    HLS master playlist output path.
    Definition: hls_params.h:27
    DASH MPD related parameters.
    Definition: mpd_params.h:16
    Defines a single input/output stream.
    Definition: packager.h:69
    std::string input
    Input/source media file path or network stream URL. Required.
    Definition: packager.h:71
    HlsParams hls_params
    HLS related parameters.
    Definition: packager.h:55
    -
    Status Initialize(const PackagingParams &packaging_params, const std::vector< StreamDescriptor > &stream_descriptors)
    Definition: packager.cc:829
    +
    Status Initialize(const PackagingParams &packaging_params, const std::vector< StreamDescriptor > &stream_descriptors)
    Definition: packager.cc:809
    std::string default_language
    Definition: mpd_params.h:56
    -
    static std::string DefaultStreamLabelFunction(int max_sd_pixels, int max_hd_pixels, int max_uhd1_pixels, const EncryptionParams::EncryptedStreamAttributes &stream_attributes)
    Definition: packager.cc:993
    +
    static std::string DefaultStreamLabelFunction(int max_sd_pixels, int max_hd_pixels, int max_uhd1_pixels, const EncryptionParams::EncryptedStreamAttributes &stream_attributes)
    Definition: packager.cc:963
    ChunkingParams chunking_params
    Chunking (segmentation) related parameters.
    Definition: packager.h:44
    std::vector< Cuepoint > cue_points
    List of cuepoints.
    HLS related parameters.
    Definition: hls_params.h:23
    @@ -86,7 +86,7 @@ $(function() {
    bool inject_fake_clock
    Definition: packager.h:31
    Convenience class which initializes and terminates libcrypto threading.
    All the methods that are virtual are virtual for mocking.
    -
    static std::string GetLibraryVersion()
    Definition: packager.cc:989
    +
    static std::string GetLibraryVersion()
    Definition: packager.cc:959
    std::string LanguageToISO_639_2(const std::string &language)
    std::string injected_library_version
    Definition: packager.h:34
    @@ -98,7 +98,7 @@ $(function() {
    std::string mpd_output
    MPD output file path.
    Definition: mpd_params.h:18
    A synchronized queue for cue points.
    -
    Status Run()
    Definition: packager.cc:962
    +
    Status Run()
    Definition: packager.cc:934
    static std::string MakeCallbackFileName(const BufferCallbackParams &callback_params, const std::string &name)
    Definition: file.cc:354
    std::string output
    Definition: packager.h:79
    @@ -108,7 +108,7 @@ $(function() {
    std::string default_language
    Definition: hls_params.h:48
    double segment_duration_in_seconds
    Segment duration in seconds.
    Defines Mpd Options.
    Definition: mpd_options.h:25
    -
    void Cancel()
    Cancel packaging. Note that it has to be called from another thread.
    Definition: packager.cc:981
    +
    void Cancel()
    Cancel packaging. Note that it has to be called from another thread.
    Definition: packager.cc:951
    Packaging parameters.
    Definition: packager.h:38
    static Status Open(const std::string &filename, std::unique_ptr< FileReader > *out)
    Definition: text_readers.cc:15
    @@ -117,7 +117,7 @@ $(function() {
    diff --git a/docs/d3/d51/classshaka_1_1media_1_1LibcryptoThreading.html b/docs/d3/d51/classshaka_1_1media_1_1LibcryptoThreading.html index fe7a9c4f26..d1e05e87c0 100644 --- a/docs/d3/d51/classshaka_1_1media_1_1LibcryptoThreading.html +++ b/docs/d3/d51/classshaka_1_1media_1_1LibcryptoThreading.html @@ -84,7 +84,7 @@ $(function() {
    diff --git a/docs/d3/d53/classshaka_1_1media_1_1JobManager.html b/docs/d3/d53/classshaka_1_1media_1_1JobManager.html index 81377ec854..db976daf82 100644 --- a/docs/d3/d53/classshaka_1_1media_1_1JobManager.html +++ b/docs/d3/d53/classshaka_1_1media_1_1JobManager.html @@ -102,7 +102,7 @@ void CancelJobs () diff --git a/docs/d3/d56/decrypt__config_8cc_source.html b/docs/d3/d56/decrypt__config_8cc_source.html index 68d9ae2733..888898eb93 100644 --- a/docs/d3/d56/decrypt__config_8cc_source.html +++ b/docs/d3/d56/decrypt__config_8cc_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d3/d5f/sync__point__queue_8h_source.html b/docs/d3/d5f/sync__point__queue_8h_source.html index b217033cb5..64c1e7cb0d 100644 --- a/docs/d3/d5f/sync__point__queue_8h_source.html +++ b/docs/d3/d5f/sync__point__queue_8h_source.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d3/d62/continuity__counter_8h_source.html b/docs/d3/d62/continuity__counter_8h_source.html index ffa301d95b..6c80a5027e 100644 --- a/docs/d3/d62/continuity__counter_8h_source.html +++ b/docs/d3/d62/continuity__counter_8h_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/d3/d62/rcheck_8h_source.html b/docs/d3/d62/rcheck_8h_source.html index a8dd2e16c3..11e0c06799 100644 --- a/docs/d3/d62/rcheck_8h_source.html +++ b/docs/d3/d62/rcheck_8h_source.html @@ -69,7 +69,7 @@ $(function() {
    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_BASE_RCHECK_H_
    6 #define PACKAGER_MEDIA_BASE_RCHECK_H_
    7 
    8 #include "packager/base/logging.h"
    9 
    10 #define RCHECK(x) \
    11  do { \
    12  if (!(x)) { \
    13  LOG(ERROR) << "Failure while processing: " << #x; \
    14  return false; \
    15  } \
    16  } while (0)
    17 
    18 #endif // PACKAGER_MEDIA_BASE_RCHECK_H_
    diff --git a/docs/d3/d66/structshaka_1_1media_1_1mp4_1_1DataEntryUrl-members.html b/docs/d3/d66/structshaka_1_1media_1_1mp4_1_1DataEntryUrl-members.html index b2246e2960..e3b4537b42 100644 --- a/docs/d3/d66/structshaka_1_1media_1_1mp4_1_1DataEntryUrl-members.html +++ b/docs/d3/d66/structshaka_1_1media_1_1mp4_1_1DataEntryUrl-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/d3/d67/classshaka_1_1media_1_1WebMVideoClient.html b/docs/d3/d67/classshaka_1_1media_1_1WebMVideoClient.html index 8c76508ed9..554b3b55b0 100644 --- a/docs/d3/d67/classshaka_1_1media_1_1WebMVideoClient.html +++ b/docs/d3/d67/classshaka_1_1media_1_1WebMVideoClient.html @@ -178,7 +178,7 @@ An empty pointer if there was unexpected values in the provided parameters or vi diff --git a/docs/d3/d6e/structshaka_1_1MpdParams_1_1UtcTiming.html b/docs/d3/d6e/structshaka_1_1MpdParams_1_1UtcTiming.html index b91577b3e7..6383844267 100644 --- a/docs/d3/d6e/structshaka_1_1MpdParams_1_1UtcTiming.html +++ b/docs/d3/d6e/structshaka_1_1MpdParams_1_1UtcTiming.html @@ -94,7 +94,7 @@ std::string value diff --git a/docs/d3/d6f/ad__cue__generator__params_8h_source.html b/docs/d3/d6f/ad__cue__generator__params_8h_source.html index 51624127e1..209f5e4a58 100644 --- a/docs/d3/d6f/ad__cue__generator__params_8h_source.html +++ b/docs/d3/d6f/ad__cue__generator__params_8h_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d3/d71/classshaka_1_1media_1_1mp2t_1_1TsMuxer.html b/docs/d3/d71/classshaka_1_1media_1_1mp2t_1_1TsMuxer.html index 6f24de3a7e..05980fbe59 100644 --- a/docs/d3/d71/classshaka_1_1media_1_1mp2t_1_1TsMuxer.html +++ b/docs/d3/d71/classshaka_1_1media_1_1mp2t_1_1TsMuxer.html @@ -204,7 +204,7 @@ const std::map< size_t, std::pair< std::shared_ptr< diff --git a/docs/d3/d73/classshaka_1_1File.html b/docs/d3/d73/classshaka_1_1File.html index bc532987ad..49a937e857 100644 --- a/docs/d3/d73/classshaka_1_1File.html +++ b/docs/d3/d73/classshaka_1_1File.html @@ -1007,7 +1007,7 @@ class ThreadedIoFile diff --git a/docs/d3/d73/classshaka_1_1media_1_1webm_1_1WebMMuxer.html b/docs/d3/d73/classshaka_1_1media_1_1webm_1_1WebMMuxer.html index e2e1ff0dfe..a705e2763e 100644 --- a/docs/d3/d73/classshaka_1_1media_1_1webm_1_1WebMMuxer.html +++ b/docs/d3/d73/classshaka_1_1media_1_1webm_1_1WebMMuxer.html @@ -208,7 +208,7 @@ const std::map< size_t, std::pair< std::shared_ptr< diff --git a/docs/d3/d75/classshaka_1_1media_1_1AesEncryptor.html b/docs/d3/d75/classshaka_1_1media_1_1AesEncryptor.html index 8c4d718944..be0cbcfbf5 100644 --- a/docs/d3/d75/classshaka_1_1media_1_1AesEncryptor.html +++ b/docs/d3/d75/classshaka_1_1media_1_1AesEncryptor.html @@ -215,7 +215,7 @@ AES_KEY * mutable_aes_key< diff --git a/docs/d3/d75/classshaka_1_1media_1_1mp4_1_1ChunkInfoIterator-members.html b/docs/d3/d75/classshaka_1_1media_1_1mp4_1_1ChunkInfoIterator-members.html index 1bc205321b..dbc059f257 100644 --- a/docs/d3/d75/classshaka_1_1media_1_1mp4_1_1ChunkInfoIterator-members.html +++ b/docs/d3/d75/classshaka_1_1media_1_1mp4_1_1ChunkInfoIterator-members.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/d3/d76/muxer__flags_8h_source.html b/docs/d3/d76/muxer__flags_8h_source.html index 6c95c5a24b..1000638a3a 100644 --- a/docs/d3/d76/muxer__flags_8h_source.html +++ b/docs/d3/d76/muxer__flags_8h_source.html @@ -69,7 +69,7 @@ $(function() {
    1 // Copyright 2014 Google Inc. All rights reserved.
    2 //
    3 // Use of this source code is governed by a BSD-style
    4 // license that can be found in the LICENSE file or at
    5 // https://developers.google.com/open-source/licenses/bsd
    6 //
    7 // Defines Muxer flags.
    8 
    9 #ifndef APP_MUXER_FLAGS_H_
    10 #define APP_MUXER_FLAGS_H_
    11 
    12 #include <gflags/gflags.h>
    13 
    14 DECLARE_double(clear_lead);
    15 DECLARE_double(segment_duration);
    16 DECLARE_bool(segment_sap_aligned);
    17 DECLARE_double(fragment_duration);
    18 DECLARE_bool(fragment_sap_aligned);
    19 DECLARE_int32(num_subsegments_per_sidx);
    20 DECLARE_string(temp_dir);
    21 DECLARE_bool(mp4_include_pssh_in_stream);
    22 DECLARE_bool(mp4_use_decoding_timestamp_in_timeline);
    23 
    24 #endif // APP_MUXER_FLAGS_H_
    diff --git a/docs/d3/d77/structshaka_1_1media_1_1mp4_1_1TextSampleEntry-members.html b/docs/d3/d77/structshaka_1_1media_1_1mp4_1_1TextSampleEntry-members.html index 633cdaab95..243e327355 100644 --- a/docs/d3/d77/structshaka_1_1media_1_1mp4_1_1TextSampleEntry-members.html +++ b/docs/d3/d77/structshaka_1_1media_1_1mp4_1_1TextSampleEntry-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/docs/d3/d7b/classshaka_1_1media_1_1RsaPublicKey-members.html b/docs/d3/d7b/classshaka_1_1media_1_1RsaPublicKey-members.html index ec80e4bdf1..0510cb7cdd 100644 --- a/docs/d3/d7b/classshaka_1_1media_1_1RsaPublicKey-members.html +++ b/docs/d3/d7b/classshaka_1_1media_1_1RsaPublicKey-members.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/d3/d7c/classshaka_1_1media_1_1WebMAudioClient.html b/docs/d3/d7c/classshaka_1_1media_1_1WebMAudioClient.html index 710b5f41c1..9328a2c997 100644 --- a/docs/d3/d7c/classshaka_1_1media_1_1WebMAudioClient.html +++ b/docs/d3/d7c/classshaka_1_1media_1_1WebMAudioClient.html @@ -200,7 +200,7 @@ An empty pointer if there was unexpected values in the provided parameters or au diff --git a/docs/d3/d80/muxer__util_8h_source.html b/docs/d3/d80/muxer__util_8h_source.html index 8ffc625971..ab5a7fdfca 100644 --- a/docs/d3/d80/muxer__util_8h_source.html +++ b/docs/d3/d80/muxer__util_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d3/d87/structshaka_1_1media_1_1mp4_1_1SampleToChunk.html b/docs/d3/d87/structshaka_1_1media_1_1mp4_1_1SampleToChunk.html index 0c3ef9ca6e..56c5c56d51 100644 --- a/docs/d3/d87/structshaka_1_1media_1_1mp4_1_1SampleToChunk.html +++ b/docs/d3/d87/structshaka_1_1media_1_1mp4_1_1SampleToChunk.html @@ -107,10 +107,10 @@ std::vector<   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

    @@ -121,7 +121,7 @@ Additional Inherited Members

    Detailed Description

    -

    Definition at line 435 of file box_definitions.h.

    +

    Definition at line 446 of file box_definitions.h.

    Member Function Documentation

    ◆ BoxType()

    @@ -149,7 +149,7 @@ Additional Inherited Members

    Implements shaka::media::mp4::Box.

    -

    Definition at line 749 of file box_definitions.cc.

    +

    Definition at line 761 of file box_definitions.cc.

    @@ -160,7 +160,7 @@ Additional Inherited Members diff --git a/docs/d3/d87/trick__play__handler_8cc_source.html b/docs/d3/d87/trick__play__handler_8cc_source.html index 07a82d1d44..270550b550 100644 --- a/docs/d3/d87/trick__play__handler_8cc_source.html +++ b/docs/d3/d87/trick__play__handler_8cc_source.html @@ -66,13 +66,13 @@ $(function() {
    trick_play_handler.cc
    -
    1 // Copyright 2017 Google Inc. All rights reserved.
    2 //
    3 // Use of this source code is governed by a BSD-style
    4 // license that can be found in the LICENSE file or at
    5 // https://developers.google.com/open-source/licenses/bsd
    6 
    7 #include "packager/media/trick_play/trick_play_handler.h"
    8 
    9 #include "packager/base/logging.h"
    10 #include "packager/media/base/video_stream_info.h"
    11 
    12 namespace shaka {
    13 namespace media {
    14 namespace {
    15 const size_t kStreamIndexIn = 0;
    16 const size_t kStreamIndexOut = 0;
    17 } // namespace
    18 
    19 TrickPlayHandler::TrickPlayHandler(uint32_t factor) : factor_(factor) {
    20  DCHECK_GE(factor, 1u)
    21  << "Trick Play Handles must have a factor of 1 or higher.";
    22 }
    23 
    24 Status TrickPlayHandler::InitializeInternal() {
    25  return Status::OK;
    26 }
    27 
    28 Status TrickPlayHandler::Process(std::unique_ptr<StreamData> stream_data) {
    29  DCHECK(stream_data);
    30  DCHECK_EQ(stream_data->stream_index, kStreamIndexIn);
    31 
    32  switch (stream_data->stream_data_type) {
    33  case StreamDataType::kStreamInfo:
    34  return OnStreamInfo(*stream_data->stream_info);
    35 
    36  case StreamDataType::kSegmentInfo:
    37  return OnSegmentInfo(std::move(stream_data->segment_info));
    38 
    39  case StreamDataType::kMediaSample:
    40  return OnMediaSample(*stream_data->media_sample);
    41 
    42  default:
    43  return Status(error::TRICK_PLAY_ERROR,
    44  "Trick play only supports stream info, segment info, and "
    45  "media sample messages.");
    46  }
    47 }
    48 
    49 Status TrickPlayHandler::OnFlushRequest(size_t input_stream_index) {
    50  DCHECK_EQ(input_stream_index, 0u);
    51 
    52  // Send everything out in its "as-is" state as we no longer need to update
    53  // anything.
    54  Status s;
    55  while (s.ok() && delayed_messages_.size()) {
    56  s.Update(Dispatch(std::move(delayed_messages_.front())));
    57  delayed_messages_.pop_front();
    58  }
    59 
    60  return s.ok() ? MediaHandler::FlushAllDownstreams() : s;
    61 }
    62 
    63 Status TrickPlayHandler::OnStreamInfo(const StreamInfo& info) {
    64  if (info.stream_type() != kStreamVideo) {
    65  return Status(error::TRICK_PLAY_ERROR,
    66  "Trick play does not support non-video stream");
    67  }
    68 
    69  // Copy the video so we can edit it. Set play back rate to be zero. It will be
    70  // updated later before being dispatched downstream.
    71  video_info_ = std::make_shared<VideoStreamInfo>(
    72  static_cast<const VideoStreamInfo&>(info));
    73 
    74  if (video_info_->trick_play_factor() > 0) {
    75  return Status(error::TRICK_PLAY_ERROR,
    76  "This stream is already a trick play stream.");
    77  }
    78 
    79  video_info_->set_trick_play_factor(factor_);
    80  video_info_->set_playback_rate(0);
    81 
    82  // Add video info to the message queue so that it can be sent out with all
    83  // other messages. It won't be sent until the second trick play frame comes
    84  // through. Until then, it can be updated via the |video_info_| member.
    85  delayed_messages_.push_back(
    86  StreamData::FromStreamInfo(kStreamIndexOut, video_info_));
    87 
    88  return Status::OK;
    89 }
    90 
    91 Status TrickPlayHandler::OnSegmentInfo(
    92  std::shared_ptr<const SegmentInfo> info) {
    93  if (delayed_messages_.empty()) {
    94  return Status(error::TRICK_PLAY_ERROR,
    95  "Cannot handle segments with no preceding samples.");
    96  }
    97 
    98  // Trick play does not care about sub segments, only full segments matter.
    99  if (info->is_subsegment) {
    100  return Status::OK;
    101  }
    102 
    103  const StreamDataType previous_type =
    104  delayed_messages_.back()->stream_data_type;
    105 
    106  switch (previous_type) {
    107  case StreamDataType::kSegmentInfo:
    108  // In the case that there was an empty segment (no trick frame between in
    109  // a segment) extend the previous segment to include the empty segment to
    110  // avoid holes.
    111  previous_segment_->duration += info->duration;
    112  return Status::OK;
    113 
    114  case StreamDataType::kMediaSample:
    115  // The segment has ended and there are media samples in the segment.
    116  // Add the segment info to the list of delayed messages. Segment info will
    117  // not get sent downstream until the next trick play frame comes through
    118  // or flush is called.
    119  previous_segment_ = std::make_shared<SegmentInfo>(*info);
    120  delayed_messages_.push_back(
    121  StreamData::FromSegmentInfo(kStreamIndexOut, previous_segment_));
    122  return Status::OK;
    123 
    124  default:
    125  return Status(error::TRICK_PLAY_ERROR,
    126  "Unexpected sample in trick play deferred queue : type=" +
    127  std::to_string(static_cast<int>(previous_type)));
    128  }
    129 }
    130 
    131 Status TrickPlayHandler::OnMediaSample(const MediaSample& sample) {
    132  total_frames_++;
    133 
    134  if (sample.is_key_frame()) {
    135  total_key_frames_++;
    136 
    137  if ((total_key_frames_ - 1) % factor_ == 0) {
    138  return OnTrickFrame(sample);
    139  }
    140  }
    141 
    142  // Update this now as it may be sent out soon via the delay message queue.
    143  if (total_trick_frames_ < 2) {
    144  // At this point, video_info will be at the head of the delay message queue
    145  // and can still be updated safely.
    146 
    147  // The play back rate is determined by the number of frames between the
    148  // first two trick play frames. The first trick play frame will be the
    149  // first frame in the video.
    150  video_info_->set_playback_rate(total_frames_);
    151  }
    152 
    153  // If the frame is not a trick play frame, then take the duration of this
    154  // frame and add it to the previous trick play frame so that it will span the
    155  // gap created by not passing this frame through.
    156  DCHECK(previous_trick_frame_);
    157  previous_trick_frame_->set_duration(previous_trick_frame_->duration() +
    158  sample.duration());
    159 
    160  return Status::OK;
    161 }
    162 
    163 Status TrickPlayHandler::OnTrickFrame(const MediaSample& sample) {
    164  total_trick_frames_++;
    165 
    166  // Make a message we can store until later.
    167  previous_trick_frame_ = sample.Clone();
    168 
    169  // Add the message to our queue so that it will be ready to go out.
    170  delayed_messages_.push_back(
    171  StreamData::FromMediaSample(kStreamIndexOut, previous_trick_frame_));
    172 
    173  // We need two trick play frames before we can send out our stream info, so we
    174  // cannot send this media sample until after we send our sample info
    175  // downstream.
    176  if (total_trick_frames_ < 2) {
    177  return Status::OK;
    178  }
    179 
    180  // Send out all delayed messages up until the new trick play frame we just
    181  // added.
    182  Status s;
    183  while (s.ok() && delayed_messages_.size() > 1) {
    184  s.Update(Dispatch(std::move(delayed_messages_.front())));
    185  delayed_messages_.pop_front();
    186  }
    187  return s;
    188 }
    189 
    190 } // namespace media
    191 } // namespace shaka
    Status Dispatch(std::unique_ptr< StreamData > stream_data) const
    +
    1 // Copyright 2017 Google Inc. All rights reserved.
    2 //
    3 // Use of this source code is governed by a BSD-style
    4 // license that can be found in the LICENSE file or at
    5 // https://developers.google.com/open-source/licenses/bsd
    6 
    7 #include "packager/media/trick_play/trick_play_handler.h"
    8 
    9 #include "packager/base/logging.h"
    10 #include "packager/media/base/video_stream_info.h"
    11 
    12 namespace shaka {
    13 namespace media {
    14 namespace {
    15 const size_t kStreamIndexIn = 0;
    16 const size_t kStreamIndexOut = 0;
    17 } // namespace
    18 
    19 TrickPlayHandler::TrickPlayHandler(uint32_t factor) : factor_(factor) {
    20  DCHECK_GE(factor, 1u)
    21  << "Trick Play Handles must have a factor of 1 or higher.";
    22 }
    23 
    24 Status TrickPlayHandler::InitializeInternal() {
    25  return Status::OK;
    26 }
    27 
    28 Status TrickPlayHandler::Process(std::unique_ptr<StreamData> stream_data) {
    29  DCHECK(stream_data);
    30  DCHECK_EQ(stream_data->stream_index, kStreamIndexIn);
    31 
    32  switch (stream_data->stream_data_type) {
    33  case StreamDataType::kStreamInfo:
    34  return OnStreamInfo(*stream_data->stream_info);
    35 
    36  case StreamDataType::kSegmentInfo:
    37  return OnSegmentInfo(std::move(stream_data->segment_info));
    38 
    39  case StreamDataType::kMediaSample:
    40  return OnMediaSample(*stream_data->media_sample);
    41 
    42  default:
    43  return Status(error::TRICK_PLAY_ERROR,
    44  "Trick play only supports stream info, segment info, and "
    45  "media sample messages.");
    46  }
    47 }
    48 
    49 Status TrickPlayHandler::OnFlushRequest(size_t input_stream_index) {
    50  DCHECK_EQ(input_stream_index, 0u);
    51 
    52  // Send everything out in its "as-is" state as we no longer need to update
    53  // anything.
    54  Status s;
    55  while (s.ok() && delayed_messages_.size()) {
    56  s.Update(Dispatch(std::move(delayed_messages_.front())));
    57  delayed_messages_.pop_front();
    58  }
    59 
    60  return s.ok() ? MediaHandler::FlushAllDownstreams() : s;
    61 }
    62 
    63 Status TrickPlayHandler::OnStreamInfo(const StreamInfo& info) {
    64  if (info.stream_type() != kStreamVideo) {
    65  return Status(error::TRICK_PLAY_ERROR,
    66  "Trick play does not support non-video stream");
    67  }
    68 
    69  // Copy the video so we can edit it. Set play back rate to be zero. It will be
    70  // updated later before being dispatched downstream.
    71  video_info_ = std::make_shared<VideoStreamInfo>(
    72  static_cast<const VideoStreamInfo&>(info));
    73 
    74  if (video_info_->trick_play_factor() > 0) {
    75  return Status(error::TRICK_PLAY_ERROR,
    76  "This stream is already a trick play stream.");
    77  }
    78 
    79  video_info_->set_trick_play_factor(factor_);
    80  video_info_->set_playback_rate(0);
    81 
    82  // Add video info to the message queue so that it can be sent out with all
    83  // other messages. It won't be sent until the second trick play frame comes
    84  // through. Until then, it can be updated via the |video_info_| member.
    85  delayed_messages_.push_back(
    86  StreamData::FromStreamInfo(kStreamIndexOut, video_info_));
    87 
    88  return Status::OK;
    89 }
    90 
    91 Status TrickPlayHandler::OnSegmentInfo(
    92  std::shared_ptr<const SegmentInfo> info) {
    93  if (delayed_messages_.empty()) {
    94  return Status(error::TRICK_PLAY_ERROR,
    95  "Cannot handle segments with no preceding samples.");
    96  }
    97 
    98  // Trick play does not care about sub segments, only full segments matter.
    99  if (info->is_subsegment) {
    100  return Status::OK;
    101  }
    102 
    103  const StreamDataType previous_type =
    104  delayed_messages_.back()->stream_data_type;
    105 
    106  switch (previous_type) {
    107  case StreamDataType::kSegmentInfo:
    108  // In the case that there was an empty segment (no trick frame between in
    109  // a segment) extend the previous segment to include the empty segment to
    110  // avoid holes.
    111  previous_segment_->duration += info->duration;
    112  return Status::OK;
    113 
    114  case StreamDataType::kMediaSample:
    115  // The segment has ended and there are media samples in the segment.
    116  // Add the segment info to the list of delayed messages. Segment info will
    117  // not get sent downstream until the next trick play frame comes through
    118  // or flush is called.
    119  previous_segment_ = std::make_shared<SegmentInfo>(*info);
    120  delayed_messages_.push_back(
    121  StreamData::FromSegmentInfo(kStreamIndexOut, previous_segment_));
    122  return Status::OK;
    123 
    124  default:
    125  return Status(error::TRICK_PLAY_ERROR,
    126  "Unexpected sample in trick play deferred queue : type=" +
    127  std::to_string(static_cast<int>(previous_type)));
    128  }
    129 }
    130 
    131 Status TrickPlayHandler::OnMediaSample(const MediaSample& sample) {
    132  total_frames_++;
    133 
    134  if (sample.is_key_frame()) {
    135  total_key_frames_++;
    136 
    137  if ((total_key_frames_ - 1) % factor_ == 0) {
    138  return OnTrickFrame(sample);
    139  }
    140  }
    141 
    142  // Update this now as it may be sent out soon via the delay message queue.
    143  if (total_trick_frames_ < 2) {
    144  // At this point, video_info will be at the head of the delay message queue
    145  // and can still be updated safely.
    146 
    147  // The play back rate is determined by the number of frames between the
    148  // first two trick play frames. The first trick play frame will be the
    149  // first frame in the video.
    150  video_info_->set_playback_rate(total_frames_);
    151  }
    152 
    153  // If the frame is not a trick play frame, then take the duration of this
    154  // frame and add it to the previous trick play frame so that it will span the
    155  // gap created by not passing this frame through.
    156  DCHECK(previous_trick_frame_);
    157  previous_trick_frame_->set_duration(previous_trick_frame_->duration() +
    158  sample.duration());
    159 
    160  return Status::OK;
    161 }
    162 
    163 Status TrickPlayHandler::OnTrickFrame(const MediaSample& sample) {
    164  total_trick_frames_++;
    165 
    166  // Make a message we can store until later.
    167  previous_trick_frame_ = sample.Clone();
    168 
    169  // Add the message to our queue so that it will be ready to go out.
    170  delayed_messages_.push_back(
    171  StreamData::FromMediaSample(kStreamIndexOut, previous_trick_frame_));
    172 
    173  // We need two trick play frames before we can send out our stream info, so we
    174  // cannot send this media sample until after we send our sample info
    175  // downstream.
    176  if (total_trick_frames_ < 2) {
    177  return Status::OK;
    178  }
    179 
    180  // Send out all delayed messages up until the new trick play frame we just
    181  // added.
    182  Status s;
    183  while (s.ok() && delayed_messages_.size() > 1) {
    184  s.Update(Dispatch(std::move(delayed_messages_.front())));
    185  delayed_messages_.pop_front();
    186  }
    187  return s;
    188 }
    189 
    190 } // namespace media
    191 } // namespace shaka
    Status Dispatch(std::unique_ptr< StreamData > stream_data) const
    All the methods that are virtual are virtual for mocking.
    -
    Status FlushAllDownstreams()
    Flush all connected downstream handlers.
    +
    Status FlushAllDownstreams()
    Flush all connected downstream handlers.
    diff --git a/docs/d3/d8d/webm__audio__client_8h_source.html b/docs/d3/d8d/webm__audio__client_8h_source.html index 7d2b0ca41f..ff08561fe3 100644 --- a/docs/d3/d8d/webm__audio__client_8h_source.html +++ b/docs/d3/d8d/webm__audio__client_8h_source.html @@ -74,7 +74,7 @@ $(function() {
    diff --git a/docs/d3/d90/ec3__audio__util_8cc_source.html b/docs/d3/d90/ec3__audio__util_8cc_source.html index 7efcb24f9d..737ac04dea 100644 --- a/docs/d3/d90/ec3__audio__util_8cc_source.html +++ b/docs/d3/d90/ec3__audio__util_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d3/d91/classshaka_1_1media_1_1H264Parser.html b/docs/d3/d91/classshaka_1_1media_1_1H264Parser.html index 2b2434dfdc..87212f4526 100644 --- a/docs/d3/d91/classshaka_1_1media_1_1H264Parser.html +++ b/docs/d3/d91/classshaka_1_1media_1_1H264Parser.html @@ -111,7 +111,7 @@ Result ParseSEI (const diff --git a/docs/d3/d93/media__handler_8h_source.html b/docs/d3/d93/media__handler_8h_source.html index b69a2fe1df..001796520b 100644 --- a/docs/d3/d93/media__handler_8h_source.html +++ b/docs/d3/d93/media__handler_8h_source.html @@ -66,25 +66,25 @@ $(function() {
    media_handler.h
    -
    1 // Copyright 2017 Google Inc. All rights reserved.
    2 //
    3 // Use of this source code is governed by a BSD-style
    4 // license that can be found in the LICENSE file or at
    5 // https://developers.google.com/open-source/licenses/bsd
    6 
    7 #ifndef PACKAGER_MEDIA_BASE_MEDIA_HANDLER_H_
    8 #define PACKAGER_MEDIA_BASE_MEDIA_HANDLER_H_
    9 
    10 #include <map>
    11 #include <memory>
    12 #include <utility>
    13 
    14 #include "packager/media/base/media_sample.h"
    15 #include "packager/media/base/stream_info.h"
    16 #include "packager/media/base/text_sample.h"
    17 #include "packager/status.h"
    18 
    19 namespace shaka {
    20 namespace media {
    21 
    22 enum class StreamDataType {
    23  kUnknown,
    24  kStreamInfo,
    25  kMediaSample,
    26  kTextSample,
    27  kSegmentInfo,
    28  kScte35Event,
    29  kCueEvent,
    30 };
    31 
    32 // Scte35Event represents cuepoint markers in input streams. It will be used
    33 // to represent out of band cuepoint markers too.
    34 struct Scte35Event {
    35  std::string id;
    36  // Segmentation type id from SCTE35 segmentation descriptor.
    37  int type = 0;
    38  double start_time_in_seconds = 0;
    39  double duration_in_seconds = 0;
    40  std::string cue_data;
    41 };
    42 
    43 enum class CueEventType { kCueIn, kCueOut, kCuePoint };
    44 
    45 // In server-based model, Chunking Handler consolidates SCTE-35 events and
    46 // generates CueEvent before an ad is about to be inserted.
    47 struct CueEvent {
    48  CueEventType type = CueEventType::kCuePoint;
    49  double time_in_seconds;
    50  std::string cue_data;
    51 };
    52 
    53 struct SegmentInfo {
    54  bool is_subsegment = false;
    55  bool is_encrypted = false;
    56  int64_t start_timestamp = -1;
    57  int64_t duration = 0;
    58  // This is only available if key rotation is enabled. Note that we may have
    59  // a |key_rotation_encryption_config| even if the segment is not encrypted,
    60  // which is the case for clear lead.
    61  std::shared_ptr<EncryptionConfig> key_rotation_encryption_config;
    62 };
    63 
    64 // TODO(kqyang): Should we use protobuf?
    65 struct StreamData {
    66  size_t stream_index = static_cast<size_t>(-1);
    67  StreamDataType stream_data_type = StreamDataType::kUnknown;
    68 
    69  std::shared_ptr<const StreamInfo> stream_info;
    70  std::shared_ptr<const MediaSample> media_sample;
    71  std::shared_ptr<const TextSample> text_sample;
    72  std::shared_ptr<const SegmentInfo> segment_info;
    73  std::shared_ptr<const Scte35Event> scte35_event;
    74  std::shared_ptr<const CueEvent> cue_event;
    75 
    76  static std::unique_ptr<StreamData> FromStreamInfo(
    77  size_t stream_index, std::shared_ptr<const StreamInfo> stream_info) {
    78  std::unique_ptr<StreamData> stream_data(new StreamData);
    79  stream_data->stream_index = stream_index;
    80  stream_data->stream_data_type = StreamDataType::kStreamInfo;
    81  stream_data->stream_info = std::move(stream_info);
    82  return stream_data;
    83  }
    84 
    85  static std::unique_ptr<StreamData> FromMediaSample(
    86  size_t stream_index, std::shared_ptr<const MediaSample> media_sample) {
    87  std::unique_ptr<StreamData> stream_data(new StreamData);
    88  stream_data->stream_index = stream_index;
    89  stream_data->stream_data_type = StreamDataType::kMediaSample;
    90  stream_data->media_sample = std::move(media_sample);
    91  return stream_data;
    92  }
    93 
    94  static std::unique_ptr<StreamData> FromTextSample(
    95  size_t stream_index, std::shared_ptr<const TextSample> text_sample) {
    96  std::unique_ptr<StreamData> stream_data(new StreamData);
    97  stream_data->stream_index = stream_index;
    98  stream_data->stream_data_type = StreamDataType::kTextSample;
    99  stream_data->text_sample = std::move(text_sample);
    100  return stream_data;
    101  }
    102 
    103  static std::unique_ptr<StreamData> FromSegmentInfo(
    104  size_t stream_index, std::shared_ptr<const SegmentInfo> segment_info) {
    105  std::unique_ptr<StreamData> stream_data(new StreamData);
    106  stream_data->stream_index = stream_index;
    107  stream_data->stream_data_type = StreamDataType::kSegmentInfo;
    108  stream_data->segment_info = std::move(segment_info);
    109  return stream_data;
    110  }
    111 
    112  static std::unique_ptr<StreamData> FromScte35Event(
    113  size_t stream_index,
    114  std::shared_ptr<const Scte35Event> scte35_event) {
    115  std::unique_ptr<StreamData> stream_data(new StreamData);
    116  stream_data->stream_index = stream_index;
    117  stream_data->stream_data_type = StreamDataType::kScte35Event;
    118  stream_data->scte35_event = std::move(scte35_event);
    119  return stream_data;
    120  }
    121 
    122  static std::unique_ptr<StreamData> FromCueEvent(
    123  size_t stream_index,
    124  std::shared_ptr<const CueEvent> cue_event) {
    125  std::unique_ptr<StreamData> stream_data(new StreamData);
    126  stream_data->stream_index = stream_index;
    127  stream_data->stream_data_type = StreamDataType::kCueEvent;
    128  stream_data->cue_event = std::move(cue_event);
    129  return stream_data;
    130  }
    131 };
    132 
    149  public:
    150  MediaHandler() = default;
    151  virtual ~MediaHandler() = default;
    152 
    154  Status SetHandler(size_t output_stream_index,
    155  std::shared_ptr<MediaHandler> handler);
    156 
    158  Status AddHandler(std::shared_ptr<MediaHandler> handler) {
    159  return SetHandler(next_output_stream_index_, handler);
    160  }
    161 
    164  Status Initialize();
    165 
    167  bool IsConnected() { return num_input_streams_ > 0; }
    168 
    169  protected:
    172  virtual Status InitializeInternal() = 0;
    173 
    178  virtual Status Process(std::unique_ptr<StreamData> stream_data) = 0;
    179 
    181  virtual Status OnFlushRequest(size_t input_stream_index);
    182 
    184  virtual bool ValidateOutputStreamIndex(size_t stream_index) const;
    185 
    188  Status Dispatch(std::unique_ptr<StreamData> stream_data) const;
    189 
    192  size_t stream_index,
    193  std::shared_ptr<const StreamInfo> stream_info) const {
    194  return Dispatch(
    195  StreamData::FromStreamInfo(stream_index, std::move(stream_info)));
    196  }
    197 
    200  size_t stream_index,
    201  std::shared_ptr<const MediaSample> media_sample) const {
    202  return Dispatch(
    203  StreamData::FromMediaSample(stream_index, std::move(media_sample)));
    204  }
    205 
    207  // DispatchTextSample should only be override for testing.
    209  size_t stream_index,
    210  std::shared_ptr<const TextSample> text_sample) const {
    211  return Dispatch(
    212  StreamData::FromTextSample(stream_index, std::move(text_sample)));
    213  }
    214 
    217  size_t stream_index,
    218  std::shared_ptr<const SegmentInfo> segment_info) const {
    219  return Dispatch(
    220  StreamData::FromSegmentInfo(stream_index, std::move(segment_info)));
    221  }
    222 
    225  size_t stream_index,
    226  std::shared_ptr<const Scte35Event> scte35_event) const {
    227  return Dispatch(
    228  StreamData::FromScte35Event(stream_index, std::move(scte35_event)));
    229  }
    230 
    232  Status DispatchCueEvent(size_t stream_index,
    233  std::shared_ptr<const CueEvent> cue_event) const {
    234  return Dispatch(
    235  StreamData::FromCueEvent(stream_index, std::move(cue_event)));
    236  }
    237 
    239  Status FlushDownstream(size_t output_stream_index);
    240 
    242  Status FlushAllDownstreams();
    243 
    244  bool initialized() { return initialized_; }
    245  size_t num_input_streams() const { return num_input_streams_; }
    246  size_t next_output_stream_index() const { return next_output_stream_index_; }
    247  const std::map<size_t, std::pair<std::shared_ptr<MediaHandler>, size_t>>&
    248  output_handlers() {
    249  return output_handlers_;
    250  }
    251 
    252  private:
    253  MediaHandler(const MediaHandler&) = delete;
    254  MediaHandler& operator=(const MediaHandler&) = delete;
    255 
    256  bool initialized_ = false;
    257  // Number of input streams.
    258  size_t num_input_streams_ = 0;
    259  // The next available output stream index, used by AddHandler.
    260  size_t next_output_stream_index_ = 0;
    261  // output stream index -> {output handler, output handler input stream index}
    262  // map.
    263  std::map<size_t, std::pair<std::shared_ptr<MediaHandler>, size_t>>
    264  output_handlers_;
    265 };
    266 
    267 } // namespace media
    268 } // namespace shaka
    269 
    270 #endif // PACKAGER_MEDIA_BASE_MEDIA_HANDLER_H_
    Status DispatchStreamInfo(size_t stream_index, std::shared_ptr< const StreamInfo > stream_info) const
    Dispatch the stream info to downstream handlers.
    - - - -
    bool IsConnected()
    Validate if the handler is connected to its upstream handler.
    +
    1 // Copyright 2017 Google Inc. All rights reserved.
    2 //
    3 // Use of this source code is governed by a BSD-style
    4 // license that can be found in the LICENSE file or at
    5 // https://developers.google.com/open-source/licenses/bsd
    6 
    7 #ifndef PACKAGER_MEDIA_BASE_MEDIA_HANDLER_H_
    8 #define PACKAGER_MEDIA_BASE_MEDIA_HANDLER_H_
    9 
    10 #include <map>
    11 #include <memory>
    12 #include <utility>
    13 
    14 #include "packager/media/base/media_sample.h"
    15 #include "packager/media/base/stream_info.h"
    16 #include "packager/media/base/text_sample.h"
    17 #include "packager/status.h"
    18 
    19 namespace shaka {
    20 namespace media {
    21 
    22 enum class StreamDataType {
    23  kUnknown,
    24  kStreamInfo,
    25  kMediaSample,
    26  kTextSample,
    27  kSegmentInfo,
    28  kScte35Event,
    29  kCueEvent,
    30 };
    31 
    32 std::string StreamDataTypeToString(StreamDataType type);
    33 
    34 // Scte35Event represents cuepoint markers in input streams. It will be used
    35 // to represent out of band cuepoint markers too.
    36 struct Scte35Event {
    37  std::string id;
    38  // Segmentation type id from SCTE35 segmentation descriptor.
    39  int type = 0;
    40  double start_time_in_seconds = 0;
    41  double duration_in_seconds = 0;
    42  std::string cue_data;
    43 };
    44 
    45 enum class CueEventType { kCueIn, kCueOut, kCuePoint };
    46 
    47 // In server-based model, Chunking Handler consolidates SCTE-35 events and
    48 // generates CueEvent before an ad is about to be inserted.
    49 struct CueEvent {
    50  CueEventType type = CueEventType::kCuePoint;
    51  double time_in_seconds;
    52  std::string cue_data;
    53 };
    54 
    55 struct SegmentInfo {
    56  bool is_subsegment = false;
    57  bool is_encrypted = false;
    58  int64_t start_timestamp = -1;
    59  int64_t duration = 0;
    60  // This is only available if key rotation is enabled. Note that we may have
    61  // a |key_rotation_encryption_config| even if the segment is not encrypted,
    62  // which is the case for clear lead.
    63  std::shared_ptr<EncryptionConfig> key_rotation_encryption_config;
    64 };
    65 
    66 // TODO(kqyang): Should we use protobuf?
    67 struct StreamData {
    68  size_t stream_index = static_cast<size_t>(-1);
    69  StreamDataType stream_data_type = StreamDataType::kUnknown;
    70 
    71  std::shared_ptr<const StreamInfo> stream_info;
    72  std::shared_ptr<const MediaSample> media_sample;
    73  std::shared_ptr<const TextSample> text_sample;
    74  std::shared_ptr<const SegmentInfo> segment_info;
    75  std::shared_ptr<const Scte35Event> scte35_event;
    76  std::shared_ptr<const CueEvent> cue_event;
    77 
    78  static std::unique_ptr<StreamData> FromStreamInfo(
    79  size_t stream_index, std::shared_ptr<const StreamInfo> stream_info) {
    80  std::unique_ptr<StreamData> stream_data(new StreamData);
    81  stream_data->stream_index = stream_index;
    82  stream_data->stream_data_type = StreamDataType::kStreamInfo;
    83  stream_data->stream_info = std::move(stream_info);
    84  return stream_data;
    85  }
    86 
    87  static std::unique_ptr<StreamData> FromMediaSample(
    88  size_t stream_index, std::shared_ptr<const MediaSample> media_sample) {
    89  std::unique_ptr<StreamData> stream_data(new StreamData);
    90  stream_data->stream_index = stream_index;
    91  stream_data->stream_data_type = StreamDataType::kMediaSample;
    92  stream_data->media_sample = std::move(media_sample);
    93  return stream_data;
    94  }
    95 
    96  static std::unique_ptr<StreamData> FromTextSample(
    97  size_t stream_index, std::shared_ptr<const TextSample> text_sample) {
    98  std::unique_ptr<StreamData> stream_data(new StreamData);
    99  stream_data->stream_index = stream_index;
    100  stream_data->stream_data_type = StreamDataType::kTextSample;
    101  stream_data->text_sample = std::move(text_sample);
    102  return stream_data;
    103  }
    104 
    105  static std::unique_ptr<StreamData> FromSegmentInfo(
    106  size_t stream_index, std::shared_ptr<const SegmentInfo> segment_info) {
    107  std::unique_ptr<StreamData> stream_data(new StreamData);
    108  stream_data->stream_index = stream_index;
    109  stream_data->stream_data_type = StreamDataType::kSegmentInfo;
    110  stream_data->segment_info = std::move(segment_info);
    111  return stream_data;
    112  }
    113 
    114  static std::unique_ptr<StreamData> FromScte35Event(
    115  size_t stream_index,
    116  std::shared_ptr<const Scte35Event> scte35_event) {
    117  std::unique_ptr<StreamData> stream_data(new StreamData);
    118  stream_data->stream_index = stream_index;
    119  stream_data->stream_data_type = StreamDataType::kScte35Event;
    120  stream_data->scte35_event = std::move(scte35_event);
    121  return stream_data;
    122  }
    123 
    124  static std::unique_ptr<StreamData> FromCueEvent(
    125  size_t stream_index,
    126  std::shared_ptr<const CueEvent> cue_event) {
    127  std::unique_ptr<StreamData> stream_data(new StreamData);
    128  stream_data->stream_index = stream_index;
    129  stream_data->stream_data_type = StreamDataType::kCueEvent;
    130  stream_data->cue_event = std::move(cue_event);
    131  return stream_data;
    132  }
    133 };
    134 
    151  public:
    152  MediaHandler() = default;
    153  virtual ~MediaHandler() = default;
    154 
    156  Status SetHandler(size_t output_stream_index,
    157  std::shared_ptr<MediaHandler> handler);
    158 
    160  Status AddHandler(std::shared_ptr<MediaHandler> handler) {
    161  return SetHandler(next_output_stream_index_, handler);
    162  }
    163 
    166  Status Initialize();
    167 
    169  bool IsConnected() { return num_input_streams_ > 0; }
    170 
    171  protected:
    174  virtual Status InitializeInternal() = 0;
    175 
    180  virtual Status Process(std::unique_ptr<StreamData> stream_data) = 0;
    181 
    183  virtual Status OnFlushRequest(size_t input_stream_index);
    184 
    186  virtual bool ValidateOutputStreamIndex(size_t stream_index) const;
    187 
    190  Status Dispatch(std::unique_ptr<StreamData> stream_data) const;
    191 
    194  size_t stream_index,
    195  std::shared_ptr<const StreamInfo> stream_info) const {
    196  return Dispatch(
    197  StreamData::FromStreamInfo(stream_index, std::move(stream_info)));
    198  }
    199 
    202  size_t stream_index,
    203  std::shared_ptr<const MediaSample> media_sample) const {
    204  return Dispatch(
    205  StreamData::FromMediaSample(stream_index, std::move(media_sample)));
    206  }
    207 
    209  // DispatchTextSample should only be override for testing.
    211  size_t stream_index,
    212  std::shared_ptr<const TextSample> text_sample) const {
    213  return Dispatch(
    214  StreamData::FromTextSample(stream_index, std::move(text_sample)));
    215  }
    216 
    219  size_t stream_index,
    220  std::shared_ptr<const SegmentInfo> segment_info) const {
    221  return Dispatch(
    222  StreamData::FromSegmentInfo(stream_index, std::move(segment_info)));
    223  }
    224 
    227  size_t stream_index,
    228  std::shared_ptr<const Scte35Event> scte35_event) const {
    229  return Dispatch(
    230  StreamData::FromScte35Event(stream_index, std::move(scte35_event)));
    231  }
    232 
    234  Status DispatchCueEvent(size_t stream_index,
    235  std::shared_ptr<const CueEvent> cue_event) const {
    236  return Dispatch(
    237  StreamData::FromCueEvent(stream_index, std::move(cue_event)));
    238  }
    239 
    241  Status FlushDownstream(size_t output_stream_index);
    242 
    244  Status FlushAllDownstreams();
    245 
    246  bool initialized() { return initialized_; }
    247  size_t num_input_streams() const { return num_input_streams_; }
    248  size_t next_output_stream_index() const { return next_output_stream_index_; }
    249  const std::map<size_t, std::pair<std::shared_ptr<MediaHandler>, size_t>>&
    250  output_handlers() {
    251  return output_handlers_;
    252  }
    253 
    254  private:
    255  MediaHandler(const MediaHandler&) = delete;
    256  MediaHandler& operator=(const MediaHandler&) = delete;
    257 
    258  bool initialized_ = false;
    259  // Number of input streams.
    260  size_t num_input_streams_ = 0;
    261  // The next available output stream index, used by AddHandler.
    262  size_t next_output_stream_index_ = 0;
    263  // output stream index -> {output handler, output handler input stream index}
    264  // map.
    265  std::map<size_t, std::pair<std::shared_ptr<MediaHandler>, size_t>>
    266  output_handlers_;
    267 };
    268 
    269 } // namespace media
    270 } // namespace shaka
    271 
    272 #endif // PACKAGER_MEDIA_BASE_MEDIA_HANDLER_H_
    Status DispatchStreamInfo(size_t stream_index, std::shared_ptr< const StreamInfo > stream_info) const
    Dispatch the stream info to downstream handlers.
    + + + +
    bool IsConnected()
    Validate if the handler is connected to its upstream handler.
    All the methods that are virtual are virtual for mocking.
    - + -
    Status DispatchTextSample(size_t stream_index, std::shared_ptr< const TextSample > text_sample) const
    Dispatch the text sample to downstream handlers.
    -
    Status AddHandler(std::shared_ptr< MediaHandler > handler)
    Connect downstream handler to the next available output stream index.
    -
    Status DispatchSegmentInfo(size_t stream_index, std::shared_ptr< const SegmentInfo > segment_info) const
    Dispatch the segment info to downstream handlers.
    -
    Status DispatchCueEvent(size_t stream_index, std::shared_ptr< const CueEvent > cue_event) const
    Dispatch the cue event to downstream handlers.
    -
    Status DispatchScte35Event(size_t stream_index, std::shared_ptr< const Scte35Event > scte35_event) const
    Dispatch the scte35 event to downstream handlers.
    - -
    Status DispatchMediaSample(size_t stream_index, std::shared_ptr< const MediaSample > media_sample) const
    Dispatch the media sample to downstream handlers.
    +
    Status DispatchTextSample(size_t stream_index, std::shared_ptr< const TextSample > text_sample) const
    Dispatch the text sample to downstream handlers.
    +
    Status AddHandler(std::shared_ptr< MediaHandler > handler)
    Connect downstream handler to the next available output stream index.
    +
    Status DispatchSegmentInfo(size_t stream_index, std::shared_ptr< const SegmentInfo > segment_info) const
    Dispatch the segment info to downstream handlers.
    +
    Status DispatchCueEvent(size_t stream_index, std::shared_ptr< const CueEvent > cue_event) const
    Dispatch the cue event to downstream handlers.
    +
    Status DispatchScte35Event(size_t stream_index, std::shared_ptr< const Scte35Event > scte35_event) const
    Dispatch the scte35 event to downstream handlers.
    + +
    Status DispatchMediaSample(size_t stream_index, std::shared_ptr< const MediaSample > media_sample) const
    Dispatch the media sample to downstream handlers.
    diff --git a/docs/d3/d95/classshaka_1_1hls_1_1MockMediaPlaylist.html b/docs/d3/d95/classshaka_1_1hls_1_1MockMediaPlaylist.html index 1f656dbdbe..7ecd97c8d4 100644 --- a/docs/d3/d95/classshaka_1_1hls_1_1MockMediaPlaylist.html +++ b/docs/d3/d95/classshaka_1_1hls_1_1MockMediaPlaylist.html @@ -202,7 +202,7 @@ Additional Inherited Members
    diff --git a/docs/d3/d9a/classshaka_1_1media_1_1MediaHandlerGraphTestBase.html b/docs/d3/d9a/classshaka_1_1media_1_1MediaHandlerGraphTestBase.html index b1d2750f8b..1773666ba1 100644 --- a/docs/d3/d9a/classshaka_1_1media_1_1MediaHandlerGraphTestBase.html +++ b/docs/d3/d9a/classshaka_1_1media_1_1MediaHandlerGraphTestBase.html @@ -147,7 +147,7 @@ std::unique_ptr<

    Detailed Description

    -

    Definition at line 267 of file media_handler_test_base.h.

    +

    Definition at line 266 of file media_handler_test_base.h.

    Member Function Documentation

    ◆ GetOutputStreamDataVector()

    @@ -173,7 +173,7 @@ std::unique_ptr<
    Returns
    the output stream data vector from handler.
    -

    Definition at line 331 of file media_handler_test_base.cc.

    +

    Definition at line 311 of file media_handler_test_base.cc.

    @@ -201,7 +201,7 @@ std::unique_ptr<
    Returns
    some a downstream handler that can be used for connecting.
    -

    Definition at line 288 of file media_handler_test_base.h.

    +

    Definition at line 287 of file media_handler_test_base.h.

    @@ -229,7 +229,7 @@ std::unique_ptr<
    Returns
    some random handler that can be used for testing.
    -

    Definition at line 285 of file media_handler_test_base.h.

    +

    Definition at line 284 of file media_handler_test_base.h.

    @@ -240,7 +240,7 @@ std::unique_ptr< diff --git a/docs/d3/d9c/encryption__handler_8cc_source.html b/docs/d3/d9c/encryption__handler_8cc_source.html index b524299e04..4844b4ea65 100644 --- a/docs/d3/d9c/encryption__handler_8cc_source.html +++ b/docs/d3/d9c/encryption__handler_8cc_source.html @@ -73,7 +73,7 @@ $(function() {
    const uint8_t * data() const
    This is the pointer to the Nalu data, pointing to the header.
    Definition: nalu_reader.h:97
    - +
    All the methods that are virtual are virtual for mocking.
    @@ -98,7 +98,7 @@ $(function() { diff --git a/docs/d3/da0/ec3__audio__util_8h_source.html b/docs/d3/da0/ec3__audio__util_8h_source.html index 3fbbf58dfc..1d1418c385 100644 --- a/docs/d3/da0/ec3__audio__util_8h_source.html +++ b/docs/d3/da0/ec3__audio__util_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d3/da1/classshaka_1_1media_1_1webm_1_1SingleSegmentSegmenter.html b/docs/d3/da1/classshaka_1_1media_1_1webm_1_1SingleSegmentSegmenter.html index 0d0a2c478d..62ca6e4e83 100644 --- a/docs/d3/da1/classshaka_1_1media_1_1webm_1_1SingleSegmentSegmenter.html +++ b/docs/d3/da1/classshaka_1_1media_1_1webm_1_1SingleSegmentSegmenter.html @@ -282,7 +282,7 @@ uint64_t duration () c diff --git a/docs/d3/da2/structshaka_1_1media_1_1mp4_1_1SchemeType.html b/docs/d3/da2/structshaka_1_1media_1_1mp4_1_1SchemeType.html index 4290999267..6cd41a1055 100644 --- a/docs/d3/da2/structshaka_1_1media_1_1mp4_1_1SchemeType.html +++ b/docs/d3/da2/structshaka_1_1media_1_1mp4_1_1SchemeType.html @@ -103,17 +103,17 @@ Public Member Functions

    Public Attributes

    -FourCC type +FourCC type = FOURCC_NULL   -uint32_t version +uint32_t version = 0u   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

    @@ -124,7 +124,7 @@ Additional Inherited Members

    Detailed Description

    -

    Definition at line 137 of file box_definitions.h.

    +

    Definition at line 136 of file box_definitions.h.

    Member Function Documentation

    ◆ BoxType()

    @@ -152,7 +152,7 @@ Additional Inherited Members

    Implements shaka::media::mp4::Box.

    -

    Definition at line 389 of file box_definitions.cc.

    +

    Definition at line 401 of file box_definitions.cc.

    @@ -163,7 +163,7 @@ Additional Inherited Members diff --git a/docs/d3/da5/structshaka_1_1MpdParams_1_1UtcTiming-members.html b/docs/d3/da5/structshaka_1_1MpdParams_1_1UtcTiming-members.html index 0e1202a02c..5bf23e715e 100644 --- a/docs/d3/da5/structshaka_1_1MpdParams_1_1UtcTiming-members.html +++ b/docs/d3/da5/structshaka_1_1MpdParams_1_1UtcTiming-members.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d3/dad/structshaka_1_1media_1_1mp4_1_1ID3v2.html b/docs/d3/dad/structshaka_1_1media_1_1mp4_1_1ID3v2.html index 11a5878249..5553427c00 100644 --- a/docs/d3/dad/structshaka_1_1media_1_1mp4_1_1ID3v2.html +++ b/docs/d3/dad/structshaka_1_1media_1_1mp4_1_1ID3v2.html @@ -115,10 +115,10 @@ std::vector< uint8_t >    - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

    Implements shaka::media::mp4::Box.

    -

    Definition at line 1329 of file box_definitions.cc.

    +

    Definition at line 1359 of file box_definitions.cc.

    @@ -169,7 +169,7 @@ Additional Inherited Members diff --git a/docs/d3/db3/classshaka_1_1media_1_1RawKeyPsshGenerator.html b/docs/d3/db3/classshaka_1_1media_1_1RawKeyPsshGenerator.html index a98dd230ad..0623e30a0b 100644 --- a/docs/d3/db3/classshaka_1_1media_1_1RawKeyPsshGenerator.html +++ b/docs/d3/db3/classshaka_1_1media_1_1RawKeyPsshGenerator.html @@ -130,7 +130,7 @@ Public Member Functions diff --git a/docs/d3/db4/classshaka_1_1media_1_1WebMWebVTTParser-members.html b/docs/d3/db4/classshaka_1_1media_1_1WebMWebVTTParser-members.html index 00d7e35f09..b89a551f9d 100644 --- a/docs/d3/db4/classshaka_1_1media_1_1WebMWebVTTParser-members.html +++ b/docs/d3/db4/classshaka_1_1media_1_1WebMWebVTTParser-members.html @@ -73,7 +73,7 @@ $(function() {

    @@ -158,7 +158,7 @@ Additional Inherited Members

    diff --git a/docs/d3/db5/structshaka_1_1media_1_1mp4_1_1Track.html b/docs/d3/db5/structshaka_1_1media_1_1mp4_1_1Track.html index e651542c78..f7224899d8 100644 --- a/docs/d3/db5/structshaka_1_1media_1_1mp4_1_1Track.html +++ b/docs/d3/db5/structshaka_1_1media_1_1mp4_1_1Track.html @@ -121,7 +121,7 @@ Additional Inherited Members

    Detailed Description

    -

    Definition at line 622 of file box_definitions.h.

    +

    Definition at line 627 of file box_definitions.h.

    Member Function Documentation

    ◆ BoxType()

    @@ -149,7 +149,7 @@ Additional Inherited Members

    Implements shaka::media::mp4::Box.

    -

    Definition at line 2096 of file box_definitions.cc.

    +

    Definition at line 2150 of file box_definitions.cc.

    @@ -160,7 +160,7 @@ Additional Inherited Members diff --git a/docs/d3/db6/webm__parser_8cc_source.html b/docs/d3/db6/webm__parser_8cc_source.html index a73cb9e850..ee6f53c708 100644 --- a/docs/d3/db6/webm__parser_8cc_source.html +++ b/docs/d3/db6/webm__parser_8cc_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d3/dbc/seek__head_8cc_source.html b/docs/d3/dbc/seek__head_8cc_source.html index f8cea2e48f..9f5d382d7f 100644 --- a/docs/d3/dbc/seek__head_8cc_source.html +++ b/docs/d3/dbc/seek__head_8cc_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/d3/dbe/demuxer_8cc_source.html b/docs/d3/dbe/demuxer_8cc_source.html index c2f2bd2f64..661f963249 100644 --- a/docs/d3/dbe/demuxer_8cc_source.html +++ b/docs/d3/dbe/demuxer_8cc_source.html @@ -66,7 +66,7 @@ $(function() {
    demuxer.cc
    -
    1 // Copyright 2014 Google Inc. All rights reserved.
    2 //
    3 // Use of this source code is governed by a BSD-style
    4 // license that can be found in the LICENSE file or at
    5 // https://developers.google.com/open-source/licenses/bsd
    6 
    7 #include "packager/media/demuxer/demuxer.h"
    8 
    9 #include <algorithm>
    10 
    11 #include "packager/base/bind.h"
    12 #include "packager/base/logging.h"
    13 #include "packager/base/strings/string_number_conversions.h"
    14 #include "packager/file/file.h"
    15 #include "packager/media/base/decryptor_source.h"
    16 #include "packager/media/base/key_source.h"
    17 #include "packager/media/base/macros.h"
    18 #include "packager/media/base/media_sample.h"
    19 #include "packager/media/base/stream_info.h"
    20 #include "packager/media/formats/mp2t/mp2t_media_parser.h"
    21 #include "packager/media/formats/mp4/mp4_media_parser.h"
    22 #include "packager/media/formats/webm/webm_media_parser.h"
    23 #include "packager/media/formats/wvm/wvm_media_parser.h"
    24 
    25 namespace {
    26 // 65KB, sufficient to determine the container and likely all init data.
    27 const size_t kInitBufSize = 0x10000;
    28 const size_t kBufSize = 0x200000; // 2MB
    29 // Maximum number of allowed queued samples. If we are receiving a lot of
    30 // samples before seeing init_event, something is not right. The number
    31 // set here is arbitrary though.
    32 const size_t kQueuedSamplesLimit = 10000;
    33 const size_t kInvalidStreamIndex = static_cast<size_t>(-1);
    34 const size_t kBaseVideoOutputStreamIndex = 0x100;
    35 const size_t kBaseAudioOutputStreamIndex = 0x200;
    36 const size_t kBaseTextOutputStreamIndex = 0x300;
    37 
    38 std::string GetStreamLabel(size_t stream_index) {
    39  switch (stream_index) {
    40  case kBaseVideoOutputStreamIndex:
    41  return "video";
    42  case kBaseAudioOutputStreamIndex:
    43  return "audio";
    44  case kBaseTextOutputStreamIndex:
    45  return "text";
    46  default:
    47  return base::SizeTToString(stream_index);
    48  }
    49 }
    50 
    51 bool GetStreamIndex(const std::string& stream_label, size_t* stream_index) {
    52  DCHECK(stream_index);
    53  if (stream_label == "video") {
    54  *stream_index = kBaseVideoOutputStreamIndex;
    55  } else if (stream_label == "audio") {
    56  *stream_index = kBaseAudioOutputStreamIndex;
    57  } else if (stream_label == "text") {
    58  *stream_index = kBaseTextOutputStreamIndex;
    59  } else {
    60  // Expect stream_label to be a zero based stream id.
    61  if (!base::StringToSizeT(stream_label, stream_index)) {
    62  LOG(ERROR) << "Invalid argument --stream=" << stream_label << "; "
    63  << "should be 'audio', 'video', 'text', or a number";
    64  return false;
    65  }
    66  }
    67  return true;
    68 }
    69 
    70 }
    71 
    72 namespace shaka {
    73 namespace media {
    74 
    75 Demuxer::Demuxer(const std::string& file_name)
    76  : file_name_(file_name), buffer_(new uint8_t[kBufSize]) {}
    77 
    78 Demuxer::~Demuxer() {
    79  if (media_file_)
    80  media_file_->Close();
    81 }
    82 
    83 void Demuxer::SetKeySource(std::unique_ptr<KeySource> key_source) {
    84  key_source_ = std::move(key_source);
    85 }
    86 
    88  LOG(INFO) << "Demuxer::Run() on file '" << file_name_ << "'.";
    89  Status status = InitializeParser();
    90  // ParserInitEvent callback is called after a few calls to Parse(), which sets
    91  // up the streams. Only after that, we can verify the outputs below.
    92  while (!all_streams_ready_ && status.ok())
    93  status.Update(Parse());
    94  // If no output is defined, then return success after receiving all stream
    95  // info.
    96  if (all_streams_ready_ && output_handlers().empty())
    97  return Status::OK;
    98  if (!init_event_status_.ok())
    99  return init_event_status_;
    100  if (!status.ok())
    101  return status;
    102  // Check if all specified outputs exists.
    103  for (const auto& pair : output_handlers()) {
    104  if (std::find(stream_indexes_.begin(), stream_indexes_.end(), pair.first) ==
    105  stream_indexes_.end()) {
    106  LOG(ERROR) << "Invalid argument, stream=" << GetStreamLabel(pair.first)
    107  << " not available.";
    108  return Status(error::INVALID_ARGUMENT, "Stream not available");
    109  }
    110  }
    111 
    112  while (!cancelled_ && status.ok())
    113  status.Update(Parse());
    114  if (cancelled_ && status.ok())
    115  return Status(error::CANCELLED, "Demuxer run cancelled");
    116 
    117  if (status.error_code() == error::END_OF_STREAM) {
    118  for (size_t stream_index : stream_indexes_) {
    119  status = FlushDownstream(stream_index);
    120  if (!status.ok())
    121  return status;
    122  }
    123  return Status::OK;
    124  }
    125  return status;
    126 }
    127 
    129  cancelled_ = true;
    130 }
    131 
    132 Status Demuxer::SetHandler(const std::string& stream_label,
    133  std::shared_ptr<MediaHandler> handler) {
    134  size_t stream_index = kInvalidStreamIndex;
    135  if (!GetStreamIndex(stream_label, &stream_index)) {
    136  return Status(error::INVALID_ARGUMENT,
    137  "Invalid stream: " + stream_label);
    138  }
    139  return MediaHandler::SetHandler(stream_index, std::move(handler));
    140 }
    141 
    142 void Demuxer::SetLanguageOverride(const std::string& stream_label,
    143  const std::string& language_override) {
    144  size_t stream_index = kInvalidStreamIndex;
    145  if (!GetStreamIndex(stream_label, &stream_index))
    146  LOG(WARNING) << "Invalid stream for language override " << stream_label;
    147  language_overrides_[stream_index] = language_override;
    148 }
    149 
    150 Demuxer::QueuedSample::QueuedSample(uint32_t local_track_id,
    151  std::shared_ptr<MediaSample> local_sample)
    152  : track_id(local_track_id), sample(local_sample) {}
    153 
    154 Demuxer::QueuedSample::~QueuedSample() {}
    155 
    156 Status Demuxer::InitializeParser() {
    157  DCHECK(!media_file_);
    158  DCHECK(!all_streams_ready_);
    159 
    160  LOG(INFO) << "Initialize Demuxer for file '" << file_name_ << "'.";
    161 
    162  media_file_ = File::Open(file_name_.c_str(), "r");
    163  if (!media_file_) {
    164  return Status(error::FILE_FAILURE,
    165  "Cannot open file for reading " + file_name_);
    166  }
    167 
    168  // Read enough bytes before detecting the container.
    169  int64_t bytes_read = 0;
    170  while (static_cast<size_t>(bytes_read) < kInitBufSize) {
    171  int64_t read_result =
    172  media_file_->Read(buffer_.get() + bytes_read, kInitBufSize);
    173  if (read_result < 0)
    174  return Status(error::FILE_FAILURE, "Cannot read file " + file_name_);
    175  if (read_result == 0)
    176  break;
    177  bytes_read += read_result;
    178  }
    179  container_name_ = DetermineContainer(buffer_.get(), bytes_read);
    180 
    181  // Initialize media parser.
    182  switch (container_name_) {
    183  case CONTAINER_MOV:
    184  parser_.reset(new mp4::MP4MediaParser());
    185  break;
    186  case CONTAINER_MPEG2TS:
    187  parser_.reset(new mp2t::Mp2tMediaParser());
    188  break;
    189  // Widevine classic (WVM) is derived from MPEG2PS. We do not support
    190  // non-WVM MPEG2PS file, thus we do not differentiate between the two.
    191  // Every MPEG2PS file is assumed to be WVM file. If it turns out not the
    192  // case, an error will be reported when trying to parse the file as WVM
    193  // file.
    194  case CONTAINER_MPEG2PS:
    195  FALLTHROUGH_INTENDED;
    196  case CONTAINER_WVM:
    197  parser_.reset(new wvm::WvmMediaParser());
    198  break;
    199  case CONTAINER_WEBM:
    200  parser_.reset(new WebMMediaParser());
    201  break;
    202  break;
    203  default:
    204  NOTIMPLEMENTED();
    205  return Status(error::UNIMPLEMENTED, "Container not supported.");
    206  }
    207 
    208  parser_->Init(base::Bind(&Demuxer::ParserInitEvent, base::Unretained(this)),
    209  base::Bind(&Demuxer::NewSampleEvent, base::Unretained(this)),
    210  key_source_.get());
    211 
    212  // Handle trailing 'moov'.
    213  if (container_name_ == CONTAINER_MOV)
    214  static_cast<mp4::MP4MediaParser*>(parser_.get())->LoadMoov(file_name_);
    215  if (!parser_->Parse(buffer_.get(), bytes_read)) {
    216  return Status(error::PARSER_FAILURE,
    217  "Cannot parse media file " + file_name_);
    218  }
    219  return Status::OK;
    220 }
    221 
    222 void Demuxer::ParserInitEvent(
    223  const std::vector<std::shared_ptr<StreamInfo>>& stream_infos) {
    224  if (dump_stream_info_) {
    225  printf("\nFile \"%s\":\n", file_name_.c_str());
    226  printf("Found %zu stream(s).\n", stream_infos.size());
    227  for (size_t i = 0; i < stream_infos.size(); ++i)
    228  printf("Stream [%zu] %s\n", i, stream_infos[i]->ToString().c_str());
    229  }
    230 
    231  int base_stream_index = 0;
    232  bool video_handler_set =
    233  output_handlers().find(kBaseVideoOutputStreamIndex) !=
    234  output_handlers().end();
    235  bool audio_handler_set =
    236  output_handlers().find(kBaseAudioOutputStreamIndex) !=
    237  output_handlers().end();
    238  bool text_handler_set =
    239  output_handlers().find(kBaseTextOutputStreamIndex) !=
    240  output_handlers().end();
    241  for (const std::shared_ptr<StreamInfo>& stream_info : stream_infos) {
    242  size_t stream_index = base_stream_index;
    243  if (video_handler_set && stream_info->stream_type() == kStreamVideo) {
    244  stream_index = kBaseVideoOutputStreamIndex;
    245  // Only for the first video stream.
    246  video_handler_set = false;
    247  }
    248  if (audio_handler_set && stream_info->stream_type() == kStreamAudio) {
    249  stream_index = kBaseAudioOutputStreamIndex;
    250  // Only for the first audio stream.
    251  audio_handler_set = false;
    252  }
    253  if (text_handler_set && stream_info->stream_type() == kStreamText) {
    254  stream_index = kBaseTextOutputStreamIndex;
    255  text_handler_set = false;
    256  }
    257 
    258  const bool handler_set =
    259  output_handlers().find(stream_index) != output_handlers().end();
    260  if (handler_set) {
    261  track_id_to_stream_index_map_[stream_info->track_id()] = stream_index;
    262  stream_indexes_.push_back(stream_index);
    263  auto iter = language_overrides_.find(stream_index);
    264  if (iter != language_overrides_.end() &&
    265  stream_info->stream_type() != kStreamVideo) {
    266  stream_info->set_language(iter->second);
    267  }
    268  if (stream_info->is_encrypted()) {
    269  init_event_status_.Update(Status(error::INVALID_ARGUMENT,
    270  "A decryption key source is not "
    271  "provided for an encrypted stream."));
    272  } else {
    273  init_event_status_.Update(
    274  DispatchStreamInfo(stream_index, stream_info));
    275  }
    276  } else {
    277  track_id_to_stream_index_map_[stream_info->track_id()] =
    278  kInvalidStreamIndex;
    279  }
    280  ++base_stream_index;
    281  }
    282  all_streams_ready_ = true;
    283 }
    284 
    285 bool Demuxer::NewSampleEvent(uint32_t track_id,
    286  const std::shared_ptr<MediaSample>& sample) {
    287  if (!all_streams_ready_) {
    288  if (queued_samples_.size() >= kQueuedSamplesLimit) {
    289  LOG(ERROR) << "Queued samples limit reached: " << kQueuedSamplesLimit;
    290  return false;
    291  }
    292  queued_samples_.push_back(QueuedSample(track_id, sample));
    293  return true;
    294  }
    295  if (!init_event_status_.ok()) {
    296  return false;
    297  }
    298  while (!queued_samples_.empty()) {
    299  if (!PushSample(queued_samples_.front().track_id,
    300  queued_samples_.front().sample)) {
    301  return false;
    302  }
    303  queued_samples_.pop_front();
    304  }
    305  return PushSample(track_id, sample);
    306 }
    307 
    308 bool Demuxer::PushSample(uint32_t track_id,
    309  const std::shared_ptr<MediaSample>& sample) {
    310  auto stream_index_iter = track_id_to_stream_index_map_.find(track_id);
    311  if (stream_index_iter == track_id_to_stream_index_map_.end()) {
    312  LOG(ERROR) << "Track " << track_id << " not found.";
    313  return false;
    314  }
    315  if (stream_index_iter->second == kInvalidStreamIndex)
    316  return true;
    317  Status status = DispatchMediaSample(stream_index_iter->second, sample);
    318  if (!status.ok()) {
    319  LOG(ERROR) << "Failed to process sample " << stream_index_iter->second
    320  << " " << status;
    321  }
    322  return status.ok();
    323 }
    324 
    325 Status Demuxer::Parse() {
    326  DCHECK(media_file_);
    327  DCHECK(parser_);
    328  DCHECK(buffer_);
    329 
    330  int64_t bytes_read = media_file_->Read(buffer_.get(), kBufSize);
    331  if (bytes_read == 0) {
    332  if (!parser_->Flush())
    333  return Status(error::PARSER_FAILURE, "Failed to flush.");
    334  return Status(error::END_OF_STREAM, "");
    335  } else if (bytes_read < 0) {
    336  return Status(error::FILE_FAILURE, "Cannot read file " + file_name_);
    337  }
    338 
    339  return parser_->Parse(buffer_.get(), bytes_read)
    340  ? Status::OK
    341  : Status(error::PARSER_FAILURE,
    342  "Cannot parse media file " + file_name_);
    343 }
    344 
    345 } // namespace media
    346 } // namespace shaka
    Status DispatchStreamInfo(size_t stream_index, std::shared_ptr< const StreamInfo > stream_info) const
    Dispatch the stream info to downstream handlers.
    +
    1 // Copyright 2014 Google Inc. All rights reserved.
    2 //
    3 // Use of this source code is governed by a BSD-style
    4 // license that can be found in the LICENSE file or at
    5 // https://developers.google.com/open-source/licenses/bsd
    6 
    7 #include "packager/media/demuxer/demuxer.h"
    8 
    9 #include <algorithm>
    10 
    11 #include "packager/base/bind.h"
    12 #include "packager/base/logging.h"
    13 #include "packager/base/strings/string_number_conversions.h"
    14 #include "packager/file/file.h"
    15 #include "packager/media/base/decryptor_source.h"
    16 #include "packager/media/base/key_source.h"
    17 #include "packager/media/base/macros.h"
    18 #include "packager/media/base/media_sample.h"
    19 #include "packager/media/base/stream_info.h"
    20 #include "packager/media/formats/mp2t/mp2t_media_parser.h"
    21 #include "packager/media/formats/mp4/mp4_media_parser.h"
    22 #include "packager/media/formats/webm/webm_media_parser.h"
    23 #include "packager/media/formats/wvm/wvm_media_parser.h"
    24 
    25 namespace {
    26 // 65KB, sufficient to determine the container and likely all init data.
    27 const size_t kInitBufSize = 0x10000;
    28 const size_t kBufSize = 0x200000; // 2MB
    29 // Maximum number of allowed queued samples. If we are receiving a lot of
    30 // samples before seeing init_event, something is not right. The number
    31 // set here is arbitrary though.
    32 const size_t kQueuedSamplesLimit = 10000;
    33 const size_t kInvalidStreamIndex = static_cast<size_t>(-1);
    34 const size_t kBaseVideoOutputStreamIndex = 0x100;
    35 const size_t kBaseAudioOutputStreamIndex = 0x200;
    36 const size_t kBaseTextOutputStreamIndex = 0x300;
    37 
    38 std::string GetStreamLabel(size_t stream_index) {
    39  switch (stream_index) {
    40  case kBaseVideoOutputStreamIndex:
    41  return "video";
    42  case kBaseAudioOutputStreamIndex:
    43  return "audio";
    44  case kBaseTextOutputStreamIndex:
    45  return "text";
    46  default:
    47  return base::SizeTToString(stream_index);
    48  }
    49 }
    50 
    51 bool GetStreamIndex(const std::string& stream_label, size_t* stream_index) {
    52  DCHECK(stream_index);
    53  if (stream_label == "video") {
    54  *stream_index = kBaseVideoOutputStreamIndex;
    55  } else if (stream_label == "audio") {
    56  *stream_index = kBaseAudioOutputStreamIndex;
    57  } else if (stream_label == "text") {
    58  *stream_index = kBaseTextOutputStreamIndex;
    59  } else {
    60  // Expect stream_label to be a zero based stream id.
    61  if (!base::StringToSizeT(stream_label, stream_index)) {
    62  LOG(ERROR) << "Invalid argument --stream=" << stream_label << "; "
    63  << "should be 'audio', 'video', 'text', or a number";
    64  return false;
    65  }
    66  }
    67  return true;
    68 }
    69 
    70 }
    71 
    72 namespace shaka {
    73 namespace media {
    74 
    75 Demuxer::Demuxer(const std::string& file_name)
    76  : file_name_(file_name), buffer_(new uint8_t[kBufSize]) {}
    77 
    78 Demuxer::~Demuxer() {
    79  if (media_file_)
    80  media_file_->Close();
    81 }
    82 
    83 void Demuxer::SetKeySource(std::unique_ptr<KeySource> key_source) {
    84  key_source_ = std::move(key_source);
    85 }
    86 
    88  LOG(INFO) << "Demuxer::Run() on file '" << file_name_ << "'.";
    89  Status status = InitializeParser();
    90  // ParserInitEvent callback is called after a few calls to Parse(), which sets
    91  // up the streams. Only after that, we can verify the outputs below.
    92  while (!all_streams_ready_ && status.ok())
    93  status.Update(Parse());
    94  // If no output is defined, then return success after receiving all stream
    95  // info.
    96  if (all_streams_ready_ && output_handlers().empty())
    97  return Status::OK;
    98  if (!init_event_status_.ok())
    99  return init_event_status_;
    100  if (!status.ok())
    101  return status;
    102  // Check if all specified outputs exists.
    103  for (const auto& pair : output_handlers()) {
    104  if (std::find(stream_indexes_.begin(), stream_indexes_.end(), pair.first) ==
    105  stream_indexes_.end()) {
    106  LOG(ERROR) << "Invalid argument, stream=" << GetStreamLabel(pair.first)
    107  << " not available.";
    108  return Status(error::INVALID_ARGUMENT, "Stream not available");
    109  }
    110  }
    111 
    112  while (!cancelled_ && status.ok())
    113  status.Update(Parse());
    114  if (cancelled_ && status.ok())
    115  return Status(error::CANCELLED, "Demuxer run cancelled");
    116 
    117  if (status.error_code() == error::END_OF_STREAM) {
    118  for (size_t stream_index : stream_indexes_) {
    119  status = FlushDownstream(stream_index);
    120  if (!status.ok())
    121  return status;
    122  }
    123  return Status::OK;
    124  }
    125  return status;
    126 }
    127 
    129  cancelled_ = true;
    130 }
    131 
    132 Status Demuxer::SetHandler(const std::string& stream_label,
    133  std::shared_ptr<MediaHandler> handler) {
    134  size_t stream_index = kInvalidStreamIndex;
    135  if (!GetStreamIndex(stream_label, &stream_index)) {
    136  return Status(error::INVALID_ARGUMENT,
    137  "Invalid stream: " + stream_label);
    138  }
    139  return MediaHandler::SetHandler(stream_index, std::move(handler));
    140 }
    141 
    142 void Demuxer::SetLanguageOverride(const std::string& stream_label,
    143  const std::string& language_override) {
    144  size_t stream_index = kInvalidStreamIndex;
    145  if (!GetStreamIndex(stream_label, &stream_index))
    146  LOG(WARNING) << "Invalid stream for language override " << stream_label;
    147  language_overrides_[stream_index] = language_override;
    148 }
    149 
    150 Demuxer::QueuedSample::QueuedSample(uint32_t local_track_id,
    151  std::shared_ptr<MediaSample> local_sample)
    152  : track_id(local_track_id), sample(local_sample) {}
    153 
    154 Demuxer::QueuedSample::~QueuedSample() {}
    155 
    156 Status Demuxer::InitializeParser() {
    157  DCHECK(!media_file_);
    158  DCHECK(!all_streams_ready_);
    159 
    160  LOG(INFO) << "Initialize Demuxer for file '" << file_name_ << "'.";
    161 
    162  media_file_ = File::Open(file_name_.c_str(), "r");
    163  if (!media_file_) {
    164  return Status(error::FILE_FAILURE,
    165  "Cannot open file for reading " + file_name_);
    166  }
    167 
    168  // Read enough bytes before detecting the container.
    169  int64_t bytes_read = 0;
    170  while (static_cast<size_t>(bytes_read) < kInitBufSize) {
    171  int64_t read_result =
    172  media_file_->Read(buffer_.get() + bytes_read, kInitBufSize);
    173  if (read_result < 0)
    174  return Status(error::FILE_FAILURE, "Cannot read file " + file_name_);
    175  if (read_result == 0)
    176  break;
    177  bytes_read += read_result;
    178  }
    179  container_name_ = DetermineContainer(buffer_.get(), bytes_read);
    180 
    181  // Initialize media parser.
    182  switch (container_name_) {
    183  case CONTAINER_MOV:
    184  parser_.reset(new mp4::MP4MediaParser());
    185  break;
    186  case CONTAINER_MPEG2TS:
    187  parser_.reset(new mp2t::Mp2tMediaParser());
    188  break;
    189  // Widevine classic (WVM) is derived from MPEG2PS. We do not support
    190  // non-WVM MPEG2PS file, thus we do not differentiate between the two.
    191  // Every MPEG2PS file is assumed to be WVM file. If it turns out not the
    192  // case, an error will be reported when trying to parse the file as WVM
    193  // file.
    194  case CONTAINER_MPEG2PS:
    195  FALLTHROUGH_INTENDED;
    196  case CONTAINER_WVM:
    197  parser_.reset(new wvm::WvmMediaParser());
    198  break;
    199  case CONTAINER_WEBM:
    200  parser_.reset(new WebMMediaParser());
    201  break;
    202  break;
    203  default:
    204  NOTIMPLEMENTED();
    205  return Status(error::UNIMPLEMENTED, "Container not supported.");
    206  }
    207 
    208  parser_->Init(base::Bind(&Demuxer::ParserInitEvent, base::Unretained(this)),
    209  base::Bind(&Demuxer::NewSampleEvent, base::Unretained(this)),
    210  key_source_.get());
    211 
    212  // Handle trailing 'moov'.
    213  if (container_name_ == CONTAINER_MOV)
    214  static_cast<mp4::MP4MediaParser*>(parser_.get())->LoadMoov(file_name_);
    215  if (!parser_->Parse(buffer_.get(), bytes_read)) {
    216  return Status(error::PARSER_FAILURE,
    217  "Cannot parse media file " + file_name_);
    218  }
    219  return Status::OK;
    220 }
    221 
    222 void Demuxer::ParserInitEvent(
    223  const std::vector<std::shared_ptr<StreamInfo>>& stream_infos) {
    224  if (dump_stream_info_) {
    225  printf("\nFile \"%s\":\n", file_name_.c_str());
    226  printf("Found %zu stream(s).\n", stream_infos.size());
    227  for (size_t i = 0; i < stream_infos.size(); ++i)
    228  printf("Stream [%zu] %s\n", i, stream_infos[i]->ToString().c_str());
    229  }
    230 
    231  int base_stream_index = 0;
    232  bool video_handler_set =
    233  output_handlers().find(kBaseVideoOutputStreamIndex) !=
    234  output_handlers().end();
    235  bool audio_handler_set =
    236  output_handlers().find(kBaseAudioOutputStreamIndex) !=
    237  output_handlers().end();
    238  bool text_handler_set =
    239  output_handlers().find(kBaseTextOutputStreamIndex) !=
    240  output_handlers().end();
    241  for (const std::shared_ptr<StreamInfo>& stream_info : stream_infos) {
    242  size_t stream_index = base_stream_index;
    243  if (video_handler_set && stream_info->stream_type() == kStreamVideo) {
    244  stream_index = kBaseVideoOutputStreamIndex;
    245  // Only for the first video stream.
    246  video_handler_set = false;
    247  }
    248  if (audio_handler_set && stream_info->stream_type() == kStreamAudio) {
    249  stream_index = kBaseAudioOutputStreamIndex;
    250  // Only for the first audio stream.
    251  audio_handler_set = false;
    252  }
    253  if (text_handler_set && stream_info->stream_type() == kStreamText) {
    254  stream_index = kBaseTextOutputStreamIndex;
    255  text_handler_set = false;
    256  }
    257 
    258  const bool handler_set =
    259  output_handlers().find(stream_index) != output_handlers().end();
    260  if (handler_set) {
    261  track_id_to_stream_index_map_[stream_info->track_id()] = stream_index;
    262  stream_indexes_.push_back(stream_index);
    263  auto iter = language_overrides_.find(stream_index);
    264  if (iter != language_overrides_.end() &&
    265  stream_info->stream_type() != kStreamVideo) {
    266  stream_info->set_language(iter->second);
    267  }
    268  if (stream_info->is_encrypted()) {
    269  init_event_status_.Update(Status(error::INVALID_ARGUMENT,
    270  "A decryption key source is not "
    271  "provided for an encrypted stream."));
    272  } else {
    273  init_event_status_.Update(
    274  DispatchStreamInfo(stream_index, stream_info));
    275  }
    276  } else {
    277  track_id_to_stream_index_map_[stream_info->track_id()] =
    278  kInvalidStreamIndex;
    279  }
    280  ++base_stream_index;
    281  }
    282  all_streams_ready_ = true;
    283 }
    284 
    285 bool Demuxer::NewSampleEvent(uint32_t track_id,
    286  const std::shared_ptr<MediaSample>& sample) {
    287  if (!all_streams_ready_) {
    288  if (queued_samples_.size() >= kQueuedSamplesLimit) {
    289  LOG(ERROR) << "Queued samples limit reached: " << kQueuedSamplesLimit;
    290  return false;
    291  }
    292  queued_samples_.push_back(QueuedSample(track_id, sample));
    293  return true;
    294  }
    295  if (!init_event_status_.ok()) {
    296  return false;
    297  }
    298  while (!queued_samples_.empty()) {
    299  if (!PushSample(queued_samples_.front().track_id,
    300  queued_samples_.front().sample)) {
    301  return false;
    302  }
    303  queued_samples_.pop_front();
    304  }
    305  return PushSample(track_id, sample);
    306 }
    307 
    308 bool Demuxer::PushSample(uint32_t track_id,
    309  const std::shared_ptr<MediaSample>& sample) {
    310  auto stream_index_iter = track_id_to_stream_index_map_.find(track_id);
    311  if (stream_index_iter == track_id_to_stream_index_map_.end()) {
    312  LOG(ERROR) << "Track " << track_id << " not found.";
    313  return false;
    314  }
    315  if (stream_index_iter->second == kInvalidStreamIndex)
    316  return true;
    317  Status status = DispatchMediaSample(stream_index_iter->second, sample);
    318  if (!status.ok()) {
    319  LOG(ERROR) << "Failed to process sample " << stream_index_iter->second
    320  << " " << status;
    321  }
    322  return status.ok();
    323 }
    324 
    325 Status Demuxer::Parse() {
    326  DCHECK(media_file_);
    327  DCHECK(parser_);
    328  DCHECK(buffer_);
    329 
    330  int64_t bytes_read = media_file_->Read(buffer_.get(), kBufSize);
    331  if (bytes_read == 0) {
    332  if (!parser_->Flush())
    333  return Status(error::PARSER_FAILURE, "Failed to flush.");
    334  return Status(error::END_OF_STREAM, "");
    335  } else if (bytes_read < 0) {
    336  return Status(error::FILE_FAILURE, "Cannot read file " + file_name_);
    337  }
    338 
    339  return parser_->Parse(buffer_.get(), bytes_read)
    340  ? Status::OK
    341  : Status(error::PARSER_FAILURE,
    342  "Cannot parse media file " + file_name_);
    343 }
    344 
    345 } // namespace media
    346 } // namespace shaka
    Status DispatchStreamInfo(size_t stream_index, std::shared_ptr< const StreamInfo > stream_info) const
    Dispatch the stream info to downstream handlers.
    Status SetHandler(const std::string &stream_label, std::shared_ptr< MediaHandler > handler)
    Definition: demuxer.cc:132
    Status Run() override
    Definition: demuxer.cc:87
    @@ -78,18 +78,18 @@ $(function() {
    virtual bool Close()=0
    void SetKeySource(std::unique_ptr< KeySource > key_source)
    Definition: demuxer.cc:83
    -
    Status FlushDownstream(size_t output_stream_index)
    Flush the downstream connected at the specified output stream index.
    +
    Status FlushDownstream(size_t output_stream_index)
    Flush the downstream connected at the specified output stream index.
    void Update(Status new_status)
    Definition: status.cc:76
    Demuxer(const std::string &file_name)
    Definition: demuxer.cc:75
    virtual bool Open()=0
    Internal open. Should not be used directly.
    -
    Status DispatchMediaSample(size_t stream_index, std::shared_ptr< const MediaSample > media_sample) const
    Dispatch the media sample to downstream handlers.
    +
    Status DispatchMediaSample(size_t stream_index, std::shared_ptr< const MediaSample > media_sample) const
    Dispatch the media sample to downstream handlers.
    void Cancel() override
    Definition: demuxer.cc:128
    -
    Status SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)
    Connect downstream handler at the specified output stream index.
    +
    Status SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)
    Connect downstream handler at the specified output stream index.
    diff --git a/docs/d3/dbe/structshaka_1_1media_1_1mp4_1_1EditList.html b/docs/d3/dbe/structshaka_1_1media_1_1mp4_1_1EditList.html index 8ebc851f59..5d6c38ec22 100644 --- a/docs/d3/dbe/structshaka_1_1media_1_1mp4_1_1EditList.html +++ b/docs/d3/dbe/structshaka_1_1media_1_1mp4_1_1EditList.html @@ -107,10 +107,10 @@ std::vector<   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

    Implements shaka::media::mp4::Box.

    -

    Definition at line 1181 of file box_definitions.cc.

    +

    Definition at line 1204 of file box_definitions.cc.

    @@ -160,7 +160,7 @@ Additional Inherited Members diff --git a/docs/d3/dc0/structshaka_1_1DecryptionParams-members.html b/docs/d3/dc0/structshaka_1_1DecryptionParams-members.html index 6a16dcb91b..64bf139800 100644 --- a/docs/d3/dc0/structshaka_1_1DecryptionParams-members.html +++ b/docs/d3/dc0/structshaka_1_1DecryptionParams-members.html @@ -75,7 +75,7 @@ $(function() {

    @@ -149,7 +149,7 @@ Additional Inherited Members

    diff --git a/docs/d3/dc1/classshaka_1_1media_1_1mp2t_1_1Mp2tMediaParser.html b/docs/d3/dc1/classshaka_1_1media_1_1mp2t_1_1Mp2tMediaParser.html index 63b10a4ca6..43f70e5165 100644 --- a/docs/d3/dc1/classshaka_1_1media_1_1mp2t_1_1Mp2tMediaParser.html +++ b/docs/d3/dc1/classshaka_1_1media_1_1mp2t_1_1Mp2tMediaParser.html @@ -231,7 +231,7 @@ Additional Inherited Members diff --git a/docs/d3/dd0/classshaka_1_1MpdNotifier.html b/docs/d3/dd0/classshaka_1_1MpdNotifier.html index 8e8f5499a1..7721cc8587 100644 --- a/docs/d3/dd0/classshaka_1_1MpdNotifier.html +++ b/docs/d3/dd0/classshaka_1_1MpdNotifier.html @@ -534,7 +534,7 @@ Public Member Functions diff --git a/docs/d3/dd0/structshaka_1_1media_1_1mp4_1_1SegmentType.html b/docs/d3/dd0/structshaka_1_1media_1_1mp4_1_1SegmentType.html index 12d0b18109..38a2de2672 100644 --- a/docs/d3/dd0/structshaka_1_1media_1_1mp4_1_1SegmentType.html +++ b/docs/d3/dd0/structshaka_1_1media_1_1mp4_1_1SegmentType.html @@ -102,10 +102,10 @@ Public Member Functions Additional Inherited Members - Public Attributes inherited from shaka::media::mp4::FileType -FourCC major_brand +FourCC major_brand = FOURCC_NULL   -uint32_t minor_version +uint32_t minor_version = 0   std::vector< FourCC > compatible_brands @@ -116,7 +116,7 @@ std::vector< FourCC > <

    Detailed Description

    -

    Definition at line 53 of file box_definitions.h.

    +

    Definition at line 54 of file box_definitions.h.

    Member Function Documentation

    ◆ BoxType()

    @@ -144,7 +144,7 @@ std::vector< FourCC > <

    Reimplemented from shaka::media::mp4::FileType.

    -

    Definition at line 157 of file box_definitions.cc.

    +

    Definition at line 155 of file box_definitions.cc.

    @@ -155,7 +155,7 @@ std::vector< FourCC > < diff --git a/docs/d3/dd7/ad__cue__generator_8h_source.html b/docs/d3/dd7/ad__cue__generator_8h_source.html index 4ca99ef295..8e0fb1ca40 100644 --- a/docs/d3/dd7/ad__cue__generator_8h_source.html +++ b/docs/d3/dd7/ad__cue__generator_8h_source.html @@ -66,7 +66,7 @@ $(function() {
    ad_cue_generator.h
    -
    1 // Copyright 2017 Google Inc. All rights reserved.
    2 //
    3 // Use of this source code is governed by a BSD-style
    4 // license that can be found in the LICENSE file or at
    5 // https://developers.google.com/open-source/licenses/bsd
    6 
    7 #ifndef PACKAGER_MEDIA_AD_CUE_GENERATOR_AD_CUE_GENERATOR_H_
    8 #define PACKAGER_MEDIA_AD_CUE_GENERATOR_AD_CUE_GENERATOR_H_
    9 
    10 #include "packager/media/base/media_handler.h"
    11 #include "packager/media/public/ad_cue_generator_params.h"
    12 
    13 namespace shaka {
    14 namespace media {
    15 
    17 class AdCueGenerator : public MediaHandler {
    18  public:
    19  explicit AdCueGenerator(const AdCueGeneratorParams& ad_cue_generator_params);
    20  ~AdCueGenerator() override;
    21 
    22  private:
    23  AdCueGenerator(const AdCueGenerator&) = delete;
    24  AdCueGenerator& operator=(const AdCueGenerator&) = delete;
    25 
    26  Status InitializeInternal() override;
    27  Status Process(std::unique_ptr<StreamData> stream_data) override;
    28 
    29  // Dispatches SCTE35 events that are built from AdCueGenerator params.
    30  Status DispatchScte35Events(size_t stream_index, uint32_t time_scale);
    31 
    32  const AdCueGeneratorParams ad_cue_generator_params_;
    33 };
    34 
    35 } // namespace media
    36 } // namespace shaka
    37 
    38 #endif // PACKAGER_MEDIA_AD_CUE_GENERATOR_AD_CUE_GENERATOR_H_
    +
    1 // Copyright 2017 Google Inc. All rights reserved.
    2 //
    3 // Use of this source code is governed by a BSD-style
    4 // license that can be found in the LICENSE file or at
    5 // https://developers.google.com/open-source/licenses/bsd
    6 
    7 #ifndef PACKAGER_MEDIA_AD_CUE_GENERATOR_AD_CUE_GENERATOR_H_
    8 #define PACKAGER_MEDIA_AD_CUE_GENERATOR_AD_CUE_GENERATOR_H_
    9 
    10 #include "packager/media/base/media_handler.h"
    11 #include "packager/media/public/ad_cue_generator_params.h"
    12 
    13 namespace shaka {
    14 namespace media {
    15 
    17 class AdCueGenerator : public MediaHandler {
    18  public:
    19  explicit AdCueGenerator(const AdCueGeneratorParams& ad_cue_generator_params);
    20  ~AdCueGenerator() override;
    21 
    22  private:
    23  AdCueGenerator(const AdCueGenerator&) = delete;
    24  AdCueGenerator& operator=(const AdCueGenerator&) = delete;
    25 
    26  Status InitializeInternal() override;
    27  Status Process(std::unique_ptr<StreamData> stream_data) override;
    28 
    29  // Dispatches SCTE35 events that are built from AdCueGenerator params.
    30  Status DispatchScte35Events(size_t stream_index, uint32_t time_scale);
    31 
    32  const AdCueGeneratorParams ad_cue_generator_params_;
    33 };
    34 
    35 } // namespace media
    36 } // namespace shaka
    37 
    38 #endif // PACKAGER_MEDIA_AD_CUE_GENERATOR_AD_CUE_GENERATOR_H_
    All the methods that are virtual are virtual for mocking.
    Cuepoint generator related parameters.
    @@ -74,7 +74,7 @@ $(function() {
    diff --git a/docs/d3/dd7/id3__tag_8h_source.html b/docs/d3/dd7/id3__tag_8h_source.html index 843d3a8819..1646a9f9bc 100644 --- a/docs/d3/dd7/id3__tag_8h_source.html +++ b/docs/d3/dd7/id3__tag_8h_source.html @@ -75,7 +75,7 @@ $(function() {
    diff --git a/docs/d3/ddf/classshaka_1_1media_1_1PlayReadyPsshGenerator.html b/docs/d3/ddf/classshaka_1_1media_1_1PlayReadyPsshGenerator.html index bf8588fc66..0cb7cad9f5 100644 --- a/docs/d3/ddf/classshaka_1_1media_1_1PlayReadyPsshGenerator.html +++ b/docs/d3/ddf/classshaka_1_1media_1_1PlayReadyPsshGenerator.html @@ -130,7 +130,7 @@ Public Member Functions diff --git a/docs/d3/de2/structshaka_1_1FileCloser.html b/docs/d3/de2/structshaka_1_1FileCloser.html index 34f3fbca90..5102036175 100644 --- a/docs/d3/de2/structshaka_1_1FileCloser.html +++ b/docs/d3/de2/structshaka_1_1FileCloser.html @@ -88,7 +88,7 @@ void operator() ( diff --git a/docs/d3/de4/seek__head_8h_source.html b/docs/d3/de4/seek__head_8h_source.html index d597b342ce..30fb4119ab 100644 --- a/docs/d3/de4/seek__head_8h_source.html +++ b/docs/d3/de4/seek__head_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d3/de6/job__manager_8h_source.html b/docs/d3/de6/job__manager_8h_source.html index 74ad34fb02..6bf9a5d75c 100644 --- a/docs/d3/de6/job__manager_8h_source.html +++ b/docs/d3/de6/job__manager_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d3/de7/classshaka_1_1media_1_1PeekingReader-members.html b/docs/d3/de7/classshaka_1_1media_1_1PeekingReader-members.html index b406803e8b..601111863f 100644 --- a/docs/d3/de7/classshaka_1_1media_1_1PeekingReader-members.html +++ b/docs/d3/de7/classshaka_1_1media_1_1PeekingReader-members.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d3/de9/classshaka_1_1media_1_1mp4_1_1BoxBuffer-members.html b/docs/d3/de9/classshaka_1_1media_1_1mp4_1_1BoxBuffer-members.html index d84ea02009..35a3ec7c20 100644 --- a/docs/d3/de9/classshaka_1_1media_1_1mp4_1_1BoxBuffer-members.html +++ b/docs/d3/de9/classshaka_1_1media_1_1mp4_1_1BoxBuffer-members.html @@ -97,7 +97,7 @@ $(function() { diff --git a/docs/d3/de9/structshaka_1_1media_1_1mp4_1_1SampleGroupDescription-members.html b/docs/d3/de9/structshaka_1_1media_1_1mp4_1_1SampleGroupDescription-members.html index c258da2800..81ff1fe9b8 100644 --- a/docs/d3/de9/structshaka_1_1media_1_1mp4_1_1SampleGroupDescription-members.html +++ b/docs/d3/de9/structshaka_1_1media_1_1mp4_1_1SampleGroupDescription-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/docs/d3/deb/packed__audio__writer_8cc_source.html b/docs/d3/deb/packed__audio__writer_8cc_source.html index d76579c638..4250b073e6 100644 --- a/docs/d3/deb/packed__audio__writer_8cc_source.html +++ b/docs/d3/deb/packed__audio__writer_8cc_source.html @@ -67,7 +67,7 @@ $(function() {
    1 // Copyright 2018 Google LLC. All rights reserved.
    2 //
    3 // Use of this source code is governed by a BSD-style
    4 // license that can be found in the LICENSE file or at
    5 // https://developers.google.com/open-source/licenses/bsd
    6 
    7 #include "packager/media/formats/packed_audio/packed_audio_writer.h"
    8 
    9 #include "packager/media/base/muxer_util.h"
    10 #include "packager/media/formats/packed_audio/packed_audio_segmenter.h"
    11 #include "packager/status_macros.h"
    12 
    13 namespace shaka {
    14 namespace media {
    15 
    17  : Muxer(muxer_options), segmenter_(new PackedAudioSegmenter) {}
    18 
    19 PackedAudioWriter::~PackedAudioWriter() = default;
    20 
    21 Status PackedAudioWriter::InitializeMuxer() {
    22  if (streams().size() > 1u)
    23  return Status(error::MUXER_FAILURE, "Cannot handle more than one streams.");
    24 
    25  RETURN_IF_ERROR(segmenter_->Initialize(*streams()[0]));
    26 
    27  if (options().segment_template.empty()) {
    28  const std::string& file_name = options().output_file_name;
    29  DCHECK(!file_name.empty());
    30  output_file_.reset(File::Open(file_name.c_str(), "w"));
    31  if (!output_file_) {
    32  return Status(error::FILE_FAILURE,
    33  "Cannot open file for write " + file_name);
    34  }
    35  }
    36 
    37  if (muxer_listener()) {
    38  muxer_listener()->OnMediaStart(options(), *streams().front(),
    39  kPackedAudioTimescale,
    40  MuxerListener::kContainerPackedAudio);
    41  }
    42  return Status::OK;
    43 }
    44 
    45 Status PackedAudioWriter::Finalize() {
    46  if (output_file_)
    47  RETURN_IF_ERROR(CloseFile(std::move(output_file_)));
    48 
    49  if (muxer_listener()) {
    50  muxer_listener()->OnMediaEnd(
    51  media_ranges_, total_duration_ * segmenter_->TimescaleScale());
    52  }
    53  return Status::OK;
    54 }
    55 
    56 Status PackedAudioWriter::AddSample(size_t stream_id,
    57  const MediaSample& sample) {
    58  DCHECK_EQ(stream_id, 0u);
    59  return segmenter_->AddSample(sample);
    60 }
    61 
    62 Status PackedAudioWriter::FinalizeSegment(size_t stream_id,
    63  const SegmentInfo& segment_info) {
    64  DCHECK_EQ(stream_id, 0u);
    65  // PackedAudio does not support subsegment.
    66  if (segment_info.is_subsegment)
    67  return Status::OK;
    68 
    69  RETURN_IF_ERROR(segmenter_->FinalizeSegment());
    70 
    71  const uint64_t segment_timestamp =
    72  segment_info.start_timestamp * segmenter_->TimescaleScale();
    73  std::string segment_path =
    74  options().segment_template.empty()
    75  ? options().output_file_name
    76  : GetSegmentName(options().segment_template, segment_timestamp,
    77  segment_number_++, options().bandwidth);
    78 
    79  // Save |segment_size| as it will be cleared after writing.
    80  const size_t segment_size = segmenter_->segment_buffer()->Size();
    81 
    82  RETURN_IF_ERROR(WriteSegment(segment_path, segmenter_->segment_buffer()));
    83  total_duration_ += segment_info.duration;
    84 
    85  if (muxer_listener()) {
    86  muxer_listener()->OnNewSegment(
    87  segment_path, segment_timestamp,
    88  segment_info.duration * segmenter_->TimescaleScale(), segment_size);
    89  }
    90  return Status::OK;
    91 }
    92 
    93 Status PackedAudioWriter::WriteSegment(const std::string& segment_path,
    94  BufferWriter* segment_buffer) {
    95  std::unique_ptr<File, FileCloser> file;
    96  if (output_file_) {
    97  // This is in single segment mode.
    98  Range range;
    99  range.start = media_ranges_.subsegment_ranges.empty()
    100  ? 0
    101  : (media_ranges_.subsegment_ranges.back().end + 1);
    102  range.end = range.start + segment_buffer->Size() - 1;
    103  media_ranges_.subsegment_ranges.push_back(range);
    104  } else {
    105  file.reset(File::Open(segment_path.c_str(), "w"));
    106  if (!file) {
    107  return Status(error::FILE_FAILURE,
    108  "Cannot open file for write " + segment_path);
    109  }
    110  }
    111 
    112  RETURN_IF_ERROR(segment_buffer->WriteToFile(output_file_ ? output_file_.get()
    113  : file.get()));
    114 
    115  if (file)
    116  RETURN_IF_ERROR(CloseFile(std::move(file)));
    117  return Status::OK;
    118 }
    119 
    120 Status PackedAudioWriter::CloseFile(std::unique_ptr<File, FileCloser> file) {
    121  std::string file_name = file->file_name();
    122  if (!file.release()->Close()) {
    123  return Status(
    124  error::FILE_FAILURE,
    125  "Cannot close file " + file_name +
    126  ", possibly file permission issue or running out of disk space.");
    127  }
    128  return Status::OK;
    129 }
    130 
    131 } // namespace media
    132 } // namespace shaka
    virtual void OnNewSegment(const std::string &segment_name, uint64_t start_time, uint64_t duration, uint64_t segment_file_size)=0
    - +
    All the methods that are virtual are virtual for mocking.
    @@ -83,11 +83,11 @@ $(function() {
    Status WriteToFile(File *file)
    - +
    diff --git a/docs/d3/df1/box__reader_8cc_source.html b/docs/d3/df1/box__reader_8cc_source.html index 356cf21c09..e6084d4405 100644 --- a/docs/d3/df1/box__reader_8cc_source.html +++ b/docs/d3/df1/box__reader_8cc_source.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/d3/df4/structshaka_1_1media_1_1CueEventInfo-members.html b/docs/d3/df4/structshaka_1_1media_1_1CueEventInfo-members.html index 2ccb90675f..ed8e742863 100644 --- a/docs/d3/df4/structshaka_1_1media_1_1CueEventInfo-members.html +++ b/docs/d3/df4/structshaka_1_1media_1_1CueEventInfo-members.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d3/dfb/classshaka_1_1media_1_1CueAlignmentHandler-members.html b/docs/d3/dfb/classshaka_1_1media_1_1CueAlignmentHandler-members.html index df799463cb..1ba882cc9a 100644 --- a/docs/d3/dfb/classshaka_1_1media_1_1CueAlignmentHandler-members.html +++ b/docs/d3/dfb/classshaka_1_1media_1_1CueAlignmentHandler-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/docs/d3/dfe/classshaka_1_1media_1_1AesPatternCryptor.html b/docs/d3/dfe/classshaka_1_1media_1_1AesPatternCryptor.html index 2f899fbef4..69e1620b1f 100644 --- a/docs/d3/dfe/classshaka_1_1media_1_1AesPatternCryptor.html +++ b/docs/d3/dfe/classshaka_1_1media_1_1AesPatternCryptor.html @@ -276,7 +276,7 @@ AES_KEY * mutable_aes_key< diff --git a/docs/d4/d00/mp4_2multi__segment__segmenter_8cc_source.html b/docs/d4/d00/mp4_2multi__segment__segmenter_8cc_source.html index 9dae62851c..a1e206e2cd 100644 --- a/docs/d4/d00/mp4_2multi__segment__segmenter_8cc_source.html +++ b/docs/d4/d00/mp4_2multi__segment__segmenter_8cc_source.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/d4/d08/classshaka_1_1media_1_1mp4_1_1MP4MediaParser-members.html b/docs/d4/d08/classshaka_1_1media_1_1mp4_1_1MP4MediaParser-members.html index a72264e458..20d4931458 100644 --- a/docs/d4/d08/classshaka_1_1media_1_1mp4_1_1MP4MediaParser-members.html +++ b/docs/d4/d08/classshaka_1_1media_1_1mp4_1_1MP4MediaParser-members.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/d4/d0b/classshaka_1_1media_1_1TextTrack.html b/docs/d4/d0b/classshaka_1_1media_1_1TextTrack.html index 672f90ddc2..ca551fb9b2 100644 --- a/docs/d4/d0b/classshaka_1_1media_1_1TextTrack.html +++ b/docs/d4/d0b/classshaka_1_1media_1_1TextTrack.html @@ -85,7 +85,7 @@ virtual void addWebVTTCue< diff --git a/docs/d4/d0c/text__readers_8h_source.html b/docs/d4/d0c/text__readers_8h_source.html index 5e1ee08ec9..14eeb9542b 100644 --- a/docs/d4/d0c/text__readers_8h_source.html +++ b/docs/d4/d0c/text__readers_8h_source.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d4/d15/gflags__hex__bytes_8cc_source.html b/docs/d4/d15/gflags__hex__bytes_8cc_source.html index 6295f00edb..9519fa0ec3 100644 --- a/docs/d4/d15/gflags__hex__bytes_8cc_source.html +++ b/docs/d4/d15/gflags__hex__bytes_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d4/d18/structshaka_1_1media_1_1mp4_1_1EditListEntry.html b/docs/d4/d18/structshaka_1_1media_1_1mp4_1_1EditListEntry.html index e00891cdb6..ea9ffdf960 100644 --- a/docs/d4/d18/structshaka_1_1media_1_1mp4_1_1EditListEntry.html +++ b/docs/d4/d18/structshaka_1_1media_1_1mp4_1_1EditListEntry.html @@ -73,16 +73,16 @@ $(function() {

    Public Attributes

    -uint64_t segment_duration +uint64_t segment_duration = 0   -int64_t media_time +int64_t media_time = 0   -int16_t media_rate_integer +int16_t media_rate_integer = 0   -int16_t media_rate_fraction +int16_t media_rate_fraction = 0  

    Detailed Description

    @@ -94,7 +94,7 @@ int16_t media_rate_fractio diff --git a/docs/d4/d20/classshaka_1_1media_1_1AesCbcEncryptor.html b/docs/d4/d20/classshaka_1_1media_1_1AesCbcEncryptor.html index a66a729418..f01e284773 100644 --- a/docs/d4/d20/classshaka_1_1media_1_1AesCbcEncryptor.html +++ b/docs/d4/d20/classshaka_1_1media_1_1AesCbcEncryptor.html @@ -214,7 +214,7 @@ AES_KEY * mutable_aes_key< diff --git a/docs/d4/d20/structshaka_1_1media_1_1mp4_1_1ChunkLargeOffset-members.html b/docs/d4/d20/structshaka_1_1media_1_1mp4_1_1ChunkLargeOffset-members.html index 95734b9dc5..5dcd3b6d95 100644 --- a/docs/d4/d20/structshaka_1_1media_1_1mp4_1_1ChunkLargeOffset-members.html +++ b/docs/d4/d20/structshaka_1_1media_1_1mp4_1_1ChunkLargeOffset-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/d4/d22/structshaka_1_1media_1_1SegmentEventInfo-members.html b/docs/d4/d22/structshaka_1_1media_1_1SegmentEventInfo-members.html index 68eed01728..c521933ef1 100644 --- a/docs/d4/d22/structshaka_1_1media_1_1SegmentEventInfo-members.html +++ b/docs/d4/d22/structshaka_1_1media_1_1SegmentEventInfo-members.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d4/d2c/structshaka_1_1media_1_1mp4_1_1ID3v2-members.html b/docs/d4/d2c/structshaka_1_1media_1_1mp4_1_1ID3v2-members.html index bc76fe73ff..23eb00c0ab 100644 --- a/docs/d4/d2c/structshaka_1_1media_1_1mp4_1_1ID3v2-members.html +++ b/docs/d4/d2c/structshaka_1_1media_1_1mp4_1_1ID3v2-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/docs/d4/d33/structshaka_1_1media_1_1mp4_1_1WebVTTSourceLabelBox.html b/docs/d4/d33/structshaka_1_1media_1_1mp4_1_1WebVTTSourceLabelBox.html index 9bb306e15a..fe933095a9 100644 --- a/docs/d4/d33/structshaka_1_1media_1_1mp4_1_1WebVTTSourceLabelBox.html +++ b/docs/d4/d33/structshaka_1_1media_1_1mp4_1_1WebVTTSourceLabelBox.html @@ -112,7 +112,7 @@ Additional Inherited Members

    Detailed Description

    -

    Definition at line 370 of file box_definitions.h.

    +

    Definition at line 377 of file box_definitions.h.

    Member Function Documentation

    ◆ BoxType()

    @@ -140,7 +140,7 @@ Additional Inherited Members

    Implements shaka::media::mp4::Box.

    -

    Definition at line 1829 of file box_definitions.cc.

    +

    Definition at line 1862 of file box_definitions.cc.

    @@ -151,7 +151,7 @@ Additional Inherited Members diff --git a/docs/d4/d37/io__cache_8cc_source.html b/docs/d4/d37/io__cache_8cc_source.html index 8dce922997..54a1a9ab18 100644 --- a/docs/d4/d37/io__cache_8cc_source.html +++ b/docs/d4/d37/io__cache_8cc_source.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/d4/d3a/structshaka_1_1media_1_1H264Sps-members.html b/docs/d4/d3a/structshaka_1_1media_1_1H264Sps-members.html index 3a81062c89..12dbbbb3f2 100644 --- a/docs/d4/d3a/structshaka_1_1media_1_1H264Sps-members.html +++ b/docs/d4/d3a/structshaka_1_1media_1_1H264Sps-members.html @@ -118,7 +118,7 @@ $(function() { diff --git a/docs/d4/d40/sample__aes__ec3__cryptor_8h_source.html b/docs/d4/d40/sample__aes__ec3__cryptor_8h_source.html index 26d894eac9..37c02ff410 100644 --- a/docs/d4/d40/sample__aes__ec3__cryptor_8h_source.html +++ b/docs/d4/d40/sample__aes__ec3__cryptor_8h_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d4/d43/classshaka_1_1media_1_1ChunkingHandler.html b/docs/d4/d43/classshaka_1_1media_1_1ChunkingHandler.html index b92f4df480..4c0be4cda4 100644 --- a/docs/d4/d43/classshaka_1_1media_1_1ChunkingHandler.html +++ b/docs/d4/d43/classshaka_1_1media_1_1ChunkingHandler.html @@ -250,7 +250,7 @@ class ChunkingHandlerTest< diff --git a/docs/d4/d4a/structshaka_1_1media_1_1mp4_1_1SampleAuxiliaryInformationOffset-members.html b/docs/d4/d4a/structshaka_1_1media_1_1mp4_1_1SampleAuxiliaryInformationOffset-members.html index ad22fe782a..b759407dc6 100644 --- a/docs/d4/d4a/structshaka_1_1media_1_1mp4_1_1SampleAuxiliaryInformationOffset-members.html +++ b/docs/d4/d4a/structshaka_1_1media_1_1mp4_1_1SampleAuxiliaryInformationOffset-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/d4/d4c/structshaka_1_1media_1_1H264WeightingFactors.html b/docs/d4/d4c/structshaka_1_1media_1_1H264WeightingFactors.html index 279ff64f16..1adb431201 100644 --- a/docs/d4/d4c/structshaka_1_1media_1_1H264WeightingFactors.html +++ b/docs/d4/d4c/structshaka_1_1media_1_1H264WeightingFactors.html @@ -100,7 +100,7 @@ int chroma_offset [32] diff --git a/docs/d4/d58/classshaka_1_1media_1_1Nalu-members.html b/docs/d4/d58/classshaka_1_1media_1_1Nalu-members.html index ef04e1b100..acd98f2da3 100644 --- a/docs/d4/d58/classshaka_1_1media_1_1Nalu-members.html +++ b/docs/d4/d58/classshaka_1_1media_1_1Nalu-members.html @@ -135,7 +135,7 @@ $(function() { diff --git a/docs/d4/d59/classshaka_1_1media_1_1WebMWebVTTParser.html b/docs/d4/d59/classshaka_1_1media_1_1WebMWebVTTParser.html index 50e4b69a11..3a4dfa3554 100644 --- a/docs/d4/d59/classshaka_1_1media_1_1WebMWebVTTParser.html +++ b/docs/d4/d59/classshaka_1_1media_1_1WebMWebVTTParser.html @@ -87,7 +87,7 @@ static void  diff --git a/docs/d4/d5c/classshaka_1_1media_1_1DecryptConfig-members.html b/docs/d4/d5c/classshaka_1_1media_1_1DecryptConfig-members.html index 5f90ff7386..1a0303c029 100644 --- a/docs/d4/d5c/classshaka_1_1media_1_1DecryptConfig-members.html +++ b/docs/d4/d5c/classshaka_1_1media_1_1DecryptConfig-members.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/d4/d61/ad__cue__generator__flags_8h_source.html b/docs/d4/d61/ad__cue__generator__flags_8h_source.html index f11805cf7f..2fa91945c7 100644 --- a/docs/d4/d61/ad__cue__generator__flags_8h_source.html +++ b/docs/d4/d61/ad__cue__generator__flags_8h_source.html @@ -69,7 +69,7 @@ $(function() {
    1 // Copyright 2017 Google Inc. All rights reserved.
    2 //
    3 // Use of this source code is governed by a BSD-style
    4 // license that can be found in the LICENSE file or at
    5 // https://developers.google.com/open-source/licenses/bsd
    6 
    7 #ifndef PACKAGER_APP_AD_CUE_GENERATOR_FLAGS_H_
    8 #define PACKAGER_APP_AD_CUE_GENERATOR_FLAGS_H_
    9 
    10 #include <gflags/gflags.h>
    11 
    12 DECLARE_string(ad_cues);
    13 
    14 #endif // PACKAGER_APP_AD_CUE_GENERATOR_FLAGS_H_
    diff --git a/docs/d4/d70/structshaka_1_1SegmentInfo-members.html b/docs/d4/d70/structshaka_1_1SegmentInfo-members.html index f0dbbef910..256cde946f 100644 --- a/docs/d4/d70/structshaka_1_1SegmentInfo-members.html +++ b/docs/d4/d70/structshaka_1_1SegmentInfo-members.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d4/d87/nalu__reader_8h_source.html b/docs/d4/d87/nalu__reader_8h_source.html index 6810cc5d87..f429e0a321 100644 --- a/docs/d4/d87/nalu__reader_8h_source.html +++ b/docs/d4/d87/nalu__reader_8h_source.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d4/d87/text__sample_8cc_source.html b/docs/d4/d87/text__sample_8cc_source.html index 4085628f46..330b1bd0e4 100644 --- a/docs/d4/d87/text__sample_8cc_source.html +++ b/docs/d4/d87/text__sample_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d4/d8a/classshaka_1_1media_1_1HEVCDecoderConfigurationRecord.html b/docs/d4/d8a/classshaka_1_1media_1_1HEVCDecoderConfigurationRecord.html index 7a8079c6dc..e84d3708cd 100644 --- a/docs/d4/d8a/classshaka_1_1media_1_1HEVCDecoderConfigurationRecord.html +++ b/docs/d4/d8a/classshaka_1_1media_1_1HEVCDecoderConfigurationRecord.html @@ -149,7 +149,7 @@ void  diff --git a/docs/d4/d8c/classshaka_1_1BandwidthEstimator-members.html b/docs/d4/d8c/classshaka_1_1BandwidthEstimator-members.html index 355228015c..aa3f0e5986 100644 --- a/docs/d4/d8c/classshaka_1_1BandwidthEstimator-members.html +++ b/docs/d4/d8c/classshaka_1_1BandwidthEstimator-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d4/d8d/structshaka_1_1media_1_1mp4_1_1EC3Specific.html b/docs/d4/d8d/structshaka_1_1media_1_1mp4_1_1EC3Specific.html index 8ec0728e86..897f53be89 100644 --- a/docs/d4/d8d/structshaka_1_1media_1_1mp4_1_1EC3Specific.html +++ b/docs/d4/d8d/structshaka_1_1media_1_1mp4_1_1EC3Specific.html @@ -112,7 +112,7 @@ Additional Inherited Members

    Detailed Description

    -

    Definition at line 319 of file box_definitions.h.

    +

    Definition at line 322 of file box_definitions.h.

    Member Function Documentation

    ◆ BoxType()

    @@ -140,7 +140,7 @@ Additional Inherited Members

    Implements shaka::media::mp4::Box.

    -

    Definition at line 1645 of file box_definitions.cc.

    +

    Definition at line 1681 of file box_definitions.cc.

    @@ -151,7 +151,7 @@ Additional Inherited Members diff --git a/docs/d4/d9b/classshaka_1_1media_1_1MediaHandlerTestBase.html b/docs/d4/d9b/classshaka_1_1media_1_1MediaHandlerTestBase.html index 8f0cd8065c..2c8dfc9b03 100644 --- a/docs/d4/d9b/classshaka_1_1media_1_1MediaHandlerTestBase.html +++ b/docs/d4/d9b/classshaka_1_1media_1_1MediaHandlerTestBase.html @@ -132,7 +132,7 @@ std::unique_ptr<

    Detailed Description

    -

    Definition at line 195 of file media_handler_test_base.h.

    +

    Definition at line 194 of file media_handler_test_base.h.


    The documentation for this class was generated from the following files:
    • packager/media/base/media_handler_test_base.h
    • packager/media/base/media_handler_test_base.cc
    • @@ -140,7 +140,7 @@ std::unique_ptr< diff --git a/docs/d4/da6/classshaka_1_1media_1_1PlayReadyKeySource.html b/docs/d4/da6/classshaka_1_1media_1_1PlayReadyKeySource.html index a01f56dc4c..c83156c58a 100644 --- a/docs/d4/da6/classshaka_1_1media_1_1PlayReadyKeySource.html +++ b/docs/d4/da6/classshaka_1_1media_1_1PlayReadyKeySource.html @@ -467,7 +467,7 @@ Additional Inherited Members diff --git a/docs/d4/da7/segmenter__test__base_8cc_source.html b/docs/d4/da7/segmenter__test__base_8cc_source.html index f9172d7afc..1a1a083ff0 100644 --- a/docs/d4/da7/segmenter__test__base_8cc_source.html +++ b/docs/d4/da7/segmenter__test__base_8cc_source.html @@ -78,14 +78,14 @@ $(function() {
      void Reset()
      Resets the state of the parser so it can start parsing a new list.
      Definition: webm_parser.cc:733
      int Parse(const uint8_t *buf, int size)
      Definition: webm_parser.cc:738
      std::string OutputFileName() const
      Gets the file name of the current output file.
      -
      std::string temp_dir
      Specify temporary directory for intermediate files.
      Definition: muxer_options.h:39
      +
      std::string temp_dir
      Specify temporary directory for intermediate files.
      Definition: muxer_options.h:46
      static std::shared_ptr< MediaSample > CopyFrom(const uint8_t *data, size_t size, bool is_key_frame)
      Definition: media_sample.cc:42
      Holds video stream information.
      diff --git a/docs/d4/dad/structshaka_1_1media_1_1mp4_1_1SampleEncryption.html b/docs/d4/dad/structshaka_1_1media_1_1mp4_1_1SampleEncryption.html index e2e55627a9..d51a9c52b2 100644 --- a/docs/d4/dad/structshaka_1_1media_1_1mp4_1_1SampleEncryption.html +++ b/docs/d4/dad/structshaka_1_1media_1_1mp4_1_1SampleEncryption.html @@ -66,6 +66,7 @@ $(function() { Public Types | Public Member Functions | Public Attributes | +Static Public Attributes | List of all members
      shaka::media::mp4::SampleEncryption Struct Reference
      @@ -114,19 +115,25 @@ Public Attributes std::vector< uint8_t > sample_encryption_data   -uint8_t iv_size +uint8_t iv_size = kInvalidIvSize   std::vector< SampleEncryptionEntrysample_encryption_entries   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0   + + + +

      +Static Public Attributes

      +static const uint8_t kInvalidIvSize = 1
       
      @@ -135,7 +142,7 @@ Additional Inherited Members

      Additional Inherited Members

      - Protected Member Functions inherited from shaka::media::mp4::FullBox

      Detailed Description

      -

      Definition at line 108 of file box_definitions.h.

      +

      Definition at line 105 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -163,7 +170,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 304 of file box_definitions.cc.

      +

      Definition at line 310 of file box_definitions.cc.

      @@ -201,7 +208,7 @@ Additional Inherited Members
      Returns
      true on success, false otherwise.
      -

      Definition at line 357 of file box_definitions.cc.

      +

      Definition at line 365 of file box_definitions.cc.

      @@ -219,7 +226,7 @@ Additional Inherited Members

      We may not know iv_size before reading this box. In this case, we will store sample encryption data for parsing later when iv_size is known.

      -

      Definition at line 125 of file box_definitions.h.

      +

      Definition at line 124 of file box_definitions.h.

      @@ -230,7 +237,7 @@ Additional Inherited Members diff --git a/docs/d4/db1/structshaka_1_1media_1_1mp4_1_1CompactSampleSize-members.html b/docs/d4/db1/structshaka_1_1media_1_1mp4_1_1CompactSampleSize-members.html index 2f6d4d45c4..3f8b4c0a69 100644 --- a/docs/d4/db1/structshaka_1_1media_1_1mp4_1_1CompactSampleSize-members.html +++ b/docs/d4/db1/structshaka_1_1media_1_1mp4_1_1CompactSampleSize-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/docs/d4/db2/cluster__builder_8h_source.html b/docs/d4/db2/cluster__builder_8h_source.html index 7be172771b..3b3d43e4ea 100644 --- a/docs/d4/db2/cluster__builder_8h_source.html +++ b/docs/d4/db2/cluster__builder_8h_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/d4/db4/classshaka_1_1MpdNotifierFactory.html b/docs/d4/db4/classshaka_1_1MpdNotifierFactory.html index aa7f6a920e..0b8dc27cdc 100644 --- a/docs/d4/db4/classshaka_1_1MpdNotifierFactory.html +++ b/docs/d4/db4/classshaka_1_1MpdNotifierFactory.html @@ -88,7 +88,7 @@ virtual std::unique_ptr< diff --git a/docs/d4/db9/structshaka_1_1media_1_1mp4_1_1MediaHeader.html b/docs/d4/db9/structshaka_1_1media_1_1mp4_1_1MediaHeader.html index 8ae4cc7b28..c4164c2f2d 100644 --- a/docs/d4/db9/structshaka_1_1media_1_1mp4_1_1MediaHeader.html +++ b/docs/d4/db9/structshaka_1_1media_1_1mp4_1_1MediaHeader.html @@ -103,26 +103,26 @@ Public Member Functions

      Public Attributes

      -uint64_t creation_time +uint64_t creation_time = 0u   -uint64_t modification_time +uint64_t modification_time = 0u   -uint32_t timescale +uint32_t timescale = 0u   -uint64_t duration +uint64_t duration = 0u   Language language   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

      @@ -133,7 +133,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 555 of file box_definitions.h.

      +

      Definition at line 560 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -161,7 +161,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 1885 of file box_definitions.cc.

      +

      Definition at line 1917 of file box_definitions.cc.

      @@ -172,7 +172,7 @@ Additional Inherited Members diff --git a/docs/d4/dcb/classshaka_1_1UdpFile.html b/docs/d4/dcb/classshaka_1_1UdpFile.html index e0b3ebb859..719d390cfd 100644 --- a/docs/d4/dcb/classshaka_1_1UdpFile.html +++ b/docs/d4/dcb/classshaka_1_1UdpFile.html @@ -456,7 +456,7 @@ Additional Inherited Members diff --git a/docs/d4/dd3/bit__reader_8h_source.html b/docs/d4/dd3/bit__reader_8h_source.html index 29d25d5ec3..e545223827 100644 --- a/docs/d4/dd3/bit__reader_8h_source.html +++ b/docs/d4/dd3/bit__reader_8h_source.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/d4/dd4/structshaka_1_1media_1_1mp4_1_1FullBox-members.html b/docs/d4/dd4/structshaka_1_1media_1_1mp4_1_1FullBox-members.html index 1b0b1f82f3..4b9e3e292f 100644 --- a/docs/d4/dd4/structshaka_1_1media_1_1mp4_1_1FullBox-members.html +++ b/docs/d4/dd4/structshaka_1_1media_1_1mp4_1_1FullBox-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/docs/d4/dd6/raw__key__source_8cc_source.html b/docs/d4/dd6/raw__key__source_8cc_source.html index d45e1d4b96..3c5e61f04e 100644 --- a/docs/d4/dd6/raw__key__source_8cc_source.html +++ b/docs/d4/dd6/raw__key__source_8cc_source.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/d4/dde/webvtt__util_8h_source.html b/docs/d4/dde/webvtt__util_8h_source.html index 1158efb8c9..d890bd642a 100644 --- a/docs/d4/dde/webvtt__util_8h_source.html +++ b/docs/d4/dde/webvtt__util_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d4/de3/structshaka_1_1media_1_1mp4_1_1DataReference.html b/docs/d4/de3/structshaka_1_1media_1_1mp4_1_1DataReference.html index 459d81e16a..e9f7acef8c 100644 --- a/docs/d4/de3/structshaka_1_1media_1_1mp4_1_1DataReference.html +++ b/docs/d4/de3/structshaka_1_1media_1_1mp4_1_1DataReference.html @@ -103,14 +103,14 @@ Public Member Functions

      Public Attributes

      -std::vector< DataEntryUrldata_entry +std::vector< DataEntryUrldata_entry = std::vector<DataEntryUrl>(1)   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

      @@ -121,7 +121,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 590 of file box_definitions.h.

      +

      Definition at line 595 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -149,7 +149,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 1980 of file box_definitions.cc.

      +

      Definition at line 2025 of file box_definitions.cc.

      @@ -160,7 +160,7 @@ Additional Inherited Members diff --git a/docs/d4/de6/classshaka_1_1media_1_1ProgressListener.html b/docs/d4/de6/classshaka_1_1media_1_1ProgressListener.html index 0536814482..29785f1fcc 100644 --- a/docs/d4/de6/classshaka_1_1media_1_1ProgressListener.html +++ b/docs/d4/de6/classshaka_1_1media_1_1ProgressListener.html @@ -123,7 +123,7 @@ Public Member Functions diff --git a/docs/d4/de7/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener-members.html b/docs/d4/de7/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener-members.html index 6e242089e2..af5bc9c2f6 100644 --- a/docs/d4/de7/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener-members.html +++ b/docs/d4/de7/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/docs/d4/dec/hls__flags_8h_source.html b/docs/d4/dec/hls__flags_8h_source.html index 0a44c4427d..4d241ef4a2 100644 --- a/docs/d4/dec/hls__flags_8h_source.html +++ b/docs/d4/dec/hls__flags_8h_source.html @@ -69,7 +69,7 @@ $(function() {
      1 // Copyright 2016 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #ifndef PACKAGER_APP_HLS_FLAGS_H_
      8 #define PACKAGER_APP_HLS_FLAGS_H_
      9 
      10 #include <gflags/gflags.h>
      11 
      12 DECLARE_string(hls_master_playlist_output);
      13 DECLARE_string(hls_base_url);
      14 DECLARE_string(hls_key_uri);
      15 DECLARE_string(hls_playlist_type);
      16 
      17 #endif // PACKAGER_APP_HLS_FLAGS_H_
      diff --git a/docs/d4/df5/request__signer_8cc_source.html b/docs/d4/df5/request__signer_8cc_source.html index c475939546..eb05ff7815 100644 --- a/docs/d4/df5/request__signer_8cc_source.html +++ b/docs/d4/df5/request__signer_8cc_source.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/d4/df9/structshaka_1_1media_1_1mp4_1_1SegmentIndex.html b/docs/d4/df9/structshaka_1_1media_1_1mp4_1_1SegmentIndex.html index 715515e5c2..98e2d506c1 100644 --- a/docs/d4/df9/structshaka_1_1media_1_1mp4_1_1SegmentIndex.html +++ b/docs/d4/df9/structshaka_1_1media_1_1mp4_1_1SegmentIndex.html @@ -103,26 +103,26 @@ Public Member Functions

      Public Attributes

      -uint32_t reference_id +uint32_t reference_id = 0u   -uint32_t timescale +uint32_t timescale = 0u   -uint64_t earliest_presentation_time +uint64_t earliest_presentation_time = 0u   -uint64_t first_offset +uint64_t first_offset = 0u   std::vector< SegmentReferencereferences   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

      @@ -133,7 +133,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 770 of file box_definitions.h.

      +

      Definition at line 775 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -161,7 +161,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 2518 of file box_definitions.cc.

      +

      Definition at line 2583 of file box_definitions.cc.

      @@ -172,7 +172,7 @@ Additional Inherited Members diff --git a/docs/d4/dfa/structshaka_1_1media_1_1mp4_1_1AC3Specific.html b/docs/d4/dfa/structshaka_1_1media_1_1mp4_1_1AC3Specific.html index ee34199284..42e8ecea74 100644 --- a/docs/d4/dfa/structshaka_1_1media_1_1mp4_1_1AC3Specific.html +++ b/docs/d4/dfa/structshaka_1_1media_1_1mp4_1_1AC3Specific.html @@ -112,7 +112,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 313 of file box_definitions.h.

      +

      Definition at line 316 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -140,7 +140,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 1626 of file box_definitions.cc.

      +

      Definition at line 1660 of file box_definitions.cc.

      @@ -151,7 +151,7 @@ Additional Inherited Members diff --git a/docs/d4/dfd/structshaka_1_1media_1_1H265Sps.html b/docs/d4/dfd/structshaka_1_1media_1_1H265Sps.html index 80765575e5..3cfadc8f9f 100644 --- a/docs/d4/dfd/structshaka_1_1media_1_1H265Sps.html +++ b/docs/d4/dfd/structshaka_1_1media_1_1H265Sps.html @@ -234,7 +234,7 @@ bool vui_parameters_presen diff --git a/docs/d4/dff/webm__media__parser_8cc_source.html b/docs/d4/dff/webm__media__parser_8cc_source.html index 1b117f5e3d..eb1fc06dc1 100644 --- a/docs/d4/dff/webm__media__parser_8cc_source.html +++ b/docs/d4/dff/webm__media__parser_8cc_source.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/d5/d03/structshaka_1_1media_1_1mp4_1_1FileType.html b/docs/d5/d03/structshaka_1_1media_1_1mp4_1_1FileType.html index a0f296a5c6..4363ab3340 100644 --- a/docs/d5/d03/structshaka_1_1media_1_1mp4_1_1FileType.html +++ b/docs/d5/d03/structshaka_1_1media_1_1mp4_1_1FileType.html @@ -102,10 +102,10 @@ Public Member Functions

      Public Attributes

      -FourCC major_brand +FourCC major_brand = FOURCC_NULL   -uint32_t minor_version +uint32_t minor_version = 0   std::vector< FourCC > compatible_brands @@ -119,7 +119,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 45 of file box_definitions.h.

      +

      Definition at line 46 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -149,7 +149,7 @@ Additional Inherited Members

      Reimplemented in shaka::media::mp4::SegmentType.

      -

      Definition at line 133 of file box_definitions.cc.

      +

      Definition at line 129 of file box_definitions.cc.

      @@ -160,7 +160,7 @@ Additional Inherited Members diff --git a/docs/d5/d05/structshaka_1_1media_1_1mp4_1_1OriginalFormat.html b/docs/d5/d05/structshaka_1_1media_1_1mp4_1_1OriginalFormat.html index 4ceffdca96..674be7038b 100644 --- a/docs/d5/d05/structshaka_1_1media_1_1mp4_1_1OriginalFormat.html +++ b/docs/d5/d05/structshaka_1_1media_1_1mp4_1_1OriginalFormat.html @@ -101,7 +101,7 @@ Public Member Functions

      Public Attributes

      -FourCC format +FourCC format = FOURCC_NULL  

      @@ -112,7 +112,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 131 of file box_definitions.h.

      +

      Definition at line 130 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -140,7 +140,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 377 of file box_definitions.cc.

      +

      Definition at line 386 of file box_definitions.cc.

      @@ -151,7 +151,7 @@ Additional Inherited Members diff --git a/docs/d5/d09/structshaka_1_1media_1_1mp4_1_1CueIDBox.html b/docs/d5/d09/structshaka_1_1media_1_1mp4_1_1CueIDBox.html index fd06dcd703..3117fdf53e 100644 --- a/docs/d5/d09/structshaka_1_1media_1_1mp4_1_1CueIDBox.html +++ b/docs/d5/d09/structshaka_1_1media_1_1mp4_1_1CueIDBox.html @@ -112,7 +112,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 797 of file box_definitions.h.

      +

      Definition at line 808 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -140,7 +140,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 2620 of file box_definitions.cc.

      +

      Definition at line 2692 of file box_definitions.cc.

      @@ -151,7 +151,7 @@ Additional Inherited Members diff --git a/docs/d5/d0f/structshaka_1_1EncryptionParams_1_1EncryptedStreamAttributes-members.html b/docs/d5/d0f/structshaka_1_1EncryptionParams_1_1EncryptedStreamAttributes-members.html index 1ed31354bb..594b97d682 100644 --- a/docs/d5/d0f/structshaka_1_1EncryptionParams_1_1EncryptedStreamAttributes-members.html +++ b/docs/d5/d0f/structshaka_1_1EncryptionParams_1_1EncryptedStreamAttributes-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d5/d11/classshaka_1_1media_1_1WebMInfoParser-members.html b/docs/d5/d11/classshaka_1_1media_1_1WebMInfoParser-members.html index 6e769045c8..9f8ad43068 100644 --- a/docs/d5/d11/classshaka_1_1media_1_1WebMInfoParser-members.html +++ b/docs/d5/d11/classshaka_1_1media_1_1WebMInfoParser-members.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/d5/d11/structshaka_1_1media_1_1mp4_1_1ElementaryStreamDescriptor.html b/docs/d5/d11/structshaka_1_1media_1_1mp4_1_1ElementaryStreamDescriptor.html index d174d8965d..4373be5433 100644 --- a/docs/d5/d11/structshaka_1_1media_1_1mp4_1_1ElementaryStreamDescriptor.html +++ b/docs/d5/d11/structshaka_1_1media_1_1mp4_1_1ElementaryStreamDescriptor.html @@ -110,10 +110,10 @@ Public Attributes   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

      @@ -124,7 +124,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 296 of file box_definitions.h.

      +

      Definition at line 299 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -152,7 +152,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 1561 of file box_definitions.cc.

      +

      Definition at line 1593 of file box_definitions.cc.

      @@ -163,7 +163,7 @@ Additional Inherited Members diff --git a/docs/d5/d13/classshaka_1_1media_1_1ESDescriptor.html b/docs/d5/d13/classshaka_1_1media_1_1ESDescriptor.html index e6dfa7fb7d..94a94020f0 100644 --- a/docs/d5/d13/classshaka_1_1media_1_1ESDescriptor.html +++ b/docs/d5/d13/classshaka_1_1media_1_1ESDescriptor.html @@ -159,7 +159,7 @@ bool IsDTS () const diff --git a/docs/d5/d15/producer__consumer__queue_8h_source.html b/docs/d5/d15/producer__consumer__queue_8h_source.html index 585cfc16ac..2eb804e55d 100644 --- a/docs/d5/d15/producer__consumer__queue_8h_source.html +++ b/docs/d5/d15/producer__consumer__queue_8h_source.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/d5/d1a/classshaka_1_1Packager-members.html b/docs/d5/d1a/classshaka_1_1Packager-members.html index d64e6a5a21..bb7e0c0284 100644 --- a/docs/d5/d1a/classshaka_1_1Packager-members.html +++ b/docs/d5/d1a/classshaka_1_1Packager-members.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/d5/d1a/ts__section_8h_source.html b/docs/d5/d1a/ts__section_8h_source.html index d50192c27c..d50790b580 100644 --- a/docs/d5/d1a/ts__section_8h_source.html +++ b/docs/d5/d1a/ts__section_8h_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d5/d1d/playready__pssh__generator_8cc_source.html b/docs/d5/d1d/playready__pssh__generator_8cc_source.html index dda2596017..4445a573cf 100644 --- a/docs/d5/d1d/playready__pssh__generator_8cc_source.html +++ b/docs/d5/d1d/playready__pssh__generator_8cc_source.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d5/d26/classshaka_1_1media_1_1mp4_1_1TrackRunIterator-members.html b/docs/d5/d26/classshaka_1_1media_1_1mp4_1_1TrackRunIterator-members.html index 971a480662..8b6fc76b0e 100644 --- a/docs/d5/d26/classshaka_1_1media_1_1mp4_1_1TrackRunIterator-members.html +++ b/docs/d5/d26/classshaka_1_1media_1_1mp4_1_1TrackRunIterator-members.html @@ -98,7 +98,7 @@ $(function() { diff --git a/docs/d5/d27/key__fetcher_8cc_source.html b/docs/d5/d27/key__fetcher_8cc_source.html index 3c32a870d1..5a9940c551 100644 --- a/docs/d5/d27/key__fetcher_8cc_source.html +++ b/docs/d5/d27/key__fetcher_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d5/d2a/proto__json__util_8cc_source.html b/docs/d5/d2a/proto__json__util_8cc_source.html index a21013e7f2..5bd33b6c5d 100644 --- a/docs/d5/d2a/proto__json__util_8cc_source.html +++ b/docs/d5/d2a/proto__json__util_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html b/docs/d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html index 0fa98b960a..aa0b3e42c3 100644 --- a/docs/d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html +++ b/docs/d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html @@ -494,7 +494,7 @@ template<class T > diff --git a/docs/d5/d3b/structshaka_1_1media_1_1mp4_1_1Media-members.html b/docs/d5/d3b/structshaka_1_1media_1_1mp4_1_1Media-members.html index 729918333b..d9c5e6106f 100644 --- a/docs/d5/d3b/structshaka_1_1media_1_1mp4_1_1Media-members.html +++ b/docs/d5/d3b/structshaka_1_1media_1_1mp4_1_1Media-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/docs/d5/d3e/classshaka_1_1media_1_1TextChunker.html b/docs/d5/d3e/classshaka_1_1media_1_1TextChunker.html index 30562bd9e6..e33b046dd4 100644 --- a/docs/d5/d3e/classshaka_1_1media_1_1TextChunker.html +++ b/docs/d5/d3e/classshaka_1_1media_1_1TextChunker.html @@ -164,7 +164,7 @@ const std::map< size_t, std::pair< std::shared_ptr< diff --git a/docs/d5/d40/webm_2single__segment__segmenter_8h_source.html b/docs/d5/d40/webm_2single__segment__segmenter_8h_source.html index 3d077fd9da..fecc8acdf3 100644 --- a/docs/d5/d40/webm_2single__segment__segmenter_8h_source.html +++ b/docs/d5/d40/webm_2single__segment__segmenter_8h_source.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d5/d4b/classshaka_1_1media_1_1mp2t_1_1TsSectionPsi-members.html b/docs/d5/d4b/classshaka_1_1media_1_1mp2t_1_1TsSectionPsi-members.html index 9c358f9739..2bb7584afc 100644 --- a/docs/d5/d4b/classshaka_1_1media_1_1mp2t_1_1TsSectionPsi-members.html +++ b/docs/d5/d4b/classshaka_1_1media_1_1mp2t_1_1TsSectionPsi-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/docs/d5/d4b/packed__audio__writer_8h_source.html b/docs/d5/d4b/packed__audio__writer_8h_source.html index aa4af8d4ff..e87ed36943 100644 --- a/docs/d5/d4b/packed__audio__writer_8h_source.html +++ b/docs/d5/d4b/packed__audio__writer_8h_source.html @@ -67,7 +67,7 @@ $(function() {
      1 // Copyright 2018 Google LLC. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #ifndef PACKAGER_MEDIA_FORMATS_PACKED_AUDIO_PACKED_AUDIO_WRITER_H_
      8 #define PACKAGER_MEDIA_FORMATS_PACKED_AUDIO_PACKED_AUDIO_WRITER_H_
      9 
      10 #include "packager/file/file_closer.h"
      11 #include "packager/media/base/muxer.h"
      12 
      13 namespace shaka {
      14 namespace media {
      15 
      16 class BufferWriter;
      17 class PackedAudioSegmenter;
      18 
      23 class PackedAudioWriter : public Muxer {
      24  public:
      26  explicit PackedAudioWriter(const MuxerOptions& muxer_options);
      27  ~PackedAudioWriter() override;
      28 
      29  private:
      30  friend class PackedAudioWriterTest;
      31 
      32  PackedAudioWriter(const PackedAudioWriter&) = delete;
      33  PackedAudioWriter& operator=(const PackedAudioWriter&) = delete;
      34 
      35  // Muxer implementations.
      36  Status InitializeMuxer() override;
      37  Status Finalize() override;
      38  Status AddSample(size_t stream_id, const MediaSample& sample) override;
      39  Status FinalizeSegment(size_t stream_id, const SegmentInfo& sample) override;
      40 
      41  Status WriteSegment(const std::string& segment_path,
      42  BufferWriter* segment_buffer);
      43 
      44  Status CloseFile(std::unique_ptr<File, FileCloser> file);
      45 
      46  std::unique_ptr<PackedAudioSegmenter> segmenter_;
      47 
      48  // Used in single segment mode.
      49  std::unique_ptr<File, FileCloser> output_file_;
      50  // Keeps track of segment ranges in single segment mode.
      51  MuxerListener::MediaRanges media_ranges_;
      52  uint64_t total_duration_ = 0;
      53 
      54  // Used in multi-segment mode for segment template.
      55  uint64_t segment_number_ = 0;
      56 };
      57 
      58 } // namespace media
      59 } // namespace shaka
      60 
      61 #endif // PACKAGER_MEDIA_FORMATS_PACKED_AUDIO_PACKED_AUDIO_WRITER_H_
      - +
      All the methods that are virtual are virtual for mocking.
      This structure contains the list of configuration options for Muxer.
      Definition: muxer_options.h:20
      @@ -79,7 +79,7 @@ $(function() {
      diff --git a/docs/d5/d4d/box_8cc_source.html b/docs/d5/d4d/box_8cc_source.html index dd742e662c..64fe24a772 100644 --- a/docs/d5/d4d/box_8cc_source.html +++ b/docs/d5/d4d/box_8cc_source.html @@ -66,7 +66,7 @@ $(function() {
      box.cc
      -
      1 // Copyright 2014 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #include "packager/media/formats/mp4/box.h"
      8 
      9 #include "packager/base/logging.h"
      10 #include "packager/media/formats/mp4/box_buffer.h"
      11 
      12 namespace shaka {
      13 namespace media {
      14 namespace mp4 {
      15 
      16 Box::Box() : box_size_(0) {}
      17 Box::~Box() {}
      18 
      19 bool Box::Parse(BoxReader* reader) {
      20  DCHECK(reader);
      21  BoxBuffer buffer(reader);
      22  return ReadWriteInternal(&buffer);
      23 }
      24 
      25 void Box::Write(BufferWriter* writer) {
      26  DCHECK(writer);
      27  // Compute and update box size.
      28  uint32_t size = ComputeSize();
      29  DCHECK_EQ(size, box_size_);
      30 
      31  size_t buffer_size_before_write = writer->Size();
      32  BoxBuffer buffer(writer);
      33  CHECK(ReadWriteInternal(&buffer));
      34  DCHECK_EQ(box_size_, writer->Size() - buffer_size_before_write)
      35  << FourCCToString(BoxType());
      36 }
      37 
      38 void Box::WriteHeader(BufferWriter* writer) {
      39  DCHECK(writer);
      40  // Compute and update box size.
      41  uint32_t size = ComputeSize();
      42  DCHECK_EQ(size, box_size_);
      43 
      44  size_t buffer_size_before_write = writer->Size();
      45  BoxBuffer buffer(writer);
      46  CHECK(ReadWriteHeaderInternal(&buffer));
      47  DCHECK_EQ(HeaderSize(), writer->Size() - buffer_size_before_write);
      48 }
      49 
      50 uint32_t Box::ComputeSize() {
      51  box_size_ = static_cast<uint32_t>(ComputeSizeInternal());
      52  return box_size_;
      53 }
      54 
      55 uint32_t Box::HeaderSize() const {
      56  const uint32_t kFourCCSize = 4;
      57  // We don't support 64-bit size.
      58  return kFourCCSize + sizeof(uint32_t);
      59 }
      60 
      61 bool Box::ReadWriteHeaderInternal(BoxBuffer* buffer) {
      62  if (buffer->Reading()) {
      63  // Skip for read mode, which is handled already in BoxReader.
      64  } else {
      65  CHECK(buffer->ReadWriteUInt32(&box_size_));
      66  FourCC fourcc = BoxType();
      67  CHECK(buffer->ReadWriteFourCC(&fourcc));
      68  }
      69  return true;
      70 }
      71 
      72 FullBox::FullBox() : version(0), flags(0) {}
      73 FullBox::~FullBox() {}
      74 
      75 uint32_t FullBox::HeaderSize() const {
      76  // Additional 1-byte version and 3-byte flags.
      77  return Box::HeaderSize() + 1 + 3;
      78 }
      79 
      80 bool FullBox::ReadWriteHeaderInternal(BoxBuffer* buffer) {
      81  RCHECK(Box::ReadWriteHeaderInternal(buffer));
      82 
      83  uint32_t vflags;
      84  if (buffer->Reading()) {
      85  RCHECK(buffer->ReadWriteUInt32(&vflags));
      86  this->version = vflags >> 24;
      87  this->flags = vflags & 0x00FFFFFF;
      88  } else {
      89  vflags = (this->version << 24) | this->flags;
      90  RCHECK(buffer->ReadWriteUInt32(&vflags));
      91  }
      92  return true;
      93 }
      94 
      95 } // namespace mp4
      96 } // namespace media
      97 } // namespace shaka
      +
      1 // Copyright 2014 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #include "packager/media/formats/mp4/box.h"
      8 
      9 #include "packager/base/logging.h"
      10 #include "packager/media/formats/mp4/box_buffer.h"
      11 
      12 namespace shaka {
      13 namespace media {
      14 namespace mp4 {
      15 
      16 Box::Box() : box_size_(0) {}
      17 Box::~Box() {}
      18 
      19 bool Box::Parse(BoxReader* reader) {
      20  DCHECK(reader);
      21  BoxBuffer buffer(reader);
      22  return ReadWriteInternal(&buffer);
      23 }
      24 
      25 void Box::Write(BufferWriter* writer) {
      26  DCHECK(writer);
      27  // Compute and update box size.
      28  uint32_t size = ComputeSize();
      29  DCHECK_EQ(size, box_size_);
      30 
      31  size_t buffer_size_before_write = writer->Size();
      32  BoxBuffer buffer(writer);
      33  CHECK(ReadWriteInternal(&buffer));
      34  DCHECK_EQ(box_size_, writer->Size() - buffer_size_before_write)
      35  << FourCCToString(BoxType());
      36 }
      37 
      38 void Box::WriteHeader(BufferWriter* writer) {
      39  DCHECK(writer);
      40  // Compute and update box size.
      41  uint32_t size = ComputeSize();
      42  DCHECK_EQ(size, box_size_);
      43 
      44  size_t buffer_size_before_write = writer->Size();
      45  BoxBuffer buffer(writer);
      46  CHECK(ReadWriteHeaderInternal(&buffer));
      47  DCHECK_EQ(HeaderSize(), writer->Size() - buffer_size_before_write);
      48 }
      49 
      50 uint32_t Box::ComputeSize() {
      51  box_size_ = static_cast<uint32_t>(ComputeSizeInternal());
      52  return box_size_;
      53 }
      54 
      55 uint32_t Box::HeaderSize() const {
      56  const uint32_t kFourCCSize = 4;
      57  // We don't support 64-bit size.
      58  return kFourCCSize + sizeof(uint32_t);
      59 }
      60 
      61 bool Box::ReadWriteHeaderInternal(BoxBuffer* buffer) {
      62  if (buffer->Reading()) {
      63  // Skip for read mode, which is handled already in BoxReader.
      64  } else {
      65  CHECK(buffer->ReadWriteUInt32(&box_size_));
      66  FourCC fourcc = BoxType();
      67  CHECK(buffer->ReadWriteFourCC(&fourcc));
      68  }
      69  return true;
      70 }
      71 
      72 FullBox::FullBox() = default;
      73 FullBox::~FullBox() = default;
      74 
      75 uint32_t FullBox::HeaderSize() const {
      76  // Additional 1-byte version and 3-byte flags.
      77  return Box::HeaderSize() + 1 + 3;
      78 }
      79 
      80 bool FullBox::ReadWriteHeaderInternal(BoxBuffer* buffer) {
      81  RCHECK(Box::ReadWriteHeaderInternal(buffer));
      82 
      83  uint32_t vflags;
      84  if (buffer->Reading()) {
      85  RCHECK(buffer->ReadWriteUInt32(&vflags));
      86  this->version = vflags >> 24;
      87  this->flags = vflags & 0x00FFFFFF;
      88  } else {
      89  vflags = (this->version << 24) | this->flags;
      90  RCHECK(buffer->ReadWriteUInt32(&vflags));
      91  }
      92  return true;
      93 }
      94 
      95 } // namespace mp4
      96 } // namespace media
      97 } // namespace shaka
      All the methods that are virtual are virtual for mocking.
      @@ -74,7 +74,7 @@ $(function() {
      diff --git a/docs/d5/d51/packed__audio__segmenter_8cc_source.html b/docs/d5/d51/packed__audio__segmenter_8cc_source.html index e5049314b6..fdb032494b 100644 --- a/docs/d5/d51/packed__audio__segmenter_8cc_source.html +++ b/docs/d5/d51/packed__audio__segmenter_8cc_source.html @@ -81,7 +81,7 @@ $(function() {
      diff --git a/docs/d5/d52/ts__section__pes_8h_source.html b/docs/d5/d52/ts__section__pes_8h_source.html index 82feab09a6..4485fa8a84 100644 --- a/docs/d5/d52/ts__section__pes_8h_source.html +++ b/docs/d5/d52/ts__section__pes_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d5/d53/structshaka_1_1media_1_1mp4_1_1SampleAuxiliaryInformationSize-members.html b/docs/d5/d53/structshaka_1_1media_1_1mp4_1_1SampleAuxiliaryInformationSize-members.html index c472ae73aa..a15b76466e 100644 --- a/docs/d5/d53/structshaka_1_1media_1_1mp4_1_1SampleAuxiliaryInformationSize-members.html +++ b/docs/d5/d53/structshaka_1_1media_1_1mp4_1_1SampleAuxiliaryInformationSize-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/docs/d5/d57/classshaka_1_1RepresentationStateChangeListener-members.html b/docs/d5/d57/classshaka_1_1RepresentationStateChangeListener-members.html index d1d6517069..6088d237de 100644 --- a/docs/d5/d57/classshaka_1_1RepresentationStateChangeListener-members.html +++ b/docs/d5/d57/classshaka_1_1RepresentationStateChangeListener-members.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/d5/d59/classshaka_1_1MockRepresentation-members.html b/docs/d5/d59/classshaka_1_1MockRepresentation-members.html index 0fb8351324..9a82a671ef 100644 --- a/docs/d5/d59/classshaka_1_1MockRepresentation-members.html +++ b/docs/d5/d59/classshaka_1_1MockRepresentation-members.html @@ -98,7 +98,7 @@ $(function() { diff --git a/docs/d5/d5a/webvtt__timestamp_8cc_source.html b/docs/d5/d5a/webvtt__timestamp_8cc_source.html index dce6e3c314..696420d072 100644 --- a/docs/d5/d5a/webvtt__timestamp_8cc_source.html +++ b/docs/d5/d5a/webvtt__timestamp_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d5/d5c/continuity__counter_8cc_source.html b/docs/d5/d5c/continuity__counter_8cc_source.html index b65c111f4f..087a6db842 100644 --- a/docs/d5/d5c/continuity__counter_8cc_source.html +++ b/docs/d5/d5c/continuity__counter_8cc_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d5/d63/classshaka_1_1media_1_1mp2t_1_1EsParserH265.html b/docs/d5/d63/classshaka_1_1media_1_1mp2t_1_1EsParserH265.html index 9c9409d362..70904e19af 100644 --- a/docs/d5/d63/classshaka_1_1media_1_1mp2t_1_1EsParserH265.html +++ b/docs/d5/d63/classshaka_1_1media_1_1mp2t_1_1EsParserH265.html @@ -133,7 +133,7 @@ const diff --git a/docs/d5/d63/network__util_8cc_source.html b/docs/d5/d63/network__util_8cc_source.html index 7a82f083db..a782237308 100644 --- a/docs/d5/d63/network__util_8cc_source.html +++ b/docs/d5/d63/network__util_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d5/d66/classshaka_1_1media_1_1NalUnitToByteStreamConverter.html b/docs/d5/d66/classshaka_1_1media_1_1NalUnitToByteStreamConverter.html index 1cec02efb7..14f79113bd 100644 --- a/docs/d5/d66/classshaka_1_1media_1_1NalUnitToByteStreamConverter.html +++ b/docs/d5/d66/classshaka_1_1media_1_1NalUnitToByteStreamConverter.html @@ -277,7 +277,7 @@ class NalUnitToByteStreamC diff --git a/docs/d5/d67/classshaka_1_1media_1_1RawKeyPsshGenerator-members.html b/docs/d5/d67/classshaka_1_1media_1_1RawKeyPsshGenerator-members.html index 841a2742ae..8f8605985c 100644 --- a/docs/d5/d67/classshaka_1_1media_1_1RawKeyPsshGenerator-members.html +++ b/docs/d5/d67/classshaka_1_1media_1_1RawKeyPsshGenerator-members.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/d5/d69/classshaka_1_1media_1_1WidevinePsshGenerator.html b/docs/d5/d69/classshaka_1_1media_1_1WidevinePsshGenerator.html index 35495e4636..059c0f0c10 100644 --- a/docs/d5/d69/classshaka_1_1media_1_1WidevinePsshGenerator.html +++ b/docs/d5/d69/classshaka_1_1media_1_1WidevinePsshGenerator.html @@ -130,7 +130,7 @@ Public Member Functions diff --git a/docs/d5/d6f/vlog__flags_8cc_source.html b/docs/d5/d6f/vlog__flags_8cc_source.html index 4a8c9ef2d5..112a9660d9 100644 --- a/docs/d5/d6f/vlog__flags_8cc_source.html +++ b/docs/d5/d6f/vlog__flags_8cc_source.html @@ -69,7 +69,7 @@ $(function() {
      1 // Copyright 2015 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 //
      7 // Defines verbose logging flags.
      8 
      9 #include "packager/app/vlog_flags.h"
      10 
      11 DEFINE_int32(v,
      12  0,
      13  "Show all VLOG(m) or DVLOG(m) messages for m <= this. "
      14  "Overridable by --vmodule.");
      15 DEFINE_string(
      16  vmodule,
      17  "",
      18  "Per-module verbose level."
      19  "Argument is a comma-separated list of <module name>=<log level>. "
      20  "<module name> is a glob pattern, matched against the filename base "
      21  "(that is, name ignoring .cc/.h./-inl.h). "
      22  "A pattern without slashes matches just the file name portion, otherwise "
      23  "the whole file path (still without .cc/.h./-inl.h) is matched. "
      24  "? and * in the glob pattern match any single or sequence of characters "
      25  "respectively including slashes. "
      26  "<log level> overrides any value given by --v.");
      diff --git a/docs/d5/d72/avc__decoder__configuration__record_8cc_source.html b/docs/d5/d72/avc__decoder__configuration__record_8cc_source.html index 448af908c0..74cac85249 100644 --- a/docs/d5/d72/avc__decoder__configuration__record_8cc_source.html +++ b/docs/d5/d72/avc__decoder__configuration__record_8cc_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d5/d76/classshaka_1_1hls_1_1HlsEntry.html b/docs/d5/d76/classshaka_1_1hls_1_1HlsEntry.html index a4290b58c1..cee028b909 100644 --- a/docs/d5/d76/classshaka_1_1hls_1_1HlsEntry.html +++ b/docs/d5/d76/classshaka_1_1hls_1_1HlsEntry.html @@ -106,7 +106,7 @@ Protected Member Functions diff --git a/docs/d5/d78/classshaka_1_1media_1_1FileReader-members.html b/docs/d5/d78/classshaka_1_1media_1_1FileReader-members.html index 78627d0d4e..5c0fc00566 100644 --- a/docs/d5/d78/classshaka_1_1media_1_1FileReader-members.html +++ b/docs/d5/d78/classshaka_1_1media_1_1FileReader-members.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d5/d7b/box__definitions_8h_source.html b/docs/d5/d7b/box__definitions_8h_source.html index ad4e00ff42..5f43fe5da9 100644 --- a/docs/d5/d7b/box__definitions_8h_source.html +++ b/docs/d5/d7b/box__definitions_8h_source.html @@ -66,103 +66,103 @@ $(function() {
      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 };
      30 
      31 class BoxBuffer;
      32 
      33 #define DECLARE_BOX_METHODS(T) \
      34  public: \
      35  T(); \
      36  ~T() override; \
      37  FourCC BoxType() const override; \
      38  \
      39  private: \
      40  bool ReadWriteInternal(BoxBuffer* buffer) override; \
      41  size_t ComputeSizeInternal() override; \
      42  \
      43  public:
      44 
      45 struct FileType : Box {
      46  DECLARE_BOX_METHODS(FileType);
      47 
      48  FourCC major_brand;
      49  uint32_t minor_version;
      50  std::vector<FourCC> compatible_brands;
      51 };
      52 
      54  FourCC BoxType() const override;
      55 };
      56 
      58  DECLARE_BOX_METHODS(ProtectionSystemSpecificHeader);
      59 
      60  std::vector<uint8_t> raw_box;
      61 };
      62 
      64  DECLARE_BOX_METHODS(SampleAuxiliaryInformationOffset);
      65 
      66  std::vector<uint64_t> offsets;
      67 };
      68 
      70  DECLARE_BOX_METHODS(SampleAuxiliaryInformationSize);
      71 
      72  uint8_t default_sample_info_size;
      73  uint32_t sample_count;
      74  std::vector<uint8_t> sample_info_sizes;
      75 };
      76 
      86  bool ReadWrite(uint8_t iv_size,
      87  bool has_subsamples,
      88  BoxBuffer* buffer);
      95  bool ParseFromBuffer(uint8_t iv_size,
      96  bool has_subsamples,
      97  BufferReader* reader);
      99  uint32_t ComputeSize() const;
      102  uint32_t GetTotalSizeOfSubsamples() const;
      103 
      104  std::vector<uint8_t> initialization_vector;
      105  std::vector<SubsampleEntry> subsamples;
      106 };
      107 
      109  enum SampleEncryptionFlags {
      110  kUseSubsampleEncryption = 2,
      111  };
      112 
      113  DECLARE_BOX_METHODS(SampleEncryption);
      119  bool ParseFromSampleEncryptionData(
      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;
      128  std::vector<SampleEncryptionEntry> sample_encryption_entries;
      129 };
      130 
      131 struct OriginalFormat : Box {
      132  DECLARE_BOX_METHODS(OriginalFormat);
      133 
      134  FourCC format;
      135 };
      136 
      137 struct SchemeType : FullBox {
      138  DECLARE_BOX_METHODS(SchemeType);
      139 
      140  FourCC type;
      141  uint32_t version;
      142 };
      143 
      145  DECLARE_BOX_METHODS(TrackEncryption);
      146 
      147  uint8_t default_is_protected;
      148  uint8_t default_per_sample_iv_size;
      149  std::vector<uint8_t> default_kid;
      150 
      151  // For pattern-based encryption.
      152  uint8_t default_crypt_byte_block;
      153  uint8_t default_skip_byte_block;
      154 
      155  // Present only if
      156  // |default_is_protected == 1 && default_per_sample_iv_size == 0|.
      157  std::vector<uint8_t> default_constant_iv;
      158 };
      159 
      160 struct SchemeInfo : Box {
      161  DECLARE_BOX_METHODS(SchemeInfo);
      162 
      163  TrackEncryption track_encryption;
      164 };
      165 
      167  DECLARE_BOX_METHODS(ProtectionSchemeInfo);
      168 
      169  OriginalFormat format;
      170  SchemeType type;
      171  SchemeInfo info;
      172 };
      173 
      175  DECLARE_BOX_METHODS(MovieHeader);
      176 
      177  uint64_t creation_time;
      178  uint64_t modification_time;
      179  uint32_t timescale;
      180  uint64_t duration;
      181  int32_t rate;
      182  int16_t volume;
      183  uint32_t next_track_id;
      184 };
      185 
      187  enum TrackHeaderFlags {
      188  kTrackEnabled = 0x000001,
      189  kTrackInMovie = 0x000002,
      190  kTrackInPreview = 0x000004,
      191  };
      192 
      193  DECLARE_BOX_METHODS(TrackHeader);
      194 
      195  uint64_t creation_time;
      196  uint64_t modification_time;
      197  uint32_t track_id;
      198  uint64_t duration;
      199  int16_t layer;
      200  int16_t alternate_group;
      201  int16_t volume;
      202  // width and height specify the track's visual presentation size as
      203  // fixed-point 16.16 values.
      204  uint32_t width;
      205  uint32_t height;
      206 };
      207 
      209  uint64_t segment_duration;
      210  int64_t media_time;
      211  int16_t media_rate_integer;
      212  int16_t media_rate_fraction;
      213 };
      214 
      215 struct EditList : FullBox {
      216  DECLARE_BOX_METHODS(EditList);
      217 
      218  std::vector<EditListEntry> edits;
      219 };
      220 
      221 struct Edit : Box {
      222  DECLARE_BOX_METHODS(Edit);
      223 
      224  EditList list;
      225 };
      226 
      228  DECLARE_BOX_METHODS(HandlerReference);
      229 
      230  FourCC handler_type;
      231 };
      232 
      233 struct Language {
      234  bool ReadWrite(BoxBuffer* buffer);
      235  uint32_t ComputeSize() const;
      236 
      237  std::string code;
      238 };
      239 
      241 struct ID3v2 : FullBox {
      242  DECLARE_BOX_METHODS(ID3v2);
      243 
      244  Language language;
      245  std::vector<uint8_t> id3v2_data;
      246 };
      247 
      248 struct Metadata : FullBox {
      249  DECLARE_BOX_METHODS(Metadata);
      250 
      251  HandlerReference handler;
      252  ID3v2 id3v2;
      253 };
      254 
      255 // This defines a common structure for various CodecConfiguration boxes:
      256 // AVCConfiguration, HEVCConfiguration and VPCodecConfiguration.
      257 // Note that unlike the other two CodecConfiguration boxes, VPCodecConfiguration
      258 // box inherits from FullBox instead of Box, according to VP Codec ISO Media
      259 // File Format Binding specification. It will be handled properly in the
      260 // implementation.
      262  DECLARE_BOX_METHODS(CodecConfiguration);
      263 
      264  FourCC box_type;
      265  // Contains full codec configuration record, including possible extension
      266  // boxes.
      267  std::vector<uint8_t> data;
      268 };
      269 
      271  DECLARE_BOX_METHODS(PixelAspectRatio);
      272 
      273  uint32_t h_spacing;
      274  uint32_t v_spacing;
      275 };
      276 
      278  DECLARE_BOX_METHODS(VideoSampleEntry);
      279  // Returns actual format of this sample entry.
      280  FourCC GetActualFormat() const {
      281  return format == FOURCC_encv ? sinf.format.format : format;
      282  }
      283  // Returns the box type of codec configuration box from video format.
      284  FourCC GetCodecConfigurationBoxType(FourCC format) const;
      285 
      286  FourCC format;
      287  uint16_t data_reference_index;
      288  uint16_t width;
      289  uint16_t height;
      290 
      291  PixelAspectRatio pixel_aspect;
      293  CodecConfiguration codec_configuration;
      294 };
      295 
      297  DECLARE_BOX_METHODS(ElementaryStreamDescriptor);
      298 
      299  AACAudioSpecificConfig aac_audio_specific_config;
      300  ESDescriptor es_descriptor;
      301 };
      302 
      303 struct DTSSpecific : Box {
      304  DECLARE_BOX_METHODS(DTSSpecific);
      305 
      306  uint32_t sampling_frequency;
      307  uint32_t max_bitrate;
      308  uint32_t avg_bitrate;
      309  uint8_t pcm_sample_depth;
      310  std::vector<uint8_t> extra_data;
      311 };
      312 
      313 struct AC3Specific : Box {
      314  DECLARE_BOX_METHODS(AC3Specific);
      315 
      316  std::vector<uint8_t> data;
      317 };
      318 
      319 struct EC3Specific : Box {
      320  DECLARE_BOX_METHODS(EC3Specific);
      321 
      322  std::vector<uint8_t> data;
      323 };
      324 
      325 struct OpusSpecific : Box {
      326  DECLARE_BOX_METHODS(OpusSpecific);
      327 
      328  std::vector<uint8_t> opus_identification_header;
      329  // The number of priming samples. Extracted from |opus_identification_header|.
      330  uint16_t preskip;
      331 };
      332 
      333 // FLAC specific decoder configuration box:
      334 // https://github.com/xiph/flac/blob/master/doc/isoflac.txt
      335 // We do not care about the actual data inside, which is simply copied over.
      337  DECLARE_BOX_METHODS(FlacSpecific);
      338 
      339  std::vector<uint8_t> data;
      340 };
      341 
      343  DECLARE_BOX_METHODS(AudioSampleEntry);
      344  // Returns actual format of this sample entry.
      345  FourCC GetActualFormat() const {
      346  return format == FOURCC_enca ? sinf.format.format : format;
      347  }
      348 
      349  FourCC format;
      350  uint16_t data_reference_index;
      351  uint16_t channelcount;
      352  uint16_t samplesize;
      353  uint32_t samplerate;
      354 
      356 
      358  DTSSpecific ddts;
      359  AC3Specific dac3;
      360  EC3Specific dec3;
      361  OpusSpecific dops;
      362  FlacSpecific dfla;
      363 };
      364 
      366  DECLARE_BOX_METHODS(WebVTTConfigurationBox);
      367  std::string config;
      368 };
      369 
      371  DECLARE_BOX_METHODS(WebVTTSourceLabelBox);
      372  std::string source_label;
      373 };
      374 
      376  DECLARE_BOX_METHODS(TextSampleEntry);
      377 
      378  // Specifies fourcc of this sample entry. It needs to be set on write, e.g.
      379  // set to 'wvtt' to write WVTTSampleEntry; On read, it is recovered from box
      380  // header.
      381  FourCC format;
      382  uint16_t data_reference_index;
      383 
      384  // Sub boxes for wvtt text sample entry.
      385  WebVTTConfigurationBox config;
      386  WebVTTSourceLabelBox label;
      387  // Optional MPEG4BitRateBox.
      388 };
      389 
      391  DECLARE_BOX_METHODS(SampleDescription);
      392 
      393  TrackType type;
      394  // TODO(kqyang): Clean up the code to have one single member, e.g. by creating
      395  // SampleEntry struct, std::vector<SampleEntry> sample_entries.
      396  std::vector<VideoSampleEntry> video_entries;
      397  std::vector<AudioSampleEntry> audio_entries;
      398  std::vector<TextSampleEntry> text_entries;
      399 };
      400 
      401 struct DecodingTime {
      402  uint32_t sample_count;
      403  uint32_t sample_delta;
      404 };
      405 
      406 // stts.
      408  DECLARE_BOX_METHODS(DecodingTimeToSample);
      409 
      410  std::vector<DecodingTime> decoding_time;
      411 };
      412 
      414  uint32_t sample_count;
      415  // If version == 0, sample_offset is uint32_t;
      416  // If version == 1, sample_offset is int32_t.
      417  // Use int64_t so both can be supported properly.
      418  int64_t sample_offset;
      419 };
      420 
      421 // ctts. Optional.
      423  DECLARE_BOX_METHODS(CompositionTimeToSample);
      424 
      425  std::vector<CompositionOffset> composition_offset;
      426 };
      427 
      428 struct ChunkInfo {
      429  uint32_t first_chunk;
      430  uint32_t samples_per_chunk;
      431  uint32_t sample_description_index;
      432 };
      433 
      434 // stsc.
      436  DECLARE_BOX_METHODS(SampleToChunk);
      437 
      438  std::vector<ChunkInfo> chunk_info;
      439 };
      440 
      441 // stsz.
      442 struct SampleSize : FullBox {
      443  DECLARE_BOX_METHODS(SampleSize);
      444 
      445  uint32_t sample_size;
      446  uint32_t sample_count;
      447  std::vector<uint32_t> sizes;
      448 };
      449 
      450 // stz2.
      452  DECLARE_BOX_METHODS(CompactSampleSize);
      453 
      454  uint8_t field_size;
      455  std::vector<uint32_t> sizes;
      456 };
      457 
      458 // co64.
      460  DECLARE_BOX_METHODS(ChunkLargeOffset);
      461 
      462  std::vector<uint64_t> offsets;
      463 };
      464 
      465 // stco.
      467  DECLARE_BOX_METHODS(ChunkOffset);
      468 };
      469 
      470 // stss. Optional.
      471 struct SyncSample : FullBox {
      472  DECLARE_BOX_METHODS(SyncSample);
      473 
      474  std::vector<uint32_t> sample_number;
      475 };
      476 
      480 
      481  bool ReadWrite(BoxBuffer* buffer);
      482  uint32_t ComputeSize() const;
      483 
      484  uint8_t is_protected;
      485  uint8_t per_sample_iv_size;
      486  std::vector<uint8_t> key_id;
      487 
      488  // For pattern-based encryption.
      489  uint8_t crypt_byte_block;
      490  uint8_t skip_byte_block;
      491 
      492  // Present only if |is_protected == 1 && per_sample_iv_size == 0|.
      493  std::vector<uint8_t> constant_iv;
      494 };
      495 
      499 
      500  bool ReadWrite(BoxBuffer* buffer);
      501  uint32_t ComputeSize() const;
      502 
      503  int16_t roll_distance;
      504 };
      505 
      507  DECLARE_BOX_METHODS(SampleGroupDescription);
      508 
      509  template <typename T>
      510  bool ReadWriteEntries(BoxBuffer* buffer, std::vector<T>* entries);
      511 
      512  uint32_t grouping_type;
      513  // Only present if grouping_type == 'seig'.
      514  std::vector<CencSampleEncryptionInfoEntry>
      515  cenc_sample_encryption_info_entries;
      516  // Only present if grouping_type == 'roll'.
      517  std::vector<AudioRollRecoveryEntry> audio_roll_recovery_entries;
      518 };
      519 
      521  enum GroupDescriptionIndexBase {
      522  kTrackGroupDescriptionIndexBase = 0,
      523  kTrackFragmentGroupDescriptionIndexBase = 0x10000,
      524  };
      525 
      526  uint32_t sample_count;
      527  uint32_t group_description_index;
      528 };
      529 
      531  DECLARE_BOX_METHODS(SampleToGroup);
      532 
      533  uint32_t grouping_type;
      534  uint32_t grouping_type_parameter; // Version 1 only.
      535  std::vector<SampleToGroupEntry> entries;
      536 };
      537 
      538 struct SampleTable : Box {
      539  DECLARE_BOX_METHODS(SampleTable);
      540 
      541  SampleDescription description;
      542  DecodingTimeToSample decoding_time_to_sample;
      543  CompositionTimeToSample composition_time_to_sample;
      544  SampleToChunk sample_to_chunk;
      545  // Either SampleSize or CompactSampleSize must present. Store in SampleSize.
      546  SampleSize sample_size;
      547  // Either ChunkOffset or ChunkLargeOffset must present. Store in
      548  // ChunkLargeOffset.
      549  ChunkLargeOffset chunk_large_offset;
      550  SyncSample sync_sample;
      551  std::vector<SampleGroupDescription> sample_group_descriptions;
      552  std::vector<SampleToGroup> sample_to_groups;
      553 };
      554 
      556  DECLARE_BOX_METHODS(MediaHeader);
      557 
      558  uint64_t creation_time;
      559  uint64_t modification_time;
      560  uint32_t timescale;
      561  uint64_t duration;
      562  Language language;
      563 };
      564 
      566  DECLARE_BOX_METHODS(VideoMediaHeader);
      567 
      568  uint16_t graphicsmode;
      569  uint16_t opcolor_red;
      570  uint16_t opcolor_green;
      571  uint16_t opcolor_blue;
      572 };
      573 
      575  DECLARE_BOX_METHODS(SoundMediaHeader);
      576 
      577  uint16_t balance;
      578 };
      579 
      581  DECLARE_BOX_METHODS(SubtitleMediaHeader);
      582 };
      583 
      585  DECLARE_BOX_METHODS(DataEntryUrl);
      586 
      587  std::vector<uint8_t> location;
      588 };
      589 
      591  DECLARE_BOX_METHODS(DataReference);
      592 
      593  // data entry can be either url or urn box. Fix to url box for now.
      594  std::vector<DataEntryUrl> data_entry;
      595 };
      596 
      598  DECLARE_BOX_METHODS(DataInformation);
      599 
      600  DataReference dref;
      601 };
      602 
      604  DECLARE_BOX_METHODS(MediaInformation);
      605 
      606  DataInformation dinf;
      607  SampleTable sample_table;
      608  // Exactly one specific meida header shall be present, vmhd, smhd, hmhd, nmhd.
      609  VideoMediaHeader vmhd;
      610  SoundMediaHeader smhd;
      611  SubtitleMediaHeader sthd;
      612 };
      613 
      614 struct Media : Box {
      615  DECLARE_BOX_METHODS(Media);
      616 
      617  MediaHeader header;
      618  HandlerReference handler;
      619  MediaInformation information;
      620 };
      621 
      622 struct Track : Box {
      623  DECLARE_BOX_METHODS(Track);
      624 
      625  TrackHeader header;
      626  Media media;
      627  Edit edit;
      628  SampleEncryption sample_encryption;
      629 };
      630 
      632  DECLARE_BOX_METHODS(MovieExtendsHeader);
      633 
      634  uint64_t fragment_duration;
      635 };
      636 
      638  DECLARE_BOX_METHODS(TrackExtends);
      639 
      640  uint32_t track_id;
      641  uint32_t default_sample_description_index;
      642  uint32_t default_sample_duration;
      643  uint32_t default_sample_size;
      644  uint32_t default_sample_flags;
      645 };
      646 
      647 struct MovieExtends : Box {
      648  DECLARE_BOX_METHODS(MovieExtends);
      649 
      650  MovieExtendsHeader header;
      651  std::vector<TrackExtends> tracks;
      652 };
      653 
      654 struct Movie : Box {
      655  DECLARE_BOX_METHODS(Movie);
      656 
      657  MovieHeader header;
      658  Metadata metadata; // Used to hold version information.
      659  MovieExtends extends;
      660  std::vector<Track> tracks;
      661  std::vector<ProtectionSystemSpecificHeader> pssh;
      662 };
      663 
      665  DECLARE_BOX_METHODS(TrackFragmentDecodeTime);
      666 
      667  uint64_t decode_time;
      668 };
      669 
      671  DECLARE_BOX_METHODS(MovieFragmentHeader);
      672 
      673  uint32_t sequence_number;
      674 };
      675 
      677  enum TrackFragmentFlagsMasks {
      678  kBaseDataOffsetPresentMask = 0x000001,
      679  kSampleDescriptionIndexPresentMask = 0x000002,
      680  kDefaultSampleDurationPresentMask = 0x000008,
      681  kDefaultSampleSizePresentMask = 0x000010,
      682  kDefaultSampleFlagsPresentMask = 0x000020,
      683  kDurationIsEmptyMask = 0x010000,
      684  kDefaultBaseIsMoofMask = 0x020000,
      685  };
      686 
      687  enum SampleFlagsMasks {
      688  kReservedMask = 0xFC000000,
      689  kSampleDependsOnMask = 0x03000000,
      690  kSampleIsDependedOnMask = 0x00C00000,
      691  kSampleHasRedundancyMask = 0x00300000,
      692  kSamplePaddingValueMask = 0x000E0000,
      693  kNonKeySampleMask = 0x00010000,
      694  kSampleDegradationPriorityMask = 0x0000FFFF,
      695  };
      696 
      697  DECLARE_BOX_METHODS(TrackFragmentHeader);
      698 
      699  uint32_t track_id;
      700  uint32_t sample_description_index;
      701  uint32_t default_sample_duration;
      702  uint32_t default_sample_size;
      703  uint32_t default_sample_flags;
      704 };
      705 
      707  enum TrackFragmentFlagsMasks {
      708  kDataOffsetPresentMask = 0x000001,
      709  kFirstSampleFlagsPresentMask = 0x000004,
      710  kSampleDurationPresentMask = 0x000100,
      711  kSampleSizePresentMask = 0x000200,
      712  kSampleFlagsPresentMask = 0x000400,
      713  kSampleCompTimeOffsetsPresentMask = 0x000800,
      714  };
      715 
      716  DECLARE_BOX_METHODS(TrackFragmentRun);
      717 
      718  uint32_t sample_count;
      719  uint32_t data_offset;
      720  std::vector<uint32_t> sample_flags;
      721  std::vector<uint32_t> sample_sizes;
      722  std::vector<uint32_t> sample_durations;
      723  std::vector<int64_t> sample_composition_time_offsets;
      724 };
      725 
      726 struct TrackFragment : Box {
      727  DECLARE_BOX_METHODS(TrackFragment);
      728 
      729  TrackFragmentHeader header;
      730  std::vector<TrackFragmentRun> runs;
      731  bool decode_time_absent;
      732  TrackFragmentDecodeTime decode_time;
      733  std::vector<SampleGroupDescription> sample_group_descriptions;
      734  std::vector<SampleToGroup> sample_to_groups;
      735  SampleAuxiliaryInformationSize auxiliary_size;
      736  SampleAuxiliaryInformationOffset auxiliary_offset;
      737  SampleEncryption sample_encryption;
      738 };
      739 
      740 struct MovieFragment : Box {
      741  DECLARE_BOX_METHODS(MovieFragment);
      742 
      743  MovieFragmentHeader header;
      744  std::vector<TrackFragment> tracks;
      745  std::vector<ProtectionSystemSpecificHeader> pssh;
      746 };
      747 
      749  enum SAPType {
      750  TypeUnknown = 0,
      751  Type1 = 1, // T(ept) = T(dec) = T(sap) = T(ptf)
      752  Type2 = 2, // T(ept) = T(dec) = T(sap) < T(ptf)
      753  Type3 = 3, // T(ept) < T(dec) = T(sap) <= T(ptf)
      754  Type4 = 4, // T(ept) <= T(ptf) < T(dec) = T(sap)
      755  Type5 = 5, // T(ept) = T(dec) < T(sap)
      756  Type6 = 6, // T(ept) < T(dec) < T(sap)
      757  };
      758 
      759  bool reference_type;
      760  uint32_t referenced_size;
      761  uint32_t subsegment_duration;
      762  bool starts_with_sap;
      763  SAPType sap_type;
      764  uint32_t sap_delta_time;
      765  // We add this field to keep track of earliest_presentation_time in this
      766  // subsegment. It is not part of SegmentReference.
      767  uint64_t earliest_presentation_time;
      768 };
      769 
      771  DECLARE_BOX_METHODS(SegmentIndex);
      772 
      773  uint32_t reference_id;
      774  uint32_t timescale;
      775  uint64_t earliest_presentation_time;
      776  uint64_t first_offset;
      777  std::vector<SegmentReference> references;
      778 };
      779 
      780 // The actual data is parsed and written separately.
      781 struct MediaData : Box {
      782  DECLARE_BOX_METHODS(MediaData);
      783 
      784  uint32_t data_size;
      785 };
      786 
      787 struct CueSourceIDBox : Box {
      788  DECLARE_BOX_METHODS(CueSourceIDBox);
      789  int32_t source_id;
      790 };
      791 
      792 struct CueTimeBox : Box {
      793  DECLARE_BOX_METHODS(CueTimeBox);
      794  std::string cue_current_time;
      795 };
      796 
      797 struct CueIDBox : Box {
      798  DECLARE_BOX_METHODS(CueIDBox);
      799  std::string cue_id;
      800 };
      801 
      802 struct CueSettingsBox : Box {
      803  DECLARE_BOX_METHODS(CueSettingsBox);
      804  std::string settings;
      805 };
      806 
      807 struct CuePayloadBox : Box {
      808  DECLARE_BOX_METHODS(CuePayloadBox);
      809  std::string cue_text;
      810 };
      811 
      812 struct VTTEmptyCueBox : Box {
      813  DECLARE_BOX_METHODS(VTTEmptyCueBox);
      814 };
      815 
      817  DECLARE_BOX_METHODS(VTTAdditionalTextBox);
      818  std::string cue_additional_text;
      819 };
      820 
      821 struct VTTCueBox : Box {
      822  DECLARE_BOX_METHODS(VTTCueBox);
      823 
      824  CueSourceIDBox cue_source_id;
      825  CueIDBox cue_id;
      826  CueTimeBox cue_time;
      827  CueSettingsBox cue_settings;
      828  CuePayloadBox cue_payload;
      829 };
      830 
      831 #undef DECLARE_BOX
      832 
      833 } // namespace mp4
      834 } // namespace media
      835 } // namespace shaka
      836 
      837 #endif // PACKAGER_MEDIA_FORMATS_MP4_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 };
      30 
      31 class BoxBuffer;
      32 
      33 #define DECLARE_BOX_METHODS(T) \
      34  public: \
      35  T(); \
      36  ~T() override; \
      37  \
      38  FourCC BoxType() const override; \
      39  \
      40  private: \
      41  bool ReadWriteInternal(BoxBuffer* buffer) override; \
      42  size_t ComputeSizeInternal() override; \
      43  \
      44  public:
      45 
      46 struct FileType : Box {
      47  DECLARE_BOX_METHODS(FileType);
      48 
      49  FourCC major_brand = FOURCC_NULL;
      50  uint32_t minor_version = 0;
      51  std::vector<FourCC> compatible_brands;
      52 };
      53 
      55  FourCC BoxType() const override;
      56 };
      57 
      59  DECLARE_BOX_METHODS(ProtectionSystemSpecificHeader);
      60 
      61  std::vector<uint8_t> raw_box;
      62 };
      63 
      65  DECLARE_BOX_METHODS(SampleAuxiliaryInformationOffset);
      66 
      67  std::vector<uint64_t> offsets;
      68 };
      69 
      71  DECLARE_BOX_METHODS(SampleAuxiliaryInformationSize);
      72 
      73  uint8_t default_sample_info_size = 0;
      74  uint32_t sample_count = 0;
      75  std::vector<uint8_t> sample_info_sizes;
      76 };
      77 
      85  bool ReadWrite(uint8_t iv_size, bool has_subsamples, BoxBuffer* buffer);
      92  bool ParseFromBuffer(uint8_t iv_size,
      93  bool has_subsamples,
      94  BufferReader* reader);
      96  uint32_t ComputeSize() const;
      99  uint32_t GetTotalSizeOfSubsamples() const;
      100 
      101  std::vector<uint8_t> initialization_vector;
      102  std::vector<SubsampleEntry> subsamples;
      103 };
      104 
      106  static const uint8_t kInvalidIvSize = 1;
      107 
      108  enum SampleEncryptionFlags {
      109  kUseSubsampleEncryption = 2,
      110  };
      111 
      112  DECLARE_BOX_METHODS(SampleEncryption);
      118  bool ParseFromSampleEncryptionData(
      119  uint8_t iv_size,
      120  std::vector<SampleEncryptionEntry>* sample_encryption_entries) const;
      121 
      124  std::vector<uint8_t> sample_encryption_data;
      125 
      126  uint8_t iv_size = kInvalidIvSize;
      127  std::vector<SampleEncryptionEntry> sample_encryption_entries;
      128 };
      129 
      130 struct OriginalFormat : Box {
      131  DECLARE_BOX_METHODS(OriginalFormat);
      132 
      133  FourCC format = FOURCC_NULL;
      134 };
      135 
      136 struct SchemeType : FullBox {
      137  DECLARE_BOX_METHODS(SchemeType);
      138 
      139  FourCC type = FOURCC_NULL;
      140  uint32_t version = 0u;
      141 };
      142 
      144  DECLARE_BOX_METHODS(TrackEncryption);
      145 
      146  uint8_t default_is_protected = 0;
      147  uint8_t default_per_sample_iv_size = 0;
      148  // Default to a vector of 16 zeros.
      149  std::vector<uint8_t> default_kid = std::vector<uint8_t>(16, 0);
      150 
      151  // For pattern-based encryption.
      152  uint8_t default_crypt_byte_block = 0;
      153  uint8_t default_skip_byte_block = 0;
      154 
      155  // Present only if
      156  // |default_is_protected == 1 && default_per_sample_iv_size == 0|.
      157  std::vector<uint8_t> default_constant_iv;
      158 };
      159 
      160 struct SchemeInfo : Box {
      161  DECLARE_BOX_METHODS(SchemeInfo);
      162 
      163  TrackEncryption track_encryption;
      164 };
      165 
      167  DECLARE_BOX_METHODS(ProtectionSchemeInfo);
      168 
      169  OriginalFormat format;
      170  SchemeType type;
      171  SchemeInfo info;
      172 };
      173 
      175  DECLARE_BOX_METHODS(MovieHeader);
      176 
      177  uint64_t creation_time = 0;
      178  uint64_t modification_time = 0;
      179  uint32_t timescale = 0;
      180  uint64_t duration = 0;
      181  int32_t rate = 1 << 16;
      182  int16_t volume = 1 << 8;
      183  uint32_t next_track_id = 0;
      184 };
      185 
      187  enum TrackHeaderFlags {
      188  kTrackEnabled = 0x000001,
      189  kTrackInMovie = 0x000002,
      190  kTrackInPreview = 0x000004,
      191  };
      192 
      193  DECLARE_BOX_METHODS(TrackHeader);
      194 
      195  uint64_t creation_time = 0;
      196  uint64_t modification_time = 0;
      197  uint32_t track_id = 0;
      198  uint64_t duration = 0;
      199  int16_t layer = 0;
      200  int16_t alternate_group = 0;
      201  int16_t volume = -1;
      202  // width and height specify the track's visual presentation size as
      203  // fixed-point 16.16 values.
      204  uint32_t width = 0;
      205  uint32_t height = 0;
      206 };
      207 
      209  uint64_t segment_duration = 0;
      210  int64_t media_time = 0;
      211  int16_t media_rate_integer = 0;
      212  int16_t media_rate_fraction = 0;
      213 };
      214 
      215 struct EditList : FullBox {
      216  DECLARE_BOX_METHODS(EditList);
      217 
      218  std::vector<EditListEntry> edits;
      219 };
      220 
      221 struct Edit : Box {
      222  DECLARE_BOX_METHODS(Edit);
      223 
      224  EditList list;
      225 };
      226 
      228  DECLARE_BOX_METHODS(HandlerReference);
      229 
      230  FourCC handler_type = FOURCC_NULL;
      231 };
      232 
      233 struct Language {
      234  bool ReadWrite(BoxBuffer* buffer);
      235  uint32_t ComputeSize() const;
      236 
      237  std::string code;
      238 };
      239 
      241 struct ID3v2 : FullBox {
      242  DECLARE_BOX_METHODS(ID3v2);
      243 
      244  Language language;
      245  std::vector<uint8_t> id3v2_data;
      246 };
      247 
      248 struct Metadata : FullBox {
      249  DECLARE_BOX_METHODS(Metadata);
      250 
      251  HandlerReference handler;
      252  ID3v2 id3v2;
      253 };
      254 
      255 // This defines a common structure for various CodecConfiguration boxes:
      256 // AVCConfiguration, HEVCConfiguration and VPCodecConfiguration.
      257 // Note that unlike the other two CodecConfiguration boxes, VPCodecConfiguration
      258 // box inherits from FullBox instead of Box, according to VP Codec ISO Media
      259 // File Format Binding specification. It will be handled properly in the
      260 // implementation.
      262  DECLARE_BOX_METHODS(CodecConfiguration);
      263 
      264  FourCC box_type = FOURCC_NULL;
      265  // Contains full codec configuration record, including possible extension
      266  // boxes.
      267  std::vector<uint8_t> data;
      268 };
      269 
      271  DECLARE_BOX_METHODS(PixelAspectRatio);
      272 
      273  uint32_t h_spacing = 0u;
      274  uint32_t v_spacing = 0u;
      275 };
      276 
      278  DECLARE_BOX_METHODS(VideoSampleEntry);
      279 
      280  // Returns actual format of this sample entry.
      281  FourCC GetActualFormat() const {
      282  return format == FOURCC_encv ? sinf.format.format : format;
      283  }
      284  // Returns the box type of codec configuration box from video format.
      285  FourCC GetCodecConfigurationBoxType(FourCC format) const;
      286 
      287  FourCC format = FOURCC_NULL;
      288  // data_reference_index is 1-based and "dref" box is mandatory so it is
      289  // always present.
      290  uint16_t data_reference_index = 1u;
      291  uint16_t width = 0u;
      292  uint16_t height = 0u;
      293 
      294  PixelAspectRatio pixel_aspect;
      296  CodecConfiguration codec_configuration;
      297 };
      298 
      300  DECLARE_BOX_METHODS(ElementaryStreamDescriptor);
      301 
      302  AACAudioSpecificConfig aac_audio_specific_config;
      303  ESDescriptor es_descriptor;
      304 };
      305 
      306 struct DTSSpecific : Box {
      307  DECLARE_BOX_METHODS(DTSSpecific);
      308 
      309  uint32_t sampling_frequency = 0u;
      310  uint32_t max_bitrate = 0u;
      311  uint32_t avg_bitrate = 0u;
      312  uint8_t pcm_sample_depth = 0u;
      313  std::vector<uint8_t> extra_data;
      314 };
      315 
      316 struct AC3Specific : Box {
      317  DECLARE_BOX_METHODS(AC3Specific);
      318 
      319  std::vector<uint8_t> data;
      320 };
      321 
      322 struct EC3Specific : Box {
      323  DECLARE_BOX_METHODS(EC3Specific);
      324 
      325  std::vector<uint8_t> data;
      326 };
      327 
      328 struct OpusSpecific : Box {
      329  DECLARE_BOX_METHODS(OpusSpecific);
      330 
      331  std::vector<uint8_t> opus_identification_header;
      332  // The number of priming samples. Extracted from |opus_identification_header|.
      333  uint16_t preskip = 0u;
      334 };
      335 
      336 // FLAC specific decoder configuration box:
      337 // https://github.com/xiph/flac/blob/master/doc/isoflac.txt
      338 // We do not care about the actual data inside, which is simply copied over.
      340  DECLARE_BOX_METHODS(FlacSpecific);
      341 
      342  std::vector<uint8_t> data;
      343 };
      344 
      346  DECLARE_BOX_METHODS(AudioSampleEntry);
      347 
      348  // Returns actual format of this sample entry.
      349  FourCC GetActualFormat() const {
      350  return format == FOURCC_enca ? sinf.format.format : format;
      351  }
      352 
      353  FourCC format = FOURCC_NULL;
      354  // data_reference_index is 1-based and "dref" box is mandatory so it is
      355  // always present.
      356  uint16_t data_reference_index = 1u;
      357  uint16_t channelcount = 2u;
      358  uint16_t samplesize = 16u;
      359  uint32_t samplerate = 0u;
      360 
      362 
      364  DTSSpecific ddts;
      365  AC3Specific dac3;
      366  EC3Specific dec3;
      367  OpusSpecific dops;
      368  FlacSpecific dfla;
      369 };
      370 
      372  DECLARE_BOX_METHODS(WebVTTConfigurationBox);
      373 
      374  std::string config;
      375 };
      376 
      378  DECLARE_BOX_METHODS(WebVTTSourceLabelBox);
      379 
      380  std::string source_label;
      381 };
      382 
      384  DECLARE_BOX_METHODS(TextSampleEntry);
      385 
      386  // Specifies fourcc of this sample entry. It needs to be set on write, e.g.
      387  // set to 'wvtt' to write WVTTSampleEntry; On read, it is recovered from box
      388  // header.
      389  FourCC format = FOURCC_NULL;
      390 
      391  // data_reference_index is 1-based and "dref" box is mandatory so it is
      392  // always present.
      393  uint16_t data_reference_index = 1u;
      394 
      395  // Sub boxes for wvtt text sample entry.
      396  WebVTTConfigurationBox config;
      397  WebVTTSourceLabelBox label;
      398  // Optional MPEG4BitRateBox.
      399 };
      400 
      402  DECLARE_BOX_METHODS(SampleDescription);
      403 
      404  TrackType type = kInvalid;
      405  // TODO(kqyang): Clean up the code to have one single member, e.g. by creating
      406  // SampleEntry struct, std::vector<SampleEntry> sample_entries.
      407  std::vector<VideoSampleEntry> video_entries;
      408  std::vector<AudioSampleEntry> audio_entries;
      409  std::vector<TextSampleEntry> text_entries;
      410 };
      411 
      412 struct DecodingTime {
      413  uint32_t sample_count;
      414  uint32_t sample_delta;
      415 };
      416 
      417 // stts.
      419  DECLARE_BOX_METHODS(DecodingTimeToSample);
      420 
      421  std::vector<DecodingTime> decoding_time;
      422 };
      423 
      425  uint32_t sample_count;
      426  // If version == 0, sample_offset is uint32_t;
      427  // If version == 1, sample_offset is int32_t.
      428  // Use int64_t so both can be supported properly.
      429  int64_t sample_offset;
      430 };
      431 
      432 // ctts. Optional.
      434  DECLARE_BOX_METHODS(CompositionTimeToSample);
      435 
      436  std::vector<CompositionOffset> composition_offset;
      437 };
      438 
      439 struct ChunkInfo {
      440  uint32_t first_chunk;
      441  uint32_t samples_per_chunk;
      442  uint32_t sample_description_index;
      443 };
      444 
      445 // stsc.
      447  DECLARE_BOX_METHODS(SampleToChunk);
      448 
      449  std::vector<ChunkInfo> chunk_info;
      450 };
      451 
      452 // stsz.
      453 struct SampleSize : FullBox {
      454  DECLARE_BOX_METHODS(SampleSize);
      455 
      456  uint32_t sample_size = 0u;
      457  uint32_t sample_count = 0u;
      458  std::vector<uint32_t> sizes;
      459 };
      460 
      461 // stz2.
      463  DECLARE_BOX_METHODS(CompactSampleSize);
      464 
      465  uint8_t field_size = 0u;
      466  std::vector<uint32_t> sizes;
      467 };
      468 
      469 // co64.
      471  DECLARE_BOX_METHODS(ChunkLargeOffset);
      472 
      473  std::vector<uint64_t> offsets;
      474 };
      475 
      476 // stco.
      478  DECLARE_BOX_METHODS(ChunkOffset);
      479 };
      480 
      481 // stss. Optional.
      482 struct SyncSample : FullBox {
      483  DECLARE_BOX_METHODS(SyncSample);
      484 
      485  std::vector<uint32_t> sample_number;
      486 };
      487 
      489  bool ReadWrite(BoxBuffer* buffer);
      490  uint32_t ComputeSize() const;
      491 
      492  uint8_t is_protected = 0u;
      493  uint8_t per_sample_iv_size = 0u;
      494  std::vector<uint8_t> key_id;
      495 
      496  // For pattern-based encryption.
      497  uint8_t crypt_byte_block = 0u;
      498  uint8_t skip_byte_block = 0u;
      499 
      500  // Present only if |is_protected == 1 && per_sample_iv_size == 0|.
      501  std::vector<uint8_t> constant_iv;
      502 };
      503 
      505  bool ReadWrite(BoxBuffer* buffer);
      506  uint32_t ComputeSize() const;
      507 
      508  int16_t roll_distance = 0;
      509 };
      510 
      512  DECLARE_BOX_METHODS(SampleGroupDescription);
      513 
      514  template <typename T>
      515  bool ReadWriteEntries(BoxBuffer* buffer, std::vector<T>* entries);
      516 
      517  uint32_t grouping_type = 0;
      518  // Only present if grouping_type == 'seig'.
      519  std::vector<CencSampleEncryptionInfoEntry>
      520  cenc_sample_encryption_info_entries;
      521  // Only present if grouping_type == 'roll'.
      522  std::vector<AudioRollRecoveryEntry> audio_roll_recovery_entries;
      523 };
      524 
      526  enum GroupDescriptionIndexBase {
      527  kTrackGroupDescriptionIndexBase = 0,
      528  kTrackFragmentGroupDescriptionIndexBase = 0x10000,
      529  };
      530 
      531  uint32_t sample_count = 0u;
      532  uint32_t group_description_index = 0u;
      533 };
      534 
      536  DECLARE_BOX_METHODS(SampleToGroup);
      537 
      538  uint32_t grouping_type = 0u;
      539  uint32_t grouping_type_parameter = 0u; // Version 1 only.
      540  std::vector<SampleToGroupEntry> entries;
      541 };
      542 
      543 struct SampleTable : Box {
      544  DECLARE_BOX_METHODS(SampleTable);
      545 
      546  SampleDescription description;
      547  DecodingTimeToSample decoding_time_to_sample;
      548  CompositionTimeToSample composition_time_to_sample;
      549  SampleToChunk sample_to_chunk;
      550  // Either SampleSize or CompactSampleSize must present. Store in SampleSize.
      551  SampleSize sample_size;
      552  // Either ChunkOffset or ChunkLargeOffset must present. Store in
      553  // ChunkLargeOffset.
      554  ChunkLargeOffset chunk_large_offset;
      555  SyncSample sync_sample;
      556  std::vector<SampleGroupDescription> sample_group_descriptions;
      557  std::vector<SampleToGroup> sample_to_groups;
      558 };
      559 
      561  DECLARE_BOX_METHODS(MediaHeader);
      562 
      563  uint64_t creation_time = 0u;
      564  uint64_t modification_time = 0u;
      565  uint32_t timescale = 0u;
      566  uint64_t duration = 0u;
      567  Language language;
      568 };
      569 
      571  DECLARE_BOX_METHODS(VideoMediaHeader);
      572 
      573  uint16_t graphicsmode = 0u;
      574  uint16_t opcolor_red = 0u;
      575  uint16_t opcolor_green = 0u;
      576  uint16_t opcolor_blue = 0u;
      577 };
      578 
      580  DECLARE_BOX_METHODS(SoundMediaHeader);
      581 
      582  uint16_t balance = 0u;
      583 };
      584 
      586  DECLARE_BOX_METHODS(SubtitleMediaHeader);
      587 };
      588 
      590  DECLARE_BOX_METHODS(DataEntryUrl);
      591 
      592  std::vector<uint8_t> location;
      593 };
      594 
      596  DECLARE_BOX_METHODS(DataReference);
      597 
      598  // Can be either url or urn box. Fix to url box for now.
      599  std::vector<DataEntryUrl> data_entry = std::vector<DataEntryUrl>(1);
      600 };
      601 
      603  DECLARE_BOX_METHODS(DataInformation);
      604 
      605  DataReference dref;
      606 };
      607 
      609  DECLARE_BOX_METHODS(MediaInformation);
      610 
      611  DataInformation dinf;
      612  SampleTable sample_table;
      613  // Exactly one specific meida header shall be present, vmhd, smhd, hmhd, nmhd.
      614  VideoMediaHeader vmhd;
      615  SoundMediaHeader smhd;
      616  SubtitleMediaHeader sthd;
      617 };
      618 
      619 struct Media : Box {
      620  DECLARE_BOX_METHODS(Media);
      621 
      622  MediaHeader header;
      623  HandlerReference handler;
      624  MediaInformation information;
      625 };
      626 
      627 struct Track : Box {
      628  DECLARE_BOX_METHODS(Track);
      629 
      630  TrackHeader header;
      631  Media media;
      632  Edit edit;
      633  SampleEncryption sample_encryption;
      634 };
      635 
      637  DECLARE_BOX_METHODS(MovieExtendsHeader);
      638 
      639  uint64_t fragment_duration = 0u;
      640 };
      641 
      643  DECLARE_BOX_METHODS(TrackExtends);
      644 
      645  uint32_t track_id = 0u;
      646  uint32_t default_sample_description_index = 0u;
      647  uint32_t default_sample_duration = 0u;
      648  uint32_t default_sample_size = 0u;
      649  uint32_t default_sample_flags = 0u;
      650 };
      651 
      652 struct MovieExtends : Box {
      653  DECLARE_BOX_METHODS(MovieExtends);
      654 
      655  MovieExtendsHeader header;
      656  std::vector<TrackExtends> tracks;
      657 };
      658 
      659 struct Movie : Box {
      660  DECLARE_BOX_METHODS(Movie);
      661 
      662  MovieHeader header;
      663  Metadata metadata; // Used to hold version information.
      664  MovieExtends extends;
      665  std::vector<Track> tracks;
      666  std::vector<ProtectionSystemSpecificHeader> pssh;
      667 };
      668 
      670  DECLARE_BOX_METHODS(TrackFragmentDecodeTime);
      671 
      672  uint64_t decode_time = 0u;
      673 };
      674 
      676  DECLARE_BOX_METHODS(MovieFragmentHeader);
      677 
      678  uint32_t sequence_number = 0u;
      679 };
      680 
      682  enum TrackFragmentFlagsMasks {
      683  kBaseDataOffsetPresentMask = 0x000001,
      684  kSampleDescriptionIndexPresentMask = 0x000002,
      685  kDefaultSampleDurationPresentMask = 0x000008,
      686  kDefaultSampleSizePresentMask = 0x000010,
      687  kDefaultSampleFlagsPresentMask = 0x000020,
      688  kDurationIsEmptyMask = 0x010000,
      689  kDefaultBaseIsMoofMask = 0x020000,
      690  };
      691 
      692  enum SampleFlagsMasks {
      693  kReservedMask = 0xFC000000,
      694  kSampleDependsOnMask = 0x03000000,
      695  kSampleIsDependedOnMask = 0x00C00000,
      696  kSampleHasRedundancyMask = 0x00300000,
      697  kSamplePaddingValueMask = 0x000E0000,
      698  kNonKeySampleMask = 0x00010000,
      699  kSampleDegradationPriorityMask = 0x0000FFFF,
      700  };
      701 
      702  DECLARE_BOX_METHODS(TrackFragmentHeader);
      703 
      704  uint32_t track_id = 0u;
      705  uint32_t sample_description_index = 0u;
      706  uint32_t default_sample_duration = 0u;
      707  uint32_t default_sample_size = 0u;
      708  uint32_t default_sample_flags = 0u;
      709 };
      710 
      712  enum TrackFragmentFlagsMasks {
      713  kDataOffsetPresentMask = 0x000001,
      714  kFirstSampleFlagsPresentMask = 0x000004,
      715  kSampleDurationPresentMask = 0x000100,
      716  kSampleSizePresentMask = 0x000200,
      717  kSampleFlagsPresentMask = 0x000400,
      718  kSampleCompTimeOffsetsPresentMask = 0x000800,
      719  };
      720 
      721  DECLARE_BOX_METHODS(TrackFragmentRun);
      722 
      723  uint32_t sample_count = 0u;
      724  uint32_t data_offset = 0u;
      725  std::vector<uint32_t> sample_flags;
      726  std::vector<uint32_t> sample_sizes;
      727  std::vector<uint32_t> sample_durations;
      728  std::vector<int64_t> sample_composition_time_offsets;
      729 };
      730 
      731 struct TrackFragment : Box {
      732  DECLARE_BOX_METHODS(TrackFragment);
      733 
      734  TrackFragmentHeader header;
      735  std::vector<TrackFragmentRun> runs;
      736  bool decode_time_absent = false;
      737  TrackFragmentDecodeTime decode_time;
      738  std::vector<SampleGroupDescription> sample_group_descriptions;
      739  std::vector<SampleToGroup> sample_to_groups;
      740  SampleAuxiliaryInformationSize auxiliary_size;
      741  SampleAuxiliaryInformationOffset auxiliary_offset;
      742  SampleEncryption sample_encryption;
      743 };
      744 
      745 struct MovieFragment : Box {
      746  DECLARE_BOX_METHODS(MovieFragment);
      747 
      748  MovieFragmentHeader header;
      749  std::vector<TrackFragment> tracks;
      750  std::vector<ProtectionSystemSpecificHeader> pssh;
      751 };
      752 
      754  enum SAPType {
      755  TypeUnknown = 0,
      756  Type1 = 1, // T(ept) = T(dec) = T(sap) = T(ptf)
      757  Type2 = 2, // T(ept) = T(dec) = T(sap) < T(ptf)
      758  Type3 = 3, // T(ept) < T(dec) = T(sap) <= T(ptf)
      759  Type4 = 4, // T(ept) <= T(ptf) < T(dec) = T(sap)
      760  Type5 = 5, // T(ept) = T(dec) < T(sap)
      761  Type6 = 6, // T(ept) < T(dec) < T(sap)
      762  };
      763 
      764  bool reference_type = false;
      765  uint32_t referenced_size = 0u;
      766  uint32_t subsegment_duration = 0u;
      767  bool starts_with_sap = false;
      768  SAPType sap_type = TypeUnknown;
      769  uint32_t sap_delta_time = 0u;
      770  // We add this field to keep track of earliest_presentation_time in this
      771  // subsegment. It is not part of SegmentReference.
      772  uint64_t earliest_presentation_time = 0u;
      773 };
      774 
      776  DECLARE_BOX_METHODS(SegmentIndex);
      777 
      778  uint32_t reference_id = 0u;
      779  uint32_t timescale = 0u;
      780  uint64_t earliest_presentation_time = 0u;
      781  uint64_t first_offset = 0u;
      782  std::vector<SegmentReference> references;
      783 };
      784 
      785 // The actual data is parsed and written separately.
      786 struct MediaData : Box {
      787  DECLARE_BOX_METHODS(MediaData);
      788 
      789  uint32_t data_size = 0u;
      790 };
      791 
      792 // Using negative value as "not set". It is very unlikely that 2^31 cues happen
      793 // at once.
      794 const int kCueSourceIdNotSet = -1;
      795 
      796 struct CueSourceIDBox : Box {
      797  DECLARE_BOX_METHODS(CueSourceIDBox);
      798 
      799  int32_t source_id = kCueSourceIdNotSet;
      800 };
      801 
      802 struct CueTimeBox : Box {
      803  DECLARE_BOX_METHODS(CueTimeBox);
      804 
      805  std::string cue_current_time;
      806 };
      807 
      808 struct CueIDBox : Box {
      809  DECLARE_BOX_METHODS(CueIDBox);
      810 
      811  std::string cue_id;
      812 };
      813 
      814 struct CueSettingsBox : Box {
      815  DECLARE_BOX_METHODS(CueSettingsBox);
      816 
      817  std::string settings;
      818 };
      819 
      820 struct CuePayloadBox : Box {
      821  DECLARE_BOX_METHODS(CuePayloadBox);
      822 
      823  std::string cue_text;
      824 };
      825 
      826 struct VTTEmptyCueBox : Box {
      827  DECLARE_BOX_METHODS(VTTEmptyCueBox);
      828 };
      829 
      831  DECLARE_BOX_METHODS(VTTAdditionalTextBox);
      832 
      833  std::string cue_additional_text;
      834 };
      835 
      836 struct VTTCueBox : Box {
      837  DECLARE_BOX_METHODS(VTTCueBox);
      838 
      839  CueSourceIDBox cue_source_id;
      840  CueIDBox cue_id;
      841  CueTimeBox cue_time;
      842  CueSettingsBox cue_settings;
      843  CuePayloadBox cue_payload;
      844 };
      845 
      846 #undef DECLARE_BOX
      847 
      848 } // namespace mp4
      849 } // namespace media
      850 } // namespace shaka
      851 
      852 #endif // PACKAGER_MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_
      + + + + + + + + - - - + + + - - - - + + + + - - + + - + - - + +
      All the methods that are virtual are virtual for mocking.
      - + - + - - + +
      uint32_t ComputeSize()
      Definition: box.cc:50
      - + - - - - - - - -
      std::vector< uint8_t > sample_encryption_data
      - - - - - - + + + + + + + +
      std::vector< uint8_t > sample_encryption_data
      + + + + + + - - - - - - - - - + + + + + + + + + - - - + + +
      Implemented per http://mp4ra.org/#/references.
      - - - - + + + + - - - - - - - + + + + + + + - - - + + + - + -
      FourCC BoxType() const override
      - - - +
      FourCC BoxType() const override
      + + +
      diff --git a/docs/d5/d86/structshaka_1_1media_1_1mp4_1_1MediaInformation.html b/docs/d5/d86/structshaka_1_1media_1_1mp4_1_1MediaInformation.html index af831dd474..9aad2ef0b0 100644 --- a/docs/d5/d86/structshaka_1_1media_1_1mp4_1_1MediaInformation.html +++ b/docs/d5/d86/structshaka_1_1media_1_1mp4_1_1MediaInformation.html @@ -124,7 +124,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 603 of file box_definitions.h.

      +

      Definition at line 608 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -152,7 +152,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 2016 of file box_definitions.cc.

      +

      Definition at line 2066 of file box_definitions.cc.

      @@ -163,7 +163,7 @@ Additional Inherited Members diff --git a/docs/d5/d89/widevine__key__source_8cc_source.html b/docs/d5/d89/widevine__key__source_8cc_source.html index 9619a117f1..ffd104f8cf 100644 --- a/docs/d5/d89/widevine__key__source_8cc_source.html +++ b/docs/d5/d89/widevine__key__source_8cc_source.html @@ -86,7 +86,7 @@ $(function() { diff --git a/docs/d5/d8c/structshaka_1_1media_1_1mp4_1_1CompositionOffset.html b/docs/d5/d8c/structshaka_1_1media_1_1mp4_1_1CompositionOffset.html index 327b18f9b5..68c372a957 100644 --- a/docs/d5/d8c/structshaka_1_1media_1_1mp4_1_1CompositionOffset.html +++ b/docs/d5/d8c/structshaka_1_1media_1_1mp4_1_1CompositionOffset.html @@ -81,14 +81,14 @@ int64_t sample_offset<

      Detailed Description

      -

      Definition at line 413 of file box_definitions.h.

      +

      Definition at line 424 of file box_definitions.h.


      The documentation for this struct was generated from the following file: diff --git a/docs/d5/d8d/classshaka_1_1media_1_1SampleAesEc3Cryptor-members.html b/docs/d5/d8d/classshaka_1_1media_1_1SampleAesEc3Cryptor-members.html index 38fcb47154..49535fe67d 100644 --- a/docs/d5/d8d/classshaka_1_1media_1_1SampleAesEc3Cryptor-members.html +++ b/docs/d5/d8d/classshaka_1_1media_1_1SampleAesEc3Cryptor-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/docs/d5/d8f/webm__cluster__parser_8cc_source.html b/docs/d5/d8f/webm__cluster__parser_8cc_source.html index 1e4625d5a0..fad556cce8 100644 --- a/docs/d5/d8f/webm__cluster__parser_8cc_source.html +++ b/docs/d5/d8f/webm__cluster__parser_8cc_source.html @@ -92,7 +92,7 @@ $(function() { diff --git a/docs/d5/d95/structshaka_1_1media_1_1mp4_1_1EditListEntry-members.html b/docs/d5/d95/structshaka_1_1media_1_1mp4_1_1EditListEntry-members.html index 3695b37839..bda75c050c 100644 --- a/docs/d5/d95/structshaka_1_1media_1_1mp4_1_1EditListEntry-members.html +++ b/docs/d5/d95/structshaka_1_1media_1_1mp4_1_1EditListEntry-members.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/d5/d98/encryptor_8cc_source.html b/docs/d5/d98/encryptor_8cc_source.html index 401f5ed35c..ed4ddad3ef 100644 --- a/docs/d5/d98/encryptor_8cc_source.html +++ b/docs/d5/d98/encryptor_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d5/d9b/vp__codec__configuration__record_8h_source.html b/docs/d5/d9b/vp__codec__configuration__record_8h_source.html index a93a04edd7..a2edf23bb1 100644 --- a/docs/d5/d9b/vp__codec__configuration__record_8h_source.html +++ b/docs/d5/d9b/vp__codec__configuration__record_8h_source.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d5/d9d/structshaka_1_1media_1_1H265ReferencePictureListModifications.html b/docs/d5/d9d/structshaka_1_1media_1_1H265ReferencePictureListModifications.html index 96df18ec81..df6268380f 100644 --- a/docs/d5/d9d/structshaka_1_1media_1_1H265ReferencePictureListModifications.html +++ b/docs/d5/d9d/structshaka_1_1media_1_1H265ReferencePictureListModifications.html @@ -95,7 +95,7 @@ std::vector< int > l diff --git a/docs/d5/da4/aes__encryptor_8cc_source.html b/docs/d5/da4/aes__encryptor_8cc_source.html index 7d2bfac9dd..9aaa76a605 100644 --- a/docs/d5/da4/aes__encryptor_8cc_source.html +++ b/docs/d5/da4/aes__encryptor_8cc_source.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d5/dad/structshaka_1_1media_1_1H265ReferencePictureSet.html b/docs/d5/dad/structshaka_1_1media_1_1H265ReferencePictureSet.html index e4bfc365a2..edc6e12a58 100644 --- a/docs/d5/dad/structshaka_1_1media_1_1H265ReferencePictureSet.html +++ b/docs/d5/dad/structshaka_1_1media_1_1H265ReferencePictureSet.html @@ -103,7 +103,7 @@ int num_delta_pocs diff --git a/docs/d5/db1/classshaka_1_1media_1_1StreamInfo.html b/docs/d5/db1/classshaka_1_1media_1_1StreamInfo.html index 8b35bc0a9e..cb7b85af0b 100644 --- a/docs/d5/db1/classshaka_1_1media_1_1StreamInfo.html +++ b/docs/d5/db1/classshaka_1_1media_1_1StreamInfo.html @@ -253,7 +253,7 @@ void set_encryption_config diff --git a/docs/d5/db9/classshaka_1_1media_1_1mp2t_1_1EsParserH264.html b/docs/d5/db9/classshaka_1_1media_1_1mp2t_1_1EsParserH264.html index f24412ad35..48e3ddd17b 100644 --- a/docs/d5/db9/classshaka_1_1media_1_1mp2t_1_1EsParserH264.html +++ b/docs/d5/db9/classshaka_1_1media_1_1mp2t_1_1EsParserH264.html @@ -133,7 +133,7 @@ const diff --git a/docs/d5/dba/ts__packet_8cc_source.html b/docs/d5/dba/ts__packet_8cc_source.html index ab6beedb96..ace2510f75 100644 --- a/docs/d5/dba/ts__packet_8cc_source.html +++ b/docs/d5/dba/ts__packet_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d5/dc1/webm__webvtt__parser_8cc_source.html b/docs/d5/dc1/webm__webvtt__parser_8cc_source.html index 27a49b8792..14bb221ac0 100644 --- a/docs/d5/dc1/webm__webvtt__parser_8cc_source.html +++ b/docs/d5/dc1/webm__webvtt__parser_8cc_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/d5/dc8/structshaka_1_1media_1_1mp4_1_1TrackFragment-members.html b/docs/d5/dc8/structshaka_1_1media_1_1mp4_1_1TrackFragment-members.html index 61f9f0b668..989cb69a2d 100644 --- a/docs/d5/dc8/structshaka_1_1media_1_1mp4_1_1TrackFragment-members.html +++ b/docs/d5/dc8/structshaka_1_1media_1_1mp4_1_1TrackFragment-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/docs/d5/dca/structshaka_1_1media_1_1mp4_1_1SampleAuxiliaryInformationOffset.html b/docs/d5/dca/structshaka_1_1media_1_1mp4_1_1SampleAuxiliaryInformationOffset.html index 5d2eaf162f..f219da0b27 100644 --- a/docs/d5/dca/structshaka_1_1media_1_1mp4_1_1SampleAuxiliaryInformationOffset.html +++ b/docs/d5/dca/structshaka_1_1media_1_1mp4_1_1SampleAuxiliaryInformationOffset.html @@ -107,10 +107,10 @@ std::vector< uint64_t >   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

      @@ -121,7 +121,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 63 of file box_definitions.h.

      +

      Definition at line 64 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -149,7 +149,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 182 of file box_definitions.cc.

      +

      Definition at line 186 of file box_definitions.cc.

      @@ -160,7 +160,7 @@ Additional Inherited Members diff --git a/docs/d5/dcb/raw__key__encryption__flags_8h_source.html b/docs/d5/dcb/raw__key__encryption__flags_8h_source.html index 77137345c2..389c281686 100644 --- a/docs/d5/dcb/raw__key__encryption__flags_8h_source.html +++ b/docs/d5/dcb/raw__key__encryption__flags_8h_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d5/dcf/rsa__key_8h_source.html b/docs/d5/dcf/rsa__key_8h_source.html index 291acfe4db..029d6f1b7c 100644 --- a/docs/d5/dcf/rsa__key_8h_source.html +++ b/docs/d5/dcf/rsa__key_8h_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d5/dda/ts__section__psi_8h_source.html b/docs/d5/dda/ts__section__psi_8h_source.html index b50503977c..532a013374 100644 --- a/docs/d5/dda/ts__section__psi_8h_source.html +++ b/docs/d5/dda/ts__section__psi_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d5/ddb/webvtt__text__output__handler_8cc_source.html b/docs/d5/ddb/webvtt__text__output__handler_8cc_source.html new file mode 100644 index 0000000000..f05b82e450 --- /dev/null +++ b/docs/d5/ddb/webvtt__text__output__handler_8cc_source.html @@ -0,0 +1,81 @@ + + + + + + + +Shaka Packager SDK: packager/media/formats/webvtt/webvtt_text_output_handler.cc Source File + + + + + + + + + +
      +
      + + + + + + +
      +
      Shaka Packager SDK +
      +
      +
      + + + + + + + + +
      +
      + + +
      + +
      + + +
      +
      +
      +
      webvtt_text_output_handler.cc
      +
      +
      +
      1 // Copyright 2017 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #include "packager/media/formats/webvtt/webvtt_text_output_handler.h"
      8 
      9 #include <algorithm> // needed for min and max
      10 
      11 #include "packager/base/logging.h"
      12 #include "packager/file/file.h"
      13 #include "packager/file/file_closer.h"
      14 #include "packager/media/base/muxer_util.h"
      15 #include "packager/status_macros.h"
      16 
      17 namespace shaka {
      18 namespace media {
      19 namespace {
      20 double kMillisecondsToSeconds = 1000.0;
      21 } // namespace
      22 
      23 WebVttTextOutputHandler::WebVttTextOutputHandler(
      24  const MuxerOptions& muxer_options,
      25  std::unique_ptr<MuxerListener> muxer_listener)
      26  : muxer_options_(muxer_options),
      27  muxer_listener_(std::move(muxer_listener)) {}
      28 
      29 Status WebVttTextOutputHandler::InitializeInternal() {
      30  return Status::OK;
      31 }
      32 
      33 Status WebVttTextOutputHandler::Process(
      34  std::unique_ptr<StreamData> stream_data) {
      35  switch (stream_data->stream_data_type) {
      36  case StreamDataType::kStreamInfo:
      37  return OnStreamInfo(*stream_data->stream_info);
      38  case StreamDataType::kSegmentInfo:
      39  return OnSegmentInfo(*stream_data->segment_info);
      40  case StreamDataType::kCueEvent:
      41  return OnCueEvent(*stream_data->cue_event);
      42  case StreamDataType::kTextSample:
      43  OnTextSample(*stream_data->text_sample);
      44  return Status::OK;
      45  default:
      46  return Status(error::INTERNAL_ERROR,
      47  "Invalid stream data type for this handler");
      48  }
      49 }
      50 
      51 Status WebVttTextOutputHandler::OnFlushRequest(size_t input_stream_index) {
      52  DCHECK_EQ(buffer_.sample_count(), 0u)
      53  << "There should have been a segment info before flushing that would "
      54  "have cleared out all the samples.";
      55 
      56  const float duration_ms = static_cast<float>(total_duration_ms_);
      57  const float duration_seconds = duration_ms / 1000.0f;
      58 
      59  MuxerListener::MediaRanges empty_ranges;
      60  muxer_listener_->OnMediaEnd(empty_ranges, duration_seconds);
      61 
      62  return Status::OK;
      63 }
      64 
      65 Status WebVttTextOutputHandler::OnStreamInfo(const StreamInfo& info) {
      66  muxer_listener_->OnMediaStart(muxer_options_, info, info.time_scale(),
      67  MuxerListener::kContainerText);
      68  return Status::OK;
      69 }
      70 
      71 Status WebVttTextOutputHandler::OnSegmentInfo(const SegmentInfo& info) {
      72  total_duration_ms_ += info.duration;
      73 
      74  const std::string& segment_template = muxer_options_.segment_template;
      75  const uint32_t index = segment_index_++;
      76  const uint64_t start = info.start_timestamp;
      77  const uint64_t duration = info.duration;
      78  const uint32_t bandwidth = muxer_options_.bandwidth;
      79 
      80  const std::string filename =
      81  GetSegmentName(segment_template, start, index, bandwidth);
      82 
      83  // Write everything to the file before telling the manifest so that the
      84  // file will exist on disk.
      85  std::unique_ptr<File, FileCloser> file(File::Open(filename.c_str(), "w"));
      86 
      87  if (!file) {
      88  return Status(error::FILE_FAILURE, "Failed to open " + filename);
      89  }
      90 
      91  buffer_.WriteTo(file.get());
      92  buffer_.Reset();
      93 
      94  if (!file.release()->Close()) {
      95  return Status(error::FILE_FAILURE, "Failed to close " + filename);
      96  }
      97 
      98  // Update the manifest with our new file.
      99  const uint64_t size = File::GetFileSize(filename.c_str());
      100  muxer_listener_->OnNewSegment(filename, start, duration, size);
      101 
      102  return Status::OK;
      103 }
      104 
      105 Status WebVttTextOutputHandler::OnCueEvent(const CueEvent& event) {
      106  double timestamp_seconds = event.time_in_seconds;
      107  double timestamp_ms = timestamp_seconds * kMillisecondsToSeconds;
      108  uint64_t timestamp = static_cast<uint64_t>(timestamp_ms);
      109  muxer_listener_->OnCueEvent(timestamp, event.cue_data);
      110  return Status::OK;
      111 }
      112 
      113 void WebVttTextOutputHandler::OnTextSample(const TextSample& sample) {
      114  // Skip empty samples. It is normal to see empty samples as earlier in the
      115  // pipeline we pad the stream to remove gaps.
      116  if (sample.payload().size()) {
      117  buffer_.Append(sample);
      118  }
      119 }
      120 } // namespace media
      121 } // namespace shaka
      STL namespace.
      +
      All the methods that are virtual are virtual for mocking.
      +
      static int64_t GetFileSize(const char *file_name)
      Definition: file.cc:207
      +
      virtual bool Open()=0
      Internal open. Should not be used directly.
      +
      + + + + diff --git a/docs/d5/de0/bit__reader_8cc_source.html b/docs/d5/de0/bit__reader_8cc_source.html index 5ffe2fe756..098d7e6146 100644 --- a/docs/d5/de0/bit__reader_8cc_source.html +++ b/docs/d5/de0/bit__reader_8cc_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d5/de0/classshaka_1_1media_1_1mp2t_1_1PesPacketGenerator.html b/docs/d5/de0/classshaka_1_1media_1_1mp2t_1_1PesPacketGenerator.html index 1bcc2c6d76..00f8c5d504 100644 --- a/docs/d5/de0/classshaka_1_1media_1_1mp2t_1_1PesPacketGenerator.html +++ b/docs/d5/de0/classshaka_1_1media_1_1mp2t_1_1PesPacketGenerator.html @@ -252,7 +252,7 @@ class PesPacketGeneratorTe diff --git a/docs/d5/de2/structshaka_1_1media_1_1MuxerListenerFactory_1_1StreamData-members.html b/docs/d5/de2/structshaka_1_1media_1_1MuxerListenerFactory_1_1StreamData-members.html index 80ead33d57..e02e3910d8 100644 --- a/docs/d5/de2/structshaka_1_1media_1_1MuxerListenerFactory_1_1StreamData-members.html +++ b/docs/d5/de2/structshaka_1_1media_1_1MuxerListenerFactory_1_1StreamData-members.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d5/de3/structshaka_1_1PackagingParams.html b/docs/d5/de3/structshaka_1_1PackagingParams.html index 3d8241ffac..cf82b42ac6 100644 --- a/docs/d5/de3/structshaka_1_1PackagingParams.html +++ b/docs/d5/de3/structshaka_1_1PackagingParams.html @@ -146,7 +146,7 @@ std::string  diff --git a/docs/d5/de9/replicator_8cc_source.html b/docs/d5/de9/replicator_8cc_source.html index 82cbd293df..cf84453d4d 100644 --- a/docs/d5/de9/replicator_8cc_source.html +++ b/docs/d5/de9/replicator_8cc_source.html @@ -66,13 +66,13 @@ $(function() {
      replicator.cc
      -
      1 // Copyright 2017 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #include "packager/media/replicator/replicator.h"
      8 
      9 namespace shaka {
      10 namespace media {
      11 
      12 Status Replicator::InitializeInternal() {
      13  return Status::OK;
      14 }
      15 
      16 Status Replicator::Process(std::unique_ptr<StreamData> stream_data) {
      17  Status status;
      18 
      19  for (auto& out : output_handlers()) {
      20  std::unique_ptr<StreamData> copy(new StreamData(*stream_data));
      21  copy->stream_index = out.first;
      22 
      23  status.Update(Dispatch(std::move(copy)));
      24  }
      25 
      26  return status;
      27 }
      28 
      29 bool Replicator::ValidateOutputStreamIndex(size_t stream_index) const {
      30  return true;
      31 }
      32 
      33 Status Replicator::OnFlushRequest(size_t input_stream_index) {
      34  DCHECK_EQ(input_stream_index, 0u);
      35  return FlushAllDownstreams();
      36 }
      37 
      38 } // namespace media
      39 } // namespace shaka
      Status Dispatch(std::unique_ptr< StreamData > stream_data) const
      +
      1 // Copyright 2017 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #include "packager/media/replicator/replicator.h"
      8 
      9 namespace shaka {
      10 namespace media {
      11 
      12 Status Replicator::InitializeInternal() {
      13  return Status::OK;
      14 }
      15 
      16 Status Replicator::Process(std::unique_ptr<StreamData> stream_data) {
      17  Status status;
      18 
      19  for (auto& out : output_handlers()) {
      20  std::unique_ptr<StreamData> copy(new StreamData(*stream_data));
      21  copy->stream_index = out.first;
      22 
      23  status.Update(Dispatch(std::move(copy)));
      24  }
      25 
      26  return status;
      27 }
      28 
      29 bool Replicator::ValidateOutputStreamIndex(size_t stream_index) const {
      30  return true;
      31 }
      32 
      33 Status Replicator::OnFlushRequest(size_t input_stream_index) {
      34  DCHECK_EQ(input_stream_index, 0u);
      35  return FlushAllDownstreams();
      36 }
      37 
      38 } // namespace media
      39 } // namespace shaka
      Status Dispatch(std::unique_ptr< StreamData > stream_data) const
      All the methods that are virtual are virtual for mocking.
      -
      Status FlushAllDownstreams()
      Flush all connected downstream handlers.
      +
      Status FlushAllDownstreams()
      Flush all connected downstream handlers.
      diff --git a/docs/d5/dec/classshaka_1_1media_1_1WebMParserClient.html b/docs/d5/dec/classshaka_1_1media_1_1WebMParserClient.html index 1c44f9576d..af54b2bd5b 100644 --- a/docs/d5/dec/classshaka_1_1media_1_1WebMParserClient.html +++ b/docs/d5/dec/classshaka_1_1media_1_1WebMParserClient.html @@ -127,7 +127,7 @@ Protected Member Functions
      diff --git a/docs/d5/dec/decoder__configuration__record_8cc_source.html b/docs/d5/dec/decoder__configuration__record_8cc_source.html index 4e9b216df4..f77be91dd1 100644 --- a/docs/d5/dec/decoder__configuration__record_8cc_source.html +++ b/docs/d5/dec/decoder__configuration__record_8cc_source.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/d5/dec/structshaka_1_1media_1_1mp4_1_1WebVTTConfigurationBox-members.html b/docs/d5/dec/structshaka_1_1media_1_1mp4_1_1WebVTTConfigurationBox-members.html index abf9bc091c..3c58dc96f9 100644 --- a/docs/d5/dec/structshaka_1_1media_1_1mp4_1_1WebVTTConfigurationBox-members.html +++ b/docs/d5/dec/structshaka_1_1media_1_1mp4_1_1WebVTTConfigurationBox-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/d5/def/ts__section__pmt_8h_source.html b/docs/d5/def/ts__section__pmt_8h_source.html index d7470dd5ac..d41958e282 100644 --- a/docs/d5/def/ts__section__pmt_8h_source.html +++ b/docs/d5/def/ts__section__pmt_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d5/df2/media__playlist_8cc_source.html b/docs/d5/df2/media__playlist_8cc_source.html index b0e628596f..d1866023b9 100644 --- a/docs/d5/df2/media__playlist_8cc_source.html +++ b/docs/d5/df2/media__playlist_8cc_source.html @@ -66,35 +66,35 @@ $(function() {
      media_playlist.cc
      -
      1 // Copyright 2016 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #include "packager/hls/base/media_playlist.h"
      8 
      9 #include <inttypes.h>
      10 
      11 #include <algorithm>
      12 #include <cmath>
      13 #include <memory>
      14 
      15 #include "packager/base/logging.h"
      16 #include "packager/base/strings/string_number_conversions.h"
      17 #include "packager/base/strings/stringprintf.h"
      18 #include "packager/file/file.h"
      19 #include "packager/hls/base/tag.h"
      20 #include "packager/media/base/language_utils.h"
      21 #include "packager/media/base/muxer_util.h"
      22 #include "packager/version/version.h"
      23 
      24 namespace shaka {
      25 namespace hls {
      26 
      27 namespace {
      28 uint32_t GetTimeScale(const MediaInfo& media_info) {
      29  if (media_info.has_reference_time_scale())
      30  return media_info.reference_time_scale();
      31 
      32  if (media_info.has_video_info())
      33  return media_info.video_info().time_scale();
      34 
      35  if (media_info.has_audio_info())
      36  return media_info.audio_info().time_scale();
      37  return 0u;
      38 }
      39 
      40 // Duplicated from MpdUtils because:
      41 // 1. MpdUtils header depends on libxml header, which is not in the deps here
      42 // 2. GetLanguage depends on MediaInfo from packager/mpd/
      43 // 3. Moving GetLanguage to LanguageUtils would create a a media => mpd dep.
      44 // TODO(https://github.com/google/shaka-packager/issues/373): Fix this
      45 // dependency situation and factor this out to a common location.
      46 std::string GetLanguage(const MediaInfo& media_info) {
      47  std::string lang;
      48  if (media_info.has_audio_info()) {
      49  lang = media_info.audio_info().language();
      50  } else if (media_info.has_text_info()) {
      51  lang = media_info.text_info().language();
      52  }
      53  return LanguageToShortestForm(lang);
      54 }
      55 
      56 void AppendExtXMap(const MediaInfo& media_info, std::string* out) {
      57  if (media_info.has_init_segment_url()) {
      58  Tag tag("#EXT-X-MAP", out);
      59  tag.AddQuotedString("URI", media_info.init_segment_url().data());
      60  out->append("\n");
      61  } else if (media_info.has_media_file_url() && media_info.has_init_range()) {
      62  // It only makes sense for single segment media to have EXT-X-MAP if
      63  // there is init_range.
      64  Tag tag("#EXT-X-MAP", out);
      65  tag.AddQuotedString("URI", media_info.media_file_url().data());
      66 
      67  if (media_info.has_init_range()) {
      68  const uint64_t begin = media_info.init_range().begin();
      69  const uint64_t end = media_info.init_range().end();
      70  const uint64_t length = end - begin + 1;
      71 
      72  tag.AddQuotedNumberPair("BYTERANGE", length, '@', begin);
      73  }
      74 
      75  out->append("\n");
      76  } else {
      77  // This media info does not need an ext-x-map tag.
      78  }
      79 }
      80 
      81 std::string CreatePlaylistHeader(
      82  const MediaInfo& media_info,
      83  uint32_t target_duration,
      84  HlsPlaylistType type,
      85  MediaPlaylist::MediaPlaylistStreamType stream_type,
      86  int media_sequence_number,
      87  int discontinuity_sequence_number) {
      88  const std::string version = GetPackagerVersion();
      89  std::string version_line;
      90  if (!version.empty()) {
      91  version_line =
      92  base::StringPrintf("## Generated with %s version %s\n",
      93  GetPackagerProjectUrl().c_str(), version.c_str());
      94  }
      95 
      96  // 6 is required for EXT-X-MAP without EXT-X-I-FRAMES-ONLY.
      97  std::string header = base::StringPrintf(
      98  "#EXTM3U\n"
      99  "#EXT-X-VERSION:6\n"
      100  "%s"
      101  "#EXT-X-TARGETDURATION:%d\n",
      102  version_line.c_str(), target_duration);
      103 
      104  switch (type) {
      105  case HlsPlaylistType::kVod:
      106  header += "#EXT-X-PLAYLIST-TYPE:VOD\n";
      107  break;
      108  case HlsPlaylistType::kEvent:
      109  header += "#EXT-X-PLAYLIST-TYPE:EVENT\n";
      110  break;
      111  case HlsPlaylistType::kLive:
      112  if (media_sequence_number > 0) {
      113  base::StringAppendF(&header, "#EXT-X-MEDIA-SEQUENCE:%d\n",
      114  media_sequence_number);
      115  }
      116  if (discontinuity_sequence_number > 0) {
      117  base::StringAppendF(&header, "#EXT-X-DISCONTINUITY-SEQUENCE:%d\n",
      118  discontinuity_sequence_number);
      119  }
      120  break;
      121  default:
      122  NOTREACHED() << "Unexpected MediaPlaylistType " << static_cast<int>(type);
      123  }
      124  if (stream_type ==
      125  MediaPlaylist::MediaPlaylistStreamType::kVideoIFramesOnly) {
      126  base::StringAppendF(&header, "#EXT-X-I-FRAMES-ONLY\n");
      127  }
      128 
      129  // Put EXT-X-MAP at the end since the rest of the playlist is about the
      130  // segment and key info.
      131  AppendExtXMap(media_info, &header);
      132 
      133  return header;
      134 }
      135 
      136 class SegmentInfoEntry : public HlsEntry {
      137  public:
      138  // If |use_byte_range| true then this will append EXT-X-BYTERANGE
      139  // after EXTINF.
      140  // It uses |previous_segment_end_offset| to determine if it has to also
      141  // specify the start byte offset in the tag.
      142  // |duration| is duration in seconds.
      143  SegmentInfoEntry(const std::string& file_name,
      144  double start_time,
      145  double duration,
      146  bool use_byte_range,
      147  uint64_t start_byte_offset,
      148  uint64_t segment_file_size,
      149  uint64_t previous_segment_end_offset);
      150 
      151  std::string ToString() override;
      152  double start_time() const { return start_time_; }
      153  double duration() const { return duration_; }
      154 
      155  private:
      156  SegmentInfoEntry(const SegmentInfoEntry&) = delete;
      157  SegmentInfoEntry& operator=(const SegmentInfoEntry&) = delete;
      158 
      159  const std::string file_name_;
      160  const double start_time_;
      161  const double duration_;
      162  const bool use_byte_range_;
      163  const uint64_t start_byte_offset_;
      164  const uint64_t segment_file_size_;
      165  const uint64_t previous_segment_end_offset_;
      166 };
      167 
      168 SegmentInfoEntry::SegmentInfoEntry(const std::string& file_name,
      169  double start_time,
      170  double duration,
      171  bool use_byte_range,
      172  uint64_t start_byte_offset,
      173  uint64_t segment_file_size,
      174  uint64_t previous_segment_end_offset)
      175  : HlsEntry(HlsEntry::EntryType::kExtInf),
      176  file_name_(file_name),
      177  start_time_(start_time),
      178  duration_(duration),
      179  use_byte_range_(use_byte_range),
      180  start_byte_offset_(start_byte_offset),
      181  segment_file_size_(segment_file_size),
      182  previous_segment_end_offset_(previous_segment_end_offset) {}
      183 
      184 std::string SegmentInfoEntry::ToString() {
      185  std::string result = base::StringPrintf("#EXTINF:%.3f,", duration_);
      186 
      187  if (use_byte_range_) {
      188  base::StringAppendF(&result, "\n#EXT-X-BYTERANGE:%" PRIu64,
      189  segment_file_size_);
      190  if (previous_segment_end_offset_ + 1 != start_byte_offset_) {
      191  base::StringAppendF(&result, "@%" PRIu64, start_byte_offset_);
      192  }
      193  }
      194 
      195  base::StringAppendF(&result, "\n%s", file_name_.c_str());
      196 
      197  return result;
      198 }
      199 
      200 class EncryptionInfoEntry : public HlsEntry {
      201  public:
      202  EncryptionInfoEntry(MediaPlaylist::EncryptionMethod method,
      203  const std::string& url,
      204  const std::string& key_id,
      205  const std::string& iv,
      206  const std::string& key_format,
      207  const std::string& key_format_versions);
      208 
      209  std::string ToString() override;
      210 
      211  private:
      212  EncryptionInfoEntry(const EncryptionInfoEntry&) = delete;
      213  EncryptionInfoEntry& operator=(const EncryptionInfoEntry&) = delete;
      214 
      215  const MediaPlaylist::EncryptionMethod method_;
      216  const std::string url_;
      217  const std::string key_id_;
      218  const std::string iv_;
      219  const std::string key_format_;
      220  const std::string key_format_versions_;
      221 };
      222 
      223 EncryptionInfoEntry::EncryptionInfoEntry(MediaPlaylist::EncryptionMethod method,
      224  const std::string& url,
      225  const std::string& key_id,
      226  const std::string& iv,
      227  const std::string& key_format,
      228  const std::string& key_format_versions)
      229  : HlsEntry(HlsEntry::EntryType::kExtKey),
      230  method_(method),
      231  url_(url),
      232  key_id_(key_id),
      233  iv_(iv),
      234  key_format_(key_format),
      235  key_format_versions_(key_format_versions) {}
      236 
      237 std::string EncryptionInfoEntry::ToString() {
      238  std::string tag_string;
      239  Tag tag("#EXT-X-KEY", &tag_string);
      240 
      241  if (method_ == MediaPlaylist::EncryptionMethod::kSampleAes) {
      242  tag.AddString("METHOD", "SAMPLE-AES");
      243  } else if (method_ == MediaPlaylist::EncryptionMethod::kAes128) {
      244  tag.AddString("METHOD", "AES-128");
      245  } else if (method_ == MediaPlaylist::EncryptionMethod::kSampleAesCenc) {
      246  tag.AddString("METHOD", "SAMPLE-AES-CTR");
      247  } else {
      248  DCHECK(method_ == MediaPlaylist::EncryptionMethod::kNone);
      249  tag.AddString("METHOD", "NONE");
      250  }
      251 
      252  tag.AddQuotedString("URI", url_);
      253 
      254  if (!key_id_.empty()) {
      255  tag.AddString("KEYID", key_id_);
      256  }
      257  if (!iv_.empty()) {
      258  tag.AddString("IV", iv_);
      259  }
      260  if (!key_format_versions_.empty()) {
      261  tag.AddQuotedString("KEYFORMATVERSIONS", key_format_versions_);
      262  }
      263  if (!key_format_.empty()) {
      264  tag.AddQuotedString("KEYFORMAT", key_format_);
      265  }
      266 
      267  return tag_string;
      268 }
      269 
      270 class DiscontinuityEntry : public HlsEntry {
      271  public:
      272  DiscontinuityEntry();
      273 
      274  std::string ToString() override;
      275 
      276  private:
      277  DiscontinuityEntry(const DiscontinuityEntry&) = delete;
      278  DiscontinuityEntry& operator=(const DiscontinuityEntry&) = delete;
      279 };
      280 
      281 DiscontinuityEntry::DiscontinuityEntry()
      282  : HlsEntry(HlsEntry::EntryType::kExtDiscontinuity) {}
      283 
      284 std::string DiscontinuityEntry::ToString() {
      285  return "#EXT-X-DISCONTINUITY";
      286 }
      287 
      288 class PlacementOpportunityEntry : public HlsEntry {
      289  public:
      290  PlacementOpportunityEntry();
      291 
      292  std::string ToString() override;
      293 
      294  private:
      295  PlacementOpportunityEntry(const PlacementOpportunityEntry&) = delete;
      296  PlacementOpportunityEntry& operator=(const PlacementOpportunityEntry&) =
      297  delete;
      298 };
      299 
      300 PlacementOpportunityEntry::PlacementOpportunityEntry()
      301  : HlsEntry(HlsEntry::EntryType::kExtPlacementOpportunity) {}
      302 
      303 std::string PlacementOpportunityEntry::ToString() {
      304  return "#EXT-X-PLACEMENT-OPPORTUNITY";
      305 }
      306 
      307 double LatestSegmentStartTime(
      308  const std::list<std::unique_ptr<HlsEntry>>& entries) {
      309  DCHECK(!entries.empty());
      310  for (auto iter = entries.rbegin(); iter != entries.rend(); ++iter) {
      311  if (iter->get()->type() == HlsEntry::EntryType::kExtInf) {
      312  const SegmentInfoEntry* segment_info =
      313  reinterpret_cast<SegmentInfoEntry*>(iter->get());
      314  return segment_info->start_time();
      315  }
      316  }
      317  return 0.0;
      318 }
      319 
      320 } // namespace
      321 
      322 HlsEntry::HlsEntry(HlsEntry::EntryType type) : type_(type) {}
      323 HlsEntry::~HlsEntry() {}
      324 
      326  const std::string& file_name,
      327  const std::string& name,
      328  const std::string& group_id)
      329  : hls_params_(hls_params),
      330  file_name_(file_name),
      331  name_(name),
      332  group_id_(group_id) {}
      333 
      334 MediaPlaylist::~MediaPlaylist() {}
      335 
      337  MediaPlaylistStreamType stream_type) {
      338  stream_type_ = stream_type;
      339 }
      340 
      341 void MediaPlaylist::SetCodecForTesting(const std::string& codec) {
      342  codec_ = codec;
      343 }
      344 
      346  language_ = language;
      347 }
      348 
      349 bool MediaPlaylist::SetMediaInfo(const MediaInfo& media_info) {
      350  const uint32_t time_scale = GetTimeScale(media_info);
      351  if (time_scale == 0) {
      352  LOG(ERROR) << "MediaInfo does not contain a valid timescale.";
      353  return false;
      354  }
      355 
      356  if (media_info.has_video_info()) {
      357  stream_type_ = MediaPlaylistStreamType::kVideo;
      358  codec_ = media_info.video_info().codec();
      359  } else if (media_info.has_audio_info()) {
      360  stream_type_ = MediaPlaylistStreamType::kAudio;
      361  codec_ = media_info.audio_info().codec();
      362  } else {
      363  stream_type_ = MediaPlaylistStreamType::kSubtitle;
      364  codec_ = media_info.text_info().codec();
      365  }
      366 
      367  time_scale_ = time_scale;
      368  media_info_ = media_info;
      369  language_ = GetLanguage(media_info);
      370  use_byte_range_ = !media_info_.has_segment_template_url();
      371  return true;
      372 }
      373 
      374 void MediaPlaylist::AddSegment(const std::string& file_name,
      375  uint64_t start_time,
      376  uint64_t duration,
      377  uint64_t start_byte_offset,
      378  uint64_t size) {
      379  if (stream_type_ == MediaPlaylistStreamType::kVideoIFramesOnly) {
      380  if (key_frames_.empty())
      381  return;
      382  // Skip the last entry as the duration of the key frames are defined by the
      383  // next key frame, which we don't know yet.
      384  for (auto iter = key_frames_.begin(); iter != std::prev(key_frames_.end());
      385  ++iter) {
      386  const std::string& segment_file_name =
      387  iter->segment_file_name.empty() ? file_name : iter->segment_file_name;
      388  AddSegmentInfoEntry(segment_file_name, iter->timestamp, iter->duration,
      389  iter->start_byte_offset, iter->size);
      390  }
      391 
      392  key_frames_.erase(key_frames_.begin(), std::prev(key_frames_.end()));
      393  KeyFrameInfo& key_frame = key_frames_.front();
      394  key_frame.segment_file_name = file_name;
      395  key_frame.duration = start_time + duration - key_frame.timestamp;
      396  return;
      397  }
      398  return AddSegmentInfoEntry(file_name, start_time, duration, start_byte_offset,
      399  size);
      400 }
      401 
      402 void MediaPlaylist::AddKeyFrame(uint64_t timestamp,
      403  uint64_t start_byte_offset,
      404  uint64_t size) {
      405  if (stream_type_ != MediaPlaylistStreamType::kVideoIFramesOnly) {
      406  if (stream_type_ != MediaPlaylistStreamType::kVideo) {
      407  LOG(WARNING)
      408  << "I-Frames Only playlist applies to video renditions only.";
      409  return;
      410  }
      411  stream_type_ = MediaPlaylistStreamType::kVideoIFramesOnly;
      412  use_byte_range_ = true;
      413  }
      414  if (!key_frames_.empty()) {
      415  key_frames_.back().duration = timestamp - key_frames_.back().timestamp;
      416  }
      417  key_frames_.push_back({timestamp, start_byte_offset, size});
      418 }
      419 
      420 void MediaPlaylist::AddEncryptionInfo(MediaPlaylist::EncryptionMethod method,
      421  const std::string& url,
      422  const std::string& key_id,
      423  const std::string& iv,
      424  const std::string& key_format,
      425  const std::string& key_format_versions) {
      426  if (!inserted_discontinuity_tag_) {
      427  // Insert discontinuity tag only for the first EXT-X-KEY, only if there
      428  // are non-encrypted media segments.
      429  if (!entries_.empty())
      430  entries_.emplace_back(new DiscontinuityEntry());
      431  inserted_discontinuity_tag_ = true;
      432  }
      433  entries_.emplace_back(new EncryptionInfoEntry(
      434  method, url, key_id, iv, key_format, key_format_versions));
      435 }
      436 
      438  entries_.emplace_back(new PlacementOpportunityEntry());
      439 }
      440 
      441 bool MediaPlaylist::WriteToFile(const std::string& file_path) {
      442  if (!key_frames_.empty() &&
      443  hls_params_.playlist_type == HlsPlaylistType::kVod) {
      444  // Flush remaining key frames. This assumes |WriteToFile| is only called
      445  // once at the end of the file in VOD.
      446  CHECK_EQ(key_frames_.size(), 1u);
      447  const KeyFrameInfo& key_frame = key_frames_.front();
      448  AddSegmentInfoEntry(key_frame.segment_file_name, key_frame.timestamp,
      449  key_frame.duration, key_frame.start_byte_offset,
      450  key_frame.size);
      451  key_frames_.clear();
      452  }
      453 
      454  if (!target_duration_set_) {
      456  }
      457 
      458  std::string content = CreatePlaylistHeader(
      459  media_info_, target_duration_, hls_params_.playlist_type, stream_type_,
      460  media_sequence_number_, discontinuity_sequence_number_);
      461 
      462  for (const auto& entry : entries_)
      463  base::StringAppendF(&content, "%s\n", entry->ToString().c_str());
      464 
      465  if (hls_params_.playlist_type == HlsPlaylistType::kVod) {
      466  content += "#EXT-X-ENDLIST\n";
      467  }
      468 
      469  if (!File::WriteFileAtomically(file_path.c_str(), content)) {
      470  LOG(ERROR) << "Failed to write playlist to: " << file_path;
      471  return false;
      472  }
      473  return true;
      474 }
      475 
      476 uint64_t MediaPlaylist::Bitrate() const {
      477  if (media_info_.has_bandwidth())
      478  return media_info_.bandwidth();
      479  return max_bitrate_;
      480 }
      481 
      483  return longest_segment_duration_;
      484 }
      485 
      486 void MediaPlaylist::SetTargetDuration(uint32_t target_duration) {
      487  if (target_duration_set_) {
      488  if (target_duration_ == target_duration)
      489  return;
      490  VLOG(1) << "Updating target duration from " << target_duration << " to "
      491  << target_duration_;
      492  }
      493  target_duration_ = target_duration;
      494  target_duration_set_ = true;
      495 }
      496 
      498  return media_info_.audio_info().num_channels();
      499 }
      500 
      502  uint32_t* height) const {
      503  DCHECK(width);
      504  DCHECK(height);
      505  if (media_info_.has_video_info()) {
      506  const double pixel_aspect_ratio =
      507  media_info_.video_info().pixel_height() > 0
      508  ? static_cast<double>(media_info_.video_info().pixel_width()) /
      509  media_info_.video_info().pixel_height()
      510  : 1.0;
      511  *width = static_cast<uint32_t>(media_info_.video_info().width() *
      512  pixel_aspect_ratio);
      513  *height = media_info_.video_info().height();
      514  return true;
      515  }
      516  return false;
      517 }
      518 
      519 void MediaPlaylist::AddSegmentInfoEntry(const std::string& segment_file_name,
      520  uint64_t start_time,
      521  uint64_t duration,
      522  uint64_t start_byte_offset,
      523  uint64_t size) {
      524  if (time_scale_ == 0) {
      525  LOG(WARNING) << "Timescale is not set and the duration for " << duration
      526  << " cannot be calculated. The output will be wrong.";
      527 
      528  entries_.emplace_back(new SegmentInfoEntry(
      529  segment_file_name, 0.0, 0.0, use_byte_range_, start_byte_offset, size,
      530  previous_segment_end_offset_));
      531  return;
      532  }
      533 
      534  const double start_time_seconds =
      535  static_cast<double>(start_time) / time_scale_;
      536  const double segment_duration_seconds =
      537  static_cast<double>(duration) / time_scale_;
      538  if (segment_duration_seconds > longest_segment_duration_)
      539  longest_segment_duration_ = segment_duration_seconds;
      540 
      541  const int kBitsInByte = 8;
      542  const uint64_t bitrate = kBitsInByte * size / segment_duration_seconds;
      543  max_bitrate_ = std::max(max_bitrate_, bitrate);
      544  entries_.emplace_back(new SegmentInfoEntry(
      545  segment_file_name, start_time_seconds, segment_duration_seconds,
      546  use_byte_range_, start_byte_offset, size, previous_segment_end_offset_));
      547  previous_segment_end_offset_ = start_byte_offset + size - 1;
      548  SlideWindow();
      549 }
      550 
      551 void MediaPlaylist::SlideWindow() {
      552  DCHECK(!entries_.empty());
      553  if (hls_params_.time_shift_buffer_depth <= 0.0 ||
      554  hls_params_.playlist_type != HlsPlaylistType::kLive) {
      555  return;
      556  }
      557  DCHECK_GT(time_scale_, 0u);
      558 
      559  // The start time of the latest segment is considered the current_play_time,
      560  // and this should guarantee that the latest segment will stay in the list.
      561  const double current_play_time = LatestSegmentStartTime(entries_);
      562  if (current_play_time <= hls_params_.time_shift_buffer_depth)
      563  return;
      564 
      565  const double timeshift_limit =
      566  current_play_time - hls_params_.time_shift_buffer_depth;
      567 
      568  // Temporary list to hold the EXT-X-KEYs. For example, this allows us to
      569  // remove <3> without removing <1> and <2> below (<1> and <2> are moved to the
      570  // temporary list and added back later).
      571  // #EXT-X-KEY <1>
      572  // #EXT-X-KEY <2>
      573  // #EXTINF <3>
      574  // #EXTINF <4>
      575  std::list<std::unique_ptr<HlsEntry>> ext_x_keys;
      576  // Consecutive key entries are either fully removed or not removed at all.
      577  // Keep track of entry types so we know if it is consecutive key entries.
      578  HlsEntry::EntryType prev_entry_type = HlsEntry::EntryType::kExtInf;
      579 
      580  std::list<std::unique_ptr<HlsEntry>>::iterator last = entries_.begin();
      581  for (; last != entries_.end(); ++last) {
      582  HlsEntry::EntryType entry_type = last->get()->type();
      583  if (entry_type == HlsEntry::EntryType::kExtKey) {
      584  if (prev_entry_type != HlsEntry::EntryType::kExtKey)
      585  ext_x_keys.clear();
      586  ext_x_keys.push_back(std::move(*last));
      587  } else if (entry_type == HlsEntry::EntryType::kExtDiscontinuity) {
      588  ++discontinuity_sequence_number_;
      589  } else {
      590  DCHECK_EQ(entry_type, HlsEntry::EntryType::kExtInf);
      591  const SegmentInfoEntry& segment_info =
      592  *reinterpret_cast<SegmentInfoEntry*>(last->get());
      593  const double last_segment_end_time =
      594  segment_info.start_time() + segment_info.duration();
      595  if (timeshift_limit < last_segment_end_time)
      596  break;
      597  RemoveOldSegment(segment_info.start_time());
      598  media_sequence_number_++;
      599  }
      600  prev_entry_type = entry_type;
      601  }
      602  entries_.erase(entries_.begin(), last);
      603  // Add key entries back.
      604  entries_.insert(entries_.begin(), std::make_move_iterator(ext_x_keys.begin()),
      605  std::make_move_iterator(ext_x_keys.end()));
      606 }
      607 
      608 void MediaPlaylist::RemoveOldSegment(uint64_t start_time) {
      609  if (hls_params_.preserved_segments_outside_live_window == 0)
      610  return;
      611  if (stream_type_ == MediaPlaylistStreamType::kVideoIFramesOnly)
      612  return;
      613 
      614  segments_to_be_removed_.push_back(
      615  media::GetSegmentName(media_info_.segment_template(), start_time,
      616  media_sequence_number_, media_info_.bandwidth()));
      617  while (segments_to_be_removed_.size() >
      619  VLOG(2) << "Deleting " << segments_to_be_removed_.front();
      620  File::Delete(segments_to_be_removed_.front().c_str());
      621  segments_to_be_removed_.pop_front();
      622  }
      623 }
      624 
      625 } // namespace hls
      626 } // namespace shaka
      void SetStreamTypeForTesting(MediaPlaylistStreamType stream_type)
      For testing only.
      -
      virtual uint64_t Bitrate() const
      +
      1 // Copyright 2016 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #include "packager/hls/base/media_playlist.h"
      8 
      9 #include <inttypes.h>
      10 
      11 #include <algorithm>
      12 #include <cmath>
      13 #include <memory>
      14 
      15 #include "packager/base/logging.h"
      16 #include "packager/base/strings/string_number_conversions.h"
      17 #include "packager/base/strings/stringprintf.h"
      18 #include "packager/file/file.h"
      19 #include "packager/hls/base/tag.h"
      20 #include "packager/media/base/language_utils.h"
      21 #include "packager/media/base/muxer_util.h"
      22 #include "packager/version/version.h"
      23 
      24 namespace shaka {
      25 namespace hls {
      26 
      27 namespace {
      28 uint32_t GetTimeScale(const MediaInfo& media_info) {
      29  if (media_info.has_reference_time_scale())
      30  return media_info.reference_time_scale();
      31 
      32  if (media_info.has_video_info())
      33  return media_info.video_info().time_scale();
      34 
      35  if (media_info.has_audio_info())
      36  return media_info.audio_info().time_scale();
      37  return 0u;
      38 }
      39 
      40 // Duplicated from MpdUtils because:
      41 // 1. MpdUtils header depends on libxml header, which is not in the deps here
      42 // 2. GetLanguage depends on MediaInfo from packager/mpd/
      43 // 3. Moving GetLanguage to LanguageUtils would create a a media => mpd dep.
      44 // TODO(https://github.com/google/shaka-packager/issues/373): Fix this
      45 // dependency situation and factor this out to a common location.
      46 std::string GetLanguage(const MediaInfo& media_info) {
      47  std::string lang;
      48  if (media_info.has_audio_info()) {
      49  lang = media_info.audio_info().language();
      50  } else if (media_info.has_text_info()) {
      51  lang = media_info.text_info().language();
      52  }
      53  return LanguageToShortestForm(lang);
      54 }
      55 
      56 void AppendExtXMap(const MediaInfo& media_info, std::string* out) {
      57  if (media_info.has_init_segment_url()) {
      58  Tag tag("#EXT-X-MAP", out);
      59  tag.AddQuotedString("URI", media_info.init_segment_url().data());
      60  out->append("\n");
      61  } else if (media_info.has_media_file_url() && media_info.has_init_range()) {
      62  // It only makes sense for single segment media to have EXT-X-MAP if
      63  // there is init_range.
      64  Tag tag("#EXT-X-MAP", out);
      65  tag.AddQuotedString("URI", media_info.media_file_url().data());
      66 
      67  if (media_info.has_init_range()) {
      68  const uint64_t begin = media_info.init_range().begin();
      69  const uint64_t end = media_info.init_range().end();
      70  const uint64_t length = end - begin + 1;
      71 
      72  tag.AddQuotedNumberPair("BYTERANGE", length, '@', begin);
      73  }
      74 
      75  out->append("\n");
      76  } else {
      77  // This media info does not need an ext-x-map tag.
      78  }
      79 }
      80 
      81 std::string CreatePlaylistHeader(
      82  const MediaInfo& media_info,
      83  uint32_t target_duration,
      84  HlsPlaylistType type,
      85  MediaPlaylist::MediaPlaylistStreamType stream_type,
      86  int media_sequence_number,
      87  int discontinuity_sequence_number) {
      88  const std::string version = GetPackagerVersion();
      89  std::string version_line;
      90  if (!version.empty()) {
      91  version_line =
      92  base::StringPrintf("## Generated with %s version %s\n",
      93  GetPackagerProjectUrl().c_str(), version.c_str());
      94  }
      95 
      96  // 6 is required for EXT-X-MAP without EXT-X-I-FRAMES-ONLY.
      97  std::string header = base::StringPrintf(
      98  "#EXTM3U\n"
      99  "#EXT-X-VERSION:6\n"
      100  "%s"
      101  "#EXT-X-TARGETDURATION:%d\n",
      102  version_line.c_str(), target_duration);
      103 
      104  switch (type) {
      105  case HlsPlaylistType::kVod:
      106  header += "#EXT-X-PLAYLIST-TYPE:VOD\n";
      107  break;
      108  case HlsPlaylistType::kEvent:
      109  header += "#EXT-X-PLAYLIST-TYPE:EVENT\n";
      110  break;
      111  case HlsPlaylistType::kLive:
      112  if (media_sequence_number > 0) {
      113  base::StringAppendF(&header, "#EXT-X-MEDIA-SEQUENCE:%d\n",
      114  media_sequence_number);
      115  }
      116  if (discontinuity_sequence_number > 0) {
      117  base::StringAppendF(&header, "#EXT-X-DISCONTINUITY-SEQUENCE:%d\n",
      118  discontinuity_sequence_number);
      119  }
      120  break;
      121  default:
      122  NOTREACHED() << "Unexpected MediaPlaylistType " << static_cast<int>(type);
      123  }
      124  if (stream_type ==
      125  MediaPlaylist::MediaPlaylistStreamType::kVideoIFramesOnly) {
      126  base::StringAppendF(&header, "#EXT-X-I-FRAMES-ONLY\n");
      127  }
      128 
      129  // Put EXT-X-MAP at the end since the rest of the playlist is about the
      130  // segment and key info.
      131  AppendExtXMap(media_info, &header);
      132 
      133  return header;
      134 }
      135 
      136 class SegmentInfoEntry : public HlsEntry {
      137  public:
      138  // If |use_byte_range| true then this will append EXT-X-BYTERANGE
      139  // after EXTINF.
      140  // It uses |previous_segment_end_offset| to determine if it has to also
      141  // specify the start byte offset in the tag.
      142  // |duration| is duration in seconds.
      143  SegmentInfoEntry(const std::string& file_name,
      144  double start_time,
      145  double duration,
      146  bool use_byte_range,
      147  uint64_t start_byte_offset,
      148  uint64_t segment_file_size,
      149  uint64_t previous_segment_end_offset);
      150 
      151  std::string ToString() override;
      152  double start_time() const { return start_time_; }
      153  double duration() const { return duration_; }
      154  void set_duration(double duration) { duration_ = duration; }
      155 
      156  private:
      157  SegmentInfoEntry(const SegmentInfoEntry&) = delete;
      158  SegmentInfoEntry& operator=(const SegmentInfoEntry&) = delete;
      159 
      160  const std::string file_name_;
      161  const double start_time_;
      162  double duration_;
      163  const bool use_byte_range_;
      164  const uint64_t start_byte_offset_;
      165  const uint64_t segment_file_size_;
      166  const uint64_t previous_segment_end_offset_;
      167 };
      168 
      169 SegmentInfoEntry::SegmentInfoEntry(const std::string& file_name,
      170  double start_time,
      171  double duration,
      172  bool use_byte_range,
      173  uint64_t start_byte_offset,
      174  uint64_t segment_file_size,
      175  uint64_t previous_segment_end_offset)
      176  : HlsEntry(HlsEntry::EntryType::kExtInf),
      177  file_name_(file_name),
      178  start_time_(start_time),
      179  duration_(duration),
      180  use_byte_range_(use_byte_range),
      181  start_byte_offset_(start_byte_offset),
      182  segment_file_size_(segment_file_size),
      183  previous_segment_end_offset_(previous_segment_end_offset) {}
      184 
      185 std::string SegmentInfoEntry::ToString() {
      186  std::string result = base::StringPrintf("#EXTINF:%.3f,", duration_);
      187 
      188  if (use_byte_range_) {
      189  base::StringAppendF(&result, "\n#EXT-X-BYTERANGE:%" PRIu64,
      190  segment_file_size_);
      191  if (previous_segment_end_offset_ + 1 != start_byte_offset_) {
      192  base::StringAppendF(&result, "@%" PRIu64, start_byte_offset_);
      193  }
      194  }
      195 
      196  base::StringAppendF(&result, "\n%s", file_name_.c_str());
      197 
      198  return result;
      199 }
      200 
      201 class EncryptionInfoEntry : public HlsEntry {
      202  public:
      203  EncryptionInfoEntry(MediaPlaylist::EncryptionMethod method,
      204  const std::string& url,
      205  const std::string& key_id,
      206  const std::string& iv,
      207  const std::string& key_format,
      208  const std::string& key_format_versions);
      209 
      210  std::string ToString() override;
      211 
      212  private:
      213  EncryptionInfoEntry(const EncryptionInfoEntry&) = delete;
      214  EncryptionInfoEntry& operator=(const EncryptionInfoEntry&) = delete;
      215 
      216  const MediaPlaylist::EncryptionMethod method_;
      217  const std::string url_;
      218  const std::string key_id_;
      219  const std::string iv_;
      220  const std::string key_format_;
      221  const std::string key_format_versions_;
      222 };
      223 
      224 EncryptionInfoEntry::EncryptionInfoEntry(MediaPlaylist::EncryptionMethod method,
      225  const std::string& url,
      226  const std::string& key_id,
      227  const std::string& iv,
      228  const std::string& key_format,
      229  const std::string& key_format_versions)
      230  : HlsEntry(HlsEntry::EntryType::kExtKey),
      231  method_(method),
      232  url_(url),
      233  key_id_(key_id),
      234  iv_(iv),
      235  key_format_(key_format),
      236  key_format_versions_(key_format_versions) {}
      237 
      238 std::string EncryptionInfoEntry::ToString() {
      239  std::string tag_string;
      240  Tag tag("#EXT-X-KEY", &tag_string);
      241 
      242  if (method_ == MediaPlaylist::EncryptionMethod::kSampleAes) {
      243  tag.AddString("METHOD", "SAMPLE-AES");
      244  } else if (method_ == MediaPlaylist::EncryptionMethod::kAes128) {
      245  tag.AddString("METHOD", "AES-128");
      246  } else if (method_ == MediaPlaylist::EncryptionMethod::kSampleAesCenc) {
      247  tag.AddString("METHOD", "SAMPLE-AES-CTR");
      248  } else {
      249  DCHECK(method_ == MediaPlaylist::EncryptionMethod::kNone);
      250  tag.AddString("METHOD", "NONE");
      251  }
      252 
      253  tag.AddQuotedString("URI", url_);
      254 
      255  if (!key_id_.empty()) {
      256  tag.AddString("KEYID", key_id_);
      257  }
      258  if (!iv_.empty()) {
      259  tag.AddString("IV", iv_);
      260  }
      261  if (!key_format_versions_.empty()) {
      262  tag.AddQuotedString("KEYFORMATVERSIONS", key_format_versions_);
      263  }
      264  if (!key_format_.empty()) {
      265  tag.AddQuotedString("KEYFORMAT", key_format_);
      266  }
      267 
      268  return tag_string;
      269 }
      270 
      271 class DiscontinuityEntry : public HlsEntry {
      272  public:
      273  DiscontinuityEntry();
      274 
      275  std::string ToString() override;
      276 
      277  private:
      278  DiscontinuityEntry(const DiscontinuityEntry&) = delete;
      279  DiscontinuityEntry& operator=(const DiscontinuityEntry&) = delete;
      280 };
      281 
      282 DiscontinuityEntry::DiscontinuityEntry()
      283  : HlsEntry(HlsEntry::EntryType::kExtDiscontinuity) {}
      284 
      285 std::string DiscontinuityEntry::ToString() {
      286  return "#EXT-X-DISCONTINUITY";
      287 }
      288 
      289 class PlacementOpportunityEntry : public HlsEntry {
      290  public:
      291  PlacementOpportunityEntry();
      292 
      293  std::string ToString() override;
      294 
      295  private:
      296  PlacementOpportunityEntry(const PlacementOpportunityEntry&) = delete;
      297  PlacementOpportunityEntry& operator=(const PlacementOpportunityEntry&) =
      298  delete;
      299 };
      300 
      301 PlacementOpportunityEntry::PlacementOpportunityEntry()
      302  : HlsEntry(HlsEntry::EntryType::kExtPlacementOpportunity) {}
      303 
      304 std::string PlacementOpportunityEntry::ToString() {
      305  return "#EXT-X-PLACEMENT-OPPORTUNITY";
      306 }
      307 
      308 double LatestSegmentStartTime(
      309  const std::list<std::unique_ptr<HlsEntry>>& entries) {
      310  DCHECK(!entries.empty());
      311  for (auto iter = entries.rbegin(); iter != entries.rend(); ++iter) {
      312  if (iter->get()->type() == HlsEntry::EntryType::kExtInf) {
      313  const SegmentInfoEntry* segment_info =
      314  reinterpret_cast<SegmentInfoEntry*>(iter->get());
      315  return segment_info->start_time();
      316  }
      317  }
      318  return 0.0;
      319 }
      320 
      321 } // namespace
      322 
      323 HlsEntry::HlsEntry(HlsEntry::EntryType type) : type_(type) {}
      324 HlsEntry::~HlsEntry() {}
      325 
      327  const std::string& file_name,
      328  const std::string& name,
      329  const std::string& group_id)
      330  : hls_params_(hls_params),
      331  file_name_(file_name),
      332  name_(name),
      333  group_id_(group_id) {}
      334 
      335 MediaPlaylist::~MediaPlaylist() {}
      336 
      338  MediaPlaylistStreamType stream_type) {
      339  stream_type_ = stream_type;
      340 }
      341 
      342 void MediaPlaylist::SetCodecForTesting(const std::string& codec) {
      343  codec_ = codec;
      344 }
      345 
      347  language_ = language;
      348 }
      349 
      350 bool MediaPlaylist::SetMediaInfo(const MediaInfo& media_info) {
      351  const uint32_t time_scale = GetTimeScale(media_info);
      352  if (time_scale == 0) {
      353  LOG(ERROR) << "MediaInfo does not contain a valid timescale.";
      354  return false;
      355  }
      356 
      357  if (media_info.has_video_info()) {
      358  stream_type_ = MediaPlaylistStreamType::kVideo;
      359  codec_ = media_info.video_info().codec();
      360  } else if (media_info.has_audio_info()) {
      361  stream_type_ = MediaPlaylistStreamType::kAudio;
      362  codec_ = media_info.audio_info().codec();
      363  } else {
      364  stream_type_ = MediaPlaylistStreamType::kSubtitle;
      365  codec_ = media_info.text_info().codec();
      366  }
      367 
      368  time_scale_ = time_scale;
      369  media_info_ = media_info;
      370  language_ = GetLanguage(media_info);
      371  use_byte_range_ = !media_info_.has_segment_template_url();
      372  return true;
      373 }
      374 
      375 void MediaPlaylist::AddSegment(const std::string& file_name,
      376  uint64_t start_time,
      377  uint64_t duration,
      378  uint64_t start_byte_offset,
      379  uint64_t size) {
      380  if (stream_type_ == MediaPlaylistStreamType::kVideoIFramesOnly) {
      381  if (key_frames_.empty())
      382  return;
      383 
      384  AdjustLastSegmentInfoEntryDuration(key_frames_.front().timestamp);
      385 
      386  for (auto iter = key_frames_.begin(); iter != key_frames_.end(); ++iter) {
      387  // Last entry duration may be adjusted later when the next iframe becomes
      388  // available.
      389  const uint64_t next_timestamp = std::next(iter) == key_frames_.end()
      390  ? (start_time + duration)
      391  : std::next(iter)->timestamp;
      392  AddSegmentInfoEntry(file_name, iter->timestamp,
      393  next_timestamp - iter->timestamp,
      394  iter->start_byte_offset, iter->size);
      395  }
      396  key_frames_.clear();
      397  return;
      398  }
      399  return AddSegmentInfoEntry(file_name, start_time, duration, start_byte_offset,
      400  size);
      401 }
      402 
      403 void MediaPlaylist::AddKeyFrame(uint64_t timestamp,
      404  uint64_t start_byte_offset,
      405  uint64_t size) {
      406  if (stream_type_ != MediaPlaylistStreamType::kVideoIFramesOnly) {
      407  if (stream_type_ != MediaPlaylistStreamType::kVideo) {
      408  LOG(WARNING)
      409  << "I-Frames Only playlist applies to video renditions only.";
      410  return;
      411  }
      412  stream_type_ = MediaPlaylistStreamType::kVideoIFramesOnly;
      413  use_byte_range_ = true;
      414  }
      415  key_frames_.push_back({timestamp, start_byte_offset, size});
      416 }
      417 
      418 void MediaPlaylist::AddEncryptionInfo(MediaPlaylist::EncryptionMethod method,
      419  const std::string& url,
      420  const std::string& key_id,
      421  const std::string& iv,
      422  const std::string& key_format,
      423  const std::string& key_format_versions) {
      424  if (!inserted_discontinuity_tag_) {
      425  // Insert discontinuity tag only for the first EXT-X-KEY, only if there
      426  // are non-encrypted media segments.
      427  if (!entries_.empty())
      428  entries_.emplace_back(new DiscontinuityEntry());
      429  inserted_discontinuity_tag_ = true;
      430  }
      431  entries_.emplace_back(new EncryptionInfoEntry(
      432  method, url, key_id, iv, key_format, key_format_versions));
      433 }
      434 
      436  entries_.emplace_back(new PlacementOpportunityEntry());
      437 }
      438 
      439 bool MediaPlaylist::WriteToFile(const std::string& file_path) {
      440  if (!target_duration_set_) {
      442  }
      443 
      444  std::string content = CreatePlaylistHeader(
      445  media_info_, target_duration_, hls_params_.playlist_type, stream_type_,
      446  media_sequence_number_, discontinuity_sequence_number_);
      447 
      448  for (const auto& entry : entries_)
      449  base::StringAppendF(&content, "%s\n", entry->ToString().c_str());
      450 
      451  if (hls_params_.playlist_type == HlsPlaylistType::kVod) {
      452  content += "#EXT-X-ENDLIST\n";
      453  }
      454 
      455  if (!File::WriteFileAtomically(file_path.c_str(), content)) {
      456  LOG(ERROR) << "Failed to write playlist to: " << file_path;
      457  return false;
      458  }
      459  return true;
      460 }
      461 
      462 uint64_t MediaPlaylist::Bitrate() const {
      463  if (media_info_.has_bandwidth())
      464  return media_info_.bandwidth();
      465  return max_bitrate_;
      466 }
      467 
      469  return longest_segment_duration_;
      470 }
      471 
      472 void MediaPlaylist::SetTargetDuration(uint32_t target_duration) {
      473  if (target_duration_set_) {
      474  if (target_duration_ == target_duration)
      475  return;
      476  VLOG(1) << "Updating target duration from " << target_duration << " to "
      477  << target_duration_;
      478  }
      479  target_duration_ = target_duration;
      480  target_duration_set_ = true;
      481 }
      482 
      484  return media_info_.audio_info().num_channels();
      485 }
      486 
      488  uint32_t* height) const {
      489  DCHECK(width);
      490  DCHECK(height);
      491  if (media_info_.has_video_info()) {
      492  const double pixel_aspect_ratio =
      493  media_info_.video_info().pixel_height() > 0
      494  ? static_cast<double>(media_info_.video_info().pixel_width()) /
      495  media_info_.video_info().pixel_height()
      496  : 1.0;
      497  *width = static_cast<uint32_t>(media_info_.video_info().width() *
      498  pixel_aspect_ratio);
      499  *height = media_info_.video_info().height();
      500  return true;
      501  }
      502  return false;
      503 }
      504 
      505 void MediaPlaylist::AddSegmentInfoEntry(const std::string& segment_file_name,
      506  uint64_t start_time,
      507  uint64_t duration,
      508  uint64_t start_byte_offset,
      509  uint64_t size) {
      510  if (time_scale_ == 0) {
      511  LOG(WARNING) << "Timescale is not set and the duration for " << duration
      512  << " cannot be calculated. The output will be wrong.";
      513 
      514  entries_.emplace_back(new SegmentInfoEntry(
      515  segment_file_name, 0.0, 0.0, use_byte_range_, start_byte_offset, size,
      516  previous_segment_end_offset_));
      517  return;
      518  }
      519 
      520  const double start_time_seconds =
      521  static_cast<double>(start_time) / time_scale_;
      522  const double segment_duration_seconds =
      523  static_cast<double>(duration) / time_scale_;
      524  longest_segment_duration_ =
      525  std::max(longest_segment_duration_, segment_duration_seconds);
      526 
      527  const int kBitsInByte = 8;
      528  const uint64_t bitrate = kBitsInByte * size / segment_duration_seconds;
      529  max_bitrate_ = std::max(max_bitrate_, bitrate);
      530  entries_.emplace_back(new SegmentInfoEntry(
      531  segment_file_name, start_time_seconds, segment_duration_seconds,
      532  use_byte_range_, start_byte_offset, size, previous_segment_end_offset_));
      533  previous_segment_end_offset_ = start_byte_offset + size - 1;
      534  SlideWindow();
      535 }
      536 
      537 void MediaPlaylist::AdjustLastSegmentInfoEntryDuration(
      538  uint64_t next_timestamp) {
      539  if (time_scale_ == 0)
      540  return;
      541 
      542  const double next_timestamp_seconds =
      543  static_cast<double>(next_timestamp) / time_scale_;
      544 
      545  for (auto iter = entries_.rbegin(); iter != entries_.rend(); ++iter) {
      546  if (iter->get()->type() == HlsEntry::EntryType::kExtInf) {
      547  SegmentInfoEntry* segment_info =
      548  reinterpret_cast<SegmentInfoEntry*>(iter->get());
      549 
      550  const double segment_duration_seconds =
      551  next_timestamp_seconds - segment_info->start_time();
      552  segment_info->set_duration(segment_duration_seconds);
      553  longest_segment_duration_ =
      554  std::max(longest_segment_duration_, segment_duration_seconds);
      555  break;
      556  }
      557  }
      558 }
      559 
      560 void MediaPlaylist::SlideWindow() {
      561  DCHECK(!entries_.empty());
      562  if (hls_params_.time_shift_buffer_depth <= 0.0 ||
      563  hls_params_.playlist_type != HlsPlaylistType::kLive) {
      564  return;
      565  }
      566  DCHECK_GT(time_scale_, 0u);
      567 
      568  // The start time of the latest segment is considered the current_play_time,
      569  // and this should guarantee that the latest segment will stay in the list.
      570  const double current_play_time = LatestSegmentStartTime(entries_);
      571  if (current_play_time <= hls_params_.time_shift_buffer_depth)
      572  return;
      573 
      574  const double timeshift_limit =
      575  current_play_time - hls_params_.time_shift_buffer_depth;
      576 
      577  // Temporary list to hold the EXT-X-KEYs. For example, this allows us to
      578  // remove <3> without removing <1> and <2> below (<1> and <2> are moved to the
      579  // temporary list and added back later).
      580  // #EXT-X-KEY <1>
      581  // #EXT-X-KEY <2>
      582  // #EXTINF <3>
      583  // #EXTINF <4>
      584  std::list<std::unique_ptr<HlsEntry>> ext_x_keys;
      585  // Consecutive key entries are either fully removed or not removed at all.
      586  // Keep track of entry types so we know if it is consecutive key entries.
      587  HlsEntry::EntryType prev_entry_type = HlsEntry::EntryType::kExtInf;
      588 
      589  std::list<std::unique_ptr<HlsEntry>>::iterator last = entries_.begin();
      590  for (; last != entries_.end(); ++last) {
      591  HlsEntry::EntryType entry_type = last->get()->type();
      592  if (entry_type == HlsEntry::EntryType::kExtKey) {
      593  if (prev_entry_type != HlsEntry::EntryType::kExtKey)
      594  ext_x_keys.clear();
      595  ext_x_keys.push_back(std::move(*last));
      596  } else if (entry_type == HlsEntry::EntryType::kExtDiscontinuity) {
      597  ++discontinuity_sequence_number_;
      598  } else {
      599  DCHECK_EQ(entry_type, HlsEntry::EntryType::kExtInf);
      600  const SegmentInfoEntry& segment_info =
      601  *reinterpret_cast<SegmentInfoEntry*>(last->get());
      602  const double last_segment_end_time =
      603  segment_info.start_time() + segment_info.duration();
      604  if (timeshift_limit < last_segment_end_time)
      605  break;
      606  RemoveOldSegment(segment_info.start_time());
      607  media_sequence_number_++;
      608  }
      609  prev_entry_type = entry_type;
      610  }
      611  entries_.erase(entries_.begin(), last);
      612  // Add key entries back.
      613  entries_.insert(entries_.begin(), std::make_move_iterator(ext_x_keys.begin()),
      614  std::make_move_iterator(ext_x_keys.end()));
      615 }
      616 
      617 void MediaPlaylist::RemoveOldSegment(uint64_t start_time) {
      618  if (hls_params_.preserved_segments_outside_live_window == 0)
      619  return;
      620  if (stream_type_ == MediaPlaylistStreamType::kVideoIFramesOnly)
      621  return;
      622 
      623  segments_to_be_removed_.push_back(
      624  media::GetSegmentName(media_info_.segment_template(), start_time,
      625  media_sequence_number_, media_info_.bandwidth()));
      626  while (segments_to_be_removed_.size() >
      628  VLOG(2) << "Deleting " << segments_to_be_removed_.front();
      629  File::Delete(segments_to_be_removed_.front().c_str());
      630  segments_to_be_removed_.pop_front();
      631  }
      632 }
      633 
      634 } // namespace hls
      635 } // namespace shaka
      void SetStreamTypeForTesting(MediaPlaylistStreamType stream_type)
      For testing only.
      +
      virtual uint64_t Bitrate() const
      static bool Delete(const char *file_name)
      Definition: file.cc:198
      HlsPlaylistType
      Definition: hls_params.h:16
      HLS related parameters.
      Definition: hls_params.h:23
      std::string language() const
      size_t preserved_segments_outside_live_window
      Definition: hls_params.h:40
      std::string LanguageToShortestForm(const std::string &language)
      -
      virtual void SetTargetDuration(uint32_t target_duration)
      +
      virtual void SetTargetDuration(uint32_t target_duration)
      All the methods that are virtual are virtual for mocking.
      -
      virtual bool SetMediaInfo(const MediaInfo &media_info)
      -
      virtual void AddKeyFrame(uint64_t timestamp, uint64_t start_byte_offset, uint64_t size)
      -
      MediaPlaylist(const HlsParams &hls_params, const std::string &file_name, const std::string &name, const std::string &group_id)
      +
      virtual bool SetMediaInfo(const MediaInfo &media_info)
      +
      virtual void AddKeyFrame(uint64_t timestamp, uint64_t start_byte_offset, uint64_t size)
      +
      MediaPlaylist(const HlsParams &hls_params, const std::string &file_name, const std::string &name, const std::string &group_id)
      double time_shift_buffer_depth
      Definition: hls_params.h:33
      -
      virtual void AddSegment(const std::string &file_name, uint64_t start_time, uint64_t duration, uint64_t start_byte_offset, uint64_t size)
      -
      void SetLanguageForTesting(const std::string &language)
      For testing only.
      -
      virtual double GetLongestSegmentDuration() const
      +
      virtual void AddSegment(const std::string &file_name, uint64_t start_time, uint64_t duration, uint64_t start_byte_offset, uint64_t size)
      +
      void SetLanguageForTesting(const std::string &language)
      For testing only.
      +
      virtual double GetLongestSegmentDuration() const
      static bool WriteFileAtomically(const char *file_name, const std::string &contents)
      Definition: file.cc:262
      -
      virtual void AddPlacementOpportunity()
      -
      virtual void AddEncryptionInfo(EncryptionMethod method, const std::string &url, const std::string &key_id, const std::string &iv, const std::string &key_format, const std::string &key_format_versions)
      -
      virtual bool GetDisplayResolution(uint32_t *width, uint32_t *height) const
      -
      virtual bool WriteToFile(const std::string &file_path)
      -
      void SetCodecForTesting(const std::string &codec)
      For testing only.
      -
      virtual int GetNumChannels() const
      +
      virtual void AddPlacementOpportunity()
      +
      virtual void AddEncryptionInfo(EncryptionMethod method, const std::string &url, const std::string &key_id, const std::string &iv, const std::string &key_format, const std::string &key_format_versions)
      +
      virtual bool GetDisplayResolution(uint32_t *width, uint32_t *height) const
      +
      virtual bool WriteToFile(const std::string &file_path)
      +
      void SetCodecForTesting(const std::string &codec)
      For testing only.
      +
      virtual int GetNumChannels() const
      HlsPlaylistType playlist_type
      HLS playlist type. See HLS specification for details.
      Definition: hls_params.h:25
      diff --git a/docs/d5/dfa/classshaka_1_1media_1_1HlsNotifyMuxerListener.html b/docs/d5/dfa/classshaka_1_1media_1_1HlsNotifyMuxerListener.html index 3e8830f88c..f14e263d84 100644 --- a/docs/d5/dfa/classshaka_1_1media_1_1HlsNotifyMuxerListener.html +++ b/docs/d5/dfa/classshaka_1_1media_1_1HlsNotifyMuxerListener.html @@ -595,7 +595,7 @@ Additional Inherited Members
      diff --git a/docs/d5/dfa/classshaka_1_1media_1_1MediaParser-members.html b/docs/d5/dfa/classshaka_1_1media_1_1MediaParser-members.html index 712c3978bb..23949a93c5 100644 --- a/docs/d5/dfa/classshaka_1_1media_1_1MediaParser-members.html +++ b/docs/d5/dfa/classshaka_1_1media_1_1MediaParser-members.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/d5/dfc/file_8cc_source.html b/docs/d5/dfc/file_8cc_source.html index b3cf9b9418..f0f3895616 100644 --- a/docs/d5/dfc/file_8cc_source.html +++ b/docs/d5/dfc/file_8cc_source.html @@ -91,7 +91,7 @@ $(function() { diff --git a/docs/d5/dfe/classshaka_1_1File-members.html b/docs/d5/dfe/classshaka_1_1File-members.html index 4bada03732..e9cff3dbf9 100644 --- a/docs/d5/dfe/classshaka_1_1File-members.html +++ b/docs/d5/dfe/classshaka_1_1File-members.html @@ -96,7 +96,7 @@ $(function() { diff --git a/docs/d6/d02/playready__key__encryption__flags_8h_source.html b/docs/d6/d02/playready__key__encryption__flags_8h_source.html index e1a7d193a6..45a38b6cca 100644 --- a/docs/d6/d02/playready__key__encryption__flags_8h_source.html +++ b/docs/d6/d02/playready__key__encryption__flags_8h_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d6/d03/classshaka_1_1media_1_1AesCbcDecryptor-members.html b/docs/d6/d03/classshaka_1_1media_1_1AesCbcDecryptor-members.html index 62d191a1d3..bd882053e8 100644 --- a/docs/d6/d03/classshaka_1_1media_1_1AesCbcDecryptor-members.html +++ b/docs/d6/d03/classshaka_1_1media_1_1AesCbcDecryptor-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/docs/d6/d09/aes__pattern__cryptor_8h_source.html b/docs/d6/d09/aes__pattern__cryptor_8h_source.html index d0dd13ae50..befb7bbad0 100644 --- a/docs/d6/d09/aes__pattern__cryptor_8h_source.html +++ b/docs/d6/d09/aes__pattern__cryptor_8h_source.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d6/d0f/raw__key__pssh__generator_8cc_source.html b/docs/d6/d0f/raw__key__pssh__generator_8cc_source.html index f6ca2af0c4..4db9e5c686 100644 --- a/docs/d6/d0f/raw__key__pssh__generator_8cc_source.html +++ b/docs/d6/d0f/raw__key__pssh__generator_8cc_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/d6/d16/text__stream__info_8cc_source.html b/docs/d6/d16/text__stream__info_8cc_source.html index 39cf963f17..7135dc5237 100644 --- a/docs/d6/d16/text__stream__info_8cc_source.html +++ b/docs/d6/d16/text__stream__info_8cc_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d6/d17/es__parser__h264_8cc_source.html b/docs/d6/d17/es__parser__h264_8cc_source.html index e9a88ac820..03c6648d52 100644 --- a/docs/d6/d17/es__parser__h264_8cc_source.html +++ b/docs/d6/d17/es__parser__h264_8cc_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/d6/d1a/structshaka_1_1media_1_1mp4_1_1MovieHeader.html b/docs/d6/d1a/structshaka_1_1media_1_1mp4_1_1MovieHeader.html index feba36b2f3..f03b99fc62 100644 --- a/docs/d6/d1a/structshaka_1_1media_1_1mp4_1_1MovieHeader.html +++ b/docs/d6/d1a/structshaka_1_1media_1_1mp4_1_1MovieHeader.html @@ -103,32 +103,32 @@ Public Member Functions

      Public Attributes

      -uint64_t creation_time +uint64_t creation_time = 0   -uint64_t modification_time +uint64_t modification_time = 0   -uint32_t timescale +uint32_t timescale = 0   -uint64_t duration +uint64_t duration = 0   -int32_t rate +int32_t rate = 1 << 16   -int16_t volume +int16_t volume = 1 << 8   -uint32_t next_track_id +uint32_t next_track_id = 0   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

      Implements shaka::media::mp4::Box.

      -

      Definition at line 520 of file box_definitions.cc.

      +

      Definition at line 530 of file box_definitions.cc.

      @@ -178,7 +178,7 @@ Additional Inherited Members diff --git a/docs/d6/d1a/ts__packet__writer__util_8cc_source.html b/docs/d6/d1a/ts__packet__writer__util_8cc_source.html index 2286cb1ae2..c56f66a687 100644 --- a/docs/d6/d1a/ts__packet__writer__util_8cc_source.html +++ b/docs/d6/d1a/ts__packet__writer__util_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d6/d26/structshaka_1_1media_1_1VideoStreamInfoParameters.html b/docs/d6/d26/structshaka_1_1media_1_1VideoStreamInfoParameters.html index c75a2000fe..f534d3a469 100644 --- a/docs/d6/d26/structshaka_1_1media_1_1VideoStreamInfoParameters.html +++ b/docs/d6/d26/structshaka_1_1media_1_1VideoStreamInfoParameters.html @@ -122,7 +122,7 @@ bool  diff --git a/docs/d6/dc1/classshaka_1_1media_1_1WebVttSegmentedOutputHandler.html b/docs/d6/d2a/classshaka_1_1media_1_1WebVttTextOutputHandler.html similarity index 83% rename from docs/d6/dc1/classshaka_1_1media_1_1WebVttSegmentedOutputHandler.html rename to docs/d6/d2a/classshaka_1_1media_1_1WebVttTextOutputHandler.html index 9d2cbc6777..1af1435319 100644 --- a/docs/d6/dc1/classshaka_1_1media_1_1WebVttSegmentedOutputHandler.html +++ b/docs/d6/d2a/classshaka_1_1media_1_1WebVttTextOutputHandler.html @@ -5,7 +5,7 @@ -Shaka Packager SDK: shaka::media::WebVttSegmentedOutputHandler Class Reference +Shaka Packager SDK: shaka::media::WebVttTextOutputHandler Class Reference @@ -58,33 +58,32 @@ $(function() {
      -
      shaka::media::WebVttSegmentedOutputHandler Class Reference
      +
      shaka::media::WebVttTextOutputHandler Class Reference
      -Inheritance diagram for shaka::media::WebVttSegmentedOutputHandler:
      +Inheritance diagram for shaka::media::WebVttTextOutputHandler:
      - - -shaka::media::WebVttOutputHandler -shaka::media::MediaHandler + + +shaka::media::MediaHandler

      @@ -167,7 +167,7 @@ Additional Inherited Members

      is_encrypted
      - - + + @@ -103,13 +102,6 @@ bool  - - - - - @@ -164,15 +156,15 @@ const std::map< size_t, std::pair< std::shared_ptr<

      Detailed Description

      -

      Definition at line 61 of file webvtt_output_handler.h.

      +

      Definition at line 22 of file webvtt_text_output_handler.h.


      The documentation for this class was generated from the following files: diff --git a/docs/d6/d2a/classshaka_1_1media_1_1WebVttTextOutputHandler.png b/docs/d6/d2a/classshaka_1_1media_1_1WebVttTextOutputHandler.png new file mode 100644 index 0000000000..70706d4b69 Binary files /dev/null and b/docs/d6/d2a/classshaka_1_1media_1_1WebVttTextOutputHandler.png differ diff --git a/docs/d6/d2c/ts__stream__type_8h_source.html b/docs/d6/d2c/ts__stream__type_8h_source.html index f8ab2f50c4..eb23f3f6f7 100644 --- a/docs/d6/d2c/ts__stream__type_8h_source.html +++ b/docs/d6/d2c/ts__stream__type_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d6/d2e/mpd__notifier__util_8cc_source.html b/docs/d6/d2e/mpd__notifier__util_8cc_source.html index 67b20845ae..aafb4f5162 100644 --- a/docs/d6/d2e/mpd__notifier__util_8cc_source.html +++ b/docs/d6/d2e/mpd__notifier__util_8cc_source.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/d6/d32/classshaka_1_1media_1_1TextTrack-members.html b/docs/d6/d32/classshaka_1_1media_1_1TextTrack-members.html index 849c1a5c7c..6c2ea5ba14 100644 --- a/docs/d6/d32/classshaka_1_1media_1_1TextTrack-members.html +++ b/docs/d6/d32/classshaka_1_1media_1_1TextTrack-members.html @@ -74,7 +74,7 @@ $(function() {

      Public Member Functions

      WebVttSegmentedOutputHandler (const MuxerOptions &muxer_options, std::unique_ptr< MuxerListener > muxer_listener)
       
      WebVttTextOutputHandler (const MuxerOptions &muxer_options, std::unique_ptr< MuxerListener > muxer_listener)
       
      - Public Member Functions inherited from shaka::media::MediaHandler
      Status SetHandler (size_t output_stream_index, std::shared_ptr< MediaHandler > handler)

      Additional Inherited Members

      - Protected Member Functions inherited from shaka::media::WebVttOutputHandler
      -void WriteCue (const std::string &id, uint64_t start, uint64_t end, const std::string &settings, const std::string &payload)
       
      -Status WriteSegmentToFile (const std::string &filename)
       
      - Protected Member Functions inherited from shaka::media::MediaHandler
      virtual bool ValidateOutputStreamIndex (size_t stream_index) const
      diff --git a/docs/d6/d35/webm__content__encodings_8cc_source.html b/docs/d6/d35/webm__content__encodings_8cc_source.html index a70a1b10d5..cde7e1f39f 100644 --- a/docs/d6/d35/webm__content__encodings_8cc_source.html +++ b/docs/d6/d35/webm__content__encodings_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d6/d37/combined__muxer__listener_8cc_source.html b/docs/d6/d37/combined__muxer__listener_8cc_source.html index 8f3216d636..f83fd3f43f 100644 --- a/docs/d6/d37/combined__muxer__listener_8cc_source.html +++ b/docs/d6/d37/combined__muxer__listener_8cc_source.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/d6/d3b/chunk__info__iterator_8cc_source.html b/docs/d6/d3b/chunk__info__iterator_8cc_source.html index 7b64aacb44..b7bafebd93 100644 --- a/docs/d6/d3b/chunk__info__iterator_8cc_source.html +++ b/docs/d6/d3b/chunk__info__iterator_8cc_source.html @@ -69,14 +69,14 @@ $(function() {
      1 // Copyright 2014 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #include "packager/media/formats/mp4/chunk_info_iterator.h"
      8 
      9 #include <algorithm>
      10 #include <limits>
      11 
      12 #include "packager/base/logging.h"
      13 
      14 namespace shaka {
      15 namespace media {
      16 namespace mp4 {
      17 
      19  : chunk_sample_index_(0),
      20  current_chunk_(0),
      21  chunk_info_table_(sample_to_chunk.chunk_info),
      22  iterator_(chunk_info_table_.begin()) {
      23  if (iterator_ != chunk_info_table_.end())
      24  current_chunk_ = iterator_->first_chunk;
      25 }
      26 ChunkInfoIterator::~ChunkInfoIterator() {}
      27 
      29  ++current_chunk_;
      30  if (iterator_ + 1 != chunk_info_table_.end()) {
      31  if (current_chunk_ >= (iterator_ + 1)->first_chunk)
      32  ++iterator_;
      33  }
      34  chunk_sample_index_ = 0;
      35  return true;
      36 }
      37 
      39  ++chunk_sample_index_;
      40  if (chunk_sample_index_ >= iterator_->samples_per_chunk)
      41  AdvanceChunk();
      42  return true;
      43 }
      44 
      46  return iterator_ != chunk_info_table_.end() &&
      47  chunk_sample_index_ < iterator_->samples_per_chunk;
      48 }
      49 
      50 uint32_t ChunkInfoIterator::NumSamples(uint32_t start_chunk,
      51  uint32_t end_chunk) const {
      52  DCHECK_LE(start_chunk, end_chunk);
      53 
      54  uint32_t last_chunk = 0;
      55  uint32_t num_samples = 0;
      56  for (std::vector<ChunkInfo>::const_iterator it = chunk_info_table_.begin();
      57  it != chunk_info_table_.end();
      58  ++it) {
      59  last_chunk = (it + 1 == chunk_info_table_.end())
      60  ? std::numeric_limits<uint32_t>::max()
      61  : (it + 1)->first_chunk - 1;
      62  if (last_chunk >= start_chunk) {
      63  num_samples += (std::min(end_chunk, last_chunk) -
      64  std::max(start_chunk, it->first_chunk) + 1) *
      65  it->samples_per_chunk;
      66  if (last_chunk >= end_chunk)
      67  break;
      68  }
      69  }
      70  return num_samples;
      71 }
      72 
      73 } // namespace mp4
      74 } // namespace media
      75 } // namespace shaka
      All the methods that are virtual are virtual for mocking.
      - +
      uint32_t NumSamples(uint32_t start_chunk, uint32_t end_chunk) const
      ChunkInfoIterator(const SampleToChunk &sample_to_chunk)
      Create ChunkInfoIterator from sample to chunk box.
      diff --git a/docs/d6/d3e/pssh__generator__util_8h_source.html b/docs/d6/d3e/pssh__generator__util_8h_source.html index b4f04efe3d..f82a164720 100644 --- a/docs/d6/d3e/pssh__generator__util_8h_source.html +++ b/docs/d6/d3e/pssh__generator__util_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d6/d3f/classshaka_1_1media_1_1WebVttOutputHandler.html b/docs/d6/d3f/classshaka_1_1media_1_1WebVttOutputHandler.html deleted file mode 100644 index 9155f96f72..0000000000 --- a/docs/d6/d3f/classshaka_1_1media_1_1WebVttOutputHandler.html +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - -Shaka Packager SDK: shaka::media::WebVttOutputHandler Class Reference - - - - - - - - - -
      -
      - - - - - - -
      -
      Shaka Packager SDK -
      -
      -
      - - - - - - - - -
      -
      - - -
      - -
      - - -
      -
      - -
      -
      shaka::media::WebVttOutputHandler Class Referenceabstract
      -
      -
      -
      -Inheritance diagram for shaka::media::WebVttOutputHandler:
      -
      -
      - - -shaka::media::MediaHandler -shaka::media::WebVttSegmentedOutputHandler - -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

      -Protected Member Functions

      -virtual Status OnStreamInfo (const StreamInfo &info)=0
       
      -virtual Status OnSegmentInfo (const SegmentInfo &info)=0
       
      -virtual Status OnCueEvent (const CueEvent &event)=0
       
      -virtual Status OnTextSample (const TextSample &sample)=0
       
      -virtual Status OnStreamEnd ()=0
       
      -void WriteCue (const std::string &id, uint64_t start, uint64_t end, const std::string &settings, const std::string &payload)
       
      -Status WriteSegmentToFile (const std::string &filename)
       
      - Protected Member Functions inherited from shaka::media::MediaHandler
      -virtual bool ValidateOutputStreamIndex (size_t stream_index) const
       Validate if the stream at the specified index actually exists.
       
      Status Dispatch (std::unique_ptr< StreamData > stream_data) const
       
      -Status DispatchStreamInfo (size_t stream_index, std::shared_ptr< const StreamInfo > stream_info) const
       Dispatch the stream info to downstream handlers.
       
      -Status DispatchMediaSample (size_t stream_index, std::shared_ptr< const MediaSample > media_sample) const
       Dispatch the media sample to downstream handlers.
       
      -Status DispatchTextSample (size_t stream_index, std::shared_ptr< const TextSample > text_sample) const
       Dispatch the text sample to downstream handlers.
       
      -Status DispatchSegmentInfo (size_t stream_index, std::shared_ptr< const SegmentInfo > segment_info) const
       Dispatch the segment info to downstream handlers.
       
      -Status DispatchScte35Event (size_t stream_index, std::shared_ptr< const Scte35Event > scte35_event) const
       Dispatch the scte35 event to downstream handlers.
       
      -Status DispatchCueEvent (size_t stream_index, std::shared_ptr< const CueEvent > cue_event) const
       Dispatch the cue event to downstream handlers.
       
      -Status FlushDownstream (size_t output_stream_index)
       Flush the downstream connected at the specified output stream index.
       
      -Status FlushAllDownstreams ()
       Flush all connected downstream handlers.
       
      -bool initialized ()
       
      -size_t num_input_streams () const
       
      -size_t next_output_stream_index () const
       
      -const std::map< size_t, std::pair< std::shared_ptr< MediaHandler >, size_t > > & output_handlers ()
       
      - - - - - - - - - - - - - -

      -Additional Inherited Members

      - Public Member Functions inherited from shaka::media::MediaHandler
      -Status SetHandler (size_t output_stream_index, std::shared_ptr< MediaHandler > handler)
       Connect downstream handler at the specified output stream index.
       
      -Status AddHandler (std::shared_ptr< MediaHandler > handler)
       Connect downstream handler to the next available output stream index.
       
      Status Initialize ()
       
      -bool IsConnected ()
       Validate if the handler is connected to its upstream handler.
       
      -

      Detailed Description

      -
      -

      Definition at line 24 of file webvtt_output_handler.h.

      -

      The documentation for this class was generated from the following files: -
      - - - - diff --git a/docs/d6/d3f/classshaka_1_1media_1_1WebVttOutputHandler.png b/docs/d6/d3f/classshaka_1_1media_1_1WebVttOutputHandler.png deleted file mode 100644 index 90dc0dbf0e..0000000000 Binary files a/docs/d6/d3f/classshaka_1_1media_1_1WebVttOutputHandler.png and /dev/null differ diff --git a/docs/d6/d46/structshaka_1_1media_1_1CueEventInfo.html b/docs/d6/d46/structshaka_1_1media_1_1CueEventInfo.html index ac8992c680..001113b230 100644 --- a/docs/d6/d46/structshaka_1_1media_1_1CueEventInfo.html +++ b/docs/d6/d46/structshaka_1_1media_1_1CueEventInfo.html @@ -85,7 +85,7 @@ uint64_t timestamp diff --git a/docs/d6/d47/hls__params_8h_source.html b/docs/d6/d47/hls__params_8h_source.html index ee52d338a6..7a231db426 100644 --- a/docs/d6/d47/hls__params_8h_source.html +++ b/docs/d6/d47/hls__params_8h_source.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/d6/d48/classshaka_1_1media_1_1PackedAudioWriter.html b/docs/d6/d48/classshaka_1_1media_1_1PackedAudioWriter.html index 3b575f0344..27f2083a8e 100644 --- a/docs/d6/d48/classshaka_1_1media_1_1PackedAudioWriter.html +++ b/docs/d6/d48/classshaka_1_1media_1_1PackedAudioWriter.html @@ -212,7 +212,7 @@ const std::map< size_t, std::pair< std::shared_ptr< diff --git a/docs/d6/d4c/classshaka_1_1media_1_1EncryptionHandler.html b/docs/d6/d4c/classshaka_1_1media_1_1EncryptionHandler.html index bb8ff4aff0..ca2fd300aa 100644 --- a/docs/d6/d4c/classshaka_1_1media_1_1EncryptionHandler.html +++ b/docs/d6/d4c/classshaka_1_1media_1_1EncryptionHandler.html @@ -242,7 +242,7 @@ class EncryptionHandlerTes diff --git a/docs/d6/d4e/webm_2multi__segment__segmenter_8cc_source.html b/docs/d6/d4e/webm_2multi__segment__segmenter_8cc_source.html index 367c155dec..c93e55c906 100644 --- a/docs/d6/d4e/webm_2multi__segment__segmenter_8cc_source.html +++ b/docs/d6/d4e/webm_2multi__segment__segmenter_8cc_source.html @@ -70,12 +70,12 @@ $(function() {
      All the methods that are virtual are virtual for mocking.
      An implementation of IMkvWriter using our File type.
      Definition: mkv_writer.h:21
      - -
      Status FinalizeSegment(size_t stream_id, const SegmentInfo &segment_info)
      Definition: segmenter.cc:143
      + +
      Status FinalizeSegment(size_t stream_id, const SegmentInfo &segment_info)
      Definition: segmenter.cc:148
      diff --git a/docs/d6/d55/aes__cryptor_8cc_source.html b/docs/d6/d55/aes__cryptor_8cc_source.html index 8c2917efc0..49df50ef3e 100644 --- a/docs/d6/d55/aes__cryptor_8cc_source.html +++ b/docs/d6/d55/aes__cryptor_8cc_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d6/d56/webvtt__output__handler_8h_source.html b/docs/d6/d56/webvtt__output__handler_8h_source.html deleted file mode 100644 index 849affe72c..0000000000 --- a/docs/d6/d56/webvtt__output__handler_8h_source.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - -Shaka Packager SDK: packager/media/formats/webvtt/webvtt_output_handler.h Source File - - - - - - - - - -
      -
      - - - - - - -
      -
      Shaka Packager SDK -
      -
      -
      - - - - - - - - -
      -
      - - -
      - -
      - - -
      -
      -
      -
      webvtt_output_handler.h
      -
      -
      -
      1 // Copyright 2017 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #ifndef PACKAGER_MEDIA_FORMATS_WEBVTT_WEBVTT_TEXT_HANDLER_H_
      8 #define PACKAGER_MEDIA_FORMATS_WEBVTT_WEBVTT_TEXT_HANDLER_H_
      9 
      10 #include <stdint.h>
      11 
      12 #include <vector>
      13 
      14 #include "packager/media/base/media_handler.h"
      15 #include "packager/media/base/muxer_options.h"
      16 #include "packager/media/event/muxer_listener.h"
      17 
      18 namespace shaka {
      19 namespace media {
      20 
      21 // WebVttOutputHandler is the base class for all WebVtt text output handlers.
      22 // It handles taking in the samples and writing the text out, but relies on
      23 // sub classes to handle the logic of when and where to write the information.
      25  public:
      26  WebVttOutputHandler() = default;
      27  virtual ~WebVttOutputHandler() = default;
      28 
      29  protected:
      30  virtual Status OnStreamInfo(const StreamInfo& info) = 0;
      31  virtual Status OnSegmentInfo(const SegmentInfo& info) = 0;
      32  virtual Status OnCueEvent(const CueEvent& event) = 0;
      33  virtual Status OnTextSample(const TextSample& sample) = 0;
      34  virtual Status OnStreamEnd() = 0;
      35 
      36  // Top level functions for output. These functions should be used by
      37  // subclasses to write to files.
      38  void WriteCue(const std::string& id,
      39  uint64_t start,
      40  uint64_t end,
      41  const std::string& settings,
      42  const std::string& payload);
      43  // Writes the current state of the current segment to disk. This will
      44  // reset the internal state and set it up for the next segment.
      45  Status WriteSegmentToFile(const std::string& filename);
      46 
      47  private:
      49  WebVttOutputHandler& operator=(const WebVttOutputHandler&) = delete;
      50 
      51  Status InitializeInternal() override;
      52  Status Process(std::unique_ptr<StreamData> stream_data) override;
      53  Status OnFlushRequest(size_t input_stream_index) override;
      54 
      55  // A buffer of characters waiting to be written to a file.
      56  std::string buffer_;
      57 };
      58 
      59 // This WebVttt output handler should only be used when the source WebVTT
      60 // content needs to be segmented across multiple files.
      62  public:
      63  WebVttSegmentedOutputHandler(const MuxerOptions& muxer_options,
      64  std::unique_ptr<MuxerListener> muxer_listener);
      65 
      66  private:
      67  Status OnStreamInfo(const StreamInfo& info) override;
      68  Status OnSegmentInfo(const SegmentInfo& info) override;
      69  Status OnCueEvent(const CueEvent& event) override;
      70  Status OnTextSample(const TextSample& sample) override;
      71  Status OnStreamEnd() override;
      72 
      73  Status OnSegmentEnded();
      74 
      75  void GoToNextSegment(uint64_t start_time_ms);
      76 
      77  const MuxerOptions muxer_options_;
      78  std::unique_ptr<MuxerListener> muxer_listener_;
      79 
      80  // Sum together all segment durations so we know how long the stream is.
      81  uint64_t total_duration_ms_ = 0;
      82  uint32_t segment_index_ = 0;
      83 };
      84 
      85 } // namespace media
      86 } // namespace shaka
      87 
      88 #endif // PACKAGER_MEDIA_FORMATS_WEBVTT_WEBVTT_TEXT_HANDLER_H_
      -
      Abstract class holds stream information.
      Definition: stream_info.h:59
      - - - -
      All the methods that are virtual are virtual for mocking.
      -
      This structure contains the list of configuration options for Muxer.
      Definition: muxer_options.h:20
      - - - -
      - - - - diff --git a/docs/d6/d57/classshaka_1_1media_1_1AVCDecoderConfigurationRecord.html b/docs/d6/d57/classshaka_1_1media_1_1AVCDecoderConfigurationRecord.html index e1ef04a59e..28c1fabefc 100644 --- a/docs/d6/d57/classshaka_1_1media_1_1AVCDecoderConfigurationRecord.html +++ b/docs/d6/d57/classshaka_1_1media_1_1AVCDecoderConfigurationRecord.html @@ -230,7 +230,7 @@ void  diff --git a/docs/d6/d59/protection__system__specific__info_8h_source.html b/docs/d6/d59/protection__system__specific__info_8h_source.html index 318160e50f..8aadb69f47 100644 --- a/docs/d6/d59/protection__system__specific__info_8h_source.html +++ b/docs/d6/d59/protection__system__specific__info_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d6/d5b/classshaka_1_1Status-members.html b/docs/d6/d5b/classshaka_1_1Status-members.html index 2d37719d16..0cd03a9cd7 100644 --- a/docs/d6/d5b/classshaka_1_1Status-members.html +++ b/docs/d6/d5b/classshaka_1_1Status-members.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/d6/d60/classshaka_1_1media_1_1VPCodecConfigurationRecord-members.html b/docs/d6/d60/classshaka_1_1media_1_1VPCodecConfigurationRecord-members.html index 8533fa34a6..62959e3081 100644 --- a/docs/d6/d60/classshaka_1_1media_1_1VPCodecConfigurationRecord-members.html +++ b/docs/d6/d60/classshaka_1_1media_1_1VPCodecConfigurationRecord-members.html @@ -120,7 +120,7 @@ $(function() { diff --git a/docs/d6/d62/structshaka_1_1TestParams.html b/docs/d6/d62/structshaka_1_1TestParams.html index 4b565e5108..44303b819b 100644 --- a/docs/d6/d62/structshaka_1_1TestParams.html +++ b/docs/d6/d62/structshaka_1_1TestParams.html @@ -131,7 +131,7 @@ bool  diff --git a/docs/d6/d66/structshaka_1_1RawKeyParams_1_1KeyInfo-members.html b/docs/d6/d66/structshaka_1_1RawKeyParams_1_1KeyInfo-members.html index 7c97b8ac1f..7370c21c00 100644 --- a/docs/d6/d66/structshaka_1_1RawKeyParams_1_1KeyInfo-members.html +++ b/docs/d6/d66/structshaka_1_1RawKeyParams_1_1KeyInfo-members.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d6/d6b/classshaka_1_1media_1_1RawKeySource-members.html b/docs/d6/d6b/classshaka_1_1media_1_1RawKeySource-members.html index 3183a0b0ab..5ded0b9dfd 100644 --- a/docs/d6/d6b/classshaka_1_1media_1_1RawKeySource-members.html +++ b/docs/d6/d6b/classshaka_1_1media_1_1RawKeySource-members.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/d6/d6c/h26x__bit__reader_8cc_source.html b/docs/d6/d6c/h26x__bit__reader_8cc_source.html index 3469f1cebb..d1d2a40f5c 100644 --- a/docs/d6/d6c/h26x__bit__reader_8cc_source.html +++ b/docs/d6/d6c/h26x__bit__reader_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d6/d6e/ts__section__pes_8cc_source.html b/docs/d6/d6e/ts__section__pes_8cc_source.html index 074247ed8f..7fd3bf9347 100644 --- a/docs/d6/d6e/ts__section__pes_8cc_source.html +++ b/docs/d6/d6e/ts__section__pes_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d6/d71/scoped__xml__ptr_8h_source.html b/docs/d6/d71/scoped__xml__ptr_8h_source.html index 56dff1303e..b3361b26b9 100644 --- a/docs/d6/d71/scoped__xml__ptr_8h_source.html +++ b/docs/d6/d71/scoped__xml__ptr_8h_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d6/d74/classshaka_1_1UdpOptions-members.html b/docs/d6/d74/classshaka_1_1UdpOptions-members.html index 7e45233f2e..c0131fff29 100644 --- a/docs/d6/d74/classshaka_1_1UdpOptions-members.html +++ b/docs/d6/d74/classshaka_1_1UdpOptions-members.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/d6/d79/structshaka_1_1media_1_1mp4_1_1VTTAdditionalTextBox.html b/docs/d6/d79/structshaka_1_1media_1_1mp4_1_1VTTAdditionalTextBox.html index b2c1e00e67..a75c7f46fc 100644 --- a/docs/d6/d79/structshaka_1_1media_1_1mp4_1_1VTTAdditionalTextBox.html +++ b/docs/d6/d79/structshaka_1_1media_1_1mp4_1_1VTTAdditionalTextBox.html @@ -112,7 +112,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 816 of file box_definitions.h.

      +

      Definition at line 830 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -140,7 +140,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 2690 of file box_definitions.cc.

      +

      Definition at line 2762 of file box_definitions.cc.

      @@ -151,7 +151,7 @@ Additional Inherited Members diff --git a/docs/d6/d7b/webm__tracks__parser_8h_source.html b/docs/d6/d7b/webm__tracks__parser_8h_source.html index 5317ee56e9..01a7db2fa6 100644 --- a/docs/d6/d7b/webm__tracks__parser_8h_source.html +++ b/docs/d6/d7b/webm__tracks__parser_8h_source.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d6/d7c/structshaka_1_1media_1_1mp4_1_1AC3Specific-members.html b/docs/d6/d7c/structshaka_1_1media_1_1mp4_1_1AC3Specific-members.html index 1730d07934..64473fc631 100644 --- a/docs/d6/d7c/structshaka_1_1media_1_1mp4_1_1AC3Specific-members.html +++ b/docs/d6/d7c/structshaka_1_1media_1_1mp4_1_1AC3Specific-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/d6/d86/bandwidth__estimator_8cc_source.html b/docs/d6/d86/bandwidth__estimator_8cc_source.html index 0755684282..1abfe87257 100644 --- a/docs/d6/d86/bandwidth__estimator_8cc_source.html +++ b/docs/d6/d86/bandwidth__estimator_8cc_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d6/d8a/classshaka_1_1media_1_1FakeMediaHandler-members.html b/docs/d6/d8a/classshaka_1_1media_1_1FakeMediaHandler-members.html index 37a43d30f7..e65b32df7b 100644 --- a/docs/d6/d8a/classshaka_1_1media_1_1FakeMediaHandler-members.html +++ b/docs/d6/d8a/classshaka_1_1media_1_1FakeMediaHandler-members.html @@ -98,7 +98,7 @@ $(function() { diff --git a/docs/d6/d8a/vp9__parser_8cc_source.html b/docs/d6/d8a/vp9__parser_8cc_source.html index 2a4927a738..cb732875d6 100644 --- a/docs/d6/d8a/vp9__parser_8cc_source.html +++ b/docs/d6/d8a/vp9__parser_8cc_source.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/d6/d8f/classshaka_1_1xml_1_1RepresentationBaseXmlNode-members.html b/docs/d6/d8f/classshaka_1_1xml_1_1RepresentationBaseXmlNode-members.html index 6a9b41eb31..c45176729e 100644 --- a/docs/d6/d8f/classshaka_1_1xml_1_1RepresentationBaseXmlNode-members.html +++ b/docs/d6/d8f/classshaka_1_1xml_1_1RepresentationBaseXmlNode-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/d6/d9b/h264__parser_8h_source.html b/docs/d6/d9b/h264__parser_8h_source.html index 586b0bad3b..11f3a62356 100644 --- a/docs/d6/d9b/h264__parser_8h_source.html +++ b/docs/d6/d9b/h264__parser_8h_source.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/d6/d9f/hls__flags_8cc_source.html b/docs/d6/d9f/hls__flags_8cc_source.html index 58ee8ea1e9..61fc16f03f 100644 --- a/docs/d6/d9f/hls__flags_8cc_source.html +++ b/docs/d6/d9f/hls__flags_8cc_source.html @@ -69,7 +69,7 @@ $(function() {
      1 // Copyright 2016 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #include "packager/app/hls_flags.h"
      8 
      9 DEFINE_string(hls_master_playlist_output,
      10  "",
      11  "Output path for the master playlist for HLS. This flag must be"
      12  "used to output HLS.");
      13 DEFINE_string(hls_base_url,
      14  "",
      15  "The base URL for the Media Playlists and media files listed in "
      16  "the playlists. This is the prefix for the files.");
      17 DEFINE_string(hls_key_uri,
      18  "",
      19  "The key uri for 'identity' and 'com.apple.streamingkeydelivery' "
      20  "key formats. Ignored if the playlist is not encrypted or not "
      21  "using the above key formats.");
      22 DEFINE_string(hls_playlist_type,
      23  "VOD",
      24  "VOD, EVENT, or LIVE. This defines the EXT-X-PLAYLIST-TYPE in "
      25  "the HLS specification. For hls_playlist_type of LIVE, "
      26  "EXT-X-PLAYLIST-TYPE tag is omitted.");
      diff --git a/docs/d6/d9f/webvtt__to__mp4__handler_8cc_source.html b/docs/d6/d9f/webvtt__to__mp4__handler_8cc_source.html index 10b9d41798..a9cdbf1fa2 100644 --- a/docs/d6/d9f/webvtt__to__mp4__handler_8cc_source.html +++ b/docs/d6/d9f/webvtt__to__mp4__handler_8cc_source.html @@ -66,20 +66,12 @@ $(function() {
      webvtt_to_mp4_handler.cc
      -
      1 // Copyright 2017 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #include "packager/media/formats/webvtt/webvtt_to_mp4_handler.h"
      8 
      9 #include <algorithm>
      10 
      11 #include "packager/media/base/buffer_writer.h"
      12 #include "packager/media/formats/mp4/box_buffer.h"
      13 #include "packager/media/formats/mp4/box_definitions.h"
      14 
      15 namespace shaka {
      16 namespace media {
      17 
      18 class DisplayAction {
      19  public:
      20  DisplayAction(uint64_t id, int64_t time) : id_(id), time_(time) {}
      21  virtual ~DisplayAction() = default;
      22 
      23  uint64_t id() const { return id_; }
      24  int64_t time() const { return time_; }
      25  virtual void ActOn(std::list<const TextSample*>* display) const = 0;
      26 
      27  private:
      28  uint64_t id_;
      29  int64_t time_;
      30 };
      31 
      32 namespace {
      33 const uint64_t kTrackId = 0;
      34 
      35 class AddToDisplayAction : public DisplayAction {
      36  public:
      37  explicit AddToDisplayAction(uint64_t id,
      38  std::shared_ptr<const TextSample>& sample)
      39  : DisplayAction(id, sample->start_time()), sample_(sample) {}
      40  void ActOn(std::list<const TextSample*>* display) const override {
      41  display->push_back(sample_.get());
      42  }
      43 
      44  private:
      45  std::shared_ptr<const TextSample> sample_;
      46 };
      47 
      48 class RemoveFromDisplayAction : public DisplayAction {
      49  public:
      50  explicit RemoveFromDisplayAction(uint64_t id,
      51  std::shared_ptr<const TextSample>& sample)
      52  : DisplayAction(id, sample->EndTime()), sample_(sample) {}
      53  void ActOn(std::list<const TextSample*>* display) const override {
      54  display->remove(sample_.get());
      55  }
      56 
      57  private:
      58  std::shared_ptr<const TextSample> sample_;
      59 };
      60 } // namespace
      61 
      62 bool DisplayActionCompare::operator()(
      63  const std::shared_ptr<DisplayAction>& left,
      64  const std::shared_ptr<DisplayAction>& right) const {
      65  return left->time() == right->time() ? left->id() > right->id()
      66  : left->time() > right->time();
      67 }
      68 
      69 Status WebVttToMp4Handler::InitializeInternal() {
      70  return Status::OK;
      71 }
      72 
      73 Status WebVttToMp4Handler::Process(std::unique_ptr<StreamData> stream_data) {
      74  if (StreamDataType::kStreamInfo == stream_data->stream_data_type) {
      75  return DispatchStreamInfo(kTrackId, std::move(stream_data->stream_info));
      76  }
      77  if (stream_data->stream_data_type == StreamDataType::kTextSample) {
      78  std::shared_ptr<const TextSample> sample = stream_data->text_sample;
      79 
      80  std::shared_ptr<DisplayAction> add(
      81  new AddToDisplayAction(NextActionId(), sample));
      82  std::shared_ptr<DisplayAction> remove(
      83  new RemoveFromDisplayAction(NextActionId(), sample));
      84 
      85  actions_.push(add);
      86  actions_.push(remove);
      87 
      88  return ProcessUpToTime(add->time());
      89  }
      90  return Status(error::INTERNAL_ERROR,
      91  "Invalid stream data type for this handler");
      92 }
      93 
      94 Status WebVttToMp4Handler::OnFlushRequest(size_t input_stream_index) {
      95  const int64_t kEndOfTime = std::numeric_limits<int64_t>::max();
      96  ProcessUpToTime(kEndOfTime);
      97 
      98  return FlushDownstream(0);
      99 }
      100 
      101 void WebVttToMp4Handler::WriteCue(const std::string& id,
      102  const std::string& settings,
      103  const std::string& payload,
      104  BufferWriter* out) {
      105  mp4::VTTCueBox box;
      106 
      107  if (id.length()) {
      108  box.cue_id.cue_id = id;
      109  }
      110  if (settings.length()) {
      111  box.cue_settings.settings = settings;
      112  }
      113  if (payload.length()) {
      114  box.cue_payload.cue_text = payload;
      115  }
      116  // If there is internal timing, i.e. WebVTT cue timestamp, then
      117  // cue_current_time should be populated
      118  // "which gives the VTT timestamp associated with the start time of sample."
      119  // TODO(rkuroiwa): Reuse TimestampToMilliseconds() to check if there is an
      120  // internal timestamp in the payload to set CueTimeBox.cue_current_time.
      121  box.Write(out);
      122 }
      123 
      124 Status WebVttToMp4Handler::ProcessUpToTime(int64_t cutoff_time) {
      125  // We can only process as far as the last add as no new events will be
      126  // added that come before that time.
      127  while (actions_.size() && actions_.top()->time() < cutoff_time) {
      128  // STAGE 1: Write out the current state
      129  // Get the time range for which the current active state is valid.
      130  const int64_t previous_change = next_change_;
      131  next_change_ = actions_.top()->time();
      132 
      133  if (next_change_ > previous_change) {
      134  // Send out the active group. If there is nothing in the active group,
      135  // then an empty cue is sent.
      136  Status status =
      137  active_.size()
      138  ? MergeAndSendSamples(active_, previous_change, next_change_)
      139  : SendEmptySample(previous_change, next_change_);
      140 
      141  if (!status.ok()) {
      142  return status;
      143  }
      144  } else {
      145  // The only time that |previous_change| and |next_change_| should ever
      146  // break the rule |next_change_ > previous_change| is at the start where
      147  // |previous_change| and |next_change_| are both zero.
      148  DCHECK_EQ(previous_change, 0u);
      149  DCHECK_EQ(next_change_, 0u);
      150  }
      151 
      152  // STAGE 2: Move to the next state.
      153  while (actions_.size() && actions_.top()->time() == next_change_) {
      154  actions_.top()->ActOn(&active_);
      155  actions_.pop();
      156  }
      157  }
      158 
      159  return Status::OK;
      160 }
      161 
      162 Status WebVttToMp4Handler::MergeAndSendSamples(
      163  const std::list<const TextSample*>& samples,
      164  int64_t start_time,
      165  int64_t end_time) {
      166  DCHECK_GT(end_time, start_time);
      167 
      168  box_writer_.Clear();
      169 
      170  for (const TextSample* sample : samples) {
      171  DCHECK_LE(sample->start_time(), start_time);
      172  DCHECK_GE(sample->EndTime(), end_time);
      173  WriteCue(sample->id(), sample->settings(), sample->payload(), &box_writer_);
      174  }
      175 
      176  std::shared_ptr<MediaSample> sample =
      177  MediaSample::CopyFrom(box_writer_.Buffer(), box_writer_.Size(), true);
      178  sample->set_pts(start_time);
      179  sample->set_dts(start_time);
      180  sample->set_duration(end_time - start_time);
      181  return DispatchMediaSample(kTrackId, std::move(sample));
      182 }
      183 
      184 Status WebVttToMp4Handler::SendEmptySample(int64_t start_time,
      185  int64_t end_time) {
      186  DCHECK_GT(end_time, start_time);
      187 
      188  box_writer_.Clear();
      189 
      191  box.Write(&box_writer_);
      192 
      193  std::shared_ptr<MediaSample> sample =
      194  MediaSample::CopyFrom(box_writer_.Buffer(), box_writer_.Size(), true);
      195  sample->set_pts(start_time);
      196  sample->set_dts(start_time);
      197  sample->set_duration(end_time - start_time);
      198  return DispatchMediaSample(kTrackId, std::move(sample));
      199 }
      200 
      201 uint64_t WebVttToMp4Handler::NextActionId() {
      202  return next_id_++;
      203 }
      204 } // namespace media
      205 } // namespace shaka
      Status OnFlushRequest(size_t input_stream_index) override
      Event handler for flush request at the specific input stream index.
      -
      All the methods that are virtual are virtual for mocking.
      - - - -
      Status Process(std::unique_ptr< StreamData > stream_data) override
      +
      1 // Copyright 2017 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #include "packager/media/formats/webvtt/webvtt_to_mp4_handler.h"
      8 
      9 #include <algorithm>
      10 #include <map>
      11 
      12 #include "packager/media/base/buffer_writer.h"
      13 #include "packager/media/formats/mp4/box_buffer.h"
      14 #include "packager/media/formats/mp4/box_definitions.h"
      15 #include "packager/status_macros.h"
      16 
      17 namespace shaka {
      18 namespace media {
      19 namespace {
      20 size_t kTrackId = 0;
      21 
      22 enum class DisplayActionType { ADD, REMOVE };
      23 
      24 struct DisplayAction {
      25  DisplayActionType type;
      26  const TextSample* sample;
      27 };
      28 
      29 std::multimap<int64_t, DisplayAction> CreateActionList(
      30  int64_t segment_start,
      31  int64_t segment_end,
      32  const std::list<std::shared_ptr<const TextSample>>& samples) {
      33  std::multimap<int64_t, DisplayAction> actions;
      34 
      35  for (const auto& sample : samples) {
      36  DCHECK(sample);
      37 
      38  // The add action should occur either in this segment or in a previous
      39  // segment.
      40  DCHECK_LT(sample->start_time(), segment_end);
      41  actions.insert(
      42  {sample->start_time(), {DisplayActionType::ADD, sample.get()}});
      43 
      44  // If the remove happens in a later segment, then we don't want to include
      45  // that action.
      46  if (sample->EndTime() < segment_end) {
      47  actions.insert(
      48  {sample->EndTime(), {DisplayActionType::REMOVE, sample.get()}});
      49  }
      50  }
      51 
      52  return actions;
      53 }
      54 
      55 void WriteSample(const TextSample& sample, BufferWriter* out) {
      56  mp4::VTTCueBox box;
      57 
      58  if (sample.id().length()) {
      59  box.cue_id.cue_id = sample.id();
      60  }
      61  if (sample.settings().length()) {
      62  box.cue_settings.settings = sample.settings();
      63  }
      64  if (sample.payload().length()) {
      65  box.cue_payload.cue_text = sample.payload();
      66  }
      67 
      68  // If there is internal timing, i.e. WebVTT cue timestamp, then
      69  // cue_current_time should be populated
      70  // "which gives the VTT timestamp associated with the start time of sample."
      71  // TODO(rkuroiwa): Reuse TimestampToMilliseconds() to check if there is an
      72  // internal timestamp in the payload to set CueTimeBox.cue_current_time.
      73  box.Write(out);
      74 }
      75 
      76 void WriteSamples(const std::list<const TextSample*>& samples,
      77  BufferWriter* writer) {
      78  DCHECK_GE(samples.size(), 0u);
      79 
      80  for (const auto& sample : samples) {
      81  WriteSample(*sample, writer);
      82  }
      83 }
      84 
      85 void WriteEmptySample(BufferWriter* writer) {
      86  mp4::VTTEmptyCueBox box;
      87  box.Write(writer);
      88 }
      89 
      90 std::shared_ptr<MediaSample> CreateMediaSample(const BufferWriter& buffer,
      91  int64_t start_time,
      92  int64_t end_time) {
      93  DCHECK_GE(start_time, 0);
      94  DCHECK_GT(end_time, start_time);
      95 
      96  const bool kIsKeyFrame = true;
      97 
      98  std::shared_ptr<MediaSample> sample =
      99  MediaSample::CopyFrom(buffer.Buffer(), buffer.Size(), kIsKeyFrame);
      100  sample->set_pts(start_time);
      101  sample->set_dts(start_time);
      102  sample->set_duration(end_time - start_time);
      103 
      104  return sample;
      105 }
      106 } // namespace
      107 
      108 Status WebVttToMp4Handler::InitializeInternal() {
      109  return Status::OK;
      110 }
      111 
      112 Status WebVttToMp4Handler::Process(std::unique_ptr<StreamData> stream_data) {
      113  switch (stream_data->stream_data_type) {
      114  case StreamDataType::kStreamInfo:
      115  return OnStreamInfo(std::move(stream_data));
      116  case StreamDataType::kCueEvent:
      117  return OnCueEvent(std::move(stream_data));
      118  case StreamDataType::kSegmentInfo:
      119  return OnSegmentInfo(std::move(stream_data));
      120  case StreamDataType::kTextSample:
      121  return OnTextSample(std::move(stream_data));
      122  default:
      123  return Status(error::INTERNAL_ERROR,
      124  "Invalid stream data type (" +
      125  StreamDataTypeToString(stream_data->stream_data_type) +
      126  ") for this WebVttToMp4 handler");
      127  }
      128 }
      129 
      130 Status WebVttToMp4Handler::OnStreamInfo(
      131  std::unique_ptr<StreamData> stream_data) {
      132  DCHECK(stream_data);
      133  DCHECK(stream_data->stream_info);
      134 
      135  return Dispatch(std::move(stream_data));
      136 }
      137 
      138 Status WebVttToMp4Handler::OnCueEvent(std::unique_ptr<StreamData> stream_data) {
      139  DCHECK(stream_data);
      140  DCHECK(stream_data->cue_event);
      141 
      142  if (current_segment_.size()) {
      143  return Status(error::INTERNAL_ERROR,
      144  "Cue Events should come right after segment info.");
      145  }
      146 
      147  return Dispatch(std::move(stream_data));
      148 }
      149 
      150 Status WebVttToMp4Handler::OnSegmentInfo(
      151  std::unique_ptr<StreamData> stream_data) {
      152  DCHECK(stream_data);
      153  DCHECK(stream_data->segment_info);
      154 
      155  const auto& segment = stream_data->segment_info;
      156 
      157  int64_t segment_start = segment->start_timestamp;
      158  int64_t segment_duration = segment->duration;
      159  int64_t segment_end = segment_start + segment_duration;
      160 
      161  RETURN_IF_ERROR(DispatchCurrentSegment(segment_start, segment_end));
      162  current_segment_.clear();
      163 
      164  return Dispatch(std::move(stream_data));
      165 }
      166 
      167 Status WebVttToMp4Handler::OnTextSample(
      168  std::unique_ptr<StreamData> stream_data) {
      169  DCHECK(stream_data);
      170  DCHECK(stream_data->text_sample);
      171 
      172  auto& sample = stream_data->text_sample;
      173 
      174  // Ignore empty samples. This will create gaps, but we will handle that
      175  // later.
      176  if (sample->payload().empty()) {
      177  return Status::OK;
      178  }
      179 
      180  // Add the new text sample to the cache of samples that belong in the
      181  // current segment.
      182  current_segment_.push_back(std::move(stream_data->text_sample));
      183  return Status::OK;
      184 }
      185 
      186 Status WebVttToMp4Handler::DispatchCurrentSegment(int64_t segment_start,
      187  int64_t segment_end) {
      188  // Active will hold all the samples that are "on screen" for the current
      189  // section of time.
      190  std::list<const TextSample*> active;
      191 
      192  // Move through the segment, jumping between each change to the current state.
      193  // A change is defined as a group of one or more DisplayActions.
      194  int section_start = segment_start;
      195 
      196  // |actions| is a map of [time] -> [action].
      197  auto actions = CreateActionList(segment_start, segment_end, current_segment_);
      198  auto front = actions.begin();
      199 
      200  // As it is possible to have a segment with no samples, we can't base this
      201  // loop on the number of actions. So we need to keep iterating until we
      202  // have written enough sections to get to the end of the segment.
      203  while (section_start < segment_end) {
      204  // Apply all actions that occur at the start of this part of the segment.
      205  // Normally we would only want "== section_start" but as it is possible for
      206  // samples to span multiple segments, their start time will be before the
      207  // segment's start time. So we want to apply them too if they come before
      208  // the segment. Thus why we use "<=".
      209  while (front != actions.end() && front->first <= section_start) {
      210  auto& action = front->second;
      211 
      212  switch (action.type) {
      213  case DisplayActionType::ADD: {
      214  active.push_back(action.sample);
      215  break;
      216  }
      217  case DisplayActionType::REMOVE: {
      218  auto found = std::find(active.begin(), active.end(), action.sample);
      219  DCHECK(found != active.end());
      220  active.erase(found);
      221  break;
      222  }
      223  default: {
      224  NOTREACHED() << "Unsupported DisplayActionType "
      225  << static_cast<int>(action.type);
      226  break;
      227  }
      228  }
      229 
      230  // We have "consumed" the action at the front. We can move on.
      231  front++;
      232  }
      233 
      234  // The end of the section will either be the start of the next section or
      235  // the end of the segment.
      236  int64_t section_end = front == actions.end() ? segment_end : front->first;
      237  DCHECK_GT(section_end, section_start);
      238  DCHECK_LE(section_end, segment_end);
      239  RETURN_IF_ERROR(MergeDispatchSamples(section_start, section_end, active));
      240 
      241  section_start = section_end;
      242  }
      243 
      244  DCHECK(front == actions.end()) << "We should have processed all actions.";
      245 
      246  return Status::OK;
      247 }
      248 
      249 Status WebVttToMp4Handler::MergeDispatchSamples(
      250  int64_t start_time,
      251  int64_t end_time,
      252  const std::list<const TextSample*>& state) {
      253  DCHECK_GT(end_time, start_time);
      254 
      255  box_writer_.Clear();
      256 
      257  if (state.size()) {
      258  WriteSamples(state, &box_writer_);
      259  } else {
      260  WriteEmptySample(&box_writer_);
      261  }
      262 
      263  return DispatchMediaSample(
      264  kTrackId, CreateMediaSample(box_writer_, start_time, end_time));
      265 }
      266 } // namespace media
      267 } // namespace shaka
      All the methods that are virtual are virtual for mocking.
      static std::shared_ptr< MediaSample > CopyFrom(const uint8_t *data, size_t size, bool is_key_frame)
      Definition: media_sample.cc:42
      - - -
      void Write(BufferWriter *writer)
      Definition: box.cc:25
      diff --git a/docs/d6/da0/ts__section__pat_8h_source.html b/docs/d6/da0/ts__section__pat_8h_source.html index 2ce3a03048..848b0366ba 100644 --- a/docs/d6/da0/ts__section__pat_8h_source.html +++ b/docs/d6/da0/ts__section__pat_8h_source.html @@ -73,7 +73,7 @@ $(function() {
      diff --git a/docs/d6/da3/mpd__builder_8h_source.html b/docs/d6/da3/mpd__builder_8h_source.html index cd7c26dcbb..83a1f925f8 100644 --- a/docs/d6/da3/mpd__builder_8h_source.html +++ b/docs/d6/da3/mpd__builder_8h_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d6/da4/classshaka_1_1media_1_1AVCDecoderConfigurationRecord-members.html b/docs/d6/da4/classshaka_1_1media_1_1AVCDecoderConfigurationRecord-members.html index 26fe4a4d86..a901aab4ac 100644 --- a/docs/d6/da4/classshaka_1_1media_1_1AVCDecoderConfigurationRecord-members.html +++ b/docs/d6/da4/classshaka_1_1media_1_1AVCDecoderConfigurationRecord-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/docs/d6/da6/structshaka_1_1media_1_1H265SliceHeader_1_1LongTermPicsInfo-members.html b/docs/d6/da6/structshaka_1_1media_1_1H265SliceHeader_1_1LongTermPicsInfo-members.html index 012e39b4cf..db4cd8e442 100644 --- a/docs/d6/da6/structshaka_1_1media_1_1H265SliceHeader_1_1LongTermPicsInfo-members.html +++ b/docs/d6/da6/structshaka_1_1media_1_1H265SliceHeader_1_1LongTermPicsInfo-members.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d6/da9/classshaka_1_1media_1_1BitReader.html b/docs/d6/da9/classshaka_1_1media_1_1BitReader.html index 30ca6f57b6..fb7c289a32 100644 --- a/docs/d6/da9/classshaka_1_1media_1_1BitReader.html +++ b/docs/d6/da9/classshaka_1_1media_1_1BitReader.html @@ -372,7 +372,7 @@ template<typename T > diff --git a/docs/d6/daa/structshaka_1_1media_1_1mp4_1_1VTTCueBox.html b/docs/d6/daa/structshaka_1_1media_1_1mp4_1_1VTTCueBox.html index bb7ad1e58a..5f493354d1 100644 --- a/docs/d6/daa/structshaka_1_1media_1_1mp4_1_1VTTCueBox.html +++ b/docs/d6/daa/structshaka_1_1media_1_1mp4_1_1VTTCueBox.html @@ -124,7 +124,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 821 of file box_definitions.h.

      +

      Definition at line 836 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -152,7 +152,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 2708 of file box_definitions.cc.

      +

      Definition at line 2780 of file box_definitions.cc.

      @@ -163,7 +163,7 @@ Additional Inherited Members diff --git a/docs/d6/db0/widevine__pssh__generator_8cc_source.html b/docs/d6/db0/widevine__pssh__generator_8cc_source.html index 5997f9f013..45897b9558 100644 --- a/docs/d6/db0/widevine__pssh__generator_8cc_source.html +++ b/docs/d6/db0/widevine__pssh__generator_8cc_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/d6/db1/classshaka_1_1media_1_1VideoStreamInfo.html b/docs/d6/db1/classshaka_1_1media_1_1VideoStreamInfo.html index b8a9de5d8c..808a235cd5 100644 --- a/docs/d6/db1/classshaka_1_1media_1_1VideoStreamInfo.html +++ b/docs/d6/db1/classshaka_1_1media_1_1VideoStreamInfo.html @@ -483,7 +483,7 @@ void set_encryption_config diff --git a/docs/d6/db1/structshaka_1_1media_1_1VideoStreamInfoParameters-members.html b/docs/d6/db1/structshaka_1_1media_1_1VideoStreamInfoParameters-members.html index 58590209d8..9ad3879d6e 100644 --- a/docs/d6/db1/structshaka_1_1media_1_1VideoStreamInfoParameters-members.html +++ b/docs/d6/db1/structshaka_1_1media_1_1VideoStreamInfoParameters-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/docs/d6/db8/classshaka_1_1media_1_1FileReader.html b/docs/d6/db8/classshaka_1_1media_1_1FileReader.html index 34ea1475df..934cb8863f 100644 --- a/docs/d6/db8/classshaka_1_1media_1_1FileReader.html +++ b/docs/d6/db8/classshaka_1_1media_1_1FileReader.html @@ -158,7 +158,7 @@ Static Public Member Functions diff --git a/docs/d6/dbe/mp4__output__params_8h_source.html b/docs/d6/dbe/mp4__output__params_8h_source.html index 3c86d39c64..75bbd7f241 100644 --- a/docs/d6/dbe/mp4__output__params_8h_source.html +++ b/docs/d6/dbe/mp4__output__params_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d6/dc0/classshaka_1_1hls_1_1HlsEntry-members.html b/docs/d6/dc0/classshaka_1_1hls_1_1HlsEntry-members.html index d00e446f8c..77f5e82af8 100644 --- a/docs/d6/dc0/classshaka_1_1hls_1_1HlsEntry-members.html +++ b/docs/d6/dc0/classshaka_1_1hls_1_1HlsEntry-members.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d6/dc1/classshaka_1_1media_1_1WebVttSegmentedOutputHandler.png b/docs/d6/dc1/classshaka_1_1media_1_1WebVttSegmentedOutputHandler.png deleted file mode 100644 index e9f515f596..0000000000 Binary files a/docs/d6/dc1/classshaka_1_1media_1_1WebVttSegmentedOutputHandler.png and /dev/null differ diff --git a/docs/d6/dc6/structshaka_1_1media_1_1mp2t_1_1EsParserH26x_1_1VideoSliceInfo-members.html b/docs/d6/dc6/structshaka_1_1media_1_1mp2t_1_1EsParserH26x_1_1VideoSliceInfo-members.html index 947dcc73ae..1b5c0ec53f 100644 --- a/docs/d6/dc6/structshaka_1_1media_1_1mp2t_1_1EsParserH26x_1_1VideoSliceInfo-members.html +++ b/docs/d6/dc6/structshaka_1_1media_1_1mp2t_1_1EsParserH26x_1_1VideoSliceInfo-members.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/d6/dc7/classshaka_1_1media_1_1mp2t_1_1EsParserH26x-members.html b/docs/d6/dc7/classshaka_1_1media_1_1mp2t_1_1EsParserH26x-members.html index 028efb1d6a..56c174f9d8 100644 --- a/docs/d6/dc7/classshaka_1_1media_1_1mp2t_1_1EsParserH26x-members.html +++ b/docs/d6/dc7/classshaka_1_1media_1_1mp2t_1_1EsParserH26x-members.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/d6/dc8/mkv__writer_8cc_source.html b/docs/d6/dc8/mkv__writer_8cc_source.html index 8594c4ce6e..2e502df3e4 100644 --- a/docs/d6/dc8/mkv__writer_8cc_source.html +++ b/docs/d6/dc8/mkv__writer_8cc_source.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/d6/dcb/structshaka_1_1media_1_1mp4_1_1SampleEncryptionEntry.html b/docs/d6/dcb/structshaka_1_1media_1_1mp4_1_1SampleEncryptionEntry.html index d547e7a82f..6d7d813581 100644 --- a/docs/d6/dcb/structshaka_1_1media_1_1mp4_1_1SampleEncryptionEntry.html +++ b/docs/d6/dcb/structshaka_1_1media_1_1mp4_1_1SampleEncryptionEntry.html @@ -93,7 +93,7 @@ std::vector<

      Detailed Description

      -

      Definition at line 77 of file box_definitions.h.

      +

      Definition at line 78 of file box_definitions.h.

      Member Function Documentation

      ◆ ComputeSize()

      @@ -111,7 +111,7 @@ std::vector<
      Returns
      The size of the structure in bytes when it is stored.
      -

      Definition at line 285 of file box_definitions.cc.

      +

      Definition at line 290 of file box_definitions.cc.

      @@ -131,7 +131,7 @@ std::vector<
      Returns
      The accumulated size of subsamples. Returns 0 if there is no subsamples.
      -

      Definition at line 295 of file box_definitions.cc.

      +

      Definition at line 300 of file box_definitions.cc.

      @@ -176,7 +176,7 @@ std::vector<
      Returns
      true on success, false otherwise.
      -

      Definition at line 260 of file box_definitions.cc.

      +

      Definition at line 265 of file box_definitions.cc.

      @@ -221,7 +221,7 @@ std::vector<
      Returns
      true on success, false otherwise.
      -

      Definition at line 236 of file box_definitions.cc.

      +

      Definition at line 241 of file box_definitions.cc.

      @@ -232,7 +232,7 @@ std::vector< diff --git a/docs/d6/dcc/classshaka_1_1media_1_1VP9Parser-members.html b/docs/d6/dcc/classshaka_1_1media_1_1VP9Parser-members.html index 0c9c245a50..e7e576c272 100644 --- a/docs/d6/dcc/classshaka_1_1media_1_1VP9Parser-members.html +++ b/docs/d6/dcc/classshaka_1_1media_1_1VP9Parser-members.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/d6/dce/structshaka_1_1media_1_1mp4_1_1SegmentReference-members.html b/docs/d6/dce/structshaka_1_1media_1_1mp4_1_1SegmentReference-members.html index 535181bb5e..e9690bad0e 100644 --- a/docs/d6/dce/structshaka_1_1media_1_1mp4_1_1SegmentReference-members.html +++ b/docs/d6/dce/structshaka_1_1media_1_1mp4_1_1SegmentReference-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/docs/d6/dd0/structshaka_1_1media_1_1H264SEIMessage.html b/docs/d6/dd0/structshaka_1_1media_1_1H264SEIMessage.html index ea61a7792a..375616ff0a 100644 --- a/docs/d6/dd0/structshaka_1_1media_1_1H264SEIMessage.html +++ b/docs/d6/dd0/structshaka_1_1media_1_1H264SEIMessage.html @@ -103,7 +103,7 @@ union { diff --git a/docs/d6/dd7/structshaka_1_1Mp4OutputParams-members.html b/docs/d6/dd7/structshaka_1_1Mp4OutputParams-members.html index 94e6175298..024353084c 100644 --- a/docs/d6/dd7/structshaka_1_1Mp4OutputParams-members.html +++ b/docs/d6/dd7/structshaka_1_1Mp4OutputParams-members.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/da/d17/classshaka_1_1media_1_1DisplayActionCompare.html b/docs/d6/dda/classshaka_1_1media_1_1WebVttFileBuffer.html similarity index 56% rename from docs/da/d17/classshaka_1_1media_1_1DisplayActionCompare.html rename to docs/d6/dda/classshaka_1_1media_1_1WebVttFileBuffer.html index b47650b1f5..f40c730c1b 100644 --- a/docs/da/d17/classshaka_1_1media_1_1DisplayActionCompare.html +++ b/docs/d6/dda/classshaka_1_1media_1_1WebVttFileBuffer.html @@ -5,7 +5,7 @@ -Shaka Packager SDK: shaka::media::DisplayActionCompare Class Reference +Shaka Packager SDK: shaka::media::WebVttFileBuffer Class Reference @@ -58,35 +58,44 @@ $(function() {
    -
    shaka::media::DisplayActionCompare Class Reference
    +
    shaka::media::WebVttFileBuffer Class Reference
    - - + + + + + + + +

    Public Member Functions

    -bool operator() (const std::shared_ptr< DisplayAction > &left, const std::shared_ptr< DisplayAction > &right) const
     
    +void Reset ()
     
    +void Append (const TextSample &sample)
     
    +bool WriteTo (File *file)
     
    +size_t sample_count () const
     

    Detailed Description

    -

    Definition at line 23 of file webvtt_to_mp4_handler.h.

    +

    Definition at line 21 of file webvtt_file_buffer.h.


    The documentation for this class was generated from the following files:
    diff --git a/docs/d6/dde/structshaka_1_1media_1_1H265VuiParameters-members.html b/docs/d6/dde/structshaka_1_1media_1_1H265VuiParameters-members.html index 4f16c19b22..3ddddff2c3 100644 --- a/docs/d6/dde/structshaka_1_1media_1_1H265VuiParameters-members.html +++ b/docs/d6/dde/structshaka_1_1media_1_1H265VuiParameters-members.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/d6/de2/structshaka_1_1media_1_1mp4_1_1KeyFrameInfo.html b/docs/d6/de2/structshaka_1_1media_1_1mp4_1_1KeyFrameInfo.html index 6750433e86..d84842a7c7 100644 --- a/docs/d6/de2/structshaka_1_1media_1_1mp4_1_1KeyFrameInfo.html +++ b/docs/d6/de2/structshaka_1_1media_1_1mp4_1_1KeyFrameInfo.html @@ -97,7 +97,7 @@ uint64_t size diff --git a/docs/d6/de4/structshaka_1_1media_1_1mp4_1_1CueTimeBox-members.html b/docs/d6/de4/structshaka_1_1media_1_1mp4_1_1CueTimeBox-members.html index 111ba46814..80881ff6f0 100644 --- a/docs/d6/de4/structshaka_1_1media_1_1mp4_1_1CueTimeBox-members.html +++ b/docs/d6/de4/structshaka_1_1media_1_1mp4_1_1CueTimeBox-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/d6/de7/structshaka_1_1media_1_1VPxFrameInfo-members.html b/docs/d6/de7/structshaka_1_1media_1_1VPxFrameInfo-members.html index 35fafe73a6..364ab301b3 100644 --- a/docs/d6/de7/structshaka_1_1media_1_1VPxFrameInfo-members.html +++ b/docs/d6/de7/structshaka_1_1media_1_1VPxFrameInfo-members.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d6/de8/local__file_8cc_source.html b/docs/d6/de8/local__file_8cc_source.html index b11ad7a1f2..3155b236db 100644 --- a/docs/d6/de8/local__file_8cc_source.html +++ b/docs/d6/de8/local__file_8cc_source.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/d6/de8/network__util_8h_source.html b/docs/d6/de8/network__util_8h_source.html index 5b1a4adbec..beb083573b 100644 --- a/docs/d6/de8/network__util_8h_source.html +++ b/docs/d6/de8/network__util_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d6/de9/ts__segmenter_8cc_source.html b/docs/d6/de9/ts__segmenter_8cc_source.html index ae4547166d..3a5fe08baa 100644 --- a/docs/d6/de9/ts__segmenter_8cc_source.html +++ b/docs/d6/de9/ts__segmenter_8cc_source.html @@ -86,13 +86,13 @@ $(function() {
    Class to hold a media sample.
    Definition: media_sample.h:22
    Status FinalizeSegment(uint64_t start_timestamp, uint64_t duration)
    - + - + diff --git a/docs/d6/ded/ts__packet_8h_source.html b/docs/d6/ded/ts__packet_8h_source.html index f4a10652f6..a49e4dc3bd 100644 --- a/docs/d6/ded/ts__packet_8h_source.html +++ b/docs/d6/ded/ts__packet_8h_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/d6/def/sync__sample__iterator_8cc_source.html b/docs/d6/def/sync__sample__iterator_8cc_source.html index 1a0d89548a..904fb81c7c 100644 --- a/docs/d6/def/sync__sample__iterator_8cc_source.html +++ b/docs/d6/def/sync__sample__iterator_8cc_source.html @@ -66,7 +66,7 @@ $(function() {
    sync_sample_iterator.cc
    -
    1 // Copyright 2014 Google Inc. All rights reserved.
    2 //
    3 // Use of this source code is governed by a BSD-style
    4 // license that can be found in the LICENSE file or at
    5 // https://developers.google.com/open-source/licenses/bsd
    6 
    7 #include "packager/media/formats/mp4/sync_sample_iterator.h"
    8 
    9 #include <algorithm>
    10 
    11 namespace shaka {
    12 namespace media {
    13 namespace mp4 {
    14 
    16  : sample_number_(1),
    17  sync_sample_vector_(sync_sample.sample_number),
    18  iterator_(sync_sample_vector_.begin()),
    19  is_empty_(iterator_ == sync_sample_vector_.end()) {}
    20 SyncSampleIterator::~SyncSampleIterator() {}
    21 
    23  if (iterator_ != sync_sample_vector_.end() && sample_number_ == *iterator_)
    24  ++iterator_;
    25  ++sample_number_;
    26  return true;
    27 }
    28 
    30  // If the sync sample box is not present, every sample is a sync sample.
    31  if (is_empty_)
    32  return true;
    33  return iterator_ != sync_sample_vector_.end() && sample_number_ == *iterator_;
    34 }
    35 
    36 bool SyncSampleIterator::IsSyncSample(uint32_t sample) const {
    37  // If the sync sample box is not present, every sample is a sync sample.
    38  if (is_empty_)
    39  return true;
    40  return std::binary_search(
    41  sync_sample_vector_.begin(), sync_sample_vector_.end(), sample);
    42 }
    43 
    44 } // namespace mp4
    45 } // namespace media
    46 } // namespace shaka
    +
    1 // Copyright 2014 Google Inc. All rights reserved.
    2 //
    3 // Use of this source code is governed by a BSD-style
    4 // license that can be found in the LICENSE file or at
    5 // https://developers.google.com/open-source/licenses/bsd
    6 
    7 #include "packager/media/formats/mp4/sync_sample_iterator.h"
    8 
    9 #include <algorithm>
    10 
    11 namespace shaka {
    12 namespace media {
    13 namespace mp4 {
    14 
    16  : sample_number_(1),
    17  sync_sample_vector_(sync_sample.sample_number),
    18  iterator_(sync_sample_vector_.begin()),
    19  is_empty_(iterator_ == sync_sample_vector_.end()) {}
    20 SyncSampleIterator::~SyncSampleIterator() {}
    21 
    23  if (iterator_ != sync_sample_vector_.end() && sample_number_ == *iterator_)
    24  ++iterator_;
    25  ++sample_number_;
    26  return true;
    27 }
    28 
    30  // If the sync sample box is not present, every sample is a sync sample.
    31  if (is_empty_)
    32  return true;
    33  return iterator_ != sync_sample_vector_.end() && sample_number_ == *iterator_;
    34 }
    35 
    36 bool SyncSampleIterator::IsSyncSample(uint32_t sample) const {
    37  // If the sync sample box is not present, every sample is a sync sample.
    38  if (is_empty_)
    39  return true;
    40  return std::binary_search(
    41  sync_sample_vector_.begin(), sync_sample_vector_.end(), sample);
    42 }
    43 
    44 } // namespace mp4
    45 } // namespace media
    46 } // namespace shaka
    SyncSampleIterator(const SyncSample &sync_sample)
    Create a new SyncSampleIterator from sync sample box.
    All the methods that are virtual are virtual for mocking.
    @@ -74,7 +74,7 @@ $(function() {
    diff --git a/docs/d6/df8/structshaka_1_1StreamDescriptor-members.html b/docs/d6/df8/structshaka_1_1StreamDescriptor-members.html index 3ebc00803b..895d686a00 100644 --- a/docs/d6/df8/structshaka_1_1StreamDescriptor-members.html +++ b/docs/d6/df8/structshaka_1_1StreamDescriptor-members.html @@ -86,7 +86,7 @@ $(function() {
    diff --git a/docs/d6/dfd/classshaka_1_1media_1_1mp2t_1_1AudioHeader-members.html b/docs/d6/dfd/classshaka_1_1media_1_1mp2t_1_1AudioHeader-members.html index 7b60899801..1517cae468 100644 --- a/docs/d6/dfd/classshaka_1_1media_1_1mp2t_1_1AudioHeader-members.html +++ b/docs/d6/dfd/classshaka_1_1media_1_1mp2t_1_1AudioHeader-members.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/d6/dff/classshaka_1_1media_1_1Nalu.html b/docs/d6/dff/classshaka_1_1media_1_1Nalu.html index 9d89aad3c5..fcb02de68c 100644 --- a/docs/d6/dff/classshaka_1_1media_1_1Nalu.html +++ b/docs/d6/dff/classshaka_1_1media_1_1Nalu.html @@ -225,7 +225,7 @@ bool can_start_access_unit diff --git a/docs/d7/d01/classshaka_1_1media_1_1MuxerFactory-members.html b/docs/d7/d01/classshaka_1_1media_1_1MuxerFactory-members.html index b9f409644f..079f7f6fd9 100644 --- a/docs/d7/d01/classshaka_1_1media_1_1MuxerFactory-members.html +++ b/docs/d7/d01/classshaka_1_1media_1_1MuxerFactory-members.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d7/d01/structshaka_1_1media_1_1mp4_1_1SampleGroupDescription.html b/docs/d7/d01/structshaka_1_1media_1_1mp4_1_1SampleGroupDescription.html index d97d9787d4..5e8206ffdc 100644 --- a/docs/d7/d01/structshaka_1_1media_1_1mp4_1_1SampleGroupDescription.html +++ b/docs/d7/d01/structshaka_1_1media_1_1mp4_1_1SampleGroupDescription.html @@ -107,7 +107,7 @@ template<typename T >

    Public Attributes

    -uint32_t grouping_type +uint32_t grouping_type = 0   std::vector< CencSampleEncryptionInfoEntrycenc_sample_encryption_info_entries @@ -117,10 +117,10 @@ std::vector<   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

    @@ -131,7 +131,7 @@ Additional Inherited Members

    Detailed Description

    -

    Definition at line 506 of file box_definitions.h.

    +

    Definition at line 511 of file box_definitions.h.

    Member Function Documentation

    ◆ BoxType()

    @@ -159,7 +159,7 @@ Additional Inherited Members

    Implements shaka::media::mp4::Box.

    -

    Definition at line 999 of file box_definitions.cc.

    +

    Definition at line 1014 of file box_definitions.cc.

    @@ -170,7 +170,7 @@ Additional Inherited Members diff --git a/docs/d7/d04/classshaka_1_1media_1_1AdCueGenerator-members.html b/docs/d7/d04/classshaka_1_1media_1_1AdCueGenerator-members.html index f6be33e761..133a3f35e8 100644 --- a/docs/d7/d04/classshaka_1_1media_1_1AdCueGenerator-members.html +++ b/docs/d7/d04/classshaka_1_1media_1_1AdCueGenerator-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/docs/d7/d07/structshaka_1_1media_1_1mp4_1_1SoundMediaHeader.html b/docs/d7/d07/structshaka_1_1media_1_1mp4_1_1SoundMediaHeader.html index 4690bcd6e3..54c8277101 100644 --- a/docs/d7/d07/structshaka_1_1media_1_1mp4_1_1SoundMediaHeader.html +++ b/docs/d7/d07/structshaka_1_1media_1_1mp4_1_1SoundMediaHeader.html @@ -103,14 +103,14 @@ Public Member Functions

    Public Attributes

    -uint16_t balance +uint16_t balance = 0u   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

    @@ -121,7 +121,7 @@ Additional Inherited Members

    Detailed Description

    -

    Definition at line 574 of file box_definitions.h.

    +

    Definition at line 579 of file box_definitions.h.

    Member Function Documentation

    ◆ BoxType()

    @@ -149,7 +149,7 @@ Additional Inherited Members

    Implements shaka::media::mp4::Box.

    -

    Definition at line 1930 of file box_definitions.cc.

    +

    Definition at line 1969 of file box_definitions.cc.

    @@ -160,7 +160,7 @@ Additional Inherited Members diff --git a/docs/d7/d0b/muxer__listener__test__helper_8h_source.html b/docs/d7/d0b/muxer__listener__test__helper_8h_source.html index 873bd4a545..8b387d40e3 100644 --- a/docs/d7/d0b/muxer__listener__test__helper_8h_source.html +++ b/docs/d7/d0b/muxer__listener__test__helper_8h_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d7/d12/media__parser_8h_source.html b/docs/d7/d12/media__parser_8h_source.html index fd6d9746a9..26a12e9a4e 100644 --- a/docs/d7/d12/media__parser_8h_source.html +++ b/docs/d7/d12/media__parser_8h_source.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d7/d15/mpd__notifier_8h_source.html b/docs/d7/d15/mpd__notifier_8h_source.html index cc923fcb63..972f15ffbf 100644 --- a/docs/d7/d15/mpd__notifier_8h_source.html +++ b/docs/d7/d15/mpd__notifier_8h_source.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/d7/d16/structshaka_1_1media_1_1mp4_1_1VideoSampleEntry-members.html b/docs/d7/d16/structshaka_1_1media_1_1mp4_1_1VideoSampleEntry-members.html index 2107d2191a..22c62bc773 100644 --- a/docs/d7/d16/structshaka_1_1media_1_1mp4_1_1VideoSampleEntry-members.html +++ b/docs/d7/d16/structshaka_1_1media_1_1mp4_1_1VideoSampleEntry-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/docs/d7/d1d/text__chunker_8h_source.html b/docs/d7/d1d/text__chunker_8h_source.html index 4d8053a8fd..2ada330f78 100644 --- a/docs/d7/d1d/text__chunker_8h_source.html +++ b/docs/d7/d1d/text__chunker_8h_source.html @@ -66,14 +66,14 @@ $(function() {
    text_chunker.h
    -
    1 // Copyright 2017 Google Inc. All rights reserved.
    2 //
    3 // Use of this source code is governed by a BSD-style
    4 // license that can be found in the LICENSE file or at
    5 // https://developers.google.com/open-source/licenses/bsd
    6 
    7 #ifndef PACKAGER_MEDIA_CHUNKING_TEXT_CHUNKER_H_
    8 #define PACKAGER_MEDIA_CHUNKING_TEXT_CHUNKER_H_
    9 
    10 #include <list>
    11 
    12 #include "packager/media/base/media_handler.h"
    13 
    14 namespace shaka {
    15 namespace media {
    16 
    17 class TextChunker : public MediaHandler {
    18  public:
    19  explicit TextChunker(int64_t segment_duration_ms);
    20 
    21  private:
    22  TextChunker(const TextChunker&) = delete;
    23  TextChunker& operator=(const TextChunker&) = delete;
    24 
    25  Status InitializeInternal() override;
    26 
    27  Status Process(std::unique_ptr<StreamData> stream_data) override;
    28  Status OnFlushRequest(size_t input_stream_index) override;
    29 
    30  Status OnStreamInfo(std::shared_ptr<const StreamInfo> info);
    31  Status OnCueEvent(std::shared_ptr<const CueEvent> cue);
    32  Status OnTextSample(std::shared_ptr<const TextSample> sample);
    33 
    34  Status EndSegment(int64_t segment_actual_end_ms);
    35  void StartNewSegment(int64_t start_ms);
    36 
    37  int64_t segment_duration_ms_;
    38 
    39  // The segment that we are currently outputting samples for. The segment
    40  // will end once a new sample with start time greater or equal to the
    41  // segment's end time arrives.
    42  int64_t segment_start_ms_;
    43  int64_t segment_expected_end_ms_;
    44  std::list<std::shared_ptr<const TextSample>> segment_samples_;
    45 };
    46 
    47 } // namespace media
    48 } // namespace shaka
    49 
    50 #endif // PACKAGER_MEDIA_CHUNKING_TEXT_CHUNKER_H_
    +
    1 // Copyright 2017 Google Inc. All rights reserved.
    2 //
    3 // Use of this source code is governed by a BSD-style
    4 // license that can be found in the LICENSE file or at
    5 // https://developers.google.com/open-source/licenses/bsd
    6 
    7 #ifndef PACKAGER_MEDIA_CHUNKING_TEXT_CHUNKER_H_
    8 #define PACKAGER_MEDIA_CHUNKING_TEXT_CHUNKER_H_
    9 
    10 #include <list>
    11 
    12 #include "packager/media/base/media_handler.h"
    13 
    14 namespace shaka {
    15 namespace media {
    16 
    17 class TextChunker : public MediaHandler {
    18  public:
    19  explicit TextChunker(int64_t segment_duration_ms);
    20 
    21  private:
    22  TextChunker(const TextChunker&) = delete;
    23  TextChunker& operator=(const TextChunker&) = delete;
    24 
    25  Status InitializeInternal() override;
    26 
    27  Status Process(std::unique_ptr<StreamData> stream_data) override;
    28  Status OnFlushRequest(size_t input_stream_index) override;
    29 
    30  Status OnStreamInfo(std::shared_ptr<const StreamInfo> info);
    31  Status OnCueEvent(std::shared_ptr<const CueEvent> cue);
    32  Status OnTextSample(std::shared_ptr<const TextSample> sample);
    33 
    34  Status EndSegment(int64_t segment_actual_end_ms);
    35  void StartNewSegment(int64_t start_ms);
    36 
    37  int64_t segment_duration_ms_;
    38 
    39  // The segment that we are currently outputting samples for. The segment
    40  // will end once a new sample with start time greater or equal to the
    41  // segment's end time arrives.
    42  int64_t segment_start_ms_;
    43  int64_t segment_expected_end_ms_;
    44  std::list<std::shared_ptr<const TextSample>> segment_samples_;
    45 };
    46 
    47 } // namespace media
    48 } // namespace shaka
    49 
    50 #endif // PACKAGER_MEDIA_CHUNKING_TEXT_CHUNKER_H_
    All the methods that are virtual are virtual for mocking.
    diff --git a/docs/d7/d20/period_8h_source.html b/docs/d7/d20/period_8h_source.html index 3039125be6..13d865fd0f 100644 --- a/docs/d7/d20/period_8h_source.html +++ b/docs/d7/d20/period_8h_source.html @@ -77,7 +77,7 @@ $(function() {
    diff --git a/docs/d7/d21/classshaka_1_1MockPeriod-members.html b/docs/d7/d21/classshaka_1_1MockPeriod-members.html index 7e167084b7..57f378f701 100644 --- a/docs/d7/d21/classshaka_1_1MockPeriod-members.html +++ b/docs/d7/d21/classshaka_1_1MockPeriod-members.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/d7/d22/libcrypto__threading_8h_source.html b/docs/d7/d22/libcrypto__threading_8h_source.html index 5ea3b0ac7c..a3edf8c5bc 100644 --- a/docs/d7/d22/libcrypto__threading_8h_source.html +++ b/docs/d7/d22/libcrypto__threading_8h_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d7/d26/classshaka_1_1media_1_1mp4_1_1SyncSampleIterator.html b/docs/d7/d26/classshaka_1_1media_1_1mp4_1_1SyncSampleIterator.html index 3daf310bce..c7be6c0915 100644 --- a/docs/d7/d26/classshaka_1_1media_1_1mp4_1_1SyncSampleIterator.html +++ b/docs/d7/d26/classshaka_1_1media_1_1mp4_1_1SyncSampleIterator.html @@ -158,7 +158,7 @@ Public Member Functions diff --git a/docs/d7/d29/structshaka_1_1media_1_1H265Sps-members.html b/docs/d7/d29/structshaka_1_1media_1_1H265Sps-members.html index fe6b4dfc0e..358f38a045 100644 --- a/docs/d7/d29/structshaka_1_1media_1_1H265Sps-members.html +++ b/docs/d7/d29/structshaka_1_1media_1_1H265Sps-members.html @@ -123,7 +123,7 @@ $(function() { diff --git a/docs/d7/d29/structshaka_1_1media_1_1mp4_1_1CompositionTimeToSample-members.html b/docs/d7/d29/structshaka_1_1media_1_1mp4_1_1CompositionTimeToSample-members.html index fb1ebc10da..774929a30c 100644 --- a/docs/d7/d29/structshaka_1_1media_1_1mp4_1_1CompositionTimeToSample-members.html +++ b/docs/d7/d29/structshaka_1_1media_1_1mp4_1_1CompositionTimeToSample-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/d7/d2a/manifest__flags_8h_source.html b/docs/d7/d2a/manifest__flags_8h_source.html index efea028640..fe6b8bebc9 100644 --- a/docs/d7/d2a/manifest__flags_8h_source.html +++ b/docs/d7/d2a/manifest__flags_8h_source.html @@ -69,7 +69,7 @@ $(function() {
    1 // Copyright 2018 Google Inc. All rights reserved.
    2 //
    3 // Use of this source code is governed by a BSD-style
    4 // license that can be found in the LICENSE file or at
    5 // https://developers.google.com/open-source/licenses/bsd
    6 //
    7 // Common flags applicable to both DASH and HLS.
    8 
    9 #ifndef PACKAGER_APP_MANIFEST_FLAGS_H_
    10 #define PACKAGER_APP_MANIFEST_FLAGS_H_
    11 
    12 #include <gflags/gflags.h>
    13 
    14 DECLARE_double(time_shift_buffer_depth);
    15 DECLARE_uint64(preserved_segments_outside_live_window);
    16 DECLARE_string(default_language);
    17 
    18 #endif // PACKAGER_APP_MANIFEST_FLAGS_H_
    diff --git a/docs/d7/d34/structshaka_1_1media_1_1EncryptionConfig.html b/docs/d7/d34/structshaka_1_1media_1_1EncryptionConfig.html index d20075c12f..703253ba68 100644 --- a/docs/d7/d34/structshaka_1_1media_1_1EncryptionConfig.html +++ b/docs/d7/d34/structshaka_1_1media_1_1EncryptionConfig.html @@ -103,7 +103,7 @@ std::vector< diff --git a/docs/d7/d36/classshaka_1_1media_1_1ContentEncoding-members.html b/docs/d7/d36/classshaka_1_1media_1_1ContentEncoding-members.html index 20f23d250b..581796545d 100644 --- a/docs/d7/d36/classshaka_1_1media_1_1ContentEncoding-members.html +++ b/docs/d7/d36/classshaka_1_1media_1_1ContentEncoding-members.html @@ -108,7 +108,7 @@ $(function() { diff --git a/docs/d7/d42/protection__system__specific__info_8cc_source.html b/docs/d7/d42/protection__system__specific__info_8cc_source.html index 385ff56752..2e8c8e7751 100644 --- a/docs/d7/d42/protection__system__specific__info_8cc_source.html +++ b/docs/d7/d42/protection__system__specific__info_8cc_source.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/d7/d42/structshaka_1_1media_1_1mp4_1_1SampleSize.html b/docs/d7/d42/structshaka_1_1media_1_1mp4_1_1SampleSize.html index edce35f574..e77dba4537 100644 --- a/docs/d7/d42/structshaka_1_1media_1_1mp4_1_1SampleSize.html +++ b/docs/d7/d42/structshaka_1_1media_1_1mp4_1_1SampleSize.html @@ -103,20 +103,20 @@ Public Member Functions

    Public Attributes

    -uint32_t sample_size +uint32_t sample_size = 0u   -uint32_t sample_count +uint32_t sample_count = 0u   std::vector< uint32_t > sizes   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

    @@ -127,7 +127,7 @@ Additional Inherited Members

    Detailed Description

    -

    Definition at line 442 of file box_definitions.h.

    +

    Definition at line 453 of file box_definitions.h.

    Member Function Documentation

    ◆ BoxType()

    @@ -155,7 +155,7 @@ Additional Inherited Members

    Implements shaka::media::mp4::Box.

    -

    Definition at line 775 of file box_definitions.cc.

    +

    Definition at line 789 of file box_definitions.cc.

    @@ -166,7 +166,7 @@ Additional Inherited Members diff --git a/docs/d7/d44/structshaka_1_1media_1_1mp4_1_1SampleEncryption-members.html b/docs/d7/d44/structshaka_1_1media_1_1mp4_1_1SampleEncryption-members.html index 2097919ba6..c12c2e36e0 100644 --- a/docs/d7/d44/structshaka_1_1media_1_1mp4_1_1SampleEncryption-members.html +++ b/docs/d7/d44/structshaka_1_1media_1_1mp4_1_1SampleEncryption-members.html @@ -77,24 +77,25 @@ $(function() { FullBox() (defined in shaka::media::mp4::FullBox)shaka::media::mp4::FullBox HeaderSize() const finalshaka::media::mp4::FullBoxvirtual iv_size (defined in shaka::media::mp4::SampleEncryption)shaka::media::mp4::SampleEncryption - kUseSubsampleEncryption enum value (defined in shaka::media::mp4::SampleEncryption)shaka::media::mp4::SampleEncryption - Parse(BoxReader *reader)shaka::media::mp4::Box - ParseFromSampleEncryptionData(uint8_t iv_size, std::vector< SampleEncryptionEntry > *sample_encryption_entries) constshaka::media::mp4::SampleEncryption - ReadWriteHeaderInternal(BoxBuffer *buffer) finalshaka::media::mp4::FullBoxprotectedvirtual - sample_encryption_datashaka::media::mp4::SampleEncryption - sample_encryption_entries (defined in shaka::media::mp4::SampleEncryption)shaka::media::mp4::SampleEncryption - SampleEncryption() (defined in shaka::media::mp4::SampleEncryption)shaka::media::mp4::SampleEncryption - SampleEncryptionFlags enum name (defined in shaka::media::mp4::SampleEncryption)shaka::media::mp4::SampleEncryption - version (defined in shaka::media::mp4::FullBox)shaka::media::mp4::FullBox - Write(BufferWriter *writer)shaka::media::mp4::Box - WriteHeader(BufferWriter *writer)shaka::media::mp4::Box - ~ SampleEncryption() override (defined in shaka::media::mp4::SampleEncryption)shaka::media::mp4::SampleEncryption - ~Box() (defined in shaka::media::mp4::Box)shaka::media::mp4::Boxvirtual - ~FullBox() override (defined in shaka::media::mp4::FullBox)shaka::media::mp4::FullBox + kInvalidIvSize (defined in shaka::media::mp4::SampleEncryption)shaka::media::mp4::SampleEncryptionstatic + kUseSubsampleEncryption enum value (defined in shaka::media::mp4::SampleEncryption)shaka::media::mp4::SampleEncryption + Parse(BoxReader *reader)shaka::media::mp4::Box + ParseFromSampleEncryptionData(uint8_t iv_size, std::vector< SampleEncryptionEntry > *sample_encryption_entries) constshaka::media::mp4::SampleEncryption + ReadWriteHeaderInternal(BoxBuffer *buffer) finalshaka::media::mp4::FullBoxprotectedvirtual + sample_encryption_datashaka::media::mp4::SampleEncryption + sample_encryption_entries (defined in shaka::media::mp4::SampleEncryption)shaka::media::mp4::SampleEncryption + SampleEncryption() (defined in shaka::media::mp4::SampleEncryption)shaka::media::mp4::SampleEncryption + SampleEncryptionFlags enum name (defined in shaka::media::mp4::SampleEncryption)shaka::media::mp4::SampleEncryption + version (defined in shaka::media::mp4::FullBox)shaka::media::mp4::FullBox + Write(BufferWriter *writer)shaka::media::mp4::Box + WriteHeader(BufferWriter *writer)shaka::media::mp4::Box + ~ SampleEncryption() override (defined in shaka::media::mp4::SampleEncryption)shaka::media::mp4::SampleEncryption + ~Box() (defined in shaka::media::mp4::Box)shaka::media::mp4::Boxvirtual + ~FullBox() override (defined in shaka::media::mp4::FullBox)shaka::media::mp4::FullBox diff --git a/docs/d7/d46/classshaka_1_1media_1_1WebMListParser-members.html b/docs/d7/d46/classshaka_1_1media_1_1WebMListParser-members.html index dc7c91a4c9..d872b95da0 100644 --- a/docs/d7/d46/classshaka_1_1media_1_1WebMListParser-members.html +++ b/docs/d7/d46/classshaka_1_1media_1_1WebMListParser-members.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d7/d53/classshaka_1_1media_1_1WebVttToMp4Handler.html b/docs/d7/d53/classshaka_1_1media_1_1WebVttToMp4Handler.html index ac86410cc2..5b41c569ee 100644 --- a/docs/d7/d53/classshaka_1_1media_1_1WebVttToMp4Handler.html +++ b/docs/d7/d53/classshaka_1_1media_1_1WebVttToMp4Handler.html @@ -63,7 +63,6 @@ $(function() {
    shaka::media::WebVttToMp4Handler Class Reference
    @@ -79,18 +78,28 @@ Inheritance diagram for shaka::media::WebVttToMp4Handler:
    - - - - - - - - + + + + + + + + + + + + + + + + @@ -141,68 +150,18 @@ size_t  -

    -Protected Member Functions

    Status Process (std::unique_ptr< StreamData > stream_data) override
     
    -Status OnFlushRequest (size_t input_stream_index) override
     Event handler for flush request at the specific input stream index.
     
    -virtual void WriteCue (const std::string &id, const std::string &settings, const std::string &payload, BufferWriter *out)
     

    +Additional Inherited Members

    - Public Member Functions inherited from shaka::media::MediaHandler
    +Status SetHandler (size_t output_stream_index, std::shared_ptr< MediaHandler > handler)
     Connect downstream handler at the specified output stream index.
     
    +Status AddHandler (std::shared_ptr< MediaHandler > handler)
     Connect downstream handler to the next available output stream index.
     
    Status Initialize ()
     
    +bool IsConnected ()
     Validate if the handler is connected to its upstream handler.
     
    - Protected Member Functions inherited from shaka::media::MediaHandler
    +virtual Status OnFlushRequest (size_t input_stream_index)
     Event handler for flush request at the specific input stream index.
     
    virtual bool ValidateOutputStreamIndex (size_t stream_index) const
     Validate if the stream at the specified index actually exists.
    next_output_stream_
    const std::map< size_t, std::pair< std::shared_ptr< MediaHandler >, size_t > > & output_handlers ()
     
    - - - - - - - - - - - - -

    -Additional Inherited Members

    - Public Member Functions inherited from shaka::media::MediaHandler
    -Status SetHandler (size_t output_stream_index, std::shared_ptr< MediaHandler > handler)
     Connect downstream handler at the specified output stream index.
     
    -Status AddHandler (std::shared_ptr< MediaHandler > handler)
     Connect downstream handler to the next available output stream index.
     
    Status Initialize ()
     
    -bool IsConnected ()
     Validate if the handler is connected to its upstream handler.
     

    Detailed Description

    -

    Definition at line 31 of file webvtt_to_mp4_handler.h.

    -

    Member Function Documentation

    - -

    ◆ Process()

    - -
    -
    - - - - - -
    - - - - - - - - -
    Status shaka::media::WebVttToMp4Handler::Process (std::unique_ptr< StreamDatastream_data)
    -
    -overrideprotectedvirtual
    -
    -

    Process the incoming stream data. Note that (1) stream_data.stream_index should be the input stream index; (2) The implementation needs to call DispatchXxx to dispatch the processed stream data to the downstream handlers after finishing processing if needed.

    - -

    Implements shaka::media::MediaHandler.

    - -

    Definition at line 73 of file webvtt_to_mp4_handler.cc.

    - -
    -
    -
    The documentation for this class was generated from the following files:
      +

      Definition at line 24 of file webvtt_to_mp4_handler.h.

      +
      The documentation for this class was generated from the following files: diff --git a/docs/d7/d54/classshaka_1_1media_1_1H26xByteToUnitStreamConverter-members.html b/docs/d7/d54/classshaka_1_1media_1_1H26xByteToUnitStreamConverter-members.html index 8a4b6494d8..1da8e5cd89 100644 --- a/docs/d7/d54/classshaka_1_1media_1_1H26xByteToUnitStreamConverter-members.html +++ b/docs/d7/d54/classshaka_1_1media_1_1H26xByteToUnitStreamConverter-members.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/d7/d59/classshaka_1_1media_1_1DecryptorSource.html b/docs/d7/d59/classshaka_1_1media_1_1DecryptorSource.html index 83f29c66df..c23898baca 100644 --- a/docs/d7/d59/classshaka_1_1media_1_1DecryptorSource.html +++ b/docs/d7/d59/classshaka_1_1media_1_1DecryptorSource.html @@ -181,7 +181,7 @@ Public Member Functions diff --git a/docs/d7/d5a/classshaka_1_1media_1_1SyncPointQueue-members.html b/docs/d7/d5a/classshaka_1_1media_1_1SyncPointQueue-members.html index 3e3889275b..78fd9b226e 100644 --- a/docs/d7/d5a/classshaka_1_1media_1_1SyncPointQueue-members.html +++ b/docs/d7/d5a/classshaka_1_1media_1_1SyncPointQueue-members.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/d7/d5c/classshaka_1_1hls_1_1SimpleHlsNotifier.html b/docs/d7/d5c/classshaka_1_1hls_1_1SimpleHlsNotifier.html index 1654ed6c04..22dce98587 100644 --- a/docs/d7/d5c/classshaka_1_1hls_1_1SimpleHlsNotifier.html +++ b/docs/d7/d5c/classshaka_1_1hls_1_1SimpleHlsNotifier.html @@ -545,7 +545,7 @@ class  diff --git a/docs/d7/d6c/structshaka_1_1HlsParams-members.html b/docs/d7/d6c/structshaka_1_1HlsParams-members.html index d4595d00a4..37a110d26f 100644 --- a/docs/d7/d6c/structshaka_1_1HlsParams-members.html +++ b/docs/d7/d6c/structshaka_1_1HlsParams-members.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/d7/d6d/classshaka_1_1media_1_1MediaSample.html b/docs/d7/d6d/classshaka_1_1media_1_1MediaSample.html index 33cb4cd59a..ad5ef7a4d7 100644 --- a/docs/d7/d6d/classshaka_1_1media_1_1MediaSample.html +++ b/docs/d7/d6d/classshaka_1_1media_1_1MediaSample.html @@ -465,7 +465,7 @@ Protected Member Functions diff --git a/docs/d7/d6d/structshaka_1_1EncryptionParams_1_1EncryptedStreamAttributes.html b/docs/d7/d6d/structshaka_1_1EncryptionParams_1_1EncryptedStreamAttributes.html index b2818b7000..58468be00b 100644 --- a/docs/d7/d6d/structshaka_1_1EncryptionParams_1_1EncryptedStreamAttributes.html +++ b/docs/d7/d6d/structshaka_1_1EncryptionParams_1_1EncryptedStreamAttributes.html @@ -109,7 +109,7 @@ union diff --git a/docs/d7/d75/callback__file_8h_source.html b/docs/d7/d75/callback__file_8h_source.html index 1410456774..91b2da720a 100644 --- a/docs/d7/d75/callback__file_8h_source.html +++ b/docs/d7/d75/callback__file_8h_source.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/d7/d75/structshaka_1_1media_1_1mp4_1_1MediaHeader-members.html b/docs/d7/d75/structshaka_1_1media_1_1mp4_1_1MediaHeader-members.html index cd93a733f1..1aa7f9e387 100644 --- a/docs/d7/d75/structshaka_1_1media_1_1mp4_1_1MediaHeader-members.html +++ b/docs/d7/d75/structshaka_1_1media_1_1mp4_1_1MediaHeader-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/docs/d7/d78/structshaka_1_1media_1_1H264SEIMessage-members.html b/docs/d7/d78/structshaka_1_1media_1_1H264SEIMessage-members.html index e5e9489f72..36a87e5574 100644 --- a/docs/d7/d78/structshaka_1_1media_1_1H264SEIMessage-members.html +++ b/docs/d7/d78/structshaka_1_1media_1_1H264SEIMessage-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d7/d79/chunking__handler_8h_source.html b/docs/d7/d79/chunking__handler_8h_source.html index c0712ad68d..598509d69f 100644 --- a/docs/d7/d79/chunking__handler_8h_source.html +++ b/docs/d7/d79/chunking__handler_8h_source.html @@ -68,7 +68,7 @@ $(function() {
      1 // Copyright 2017 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #ifndef PACKAGER_MEDIA_CHUNKING_CHUNKING_HANDLER_
      8 #define PACKAGER_MEDIA_CHUNKING_CHUNKING_HANDLER_
      9 
      10 #include <atomic>
      11 #include <queue>
      12 
      13 #include "packager/base/logging.h"
      14 #include "packager/base/optional.h"
      15 #include "packager/media/base/media_handler.h"
      16 #include "packager/media/public/chunking_params.h"
      17 
      18 namespace shaka {
      19 namespace media {
      20 
      39 class ChunkingHandler : public MediaHandler {
      40  public:
      41  explicit ChunkingHandler(const ChunkingParams& chunking_params);
      42  ~ChunkingHandler() override = default;
      43 
      44  protected:
      47  Status InitializeInternal() override;
      48  Status Process(std::unique_ptr<StreamData> stream_data) override;
      49  Status OnFlushRequest(size_t input_stream_index) override;
      51 
      52  private:
      53  friend class ChunkingHandlerTest;
      54 
      55  ChunkingHandler(const ChunkingHandler&) = delete;
      56  ChunkingHandler& operator=(const ChunkingHandler&) = delete;
      57 
      58  Status OnStreamInfo(std::shared_ptr<const StreamInfo> info);
      59  Status OnCueEvent(std::shared_ptr<const CueEvent> event);
      60  Status OnMediaSample(std::shared_ptr<const MediaSample> sample);
      61 
      62  Status EndSegmentIfStarted() const;
      63  Status EndSubsegmentIfStarted() const;
      64 
      65  bool IsSubsegmentEnabled() {
      66  return subsegment_duration_ > 0 &&
      67  subsegment_duration_ != segment_duration_;
      68  }
      69 
      70  const ChunkingParams chunking_params_;
      71 
      72  // Segment and subsegment duration in stream's time scale.
      73  int64_t segment_duration_ = 0;
      74  int64_t subsegment_duration_ = 0;
      75 
      76  // Current segment index, useful to determine where to do chunking.
      77  int64_t current_segment_index_ = -1;
      78  // Current subsegment index, useful to determine where to do chunking.
      79  int64_t current_subsegment_index_ = -1;
      80 
      81  base::Optional<int64_t> segment_start_time_;
      82  base::Optional<int64_t> subsegment_start_time_;
      83  uint32_t time_scale_ = 0;
      84  // The end timestamp of the last dispatched sample.
      85  int64_t last_sample_end_timestamp_ = 0;
      86 
      87  // The offset is applied to sample timestamps so a full segment is generated
      88  // after cue points.
      89  int64_t cue_offset_ = 0;
      90 };
      91 
      92 } // namespace media
      93 } // namespace shaka
      94 
      95 #endif // PACKAGER_MEDIA_CHUNKING_CHUNKING_HANDLER_
      Status Process(std::unique_ptr< StreamData > stream_data) override
      Status InitializeInternal() override
      - +
      All the methods that are virtual are virtual for mocking.
      Status OnFlushRequest(size_t input_stream_index) override
      Event handler for flush request at the specific input stream index.
      @@ -77,7 +77,7 @@ $(function() {
      diff --git a/docs/d7/d7c/vlog__flags_8h_source.html b/docs/d7/d7c/vlog__flags_8h_source.html index 5d25fc7a79..d06e56d9ed 100644 --- a/docs/d7/d7c/vlog__flags_8h_source.html +++ b/docs/d7/d7c/vlog__flags_8h_source.html @@ -69,7 +69,7 @@ $(function() {
      1 // Copyright 2015 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #ifndef APP_VLOG_FLAGS_H_
      8 #define APP_VLOG_FLAGS_H_
      9 
      10 #include <gflags/gflags.h>
      11 
      12 DECLARE_int32(v);
      13 DECLARE_string(vmodule);
      14 
      15 #endif // APP_VLOG_FLAGS_H_
      diff --git a/docs/d7/d87/video__stream__info_8h_source.html b/docs/d7/d87/video__stream__info_8h_source.html index 01645a308d..52e51cae7e 100644 --- a/docs/d7/d87/video__stream__info_8h_source.html +++ b/docs/d7/d87/video__stream__info_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d7/d91/text__padder_8h_source.html b/docs/d7/d91/text__padder_8h_source.html index 769229cc15..7d26444bdd 100644 --- a/docs/d7/d91/text__padder_8h_source.html +++ b/docs/d7/d91/text__padder_8h_source.html @@ -66,7 +66,7 @@ $(function() {
      text_padder.h
      -
      1 // Copyright 2018 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #ifndef PACKAGER_MEDIA_FORMATS_WEBVTT_TEXT_PADDER_H_
      8 #define PACKAGER_MEDIA_FORMATS_WEBVTT_TEXT_PADDER_H_
      9 
      10 #include "packager/media/base/media_handler.h"
      11 
      12 namespace shaka {
      13 namespace media {
      14 
      18 class TextPadder : public MediaHandler {
      19  public:
      21  // at least |duration_ms| long.
      22  explicit TextPadder(int64_t duration_ms);
      23  ~TextPadder() override = default;
      24 
      25  private:
      26  TextPadder(const TextPadder&) = delete;
      27  TextPadder& operator=(const TextPadder&) = delete;
      28 
      29  Status InitializeInternal() override;
      30 
      31  Status Process(std::unique_ptr<StreamData> data) override;
      32  Status OnFlushRequest(size_t index) override;
      33  Status OnTextSample(std::unique_ptr<StreamData> data);
      34 
      35  int64_t duration_ms_;
      36  int64_t max_end_time_ms_ = 0;
      37 };
      38 
      39 } // namespace media
      40 } // namespace shaka
      41 
      42 #endif // MEDIA_FORMATS_WEBVTT_TEXT_PADDER_H_
      +
      1 // Copyright 2018 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #ifndef PACKAGER_MEDIA_FORMATS_WEBVTT_TEXT_PADDER_H_
      8 #define PACKAGER_MEDIA_FORMATS_WEBVTT_TEXT_PADDER_H_
      9 
      10 #include "packager/media/base/media_handler.h"
      11 
      12 namespace shaka {
      13 namespace media {
      14 
      18 class TextPadder : public MediaHandler {
      19  public:
      21  // at least |duration_ms| long.
      22  explicit TextPadder(int64_t duration_ms);
      23  ~TextPadder() override = default;
      24 
      25  private:
      26  TextPadder(const TextPadder&) = delete;
      27  TextPadder& operator=(const TextPadder&) = delete;
      28 
      29  Status InitializeInternal() override;
      30 
      31  Status Process(std::unique_ptr<StreamData> data) override;
      32  Status OnFlushRequest(size_t index) override;
      33  Status OnTextSample(std::unique_ptr<StreamData> data);
      34 
      35  int64_t duration_ms_;
      36  int64_t max_end_time_ms_ = 0;
      37 };
      38 
      39 } // namespace media
      40 } // namespace shaka
      41 
      42 #endif // MEDIA_FORMATS_WEBVTT_TEXT_PADDER_H_
      All the methods that are virtual are virtual for mocking.
      TextPadder(int64_t duration_ms)
      Create a new text padder that will ensure the stream&#39;s duration is.
      Definition: text_padder.cc:19
      @@ -74,7 +74,7 @@ $(function() {
      diff --git a/docs/d7/d94/representation_8cc_source.html b/docs/d7/d94/representation_8cc_source.html index 523cd601c1..30dccedc28 100644 --- a/docs/d7/d94/representation_8cc_source.html +++ b/docs/d7/d94/representation_8cc_source.html @@ -102,7 +102,7 @@ $(function() {
      diff --git a/docs/d7/d9c/structshaka_1_1media_1_1H265SliceHeader_1_1LongTermPicsInfo.html b/docs/d7/d9c/structshaka_1_1media_1_1H265SliceHeader_1_1LongTermPicsInfo.html index d18d0bcfe8..a60ac56575 100644 --- a/docs/d7/d9c/structshaka_1_1media_1_1H265SliceHeader_1_1LongTermPicsInfo.html +++ b/docs/d7/d9c/structshaka_1_1media_1_1H265SliceHeader_1_1LongTermPicsInfo.html @@ -88,7 +88,7 @@ int delta_poc_msb_cycle_lt diff --git a/docs/d7/d9d/progress__listener_8h_source.html b/docs/d7/d9d/progress__listener_8h_source.html index 1ad9fab06c..cc2aae1378 100644 --- a/docs/d7/d9d/progress__listener_8h_source.html +++ b/docs/d7/d9d/progress__listener_8h_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/d7/da4/track__run__iterator_8h_source.html b/docs/d7/da4/track__run__iterator_8h_source.html index cda45f408d..56822be84e 100644 --- a/docs/d7/da4/track__run__iterator_8h_source.html +++ b/docs/d7/da4/track__run__iterator_8h_source.html @@ -67,7 +67,7 @@ $(function() {
      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_TRACK_RUN_ITERATOR_H_
      6 #define PACKAGER_MEDIA_FORMATS_MP4_TRACK_RUN_ITERATOR_H_
      7 
      8 #include <memory>
      9 #include <vector>
      10 
      11 #include "packager/media/formats/mp4/box_definitions.h"
      12 
      13 namespace shaka {
      14 namespace media {
      15 
      16 class DecryptConfig;
      17 
      18 namespace mp4 {
      19 
      20 struct SampleInfo;
      21 struct TrackRunInfo;
      22 
      24  public:
      27  explicit TrackRunIterator(const Movie* moov);
      29 
      36  bool Init();
      37 
      40  bool Init(const MovieFragment& moof);
      41 
      44  bool IsRunValid() const;
      47  bool IsSampleValid() const;
      48 
      51  void AdvanceRun();
      54  void AdvanceSample();
      55 
      59 
      64  bool CacheAuxInfo(const uint8_t* buf, int size);
      65 
      72  int64_t GetMaxClearOffset();
      73 
      76  uint32_t track_id() const;
      77  int64_t aux_info_offset() const;
      78  int aux_info_size() const;
      79  bool is_encrypted() const;
      80  bool is_audio() const;
      81  bool is_video() const;
      83 
      85  const AudioSampleEntry& audio_description() const;
      87  const VideoSampleEntry& video_description() const;
      88 
      91  int64_t sample_offset() const;
      92  int sample_size() const;
      93  int64_t dts() const;
      94  int64_t cts() const;
      95  int64_t duration() const;
      96  bool is_keyframe() const;
      98 
      101  std::unique_ptr<DecryptConfig> GetDecryptConfig();
      102 
      103  private:
      104  void ResetRun();
      105  const TrackEncryption& track_encryption() const;
      106 
      107  const Movie* moov_;
      108 
      109  std::vector<TrackRunInfo> runs_;
      110  std::vector<TrackRunInfo>::const_iterator run_itr_;
      111  std::vector<SampleInfo>::const_iterator sample_itr_;
      112 
      113  // Track the start dts of the next segment, only useful if decode_time box is
      114  // absent.
      115  std::vector<int64_t> next_fragment_start_dts_;
      116 
      117  int64_t sample_dts_;
      118  int64_t sample_offset_;
      119 
      120  DISALLOW_COPY_AND_ASSIGN(TrackRunIterator);
      121 };
      122 
      123 } // namespace mp4
      124 } // namespace media
      125 } // namespace shaka
      126 
      127 #endif // PACKAGER_MEDIA_FORMATS_MP4_TRACK_RUN_ITERATOR_H_
      - + @@ -76,10 +76,10 @@ $(function() { - - + +
      std::unique_ptr< DecryptConfig > GetDecryptConfig()
      - + @@ -88,7 +88,7 @@ $(function() {
      diff --git a/docs/d7/dad/simple__hls__notifier_8cc_source.html b/docs/d7/dad/simple__hls__notifier_8cc_source.html index 0ed142eaaa..78607a56a6 100644 --- a/docs/d7/dad/simple__hls__notifier_8cc_source.html +++ b/docs/d7/dad/simple__hls__notifier_8cc_source.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/d7/dae/structshaka_1_1media_1_1mp4_1_1MediaData.html b/docs/d7/dae/structshaka_1_1media_1_1mp4_1_1MediaData.html index 6d68e38612..78f55794ef 100644 --- a/docs/d7/dae/structshaka_1_1media_1_1mp4_1_1MediaData.html +++ b/docs/d7/dae/structshaka_1_1media_1_1mp4_1_1MediaData.html @@ -101,7 +101,7 @@ Public Member Functions

      Public Attributes

      -uint32_t data_size +uint32_t data_size = 0u  

      @@ -112,7 +112,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 781 of file box_definitions.h.

      +

      Definition at line 786 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -140,7 +140,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 2570 of file box_definitions.cc.

      +

      Definition at line 2638 of file box_definitions.cc.

      @@ -151,7 +151,7 @@ Additional Inherited Members diff --git a/docs/d7/db0/mpd__writer_8h_source.html b/docs/d7/db0/mpd__writer_8h_source.html index 0da40bd70d..e692788261 100644 --- a/docs/d7/db0/mpd__writer_8h_source.html +++ b/docs/d7/db0/mpd__writer_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d7/db7/structshaka_1_1media_1_1mp4_1_1SampleToChunk-members.html b/docs/d7/db7/structshaka_1_1media_1_1mp4_1_1SampleToChunk-members.html index 8e2217a725..6aab2b3742 100644 --- a/docs/d7/db7/structshaka_1_1media_1_1mp4_1_1SampleToChunk-members.html +++ b/docs/d7/db7/structshaka_1_1media_1_1mp4_1_1SampleToChunk-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/d7/dbd/classshaka_1_1LocalFile.html b/docs/d7/dbd/classshaka_1_1LocalFile.html index 16e9c48172..c9fdb57226 100644 --- a/docs/d7/dbd/classshaka_1_1LocalFile.html +++ b/docs/d7/dbd/classshaka_1_1LocalFile.html @@ -497,7 +497,7 @@ bool  diff --git a/docs/d7/dc3/structshaka_1_1media_1_1mp4_1_1TextSampleEntry.html b/docs/d7/dc3/structshaka_1_1media_1_1mp4_1_1TextSampleEntry.html index f477309c3f..db2dd31708 100644 --- a/docs/d7/dc3/structshaka_1_1media_1_1mp4_1_1TextSampleEntry.html +++ b/docs/d7/dc3/structshaka_1_1media_1_1mp4_1_1TextSampleEntry.html @@ -101,10 +101,10 @@ Public Member Functions

      Public Attributes

      -FourCC format +FourCC format = FOURCC_NULL   -uint16_t data_reference_index +uint16_t data_reference_index = 1u   WebVTTConfigurationBox config @@ -121,7 +121,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 375 of file box_definitions.h.

      +

      Definition at line 383 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -149,7 +149,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 1849 of file box_definitions.cc.

      +

      Definition at line 1882 of file box_definitions.cc.

      @@ -160,7 +160,7 @@ Additional Inherited Members diff --git a/docs/d7/dc6/byte__queue_8h_source.html b/docs/d7/dc6/byte__queue_8h_source.html index 1f9f67c6b1..836e7d5f5e 100644 --- a/docs/d7/dc6/byte__queue_8h_source.html +++ b/docs/d7/dc6/byte__queue_8h_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d7/dd0/mpd__notifier__util_8h_source.html b/docs/d7/dd0/mpd__notifier__util_8h_source.html index 253b5d964b..2009097d91 100644 --- a/docs/d7/dd0/mpd__notifier__util_8h_source.html +++ b/docs/d7/dd0/mpd__notifier__util_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d7/dd4/request__signer_8h_source.html b/docs/d7/dd4/request__signer_8h_source.html index cb7869fe5f..ac01975aaf 100644 --- a/docs/d7/dd4/request__signer_8h_source.html +++ b/docs/d7/dd4/request__signer_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d7/dd5/classshaka_1_1media_1_1mp4_1_1MP4MediaParser.html b/docs/d7/dd5/classshaka_1_1media_1_1mp4_1_1MP4MediaParser.html index 2742ef0249..4a26f8c4b1 100644 --- a/docs/d7/dd5/classshaka_1_1media_1_1mp4_1_1MP4MediaParser.html +++ b/docs/d7/dd5/classshaka_1_1media_1_1mp4_1_1MP4MediaParser.html @@ -261,7 +261,7 @@ Additional Inherited Members diff --git a/docs/d7/dd6/key__source_8cc_source.html b/docs/d7/dd6/key__source_8cc_source.html index bc87d6661c..be7153b2d7 100644 --- a/docs/d7/dd6/key__source_8cc_source.html +++ b/docs/d7/dd6/key__source_8cc_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d7/dda/classshaka_1_1media_1_1ByteQueue.html b/docs/d7/dda/classshaka_1_1media_1_1ByteQueue.html index 93e3a85bce..6808a6262d 100644 --- a/docs/d7/dda/classshaka_1_1media_1_1ByteQueue.html +++ b/docs/d7/dda/classshaka_1_1media_1_1ByteQueue.html @@ -156,7 +156,7 @@ void  diff --git a/docs/d7/ddd/classshaka_1_1media_1_1RsaRequestSigner.html b/docs/d7/ddd/classshaka_1_1media_1_1RsaRequestSigner.html index 0a8e6ab34e..efb50a867a 100644 --- a/docs/d7/ddd/classshaka_1_1media_1_1RsaRequestSigner.html +++ b/docs/d7/ddd/classshaka_1_1media_1_1RsaRequestSigner.html @@ -159,7 +159,7 @@ Additional Inherited Members diff --git a/docs/d7/ddf/structshaka_1_1media_1_1ProtectionSystemSpecificInfo-members.html b/docs/d7/ddf/structshaka_1_1media_1_1ProtectionSystemSpecificInfo-members.html index fe2a555c58..07c578bd7d 100644 --- a/docs/d7/ddf/structshaka_1_1media_1_1ProtectionSystemSpecificInfo-members.html +++ b/docs/d7/ddf/structshaka_1_1media_1_1ProtectionSystemSpecificInfo-members.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d7/de0/classshaka_1_1media_1_1HttpKeyFetcher.html b/docs/d7/de0/classshaka_1_1media_1_1HttpKeyFetcher.html index 79ae66d0d0..cb1a0ad09e 100644 --- a/docs/d7/de0/classshaka_1_1media_1_1HttpKeyFetcher.html +++ b/docs/d7/de0/classshaka_1_1media_1_1HttpKeyFetcher.html @@ -381,7 +381,7 @@ KeyFetcher implementation overrides. diff --git a/docs/d7/de0/structshaka_1_1media_1_1mp4_1_1SampleToGroupEntry.html b/docs/d7/de0/structshaka_1_1media_1_1mp4_1_1SampleToGroupEntry.html index 87739f6d7c..a14053c4fe 100644 --- a/docs/d7/de0/structshaka_1_1media_1_1mp4_1_1SampleToGroupEntry.html +++ b/docs/d7/de0/structshaka_1_1media_1_1mp4_1_1SampleToGroupEntry.html @@ -81,22 +81,22 @@ Public Types

      Public Attributes

      -uint32_t sample_count +uint32_t sample_count = 0u   -uint32_t group_description_index +uint32_t group_description_index = 0u  

      Detailed Description

      -

      Definition at line 520 of file box_definitions.h.

      +

      Definition at line 525 of file box_definitions.h.


      The documentation for this struct was generated from the following file: diff --git a/docs/d7/dec/h264__byte__to__unit__stream__converter_8h_source.html b/docs/d7/dec/h264__byte__to__unit__stream__converter_8h_source.html index 690ebae385..5cbf9546b4 100644 --- a/docs/d7/dec/h264__byte__to__unit__stream__converter_8h_source.html +++ b/docs/d7/dec/h264__byte__to__unit__stream__converter_8h_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d7/dee/mpd__generator_8cc_source.html b/docs/d7/dee/mpd__generator_8cc_source.html index 42e6d81ecc..9c9c63f9d8 100644 --- a/docs/d7/dee/mpd__generator_8cc_source.html +++ b/docs/d7/dee/mpd__generator_8cc_source.html @@ -66,11 +66,11 @@ $(function() {
      mpd_generator.cc
      -
      1 // Copyright 2014 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #include <iostream>
      8 
      9 #include "packager/app/mpd_generator_flags.h"
      10 #include "packager/app/vlog_flags.h"
      11 #include "packager/base/at_exit.h"
      12 #include "packager/base/command_line.h"
      13 #include "packager/base/logging.h"
      14 #include "packager/base/strings/string_split.h"
      15 #include "packager/base/strings/stringprintf.h"
      16 #include "packager/mpd/util/mpd_writer.h"
      17 #include "packager/tools/license_notice.h"
      18 #include "packager/version/version.h"
      19 
      20 #if defined(OS_WIN)
      21 #include <codecvt>
      22 #include <functional>
      23 #include <locale>
      24 #endif // defined(OS_WIN)
      25 
      26 DEFINE_bool(licenses, false, "Dump licenses.");
      27 
      28 namespace shaka {
      29 namespace {
      30 const char kUsage[] =
      31  "MPD generation driver program.\n"
      32  "This program accepts MediaInfo files in human readable text "
      33  "format and outputs an MPD.\n"
      34  "The main use case for this is to output MPD for VOD.\n"
      35  "Limitations:\n"
      36  " Each MediaInfo can only have one of VideoInfo, AudioInfo, or TextInfo.\n"
      37  " There will be at most 3 AdaptationSets in the MPD, i.e. 1 video, 1 "
      38  "audio, and 1 text.\n"
      39  "Sample Usage:\n"
      40  "%s --input=\"video1.media_info,video2.media_info,audio1.media_info\" "
      41  "--output=\"video_audio.mpd\"";
      42 
      43 enum ExitStatus {
      44  kSuccess = 0,
      45  kEmptyInputError,
      46  kEmptyOutputError,
      47  kFailedToWriteMpdToFileError
      48 };
      49 
      50 ExitStatus CheckRequiredFlags() {
      51  if (FLAGS_input.empty()) {
      52  LOG(ERROR) << "--input is required.";
      53  return kEmptyInputError;
      54  }
      55 
      56  if (FLAGS_output.empty()) {
      57  LOG(ERROR) << "--output is required.";
      58  return kEmptyOutputError;
      59  }
      60 
      61  return kSuccess;
      62 }
      63 
      64 ExitStatus RunMpdGenerator() {
      65  DCHECK_EQ(CheckRequiredFlags(), kSuccess);
      66  std::vector<std::string> base_urls;
      67  typedef std::vector<std::string>::const_iterator Iterator;
      68 
      69  std::vector<std::string> input_files = base::SplitString(
      70  FLAGS_input, ",", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL);
      71 
      72  if (!FLAGS_base_urls.empty()) {
      73  base_urls = base::SplitString(FLAGS_base_urls, ",", base::KEEP_WHITESPACE,
      74  base::SPLIT_WANT_ALL);
      75  }
      76 
      77  MpdWriter mpd_writer;
      78  for (Iterator it = base_urls.begin(); it != base_urls.end(); ++it)
      79  mpd_writer.AddBaseUrl(*it);
      80 
      81  for (const std::string& file : input_files) {
      82  if (!mpd_writer.AddFile(file)) {
      83  LOG(WARNING) << "MpdWriter failed to read " << file << ", skipping.";
      84  }
      85  }
      86 
      87  if (!mpd_writer.WriteMpdToFile(FLAGS_output.c_str())) {
      88  LOG(ERROR) << "Failed to write MPD to " << FLAGS_output;
      89  return kFailedToWriteMpdToFileError;
      90  }
      91 
      92  return kSuccess;
      93 }
      94 
      95 int MpdMain(int argc, char** argv) {
      96  base::AtExitManager exit;
      97  // Needed to enable VLOG/DVLOG through --vmodule or --v.
      98  base::CommandLine::Init(argc, argv);
      99 
      100  // Set up logging.
      101  logging::LoggingSettings log_settings;
      102  log_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
      103  CHECK(logging::InitLogging(log_settings));
      104 
      105  google::SetVersionString(GetPackagerVersion());
      106  google::SetUsageMessage(base::StringPrintf(kUsage, argv[0]));
      107  google::ParseCommandLineFlags(&argc, &argv, true);
      108  if (FLAGS_licenses) {
      109  for (const char* line : kLicenseNotice)
      110  std::cout << line << std::endl;
      111  return kSuccess;
      112  }
      113 
      114  ExitStatus status = CheckRequiredFlags();
      115  if (status != kSuccess) {
      116  google::ShowUsageWithFlags("Usage");
      117  return status;
      118  }
      119 
      120  return RunMpdGenerator();
      121 }
      122 
      123 } // namespace
      124 } // namespace shaka
      125 
      126 #if defined(OS_WIN)
      127 // Windows wmain, which converts wide character arguments to UTF-8.
      128 int wmain(int argc, wchar_t* argv[], wchar_t* envp[]) {
      129  std::unique_ptr<char* [], std::function<void(char**)>> utf8_argv(
      130  new char*[argc], [argc](char** utf8_args) {
      131  // TODO(tinskip): This leaks, but if this code is enabled, it crashes.
      132  // Figure out why. I suspect gflags does something funny with the
      133  // argument array.
      134  // for (int idx = 0; idx < argc; ++idx)
      135  // delete[] utf8_args[idx];
      136  delete[] utf8_args;
      137  });
      138  std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
      139  for (int idx = 0; idx < argc; ++idx) {
      140  std::string utf8_arg(converter.to_bytes(argv[idx]));
      141  utf8_arg += '\0';
      142  utf8_argv[idx] = new char[utf8_arg.size()];
      143  memcpy(utf8_argv[idx], &utf8_arg[0], utf8_arg.size());
      144  }
      145  return shaka::MpdMain(argc, utf8_argv.get());
      146 }
      147 #else
      148 int main(int argc, char** argv) {
      149  return shaka::MpdMain(argc, argv);
      150 }
      151 #endif // !defined(OS_WIN)
      All the methods that are virtual are virtual for mocking.
      +
      1 // Copyright 2014 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #include <iostream>
      8 
      9 #include "packager/app/mpd_generator_flags.h"
      10 #include "packager/app/vlog_flags.h"
      11 #include "packager/base/at_exit.h"
      12 #include "packager/base/command_line.h"
      13 #include "packager/base/logging.h"
      14 #include "packager/base/strings/string_split.h"
      15 #include "packager/base/strings/stringprintf.h"
      16 #include "packager/mpd/util/mpd_writer.h"
      17 #include "packager/tools/license_notice.h"
      18 #include "packager/version/version.h"
      19 
      20 #if defined(OS_WIN)
      21 #include <codecvt>
      22 #include <functional>
      23 #include <locale>
      24 #endif // defined(OS_WIN)
      25 
      26 DEFINE_bool(licenses, false, "Dump licenses.");
      27 DEFINE_string(test_packager_version,
      28  "",
      29  "Packager version for testing. Should be used for testing only.");
      30 
      31 namespace shaka {
      32 namespace {
      33 const char kUsage[] =
      34  "MPD generation driver program.\n"
      35  "This program accepts MediaInfo files in human readable text "
      36  "format and outputs an MPD.\n"
      37  "The main use case for this is to output MPD for VOD.\n"
      38  "Limitations:\n"
      39  " Each MediaInfo can only have one of VideoInfo, AudioInfo, or TextInfo.\n"
      40  " There will be at most 3 AdaptationSets in the MPD, i.e. 1 video, 1 "
      41  "audio, and 1 text.\n"
      42  "Sample Usage:\n"
      43  "%s --input=\"video1.media_info,video2.media_info,audio1.media_info\" "
      44  "--output=\"video_audio.mpd\"";
      45 
      46 enum ExitStatus {
      47  kSuccess = 0,
      48  kEmptyInputError,
      49  kEmptyOutputError,
      50  kFailedToWriteMpdToFileError
      51 };
      52 
      53 ExitStatus CheckRequiredFlags() {
      54  if (FLAGS_input.empty()) {
      55  LOG(ERROR) << "--input is required.";
      56  return kEmptyInputError;
      57  }
      58 
      59  if (FLAGS_output.empty()) {
      60  LOG(ERROR) << "--output is required.";
      61  return kEmptyOutputError;
      62  }
      63 
      64  return kSuccess;
      65 }
      66 
      67 ExitStatus RunMpdGenerator() {
      68  DCHECK_EQ(CheckRequiredFlags(), kSuccess);
      69  std::vector<std::string> base_urls;
      70  typedef std::vector<std::string>::const_iterator Iterator;
      71 
      72  std::vector<std::string> input_files = base::SplitString(
      73  FLAGS_input, ",", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL);
      74 
      75  if (!FLAGS_base_urls.empty()) {
      76  base_urls = base::SplitString(FLAGS_base_urls, ",", base::KEEP_WHITESPACE,
      77  base::SPLIT_WANT_ALL);
      78  }
      79 
      80  MpdWriter mpd_writer;
      81  for (Iterator it = base_urls.begin(); it != base_urls.end(); ++it)
      82  mpd_writer.AddBaseUrl(*it);
      83 
      84  for (const std::string& file : input_files) {
      85  if (!mpd_writer.AddFile(file)) {
      86  LOG(WARNING) << "MpdWriter failed to read " << file << ", skipping.";
      87  }
      88  }
      89 
      90  if (!mpd_writer.WriteMpdToFile(FLAGS_output.c_str())) {
      91  LOG(ERROR) << "Failed to write MPD to " << FLAGS_output;
      92  return kFailedToWriteMpdToFileError;
      93  }
      94 
      95  return kSuccess;
      96 }
      97 
      98 int MpdMain(int argc, char** argv) {
      99  base::AtExitManager exit;
      100  // Needed to enable VLOG/DVLOG through --vmodule or --v.
      101  base::CommandLine::Init(argc, argv);
      102 
      103  // Set up logging.
      104  logging::LoggingSettings log_settings;
      105  log_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
      106  CHECK(logging::InitLogging(log_settings));
      107 
      108  google::SetVersionString(GetPackagerVersion());
      109  google::SetUsageMessage(base::StringPrintf(kUsage, argv[0]));
      110  google::ParseCommandLineFlags(&argc, &argv, true);
      111  if (FLAGS_licenses) {
      112  for (const char* line : kLicenseNotice)
      113  std::cout << line << std::endl;
      114  return kSuccess;
      115  }
      116 
      117  ExitStatus status = CheckRequiredFlags();
      118  if (status != kSuccess) {
      119  google::ShowUsageWithFlags("Usage");
      120  return status;
      121  }
      122 
      123  if (!FLAGS_test_packager_version.empty())
      124  SetPackagerVersionForTesting(FLAGS_test_packager_version);
      125 
      126  return RunMpdGenerator();
      127 }
      128 
      129 } // namespace
      130 } // namespace shaka
      131 
      132 #if defined(OS_WIN)
      133 // Windows wmain, which converts wide character arguments to UTF-8.
      134 int wmain(int argc, wchar_t* argv[], wchar_t* envp[]) {
      135  std::unique_ptr<char* [], std::function<void(char**)>> utf8_argv(
      136  new char*[argc], [argc](char** utf8_args) {
      137  // TODO(tinskip): This leaks, but if this code is enabled, it crashes.
      138  // Figure out why. I suspect gflags does something funny with the
      139  // argument array.
      140  // for (int idx = 0; idx < argc; ++idx)
      141  // delete[] utf8_args[idx];
      142  delete[] utf8_args;
      143  });
      144  std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
      145  for (int idx = 0; idx < argc; ++idx) {
      146  std::string utf8_arg(converter.to_bytes(argv[idx]));
      147  utf8_arg += '\0';
      148  utf8_argv[idx] = new char[utf8_arg.size()];
      149  memcpy(utf8_argv[idx], &utf8_arg[0], utf8_arg.size());
      150  }
      151  return shaka::MpdMain(argc, utf8_argv.get());
      152 }
      153 #else
      154 int main(int argc, char** argv) {
      155  return shaka::MpdMain(argc, argv);
      156 }
      157 #endif // !defined(OS_WIN)
      All the methods that are virtual are virtual for mocking.
      diff --git a/docs/d7/def/mp4__media__parser_8cc_source.html b/docs/d7/def/mp4__media__parser_8cc_source.html index 936cd083e3..4ece257c47 100644 --- a/docs/d7/def/mp4__media__parser_8cc_source.html +++ b/docs/d7/def/mp4__media__parser_8cc_source.html @@ -71,20 +71,20 @@ $(function() {
      Class for parsing or writing VP codec configuration record.
      - +
      bool Flush() override WARN_UNUSED_RESULT
      - +
      All the methods that are virtual are virtual for mocking.
      bool Parse(const uint8_t *buf, int size) override WARN_UNUSED_RESULT
      - - + +
      bool Parse(const std::vector< uint8_t > &data)
      std::string GetCodecString(FourCC codec_fourcc) const
      Class for reading MP4 boxes.
      Definition: box_reader.h:25
      - +
      bool ParseMP4(const std::vector< uint8_t > &data)
      Class for parsing HEVC decoder configuration record.
      @@ -105,7 +105,7 @@ $(function() {
      diff --git a/docs/d7/df9/byte__queue_8cc_source.html b/docs/d7/df9/byte__queue_8cc_source.html index 7abeaeb77a..ddf2ed5757 100644 --- a/docs/d7/df9/byte__queue_8cc_source.html +++ b/docs/d7/df9/byte__queue_8cc_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d8/d02/classshaka_1_1MockPeriod.html b/docs/d8/d02/classshaka_1_1MockPeriod.html index eba15ef2f3..1f1427da56 100644 --- a/docs/d8/d02/classshaka_1_1MockPeriod.html +++ b/docs/d8/d02/classshaka_1_1MockPeriod.html @@ -119,7 +119,7 @@ Additional Inherited Members diff --git a/docs/d8/d08/classshaka_1_1media_1_1H264ByteToUnitStreamConverter.html b/docs/d8/d08/classshaka_1_1media_1_1H264ByteToUnitStreamConverter.html index d28cfefa46..8643ad75ba 100644 --- a/docs/d8/d08/classshaka_1_1media_1_1H264ByteToUnitStreamConverter.html +++ b/docs/d8/d08/classshaka_1_1media_1_1H264ByteToUnitStreamConverter.html @@ -214,7 +214,7 @@ void WarnIfNotMatch (i diff --git a/docs/d8/d08/classshaka_1_1media_1_1WebMClusterParser-members.html b/docs/d8/d08/classshaka_1_1media_1_1WebMClusterParser-members.html index 78f587cfb1..d4fe0c00c0 100644 --- a/docs/d8/d08/classshaka_1_1media_1_1WebMClusterParser-members.html +++ b/docs/d8/d08/classshaka_1_1media_1_1WebMClusterParser-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/docs/d8/d08/classshaka_1_1media_1_1mp2t_1_1TsWriter-members.html b/docs/d8/d08/classshaka_1_1media_1_1mp2t_1_1TsWriter-members.html index 5a78df4f72..863de8bffe 100644 --- a/docs/d8/d08/classshaka_1_1media_1_1mp2t_1_1TsWriter-members.html +++ b/docs/d8/d08/classshaka_1_1media_1_1mp2t_1_1TsWriter-members.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/d8/d08/structshaka_1_1media_1_1mp4_1_1MovieHeader-members.html b/docs/d8/d08/structshaka_1_1media_1_1mp4_1_1MovieHeader-members.html index 7a604fadb8..dbb1c8b7f0 100644 --- a/docs/d8/d08/structshaka_1_1media_1_1mp4_1_1MovieHeader-members.html +++ b/docs/d8/d08/structshaka_1_1media_1_1mp4_1_1MovieHeader-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/docs/d8/d0c/webvtt__text__output__handler_8h_source.html b/docs/d8/d0c/webvtt__text__output__handler_8h_source.html new file mode 100644 index 0000000000..23894fcabf --- /dev/null +++ b/docs/d8/d0c/webvtt__text__output__handler_8h_source.html @@ -0,0 +1,87 @@ + + + + + + + +Shaka Packager SDK: packager/media/formats/webvtt/webvtt_text_output_handler.h Source File + + + + + + + + + +
      +
      + + + + + + +
      +
      Shaka Packager SDK +
      +
      +
      + + + + + + + + +
      +
      + + +
      + +
      + + +
      +
      +
      +
      webvtt_text_output_handler.h
      +
      +
      +
      1 // Copyright 2017 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #ifndef PACKAGER_MEDIA_FORMATS_WEBVTT_WEBVTT_TEXT_HANDLER_H_
      8 #define PACKAGER_MEDIA_FORMATS_WEBVTT_WEBVTT_TEXT_HANDLER_H_
      9 
      10 #include <stdint.h>
      11 
      12 #include <vector>
      13 
      14 #include "packager/media/base/media_handler.h"
      15 #include "packager/media/base/muxer_options.h"
      16 #include "packager/media/event/muxer_listener.h"
      17 #include "packager/media/formats/webvtt/webvtt_file_buffer.h"
      18 
      19 namespace shaka {
      20 namespace media {
      21 
      23  public:
      24  WebVttTextOutputHandler(const MuxerOptions& muxer_options,
      25  std::unique_ptr<MuxerListener> muxer_listener);
      26  virtual ~WebVttTextOutputHandler() = default;
      27 
      28  private:
      30  WebVttTextOutputHandler& operator=(const WebVttTextOutputHandler&) = delete;
      31 
      32  Status InitializeInternal() override;
      33  Status Process(std::unique_ptr<StreamData> stream_data) override;
      34  Status OnFlushRequest(size_t input_stream_index) override;
      35 
      36  Status OnStreamInfo(const StreamInfo& info);
      37  Status OnSegmentInfo(const SegmentInfo& info);
      38  Status OnCueEvent(const CueEvent& event);
      39  void OnTextSample(const TextSample& sample);
      40 
      41  Status OnSegmentEnded();
      42 
      43  void GoToNextSegment(uint64_t start_time_ms);
      44 
      45  const MuxerOptions muxer_options_;
      46  std::unique_ptr<MuxerListener> muxer_listener_;
      47 
      48  // Sum together all segment durations so we know how long the stream is.
      49  uint64_t total_duration_ms_ = 0;
      50  uint32_t segment_index_ = 0;
      51 
      52  WebVttFileBuffer buffer_;
      53 };
      54 
      55 } // namespace media
      56 } // namespace shaka
      57 
      58 #endif // PACKAGER_MEDIA_FORMATS_WEBVTT_WEBVTT_TEXT_HANDLER_H_
      +
      Abstract class holds stream information.
      Definition: stream_info.h:59
      + + +
      All the methods that are virtual are virtual for mocking.
      +
      This structure contains the list of configuration options for Muxer.
      Definition: muxer_options.h:20
      + + + + +
      + + + + diff --git a/docs/d8/d0d/media__sample_8cc_source.html b/docs/d8/d0d/media__sample_8cc_source.html index 1bbae3f326..33df8e04f0 100644 --- a/docs/d8/d0d/media__sample_8cc_source.html +++ b/docs/d8/d0d/media__sample_8cc_source.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/d8/d0f/protection__system__flags_8h_source.html b/docs/d8/d0f/protection__system__flags_8h_source.html index 7c24d4bd71..5a357a1ac6 100644 --- a/docs/d8/d0f/protection__system__flags_8h_source.html +++ b/docs/d8/d0f/protection__system__flags_8h_source.html @@ -69,7 +69,7 @@ $(function() {
      1 // Copyright 2017 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 //
      7 // Defines command line flags for protection systems.
      8 
      9 #ifndef PACKAGER_APP_PROTECTION_SYSTEM_FLAGS_H_
      10 #define PACKAGER_APP_PROTECTION_SYSTEM_FLAGS_H_
      11 
      12 #include <gflags/gflags.h>
      13 
      14 DECLARE_bool(generate_common_pssh);
      15 DECLARE_bool(generate_playready_pssh);
      16 DECLARE_bool(generate_widevine_pssh);
      17 
      18 #endif // PACKAGER_APP_PROTECTION_SYSTEM_FLAGS_H_
      diff --git a/docs/d8/d12/structshaka_1_1media_1_1mp4_1_1DecodingTime.html b/docs/d8/d12/structshaka_1_1media_1_1mp4_1_1DecodingTime.html index dd3ab31e1a..b38f77069c 100644 --- a/docs/d8/d12/structshaka_1_1media_1_1mp4_1_1DecodingTime.html +++ b/docs/d8/d12/structshaka_1_1media_1_1mp4_1_1DecodingTime.html @@ -81,14 +81,14 @@ uint32_t sample_delta<

      Detailed Description

      -

      Definition at line 401 of file box_definitions.h.

      +

      Definition at line 412 of file box_definitions.h.


      The documentation for this struct was generated from the following file: diff --git a/docs/d8/d13/classshaka_1_1media_1_1BitReader-members.html b/docs/d8/d13/classshaka_1_1media_1_1BitReader-members.html index defe1261b9..2cb765b9e0 100644 --- a/docs/d8/d13/classshaka_1_1media_1_1BitReader-members.html +++ b/docs/d8/d13/classshaka_1_1media_1_1BitReader-members.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/d8/d14/classshaka_1_1media_1_1VP8Parser.html b/docs/d8/d14/classshaka_1_1media_1_1VP8Parser.html index cf0cf909b8..cf94c6897e 100644 --- a/docs/d8/d14/classshaka_1_1media_1_1VP8Parser.html +++ b/docs/d8/d14/classshaka_1_1media_1_1VP8Parser.html @@ -213,7 +213,7 @@ Additional Inherited Members diff --git a/docs/d8/d16/structshaka_1_1media_1_1MuxerOptions-members.html b/docs/d8/d16/structshaka_1_1media_1_1MuxerOptions-members.html index eb9e5d538e..c9e11fee20 100644 --- a/docs/d8/d16/structshaka_1_1media_1_1MuxerOptions-members.html +++ b/docs/d8/d16/structshaka_1_1media_1_1MuxerOptions-members.html @@ -72,14 +72,15 @@ $(function() { bandwidthshaka::media::MuxerOptions mp4_paramsshaka::media::MuxerOptions MuxerOptions() (defined in shaka::media::MuxerOptions)shaka::media::MuxerOptions - output_file_nameshaka::media::MuxerOptions - segment_templateshaka::media::MuxerOptions - temp_dirshaka::media::MuxerOptions - ~MuxerOptions() (defined in shaka::media::MuxerOptions)shaka::media::MuxerOptions + output_file_indexshaka::media::MuxerOptions + output_file_nameshaka::media::MuxerOptions + segment_templateshaka::media::MuxerOptions + temp_dirshaka::media::MuxerOptions + ~MuxerOptions() (defined in shaka::media::MuxerOptions)shaka::media::MuxerOptions diff --git a/docs/d8/d19/bandwidth__estimator_8h_source.html b/docs/d8/d19/bandwidth__estimator_8h_source.html index 9b91f9d7d1..8f61e7217a 100644 --- a/docs/d8/d19/bandwidth__estimator_8h_source.html +++ b/docs/d8/d19/bandwidth__estimator_8h_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d8/d1c/crypto__flags_8cc_source.html b/docs/d8/d1c/crypto__flags_8cc_source.html index ed9eb63c44..1c5adb3d8b 100644 --- a/docs/d8/d1c/crypto__flags_8cc_source.html +++ b/docs/d8/d1c/crypto__flags_8cc_source.html @@ -69,7 +69,7 @@ $(function() {
      1 // Copyright 2017 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #include "packager/app/crypto_flags.h"
      8 
      9 #include <stdio.h>
      10 
      11 DEFINE_string(protection_scheme,
      12  "cenc",
      13  "Specify a protection scheme, 'cenc' or 'cbc1' or pattern-based "
      14  "protection schemes 'cens' or 'cbcs'.");
      15 DEFINE_bool(vp9_subsample_encryption, true, "Enable VP9 subsample encryption.");
      diff --git a/docs/d8/d20/structshaka_1_1media_1_1mp4_1_1WebVTTConfigurationBox.html b/docs/d8/d20/structshaka_1_1media_1_1mp4_1_1WebVTTConfigurationBox.html index 91f675de51..afcae771c2 100644 --- a/docs/d8/d20/structshaka_1_1media_1_1mp4_1_1WebVTTConfigurationBox.html +++ b/docs/d8/d20/structshaka_1_1media_1_1mp4_1_1WebVTTConfigurationBox.html @@ -112,7 +112,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 365 of file box_definitions.h.

      +

      Definition at line 371 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -140,7 +140,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 1811 of file box_definitions.cc.

      +

      Definition at line 1845 of file box_definitions.cc.

      @@ -151,7 +151,7 @@ Additional Inherited Members diff --git a/docs/d8/d23/structshaka_1_1media_1_1SubsampleEntry-members.html b/docs/d8/d23/structshaka_1_1media_1_1SubsampleEntry-members.html index 0fb79a4f7e..eeaef2ed35 100644 --- a/docs/d8/d23/structshaka_1_1media_1_1SubsampleEntry-members.html +++ b/docs/d8/d23/structshaka_1_1media_1_1SubsampleEntry-members.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/d8/d28/es__parser__h265_8h_source.html b/docs/d8/d28/es__parser__h265_8h_source.html index a894ab31b9..af24495053 100644 --- a/docs/d8/d28/es__parser__h265_8h_source.html +++ b/docs/d8/d28/es__parser__h265_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d8/d33/webm__content__encodings__client_8h_source.html b/docs/d8/d33/webm__content__encodings__client_8h_source.html index 86c82e2cf8..6084efe1ae 100644 --- a/docs/d8/d33/webm__content__encodings__client_8h_source.html +++ b/docs/d8/d33/webm__content__encodings__client_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d8/d48/structshaka_1_1WidevineDecryptionParams.html b/docs/d8/d48/structshaka_1_1WidevineDecryptionParams.html index 9f69e00689..3f22bfeada 100644 --- a/docs/d8/d48/structshaka_1_1WidevineDecryptionParams.html +++ b/docs/d8/d48/structshaka_1_1WidevineDecryptionParams.html @@ -96,7 +96,7 @@ std::string  diff --git a/docs/d8/d4d/aes__decryptor_8h_source.html b/docs/d8/d4d/aes__decryptor_8h_source.html index 4632ce4ce1..68cffbcb2b 100644 --- a/docs/d8/d4d/aes__decryptor_8h_source.html +++ b/docs/d8/d4d/aes__decryptor_8h_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d8/d4f/classshaka_1_1media_1_1TextSample-members.html b/docs/d8/d4f/classshaka_1_1media_1_1TextSample-members.html index 724f4d4cdc..0578d81ead 100644 --- a/docs/d8/d4f/classshaka_1_1media_1_1TextSample-members.html +++ b/docs/d8/d4f/classshaka_1_1media_1_1TextSample-members.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/d8/d51/text__readers_8cc_source.html b/docs/d8/d51/text__readers_8cc_source.html index 0e8697799e..6a8b1e83a1 100644 --- a/docs/d8/d51/text__readers_8cc_source.html +++ b/docs/d8/d51/text__readers_8cc_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d8/d53/crypto__flags_8h_source.html b/docs/d8/d53/crypto__flags_8h_source.html index 317ebac198..376cea87dc 100644 --- a/docs/d8/d53/crypto__flags_8h_source.html +++ b/docs/d8/d53/crypto__flags_8h_source.html @@ -69,7 +69,7 @@ $(function() {
      1 // Copyright 2017 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 //
      7 // Defines common command line flags for encryption and decryption, which
      8 // applies to all key sources, i.e. fixed key, widevine and playready.
      9 
      10 #ifndef PACKAGER_APP_CRYPTO_FLAGS_H_
      11 #define PACKAGER_APP_CRYPTO_FLAGS_H_
      12 
      13 #include <gflags/gflags.h>
      14 
      15 DECLARE_string(protection_scheme);
      16 DECLARE_bool(vp9_subsample_encryption);
      17 
      18 #endif // PACKAGER_APP_CRYPTO_FLAGS_H_
      diff --git a/docs/d8/d5b/structshaka_1_1media_1_1mp4_1_1AudioSampleEntry.html b/docs/d8/d5b/structshaka_1_1media_1_1mp4_1_1AudioSampleEntry.html index 9c68a12847..e237e0aea3 100644 --- a/docs/d8/d5b/structshaka_1_1media_1_1mp4_1_1AudioSampleEntry.html +++ b/docs/d8/d5b/structshaka_1_1media_1_1mp4_1_1AudioSampleEntry.html @@ -104,19 +104,19 @@ FourCC GetActualFormat

      Public Attributes

      -FourCC format +FourCC format = FOURCC_NULL   -uint16_t data_reference_index +uint16_t data_reference_index = 1u   -uint16_t channelcount +uint16_t channelcount = 2u   -uint16_t samplesize +uint16_t samplesize = 16u   -uint32_t samplerate +uint32_t samplerate = 0u   ProtectionSchemeInfo sinf @@ -148,7 +148,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 342 of file box_definitions.h.

      +

      Definition at line 345 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -176,7 +176,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 1742 of file box_definitions.cc.

      +

      Definition at line 1776 of file box_definitions.cc.

      @@ -187,7 +187,7 @@ Additional Inherited Members diff --git a/docs/d8/d61/ac3__audio__util_8cc_source.html b/docs/d8/d61/ac3__audio__util_8cc_source.html index 5589bfd469..20222c4727 100644 --- a/docs/d8/d61/ac3__audio__util_8cc_source.html +++ b/docs/d8/d61/ac3__audio__util_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d8/d66/classshaka_1_1UdpFile-members.html b/docs/d8/d66/classshaka_1_1UdpFile-members.html index e761adb7df..a838d77c25 100644 --- a/docs/d8/d66/classshaka_1_1UdpFile-members.html +++ b/docs/d8/d66/classshaka_1_1UdpFile-members.html @@ -97,7 +97,7 @@ $(function() { diff --git a/docs/d8/d6a/classshaka_1_1media_1_1ClusterBuilder-members.html b/docs/d8/d6a/classshaka_1_1media_1_1ClusterBuilder-members.html index 3e9b50bc95..26f5902652 100644 --- a/docs/d8/d6a/classshaka_1_1media_1_1ClusterBuilder-members.html +++ b/docs/d8/d6a/classshaka_1_1media_1_1ClusterBuilder-members.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/d8/d6d/structshaka_1_1media_1_1mp4_1_1DataInformation.html b/docs/d8/d6d/structshaka_1_1media_1_1mp4_1_1DataInformation.html index 4c37047d27..47133ca0cb 100644 --- a/docs/d8/d6d/structshaka_1_1media_1_1mp4_1_1DataInformation.html +++ b/docs/d8/d6d/structshaka_1_1media_1_1mp4_1_1DataInformation.html @@ -112,7 +112,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 597 of file box_definitions.h.

      +

      Definition at line 602 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -140,7 +140,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 2002 of file box_definitions.cc.

      +

      Definition at line 2050 of file box_definitions.cc.

      @@ -151,7 +151,7 @@ Additional Inherited Members diff --git a/docs/d8/d6f/origin__handler_8h_source.html b/docs/d8/d6f/origin__handler_8h_source.html index ee5a3d3cab..63477e2f23 100644 --- a/docs/d8/d6f/origin__handler_8h_source.html +++ b/docs/d8/d6f/origin__handler_8h_source.html @@ -67,13 +67,13 @@ $(function() {
      1 // Copyright 2017 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #ifndef PACKAGER_MEDIA_ORIGIN_ORIGIN_HANDLER_H_
      8 #define PACKAGER_MEDIA_ORIGIN_ORIGIN_HANDLER_H_
      9 
      10 #include "packager/media/base/media_handler.h"
      11 
      12 namespace shaka {
      13 namespace media {
      14 
      15 // Origin handlers are handlers that sit at the head of a pipeline (chain of
      16 // handlers). They are expect to take input from an alternative source (like
      17 // a file or network connection).
      18 class OriginHandler : public MediaHandler {
      19  public:
      20  OriginHandler() = default;
      21 
      22  // Process all data and send messages down stream. This is the main
      23  // method of the handler. Since origin handlers do not take input via
      24  // |Process|, run will take input from an alternative source. This call
      25  // is expect to be blocking. To exit a call to |Run|, |Cancel| should
      26  // be used.
      27  virtual Status Run() = 0;
      28 
      29  // Non-blocking call to the handler, requesting that it exit the
      30  // current call to |Run|. The handler should stop processing data
      31  // as soon is convenient.
      32  virtual void Cancel() = 0;
      33 
      34  private:
      35  OriginHandler(const OriginHandler&) = delete;
      36  OriginHandler& operator=(const OriginHandler&) = delete;
      37 
      38  Status Process(std::unique_ptr<StreamData> stream_data) override;
      39 };
      40 
      41 } // namespace media
      42 } // namespace shaka
      43 
      44 #endif // PACKAGER_MEDIA_ORIGIN_ORIGIN_HANDLER_H_
      - +
      All the methods that are virtual are virtual for mocking.
      diff --git a/docs/d8/d70/structshaka_1_1media_1_1mp4_1_1Metadata-members.html b/docs/d8/d70/structshaka_1_1media_1_1mp4_1_1Metadata-members.html index dcd840666d..9c10c8c0ba 100644 --- a/docs/d8/d70/structshaka_1_1media_1_1mp4_1_1Metadata-members.html +++ b/docs/d8/d70/structshaka_1_1media_1_1mp4_1_1Metadata-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/docs/d8/d72/adaptation__set_8h_source.html b/docs/d8/d72/adaptation__set_8h_source.html index 0deee1a719..20472c5adc 100644 --- a/docs/d8/d72/adaptation__set_8h_source.html +++ b/docs/d8/d72/adaptation__set_8h_source.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d8/d74/classshaka_1_1media_1_1TracksBuilder.html b/docs/d8/d74/classshaka_1_1media_1_1TracksBuilder.html index c1be1e4974..8f2889777a 100644 --- a/docs/d8/d74/classshaka_1_1media_1_1TracksBuilder.html +++ b/docs/d8/d74/classshaka_1_1media_1_1TracksBuilder.html @@ -99,7 +99,7 @@ std::vector< uint8_t >  diff --git a/docs/d8/d81/classshaka_1_1LocalFile-members.html b/docs/d8/d81/classshaka_1_1LocalFile-members.html index 059b191b61..b7f8f6e393 100644 --- a/docs/d8/d81/classshaka_1_1LocalFile-members.html +++ b/docs/d8/d81/classshaka_1_1LocalFile-members.html @@ -97,7 +97,7 @@ $(function() { diff --git a/docs/d8/d86/classshaka_1_1media_1_1WebMTracksParser.html b/docs/d8/d86/classshaka_1_1media_1_1WebMTracksParser.html index 7deac15f92..baf7fc1f48 100644 --- a/docs/d8/d86/classshaka_1_1media_1_1WebMTracksParser.html +++ b/docs/d8/d86/classshaka_1_1media_1_1WebMTracksParser.html @@ -206,7 +206,7 @@ The number of bytes parsed on success. diff --git a/docs/d8/d88/structshaka_1_1media_1_1mp4_1_1MovieExtends-members.html b/docs/d8/d88/structshaka_1_1media_1_1mp4_1_1MovieExtends-members.html index 87f97a4230..76d92a88aa 100644 --- a/docs/d8/d88/structshaka_1_1media_1_1mp4_1_1MovieExtends-members.html +++ b/docs/d8/d88/structshaka_1_1media_1_1mp4_1_1MovieExtends-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/docs/d8/d8e/classshaka_1_1AdaptationSet.html b/docs/d8/d8e/classshaka_1_1AdaptationSet.html index 3a8d635f16..31ad8a4dee 100644 --- a/docs/d8/d8e/classshaka_1_1AdaptationSet.html +++ b/docs/d8/d8e/classshaka_1_1AdaptationSet.html @@ -691,7 +691,7 @@ class AdaptationSetTest diff --git a/docs/d8/d91/classshaka_1_1media_1_1AesCtrEncryptor-members.html b/docs/d8/d91/classshaka_1_1media_1_1AesCtrEncryptor-members.html index 057d8722b0..c7b09ff434 100644 --- a/docs/d8/d91/classshaka_1_1media_1_1AesCtrEncryptor-members.html +++ b/docs/d8/d91/classshaka_1_1media_1_1AesCtrEncryptor-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/docs/d8/d92/classshaka_1_1media_1_1AesRequestSigner-members.html b/docs/d8/d92/classshaka_1_1media_1_1AesRequestSigner-members.html index d42f8c316c..b3cf3f7e8c 100644 --- a/docs/d8/d92/classshaka_1_1media_1_1AesRequestSigner-members.html +++ b/docs/d8/d92/classshaka_1_1media_1_1AesRequestSigner-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d8/d92/structshaka_1_1media_1_1H264DecRefPicMarking-members.html b/docs/d8/d92/structshaka_1_1media_1_1H264DecRefPicMarking-members.html index 94a0432d04..68308525df 100644 --- a/docs/d8/d92/structshaka_1_1media_1_1H264DecRefPicMarking-members.html +++ b/docs/d8/d92/structshaka_1_1media_1_1H264DecRefPicMarking-members.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d8/d93/structshaka_1_1media_1_1mp4_1_1SubtitleMediaHeader-members.html b/docs/d8/d93/structshaka_1_1media_1_1mp4_1_1SubtitleMediaHeader-members.html index 9cf5b18b67..1053c6c6ed 100644 --- a/docs/d8/d93/structshaka_1_1media_1_1mp4_1_1SubtitleMediaHeader-members.html +++ b/docs/d8/d93/structshaka_1_1media_1_1mp4_1_1SubtitleMediaHeader-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/docs/d8/d94/pes__packet_8h_source.html b/docs/d8/d94/pes__packet_8h_source.html index 3dc1b20ae0..cd0ad6b678 100644 --- a/docs/d8/d94/pes__packet_8h_source.html +++ b/docs/d8/d94/pes__packet_8h_source.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/d8/d99/structshaka_1_1media_1_1mp4_1_1VTTAdditionalTextBox-members.html b/docs/d8/d99/structshaka_1_1media_1_1mp4_1_1VTTAdditionalTextBox-members.html index 50daa3018b..2a77008e51 100644 --- a/docs/d8/d99/structshaka_1_1media_1_1mp4_1_1VTTAdditionalTextBox-members.html +++ b/docs/d8/d99/structshaka_1_1media_1_1mp4_1_1VTTAdditionalTextBox-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/d8/d9a/fragmenter_8cc_source.html b/docs/d8/d9a/fragmenter_8cc_source.html index 7ebe909aef..5f185c2eab 100644 --- a/docs/d8/d9a/fragmenter_8cc_source.html +++ b/docs/d8/d9a/fragmenter_8cc_source.html @@ -66,28 +66,28 @@ $(function() {
      fragmenter.cc
      -
      1 // Copyright 2014 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #include "packager/media/formats/mp4/fragmenter.h"
      8 
      9 #include <algorithm>
      10 #include <limits>
      11 
      12 #include "packager/media/base/audio_stream_info.h"
      13 #include "packager/media/base/buffer_writer.h"
      14 #include "packager/media/base/media_sample.h"
      15 #include "packager/media/formats/mp4/box_definitions.h"
      16 #include "packager/media/formats/mp4/key_frame_info.h"
      17 
      18 namespace shaka {
      19 namespace media {
      20 namespace mp4 {
      21 
      22 namespace {
      23 const int64_t kInvalidTime = std::numeric_limits<int64_t>::max();
      24 
      25 uint64_t GetSeekPreroll(const StreamInfo& stream_info) {
      26  if (stream_info.stream_type() != kStreamAudio)
      27  return 0;
      28  const AudioStreamInfo& audio_stream_info =
      29  static_cast<const AudioStreamInfo&>(stream_info);
      30  return audio_stream_info.seek_preroll_ns();
      31 }
      32 
      33 void NewSampleEncryptionEntry(const DecryptConfig& decrypt_config,
      34  bool use_constant_iv,
      35  TrackFragment* traf) {
      36  SampleEncryption& sample_encryption = traf->sample_encryption;
      37  SampleEncryptionEntry sample_encryption_entry;
      38  if (!use_constant_iv)
      39  sample_encryption_entry.initialization_vector = decrypt_config.iv();
      40  sample_encryption_entry.subsamples = decrypt_config.subsamples();
      41  sample_encryption.sample_encryption_entries.push_back(
      42  sample_encryption_entry);
      43  traf->auxiliary_size.sample_info_sizes.push_back(
      44  sample_encryption_entry.ComputeSize());
      45 }
      46 
      47 } // namespace
      48 
      49 Fragmenter::Fragmenter(std::shared_ptr<const StreamInfo> stream_info,
      50  TrackFragment* traf)
      51  : stream_info_(std::move(stream_info)),
      52  use_decoding_timestamp_in_timeline_(false),
      53  traf_(traf),
      54  seek_preroll_(GetSeekPreroll(*stream_info_)),
      55  fragment_initialized_(false),
      56  fragment_finalized_(false),
      57  fragment_duration_(0),
      58  earliest_presentation_time_(kInvalidTime),
      59  first_sap_time_(kInvalidTime) {
      60  DCHECK(stream_info_);
      61  DCHECK(traf);
      62 }
      63 
      64 Fragmenter::~Fragmenter() {}
      65 
      67  if (sample.duration() == 0) {
      68  LOG(WARNING) << "Unexpected sample with zero duration @ dts "
      69  << sample.dts();
      70  }
      71 
      72  if (!fragment_initialized_) {
      73  Status status = InitializeFragment(sample.dts());
      74  if (!status.ok())
      75  return status;
      76  }
      77 
      78  if (sample.side_data_size() > 0)
      79  LOG(WARNING) << "MP4 samples do not support side data. Side data ignored.";
      80 
      81  // Fill in sample parameters. It will be optimized later.
      82  traf_->runs[0].sample_sizes.push_back(
      83  static_cast<uint32_t>(sample.data_size()));
      84  traf_->runs[0].sample_durations.push_back(sample.duration());
      85  traf_->runs[0].sample_flags.push_back(
      86  sample.is_key_frame() ? 0 : TrackFragmentHeader::kNonKeySampleMask);
      87 
      88  if (sample.decrypt_config()) {
      89  NewSampleEncryptionEntry(
      90  *sample.decrypt_config(),
      91  !stream_info_->encryption_config().constant_iv.empty(), traf_);
      92  }
      93 
      94  if (stream_info_->stream_type() == StreamType::kStreamVideo &&
      95  sample.is_key_frame()) {
      96  key_frame_infos_.push_back({static_cast<uint64_t>(sample.pts()),
      97  data_->Size(), sample.data_size()});
      98  }
      99 
      100  data_->AppendArray(sample.data(), sample.data_size());
      101  fragment_duration_ += sample.duration();
      102 
      103  const int64_t pts = sample.pts();
      104  const int64_t dts = sample.dts();
      105 
      106  const int64_t timestamp = use_decoding_timestamp_in_timeline_ ? dts : pts;
      107  // Set |earliest_presentation_time_| to |timestamp| if |timestamp| is smaller
      108  // or if it is not yet initialized (kInvalidTime > timestamp is always true).
      109  if (earliest_presentation_time_ > timestamp)
      110  earliest_presentation_time_ = timestamp;
      111 
      112  traf_->runs[0].sample_composition_time_offsets.push_back(pts - dts);
      113  if (pts != dts)
      114  traf_->runs[0].flags |= TrackFragmentRun::kSampleCompTimeOffsetsPresentMask;
      115 
      116  if (sample.is_key_frame()) {
      117  if (first_sap_time_ == kInvalidTime)
      118  first_sap_time_ = pts;
      119  }
      120  return Status::OK;
      121 }
      122 
      123 Status Fragmenter::InitializeFragment(int64_t first_sample_dts) {
      124  fragment_initialized_ = true;
      125  fragment_finalized_ = false;
      126  traf_->decode_time.decode_time = first_sample_dts;
      127  traf_->runs.clear();
      128  traf_->runs.resize(1);
      129  traf_->runs[0].flags = TrackFragmentRun::kDataOffsetPresentMask;
      130  traf_->auxiliary_size.sample_info_sizes.clear();
      131  traf_->auxiliary_offset.offsets.clear();
      132  traf_->sample_encryption.sample_encryption_entries.clear();
      133  traf_->sample_group_descriptions.clear();
      134  traf_->sample_to_groups.clear();
      135  traf_->header.sample_description_index = 1; // 1-based.
      136  traf_->header.flags = TrackFragmentHeader::kDefaultBaseIsMoofMask |
      137  TrackFragmentHeader::kSampleDescriptionIndexPresentMask;
      138 
      139  fragment_duration_ = 0;
      140  earliest_presentation_time_ = kInvalidTime;
      141  first_sap_time_ = kInvalidTime;
      142  data_.reset(new BufferWriter());
      143  key_frame_infos_.clear();
      144  return Status::OK;
      145 }
      146 
      148  if (stream_info_->is_encrypted()) {
      149  Status status = FinalizeFragmentForEncryption();
      150  if (!status.ok())
      151  return status;
      152  }
      153 
      154  if (first_fragment_) {
      155  // Chrome (as of v66 https://crbug.com/398141) does not like negative values
      156  // for adjusted dts = dts + Period@start (0 for first Period)
      157  // - presentationTimeOffset
      158  // Since |earliest_presentation_time| of the first fragment will be used to
      159  // set presentationTimeOffset, the adjusted dts can become negative for the
      160  // frames in the first segment in the first Period. To avoid seeing that,
      161  // |earliest_presentation_time| is adjusted so it is not larger than the
      162  // dts.
      163  const int64_t dts = traf_->decode_time.decode_time;
      164  if (earliest_presentation_time_ > dts) {
      165  const uint64_t delta = earliest_presentation_time_ - dts;
      166  earliest_presentation_time_ = dts;
      167  fragment_duration_ += delta;
      168  }
      169  first_fragment_ = false;
      170  }
      171 
      172  // Optimize trun box.
      173  traf_->runs[0].sample_count =
      174  static_cast<uint32_t>(traf_->runs[0].sample_sizes.size());
      175  if (OptimizeSampleEntries(&traf_->runs[0].sample_durations,
      176  &traf_->header.default_sample_duration)) {
      177  traf_->header.flags |=
      178  TrackFragmentHeader::kDefaultSampleDurationPresentMask;
      179  } else {
      180  traf_->runs[0].flags |= TrackFragmentRun::kSampleDurationPresentMask;
      181  }
      182  if (OptimizeSampleEntries(&traf_->runs[0].sample_sizes,
      183  &traf_->header.default_sample_size)) {
      184  traf_->header.flags |= TrackFragmentHeader::kDefaultSampleSizePresentMask;
      185  } else {
      186  traf_->runs[0].flags |= TrackFragmentRun::kSampleSizePresentMask;
      187  }
      188  if (OptimizeSampleEntries(&traf_->runs[0].sample_flags,
      189  &traf_->header.default_sample_flags)) {
      190  traf_->header.flags |= TrackFragmentHeader::kDefaultSampleFlagsPresentMask;
      191  } else {
      192  traf_->runs[0].flags |= TrackFragmentRun::kSampleFlagsPresentMask;
      193  }
      194 
      195  // Add SampleToGroup boxes. A SampleToGroup box with grouping type of 'roll'
      196  // needs to be added if there is seek preroll, referencing sample group
      197  // description in track level; Also need to add SampleToGroup boxes
      198  // correponding to every SampleGroupDescription boxes, referencing sample
      199  // group description in fragment level.
      200  DCHECK_EQ(traf_->sample_to_groups.size(), 0u);
      201  if (seek_preroll_ > 0) {
      202  traf_->sample_to_groups.resize(traf_->sample_to_groups.size() + 1);
      203  SampleToGroup& sample_to_group = traf_->sample_to_groups.back();
      204  sample_to_group.grouping_type = FOURCC_roll;
      205 
      206  sample_to_group.entries.resize(1);
      207  SampleToGroupEntry& sample_to_group_entry = sample_to_group.entries.back();
      208  sample_to_group_entry.sample_count = traf_->runs[0].sample_count;
      209  sample_to_group_entry.group_description_index =
      210  SampleToGroupEntry::kTrackGroupDescriptionIndexBase + 1;
      211  }
      212  for (const auto& sample_group_description :
      213  traf_->sample_group_descriptions) {
      214  traf_->sample_to_groups.resize(traf_->sample_to_groups.size() + 1);
      215  SampleToGroup& sample_to_group = traf_->sample_to_groups.back();
      216  sample_to_group.grouping_type = sample_group_description.grouping_type;
      217 
      218  sample_to_group.entries.resize(1);
      219  SampleToGroupEntry& sample_to_group_entry = sample_to_group.entries.back();
      220  sample_to_group_entry.sample_count = traf_->runs[0].sample_count;
      221  sample_to_group_entry.group_description_index =
      222  SampleToGroupEntry::kTrackFragmentGroupDescriptionIndexBase + 1;
      223  }
      224 
      225  fragment_finalized_ = true;
      226  fragment_initialized_ = false;
      227  return Status::OK;
      228 }
      229 
      231  // NOTE: Daisy chain is not supported currently.
      232  reference->reference_type = false;
      233  reference->subsegment_duration = fragment_duration_;
      234  reference->starts_with_sap = StartsWithSAP();
      235  if (kInvalidTime == first_sap_time_) {
      236  reference->sap_type = SegmentReference::TypeUnknown;
      237  reference->sap_delta_time = 0;
      238  } else {
      239  reference->sap_type = SegmentReference::Type1;
      240  reference->sap_delta_time = first_sap_time_ - earliest_presentation_time_;
      241  }
      242  reference->earliest_presentation_time = earliest_presentation_time_;
      243 }
      244 
      245 Status Fragmenter::FinalizeFragmentForEncryption() {
      246  SampleEncryption& sample_encryption = traf_->sample_encryption;
      247  if (sample_encryption.sample_encryption_entries.empty()) {
      248  // This fragment is not encrypted.
      249  // There are two sample description entries, an encrypted entry and a clear
      250  // entry, are generated. The 1-based clear entry index is always 2.
      251  const uint32_t kClearSampleDescriptionIndex = 2;
      252  traf_->header.sample_description_index = kClearSampleDescriptionIndex;
      253  return Status::OK;
      254  }
      255  if (sample_encryption.sample_encryption_entries.size() !=
      256  traf_->runs[0].sample_sizes.size()) {
      257  LOG(ERROR) << "Partially encrypted segment is not supported";
      258  return Status(error::MUXER_FAILURE,
      259  "Partially encrypted segment is not supported.");
      260  }
      261 
      262  const SampleEncryptionEntry& sample_encryption_entry =
      263  sample_encryption.sample_encryption_entries.front();
      264  const bool use_subsample_encryption =
      265  !sample_encryption_entry.subsamples.empty();
      266  if (use_subsample_encryption)
      267  traf_->sample_encryption.flags |= SampleEncryption::kUseSubsampleEncryption;
      268  traf_->sample_encryption.iv_size = static_cast<uint8_t>(
      269  sample_encryption_entry.initialization_vector.size());
      270 
      271  // The offset will be adjusted in Segmenter after knowing moof size.
      272  traf_->auxiliary_offset.offsets.push_back(0);
      273 
      274  // Optimize saiz box.
      275  SampleAuxiliaryInformationSize& saiz = traf_->auxiliary_size;
      276  saiz.sample_count = static_cast<uint32_t>(saiz.sample_info_sizes.size());
      277  DCHECK_EQ(saiz.sample_info_sizes.size(),
      278  traf_->sample_encryption.sample_encryption_entries.size());
      279  if (!OptimizeSampleEntries(&saiz.sample_info_sizes,
      280  &saiz.default_sample_info_size)) {
      281  saiz.default_sample_info_size = 0;
      282  }
      283 
      284  // It should only happen with full sample encryption + constant iv, i.e.
      285  // 'cbcs' applying to audio.
      286  if (saiz.default_sample_info_size == 0 && saiz.sample_info_sizes.empty()) {
      287  DCHECK(!use_subsample_encryption);
      288  // ISO/IEC 23001-7:2016(E) The sample auxiliary information would then be
      289  // empty and should be omitted. Clear saiz and saio boxes so they are not
      290  // written.
      291  saiz.sample_count = 0;
      292  traf_->auxiliary_offset.offsets.clear();
      293  }
      294  return Status::OK;
      295 }
      296 
      297 bool Fragmenter::StartsWithSAP() const {
      298  DCHECK(!traf_->runs.empty());
      299  uint32_t start_sample_flag;
      300  if (traf_->runs[0].flags & TrackFragmentRun::kSampleFlagsPresentMask) {
      301  DCHECK(!traf_->runs[0].sample_flags.empty());
      302  start_sample_flag = traf_->runs[0].sample_flags[0];
      303  } else {
      304  DCHECK(traf_->header.flags &
      305  TrackFragmentHeader::kDefaultSampleFlagsPresentMask);
      306  start_sample_flag = traf_->header.default_sample_flags;
      307  }
      308  return (start_sample_flag & TrackFragmentHeader::kNonKeySampleMask) == 0;
      309 }
      310 
      311 } // namespace mp4
      312 } // namespace media
      313 } // namespace shaka
      - - +
      1 // Copyright 2014 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #include "packager/media/formats/mp4/fragmenter.h"
      8 
      9 #include <algorithm>
      10 #include <limits>
      11 
      12 #include "packager/media/base/audio_stream_info.h"
      13 #include "packager/media/base/buffer_writer.h"
      14 #include "packager/media/base/media_sample.h"
      15 #include "packager/media/formats/mp4/box_definitions.h"
      16 #include "packager/media/formats/mp4/key_frame_info.h"
      17 
      18 namespace shaka {
      19 namespace media {
      20 namespace mp4 {
      21 
      22 namespace {
      23 const int64_t kInvalidTime = std::numeric_limits<int64_t>::max();
      24 
      25 uint64_t GetSeekPreroll(const StreamInfo& stream_info) {
      26  if (stream_info.stream_type() != kStreamAudio)
      27  return 0;
      28  const AudioStreamInfo& audio_stream_info =
      29  static_cast<const AudioStreamInfo&>(stream_info);
      30  return audio_stream_info.seek_preroll_ns();
      31 }
      32 
      33 void NewSampleEncryptionEntry(const DecryptConfig& decrypt_config,
      34  bool use_constant_iv,
      35  TrackFragment* traf) {
      36  SampleEncryption& sample_encryption = traf->sample_encryption;
      37  SampleEncryptionEntry sample_encryption_entry;
      38  if (!use_constant_iv)
      39  sample_encryption_entry.initialization_vector = decrypt_config.iv();
      40  sample_encryption_entry.subsamples = decrypt_config.subsamples();
      41  sample_encryption.sample_encryption_entries.push_back(
      42  sample_encryption_entry);
      43  traf->auxiliary_size.sample_info_sizes.push_back(
      44  sample_encryption_entry.ComputeSize());
      45 }
      46 
      47 } // namespace
      48 
      49 Fragmenter::Fragmenter(std::shared_ptr<const StreamInfo> stream_info,
      50  TrackFragment* traf)
      51  : stream_info_(std::move(stream_info)),
      52  use_decoding_timestamp_in_timeline_(false),
      53  traf_(traf),
      54  seek_preroll_(GetSeekPreroll(*stream_info_)),
      55  fragment_initialized_(false),
      56  fragment_finalized_(false),
      57  fragment_duration_(0),
      58  earliest_presentation_time_(kInvalidTime),
      59  first_sap_time_(kInvalidTime) {
      60  DCHECK(stream_info_);
      61  DCHECK(traf);
      62 }
      63 
      64 Fragmenter::~Fragmenter() {}
      65 
      67  if (sample.duration() == 0) {
      68  LOG(WARNING) << "Unexpected sample with zero duration @ dts "
      69  << sample.dts();
      70  }
      71 
      72  if (!fragment_initialized_) {
      73  Status status = InitializeFragment(sample.dts());
      74  if (!status.ok())
      75  return status;
      76  }
      77 
      78  if (sample.side_data_size() > 0)
      79  LOG(WARNING) << "MP4 samples do not support side data. Side data ignored.";
      80 
      81  // Fill in sample parameters. It will be optimized later.
      82  traf_->runs[0].sample_sizes.push_back(
      83  static_cast<uint32_t>(sample.data_size()));
      84  traf_->runs[0].sample_durations.push_back(sample.duration());
      85  traf_->runs[0].sample_flags.push_back(
      86  sample.is_key_frame() ? 0 : TrackFragmentHeader::kNonKeySampleMask);
      87 
      88  if (sample.decrypt_config()) {
      89  NewSampleEncryptionEntry(
      90  *sample.decrypt_config(),
      91  !stream_info_->encryption_config().constant_iv.empty(), traf_);
      92  }
      93 
      94  if (stream_info_->stream_type() == StreamType::kStreamVideo &&
      95  sample.is_key_frame()) {
      96  key_frame_infos_.push_back({static_cast<uint64_t>(sample.pts()),
      97  data_->Size(), sample.data_size()});
      98  }
      99 
      100  data_->AppendArray(sample.data(), sample.data_size());
      101  fragment_duration_ += sample.duration();
      102 
      103  const int64_t pts = sample.pts();
      104  const int64_t dts = sample.dts();
      105 
      106  const int64_t timestamp = use_decoding_timestamp_in_timeline_ ? dts : pts;
      107  // Set |earliest_presentation_time_| to |timestamp| if |timestamp| is smaller
      108  // or if it is not yet initialized (kInvalidTime > timestamp is always true).
      109  if (earliest_presentation_time_ > timestamp)
      110  earliest_presentation_time_ = timestamp;
      111 
      112  traf_->runs[0].sample_composition_time_offsets.push_back(pts - dts);
      113  if (pts != dts)
      114  traf_->runs[0].flags |= TrackFragmentRun::kSampleCompTimeOffsetsPresentMask;
      115 
      116  if (sample.is_key_frame()) {
      117  if (first_sap_time_ == kInvalidTime)
      118  first_sap_time_ = pts;
      119  }
      120  return Status::OK;
      121 }
      122 
      123 Status Fragmenter::InitializeFragment(int64_t first_sample_dts) {
      124  fragment_initialized_ = true;
      125  fragment_finalized_ = false;
      126  traf_->decode_time.decode_time = first_sample_dts;
      127  traf_->runs.clear();
      128  traf_->runs.resize(1);
      129  traf_->runs[0].flags = TrackFragmentRun::kDataOffsetPresentMask;
      130  traf_->auxiliary_size.sample_info_sizes.clear();
      131  traf_->auxiliary_offset.offsets.clear();
      132  traf_->sample_encryption.sample_encryption_entries.clear();
      133  traf_->sample_group_descriptions.clear();
      134  traf_->sample_to_groups.clear();
      135  traf_->header.sample_description_index = 1; // 1-based.
      136  traf_->header.flags = TrackFragmentHeader::kDefaultBaseIsMoofMask |
      137  TrackFragmentHeader::kSampleDescriptionIndexPresentMask;
      138 
      139  fragment_duration_ = 0;
      140  earliest_presentation_time_ = kInvalidTime;
      141  first_sap_time_ = kInvalidTime;
      142  data_.reset(new BufferWriter());
      143  key_frame_infos_.clear();
      144  return Status::OK;
      145 }
      146 
      148  if (stream_info_->is_encrypted()) {
      149  Status status = FinalizeFragmentForEncryption();
      150  if (!status.ok())
      151  return status;
      152  }
      153 
      154  if (first_fragment_) {
      155  if (allow_adjust_earliest_presentation_time_) {
      156  // Chrome (as of v66 https://crbug.com/398141) does not like negative
      157  // values for adjusted dts = dts + Period@start (0 for first Period)
      158  // - presentationTimeOffset
      159  // Since |earliest_presentation_time| of the first fragment will be used
      160  // to set presentationTimeOffset, the adjusted dts can become negative for
      161  // the frames in the first segment in the first Period. To avoid seeing
      162  // that, |earliest_presentation_time| is adjusted so it is not larger than
      163  // the dts.
      164  const int64_t dts = traf_->decode_time.decode_time;
      165  if (earliest_presentation_time_ > dts) {
      166  const uint64_t delta = earliest_presentation_time_ - dts;
      167  earliest_presentation_time_ = dts;
      168  fragment_duration_ += delta;
      169  }
      170  }
      171  first_fragment_ = false;
      172  }
      173 
      174  // Optimize trun box.
      175  traf_->runs[0].sample_count =
      176  static_cast<uint32_t>(traf_->runs[0].sample_sizes.size());
      177  if (OptimizeSampleEntries(&traf_->runs[0].sample_durations,
      178  &traf_->header.default_sample_duration)) {
      179  traf_->header.flags |=
      180  TrackFragmentHeader::kDefaultSampleDurationPresentMask;
      181  } else {
      182  traf_->runs[0].flags |= TrackFragmentRun::kSampleDurationPresentMask;
      183  }
      184  if (OptimizeSampleEntries(&traf_->runs[0].sample_sizes,
      185  &traf_->header.default_sample_size)) {
      186  traf_->header.flags |= TrackFragmentHeader::kDefaultSampleSizePresentMask;
      187  } else {
      188  traf_->runs[0].flags |= TrackFragmentRun::kSampleSizePresentMask;
      189  }
      190  if (OptimizeSampleEntries(&traf_->runs[0].sample_flags,
      191  &traf_->header.default_sample_flags)) {
      192  traf_->header.flags |= TrackFragmentHeader::kDefaultSampleFlagsPresentMask;
      193  } else {
      194  traf_->runs[0].flags |= TrackFragmentRun::kSampleFlagsPresentMask;
      195  }
      196 
      197  // Add SampleToGroup boxes. A SampleToGroup box with grouping type of 'roll'
      198  // needs to be added if there is seek preroll, referencing sample group
      199  // description in track level; Also need to add SampleToGroup boxes
      200  // correponding to every SampleGroupDescription boxes, referencing sample
      201  // group description in fragment level.
      202  DCHECK_EQ(traf_->sample_to_groups.size(), 0u);
      203  if (seek_preroll_ > 0) {
      204  traf_->sample_to_groups.resize(traf_->sample_to_groups.size() + 1);
      205  SampleToGroup& sample_to_group = traf_->sample_to_groups.back();
      206  sample_to_group.grouping_type = FOURCC_roll;
      207 
      208  sample_to_group.entries.resize(1);
      209  SampleToGroupEntry& sample_to_group_entry = sample_to_group.entries.back();
      210  sample_to_group_entry.sample_count = traf_->runs[0].sample_count;
      211  sample_to_group_entry.group_description_index =
      212  SampleToGroupEntry::kTrackGroupDescriptionIndexBase + 1;
      213  }
      214  for (const auto& sample_group_description :
      215  traf_->sample_group_descriptions) {
      216  traf_->sample_to_groups.resize(traf_->sample_to_groups.size() + 1);
      217  SampleToGroup& sample_to_group = traf_->sample_to_groups.back();
      218  sample_to_group.grouping_type = sample_group_description.grouping_type;
      219 
      220  sample_to_group.entries.resize(1);
      221  SampleToGroupEntry& sample_to_group_entry = sample_to_group.entries.back();
      222  sample_to_group_entry.sample_count = traf_->runs[0].sample_count;
      223  sample_to_group_entry.group_description_index =
      224  SampleToGroupEntry::kTrackFragmentGroupDescriptionIndexBase + 1;
      225  }
      226 
      227  fragment_finalized_ = true;
      228  fragment_initialized_ = false;
      229  return Status::OK;
      230 }
      231 
      233  // NOTE: Daisy chain is not supported currently.
      234  reference->reference_type = false;
      235  reference->subsegment_duration = fragment_duration_;
      236  reference->starts_with_sap = StartsWithSAP();
      237  if (kInvalidTime == first_sap_time_) {
      238  reference->sap_type = SegmentReference::TypeUnknown;
      239  reference->sap_delta_time = 0;
      240  } else {
      241  reference->sap_type = SegmentReference::Type1;
      242  reference->sap_delta_time = first_sap_time_ - earliest_presentation_time_;
      243  }
      244  reference->earliest_presentation_time = earliest_presentation_time_;
      245 }
      246 
      247 Status Fragmenter::FinalizeFragmentForEncryption() {
      248  SampleEncryption& sample_encryption = traf_->sample_encryption;
      249  if (sample_encryption.sample_encryption_entries.empty()) {
      250  // This fragment is not encrypted.
      251  // There are two sample description entries, an encrypted entry and a clear
      252  // entry, are generated. The 1-based clear entry index is always 2.
      253  const uint32_t kClearSampleDescriptionIndex = 2;
      254  traf_->header.sample_description_index = kClearSampleDescriptionIndex;
      255  return Status::OK;
      256  }
      257  if (sample_encryption.sample_encryption_entries.size() !=
      258  traf_->runs[0].sample_sizes.size()) {
      259  LOG(ERROR) << "Partially encrypted segment is not supported";
      260  return Status(error::MUXER_FAILURE,
      261  "Partially encrypted segment is not supported.");
      262  }
      263 
      264  const SampleEncryptionEntry& sample_encryption_entry =
      265  sample_encryption.sample_encryption_entries.front();
      266  const bool use_subsample_encryption =
      267  !sample_encryption_entry.subsamples.empty();
      268  if (use_subsample_encryption)
      269  traf_->sample_encryption.flags |= SampleEncryption::kUseSubsampleEncryption;
      270  traf_->sample_encryption.iv_size = static_cast<uint8_t>(
      271  sample_encryption_entry.initialization_vector.size());
      272 
      273  // The offset will be adjusted in Segmenter after knowing moof size.
      274  traf_->auxiliary_offset.offsets.push_back(0);
      275 
      276  // Optimize saiz box.
      277  SampleAuxiliaryInformationSize& saiz = traf_->auxiliary_size;
      278  saiz.sample_count = static_cast<uint32_t>(saiz.sample_info_sizes.size());
      279  DCHECK_EQ(saiz.sample_info_sizes.size(),
      280  traf_->sample_encryption.sample_encryption_entries.size());
      281  if (!OptimizeSampleEntries(&saiz.sample_info_sizes,
      282  &saiz.default_sample_info_size)) {
      283  saiz.default_sample_info_size = 0;
      284  }
      285 
      286  // It should only happen with full sample encryption + constant iv, i.e.
      287  // 'cbcs' applying to audio.
      288  if (saiz.default_sample_info_size == 0 && saiz.sample_info_sizes.empty()) {
      289  DCHECK(!use_subsample_encryption);
      290  // ISO/IEC 23001-7:2016(E) The sample auxiliary information would then be
      291  // empty and should be omitted. Clear saiz and saio boxes so they are not
      292  // written.
      293  saiz.sample_count = 0;
      294  traf_->auxiliary_offset.offsets.clear();
      295  }
      296  return Status::OK;
      297 }
      298 
      299 bool Fragmenter::StartsWithSAP() const {
      300  DCHECK(!traf_->runs.empty());
      301  uint32_t start_sample_flag;
      302  if (traf_->runs[0].flags & TrackFragmentRun::kSampleFlagsPresentMask) {
      303  DCHECK(!traf_->runs[0].sample_flags.empty());
      304  start_sample_flag = traf_->runs[0].sample_flags[0];
      305  } else {
      306  DCHECK(traf_->header.flags &
      307  TrackFragmentHeader::kDefaultSampleFlagsPresentMask);
      308  start_sample_flag = traf_->header.default_sample_flags;
      309  }
      310  return (start_sample_flag & TrackFragmentHeader::kNonKeySampleMask) == 0;
      311 }
      312 
      313 } // namespace mp4
      314 } // namespace media
      315 } // namespace shaka
      + +
      STL namespace.
      All the methods that are virtual are virtual for mocking.
      Status InitializeFragment(int64_t first_sample_dts)
      Definition: fragmenter.cc:123
      -
      void GenerateSegmentReference(SegmentReference *reference) const
      Fill reference with current fragment information.
      Definition: fragmenter.cc:230
      +
      void GenerateSegmentReference(SegmentReference *reference) const
      Fill reference with current fragment information.
      Definition: fragmenter.cc:232
      Fragmenter(std::shared_ptr< const StreamInfo > info, TrackFragment *traf)
      Definition: fragmenter.cc:49
      Status AddSample(const MediaSample &sample)
      Definition: fragmenter.cc:66
      - +
      Class to hold a media sample.
      Definition: media_sample.h:22
      - - - + + +
      Status FinalizeFragment()
      Finalize and optimize the fragment.
      Definition: fragmenter.cc:147
      -
      bool OptimizeSampleEntries(std::vector< T > *entries, T *default_value)
      Definition: fragmenter.h:111
      +
      bool OptimizeSampleEntries(std::vector< T > *entries, T *default_value)
      Definition: fragmenter.h:121
      diff --git a/docs/d8/d9c/webm__tracks__parser_8cc_source.html b/docs/d8/d9c/webm__tracks__parser_8cc_source.html index 3b052de525..89b6db9b90 100644 --- a/docs/d8/d9c/webm__tracks__parser_8cc_source.html +++ b/docs/d8/d9c/webm__tracks__parser_8cc_source.html @@ -78,7 +78,7 @@ $(function() {
      diff --git a/docs/d8/d9f/udp__file_8h_source.html b/docs/d8/d9f/udp__file_8h_source.html index 4f45470884..accff9f4ee 100644 --- a/docs/d8/d9f/udp__file_8h_source.html +++ b/docs/d8/d9f/udp__file_8h_source.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/d8/da3/classshaka_1_1media_1_1DecryptorSource-members.html b/docs/d8/da3/classshaka_1_1media_1_1DecryptorSource-members.html index 945d8aa4b1..1e0fdaa82b 100644 --- a/docs/d8/da3/classshaka_1_1media_1_1DecryptorSource-members.html +++ b/docs/d8/da3/classshaka_1_1media_1_1DecryptorSource-members.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d8/da5/structshaka_1_1media_1_1mp4_1_1SampleSize-members.html b/docs/d8/da5/structshaka_1_1media_1_1mp4_1_1SampleSize-members.html index 56e2bc5120..9d7c7d7933 100644 --- a/docs/d8/da5/structshaka_1_1media_1_1mp4_1_1SampleSize-members.html +++ b/docs/d8/da5/structshaka_1_1media_1_1mp4_1_1SampleSize-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/docs/d8/da6/classshaka_1_1media_1_1NaluReader-members.html b/docs/d8/da6/classshaka_1_1media_1_1NaluReader-members.html index e1e56e3839..ed0557b6cc 100644 --- a/docs/d8/da6/classshaka_1_1media_1_1NaluReader-members.html +++ b/docs/d8/da6/classshaka_1_1media_1_1NaluReader-members.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/d8/daa/stream__info_8h_source.html b/docs/d8/daa/stream__info_8h_source.html index 2674538fd9..0bf73d610b 100644 --- a/docs/d8/daa/stream__info_8h_source.html +++ b/docs/d8/daa/stream__info_8h_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d8/daf/namespaceshaka.html b/docs/d8/daf/namespaceshaka.html index 01d0118509..2a6772bb5c 100644 --- a/docs/d8/daf/namespaceshaka.html +++ b/docs/d8/daf/namespaceshaka.html @@ -831,7 +831,7 @@ template<class FlagType > diff --git a/docs/d8/db7/classshaka_1_1media_1_1mp4_1_1MultiSegmentSegmenter.html b/docs/d8/db7/classshaka_1_1media_1_1mp4_1_1MultiSegmentSegmenter.html index dedee0f4de..bab11052eb 100644 --- a/docs/d8/db7/classshaka_1_1media_1_1mp4_1_1MultiSegmentSegmenter.html +++ b/docs/d8/db7/classshaka_1_1media_1_1mp4_1_1MultiSegmentSegmenter.html @@ -247,7 +247,7 @@ void set_progress_target diff --git a/docs/d8/db9/classshaka_1_1media_1_1WebMContentEncodingsClient-members.html b/docs/d8/db9/classshaka_1_1media_1_1WebMContentEncodingsClient-members.html index 4fd7fc40ae..328f7d47fe 100644 --- a/docs/d8/db9/classshaka_1_1media_1_1WebMContentEncodingsClient-members.html +++ b/docs/d8/db9/classshaka_1_1media_1_1WebMContentEncodingsClient-members.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/d8/dbf/classshaka_1_1media_1_1PsshGenerator.html b/docs/d8/dbf/classshaka_1_1media_1_1PsshGenerator.html index 800bd4efbf..a9ac719752 100644 --- a/docs/d8/dbf/classshaka_1_1media_1_1PsshGenerator.html +++ b/docs/d8/dbf/classshaka_1_1media_1_1PsshGenerator.html @@ -210,7 +210,7 @@ Public Member Functions diff --git a/docs/d8/dc2/classshaka_1_1media_1_1Replicator-members.html b/docs/d8/dc2/classshaka_1_1media_1_1Replicator-members.html index 6fccc5ec51..29c43435fd 100644 --- a/docs/d8/dc2/classshaka_1_1media_1_1Replicator-members.html +++ b/docs/d8/dc2/classshaka_1_1media_1_1Replicator-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/docs/d8/dc2/structshaka_1_1media_1_1mp2t_1_1EsParserH26x_1_1VideoSliceInfo.html b/docs/d8/dc2/structshaka_1_1media_1_1mp2t_1_1EsParserH26x_1_1VideoSliceInfo.html index 0708c3b656..ecac21b205 100644 --- a/docs/d8/dc2/structshaka_1_1media_1_1mp2t_1_1EsParserH26x_1_1VideoSliceInfo.html +++ b/docs/d8/dc2/structshaka_1_1media_1_1mp2t_1_1EsParserH26x_1_1VideoSliceInfo.html @@ -94,7 +94,7 @@ int frame_num = 0 diff --git a/docs/d8/dc3/structshaka_1_1media_1_1mp4_1_1CueTimeBox.html b/docs/d8/dc3/structshaka_1_1media_1_1mp4_1_1CueTimeBox.html index 134e6ec3ae..44f132a982 100644 --- a/docs/d8/dc3/structshaka_1_1media_1_1mp4_1_1CueTimeBox.html +++ b/docs/d8/dc3/structshaka_1_1media_1_1mp4_1_1CueTimeBox.html @@ -112,7 +112,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 792 of file box_definitions.h.

      +

      Definition at line 802 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -140,7 +140,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 2600 of file box_definitions.cc.

      +

      Definition at line 2672 of file box_definitions.cc.

      @@ -151,7 +151,7 @@ Additional Inherited Members diff --git a/docs/d8/dc6/classshaka_1_1media_1_1PeekingReader.html b/docs/d8/dc6/classshaka_1_1media_1_1PeekingReader.html index 1b1984ab58..baeb554143 100644 --- a/docs/d8/dc6/classshaka_1_1media_1_1PeekingReader.html +++ b/docs/d8/dc6/classshaka_1_1media_1_1PeekingReader.html @@ -92,7 +92,7 @@ bool Next (char *out)< diff --git a/docs/d8/dca/ts__writer_8h_source.html b/docs/d8/dca/ts__writer_8h_source.html index 07a0eb55a3..3e0446b06e 100644 --- a/docs/d8/dca/ts__writer_8h_source.html +++ b/docs/d8/dca/ts__writer_8h_source.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d8/dcd/structshaka_1_1media_1_1mp4_1_1DecodingTime-members.html b/docs/d8/dcd/structshaka_1_1media_1_1mp4_1_1DecodingTime-members.html index f24f58c22b..6d605dd236 100644 --- a/docs/d8/dcd/structshaka_1_1media_1_1mp4_1_1DecodingTime-members.html +++ b/docs/d8/dcd/structshaka_1_1media_1_1mp4_1_1DecodingTime-members.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d8/dcd/structshaka_1_1media_1_1mp4_1_1TrackExtends-members.html b/docs/d8/dcd/structshaka_1_1media_1_1mp4_1_1TrackExtends-members.html index 666b21b1d0..7d873cd458 100644 --- a/docs/d8/dcd/structshaka_1_1media_1_1mp4_1_1TrackExtends-members.html +++ b/docs/d8/dcd/structshaka_1_1media_1_1mp4_1_1TrackExtends-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/docs/d1/dac/classshaka_1_1media_1_1DisplayActionCompare-members.html b/docs/d8/dd2/classshaka_1_1media_1_1WebVttFileBuffer-members.html similarity index 50% rename from docs/d1/dac/classshaka_1_1media_1_1DisplayActionCompare-members.html rename to docs/d8/dd2/classshaka_1_1media_1_1WebVttFileBuffer-members.html index bb21f93de7..662a65255d 100644 --- a/docs/d1/dac/classshaka_1_1media_1_1DisplayActionCompare-members.html +++ b/docs/d8/dd2/classshaka_1_1media_1_1WebVttFileBuffer-members.html @@ -58,22 +58,27 @@ $(function() {
    -
    shaka::media::DisplayActionCompare Member List
    +
    shaka::media::WebVttFileBuffer Member List
    -

    This is the complete list of members for shaka::media::DisplayActionCompare, including all inherited members.

    +

    This is the complete list of members for shaka::media::WebVttFileBuffer, including all inherited members.

    - + + + + + +
    operator()(const std::shared_ptr< DisplayAction > &left, const std::shared_ptr< DisplayAction > &right) const (defined in shaka::media::DisplayActionCompare)shaka::media::DisplayActionCompare
    Append(const TextSample &sample) (defined in shaka::media::WebVttFileBuffer)shaka::media::WebVttFileBuffer
    Reset() (defined in shaka::media::WebVttFileBuffer)shaka::media::WebVttFileBuffer
    sample_count() const (defined in shaka::media::WebVttFileBuffer)shaka::media::WebVttFileBufferinline
    WebVttFileBuffer() (defined in shaka::media::WebVttFileBuffer)shaka::media::WebVttFileBuffer
    WriteTo(File *file) (defined in shaka::media::WebVttFileBuffer)shaka::media::WebVttFileBuffer
    ~WebVttFileBuffer()=default (defined in shaka::media::WebVttFileBuffer)shaka::media::WebVttFileBuffervirtual
    diff --git a/docs/d8/dd6/classshaka_1_1media_1_1mp2t_1_1ContinuityCounter.html b/docs/d8/dd6/classshaka_1_1media_1_1mp2t_1_1ContinuityCounter.html index 187c21d06c..c03c3c2d22 100644 --- a/docs/d8/dd6/classshaka_1_1media_1_1mp2t_1_1ContinuityCounter.html +++ b/docs/d8/dd6/classshaka_1_1media_1_1mp2t_1_1ContinuityCounter.html @@ -106,7 +106,7 @@ Public Member Functions diff --git a/docs/d8/dd6/structshaka_1_1media_1_1mp4_1_1CencSampleEncryptionInfoEntry.html b/docs/d8/dd6/structshaka_1_1media_1_1mp4_1_1CencSampleEncryptionInfoEntry.html index a86b709d91..a707e30ee2 100644 --- a/docs/d8/dd6/structshaka_1_1media_1_1mp4_1_1CencSampleEncryptionInfoEntry.html +++ b/docs/d8/dd6/structshaka_1_1media_1_1mp4_1_1CencSampleEncryptionInfoEntry.html @@ -83,19 +83,19 @@ uint32_t ComputeSize (

    Public Attributes

    -uint8_t is_protected +uint8_t is_protected = 0u   -uint8_t per_sample_iv_size +uint8_t per_sample_iv_size = 0u   std::vector< uint8_t > key_id   -uint8_t crypt_byte_block +uint8_t crypt_byte_block = 0u   -uint8_t skip_byte_block +uint8_t skip_byte_block = 0u   std::vector< uint8_t > constant_iv @@ -103,7 +103,7 @@ std::vector< uint8_t > 

    Detailed Description

    -

    Definition at line 477 of file box_definitions.h.

    +

    Definition at line 488 of file box_definitions.h.


    The documentation for this struct was generated from the following files:
    • packager/media/formats/mp4/box_definitions.h
    • packager/media/formats/mp4/box_definitions.cc
    • @@ -111,7 +111,7 @@ std::vector< uint8_t >  diff --git a/docs/d8/de1/classshaka_1_1Period.html b/docs/d8/de1/classshaka_1_1Period.html index e2b925d193..a90a31d45d 100644 --- a/docs/d8/de1/classshaka_1_1Period.html +++ b/docs/d8/de1/classshaka_1_1Period.html @@ -224,7 +224,7 @@ class PeriodTest<
      Returns
      The list of AdaptationSets in this Period.
      -

      Definition at line 126 of file period.cc.

      +

      Definition at line 131 of file period.cc.

      @@ -291,7 +291,7 @@ class PeriodTest<

      Generates <Period> xml element with its child AdaptationSet elements.

      Returns
      On success returns a non-NULL scoped_xml_ptr. Otherwise returns a NULL scoped_xml_ptr.
      -

      Definition at line 94 of file period.cc.

      +

      Definition at line 99 of file period.cc.

      @@ -330,7 +330,7 @@ class PeriodTest< diff --git a/docs/d8/de1/classshaka_1_1SimpleMpdNotifier.html b/docs/d8/de1/classshaka_1_1SimpleMpdNotifier.html index 0dffa44de7..a085f13416 100644 --- a/docs/d8/de1/classshaka_1_1SimpleMpdNotifier.html +++ b/docs/d8/de1/classshaka_1_1SimpleMpdNotifier.html @@ -508,7 +508,7 @@ class SimpleMpdNotifierTes diff --git a/docs/d8/de6/webm__crypto__helpers_8h_source.html b/docs/d8/de6/webm__crypto__helpers_8h_source.html index e843190850..da7f425d2b 100644 --- a/docs/d8/de6/webm__crypto__helpers_8h_source.html +++ b/docs/d8/de6/webm__crypto__helpers_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d8/deb/classshaka_1_1media_1_1mp2t_1_1EsParser-members.html b/docs/d8/deb/classshaka_1_1media_1_1mp2t_1_1EsParser-members.html index accb88e49a..b7df3a8bfb 100644 --- a/docs/d8/deb/classshaka_1_1media_1_1mp2t_1_1EsParser-members.html +++ b/docs/d8/deb/classshaka_1_1media_1_1mp2t_1_1EsParser-members.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/d8/deb/retired__flags_8cc_source.html b/docs/d8/deb/retired__flags_8cc_source.html index 47d675033e..c46a726b4a 100644 --- a/docs/d8/deb/retired__flags_8cc_source.html +++ b/docs/d8/deb/retired__flags_8cc_source.html @@ -69,7 +69,7 @@ $(function() {
      1 // Copyright 2017 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 //
      7 // Defines retired / deprecated flags. These flags will be removed in later
      8 // versions.
      9 
      10 #include "packager/app/retired_flags.h"
      11 
      12 #include <stdio.h>
      13 
      14 DEFINE_string(profile, "", "This flag is deprecated. Do not use.");
      15 DEFINE_bool(single_segment, true, "This flag is deprecated. Do not use.");
      16 DEFINE_bool(webm_subsample_encryption,
      17  true,
      18  "This flag is deprecated. Use vp9_subsample_encryption instead.");
      19 DEFINE_double(availability_time_offset,
      20  0,
      21  "This flag is deprecated. Use suggested_presentation_delay "
      22  "instead which can achieve similar effect.");
      23 DEFINE_string(playready_key_id,
      24  "",
      25  "This flag is deprecated. Use --enable_raw_key_encryption with "
      26  "--generate_playready_pssh to generate PlayReady PSSH.");
      27 DEFINE_string(playready_key,
      28  "",
      29  "This flag is deprecated. Use --enable_raw_key_encryption with "
      30  "--generate_playready_pssh to generate PlayReady PSSH.");
      31 
      32 // The current gflags library does not provide a way to check whether a flag is
      33 // set in command line. If a flag has a different value to its default value,
      34 // the flag must have been set. It is possible that the flag is set to the same
      35 // value as its default value though.
      36 bool InformRetiredStringFlag(const char* flagname, const std::string& value) {
      37  if (!value.empty())
      38  fprintf(stderr, "WARNING: %s is deprecated and ignored.\n", flagname);
      39  return true;
      40 }
      41 
      42 bool InformRetiredDefaultTrueFlag(const char* flagname, bool value) {
      43  if (!value)
      44  fprintf(stderr, "WARNING: %s is deprecated and ignored.\n", flagname);
      45  return true;
      46 }
      47 
      48 bool InformRetiredDefaultDoubleFlag(const char* flagname, double value) {
      49  if (value != 0)
      50  fprintf(stderr, "WARNING: %s is deprecated and ignored.\n", flagname);
      51  return true;
      52 }
      53 
      54 DEFINE_validator(profile, &InformRetiredStringFlag);
      55 DEFINE_validator(single_segment, &InformRetiredDefaultTrueFlag);
      56 DEFINE_validator(webm_subsample_encryption, &InformRetiredDefaultTrueFlag);
      57 DEFINE_validator(availability_time_offset, &InformRetiredDefaultDoubleFlag);
      58 DEFINE_validator(playready_key_id, &InformRetiredStringFlag);
      59 DEFINE_validator(playready_key, &InformRetiredStringFlag);
      diff --git a/docs/d8/dee/classshaka_1_1media_1_1AudioTimestampHelper-members.html b/docs/d8/dee/classshaka_1_1media_1_1AudioTimestampHelper-members.html index 2f340d7ddb..9044f2bd9c 100644 --- a/docs/d8/dee/classshaka_1_1media_1_1AudioTimestampHelper-members.html +++ b/docs/d8/dee/classshaka_1_1media_1_1AudioTimestampHelper-members.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/d8/dee/classshaka_1_1media_1_1VPxParser-members.html b/docs/d8/dee/classshaka_1_1media_1_1VPxParser-members.html index 1d6683eea8..3995ab95d1 100644 --- a/docs/d8/dee/classshaka_1_1media_1_1VPxParser-members.html +++ b/docs/d8/dee/classshaka_1_1media_1_1VPxParser-members.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d8/df0/webm_2single__segment__segmenter_8cc_source.html b/docs/d8/df0/webm_2single__segment__segmenter_8cc_source.html index 30186a01af..7a189a0231 100644 --- a/docs/d8/df0/webm_2single__segment__segmenter_8cc_source.html +++ b/docs/d8/df0/webm_2single__segment__segmenter_8cc_source.html @@ -71,13 +71,13 @@ $(function() {
      An implementation of IMkvWriter using our File type.
      Definition: mkv_writer.h:21
      void Update(Status new_status)
      Definition: status.cc:76
      - -
      Status FinalizeSegment(size_t stream_id, const SegmentInfo &segment_info)
      Definition: segmenter.cc:143
      + +
      Status FinalizeSegment(size_t stream_id, const SegmentInfo &segment_info)
      Definition: segmenter.cc:148
      diff --git a/docs/d8/df7/classshaka_1_1media_1_1SegmentTestBase-members.html b/docs/d8/df7/classshaka_1_1media_1_1SegmentTestBase-members.html index 0bd9118589..9818269754 100644 --- a/docs/d8/df7/classshaka_1_1media_1_1SegmentTestBase-members.html +++ b/docs/d8/df7/classshaka_1_1media_1_1SegmentTestBase-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/docs/d8/df8/classshaka_1_1media_1_1TextPadder.html b/docs/d8/df8/classshaka_1_1media_1_1TextPadder.html index b3faa3df5b..b3d00d9151 100644 --- a/docs/d8/df8/classshaka_1_1media_1_1TextPadder.html +++ b/docs/d8/df8/classshaka_1_1media_1_1TextPadder.html @@ -168,7 +168,7 @@ const std::map< size_t, std::pair< std::shared_ptr< diff --git a/docs/d8/dfa/nal__unit__to__byte__stream__converter_8h_source.html b/docs/d8/dfa/nal__unit__to__byte__stream__converter_8h_source.html index bb7cff02cd..7b7998aca9 100644 --- a/docs/d8/dfa/nal__unit__to__byte__stream__converter_8h_source.html +++ b/docs/d8/dfa/nal__unit__to__byte__stream__converter_8h_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d9/d00/structshaka_1_1media_1_1OnMediaEndParameters-members.html b/docs/d9/d00/structshaka_1_1media_1_1OnMediaEndParameters-members.html index 1168386201..e06f280425 100644 --- a/docs/d9/d00/structshaka_1_1media_1_1OnMediaEndParameters-members.html +++ b/docs/d9/d00/structshaka_1_1media_1_1OnMediaEndParameters-members.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d9/d01/mp4_2single__segment__segmenter_8h_source.html b/docs/d9/d01/mp4_2single__segment__segmenter_8h_source.html index 0e6c8d4596..2f77c40922 100644 --- a/docs/d9/d01/mp4_2single__segment__segmenter_8h_source.html +++ b/docs/d9/d01/mp4_2single__segment__segmenter_8h_source.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/d9/d08/mock__mpd__builder_8h_source.html b/docs/d9/d08/mock__mpd__builder_8h_source.html index 7039098055..2fb4e2e4ac 100644 --- a/docs/d9/d08/mock__mpd__builder_8h_source.html +++ b/docs/d9/d08/mock__mpd__builder_8h_source.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/d9/d0b/classshaka_1_1media_1_1HlsNotifyMuxerListener-members.html b/docs/d9/d0b/classshaka_1_1media_1_1HlsNotifyMuxerListener-members.html index c0c3af2e8f..e7e5014569 100644 --- a/docs/d9/d0b/classshaka_1_1media_1_1HlsNotifyMuxerListener-members.html +++ b/docs/d9/d0b/classshaka_1_1media_1_1HlsNotifyMuxerListener-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/docs/d9/d0c/classshaka_1_1media_1_1RsaPublicKey.html b/docs/d9/d0c/classshaka_1_1media_1_1RsaPublicKey.html index 7cbe340520..f5b72a0842 100644 --- a/docs/d9/d0c/classshaka_1_1media_1_1RsaPublicKey.html +++ b/docs/d9/d0c/classshaka_1_1media_1_1RsaPublicKey.html @@ -197,7 +197,7 @@ Static Public Member Functions diff --git a/docs/d9/d12/chunking__handler_8cc_source.html b/docs/d9/d12/chunking__handler_8cc_source.html index f7a12d260b..45b93cad4f 100644 --- a/docs/d9/d12/chunking__handler_8cc_source.html +++ b/docs/d9/d12/chunking__handler_8cc_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d9/d13/classshaka_1_1media_1_1BufferReader.html b/docs/d9/d13/classshaka_1_1media_1_1BufferReader.html index 883fb662a9..2d63c34626 100644 --- a/docs/d9/d13/classshaka_1_1media_1_1BufferReader.html +++ b/docs/d9/d13/classshaka_1_1media_1_1BufferReader.html @@ -257,7 +257,7 @@ bool ReadNBytesInto8s diff --git a/docs/d9/d14/protection__system__flags_8cc_source.html b/docs/d9/d14/protection__system__flags_8cc_source.html index c9d24166b5..2e53ea4d83 100644 --- a/docs/d9/d14/protection__system__flags_8cc_source.html +++ b/docs/d9/d14/protection__system__flags_8cc_source.html @@ -69,7 +69,7 @@ $(function() {
      1 // Copyright 2017 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 //
      7 // Defines command line flags for protection systems.
      8 
      9 #include "packager/app/protection_system_flags.h"
      10 
      11 DEFINE_bool(generate_common_pssh,
      12  false,
      13  "When specified, generate an additional v1 PSSH box for the common "
      14  "system ID. See: https://goo.gl/s8RIhr."
      15  "The flag is default to be true if --enable_raw_key_encryption "
      16  "is set and no other pssh flags are specified.");
      17 DEFINE_bool(generate_playready_pssh,
      18  false,
      19  "When specified, include a PlayReady PSSH box."
      20  "A playready PSSH is always generated regardless of the value of "
      21  "--generate_playready_pssh for --enable_playready_encryption.");
      22 DEFINE_bool(generate_widevine_pssh,
      23  false,
      24  "When specified, include a Widevine PSSH box. "
      25  "A widevine PSSH is always generated regardless of the value of "
      26  "--generate_widevine_pssh for --enable_widevine_encryption.");
      diff --git a/docs/d9/d1f/structshaka_1_1media_1_1mp4_1_1MovieFragment.html b/docs/d9/d1f/structshaka_1_1media_1_1mp4_1_1MovieFragment.html index cd469ac697..08beda8273 100644 --- a/docs/d9/d1f/structshaka_1_1media_1_1mp4_1_1MovieFragment.html +++ b/docs/d9/d1f/structshaka_1_1media_1_1mp4_1_1MovieFragment.html @@ -118,7 +118,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 740 of file box_definitions.h.

      +

      Definition at line 745 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -146,7 +146,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 2483 of file box_definitions.cc.

      +

      Definition at line 2551 of file box_definitions.cc.

      @@ -157,7 +157,7 @@ Additional Inherited Members diff --git a/docs/d9/d26/classshaka_1_1media_1_1AesEncryptor-members.html b/docs/d9/d26/classshaka_1_1media_1_1AesEncryptor-members.html index d20923ca1e..2f7fe46d10 100644 --- a/docs/d9/d26/classshaka_1_1media_1_1AesEncryptor-members.html +++ b/docs/d9/d26/classshaka_1_1media_1_1AesEncryptor-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/docs/d9/d26/classshaka_1_1media_1_1mp4_1_1Segmenter.html b/docs/d9/d26/classshaka_1_1media_1_1mp4_1_1Segmenter.html index 5c6fbf2bfe..ff06a9b5c2 100644 --- a/docs/d9/d26/classshaka_1_1media_1_1mp4_1_1Segmenter.html +++ b/docs/d9/d26/classshaka_1_1media_1_1mp4_1_1Segmenter.html @@ -188,7 +188,7 @@ void set_progress_target
      Returns
      OK on success, an error status otherwise.
      -

      Definition at line 119 of file segmenter.cc.

      +

      Definition at line 124 of file segmenter.cc.

      @@ -208,7 +208,7 @@ void set_progress_target

      Finalize the segmenter.

      Returns
      OK on success, an error status otherwise.
      -

      Definition at line 104 of file segmenter.cc.

      +

      Definition at line 109 of file segmenter.cc.

      @@ -246,7 +246,7 @@ void set_progress_target
      Returns
      OK on success, an error status otherwise.
      -

      Definition at line 143 of file segmenter.cc.

      +

      Definition at line 148 of file segmenter.cc.

      @@ -266,7 +266,7 @@ void set_progress_target
      Returns
      The total length, in seconds, of segmented media files.
      -

      Definition at line 237 of file segmenter.cc.

      +

      Definition at line 242 of file segmenter.cc.

      @@ -428,7 +428,7 @@ void set_progress_target diff --git a/docs/d9/d2e/packed__audio__segmenter_8h_source.html b/docs/d9/d2e/packed__audio__segmenter_8h_source.html index 2dee19b66c..518b140518 100644 --- a/docs/d9/d2e/packed__audio__segmenter_8h_source.html +++ b/docs/d9/d2e/packed__audio__segmenter_8h_source.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/d9/d36/classshaka_1_1media_1_1TracksBuilder-members.html b/docs/d9/d36/classshaka_1_1media_1_1TracksBuilder-members.html index 0ad7373f17..6531070229 100644 --- a/docs/d9/d36/classshaka_1_1media_1_1TracksBuilder-members.html +++ b/docs/d9/d36/classshaka_1_1media_1_1TracksBuilder-members.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/d9/d3b/webm__content__encodings_8h_source.html b/docs/d9/d3b/webm__content__encodings_8h_source.html index 8f15c47ca8..8ea7d6ee49 100644 --- a/docs/d9/d3b/webm__content__encodings_8h_source.html +++ b/docs/d9/d3b/webm__content__encodings_8h_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/d9/d3c/structshaka_1_1media_1_1mp4_1_1VTTEmptyCueBox.html b/docs/d9/d3c/structshaka_1_1media_1_1mp4_1_1VTTEmptyCueBox.html index 601220bd26..b05f6ab23c 100644 --- a/docs/d9/d3c/structshaka_1_1media_1_1mp4_1_1VTTEmptyCueBox.html +++ b/docs/d9/d3c/structshaka_1_1media_1_1mp4_1_1VTTEmptyCueBox.html @@ -105,7 +105,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 812 of file box_definitions.h.

      +

      Definition at line 826 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -133,7 +133,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 2675 of file box_definitions.cc.

      +

      Definition at line 2747 of file box_definitions.cc.

      @@ -144,7 +144,7 @@ Additional Inherited Members diff --git a/docs/d9/d3e/structshaka_1_1media_1_1mp4_1_1CueSourceIDBox.html b/docs/d9/d3e/structshaka_1_1media_1_1mp4_1_1CueSourceIDBox.html index 190c729b19..8b78ec963f 100644 --- a/docs/d9/d3e/structshaka_1_1media_1_1mp4_1_1CueSourceIDBox.html +++ b/docs/d9/d3e/structshaka_1_1media_1_1mp4_1_1CueSourceIDBox.html @@ -101,7 +101,7 @@ Public Member Functions

      Public Attributes

      -int32_t source_id +int32_t source_id = kCueSourceIdNotSet  

      @@ -112,7 +112,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 787 of file box_definitions.h.

      +

      Definition at line 796 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -140,7 +140,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 2584 of file box_definitions.cc.

      +

      Definition at line 2654 of file box_definitions.cc.

      @@ -151,7 +151,7 @@ Additional Inherited Members diff --git a/docs/d9/d40/classshaka_1_1media_1_1WebVttParser.html b/docs/d9/d40/classshaka_1_1media_1_1WebVttParser.html index ee152c2127..85e3e02bb7 100644 --- a/docs/d9/d40/classshaka_1_1media_1_1WebVttParser.html +++ b/docs/d9/d40/classshaka_1_1media_1_1WebVttParser.html @@ -171,7 +171,7 @@ const std::map< size_t, std::pair< std::shared_ptr< diff --git a/docs/d9/d52/structshaka_1_1media_1_1KeyFrameEvent.html b/docs/d9/d52/structshaka_1_1media_1_1KeyFrameEvent.html index d902381b3a..b50876b9a7 100644 --- a/docs/d9/d52/structshaka_1_1media_1_1KeyFrameEvent.html +++ b/docs/d9/d52/structshaka_1_1media_1_1KeyFrameEvent.html @@ -91,7 +91,7 @@ uint64_t size diff --git a/docs/d9/d57/classshaka_1_1media_1_1mp4_1_1ChunkInfoIterator.html b/docs/d9/d57/classshaka_1_1media_1_1mp4_1_1ChunkInfoIterator.html index b3a747d52e..56a61e0e96 100644 --- a/docs/d9/d57/classshaka_1_1media_1_1mp4_1_1ChunkInfoIterator.html +++ b/docs/d9/d57/classshaka_1_1media_1_1mp4_1_1ChunkInfoIterator.html @@ -310,7 +310,7 @@ Public Member Functions diff --git a/docs/d9/d65/structshaka_1_1media_1_1MuxerListener_1_1MediaRanges-members.html b/docs/d9/d65/structshaka_1_1media_1_1MuxerListener_1_1MediaRanges-members.html index 6389bd7612..2839d995bd 100644 --- a/docs/d9/d65/structshaka_1_1media_1_1MuxerListener_1_1MediaRanges-members.html +++ b/docs/d9/d65/structshaka_1_1media_1_1MuxerListener_1_1MediaRanges-members.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d9/d66/classshaka_1_1media_1_1PackedAudioSegmenter.html b/docs/d9/d66/classshaka_1_1media_1_1PackedAudioSegmenter.html index 03ae26872a..a3d446f216 100644 --- a/docs/d9/d66/classshaka_1_1media_1_1PackedAudioSegmenter.html +++ b/docs/d9/d66/classshaka_1_1media_1_1PackedAudioSegmenter.html @@ -251,7 +251,7 @@ Public Member Functions diff --git a/docs/d9/d67/structshaka_1_1media_1_1H265VuiParameters.html b/docs/d9/d67/structshaka_1_1media_1_1H265VuiParameters.html index 55e43d7f3d..bf98a0471e 100644 --- a/docs/d9/d67/structshaka_1_1media_1_1H265VuiParameters.html +++ b/docs/d9/d67/structshaka_1_1media_1_1H265VuiParameters.html @@ -107,7 +107,7 @@ int min_spatial_segmentati diff --git a/docs/d9/d68/classshaka_1_1media_1_1CombinedMuxerListener.html b/docs/d9/d68/classshaka_1_1media_1_1CombinedMuxerListener.html index 3fe116e068..7997c9c627 100644 --- a/docs/d9/d68/classshaka_1_1media_1_1CombinedMuxerListener.html +++ b/docs/d9/d68/classshaka_1_1media_1_1CombinedMuxerListener.html @@ -530,7 +530,7 @@ Additional Inherited Members diff --git a/docs/d9/d6a/structshaka_1_1media_1_1H264SliceHeader-members.html b/docs/d9/d6a/structshaka_1_1media_1_1H264SliceHeader-members.html index 7556314f08..90202a03a2 100644 --- a/docs/d9/d6a/structshaka_1_1media_1_1H264SliceHeader-members.html +++ b/docs/d9/d6a/structshaka_1_1media_1_1H264SliceHeader-members.html @@ -126,7 +126,7 @@ $(function() { diff --git a/docs/d9/d76/ts__muxer_8cc_source.html b/docs/d9/d76/ts__muxer_8cc_source.html index 7c50c13a54..3d14bf1545 100644 --- a/docs/d9/d76/ts__muxer_8cc_source.html +++ b/docs/d9/d76/ts__muxer_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d9/d81/classshaka_1_1media_1_1ClosureThread-members.html b/docs/d9/d81/classshaka_1_1media_1_1ClosureThread-members.html index 5471c585fa..07ca3c5cdb 100644 --- a/docs/d9/d81/classshaka_1_1media_1_1ClosureThread-members.html +++ b/docs/d9/d81/classshaka_1_1media_1_1ClosureThread-members.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d9/d86/limits_8h_source.html b/docs/d9/d86/limits_8h_source.html index 43b9a3bad5..4f327182a5 100644 --- a/docs/d9/d86/limits_8h_source.html +++ b/docs/d9/d86/limits_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d9/d87/classshaka_1_1media_1_1WebMContentEncodingsClient.html b/docs/d9/d87/classshaka_1_1media_1_1WebMContentEncodingsClient.html index e9f5c4652a..06a69de7e8 100644 --- a/docs/d9/d87/classshaka_1_1media_1_1WebMContentEncodingsClient.html +++ b/docs/d9/d87/classshaka_1_1media_1_1WebMContentEncodingsClient.html @@ -128,7 +128,7 @@ Additional Inherited Members diff --git a/docs/d9/d8c/classshaka_1_1media_1_1AesRequestSigner.html b/docs/d9/d8c/classshaka_1_1media_1_1AesRequestSigner.html index 0a66484573..794e5acd08 100644 --- a/docs/d9/d8c/classshaka_1_1media_1_1AesRequestSigner.html +++ b/docs/d9/d8c/classshaka_1_1media_1_1AesRequestSigner.html @@ -165,7 +165,7 @@ Additional Inherited Members diff --git a/docs/d9/d90/text__track_8h_source.html b/docs/d9/d90/text__track_8h_source.html index ad26ff872e..5f2d2c1ba4 100644 --- a/docs/d9/d90/text__track_8h_source.html +++ b/docs/d9/d90/text__track_8h_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d9/d9b/classshaka_1_1hls_1_1MediaPlaylistFactory.html b/docs/d9/d9b/classshaka_1_1hls_1_1MediaPlaylistFactory.html index da2618c1d8..963f7da55f 100644 --- a/docs/d9/d9b/classshaka_1_1hls_1_1MediaPlaylistFactory.html +++ b/docs/d9/d9b/classshaka_1_1hls_1_1MediaPlaylistFactory.html @@ -89,7 +89,7 @@ virtual std::unique_ptr< diff --git a/docs/d9/d9b/sample__aes__ec3__cryptor_8cc_source.html b/docs/d9/d9b/sample__aes__ec3__cryptor_8cc_source.html index 4a3b5b8eec..a4aa920b51 100644 --- a/docs/d9/d9b/sample__aes__ec3__cryptor_8cc_source.html +++ b/docs/d9/d9b/sample__aes__ec3__cryptor_8cc_source.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/d9/da0/classshaka_1_1media_1_1SampleAesEc3Cryptor.html b/docs/d9/da0/classshaka_1_1media_1_1SampleAesEc3Cryptor.html index 33d2eb4581..aa2f8bd2bd 100644 --- a/docs/d9/da0/classshaka_1_1media_1_1SampleAesEc3Cryptor.html +++ b/docs/d9/da0/classshaka_1_1media_1_1SampleAesEc3Cryptor.html @@ -217,7 +217,7 @@ AES_KEY * mutable_aes_key< diff --git a/docs/d9/da4/stream__descriptor_8h_source.html b/docs/d9/da4/stream__descriptor_8h_source.html index c03e5be45d..4c8f34c940 100644 --- a/docs/d9/da4/stream__descriptor_8h_source.html +++ b/docs/d9/da4/stream__descriptor_8h_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d9/da5/classshaka_1_1media_1_1MpdNotifyMuxerListener.html b/docs/d9/da5/classshaka_1_1media_1_1MpdNotifyMuxerListener.html index 1e6a3a1b41..4ec6917b97 100644 --- a/docs/d9/da5/classshaka_1_1media_1_1MpdNotifyMuxerListener.html +++ b/docs/d9/da5/classshaka_1_1media_1_1MpdNotifyMuxerListener.html @@ -565,7 +565,7 @@ Additional Inherited Members diff --git a/docs/d9/da7/classshaka_1_1media_1_1mp4_1_1Segmenter-members.html b/docs/d9/da7/classshaka_1_1media_1_1mp4_1_1Segmenter-members.html index 327a0bc72c..5068654daf 100644 --- a/docs/d9/da7/classshaka_1_1media_1_1mp4_1_1Segmenter-members.html +++ b/docs/d9/da7/classshaka_1_1media_1_1mp4_1_1Segmenter-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/docs/d9/da8/structshaka_1_1BufferCallbackParams.html b/docs/d9/da8/structshaka_1_1BufferCallbackParams.html index c45c7ea40a..4db68fcd00 100644 --- a/docs/d9/da8/structshaka_1_1BufferCallbackParams.html +++ b/docs/d9/da8/structshaka_1_1BufferCallbackParams.html @@ -127,7 +127,7 @@ Public Attributes diff --git a/docs/d9/db2/classshaka_1_1media_1_1mp4_1_1CompositionOffsetIterator-members.html b/docs/d9/db2/classshaka_1_1media_1_1mp4_1_1CompositionOffsetIterator-members.html index 1fa0ee132d..9823fd7a94 100644 --- a/docs/d9/db2/classshaka_1_1media_1_1mp4_1_1CompositionOffsetIterator-members.html +++ b/docs/d9/db2/classshaka_1_1media_1_1mp4_1_1CompositionOffsetIterator-members.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/d9/db9/content__protection__element_8cc_source.html b/docs/d9/db9/content__protection__element_8cc_source.html index f0a6270521..e33b377438 100644 --- a/docs/d9/db9/content__protection__element_8cc_source.html +++ b/docs/d9/db9/content__protection__element_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d9/db9/muxer_8cc_source.html b/docs/d9/db9/muxer_8cc_source.html index 65cfbeb596..9170b0f5aa 100644 --- a/docs/d9/db9/muxer_8cc_source.html +++ b/docs/d9/db9/muxer_8cc_source.html @@ -66,17 +66,21 @@ $(function() {
      muxer.cc
      -
      1 // Copyright 2014 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #include "packager/media/base/muxer.h"
      8 
      9 #include <algorithm>
      10 
      11 #include "packager/media/base/media_sample.h"
      12 
      13 namespace shaka {
      14 namespace media {
      15 namespace {
      16 const bool kInitialEncryptionInfo = true;
      17 } // namespace
      18 
      19 Muxer::Muxer(const MuxerOptions& options)
      20  : options_(options), cancelled_(false), clock_(NULL) {}
      21 
      22 Muxer::~Muxer() {}
      23 
      24 void Muxer::Cancel() {
      25  cancelled_ = true;
      26 }
      27 
      28 void Muxer::SetMuxerListener(std::unique_ptr<MuxerListener> muxer_listener) {
      29  muxer_listener_ = std::move(muxer_listener);
      30 }
      31 
      33  std::unique_ptr<ProgressListener> progress_listener) {
      34  progress_listener_ = std::move(progress_listener);
      35 }
      36 
      37 Status Muxer::Process(std::unique_ptr<StreamData> stream_data) {
      38  Status status;
      39  switch (stream_data->stream_data_type) {
      40  case StreamDataType::kStreamInfo:
      41  streams_.push_back(std::move(stream_data->stream_info));
      42  if (muxer_listener_ && streams_.back()->is_encrypted()) {
      43  const EncryptionConfig& encryption_config =
      44  streams_.back()->encryption_config();
      45  muxer_listener_->OnEncryptionInfoReady(
      46  kInitialEncryptionInfo, encryption_config.protection_scheme,
      47  encryption_config.key_id, encryption_config.constant_iv,
      48  encryption_config.key_system_info);
      49  current_key_id_ = encryption_config.key_id;
      50  }
      51  return InitializeMuxer();
      52  case StreamDataType::kSegmentInfo: {
      53  const auto& segment_info = *stream_data->segment_info;
      54  if (muxer_listener_ && segment_info.is_encrypted) {
      55  const EncryptionConfig* encryption_config =
      56  segment_info.key_rotation_encryption_config.get();
      57  // Only call OnEncryptionInfoReady again when key updates.
      58  if (encryption_config && encryption_config->key_id != current_key_id_) {
      59  muxer_listener_->OnEncryptionInfoReady(
      60  !kInitialEncryptionInfo, encryption_config->protection_scheme,
      61  encryption_config->key_id, encryption_config->constant_iv,
      62  encryption_config->key_system_info);
      63  current_key_id_ = encryption_config->key_id;
      64  }
      65  if (!encryption_started_) {
      66  encryption_started_ = true;
      67  muxer_listener_->OnEncryptionStart();
      68  }
      69  }
      70  return FinalizeSegment(stream_data->stream_index, segment_info);
      71  }
      72  case StreamDataType::kMediaSample:
      73  return AddSample(stream_data->stream_index, *stream_data->media_sample);
      74  case StreamDataType::kCueEvent:
      75  if (muxer_listener_) {
      76  const int64_t time_scale =
      77  streams_[stream_data->stream_index]->time_scale();
      78  const double time_in_seconds = stream_data->cue_event->time_in_seconds;
      79  const int64_t scaled_time =
      80  static_cast<int64_t>(time_in_seconds * time_scale);
      81  muxer_listener_->OnCueEvent(scaled_time,
      82  stream_data->cue_event->cue_data);
      83  }
      84  break;
      85  default:
      86  VLOG(3) << "Stream data type "
      87  << static_cast<int>(stream_data->stream_data_type) << " ignored.";
      88  break;
      89  }
      90  // No dispatch for muxer.
      91  return Status::OK;
      92 }
      93 
      94 } // namespace media
      95 } // namespace shaka
      +
      1 // Copyright 2014 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #include "packager/media/base/muxer.h"
      8 
      9 #include <algorithm>
      10 
      11 #include "packager/media/base/media_sample.h"
      12 #include "packager/media/base/muxer_util.h"
      13 #include "packager/status_macros.h"
      14 
      15 namespace shaka {
      16 namespace media {
      17 namespace {
      18 const bool kInitialEncryptionInfo = true;
      19 const int64_t kStartTime = 0;
      20 } // namespace
      21 
      22 Muxer::Muxer(const MuxerOptions& options) : options_(options) {
      23  // "$" is only allowed if the output file name is a template, which is used to
      24  // support one file per Representation per Period when there are Ad Cues.
      25  if (options_.output_file_name.find("$") != std::string::npos)
      26  output_file_template_ = options_.output_file_name;
      27 }
      28 
      29 Muxer::~Muxer() {}
      30 
      31 void Muxer::Cancel() {
      32  cancelled_ = true;
      33 }
      34 
      35 void Muxer::SetMuxerListener(std::unique_ptr<MuxerListener> muxer_listener) {
      36  muxer_listener_ = std::move(muxer_listener);
      37 }
      38 
      40  std::unique_ptr<ProgressListener> progress_listener) {
      41  progress_listener_ = std::move(progress_listener);
      42 }
      43 
      44 Status Muxer::Process(std::unique_ptr<StreamData> stream_data) {
      45  Status status;
      46  switch (stream_data->stream_data_type) {
      47  case StreamDataType::kStreamInfo:
      48  streams_.push_back(std::move(stream_data->stream_info));
      49  return ReinitializeMuxer(kStartTime);
      50  case StreamDataType::kSegmentInfo: {
      51  const auto& segment_info = *stream_data->segment_info;
      52  if (muxer_listener_ && segment_info.is_encrypted) {
      53  const EncryptionConfig* encryption_config =
      54  segment_info.key_rotation_encryption_config.get();
      55  // Only call OnEncryptionInfoReady again when key updates.
      56  if (encryption_config && encryption_config->key_id != current_key_id_) {
      57  muxer_listener_->OnEncryptionInfoReady(
      58  !kInitialEncryptionInfo, encryption_config->protection_scheme,
      59  encryption_config->key_id, encryption_config->constant_iv,
      60  encryption_config->key_system_info);
      61  current_key_id_ = encryption_config->key_id;
      62  }
      63  if (!encryption_started_) {
      64  encryption_started_ = true;
      65  muxer_listener_->OnEncryptionStart();
      66  }
      67  }
      68  return FinalizeSegment(stream_data->stream_index, segment_info);
      69  }
      70  case StreamDataType::kMediaSample:
      71  return AddSample(stream_data->stream_index, *stream_data->media_sample);
      72  case StreamDataType::kCueEvent:
      73  if (muxer_listener_) {
      74  const int64_t time_scale =
      75  streams_[stream_data->stream_index]->time_scale();
      76  const double time_in_seconds = stream_data->cue_event->time_in_seconds;
      77  const int64_t scaled_time =
      78  static_cast<int64_t>(time_in_seconds * time_scale);
      79  muxer_listener_->OnCueEvent(scaled_time,
      80  stream_data->cue_event->cue_data);
      81 
      82  // Finalize and re-initialize Muxer to generate different content files.
      83  if (!output_file_template_.empty()) {
      84  RETURN_IF_ERROR(Finalize());
      85  RETURN_IF_ERROR(ReinitializeMuxer(scaled_time));
      86  }
      87  }
      88  break;
      89  default:
      90  VLOG(3) << "Stream data type "
      91  << static_cast<int>(stream_data->stream_data_type) << " ignored.";
      92  break;
      93  }
      94  // No dispatch for muxer.
      95  return Status::OK;
      96 }
      97 
      98 Status Muxer::OnFlushRequest(size_t input_stream_index) {
      99  return Finalize();
      100 }
      101 
      102 Status Muxer::ReinitializeMuxer(int64_t timestamp) {
      103  if (muxer_listener_ && streams_.back()->is_encrypted()) {
      104  const EncryptionConfig& encryption_config =
      105  streams_.back()->encryption_config();
      106  muxer_listener_->OnEncryptionInfoReady(
      107  kInitialEncryptionInfo, encryption_config.protection_scheme,
      108  encryption_config.key_id, encryption_config.constant_iv,
      109  encryption_config.key_system_info);
      110  current_key_id_ = encryption_config.key_id;
      111  }
      112  if (!output_file_template_.empty()) {
      113  // Update |output_file_index| and |output_file_name| with an actual file
      114  // name, which will be used by the subclasses.
      115  options_.output_file_index = output_file_index_;
      116  options_.output_file_name =
      117  GetSegmentName(output_file_template_, timestamp, output_file_index_++,
      118  options_.bandwidth);
      119  }
      120  return InitializeMuxer();
      121 }
      122 
      123 } // namespace media
      124 } // namespace shaka
      +
      Status OnFlushRequest(size_t input_stream_index) override
      Event handler for flush request at the specific input stream index.
      Definition: muxer.cc:98
      + +
      All the methods that are virtual are virtual for mocking.
      -
      void SetProgressListener(std::unique_ptr< ProgressListener > progress_listener)
      Definition: muxer.cc:32
      -
      Status Process(std::unique_ptr< StreamData > stream_data) override
      Definition: muxer.cc:37
      -
      void SetMuxerListener(std::unique_ptr< MuxerListener > muxer_listener)
      Definition: muxer.cc:28
      +
      void SetProgressListener(std::unique_ptr< ProgressListener > progress_listener)
      Definition: muxer.cc:39
      +
      Status Process(std::unique_ptr< StreamData > stream_data) override
      Definition: muxer.cc:44
      + +
      void SetMuxerListener(std::unique_ptr< MuxerListener > muxer_listener)
      Definition: muxer.cc:35
      diff --git a/docs/d9/dc4/classshaka_1_1media_1_1BufferReader-members.html b/docs/d9/dc4/classshaka_1_1media_1_1BufferReader-members.html index 0293758dae..d24d137387 100644 --- a/docs/d9/dc4/classshaka_1_1media_1_1BufferReader-members.html +++ b/docs/d9/dc4/classshaka_1_1media_1_1BufferReader-members.html @@ -91,7 +91,7 @@ $(function() {
      diff --git a/docs/d9/dc4/structshaka_1_1media_1_1mp4_1_1SampleEncryptionEntry-members.html b/docs/d9/dc4/structshaka_1_1media_1_1mp4_1_1SampleEncryptionEntry-members.html index e433ca49db..1adb5eed35 100644 --- a/docs/d9/dc4/structshaka_1_1media_1_1mp4_1_1SampleEncryptionEntry-members.html +++ b/docs/d9/dc4/structshaka_1_1media_1_1mp4_1_1SampleEncryptionEntry-members.html @@ -74,13 +74,11 @@ $(function() { initialization_vector (defined in shaka::media::mp4::SampleEncryptionEntry)shaka::media::mp4::SampleEncryptionEntry ParseFromBuffer(uint8_t iv_size, bool has_subsamples, BufferReader *reader)shaka::media::mp4::SampleEncryptionEntry ReadWrite(uint8_t iv_size, bool has_subsamples, BoxBuffer *buffer)shaka::media::mp4::SampleEncryptionEntry - SampleEncryptionEntry() (defined in shaka::media::mp4::SampleEncryptionEntry)shaka::media::mp4::SampleEncryptionEntry - subsamples (defined in shaka::media::mp4::SampleEncryptionEntry)shaka::media::mp4::SampleEncryptionEntry - ~SampleEncryptionEntry() (defined in shaka::media::mp4::SampleEncryptionEntry)shaka::media::mp4::SampleEncryptionEntry + subsamples (defined in shaka::media::mp4::SampleEncryptionEntry)shaka::media::mp4::SampleEncryptionEntry diff --git a/docs/d9/dc7/classshaka_1_1media_1_1BitWriter-members.html b/docs/d9/dc7/classshaka_1_1media_1_1BitWriter-members.html index 20e1aef858..4e67e1dc43 100644 --- a/docs/d9/dc7/classshaka_1_1media_1_1BitWriter-members.html +++ b/docs/d9/dc7/classshaka_1_1media_1_1BitWriter-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/d9/dc8/webm__constants_8cc_source.html b/docs/d9/dc8/webm__constants_8cc_source.html index 2c50863718..161de4e89c 100644 --- a/docs/d9/dc8/webm__constants_8cc_source.html +++ b/docs/d9/dc8/webm__constants_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d9/dcc/webm__video__client_8h_source.html b/docs/d9/dcc/webm__video__client_8h_source.html index 0657e56e7e..25fe586287 100644 --- a/docs/d9/dcc/webm__video__client_8h_source.html +++ b/docs/d9/dcc/webm__video__client_8h_source.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/d9/dd2/structshaka_1_1WidevineEncryptionParams.html b/docs/d9/dd2/structshaka_1_1WidevineEncryptionParams.html index 3139524f28..e88991a598 100644 --- a/docs/d9/dd2/structshaka_1_1WidevineEncryptionParams.html +++ b/docs/d9/dd2/structshaka_1_1WidevineEncryptionParams.html @@ -112,7 +112,7 @@ bool  diff --git a/docs/d9/dda/ac3__header_8cc_source.html b/docs/d9/dda/ac3__header_8cc_source.html index 781e41aee3..ac9a1c2335 100644 --- a/docs/d9/dda/ac3__header_8cc_source.html +++ b/docs/d9/dda/ac3__header_8cc_source.html @@ -86,7 +86,7 @@ $(function() { diff --git a/docs/d9/de0/structshaka_1_1media_1_1Range.html b/docs/d9/de0/structshaka_1_1media_1_1Range.html index 64ae92df12..30ff07c002 100644 --- a/docs/d9/de0/structshaka_1_1media_1_1Range.html +++ b/docs/d9/de0/structshaka_1_1media_1_1Range.html @@ -91,7 +91,7 @@ uint64_t end diff --git a/docs/d9/de2/mock__media__playlist_8cc_source.html b/docs/d9/de2/mock__media__playlist_8cc_source.html index 62e87b5814..c3c1711d44 100644 --- a/docs/d9/de2/mock__media__playlist_8cc_source.html +++ b/docs/d9/de2/mock__media__playlist_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d9/de3/muxer__listener__internal_8cc_source.html b/docs/d9/de3/muxer__listener__internal_8cc_source.html index f9292be241..d680e6e018 100644 --- a/docs/d9/de3/muxer__listener__internal_8cc_source.html +++ b/docs/d9/de3/muxer__listener__internal_8cc_source.html @@ -66,11 +66,11 @@ $(function() {
      muxer_listener_internal.cc
      -
      1 // Copyright 2014 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #include "packager/media/event/muxer_listener_internal.h"
      8 
      9 #include <google/protobuf/util/message_differencer.h>
      10 #include <math.h>
      11 
      12 #include "packager/base/logging.h"
      13 #include "packager/base/strings/string_number_conversions.h"
      14 #include "packager/base/strings/string_util.h"
      15 #include "packager/media/base/audio_stream_info.h"
      16 #include "packager/media/base/muxer_options.h"
      17 #include "packager/media/base/protection_system_specific_info.h"
      18 #include "packager/media/base/text_stream_info.h"
      19 #include "packager/media/base/video_stream_info.h"
      20 #include "packager/media/codecs/ec3_audio_util.h"
      21 #include "packager/mpd/base/media_info.pb.h"
      22 
      23 using ::google::protobuf::util::MessageDifferencer;
      24 
      25 namespace shaka {
      26 namespace media {
      27 namespace internal {
      28 
      29 namespace {
      30 
      31 // TODO(rkuroiwa): There is shaka::Range in MediaInfo proto and
      32 // shaka::media::Range in media/base. Find better names.
      33 void SetRange(uint64_t begin, uint64_t end, shaka::Range* range) {
      34  DCHECK(range);
      35  range->set_begin(begin);
      36  range->set_end(end);
      37 }
      38 
      39 void SetMediaInfoContainerType(MuxerListener::ContainerType container_type,
      40  MediaInfo* media_info) {
      41  DCHECK(media_info);
      42  switch (container_type) {
      43  case MuxerListener::kContainerUnknown:
      44  media_info->set_container_type(MediaInfo::CONTAINER_UNKNOWN);
      45  break;
      46  case MuxerListener::kContainerMp4:
      47  media_info->set_container_type(MediaInfo::CONTAINER_MP4);
      48  break;
      49  case MuxerListener::kContainerMpeg2ts:
      50  media_info->set_container_type(MediaInfo::CONTAINER_MPEG2_TS);
      51  break;
      52  case MuxerListener::kContainerPackedAudio:
      53  media_info->set_container_type(MediaInfo::CONTAINER_PACKED_AUDIO);
      54  break;
      55  case MuxerListener::kContainerWebM:
      56  media_info->set_container_type(MediaInfo::CONTAINER_WEBM);
      57  break;
      58  case MuxerListener::kContainerText:
      59  media_info->set_container_type(MediaInfo::CONTAINER_TEXT);
      60  break;
      61  default:
      62  NOTREACHED() << "Unknown container type " << container_type;
      63  }
      64 }
      65 
      66 void AddVideoInfo(const VideoStreamInfo* video_stream_info,
      67  MediaInfo* media_info) {
      68  DCHECK(video_stream_info);
      69  DCHECK(media_info);
      70  MediaInfo_VideoInfo* video_info = media_info->mutable_video_info();
      71  video_info->set_codec(video_stream_info->codec_string());
      72  video_info->set_width(video_stream_info->width());
      73  video_info->set_height(video_stream_info->height());
      74  video_info->set_time_scale(video_stream_info->time_scale());
      75 
      76  if (video_stream_info->pixel_width() > 0)
      77  video_info->set_pixel_width(video_stream_info->pixel_width());
      78 
      79  if (video_stream_info->pixel_height() > 0)
      80  video_info->set_pixel_height(video_stream_info->pixel_height());
      81 
      82  const std::vector<uint8_t>& codec_config = video_stream_info->codec_config();
      83  if (!codec_config.empty()) {
      84  video_info->set_decoder_config(&codec_config[0], codec_config.size());
      85  }
      86 
      87  if (video_stream_info->playback_rate() > 0) {
      88  video_info->set_playback_rate(video_stream_info->playback_rate());
      89  }
      90 }
      91 
      92 void AddAudioInfo(const AudioStreamInfo* audio_stream_info,
      93  MediaInfo* media_info) {
      94  DCHECK(audio_stream_info);
      95  DCHECK(media_info);
      96  MediaInfo_AudioInfo* audio_info = media_info->mutable_audio_info();
      97  audio_info->set_codec(audio_stream_info->codec_string());
      98  audio_info->set_sampling_frequency(audio_stream_info->sampling_frequency());
      99  audio_info->set_time_scale(audio_stream_info->time_scale());
      100  audio_info->set_num_channels(audio_stream_info->num_channels());
      101 
      102  const std::string& language = audio_stream_info->language();
      103  // ISO-639-2/T defines language "und" which we also want to ignore.
      104  if (!language.empty() && language != "und") {
      105  audio_info->set_language(language);
      106  }
      107 
      108  const std::vector<uint8_t>& codec_config = audio_stream_info->codec_config();
      109  if (!codec_config.empty()) {
      110  audio_info->set_decoder_config(&codec_config[0], codec_config.size());
      111  }
      112 
      113  if (audio_stream_info->codec_string() == "ec-3") {
      114  uint32_t ec3_channel_map;
      115  if (!CalculateEC3ChannelMap(codec_config, &ec3_channel_map)) {
      116  LOG(ERROR) << "Failed to calculate EC3 channel map.";
      117  return;
      118  }
      119  audio_info->mutable_codec_specific_data()->set_ec3_channel_map(
      120  ec3_channel_map);
      121  }
      122 }
      123 
      124 void AddTextInfo(const TextStreamInfo& text_stream_info,
      125  MediaInfo* media_info) {
      126  // For now, set everything as subtitle.
      127  MediaInfo::TextInfo* text_info = media_info->mutable_text_info();
      128  text_info->set_type(MediaInfo::TextInfo::SUBTITLE);
      129  text_info->set_codec(text_stream_info.codec_string());
      130  text_info->set_language(text_stream_info.language());
      131 }
      132 
      133 void SetMediaInfoStreamInfo(const StreamInfo& stream_info,
      134  MediaInfo* media_info) {
      135  if (stream_info.stream_type() == kStreamAudio) {
      136  AddAudioInfo(static_cast<const AudioStreamInfo*>(&stream_info), media_info);
      137  } else if (stream_info.stream_type() == kStreamText) {
      138  AddTextInfo(static_cast<const TextStreamInfo&>(stream_info), media_info);
      139  } else {
      140  DCHECK_EQ(stream_info.stream_type(), kStreamVideo);
      141  AddVideoInfo(static_cast<const VideoStreamInfo*>(&stream_info), media_info);
      142  }
      143  if (stream_info.duration() > 0) {
      144  // |stream_info.duration()| contains the media duration from the original
      145  // media header, which is usually good enough.
      146  media_info->set_media_duration_seconds(
      147  static_cast<double>(stream_info.duration()) / stream_info.time_scale());
      148  }
      149 }
      150 
      151 void SetMediaInfoMuxerOptions(const MuxerOptions& muxer_options,
      152  MediaInfo* media_info) {
      153  DCHECK(media_info);
      154  if (muxer_options.segment_template.empty()) {
      155  media_info->set_media_file_name(muxer_options.output_file_name);
      156  } else {
      157  if (!muxer_options.output_file_name.empty())
      158  media_info->set_init_segment_name(muxer_options.output_file_name);
      159  media_info->set_segment_template(muxer_options.segment_template);
      160  }
      161 }
      162 
      163 } // namespace
      164 
      165 bool GenerateMediaInfo(const MuxerOptions& muxer_options,
      166  const StreamInfo& stream_info,
      167  uint32_t reference_time_scale,
      168  MuxerListener::ContainerType container_type,
      169  MediaInfo* media_info) {
      170  DCHECK(media_info);
      171 
      172  SetMediaInfoMuxerOptions(muxer_options, media_info);
      173  SetMediaInfoStreamInfo(stream_info, media_info);
      174  media_info->set_reference_time_scale(reference_time_scale);
      175  SetMediaInfoContainerType(container_type, media_info);
      176  if (muxer_options.bandwidth > 0)
      177  media_info->set_bandwidth(muxer_options.bandwidth);
      178 
      179  return true;
      180 }
      181 
      182 bool IsMediaInfoCompatible(const MediaInfo& media_info1,
      183  const MediaInfo& media_info2) {
      184  return media_info1.reference_time_scale() ==
      185  media_info2.reference_time_scale() &&
      186  media_info1.container_type() == media_info2.container_type() &&
      187  MessageDifferencer::Equals(media_info1.video_info(),
      188  media_info2.video_info()) &&
      189  MessageDifferencer::Equals(media_info1.audio_info(),
      190  media_info2.audio_info()) &&
      191  MessageDifferencer::Equals(media_info1.text_info(),
      192  media_info2.text_info());
      193 }
      194 
      195 bool SetVodInformation(const MuxerListener::MediaRanges& media_ranges,
      196  float duration_seconds,
      197  MediaInfo* media_info) {
      198  DCHECK(media_info);
      199 
      200  if (duration_seconds <= 0.0f) {
      201  // Non positive second media must be invalid media.
      202  LOG(ERROR) << "Duration is not positive: " << duration_seconds;
      203  return false;
      204  }
      205 
      206  if (media_ranges.init_range) {
      207  SetRange(media_ranges.init_range->start, media_ranges.init_range->end,
      208  media_info->mutable_init_range());
      209  }
      210 
      211  if (media_ranges.index_range) {
      212  SetRange(media_ranges.index_range->start, media_ranges.index_range->end,
      213  media_info->mutable_index_range());
      214  }
      215 
      216  media_info->set_media_duration_seconds(duration_seconds);
      217 
      218  return true;
      219 }
      220 
      221 void SetContentProtectionFields(
      222  FourCC protection_scheme,
      223  const std::vector<uint8_t>& default_key_id,
      224  const std::vector<ProtectionSystemSpecificInfo>& key_system_info,
      225  MediaInfo* media_info) {
      226  DCHECK(media_info);
      227  MediaInfo::ProtectedContent* protected_content =
      228  media_info->mutable_protected_content();
      229  protected_content->set_protection_scheme(FourCCToString(protection_scheme));
      230 
      231  if (!default_key_id.empty()) {
      232  protected_content->set_default_key_id(default_key_id.data(),
      233  default_key_id.size());
      234  }
      235 
      236  for (const ProtectionSystemSpecificInfo& info : key_system_info) {
      237  MediaInfo::ProtectedContent::ContentProtectionEntry* entry =
      238  protected_content->add_content_protection_entry();
      239  entry->set_uuid(CreateUUIDString(info.system_id));
      240 
      241  const std::vector<uint8_t>& pssh = info.psshs;
      242  entry->set_pssh(pssh.data(), pssh.size());
      243  }
      244 }
      245 
      246 std::string CreateUUIDString(const std::vector<uint8_t>& data) {
      247  DCHECK_EQ(16u, data.size());
      248  std::string uuid =
      249  base::ToLowerASCII(base::HexEncode(data.data(), data.size()));
      250  uuid.insert(20, "-");
      251  uuid.insert(16, "-");
      252  uuid.insert(12, "-");
      253  uuid.insert(8, "-");
      254  return uuid;
      255 }
      256 
      257 } // namespace internal
      258 } // namespace media
      259 } // namespace shaka
      All the methods that are virtual are virtual for mocking.
      +
      1 // Copyright 2014 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #include "packager/media/event/muxer_listener_internal.h"
      8 
      9 #include <google/protobuf/util/message_differencer.h>
      10 #include <math.h>
      11 
      12 #include "packager/base/logging.h"
      13 #include "packager/base/strings/string_number_conversions.h"
      14 #include "packager/base/strings/string_util.h"
      15 #include "packager/media/base/audio_stream_info.h"
      16 #include "packager/media/base/muxer_options.h"
      17 #include "packager/media/base/protection_system_specific_info.h"
      18 #include "packager/media/base/text_stream_info.h"
      19 #include "packager/media/base/video_stream_info.h"
      20 #include "packager/media/codecs/ec3_audio_util.h"
      21 #include "packager/mpd/base/media_info.pb.h"
      22 
      23 using ::google::protobuf::util::MessageDifferencer;
      24 
      25 namespace shaka {
      26 namespace media {
      27 namespace internal {
      28 
      29 namespace {
      30 
      31 // TODO(rkuroiwa): There is shaka::Range in MediaInfo proto and
      32 // shaka::media::Range in media/base. Find better names.
      33 void SetRange(uint64_t begin, uint64_t end, shaka::Range* range) {
      34  DCHECK(range);
      35  range->set_begin(begin);
      36  range->set_end(end);
      37 }
      38 
      39 void SetMediaInfoContainerType(MuxerListener::ContainerType container_type,
      40  MediaInfo* media_info) {
      41  DCHECK(media_info);
      42  switch (container_type) {
      43  case MuxerListener::kContainerUnknown:
      44  media_info->set_container_type(MediaInfo::CONTAINER_UNKNOWN);
      45  break;
      46  case MuxerListener::kContainerMp4:
      47  media_info->set_container_type(MediaInfo::CONTAINER_MP4);
      48  break;
      49  case MuxerListener::kContainerMpeg2ts:
      50  media_info->set_container_type(MediaInfo::CONTAINER_MPEG2_TS);
      51  break;
      52  case MuxerListener::kContainerPackedAudio:
      53  media_info->set_container_type(MediaInfo::CONTAINER_PACKED_AUDIO);
      54  break;
      55  case MuxerListener::kContainerWebM:
      56  media_info->set_container_type(MediaInfo::CONTAINER_WEBM);
      57  break;
      58  case MuxerListener::kContainerText:
      59  media_info->set_container_type(MediaInfo::CONTAINER_TEXT);
      60  break;
      61  default:
      62  NOTREACHED() << "Unknown container type " << container_type;
      63  }
      64 }
      65 
      66 void AddVideoInfo(const VideoStreamInfo* video_stream_info,
      67  MediaInfo* media_info) {
      68  DCHECK(video_stream_info);
      69  DCHECK(media_info);
      70  MediaInfo_VideoInfo* video_info = media_info->mutable_video_info();
      71  video_info->set_codec(video_stream_info->codec_string());
      72  video_info->set_width(video_stream_info->width());
      73  video_info->set_height(video_stream_info->height());
      74  video_info->set_time_scale(video_stream_info->time_scale());
      75 
      76  if (video_stream_info->pixel_width() > 0)
      77  video_info->set_pixel_width(video_stream_info->pixel_width());
      78 
      79  if (video_stream_info->pixel_height() > 0)
      80  video_info->set_pixel_height(video_stream_info->pixel_height());
      81 
      82  const std::vector<uint8_t>& codec_config = video_stream_info->codec_config();
      83  if (!codec_config.empty()) {
      84  video_info->set_decoder_config(&codec_config[0], codec_config.size());
      85  }
      86 
      87  if (video_stream_info->playback_rate() > 0) {
      88  video_info->set_playback_rate(video_stream_info->playback_rate());
      89  }
      90 }
      91 
      92 void AddAudioInfo(const AudioStreamInfo* audio_stream_info,
      93  MediaInfo* media_info) {
      94  DCHECK(audio_stream_info);
      95  DCHECK(media_info);
      96  MediaInfo_AudioInfo* audio_info = media_info->mutable_audio_info();
      97  audio_info->set_codec(audio_stream_info->codec_string());
      98  audio_info->set_sampling_frequency(audio_stream_info->sampling_frequency());
      99  audio_info->set_time_scale(audio_stream_info->time_scale());
      100  audio_info->set_num_channels(audio_stream_info->num_channels());
      101 
      102  const std::string& language = audio_stream_info->language();
      103  // ISO-639-2/T defines language "und" which we also want to ignore.
      104  if (!language.empty() && language != "und") {
      105  audio_info->set_language(language);
      106  }
      107 
      108  const std::vector<uint8_t>& codec_config = audio_stream_info->codec_config();
      109  if (!codec_config.empty()) {
      110  audio_info->set_decoder_config(&codec_config[0], codec_config.size());
      111  }
      112 
      113  if (audio_stream_info->codec_string() == "ec-3") {
      114  uint32_t ec3_channel_map;
      115  if (!CalculateEC3ChannelMap(codec_config, &ec3_channel_map)) {
      116  LOG(ERROR) << "Failed to calculate EC3 channel map.";
      117  return;
      118  }
      119  audio_info->mutable_codec_specific_data()->set_ec3_channel_map(
      120  ec3_channel_map);
      121  }
      122 }
      123 
      124 void AddTextInfo(const TextStreamInfo& text_stream_info,
      125  MediaInfo* media_info) {
      126  // For now, set everything as subtitle.
      127  MediaInfo::TextInfo* text_info = media_info->mutable_text_info();
      128  text_info->set_type(MediaInfo::TextInfo::SUBTITLE);
      129  text_info->set_codec(text_stream_info.codec_string());
      130  text_info->set_language(text_stream_info.language());
      131 }
      132 
      133 void SetMediaInfoStreamInfo(const StreamInfo& stream_info,
      134  MediaInfo* media_info) {
      135  if (stream_info.stream_type() == kStreamAudio) {
      136  AddAudioInfo(static_cast<const AudioStreamInfo*>(&stream_info), media_info);
      137  } else if (stream_info.stream_type() == kStreamText) {
      138  AddTextInfo(static_cast<const TextStreamInfo&>(stream_info), media_info);
      139  } else {
      140  DCHECK_EQ(stream_info.stream_type(), kStreamVideo);
      141  AddVideoInfo(static_cast<const VideoStreamInfo*>(&stream_info), media_info);
      142  }
      143  if (stream_info.duration() > 0) {
      144  // |stream_info.duration()| contains the media duration from the original
      145  // media header, which is usually good enough.
      146  media_info->set_media_duration_seconds(
      147  static_cast<double>(stream_info.duration()) / stream_info.time_scale());
      148  }
      149 }
      150 
      151 void SetMediaInfoMuxerOptions(const MuxerOptions& muxer_options,
      152  MediaInfo* media_info) {
      153  DCHECK(media_info);
      154  if (muxer_options.segment_template.empty()) {
      155  media_info->set_media_file_name(muxer_options.output_file_name);
      156  } else {
      157  if (!muxer_options.output_file_name.empty())
      158  media_info->set_init_segment_name(muxer_options.output_file_name);
      159  media_info->set_segment_template(muxer_options.segment_template);
      160  }
      161 }
      162 
      163 // Adjust MediaInfo for compatibility comparison. MediaInfos are considered to
      164 // be compatible if codec and container are the same.
      165 MediaInfo GetCompatibleComparisonMediaInfo(const MediaInfo& media_info) {
      166  MediaInfo adjusted_media_info;
      167  adjusted_media_info.set_reference_time_scale(
      168  media_info.reference_time_scale());
      169  adjusted_media_info.set_container_type(media_info.container_type());
      170  if (media_info.has_video_info()) {
      171  *adjusted_media_info.mutable_video_info() = media_info.video_info();
      172  adjusted_media_info.mutable_video_info()->clear_frame_duration();
      173  }
      174  if (media_info.has_audio_info()) {
      175  *adjusted_media_info.mutable_audio_info() = media_info.audio_info();
      176  }
      177  if (media_info.has_text_info()) {
      178  *adjusted_media_info.mutable_text_info() = media_info.text_info();
      179  }
      180  return adjusted_media_info;
      181 }
      182 
      183 } // namespace
      184 
      185 bool GenerateMediaInfo(const MuxerOptions& muxer_options,
      186  const StreamInfo& stream_info,
      187  uint32_t reference_time_scale,
      188  MuxerListener::ContainerType container_type,
      189  MediaInfo* media_info) {
      190  DCHECK(media_info);
      191 
      192  SetMediaInfoMuxerOptions(muxer_options, media_info);
      193  SetMediaInfoStreamInfo(stream_info, media_info);
      194  media_info->set_reference_time_scale(reference_time_scale);
      195  SetMediaInfoContainerType(container_type, media_info);
      196  if (muxer_options.bandwidth > 0)
      197  media_info->set_bandwidth(muxer_options.bandwidth);
      198 
      199  return true;
      200 }
      201 
      202 bool IsMediaInfoCompatible(const MediaInfo& media_info1,
      203  const MediaInfo& media_info2) {
      204  return MessageDifferencer::Equals(
      205  GetCompatibleComparisonMediaInfo(media_info1),
      206  GetCompatibleComparisonMediaInfo(media_info2));
      207 }
      208 
      209 bool SetVodInformation(const MuxerListener::MediaRanges& media_ranges,
      210  float duration_seconds,
      211  MediaInfo* media_info) {
      212  DCHECK(media_info);
      213 
      214  if (duration_seconds <= 0.0f) {
      215  // Non positive second media must be invalid media.
      216  LOG(ERROR) << "Duration is not positive: " << duration_seconds;
      217  return false;
      218  }
      219 
      220  if (media_ranges.init_range) {
      221  SetRange(media_ranges.init_range->start, media_ranges.init_range->end,
      222  media_info->mutable_init_range());
      223  }
      224 
      225  if (media_ranges.index_range) {
      226  SetRange(media_ranges.index_range->start, media_ranges.index_range->end,
      227  media_info->mutable_index_range());
      228  }
      229 
      230  media_info->set_media_duration_seconds(duration_seconds);
      231 
      232  return true;
      233 }
      234 
      235 void SetContentProtectionFields(
      236  FourCC protection_scheme,
      237  const std::vector<uint8_t>& default_key_id,
      238  const std::vector<ProtectionSystemSpecificInfo>& key_system_info,
      239  MediaInfo* media_info) {
      240  DCHECK(media_info);
      241  MediaInfo::ProtectedContent* protected_content =
      242  media_info->mutable_protected_content();
      243  protected_content->set_protection_scheme(FourCCToString(protection_scheme));
      244 
      245  if (!default_key_id.empty()) {
      246  protected_content->set_default_key_id(default_key_id.data(),
      247  default_key_id.size());
      248  }
      249 
      250  for (const ProtectionSystemSpecificInfo& info : key_system_info) {
      251  MediaInfo::ProtectedContent::ContentProtectionEntry* entry =
      252  protected_content->add_content_protection_entry();
      253  entry->set_uuid(CreateUUIDString(info.system_id));
      254 
      255  const std::vector<uint8_t>& pssh = info.psshs;
      256  entry->set_pssh(pssh.data(), pssh.size());
      257  }
      258 }
      259 
      260 std::string CreateUUIDString(const std::vector<uint8_t>& data) {
      261  DCHECK_EQ(16u, data.size());
      262  std::string uuid =
      263  base::ToLowerASCII(base::HexEncode(data.data(), data.size()));
      264  uuid.insert(20, "-");
      265  uuid.insert(16, "-");
      266  uuid.insert(12, "-");
      267  uuid.insert(8, "-");
      268  return uuid;
      269 }
      270 
      271 } // namespace internal
      272 } // namespace media
      273 } // namespace shaka
      All the methods that are virtual are virtual for mocking.
      diff --git a/docs/d9/deb/classshaka_1_1hls_1_1HlsNotifier.html b/docs/d9/deb/classshaka_1_1hls_1_1HlsNotifier.html index 44ed50d2d5..a2f1d3afc0 100644 --- a/docs/d9/deb/classshaka_1_1hls_1_1HlsNotifier.html +++ b/docs/d9/deb/classshaka_1_1hls_1_1HlsNotifier.html @@ -506,7 +506,7 @@ Public Member Functions
      diff --git a/docs/d9/ded/aac__audio__specific__config_8cc_source.html b/docs/d9/ded/aac__audio__specific__config_8cc_source.html index c6d9743bfa..a108259baa 100644 --- a/docs/d9/ded/aac__audio__specific__config_8cc_source.html +++ b/docs/d9/ded/aac__audio__specific__config_8cc_source.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/d9/df8/structshaka_1_1media_1_1mp4_1_1TrackFragmentDecodeTime-members.html b/docs/d9/df8/structshaka_1_1media_1_1mp4_1_1TrackFragmentDecodeTime-members.html index 689e6dc61b..041df17e7d 100644 --- a/docs/d9/df8/structshaka_1_1media_1_1mp4_1_1TrackFragmentDecodeTime-members.html +++ b/docs/d9/df8/structshaka_1_1media_1_1mp4_1_1TrackFragmentDecodeTime-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/d9/df9/classshaka_1_1media_1_1OffsetByteQueue.html b/docs/d9/df9/classshaka_1_1media_1_1OffsetByteQueue.html index 0008f95f19..32ff597d5b 100644 --- a/docs/d9/df9/classshaka_1_1media_1_1OffsetByteQueue.html +++ b/docs/d9/df9/classshaka_1_1media_1_1OffsetByteQueue.html @@ -226,7 +226,7 @@ false if max_offset > diff --git a/docs/d9/dfc/hls__audio__util_8cc_source.html b/docs/d9/dfc/hls__audio__util_8cc_source.html index 1e5cb0ad8f..39b0a37547 100644 --- a/docs/d9/dfc/hls__audio__util_8cc_source.html +++ b/docs/d9/dfc/hls__audio__util_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d9/dfe/classshaka_1_1UdpOptions.html b/docs/d9/dfe/classshaka_1_1UdpOptions.html index 4d9c741c00..da78cb3cd5 100644 --- a/docs/d9/dfe/classshaka_1_1UdpOptions.html +++ b/docs/d9/dfe/classshaka_1_1UdpOptions.html @@ -152,7 +152,7 @@ Static Public Member Functions diff --git a/docs/d9/dff/structshaka_1_1media_1_1H264ModificationOfPicNum.html b/docs/d9/dff/structshaka_1_1media_1_1H264ModificationOfPicNum.html index 0c146e58ef..dcbd48193a 100644 --- a/docs/d9/dff/structshaka_1_1media_1_1H264ModificationOfPicNum.html +++ b/docs/d9/dff/structshaka_1_1media_1_1H264ModificationOfPicNum.html @@ -95,7 +95,7 @@ union { diff --git a/docs/da/d02/classshaka_1_1media_1_1Id3Tag-members.html b/docs/da/d02/classshaka_1_1media_1_1Id3Tag-members.html index 36351550cd..b145316a7d 100644 --- a/docs/da/d02/classshaka_1_1media_1_1Id3Tag-members.html +++ b/docs/da/d02/classshaka_1_1media_1_1Id3Tag-members.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/da/d04/audio__stream__info_8cc_source.html b/docs/da/d04/audio__stream__info_8cc_source.html index e7ab33ced4..cedaab40df 100644 --- a/docs/da/d04/audio__stream__info_8cc_source.html +++ b/docs/da/d04/audio__stream__info_8cc_source.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/da/d05/classshaka_1_1hls_1_1MediaPlaylist-members.html b/docs/da/d05/classshaka_1_1hls_1_1MediaPlaylist-members.html index a91f477998..829b8850ee 100644 --- a/docs/da/d05/classshaka_1_1hls_1_1MediaPlaylist-members.html +++ b/docs/da/d05/classshaka_1_1hls_1_1MediaPlaylist-members.html @@ -96,7 +96,7 @@ $(function() { diff --git a/docs/da/d10/classshaka_1_1media_1_1mp2t_1_1EsParser.html b/docs/da/d10/classshaka_1_1media_1_1mp2t_1_1EsParser.html index c5e78c2bf1..df7d760e57 100644 --- a/docs/da/d10/classshaka_1_1media_1_1mp2t_1_1EsParser.html +++ b/docs/da/d10/classshaka_1_1media_1_1mp2t_1_1EsParser.html @@ -119,7 +119,7 @@ uint32_t pid () diff --git a/docs/da/d17/classshaka_1_1media_1_1mp2t_1_1AudioProgramMapTableWriter-members.html b/docs/da/d17/classshaka_1_1media_1_1mp2t_1_1AudioProgramMapTableWriter-members.html index 8c1ecb7531..28366db6b6 100644 --- a/docs/da/d17/classshaka_1_1media_1_1mp2t_1_1AudioProgramMapTableWriter-members.html +++ b/docs/da/d17/classshaka_1_1media_1_1mp2t_1_1AudioProgramMapTableWriter-members.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/da/d1a/structshaka_1_1media_1_1mp4_1_1Language.html b/docs/da/d1a/structshaka_1_1media_1_1mp4_1_1Language.html index 74ed99e3f9..a938bcc165 100644 --- a/docs/da/d1a/structshaka_1_1media_1_1mp4_1_1Language.html +++ b/docs/da/d1a/structshaka_1_1media_1_1mp4_1_1Language.html @@ -96,7 +96,7 @@ std::string code< diff --git a/docs/da/d1c/classshaka_1_1media_1_1mp2t_1_1TsSection.html b/docs/da/d1c/classshaka_1_1media_1_1mp2t_1_1TsSection.html index bd0294618c..c309188989 100644 --- a/docs/da/d1c/classshaka_1_1media_1_1mp2t_1_1TsSection.html +++ b/docs/da/d1c/classshaka_1_1media_1_1mp2t_1_1TsSection.html @@ -117,7 +117,7 @@ virtual void Reset ()= diff --git a/docs/da/d1d/udp__options_8cc_source.html b/docs/da/d1d/udp__options_8cc_source.html index 6e728de8e6..30da5d9ab3 100644 --- a/docs/da/d1d/udp__options_8cc_source.html +++ b/docs/da/d1d/udp__options_8cc_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/da/d23/classshaka_1_1media_1_1mp2t_1_1EsParserH26x.html b/docs/da/d23/classshaka_1_1media_1_1mp2t_1_1EsParserH26x.html index ed509274f2..b97fca91b6 100644 --- a/docs/da/d23/classshaka_1_1media_1_1mp2t_1_1EsParserH26x.html +++ b/docs/da/d23/classshaka_1_1media_1_1mp2t_1_1EsParserH26x.html @@ -136,7 +136,7 @@ typedef base::Callback< void(uint32_t, const std::shared_ptr< diff --git a/docs/da/d23/ts__muxer_8h_source.html b/docs/da/d23/ts__muxer_8h_source.html index 452bf97a95..565da23318 100644 --- a/docs/da/d23/ts__muxer_8h_source.html +++ b/docs/da/d23/ts__muxer_8h_source.html @@ -66,7 +66,7 @@ $(function() {
      ts_muxer.h
      -
      1 // Copyright 2016 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #ifndef PACKAGER_MEDIA_FORMATS_MP2T_TS_MUXER_H_
      8 #define PACKAGER_MEDIA_FORMATS_MP2T_TS_MUXER_H_
      9 
      10 #include "packager/base/macros.h"
      11 #include "packager/media/base/muxer.h"
      12 #include "packager/media/formats/mp2t/ts_segmenter.h"
      13 
      14 namespace shaka {
      15 namespace media {
      16 namespace mp2t {
      17 
      20 class TsMuxer : public Muxer {
      21  public:
      22  explicit TsMuxer(const MuxerOptions& muxer_options);
      23  ~TsMuxer() override;
      24 
      25  private:
      26  // Muxer implementation.
      27  Status InitializeMuxer() override;
      28  Status Finalize() override;
      29  Status AddSample(size_t stream_id,
      30  const MediaSample& sample) override;
      31  Status FinalizeSegment(size_t stream_id,
      32  const SegmentInfo& sample) override;
      33 
      34  void FireOnMediaStartEvent();
      35  void FireOnMediaEndEvent();
      36 
      37  std::unique_ptr<TsSegmenter> segmenter_;
      38 
      39  DISALLOW_COPY_AND_ASSIGN(TsMuxer);
      40 };
      41 
      42 } // namespace mp2t
      43 } // namespace media
      44 } // namespace shaka
      45 
      46 #endif // PACKAGER_MEDIA_FORMATS_MP2T_TS_MUXER_H_
      +
      1 // Copyright 2016 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #ifndef PACKAGER_MEDIA_FORMATS_MP2T_TS_MUXER_H_
      8 #define PACKAGER_MEDIA_FORMATS_MP2T_TS_MUXER_H_
      9 
      10 #include "packager/base/macros.h"
      11 #include "packager/media/base/muxer.h"
      12 #include "packager/media/formats/mp2t/ts_segmenter.h"
      13 
      14 namespace shaka {
      15 namespace media {
      16 namespace mp2t {
      17 
      20 class TsMuxer : public Muxer {
      21  public:
      22  explicit TsMuxer(const MuxerOptions& muxer_options);
      23  ~TsMuxer() override;
      24 
      25  private:
      26  // Muxer implementation.
      27  Status InitializeMuxer() override;
      28  Status Finalize() override;
      29  Status AddSample(size_t stream_id,
      30  const MediaSample& sample) override;
      31  Status FinalizeSegment(size_t stream_id,
      32  const SegmentInfo& sample) override;
      33 
      34  void FireOnMediaStartEvent();
      35  void FireOnMediaEndEvent();
      36 
      37  std::unique_ptr<TsSegmenter> segmenter_;
      38 
      39  DISALLOW_COPY_AND_ASSIGN(TsMuxer);
      40 };
      41 
      42 } // namespace mp2t
      43 } // namespace media
      44 } // namespace shaka
      45 
      46 #endif // PACKAGER_MEDIA_FORMATS_MP2T_TS_MUXER_H_
      All the methods that are virtual are virtual for mocking.
      This structure contains the list of configuration options for Muxer.
      Definition: muxer_options.h:20
      @@ -76,7 +76,7 @@ $(function() {
      diff --git a/docs/da/d24/h265__parser_8h_source.html b/docs/da/d24/h265__parser_8h_source.html index b1e2b41210..3b86741b0d 100644 --- a/docs/da/d24/h265__parser_8h_source.html +++ b/docs/da/d24/h265__parser_8h_source.html @@ -80,7 +80,7 @@ $(function() {
      diff --git a/docs/da/d2a/classshaka_1_1media_1_1MuxerFactory.html b/docs/da/d2a/classshaka_1_1media_1_1MuxerFactory.html index 63c8e064bf..e0cd7ab9a8 100644 --- a/docs/da/d2a/classshaka_1_1media_1_1MuxerFactory.html +++ b/docs/da/d2a/classshaka_1_1media_1_1MuxerFactory.html @@ -146,7 +146,7 @@ Public Member Functions diff --git a/docs/da/d2a/text__stream__info_8h_source.html b/docs/da/d2a/text__stream__info_8h_source.html index 489d1eb446..d99e2c8ef2 100644 --- a/docs/da/d2a/text__stream__info_8h_source.html +++ b/docs/da/d2a/text__stream__info_8h_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/da/d2c/classshaka_1_1BandwidthEstimator.html b/docs/da/d2c/classshaka_1_1BandwidthEstimator.html index a67a277f87..c8d0094b30 100644 --- a/docs/da/d2c/classshaka_1_1BandwidthEstimator.html +++ b/docs/da/d2c/classshaka_1_1BandwidthEstimator.html @@ -208,7 +208,7 @@ Static Public Attributes diff --git a/docs/da/d2d/classshaka_1_1media_1_1webm_1_1WebMMuxer-members.html b/docs/da/d2d/classshaka_1_1media_1_1webm_1_1WebMMuxer-members.html index 04adb53f32..36dbc2ec59 100644 --- a/docs/da/d2d/classshaka_1_1media_1_1webm_1_1WebMMuxer-members.html +++ b/docs/da/d2d/classshaka_1_1media_1_1webm_1_1WebMMuxer-members.html @@ -90,7 +90,7 @@ $(function() { muxer_listener() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected next_output_stream_index() const (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected num_input_streams() const (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected - OnFlushRequest(size_t input_stream_index) overrideshaka::media::Muxerinlineprotectedvirtual + OnFlushRequest(size_t input_stream_index) overrideshaka::media::Muxerprotectedvirtual options() const (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected Process(std::unique_ptr< StreamData > stream_data) overrideshaka::media::Muxerprotectedvirtual @@ -108,7 +108,7 @@ $(function() { diff --git a/docs/da/d3e/structshaka_1_1media_1_1mp4_1_1PixelAspectRatio-members.html b/docs/da/d3e/structshaka_1_1media_1_1mp4_1_1PixelAspectRatio-members.html index b8ed4c8d9c..bb676e014d 100644 --- a/docs/da/d3e/structshaka_1_1media_1_1mp4_1_1PixelAspectRatio-members.html +++ b/docs/da/d3e/structshaka_1_1media_1_1mp4_1_1PixelAspectRatio-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/docs/da/d41/mp4_2multi__segment__segmenter_8h_source.html b/docs/da/d41/mp4_2multi__segment__segmenter_8h_source.html index 4019399cbe..586a59c5b1 100644 --- a/docs/da/d41/mp4_2multi__segment__segmenter_8h_source.html +++ b/docs/da/d41/mp4_2multi__segment__segmenter_8h_source.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/da/d43/structshaka_1_1ContentProtectionElement.html b/docs/da/d43/structshaka_1_1ContentProtectionElement.html index 9706cf5649..4f074f3049 100644 --- a/docs/da/d43/structshaka_1_1ContentProtectionElement.html +++ b/docs/da/d43/structshaka_1_1ContentProtectionElement.html @@ -98,7 +98,7 @@ std::vector< El diff --git a/docs/da/d4a/media__playlist_8h_source.html b/docs/da/d4a/media__playlist_8h_source.html index 23dc77c6fb..7a9a156340 100644 --- a/docs/da/d4a/media__playlist_8h_source.html +++ b/docs/da/d4a/media__playlist_8h_source.html @@ -66,7 +66,7 @@ $(function() {
      media_playlist.h
      -
      1 // Copyright 2016 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #ifndef PACKAGER_HLS_BASE_MEDIA_PLAYLIST_H_
      8 #define PACKAGER_HLS_BASE_MEDIA_PLAYLIST_H_
      9 
      10 #include <list>
      11 #include <memory>
      12 #include <string>
      13 
      14 #include "packager/base/macros.h"
      15 #include "packager/hls/public/hls_params.h"
      16 #include "packager/mpd/base/media_info.pb.h"
      17 
      18 namespace shaka {
      19 
      20 class File;
      21 
      22 namespace hls {
      23 
      24 class HlsEntry {
      25  public:
      26  enum class EntryType {
      27  kExtInf,
      28  kExtKey,
      29  kExtDiscontinuity,
      30  kExtPlacementOpportunity,
      31  };
      32  virtual ~HlsEntry();
      33 
      34  EntryType type() const { return type_; }
      35  virtual std::string ToString() = 0;
      36 
      37  protected:
      38  explicit HlsEntry(EntryType type);
      39 
      40  private:
      41  EntryType type_;
      42 };
      43 
      46  public:
      47  enum class MediaPlaylistStreamType {
      48  kUnknown,
      49  kAudio,
      50  kVideo,
      51  kVideoIFramesOnly,
      52  kSubtitle,
      53  };
      54  enum class EncryptionMethod {
      55  kNone, // No encryption, i.e. clear.
      56  kAes128, // Completely encrypted using AES-CBC.
      57  kSampleAes, // Encrypted using SAMPLE-AES method.
      58  kSampleAesCenc, // 'cenc' encrypted content.
      59  };
      60 
      68  MediaPlaylist(const HlsParams& hls_params,
      69  const std::string& file_name,
      70  const std::string& name,
      71  const std::string& group_id);
      72  virtual ~MediaPlaylist();
      73 
      74  const std::string& file_name() const { return file_name_; }
      75  const std::string& name() const { return name_; }
      76  const std::string& group_id() const { return group_id_; }
      77  MediaPlaylistStreamType stream_type() const { return stream_type_; }
      78  const std::string& codec() const { return codec_; }
      79 
      81  void SetStreamTypeForTesting(MediaPlaylistStreamType stream_type);
      82 
      84  void SetCodecForTesting(const std::string& codec);
      85 
      87  void SetLanguageForTesting(const std::string& language);
      88 
      93  virtual bool SetMediaInfo(const MediaInfo& media_info);
      94 
      102  virtual void AddSegment(const std::string& file_name,
      103  uint64_t start_time,
      104  uint64_t duration,
      105  uint64_t start_byte_offset,
      106  uint64_t size);
      107 
      114  virtual void AddKeyFrame(uint64_t timestamp,
      115  uint64_t start_byte_offset,
      116  uint64_t size);
      117 
      129  virtual void AddEncryptionInfo(EncryptionMethod method,
      130  const std::string& url,
      131  const std::string& key_id,
      132  const std::string& iv,
      133  const std::string& key_format,
      134  const std::string& key_format_versions);
      135 
      138  virtual void AddPlacementOpportunity();
      139 
      150  virtual bool WriteToFile(const std::string& file_path);
      151 
      155  virtual uint64_t Bitrate() const;
      156 
      159  virtual double GetLongestSegmentDuration() const;
      160 
      168  virtual void SetTargetDuration(uint32_t target_duration);
      169 
      171  virtual int GetNumChannels() const;
      172 
      175  virtual bool GetDisplayResolution(uint32_t* width, uint32_t* height) const;
      176 
      179  std::string language() const { return language_; }
      180 
      181  private:
      182  // Add a SegmentInfoEntry (#EXTINF).
      183  void AddSegmentInfoEntry(const std::string& segment_file_name,
      184  uint64_t start_time,
      185  uint64_t duration,
      186  uint64_t start_byte_offset,
      187  uint64_t size);
      188  // Remove elements from |entries_| for live profile. Increments
      189  // |sequence_number_| by the number of segments removed.
      190  void SlideWindow();
      191  // Remove the segment specified by |start_time|. The actual deletion can
      192  // happen at a later time depending on the value of
      193  // |preserved_segment_outside_live_window| in |hls_params_|.
      194  void RemoveOldSegment(uint64_t start_time);
      195 
      196  const HlsParams& hls_params_;
      197  // Mainly for MasterPlaylist to use these values.
      198  const std::string file_name_;
      199  const std::string name_;
      200  const std::string group_id_;
      201  MediaInfo media_info_;
      202  MediaPlaylistStreamType stream_type_ = MediaPlaylistStreamType::kUnknown;
      203  // Whether to use byte range for SegmentInfoEntry.
      204  bool use_byte_range_ = false;
      205  std::string codec_;
      206  std::string language_;
      207  int media_sequence_number_ = 0;
      208  bool inserted_discontinuity_tag_ = false;
      209  int discontinuity_sequence_number_ = 0;
      210 
      211  double longest_segment_duration_ = 0.0;
      212  uint32_t time_scale_ = 0;
      213 
      214  uint64_t max_bitrate_ = 0;
      215 
      216  // Cache the previous calls AddSegment() end offset. This is used to construct
      217  // SegmentInfoEntry.
      218  uint64_t previous_segment_end_offset_ = 0;
      219 
      220  // See SetTargetDuration() comments.
      221  bool target_duration_set_ = false;
      222  uint32_t target_duration_ = 0;
      223 
      224  std::list<std::unique_ptr<HlsEntry>> entries_;
      225  // A list to hold the file names of the segments to be removed temporarily.
      226  // Once a file is actually removed, it is removed from the list.
      227  std::list<std::string> segments_to_be_removed_;
      228 
      229  // Used by kVideoIFrameOnly playlists to track the i-frames (key frames).
      230  struct KeyFrameInfo {
      231  uint64_t timestamp;
      232  uint64_t start_byte_offset;
      233  uint64_t size;
      234  uint64_t duration;
      235  std::string segment_file_name;
      236  };
      237  std::list<KeyFrameInfo> key_frames_;
      238 
      239  DISALLOW_COPY_AND_ASSIGN(MediaPlaylist);
      240 };
      241 
      242 } // namespace hls
      243 } // namespace shaka
      244 
      245 #endif // PACKAGER_HLS_BASE_MEDIA_PLAYLIST_H_
      +
      1 // Copyright 2016 Google Inc. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file or at
      5 // https://developers.google.com/open-source/licenses/bsd
      6 
      7 #ifndef PACKAGER_HLS_BASE_MEDIA_PLAYLIST_H_
      8 #define PACKAGER_HLS_BASE_MEDIA_PLAYLIST_H_
      9 
      10 #include <list>
      11 #include <memory>
      12 #include <string>
      13 
      14 #include "packager/base/macros.h"
      15 #include "packager/hls/public/hls_params.h"
      16 #include "packager/mpd/base/media_info.pb.h"
      17 
      18 namespace shaka {
      19 
      20 class File;
      21 
      22 namespace hls {
      23 
      24 class HlsEntry {
      25  public:
      26  enum class EntryType {
      27  kExtInf,
      28  kExtKey,
      29  kExtDiscontinuity,
      30  kExtPlacementOpportunity,
      31  };
      32  virtual ~HlsEntry();
      33 
      34  EntryType type() const { return type_; }
      35  virtual std::string ToString() = 0;
      36 
      37  protected:
      38  explicit HlsEntry(EntryType type);
      39 
      40  private:
      41  EntryType type_;
      42 };
      43 
      46  public:
      47  enum class MediaPlaylistStreamType {
      48  kUnknown,
      49  kAudio,
      50  kVideo,
      51  kVideoIFramesOnly,
      52  kSubtitle,
      53  };
      54  enum class EncryptionMethod {
      55  kNone, // No encryption, i.e. clear.
      56  kAes128, // Completely encrypted using AES-CBC.
      57  kSampleAes, // Encrypted using SAMPLE-AES method.
      58  kSampleAesCenc, // 'cenc' encrypted content.
      59  };
      60 
      68  MediaPlaylist(const HlsParams& hls_params,
      69  const std::string& file_name,
      70  const std::string& name,
      71  const std::string& group_id);
      72  virtual ~MediaPlaylist();
      73 
      74  const std::string& file_name() const { return file_name_; }
      75  const std::string& name() const { return name_; }
      76  const std::string& group_id() const { return group_id_; }
      77  MediaPlaylistStreamType stream_type() const { return stream_type_; }
      78  const std::string& codec() const { return codec_; }
      79 
      81  void SetStreamTypeForTesting(MediaPlaylistStreamType stream_type);
      82 
      84  void SetCodecForTesting(const std::string& codec);
      85 
      87  void SetLanguageForTesting(const std::string& language);
      88 
      93  virtual bool SetMediaInfo(const MediaInfo& media_info);
      94 
      102  virtual void AddSegment(const std::string& file_name,
      103  uint64_t start_time,
      104  uint64_t duration,
      105  uint64_t start_byte_offset,
      106  uint64_t size);
      107 
      114  virtual void AddKeyFrame(uint64_t timestamp,
      115  uint64_t start_byte_offset,
      116  uint64_t size);
      117 
      129  virtual void AddEncryptionInfo(EncryptionMethod method,
      130  const std::string& url,
      131  const std::string& key_id,
      132  const std::string& iv,
      133  const std::string& key_format,
      134  const std::string& key_format_versions);
      135 
      138  virtual void AddPlacementOpportunity();
      139 
      150  virtual bool WriteToFile(const std::string& file_path);
      151 
      155  virtual uint64_t Bitrate() const;
      156 
      159  virtual double GetLongestSegmentDuration() const;
      160 
      168  virtual void SetTargetDuration(uint32_t target_duration);
      169 
      171  virtual int GetNumChannels() const;
      172 
      175  virtual bool GetDisplayResolution(uint32_t* width, uint32_t* height) const;
      176 
      179  std::string language() const { return language_; }
      180 
      181  private:
      182  // Add a SegmentInfoEntry (#EXTINF).
      183  void AddSegmentInfoEntry(const std::string& segment_file_name,
      184  uint64_t start_time,
      185  uint64_t duration,
      186  uint64_t start_byte_offset,
      187  uint64_t size);
      188  // Adjust the duration of the last SegmentInfoEntry to end on
      189  // |next_timestamp|.
      190  void AdjustLastSegmentInfoEntryDuration(uint64_t next_timestamp);
      191  // Remove elements from |entries_| for live profile. Increments
      192  // |sequence_number_| by the number of segments removed.
      193  void SlideWindow();
      194  // Remove the segment specified by |start_time|. The actual deletion can
      195  // happen at a later time depending on the value of
      196  // |preserved_segment_outside_live_window| in |hls_params_|.
      197  void RemoveOldSegment(uint64_t start_time);
      198 
      199  const HlsParams& hls_params_;
      200  // Mainly for MasterPlaylist to use these values.
      201  const std::string file_name_;
      202  const std::string name_;
      203  const std::string group_id_;
      204  MediaInfo media_info_;
      205  MediaPlaylistStreamType stream_type_ = MediaPlaylistStreamType::kUnknown;
      206  // Whether to use byte range for SegmentInfoEntry.
      207  bool use_byte_range_ = false;
      208  std::string codec_;
      209  std::string language_;
      210  int media_sequence_number_ = 0;
      211  bool inserted_discontinuity_tag_ = false;
      212  int discontinuity_sequence_number_ = 0;
      213 
      214  double longest_segment_duration_ = 0.0;
      215  uint32_t time_scale_ = 0;
      216 
      217  uint64_t max_bitrate_ = 0;
      218 
      219  // Cache the previous calls AddSegment() end offset. This is used to construct
      220  // SegmentInfoEntry.
      221  uint64_t previous_segment_end_offset_ = 0;
      222 
      223  // See SetTargetDuration() comments.
      224  bool target_duration_set_ = false;
      225  uint32_t target_duration_ = 0;
      226 
      227  std::list<std::unique_ptr<HlsEntry>> entries_;
      228  // A list to hold the file names of the segments to be removed temporarily.
      229  // Once a file is actually removed, it is removed from the list.
      230  std::list<std::string> segments_to_be_removed_;
      231 
      232  // Used by kVideoIFrameOnly playlists to track the i-frames (key frames).
      233  struct KeyFrameInfo {
      234  uint64_t timestamp;
      235  uint64_t start_byte_offset;
      236  uint64_t size;
      237  std::string segment_file_name;
      238  };
      239  std::list<KeyFrameInfo> key_frames_;
      240 
      241  DISALLOW_COPY_AND_ASSIGN(MediaPlaylist);
      242 };
      243 
      244 } // namespace hls
      245 } // namespace shaka
      246 
      247 #endif // PACKAGER_HLS_BASE_MEDIA_PLAYLIST_H_
      HLS related parameters.
      Definition: hls_params.h:23
      std::string language() const
      All the methods that are virtual are virtual for mocking.
      @@ -74,7 +74,7 @@ $(function() {
      diff --git a/docs/da/d4e/classshaka_1_1media_1_1AudioStreamInfo.html b/docs/da/d4e/classshaka_1_1media_1_1AudioStreamInfo.html index 335491116e..d4a586de50 100644 --- a/docs/da/d4e/classshaka_1_1media_1_1AudioStreamInfo.html +++ b/docs/da/d4e/classshaka_1_1media_1_1AudioStreamInfo.html @@ -342,7 +342,7 @@ Static Public Member Functions
      diff --git a/docs/da/d50/structshaka_1_1media_1_1mp4_1_1MovieExtendsHeader.html b/docs/da/d50/structshaka_1_1media_1_1mp4_1_1MovieExtendsHeader.html index d794d06ed5..0c829e8ef1 100644 --- a/docs/da/d50/structshaka_1_1media_1_1mp4_1_1MovieExtendsHeader.html +++ b/docs/da/d50/structshaka_1_1media_1_1mp4_1_1MovieExtendsHeader.html @@ -103,14 +103,14 @@ Public Member Functions

      Public Attributes

      -uint64_t fragment_duration +uint64_t fragment_duration = 0u   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

      @@ -121,7 +121,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 631 of file box_definitions.h.

      +

      Definition at line 636 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -149,7 +149,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 2115 of file box_definitions.cc.

      +

      Definition at line 2170 of file box_definitions.cc.

      @@ -160,7 +160,7 @@ Additional Inherited Members diff --git a/docs/da/d52/classshaka_1_1media_1_1MuxerListenerFactory-members.html b/docs/da/d52/classshaka_1_1media_1_1MuxerListenerFactory-members.html index 59ad8724b7..01483b57e6 100644 --- a/docs/da/d52/classshaka_1_1media_1_1MuxerListenerFactory-members.html +++ b/docs/da/d52/classshaka_1_1media_1_1MuxerListenerFactory-members.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/da/d53/es__parser__h265_8cc_source.html b/docs/da/d53/es__parser__h265_8cc_source.html index f0a96c9084..07bbe48c8c 100644 --- a/docs/da/d53/es__parser__h265_8cc_source.html +++ b/docs/da/d53/es__parser__h265_8cc_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/da/d55/simple__hls__notifier_8h_source.html b/docs/da/d55/simple__hls__notifier_8h_source.html index 217eaa221b..ab0c01465c 100644 --- a/docs/da/d55/simple__hls__notifier_8h_source.html +++ b/docs/da/d55/simple__hls__notifier_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/da/d59/structshaka_1_1media_1_1mp4_1_1CompactSampleSize.html b/docs/da/d59/structshaka_1_1media_1_1mp4_1_1CompactSampleSize.html index 881b17aa67..470b17e9bf 100644 --- a/docs/da/d59/structshaka_1_1media_1_1mp4_1_1CompactSampleSize.html +++ b/docs/da/d59/structshaka_1_1media_1_1mp4_1_1CompactSampleSize.html @@ -103,17 +103,17 @@ Public Member Functions

      Public Attributes

      -uint8_t field_size +uint8_t field_size = 0u   std::vector< uint32_t > sizes   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

      @@ -124,7 +124,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 451 of file box_definitions.h.

      +

      Definition at line 462 of file box_definitions.h.

      Member Function Documentation

      ◆ BoxType()

      @@ -152,7 +152,7 @@ Additional Inherited Members

      Implements shaka::media::mp4::Box.

      -

      Definition at line 800 of file box_definitions.cc.

      +

      Definition at line 817 of file box_definitions.cc.

      @@ -163,7 +163,7 @@ Additional Inherited Members diff --git a/docs/da/d5c/widevine__key__source_8h_source.html b/docs/da/d5c/widevine__key__source_8h_source.html index fcd0aac197..b15a6785c6 100644 --- a/docs/da/d5c/widevine__key__source_8h_source.html +++ b/docs/da/d5c/widevine__key__source_8h_source.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/da/d5e/classshaka_1_1media_1_1H264VideoSliceHeaderParser-members.html b/docs/da/d5e/classshaka_1_1media_1_1H264VideoSliceHeaderParser-members.html index a0b10499b0..d45a93521a 100644 --- a/docs/da/d5e/classshaka_1_1media_1_1H264VideoSliceHeaderParser-members.html +++ b/docs/da/d5e/classshaka_1_1media_1_1H264VideoSliceHeaderParser-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/da/d60/classshaka_1_1media_1_1mp4_1_1SingleSegmentSegmenter-members.html b/docs/da/d60/classshaka_1_1media_1_1mp4_1_1SingleSegmentSegmenter-members.html index 156d3666b7..a5bf737f00 100644 --- a/docs/da/d60/classshaka_1_1media_1_1mp4_1_1SingleSegmentSegmenter-members.html +++ b/docs/da/d60/classshaka_1_1media_1_1mp4_1_1SingleSegmentSegmenter-members.html @@ -97,7 +97,7 @@ $(function() { diff --git a/docs/da/d6a/classshaka_1_1media_1_1mp2t_1_1VideoProgramMapTableWriter.html b/docs/da/d6a/classshaka_1_1media_1_1mp2t_1_1VideoProgramMapTableWriter.html index dc1f2631bf..48f30a2b98 100644 --- a/docs/da/d6a/classshaka_1_1media_1_1mp2t_1_1VideoProgramMapTableWriter.html +++ b/docs/da/d6a/classshaka_1_1media_1_1mp2t_1_1VideoProgramMapTableWriter.html @@ -126,7 +126,7 @@ static const uint8_t kElem diff --git a/docs/da/d6e/structshaka_1_1media_1_1mp4_1_1AudioRollRecoveryEntry.html b/docs/da/d6e/structshaka_1_1media_1_1mp4_1_1AudioRollRecoveryEntry.html index 199fc8ca91..a8868cec44 100644 --- a/docs/da/d6e/structshaka_1_1media_1_1mp4_1_1AudioRollRecoveryEntry.html +++ b/docs/da/d6e/structshaka_1_1media_1_1mp4_1_1AudioRollRecoveryEntry.html @@ -83,12 +83,12 @@ uint32_t ComputeSize (

      Public Attributes

      -int16_t roll_distance +int16_t roll_distance = 0  

      Detailed Description

      -

      Definition at line 496 of file box_definitions.h.

      +

      Definition at line 504 of file box_definitions.h.


      The documentation for this struct was generated from the following files:
      • packager/media/formats/mp4/box_definitions.h
      • packager/media/formats/mp4/box_definitions.cc
      • @@ -96,7 +96,7 @@ int16_t roll_distance< diff --git a/docs/da/d85/classshaka_1_1media_1_1mp2t_1_1TsSegmenter-members.html b/docs/da/d85/classshaka_1_1media_1_1mp2t_1_1TsSegmenter-members.html index eab7f36313..c0e78073c0 100644 --- a/docs/da/d85/classshaka_1_1media_1_1mp2t_1_1TsSegmenter-members.html +++ b/docs/da/d85/classshaka_1_1media_1_1mp2t_1_1TsSegmenter-members.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/da/d88/mp4__muxer_8cc_source.html b/docs/da/d88/mp4__muxer_8cc_source.html index 34632576b4..dec7dc5caa 100644 --- a/docs/da/d88/mp4__muxer_8cc_source.html +++ b/docs/da/d88/mp4__muxer_8cc_source.html @@ -68,23 +68,23 @@ $(function() {
        1 // Copyright 2014 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #include "packager/media/formats/mp4/mp4_muxer.h"
        8 
        9 #include "packager/base/time/clock.h"
        10 #include "packager/base/time/time.h"
        11 #include "packager/file/file.h"
        12 #include "packager/media/base/aes_encryptor.h"
        13 #include "packager/media/base/audio_stream_info.h"
        14 #include "packager/media/base/fourccs.h"
        15 #include "packager/media/base/key_source.h"
        16 #include "packager/media/base/media_sample.h"
        17 #include "packager/media/base/text_stream_info.h"
        18 #include "packager/media/base/video_stream_info.h"
        19 #include "packager/media/codecs/es_descriptor.h"
        20 #include "packager/media/event/muxer_listener.h"
        21 #include "packager/media/formats/mp4/box_definitions.h"
        22 #include "packager/media/formats/mp4/multi_segment_segmenter.h"
        23 #include "packager/media/formats/mp4/single_segment_segmenter.h"
        24 
        25 namespace shaka {
        26 namespace media {
        27 namespace mp4 {
        28 
        29 namespace {
        30 
        31 // Sets the range start and end value from offset and size.
        32 // |start| and |end| are for byte-range-spec specified in RFC2616.
        33 void SetStartAndEndFromOffsetAndSize(size_t offset,
        34  size_t size,
        35  Range* range) {
        36  DCHECK(range);
        37  range->start = static_cast<uint32_t>(offset);
        38  // Note that ranges are inclusive. So we need - 1.
        39  range->end = range->start + static_cast<uint32_t>(size) - 1;
        40 }
        41 
        42 FourCC CodecToFourCC(Codec codec, H26xStreamFormat h26x_stream_format) {
        43  switch (codec) {
        44  case kCodecH264:
        45  return h26x_stream_format ==
        46  H26xStreamFormat::kNalUnitStreamWithParameterSetNalus
        47  ? FOURCC_avc3
        48  : FOURCC_avc1;
        49  case kCodecH265:
        50  return h26x_stream_format ==
        51  H26xStreamFormat::kNalUnitStreamWithParameterSetNalus
        52  ? FOURCC_hev1
        53  : FOURCC_hvc1;
        54  case kCodecVP8:
        55  return FOURCC_vp08;
        56  case kCodecVP9:
        57  return FOURCC_vp09;
        58  case kCodecVP10:
        59  return FOURCC_vp10;
        60  case kCodecAAC:
        61  return FOURCC_mp4a;
        62  case kCodecAC3:
        63  return FOURCC_ac_3;
        64  case kCodecDTSC:
        65  return FOURCC_dtsc;
        66  case kCodecDTSH:
        67  return FOURCC_dtsh;
        68  case kCodecDTSL:
        69  return FOURCC_dtsl;
        70  case kCodecDTSE:
        71  return FOURCC_dtse;
        72  case kCodecDTSM:
        73  return FOURCC_dtsm;
        74  case kCodecEAC3:
        75  return FOURCC_ec_3;
        76  case kCodecFlac:
        77  return FOURCC_fLaC;
        78  case kCodecOpus:
        79  return FOURCC_Opus;
        80  default:
        81  return FOURCC_NULL;
        82  }
        83 }
        84 
        85 void GenerateSinf(FourCC old_type,
        86  const EncryptionConfig& encryption_config,
        87  ProtectionSchemeInfo* sinf) {
        88  sinf->format.format = old_type;
        89 
        90  DCHECK_NE(encryption_config.protection_scheme, FOURCC_NULL);
        91  sinf->type.type = encryption_config.protection_scheme;
        92 
        93  // The version of cenc implemented here. CENC 4.
        94  const int kCencSchemeVersion = 0x00010000;
        95  sinf->type.version = kCencSchemeVersion;
        96 
        97  auto& track_encryption = sinf->info.track_encryption;
        98  track_encryption.default_is_protected = 1;
        99 
        100  track_encryption.default_crypt_byte_block =
        101  encryption_config.crypt_byte_block;
        102  track_encryption.default_skip_byte_block = encryption_config.skip_byte_block;
        103  switch (encryption_config.protection_scheme) {
        104  case FOURCC_cenc:
        105  case FOURCC_cbc1:
        106  DCHECK_EQ(track_encryption.default_crypt_byte_block, 0u);
        107  DCHECK_EQ(track_encryption.default_skip_byte_block, 0u);
        108  // CENCv3 10.1 ‘cenc’ AES-CTR scheme and 10.2 ‘cbc1’ AES-CBC scheme:
        109  // The version of the Track Encryption Box (‘tenc’) SHALL be 0.
        110  track_encryption.version = 0;
        111  break;
        112  case FOURCC_cbcs:
        113  case FOURCC_cens:
        114  if (track_encryption.default_skip_byte_block == 0) {
        115  // Some clients, e.g. Safari v11.0.3 does not like having
        116  // crypt_byte_block as a non-zero value when skip_byte_block is zero.
        117  track_encryption.default_crypt_byte_block = 0;
        118  }
        119  // CENCv3 10.3 ‘cens’ AES-CTR subsample pattern encryption scheme and
        120  // 10.4 ‘cbcs’ AES-CBC subsample pattern encryption scheme:
        121  // The version of the Track Encryption Box (‘tenc’) SHALL be 1.
        122  track_encryption.version = 1;
        123  break;
        124  default:
        125  NOTREACHED() << "Unexpected protection scheme "
        126  << encryption_config.protection_scheme;
        127  }
        128 
        129  track_encryption.default_per_sample_iv_size =
        130  encryption_config.per_sample_iv_size;
        131  track_encryption.default_constant_iv = encryption_config.constant_iv;
        132  track_encryption.default_kid = encryption_config.key_id;
        133 }
        134 
        135 } // namespace
        136 
        137 MP4Muxer::MP4Muxer(const MuxerOptions& options) : Muxer(options) {}
        138 MP4Muxer::~MP4Muxer() {}
        139 
        140 Status MP4Muxer::InitializeMuxer() {
        141  DCHECK(!streams().empty());
        142 
        143  std::unique_ptr<FileType> ftyp(new FileType);
        144  std::unique_ptr<Movie> moov(new Movie);
        145 
        146  ftyp->major_brand = FOURCC_isom;
        147  ftyp->compatible_brands.push_back(FOURCC_iso8);
        148  ftyp->compatible_brands.push_back(FOURCC_mp41);
        149  ftyp->compatible_brands.push_back(FOURCC_dash);
        150 
        151  if (streams().size() == 1) {
        152  FourCC codec_fourcc = FOURCC_NULL;
        153  if (streams()[0]->stream_type() == kStreamVideo) {
        154  codec_fourcc =
        155  CodecToFourCC(streams()[0]->codec(),
        156  static_cast<const VideoStreamInfo*>(streams()[0].get())
        157  ->h26x_stream_format());
        158  if (codec_fourcc != FOURCC_NULL)
        159  ftyp->compatible_brands.push_back(codec_fourcc);
        160  }
        161 
        162  // CMAF allows only one track/stream per file.
        163  // CMAF requires single initialization switching for AVC3/HEV1, which is not
        164  // supported yet.
        165  if (codec_fourcc != FOURCC_avc3 && codec_fourcc != FOURCC_hev1)
        166  ftyp->compatible_brands.push_back(FOURCC_cmfc);
        167  }
        168 
        169  moov->header.creation_time = IsoTimeNow();
        170  moov->header.modification_time = IsoTimeNow();
        171  moov->header.next_track_id = static_cast<uint32_t>(streams().size()) + 1;
        172 
        173  moov->tracks.resize(streams().size());
        174  moov->extends.tracks.resize(streams().size());
        175 
        176  // Initialize tracks.
        177  for (uint32_t i = 0; i < streams().size(); ++i) {
        178  const StreamInfo* stream = streams()[i].get();
        179  Track& trak = moov->tracks[i];
        180  trak.header.track_id = i + 1;
        181 
        182  TrackExtends& trex = moov->extends.tracks[i];
        183  trex.track_id = trak.header.track_id;
        184  trex.default_sample_description_index = 1;
        185 
        186  bool generate_trak_result = false;
        187  switch (stream->stream_type()) {
        188  case kStreamVideo:
        189  generate_trak_result = GenerateVideoTrak(
        190  static_cast<const VideoStreamInfo*>(stream), &trak, i + 1);
        191  break;
        192  case kStreamAudio:
        193  generate_trak_result = GenerateAudioTrak(
        194  static_cast<const AudioStreamInfo*>(stream), &trak, i + 1);
        195  break;
        196  case kStreamText:
        197  generate_trak_result = GenerateTextTrak(
        198  static_cast<const TextStreamInfo*>(stream), &trak, i + 1);
        199  break;
        200  default:
        201  NOTIMPLEMENTED() << "Not implemented for stream type: "
        202  << stream->stream_type();
        203  }
        204  if (!generate_trak_result)
        205  return Status(error::MUXER_FAILURE, "Failed to generate trak.");
        206 
        207  if (stream->is_encrypted() && options().mp4_params.include_pssh_in_stream) {
        208  const auto& key_system_info = stream->encryption_config().key_system_info;
        209  moov->pssh.resize(key_system_info.size());
        210  for (size_t j = 0; j < key_system_info.size(); j++)
        211  moov->pssh[j].raw_box = key_system_info[j].psshs;
        212  }
        213  }
        214 
        215  if (options().segment_template.empty()) {
        216  segmenter_.reset(new SingleSegmentSegmenter(options(), std::move(ftyp),
        217  std::move(moov)));
        218  } else {
        219  segmenter_.reset(
        220  new MultiSegmentSegmenter(options(), std::move(ftyp), std::move(moov)));
        221  }
        222 
        223  const Status segmenter_initialized =
        224  segmenter_->Initialize(streams(), muxer_listener(), progress_listener());
        225  if (!segmenter_initialized.ok())
        226  return segmenter_initialized;
        227 
        228  FireOnMediaStartEvent();
        229  return Status::OK;
        230 }
        231 
        232 Status MP4Muxer::Finalize() {
        233  DCHECK(segmenter_);
        234  Status segmenter_finalized = segmenter_->Finalize();
        235 
        236  if (!segmenter_finalized.ok())
        237  return segmenter_finalized;
        238 
        239  FireOnMediaEndEvent();
        240  LOG(INFO) << "MP4 file '" << options().output_file_name << "' finalized.";
        241  return Status::OK;
        242 }
        243 
        244 Status MP4Muxer::AddSample(size_t stream_id, const MediaSample& sample) {
        245  DCHECK(segmenter_);
        246  return segmenter_->AddSample(stream_id, sample);
        247 }
        248 
        249 Status MP4Muxer::FinalizeSegment(size_t stream_id,
        250  const SegmentInfo& segment_info) {
        251  DCHECK(segmenter_);
        252  VLOG(3) << "Finalize " << (segment_info.is_subsegment ? "sub" : "")
        253  << "segment " << segment_info.start_timestamp << " duration "
        254  << segment_info.duration;
        255  return segmenter_->FinalizeSegment(stream_id, segment_info);
        256 }
        257 
        258 void MP4Muxer::InitializeTrak(const StreamInfo* info, Track* trak) {
        259  int64_t now = IsoTimeNow();
        260  trak->header.creation_time = now;
        261  trak->header.modification_time = now;
        262  trak->header.duration = 0;
        263  trak->media.header.creation_time = now;
        264  trak->media.header.modification_time = now;
        265  trak->media.header.timescale = info->time_scale();
        266  trak->media.header.duration = 0;
        267  if (!info->language().empty()) {
        268  // Strip off the subtag, if any.
        269  std::string main_language = info->language();
        270  size_t dash = main_language.find('-');
        271  if (dash != std::string::npos) {
        272  main_language.erase(dash);
        273  }
        274 
        275  // ISO-639-2/T main language code should be 3 characters.
        276  if (main_language.size() != 3) {
        277  LOG(WARNING) << "'" << main_language << "' is not a valid ISO-639-2 "
        278  << "language code, ignoring.";
        279  } else {
        280  trak->media.header.language.code = main_language;
        281  }
        282  }
        283 }
        284 
        285 bool MP4Muxer::GenerateVideoTrak(const VideoStreamInfo* video_info,
        286  Track* trak,
        287  uint32_t track_id) {
        288  InitializeTrak(video_info, trak);
        289 
        290  // width and height specify the track's visual presentation size as
        291  // fixed-point 16.16 values.
        292  uint32_t pixel_width = video_info->pixel_width();
        293  uint32_t pixel_height = video_info->pixel_height();
        294  if (pixel_width == 0 || pixel_height == 0) {
        295  LOG(WARNING) << "pixel width/height are not set. Assuming 1:1.";
        296  pixel_width = 1;
        297  pixel_height = 1;
        298  }
        299  const double sample_aspect_ratio =
        300  static_cast<double>(pixel_width) / pixel_height;
        301  trak->header.width = video_info->width() * sample_aspect_ratio * 0x10000;
        302  trak->header.height = video_info->height() * 0x10000;
        303 
        304  VideoSampleEntry video;
        305  video.format =
        306  CodecToFourCC(video_info->codec(), video_info->h26x_stream_format());
        307  video.width = video_info->width();
        308  video.height = video_info->height();
        309  video.codec_configuration.data = video_info->codec_config();
        310  if (pixel_width != 1 || pixel_height != 1) {
        311  video.pixel_aspect.h_spacing = pixel_width;
        312  video.pixel_aspect.v_spacing = pixel_height;
        313  }
        314 
        315  SampleDescription& sample_description =
        316  trak->media.information.sample_table.description;
        317  sample_description.type = kVideo;
        318  sample_description.video_entries.push_back(video);
        319 
        320  if (video_info->is_encrypted()) {
        321  if (video_info->has_clear_lead()) {
        322  // Add a second entry for clear content.
        323  sample_description.video_entries.push_back(video);
        324  }
        325  // Convert the first entry to an encrypted entry.
        326  VideoSampleEntry& entry = sample_description.video_entries[0];
        327  GenerateSinf(entry.format, video_info->encryption_config(), &entry.sinf);
        328  entry.format = FOURCC_encv;
        329  }
        330  return true;
        331 }
        332 
        333 bool MP4Muxer::GenerateAudioTrak(const AudioStreamInfo* audio_info,
        334  Track* trak,
        335  uint32_t track_id) {
        336  InitializeTrak(audio_info, trak);
        337 
        338  trak->header.volume = 0x100;
        339 
        340  AudioSampleEntry audio;
        341  audio.format =
        342  CodecToFourCC(audio_info->codec(), H26xStreamFormat::kUnSpecified);
        343  switch(audio_info->codec()){
        344  case kCodecAAC:
        345  audio.esds.es_descriptor.set_object_type(
        346  ObjectType::kISO_14496_3); // MPEG4 AAC.
        347  audio.esds.es_descriptor.set_esid(track_id);
        348  audio.esds.es_descriptor.set_decoder_specific_info(
        349  audio_info->codec_config());
        350  audio.esds.es_descriptor.set_max_bitrate(audio_info->max_bitrate());
        351  audio.esds.es_descriptor.set_avg_bitrate(audio_info->avg_bitrate());
        352  break;
        353  case kCodecDTSC:
        354  case kCodecDTSH:
        355  case kCodecDTSL:
        356  case kCodecDTSE:
        357  case kCodecDTSM:
        358  audio.ddts.extra_data = audio_info->codec_config();
        359  audio.ddts.max_bitrate = audio_info->max_bitrate();
        360  audio.ddts.avg_bitrate = audio_info->avg_bitrate();
        361  audio.ddts.sampling_frequency = audio_info->sampling_frequency();
        362  audio.ddts.pcm_sample_depth = audio_info->sample_bits();
        363  break;
        364  case kCodecAC3:
        365  audio.dac3.data = audio_info->codec_config();
        366  break;
        367  case kCodecEAC3:
        368  audio.dec3.data = audio_info->codec_config();
        369  break;
        370  case kCodecFlac:
        371  audio.dfla.data = audio_info->codec_config();
        372  break;
        373  case kCodecOpus:
        374  audio.dops.opus_identification_header = audio_info->codec_config();
        375  break;
        376  default:
        377  NOTIMPLEMENTED() << " Unsupported audio codec " << audio_info->codec();
        378  return false;
        379  }
        380 
        381  if (audio_info->codec() == kCodecAC3 || audio_info->codec() == kCodecEAC3) {
        382  // AC3 and EC3 does not fill in actual channel count and sample size in
        383  // sample description entry. Instead, two constants are used.
        384  audio.channelcount = 2;
        385  audio.samplesize = 16;
        386  } else {
        387  audio.channelcount = audio_info->num_channels();
        388  audio.samplesize = audio_info->sample_bits();
        389  }
        390  audio.samplerate = audio_info->sampling_frequency();
        391  SampleTable& sample_table = trak->media.information.sample_table;
        392  SampleDescription& sample_description = sample_table.description;
        393  sample_description.type = kAudio;
        394  sample_description.audio_entries.push_back(audio);
        395 
        396  if (audio_info->is_encrypted()) {
        397  if (audio_info->has_clear_lead()) {
        398  // Add a second entry for clear content.
        399  sample_description.audio_entries.push_back(audio);
        400  }
        401  // Convert the first entry to an encrypted entry.
        402  AudioSampleEntry& entry = sample_description.audio_entries[0];
        403  GenerateSinf(entry.format, audio_info->encryption_config(), &entry.sinf);
        404  entry.format = FOURCC_enca;
        405  }
        406 
        407  // Opus requires at least one sample group description box and at least one
        408  // sample to group box with grouping type 'roll' within sample table box.
        409  if (audio_info->codec() == kCodecOpus) {
        410  sample_table.sample_group_descriptions.resize(1);
        411  SampleGroupDescription& sample_group_description =
        412  sample_table.sample_group_descriptions.back();
        413  sample_group_description.grouping_type = FOURCC_roll;
        414  sample_group_description.audio_roll_recovery_entries.resize(1);
        415  // The roll distance is expressed in sample units and always takes negative
        416  // values.
        417  const uint64_t kNanosecondsPerSecond = 1000000000ull;
        418  sample_group_description.audio_roll_recovery_entries[0].roll_distance =
        419  (0 - (audio_info->seek_preroll_ns() * audio.samplerate +
        420  kNanosecondsPerSecond / 2)) /
        421  kNanosecondsPerSecond;
        422 
        423  sample_table.sample_to_groups.resize(1);
        424  SampleToGroup& sample_to_group = sample_table.sample_to_groups.back();
        425  sample_to_group.grouping_type = FOURCC_roll;
        426 
        427  sample_to_group.entries.resize(1);
        428  SampleToGroupEntry& sample_to_group_entry = sample_to_group.entries.back();
        429  // All samples are in track fragments.
        430  sample_to_group_entry.sample_count = 0;
        431  sample_to_group_entry.group_description_index =
        432  SampleToGroupEntry::kTrackGroupDescriptionIndexBase + 1;
        433  } else if (audio_info->seek_preroll_ns() != 0) {
        434  LOG(WARNING) << "Unexpected seek preroll for codec " << audio_info->codec();
        435  }
        436  return true;
        437 }
        438 
        439 bool MP4Muxer::GenerateTextTrak(const TextStreamInfo* text_info,
        440  Track* trak,
        441  uint32_t track_id) {
        442  InitializeTrak(text_info, trak);
        443 
        444  if (text_info->codec_string() == "wvtt") {
        445  // Handle WebVTT.
        446  TextSampleEntry webvtt;
        447  webvtt.format = FOURCC_wvtt;
        448  webvtt.config.config.assign(text_info->codec_config().begin(),
        449  text_info->codec_config().end());
        450  // TODO(rkuroiwa): This should be the source file URI(s). Putting bogus
        451  // string for now so that the box will be there for samples with overlapping
        452  // cues.
        453  webvtt.label.source_label = "source_label";
        454  SampleDescription& sample_description =
        455  trak->media.information.sample_table.description;
        456  sample_description.type = kText;
        457  sample_description.text_entries.push_back(webvtt);
        458  return true;
        459  }
        460  NOTIMPLEMENTED() << text_info->codec_string()
        461  << " handling not implemented yet.";
        462  return false;
        463 }
        464 
        465 base::Optional<Range> MP4Muxer::GetInitRangeStartAndEnd() {
        466  size_t range_offset = 0;
        467  size_t range_size = 0;
        468  const bool has_range = segmenter_->GetInitRange(&range_offset, &range_size);
        469 
        470  if (!has_range)
        471  return base::nullopt;
        472 
        473  Range range;
        474  SetStartAndEndFromOffsetAndSize(range_offset, range_size, &range);
        475  return range;
        476 }
        477 
        478 base::Optional<Range> MP4Muxer::GetIndexRangeStartAndEnd() {
        479  size_t range_offset = 0;
        480  size_t range_size = 0;
        481  const bool has_range = segmenter_->GetIndexRange(&range_offset, &range_size);
        482 
        483  if (!has_range)
        484  return base::nullopt;
        485 
        486  Range range;
        487  SetStartAndEndFromOffsetAndSize(range_offset, range_size, &range);
        488  return range;
        489 }
        490 
        491 void MP4Muxer::FireOnMediaStartEvent() {
        492  if (!muxer_listener())
        493  return;
        494 
        495  if (streams().size() > 1) {
        496  LOG(ERROR) << "MuxerListener cannot take more than 1 stream.";
        497  return;
        498  }
        499  DCHECK(!streams().empty()) << "Media started without a stream.";
        500 
        501  const uint32_t timescale = segmenter_->GetReferenceTimeScale();
        502  muxer_listener()->OnMediaStart(options(), *streams().front(), timescale,
        503  MuxerListener::kContainerMp4);
        504 }
        505 
        506 void MP4Muxer::FireOnMediaEndEvent() {
        507  if (!muxer_listener())
        508  return;
        509 
        510  MuxerListener::MediaRanges media_range;
        511  media_range.init_range = GetInitRangeStartAndEnd();
        512  media_range.index_range = GetIndexRangeStartAndEnd();
        513  media_range.subsegment_ranges = segmenter_->GetSegmentRanges();
        514 
        515  const float duration_seconds = static_cast<float>(segmenter_->GetDuration());
        516  muxer_listener()->OnMediaEnd(media_range, duration_seconds);
        517 }
        518 
        519 uint64_t MP4Muxer::IsoTimeNow() {
        520  // Time in seconds from Jan. 1, 1904 to epoch time, i.e. Jan. 1, 1970.
        521  const uint64_t kIsomTimeOffset = 2082844800l;
        522  return kIsomTimeOffset +
        523  (clock() ? clock()->Now() : base::Time::Now()).ToDoubleT();
        524 }
        525 
        526 } // namespace mp4
        527 } // namespace media
        528 } // namespace shaka
        base::Optional< Range > init_range
        Range of the initialization section of a segment.
        Abstract class holds stream information.
        Definition: stream_info.h:59
        - - - + + +
        base::Optional< Range > index_range
        Range of the index section of a segment.
        - + - +
        MP4Muxer(const MuxerOptions &options)
        Create a MP4Muxer object from MuxerOptions.
        Definition: mp4_muxer.cc:137
        - +
        All the methods that are virtual are virtual for mocking.
        This structure contains the list of configuration options for Muxer.
        Definition: muxer_options.h:20
        - +
        Mp4OutputParams mp4_params
        MP4 (ISO-BMFF) specific parameters.
        Definition: muxer_options.h:25
        - - + +
        virtual void OnMediaEnd(const MediaRanges &media_ranges, float duration_seconds)=0
        @@ -93,20 +93,20 @@ $(function() {
        virtual void OnMediaStart(const MuxerOptions &muxer_options, const StreamInfo &stream_info, uint32_t time_scale, ContainerType container_type)=0
        - - + +
        Holds video stream information.
        - +
        Holds audio stream information.
        - +
        diff --git a/docs/da/d8b/classshaka_1_1media_1_1WebMMediaParser-members.html b/docs/da/d8b/classshaka_1_1media_1_1WebMMediaParser-members.html index a1e0b96e5f..068a8b695a 100644 --- a/docs/da/d8b/classshaka_1_1media_1_1WebMMediaParser-members.html +++ b/docs/da/d8b/classshaka_1_1media_1_1WebMMediaParser-members.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/da/d8e/container__names_8cc_source.html b/docs/da/d8e/container__names_8cc_source.html index 5009e4e563..6db9928261 100644 --- a/docs/da/d8e/container__names_8cc_source.html +++ b/docs/da/d8e/container__names_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/da/d93/origin__handler_8cc_source.html b/docs/da/d93/origin__handler_8cc_source.html index bb0b2cd6e3..8f7797733b 100644 --- a/docs/da/d93/origin__handler_8cc_source.html +++ b/docs/da/d93/origin__handler_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/da/d93/structshaka_1_1media_1_1CueEvent.html b/docs/da/d93/structshaka_1_1media_1_1CueEvent.html index a49160b549..fa1fb4b05b 100644 --- a/docs/da/d93/structshaka_1_1media_1_1CueEvent.html +++ b/docs/da/d93/structshaka_1_1media_1_1CueEvent.html @@ -84,14 +84,14 @@ std::string cue_data

        Detailed Description

        -

        Definition at line 47 of file media_handler.h.

        +

        Definition at line 49 of file media_handler.h.


        The documentation for this struct was generated from the following file: diff --git a/docs/da/d9b/structshaka_1_1media_1_1mp4_1_1CompositionOffset-members.html b/docs/da/d9b/structshaka_1_1media_1_1mp4_1_1CompositionOffset-members.html index 5617b67a5b..dc9e7bd2c7 100644 --- a/docs/da/d9b/structshaka_1_1media_1_1mp4_1_1CompositionOffset-members.html +++ b/docs/da/d9b/structshaka_1_1media_1_1mp4_1_1CompositionOffset-members.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/da/d9d/structshaka_1_1media_1_1mp4_1_1EC3Specific-members.html b/docs/da/d9d/structshaka_1_1media_1_1mp4_1_1EC3Specific-members.html index 2b73676047..db1aec58ec 100644 --- a/docs/da/d9d/structshaka_1_1media_1_1mp4_1_1EC3Specific-members.html +++ b/docs/da/d9d/structshaka_1_1media_1_1mp4_1_1EC3Specific-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/da/d9f/classshaka_1_1MpdNotifierFactory-members.html b/docs/da/d9f/classshaka_1_1MpdNotifierFactory-members.html index 126b06338d..8b7fa6b508 100644 --- a/docs/da/d9f/classshaka_1_1MpdNotifierFactory-members.html +++ b/docs/da/d9f/classshaka_1_1MpdNotifierFactory-members.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/da/d9f/classshaka_1_1media_1_1MockMuxerListener-members.html b/docs/da/d9f/classshaka_1_1media_1_1MockMuxerListener-members.html index c7dbefdab3..fb29891c1f 100644 --- a/docs/da/d9f/classshaka_1_1media_1_1MockMuxerListener-members.html +++ b/docs/da/d9f/classshaka_1_1media_1_1MockMuxerListener-members.html @@ -99,7 +99,7 @@ $(function() { diff --git a/docs/da/da1/classshaka_1_1media_1_1mp2t_1_1TsPacket.html b/docs/da/da1/classshaka_1_1media_1_1mp2t_1_1TsPacket.html index 713a9d3f47..553a3ec535 100644 --- a/docs/da/da1/classshaka_1_1media_1_1mp2t_1_1TsPacket.html +++ b/docs/da/da1/classshaka_1_1media_1_1mp2t_1_1TsPacket.html @@ -121,7 +121,7 @@ static const int kPacketSi diff --git a/docs/da/dab/classshaka_1_1media_1_1CueAlignmentHandler.html b/docs/da/dab/classshaka_1_1media_1_1CueAlignmentHandler.html index 38e48a51ec..cdcc6ee0b8 100644 --- a/docs/da/dab/classshaka_1_1media_1_1CueAlignmentHandler.html +++ b/docs/da/dab/classshaka_1_1media_1_1CueAlignmentHandler.html @@ -169,7 +169,7 @@ const std::map< size_t, std::pair< std::shared_ptr< diff --git a/docs/da/db2/classshaka_1_1Representation-members.html b/docs/da/db2/classshaka_1_1Representation-members.html index e4730f78f6..970beae285 100644 --- a/docs/da/db2/classshaka_1_1Representation-members.html +++ b/docs/da/db2/classshaka_1_1Representation-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/docs/da/db3/webvtt__file__buffer_8cc_source.html b/docs/da/db3/webvtt__file__buffer_8cc_source.html new file mode 100644 index 0000000000..2a0ccb02a9 --- /dev/null +++ b/docs/da/db3/webvtt__file__buffer_8cc_source.html @@ -0,0 +1,78 @@ + + + + + + + +Shaka Packager SDK: packager/media/formats/webvtt/webvtt_file_buffer.cc Source File + + + + + + + + + +
        +
        + + + + + + +
        +
        Shaka Packager SDK +
        +
        +
        + + + + + + + + +
        +
        + + +
        + +
        + + +
        +
        +
        +
        webvtt_file_buffer.cc
        +
        +
        +
        1 // Copyright 2018 Google LLC All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #include "packager/media/formats/webvtt/webvtt_file_buffer.h"
        8 
        9 #include "packager/media/base/text_sample.h"
        10 #include "packager/media/formats/webvtt/webvtt_timestamp.h"
        11 
        12 namespace shaka {
        13 namespace media {
        14 namespace {
        15 const char* kHeader = "WEBVTT\n\n";
        16 }
        17 
        18 WebVttFileBuffer::WebVttFileBuffer() {
        19  // Make sure we start with the same state that we would end up with if
        20  // the caller reset our state.
        21  Reset();
        22 }
        23 
        24 void WebVttFileBuffer::Reset() {
        25  sample_count_ = 0;
        26 
        27  buffer_.clear();
        28  buffer_.append(kHeader);
        29 }
        30 
        31 void WebVttFileBuffer::Append(const TextSample& sample) {
        32  DCHECK_GT(buffer_.size(), 0u) << "The buffer should at least have a header";
        33 
        34  sample_count_++;
        35 
        36  // Ids are optional
        37  if (sample.id().length()) {
        38  buffer_.append(sample.id());
        39  buffer_.append("\n"); // end of id
        40  }
        41 
        42  // Write the times that the sample elapses.
        43  buffer_.append(MsToWebVttTimestamp(sample.start_time()));
        44  buffer_.append(" --> ");
        45  buffer_.append(MsToWebVttTimestamp(sample.EndTime()));
        46 
        47  // Settings are optional
        48  if (sample.settings().length()) {
        49  buffer_.append(" ");
        50  buffer_.append(sample.settings());
        51  }
        52  buffer_.append("\n"); // end of time & settings
        53 
        54  buffer_.append(sample.payload());
        55  buffer_.append("\n"); // end of payload
        56  buffer_.append("\n"); // end of sample
        57 }
        58 
        59 bool WebVttFileBuffer::WriteTo(File* file) {
        60  DCHECK(file);
        61  DCHECK_GT(buffer_.size(), 0u) << "The buffer should at least have a header";
        62 
        63  const int written = file->Write(buffer_.c_str(), buffer_.size());
        64  if (written < 0) {
        65  return false;
        66  }
        67 
        68  return static_cast<size_t>(written) == buffer_.size();
        69 }
        70 } // namespace media
        71 } // namespace shaka
        All the methods that are virtual are virtual for mocking.
        +
        + + + + diff --git a/docs/da/dbb/structshaka_1_1media_1_1mp4_1_1HandlerReference.html b/docs/da/dbb/structshaka_1_1media_1_1mp4_1_1HandlerReference.html index a2bc0f1d80..9d0e1bf5b8 100644 --- a/docs/da/dbb/structshaka_1_1media_1_1mp4_1_1HandlerReference.html +++ b/docs/da/dbb/structshaka_1_1media_1_1mp4_1_1HandlerReference.html @@ -103,14 +103,14 @@ Public Member Functions

        Public Attributes

        -FourCC handler_type +FourCC handler_type = FOURCC_NULL   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

        Implements shaka::media::mp4::Box.

        -

        Definition at line 1235 of file box_definitions.cc.

        +

        Definition at line 1263 of file box_definitions.cc.

        @@ -160,7 +160,7 @@ Additional Inherited Members diff --git a/docs/da/dc3/status_8cc_source.html b/docs/da/dc3/status_8cc_source.html index e8245cd6dc..401443bfd9 100644 --- a/docs/da/dc3/status_8cc_source.html +++ b/docs/da/dc3/status_8cc_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/da/dc4/structshaka_1_1media_1_1mp4_1_1TrackHeader.html b/docs/da/dc4/structshaka_1_1media_1_1mp4_1_1TrackHeader.html index 0cd03debef..1aea1b58bb 100644 --- a/docs/da/dc4/structshaka_1_1media_1_1mp4_1_1TrackHeader.html +++ b/docs/da/dc4/structshaka_1_1media_1_1mp4_1_1TrackHeader.html @@ -112,38 +112,38 @@ Public Member Functions +uint64_t  +uint64_t  +uint32_t  +uint64_t  +int16_t  +int16_t  +int16_t  +uint32_t  +uint32_t  +uint8_t  +uint32_t 

        @@ -149,7 +149,7 @@ Additional Inherited Members

        Public Attributes

        -uint64_t creation_time
        creation_time = 0
         
        -uint64_t modification_time
        modification_time = 0
         
        -uint32_t track_id
        track_id = 0
         
        -uint64_t duration
        duration = 0
         
        -int16_t layer
        layer = 0
         
        -int16_t alternate_group
        alternate_group = 0
         
        -int16_t volume
        volume = -1
         
        -uint32_t width
        width = 0
         
        -uint32_t height
        height = 0
         
        - Public Attributes inherited from shaka::media::mp4::FullBox
        -uint8_t version
        version = 0
         
        -uint32_t flags
        flags = 0
         

        Implements shaka::media::mp4::Box.

        -

        Definition at line 563 of file box_definitions.cc.

        +

        Definition at line 567 of file box_definitions.cc.

        @@ -193,7 +193,7 @@ Additional Inherited Members diff --git a/docs/da/dca/classshaka_1_1media_1_1OriginHandler-members.html b/docs/da/dca/classshaka_1_1media_1_1OriginHandler-members.html index 88080998b7..fb54b0ba54 100644 --- a/docs/da/dca/classshaka_1_1media_1_1OriginHandler-members.html +++ b/docs/da/dca/classshaka_1_1media_1_1OriginHandler-members.html @@ -97,7 +97,7 @@ $(function() {

        @@ -182,7 +182,7 @@ Additional Inherited Members

        diff --git a/docs/da/dcb/es__descriptor_8h_source.html b/docs/da/dcb/es__descriptor_8h_source.html index 94b8c5c5ba..3ab9ac59d5 100644 --- a/docs/da/dcb/es__descriptor_8h_source.html +++ b/docs/da/dcb/es__descriptor_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/da/dd0/playready__key__source_8cc_source.html b/docs/da/dd0/playready__key__source_8cc_source.html index e8834cb70c..70c7bdfad6 100644 --- a/docs/da/dd0/playready__key__source_8cc_source.html +++ b/docs/da/dd0/playready__key__source_8cc_source.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/da/dd0/structshaka_1_1media_1_1mp4_1_1Edit.html b/docs/da/dd0/structshaka_1_1media_1_1mp4_1_1Edit.html index 79d8470cf6..479172669a 100644 --- a/docs/da/dd0/structshaka_1_1media_1_1mp4_1_1Edit.html +++ b/docs/da/dd0/structshaka_1_1media_1_1mp4_1_1Edit.html @@ -140,7 +140,7 @@ Additional Inherited Members

        Implements shaka::media::mp4::Box.

        -

        Definition at line 1218 of file box_definitions.cc.

        +

        Definition at line 1244 of file box_definitions.cc.

        @@ -151,7 +151,7 @@ Additional Inherited Members diff --git a/docs/da/dd0/webm__info__parser_8h_source.html b/docs/da/dd0/webm__info__parser_8h_source.html index 7cb1e4a781..4416ee5f50 100644 --- a/docs/da/dd0/webm__info__parser_8h_source.html +++ b/docs/da/dd0/webm__info__parser_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/da/dd1/fragmenter_8h_source.html b/docs/da/dd1/fragmenter_8h_source.html index 17141daf64..9e453d15fc 100644 --- a/docs/da/dd1/fragmenter_8h_source.html +++ b/docs/da/dd1/fragmenter_8h_source.html @@ -66,24 +66,25 @@ $(function() {
        fragmenter.h
        -
        1 // Copyright 2014 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_FORMATS_MP4_FRAGMENTER_H_
        8 #define PACKAGER_MEDIA_FORMATS_MP4_FRAGMENTER_H_
        9 
        10 #include <memory>
        11 #include <vector>
        12 
        13 #include "packager/base/logging.h"
        14 #include "packager/status.h"
        15 
        16 namespace shaka {
        17 namespace media {
        18 
        19 class BufferWriter;
        20 class MediaSample;
        21 class StreamInfo;
        22 
        23 namespace mp4 {
        24 
        25 struct KeyFrameInfo;
        26 struct SegmentReference;
        27 struct TrackFragment;
        28 
        31 class Fragmenter {
        32  public:
        35  Fragmenter(std::shared_ptr<const StreamInfo> info, TrackFragment* traf);
        36 
        37  ~Fragmenter();
        38 
        42  Status AddSample(const MediaSample& sample);
        43 
        48  Status InitializeFragment(int64_t first_sample_dts);
        49 
        52 
        54  void GenerateSegmentReference(SegmentReference* reference) const;
        55 
        56  void ClearFragmentFinalized() { fragment_finalized_ = false; }
        57 
        58  uint64_t fragment_duration() const { return fragment_duration_; }
        59  uint64_t first_sap_time() const { return first_sap_time_; }
        60  uint64_t earliest_presentation_time() const {
        61  return earliest_presentation_time_;
        62  }
        63  bool fragment_initialized() const { return fragment_initialized_; }
        64  bool fragment_finalized() const { return fragment_finalized_; }
        65  BufferWriter* data() { return data_.get(); }
        66  const std::vector<KeyFrameInfo>& key_frame_infos() const {
        67  return key_frame_infos_;
        68  }
        69 
        75  bool use_decoding_timestamp_in_timeline) {
        76  use_decoding_timestamp_in_timeline_ = use_decoding_timestamp_in_timeline;
        77  }
        78 
        79  protected:
        80  TrackFragment* traf() { return traf_; }
        81 
        85  template <typename T>
        86  bool OptimizeSampleEntries(std::vector<T>* entries, T* default_value);
        87 
        88  private:
        89  Status FinalizeFragmentForEncryption();
        90  // Check if the current fragment starts with SAP.
        91  bool StartsWithSAP() const;
        92 
        93  std::shared_ptr<const StreamInfo> stream_info_;
        94  bool use_decoding_timestamp_in_timeline_;
        95  TrackFragment* traf_;
        96  uint64_t seek_preroll_;
        97  bool fragment_initialized_;
        98  bool fragment_finalized_;
        99  uint64_t fragment_duration_;
        100  int64_t earliest_presentation_time_;
        101  bool first_fragment_ = true;
        102  int64_t first_sap_time_;
        103  std::unique_ptr<BufferWriter> data_;
        104  // Saves key frames information, for Video.
        105  std::vector<KeyFrameInfo> key_frame_infos_;
        106 
        107  DISALLOW_COPY_AND_ASSIGN(Fragmenter);
        108 };
        109 
        110 template <typename T>
        111 bool Fragmenter::OptimizeSampleEntries(std::vector<T>* entries,
        112  T* default_value) {
        113  DCHECK(entries);
        114  DCHECK(default_value);
        115  DCHECK(!entries->empty());
        116 
        117  typename std::vector<T>::const_iterator it = entries->begin();
        118  T value = *it;
        119  for (; it < entries->end(); ++it)
        120  if (value != *it)
        121  return false;
        122 
        123  // Clear |entries| if it contains only one value.
        124  entries->clear();
        125  *default_value = value;
        126  return true;
        127 }
        128 
        129 } // namespace mp4
        130 } // namespace media
        131 } // namespace shaka
        132 
        133 #endif // PACKAGER_MEDIA_FORMATS_MP4_FRAGMENTER_H_
        void set_use_decoding_timestamp_in_timeline(bool use_decoding_timestamp_in_timeline)
        Definition: fragmenter.h:74
        - - +
        1 // Copyright 2014 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_FORMATS_MP4_FRAGMENTER_H_
        8 #define PACKAGER_MEDIA_FORMATS_MP4_FRAGMENTER_H_
        9 
        10 #include <memory>
        11 #include <vector>
        12 
        13 #include "packager/base/logging.h"
        14 #include "packager/status.h"
        15 
        16 namespace shaka {
        17 namespace media {
        18 
        19 class BufferWriter;
        20 class MediaSample;
        21 class StreamInfo;
        22 
        23 namespace mp4 {
        24 
        25 struct KeyFrameInfo;
        26 struct SegmentReference;
        27 struct TrackFragment;
        28 
        31 class Fragmenter {
        32  public:
        35  Fragmenter(std::shared_ptr<const StreamInfo> info, TrackFragment* traf);
        36 
        37  ~Fragmenter();
        38 
        42  Status AddSample(const MediaSample& sample);
        43 
        48  Status InitializeFragment(int64_t first_sample_dts);
        49 
        52 
        54  void GenerateSegmentReference(SegmentReference* reference) const;
        55 
        56  void ClearFragmentFinalized() { fragment_finalized_ = false; }
        57 
        58  uint64_t fragment_duration() const { return fragment_duration_; }
        59  uint64_t first_sap_time() const { return first_sap_time_; }
        60  uint64_t earliest_presentation_time() const {
        61  return earliest_presentation_time_;
        62  }
        63  bool fragment_initialized() const { return fragment_initialized_; }
        64  bool fragment_finalized() const { return fragment_finalized_; }
        65  BufferWriter* data() { return data_.get(); }
        66  const std::vector<KeyFrameInfo>& key_frame_infos() const {
        67  return key_frame_infos_;
        68  }
        69 
        75  bool use_decoding_timestamp_in_timeline) {
        76  use_decoding_timestamp_in_timeline_ = use_decoding_timestamp_in_timeline;
        77  }
        78 
        83  bool allow_adjust_earliest_presentation_time) {
        84  allow_adjust_earliest_presentation_time_ =
        85  allow_adjust_earliest_presentation_time;
        86  }
        87 
        88  protected:
        89  TrackFragment* traf() { return traf_; }
        90 
        94  template <typename T>
        95  bool OptimizeSampleEntries(std::vector<T>* entries, T* default_value);
        96 
        97  private:
        98  Status FinalizeFragmentForEncryption();
        99  // Check if the current fragment starts with SAP.
        100  bool StartsWithSAP() const;
        101 
        102  std::shared_ptr<const StreamInfo> stream_info_;
        103  bool use_decoding_timestamp_in_timeline_;
        104  TrackFragment* traf_;
        105  uint64_t seek_preroll_;
        106  bool fragment_initialized_;
        107  bool fragment_finalized_;
        108  uint64_t fragment_duration_;
        109  int64_t earliest_presentation_time_;
        110  bool first_fragment_ = true;
        111  bool allow_adjust_earliest_presentation_time_ = false;
        112  int64_t first_sap_time_;
        113  std::unique_ptr<BufferWriter> data_;
        114  // Saves key frames information, for Video.
        115  std::vector<KeyFrameInfo> key_frame_infos_;
        116 
        117  DISALLOW_COPY_AND_ASSIGN(Fragmenter);
        118 };
        119 
        120 template <typename T>
        121 bool Fragmenter::OptimizeSampleEntries(std::vector<T>* entries,
        122  T* default_value) {
        123  DCHECK(entries);
        124  DCHECK(default_value);
        125  DCHECK(!entries->empty());
        126 
        127  typename std::vector<T>::const_iterator it = entries->begin();
        128  T value = *it;
        129  for (; it < entries->end(); ++it)
        130  if (value != *it)
        131  return false;
        132 
        133  // Clear |entries| if it contains only one value.
        134  entries->clear();
        135  *default_value = value;
        136  return true;
        137 }
        138 
        139 } // namespace mp4
        140 } // namespace media
        141 } // namespace shaka
        142 
        143 #endif // PACKAGER_MEDIA_FORMATS_MP4_FRAGMENTER_H_
        void set_use_decoding_timestamp_in_timeline(bool use_decoding_timestamp_in_timeline)
        Definition: fragmenter.h:74
        + +
        All the methods that are virtual are virtual for mocking.
        Status InitializeFragment(int64_t first_sample_dts)
        Definition: fragmenter.cc:123
        -
        void GenerateSegmentReference(SegmentReference *reference) const
        Fill reference with current fragment information.
        Definition: fragmenter.cc:230
        +
        void GenerateSegmentReference(SegmentReference *reference) const
        Fill reference with current fragment information.
        Definition: fragmenter.cc:232
        Fragmenter(std::shared_ptr< const StreamInfo > info, TrackFragment *traf)
        Definition: fragmenter.cc:49
        Status AddSample(const MediaSample &sample)
        Definition: fragmenter.cc:66
        Class to hold a media sample.
        Definition: media_sample.h:22
        +
        void set_allow_adjust_earliest_presentation_time(bool allow_adjust_earliest_presentation_time)
        Definition: fragmenter.h:82
        Status FinalizeFragment()
        Finalize and optimize the fragment.
        Definition: fragmenter.cc:147
        -
        bool OptimizeSampleEntries(std::vector< T > *entries, T *default_value)
        Definition: fragmenter.h:111
        +
        bool OptimizeSampleEntries(std::vector< T > *entries, T *default_value)
        Definition: fragmenter.h:121
        diff --git a/docs/da/dd2/classshaka_1_1media_1_1mp2t_1_1TsPacket-members.html b/docs/da/dd2/classshaka_1_1media_1_1mp2t_1_1TsPacket-members.html index e85e591222..6142de1c63 100644 --- a/docs/da/dd2/classshaka_1_1media_1_1mp2t_1_1TsPacket-members.html +++ b/docs/da/dd2/classshaka_1_1media_1_1mp2t_1_1TsPacket-members.html @@ -83,7 +83,7 @@ $(function() {
        diff --git a/docs/da/dd6/classshaka_1_1media_1_1H264ByteToUnitStreamConverter-members.html b/docs/da/dd6/classshaka_1_1media_1_1H264ByteToUnitStreamConverter-members.html index 372e5be1d6..897359871a 100644 --- a/docs/da/dd6/classshaka_1_1media_1_1H264ByteToUnitStreamConverter-members.html +++ b/docs/da/dd6/classshaka_1_1media_1_1H264ByteToUnitStreamConverter-members.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/da/dd8/classshaka_1_1media_1_1mp2t_1_1Mp2tMediaParser-members.html b/docs/da/dd8/classshaka_1_1media_1_1mp2t_1_1Mp2tMediaParser-members.html index abda1063fc..39ca791bcb 100644 --- a/docs/da/dd8/classshaka_1_1media_1_1mp2t_1_1Mp2tMediaParser-members.html +++ b/docs/da/dd8/classshaka_1_1media_1_1mp2t_1_1Mp2tMediaParser-members.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/da/dda/structshaka_1_1media_1_1H264SEIRecoveryPoint-members.html b/docs/da/dda/structshaka_1_1media_1_1H264SEIRecoveryPoint-members.html index 4a29fb8526..204ee7b12c 100644 --- a/docs/da/dda/structshaka_1_1media_1_1H264SEIRecoveryPoint-members.html +++ b/docs/da/dda/structshaka_1_1media_1_1H264SEIRecoveryPoint-members.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/da/ddd/classshaka_1_1media_1_1WidevineKeySource.html b/docs/da/ddd/classshaka_1_1media_1_1WidevineKeySource.html index 1572d1d483..b6e9e1ab96 100644 --- a/docs/da/ddd/classshaka_1_1media_1_1WidevineKeySource.html +++ b/docs/da/ddd/classshaka_1_1media_1_1WidevineKeySource.html @@ -460,7 +460,7 @@ Additional Inherited Members diff --git a/docs/da/ddf/structshaka_1_1media_1_1mp4_1_1SampleDescription-members.html b/docs/da/ddf/structshaka_1_1media_1_1mp4_1_1SampleDescription-members.html index b23d64a595..e90153c26b 100644 --- a/docs/da/ddf/structshaka_1_1media_1_1mp4_1_1SampleDescription-members.html +++ b/docs/da/ddf/structshaka_1_1media_1_1mp4_1_1SampleDescription-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/docs/da/de2/mock__mpd__builder_8cc_source.html b/docs/da/de2/mock__mpd__builder_8cc_source.html index bb956af8ec..7194e82e30 100644 --- a/docs/da/de2/mock__mpd__builder_8cc_source.html +++ b/docs/da/de2/mock__mpd__builder_8cc_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/da/de4/classshaka_1_1media_1_1WebMClusterParser.html b/docs/da/de4/classshaka_1_1media_1_1WebMClusterParser.html index eb0c46230d..60b327d239 100644 --- a/docs/da/de4/classshaka_1_1media_1_1WebMClusterParser.html +++ b/docs/da/de4/classshaka_1_1media_1_1WebMClusterParser.html @@ -353,7 +353,7 @@ The number of bytes parsed on success. diff --git a/docs/da/de6/structshaka_1_1media_1_1mp4_1_1SchemeType-members.html b/docs/da/de6/structshaka_1_1media_1_1mp4_1_1SchemeType-members.html index d97212c9a1..20edf3e8b2 100644 --- a/docs/da/de6/structshaka_1_1media_1_1mp4_1_1SchemeType-members.html +++ b/docs/da/de6/structshaka_1_1media_1_1mp4_1_1SchemeType-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/da/de8/classshaka_1_1media_1_1AudioStreamInfo-members.html b/docs/da/de8/classshaka_1_1media_1_1AudioStreamInfo-members.html index 7cf9065323..ce042964ad 100644 --- a/docs/da/de8/classshaka_1_1media_1_1AudioStreamInfo-members.html +++ b/docs/da/de8/classshaka_1_1media_1_1AudioStreamInfo-members.html @@ -110,7 +110,7 @@ $(function() { diff --git a/docs/da/de9/structshaka_1_1media_1_1mp4_1_1ProtectionSchemeInfo.html b/docs/da/de9/structshaka_1_1media_1_1mp4_1_1ProtectionSchemeInfo.html index 0fffbc98a6..e466ff2c72 100644 --- a/docs/da/de9/structshaka_1_1media_1_1mp4_1_1ProtectionSchemeInfo.html +++ b/docs/da/de9/structshaka_1_1media_1_1mp4_1_1ProtectionSchemeInfo.html @@ -146,7 +146,7 @@ Additional Inherited Members

        Implements shaka::media::mp4::Box.

        -

        Definition at line 483 of file box_definitions.cc.

        +

        Definition at line 499 of file box_definitions.cc.

        @@ -157,7 +157,7 @@ Additional Inherited Members diff --git a/docs/da/df0/classshaka_1_1media_1_1H264VideoSliceHeaderParser.html b/docs/da/df0/classshaka_1_1media_1_1H264VideoSliceHeaderParser.html index fc8e2f329b..979f05add5 100644 --- a/docs/da/df0/classshaka_1_1media_1_1H264VideoSliceHeaderParser.html +++ b/docs/da/df0/classshaka_1_1media_1_1H264VideoSliceHeaderParser.html @@ -130,7 +130,7 @@ int64_t  diff --git a/docs/da/df4/aes__decryptor_8cc_source.html b/docs/da/df4/aes__decryptor_8cc_source.html index 615e045433..3aaa3028ff 100644 --- a/docs/da/df4/aes__decryptor_8cc_source.html +++ b/docs/da/df4/aes__decryptor_8cc_source.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/da/df5/structshaka_1_1media_1_1mp4_1_1SampleDescription.html b/docs/da/df5/structshaka_1_1media_1_1mp4_1_1SampleDescription.html index d107ea8b6c..a54ff85ccc 100644 --- a/docs/da/df5/structshaka_1_1media_1_1mp4_1_1SampleDescription.html +++ b/docs/da/df5/structshaka_1_1media_1_1mp4_1_1SampleDescription.html @@ -103,7 +103,7 @@ Public Member Functions

        Public Attributes

        -TrackType type +TrackType type = kInvalid   std::vector< VideoSampleEntryvideo_entries @@ -116,10 +116,10 @@ std::vector<   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

        @@ -130,7 +130,7 @@ Additional Inherited Members

        Detailed Description

        -

        Definition at line 390 of file box_definitions.h.

        +

        Definition at line 401 of file box_definitions.h.

        Member Function Documentation

        ◆ BoxType()

        @@ -158,7 +158,7 @@ Additional Inherited Members

        Implements shaka::media::mp4::Box.

        -

        Definition at line 603 of file box_definitions.cc.

        +

        Definition at line 609 of file box_definitions.cc.

        @@ -169,7 +169,7 @@ Additional Inherited Members diff --git a/docs/da/df9/classshaka_1_1media_1_1AesPatternCryptor-members.html b/docs/da/df9/classshaka_1_1media_1_1AesPatternCryptor-members.html index fbf2d7cce0..bb0ef3689b 100644 --- a/docs/da/df9/classshaka_1_1media_1_1AesPatternCryptor-members.html +++ b/docs/da/df9/classshaka_1_1media_1_1AesPatternCryptor-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/docs/da/df9/classshaka_1_1media_1_1JobManager-members.html b/docs/da/df9/classshaka_1_1media_1_1JobManager-members.html index 89af2c0996..5c34529be7 100644 --- a/docs/da/df9/classshaka_1_1media_1_1JobManager-members.html +++ b/docs/da/df9/classshaka_1_1media_1_1JobManager-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/da/dfd/classshaka_1_1media_1_1MediaHandler.html b/docs/da/dfd/classshaka_1_1media_1_1MediaHandler.html index a8d32d04d1..ee35e82b23 100644 --- a/docs/da/dfd/classshaka_1_1media_1_1MediaHandler.html +++ b/docs/da/dfd/classshaka_1_1media_1_1MediaHandler.html @@ -91,7 +91,7 @@ Inheritance diagram for shaka::media::MediaHandler: shaka::media::TextChunker shaka::media::TextPadder shaka::media::TrickPlayHandler -shaka::media::WebVttOutputHandler +shaka::media::WebVttTextOutputHandler shaka::media::WebVttToMp4Handler @@ -177,7 +177,7 @@ const std::map< size_t, std::pair< std::shared_ptr<

        Detailed Description

        MediaHandler is the base media processing unit. Media handlers transform the input streams and propagate the outputs to downstream media handlers. There are three different types of media handlers: 1) Single input single output This is the most basic handler. It only supports one input and one output with both index as 0. 2) Multiple inputs multiple outputs The number of outputs must be equal to the number of inputs. The output stream at a specific index comes from the input stream at the same index. Different streams usually share a common resource, although they may be independent. One example of this is encryption handler. 3) Single input multiple outputs The input stream is split into multiple output streams. One example of this is trick play handler. Other types of media handlers are disallowed and not supported.

        -

        Definition at line 148 of file media_handler.h.

        +

        Definition at line 150 of file media_handler.h.

        Member Function Documentation

        ◆ Dispatch()

        @@ -204,7 +204,7 @@ const std::map< size_t, std::pair< std::shared_ptr< @@ -224,7 +224,7 @@ const std::map< size_t, std::pair< std::shared_ptr< @@ -281,7 +281,7 @@ const std::map< size_t, std::pair< std::shared_ptr< @@ -292,7 +292,7 @@ const std::map< size_t, std::pair< std::shared_ptr< diff --git a/docs/da/dfd/classshaka_1_1media_1_1MediaHandler.png b/docs/da/dfd/classshaka_1_1media_1_1MediaHandler.png index ed33fad97c..88f5df2e94 100644 Binary files a/docs/da/dfd/classshaka_1_1media_1_1MediaHandler.png and b/docs/da/dfd/classshaka_1_1media_1_1MediaHandler.png differ diff --git a/docs/db/d04/webvtt__parser_8cc_source.html b/docs/db/d04/webvtt__parser_8cc_source.html index 4d2d19ec84..f53722a2f6 100644 --- a/docs/db/d04/webvtt__parser_8cc_source.html +++ b/docs/db/d04/webvtt__parser_8cc_source.html @@ -66,15 +66,12 @@ $(function() {
        webvtt_parser.cc
        -
        1 // Copyright 2017 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #include "packager/media/formats/webvtt/webvtt_parser.h"
        8 
        9 #include <string>
        10 #include <vector>
        11 
        12 #include "packager/base/logging.h"
        13 #include "packager/base/strings/string_split.h"
        14 #include "packager/base/strings/string_util.h"
        15 #include "packager/media/base/text_stream_info.h"
        16 #include "packager/media/formats/webvtt/webvtt_timestamp.h"
        17 
        18 namespace shaka {
        19 namespace media {
        20 namespace {
        21 const uint64_t kStreamIndex = 0;
        22 
        23 std::string BlockToString(const std::string* block, size_t size) {
        24  std::string out = " --- BLOCK START ---\n";
        25 
        26  for (size_t i = 0; i < size; i++) {
        27  out.append(" ");
        28  out.append(block[i]);
        29  out.append("\n");
        30  }
        31 
        32  out.append(" --- BLOCK END ---");
        33 
        34  return out;
        35 }
        36 
        37 // Comments are just blocks that are preceded by a blank line, start with the
        38 // word "NOTE" (followed by a space or newline), and end at the first blank
        39 // line.
        40 // SOURCE: https://www.w3.org/TR/webvtt1
        41 bool IsLikelyNote(const std::string& line) {
        42  return line == "NOTE" ||
        43  base::StartsWith(line, "NOTE ", base::CompareCase::SENSITIVE) ||
        44  base::StartsWith(line, "NOTE\t", base::CompareCase::SENSITIVE);
        45 }
        46 
        47 // As cue time is the only part of a WEBVTT file that is allowed to have
        48 // "-->" appear, then if the given line contains it, we can safely assume
        49 // that the line is likely to be a cue time.
        50 bool IsLikelyCueTiming(const std::string& line) {
        51  return line.find("-->") != std::string::npos;
        52 }
        53 
        54 // A WebVTT cue identifier is any sequence of one or more characters not
        55 // containing the substring "-->" (U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS,
        56 // U+003E GREATER-THAN SIGN), nor containing any U+000A LINE FEED (LF)
        57 // characters or U+000D CARRIAGE RETURN (CR) characters.
        58 // SOURCE: https://www.w3.org/TR/webvtt1/#webvtt-cue-identifier
        59 bool MaybeCueId(const std::string& line) {
        60  return line.find("-->") == std::string::npos;
        61 }
        62 
        63 // Check to see if the block is likely a style block. Style blocks are
        64 // identified as any block that starts with a line that only contains
        65 // "STYLE".
        66 // SOURCE: https://w3c.github.io/webvtt/#styling
        67 bool IsLikelyStyle(const std::string& line) {
        68  return base::TrimWhitespaceASCII(line, base::TRIM_TRAILING) == "STYLE";
        69 }
        70 
        71 // Check to see if the block is likely a region block. Region blocks are
        72 // identified as any block that starts with a line that only contains
        73 // "REGION".
        74 // SOURCE: https://w3c.github.io/webvtt/#webvtt-region
        75 bool IsLikelyRegion(const std::string& line) {
        76  return base::TrimWhitespaceASCII(line, base::TRIM_TRAILING) == "REGION";
        77 }
        78 } // namespace
        79 
        80 WebVttParser::WebVttParser(std::unique_ptr<FileReader> source,
        81  const std::string& language)
        82  : reader_(std::move(source)), language_(language) {}
        83 
        84 Status WebVttParser::InitializeInternal() {
        85  return Status::OK;
        86 }
        87 
        88 bool WebVttParser::ValidateOutputStreamIndex(size_t stream_index) const {
        89  // Only support one output
        90  return stream_index == kStreamIndex;
        91 }
        92 
        93 Status WebVttParser::Run() {
        94  return Parse()
        95  ? FlushDownstream(kStreamIndex)
        96  : Status(error::INTERNAL_ERROR,
        97  "Failed to parse WebVTT source. See log for details.");
        98 }
        99 
        100 void WebVttParser::Cancel() {
        101  keep_reading_ = false;
        102 }
        103 
        104 bool WebVttParser::Parse() {
        105  std::vector<std::string> block;
        106  if (!reader_.Next(&block)) {
        107  LOG(ERROR) << "Failed to read WEBVTT HEADER - No blocks in source.";
        108  return false;
        109  }
        110 
        111  // Check the header. It is possible for a 0xFEFF BOM to come before the
        112  // header text.
        113  if (block.size() != 1) {
        114  LOG(ERROR) << "Failed to read WEBVTT header - "
        115  << "block size should be 1 but was " << block.size() << ".";
        116  return false;
        117  }
        118  if (block[0] != "WEBVTT" && block[0] != "\xEF\xBB\xBFWEBVTT") {
        119  LOG(ERROR) << "Failed to read WEBVTT header - should be WEBVTT but was "
        120  << block[0];
        121  return false;
        122  }
        123 
        124  const Status send_stream_info_result = DispatchTextStreamInfo();
        125 
        126  if (send_stream_info_result != Status::OK) {
        127  LOG(ERROR) << "Failed to send stream info down stream:"
        128  << send_stream_info_result.error_message();
        129  return false;
        130  }
        131 
        132  bool saw_cue = false;
        133 
        134  while (reader_.Next(&block) && keep_reading_) {
        135  // NOTE
        136  if (IsLikelyNote(block[0])) {
        137  // We can safely ignore the whole block.
        138  continue;
        139  }
        140 
        141  // STYLE
        142  if (IsLikelyStyle(block[0])) {
        143  if (saw_cue) {
        144  LOG(ERROR)
        145  << "Found style block after seeing cue. Ignoring style block";
        146  } else {
        147  LOG(WARNING) << "Missing support for style blocks. Skipping block:\n"
        148  << BlockToString(block.data(), block.size());
        149  }
        150  continue;
        151  }
        152 
        153  // REGION
        154  if (IsLikelyRegion(block[0])) {
        155  if (saw_cue) {
        156  LOG(ERROR)
        157  << "Found region block after seeing cue. Ignoring region block";
        158  } else {
        159  LOG(WARNING) << "Missing support for region blocks. Skipping block:\n"
        160  << BlockToString(block.data(), block.size());
        161  }
        162  continue;
        163  }
        164 
        165  // CUE with ID
        166  if (block.size() > 2 && MaybeCueId(block[0]) &&
        167  IsLikelyCueTiming(block[1]) && ParseCueWithId(block)) {
        168  saw_cue = true;
        169  continue;
        170  }
        171 
        172  // CUE with no ID
        173  if (block.size() > 1 && IsLikelyCueTiming(block[0]) &&
        174  ParseCueWithNoId(block)) {
        175  saw_cue = true;
        176  continue;
        177  }
        178 
        179  LOG(ERROR) << "Failed to determine block classification:\n"
        180  << BlockToString(block.data(), block.size());
        181  return false;
        182  }
        183 
        184  return keep_reading_;
        185 }
        186 
        187 bool WebVttParser::ParseCueWithNoId(const std::vector<std::string>& block) {
        188  const Status status = ParseCue("", block.data(), block.size());
        189 
        190  if (!status.ok()) {
        191  LOG(ERROR) << "Failed to parse cue: " << status.error_message();
        192  }
        193 
        194  return status.ok();
        195 }
        196 
        197 bool WebVttParser::ParseCueWithId(const std::vector<std::string>& block) {
        198  const Status status = ParseCue(block[0], block.data() + 1, block.size() - 1);
        199 
        200  if (!status.ok()) {
        201  LOG(ERROR) << "Failed to parse cue: " << status.error_message();
        202  }
        203 
        204  return status.ok();
        205 }
        206 
        207 Status WebVttParser::ParseCue(const std::string& id,
        208  const std::string* block,
        209  size_t block_size) {
        210  const std::vector<std::string> time_and_style = base::SplitString(
        211  block[0], " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
        212 
        213  uint64_t start_time = 0;
        214  uint64_t end_time = 0;
        215 
        216  const bool parsed_time =
        217  time_and_style.size() >= 3 && time_and_style[1] == "-->" &&
        218  WebVttTimestampToMs(time_and_style[0], &start_time) &&
        219  WebVttTimestampToMs(time_and_style[2], &end_time);
        220 
        221  if (!parsed_time) {
        222  return Status(
        223  error::INTERNAL_ERROR,
        224  "Could not parse start time, -->, and end time from " + block[0]);
        225  }
        226 
        227  // According to the WebVTT spec
        228  // (https://www.w3.org/TR/webvtt1/#webvtt-cue-timings) end time must be
        229  // greater than the start time of the cue. Since we are seeing content with
        230  // zero-duration cues in the field, we are going to drop the cue instead of
        231  // failing to package.
        232  //
        233  // Print a warning so that those packaging content can know that their
        234  // content is not spec compliant.
        235  if (start_time == end_time) {
        236  LOG(WARNING) << "WebVTT input is not spec compliant."
        237  " Skipping zero-duration cue\n"
        238  << BlockToString(block, block_size);
        239 
        240  return Status::OK;
        241  }
        242 
        243  std::shared_ptr<TextSample> sample = std::make_shared<TextSample>();
        244  sample->set_id(id);
        245  sample->SetTime(start_time, end_time);
        246 
        247  // The rest of time_and_style are the style tokens.
        248  for (size_t i = 3; i < time_and_style.size(); i++) {
        249  sample->AppendStyle(time_and_style[i]);
        250  }
        251 
        252  // The rest of the block is the payload.
        253  for (size_t i = 1; i < block_size; i++) {
        254  sample->AppendPayload(block[i]);
        255  }
        256 
        257  return DispatchTextSample(kStreamIndex, sample);
        258 }
        259 
        260 Status WebVttParser::DispatchTextStreamInfo() {
        261  const int kTrackId = 0;
        262  // The resolution of timings are in milliseconds.
        263  const int kTimescale = 1000;
        264  // The duration passed here is not very important. Also the whole file
        265  // must be read before determining the real duration which doesn't
        266  // work nicely with the current demuxer.
        267  const int kDuration = 0;
        268  const char kWebVttCodecString[] = "wvtt";
        269  const char kCodecConfig[] = "";
        270  const int64_t kNoWidth = 0;
        271  const int64_t kNoHeight = 0;
        272 
        273  std::shared_ptr<StreamInfo> info = std::make_shared<TextStreamInfo>(
        274  kTrackId, kTimescale, kDuration, kCodecWebVtt, kWebVttCodecString,
        275  kCodecConfig, kNoWidth, kNoHeight, language_);
        276 
        277  return DispatchStreamInfo(kStreamIndex, std::move(info));
        278 }
        279 } // namespace media
        280 } // namespace shaka
        Status DispatchStreamInfo(size_t stream_index, std::shared_ptr< const StreamInfo > stream_info) const
        Dispatch the stream info to downstream handlers.
        -
        STL namespace.
        +
        1 // Copyright 2017 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #include "packager/media/formats/webvtt/webvtt_parser.h"
        8 
        9 #include <string>
        10 #include <vector>
        11 
        12 #include "packager/base/logging.h"
        13 #include "packager/base/strings/string_split.h"
        14 #include "packager/base/strings/string_util.h"
        15 #include "packager/media/base/text_stream_info.h"
        16 #include "packager/media/formats/webvtt/webvtt_timestamp.h"
        17 
        18 namespace shaka {
        19 namespace media {
        20 namespace {
        21 const uint64_t kStreamIndex = 0;
        22 
        23 std::string BlockToString(const std::string* block, size_t size) {
        24  std::string out = " --- BLOCK START ---\n";
        25 
        26  for (size_t i = 0; i < size; i++) {
        27  out.append(" ");
        28  out.append(block[i]);
        29  out.append("\n");
        30  }
        31 
        32  out.append(" --- BLOCK END ---");
        33 
        34  return out;
        35 }
        36 
        37 // Comments are just blocks that are preceded by a blank line, start with the
        38 // word "NOTE" (followed by a space or newline), and end at the first blank
        39 // line.
        40 // SOURCE: https://www.w3.org/TR/webvtt1
        41 bool IsLikelyNote(const std::string& line) {
        42  return line == "NOTE" ||
        43  base::StartsWith(line, "NOTE ", base::CompareCase::SENSITIVE) ||
        44  base::StartsWith(line, "NOTE\t", base::CompareCase::SENSITIVE);
        45 }
        46 
        47 // As cue time is the only part of a WEBVTT file that is allowed to have
        48 // "-->" appear, then if the given line contains it, we can safely assume
        49 // that the line is likely to be a cue time.
        50 bool IsLikelyCueTiming(const std::string& line) {
        51  return line.find("-->") != std::string::npos;
        52 }
        53 
        54 // A WebVTT cue identifier is any sequence of one or more characters not
        55 // containing the substring "-->" (U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS,
        56 // U+003E GREATER-THAN SIGN), nor containing any U+000A LINE FEED (LF)
        57 // characters or U+000D CARRIAGE RETURN (CR) characters.
        58 // SOURCE: https://www.w3.org/TR/webvtt1/#webvtt-cue-identifier
        59 bool MaybeCueId(const std::string& line) {
        60  return line.find("-->") == std::string::npos;
        61 }
        62 
        63 // Check to see if the block is likely a style block. Style blocks are
        64 // identified as any block that starts with a line that only contains
        65 // "STYLE".
        66 // SOURCE: https://w3c.github.io/webvtt/#styling
        67 bool IsLikelyStyle(const std::string& line) {
        68  return base::TrimWhitespaceASCII(line, base::TRIM_TRAILING) == "STYLE";
        69 }
        70 
        71 // Check to see if the block is likely a region block. Region blocks are
        72 // identified as any block that starts with a line that only contains
        73 // "REGION".
        74 // SOURCE: https://w3c.github.io/webvtt/#webvtt-region
        75 bool IsLikelyRegion(const std::string& line) {
        76  return base::TrimWhitespaceASCII(line, base::TRIM_TRAILING) == "REGION";
        77 }
        78 } // namespace
        79 
        80 WebVttParser::WebVttParser(std::unique_ptr<FileReader> source,
        81  const std::string& language)
        82  : reader_(std::move(source)), language_(language) {}
        83 
        84 Status WebVttParser::InitializeInternal() {
        85  return Status::OK;
        86 }
        87 
        88 bool WebVttParser::ValidateOutputStreamIndex(size_t stream_index) const {
        89  // Only support one output
        90  return stream_index == kStreamIndex;
        91 }
        92 
        93 Status WebVttParser::Run() {
        94  return Parse()
        95  ? FlushDownstream(kStreamIndex)
        96  : Status(error::INTERNAL_ERROR,
        97  "Failed to parse WebVTT source. See log for details.");
        98 }
        99 
        100 void WebVttParser::Cancel() {
        101  keep_reading_ = false;
        102 }
        103 
        104 bool WebVttParser::Parse() {
        105  std::vector<std::string> block;
        106  if (!reader_.Next(&block)) {
        107  LOG(ERROR) << "Failed to read WEBVTT HEADER - No blocks in source.";
        108  return false;
        109  }
        110 
        111  // Check the header. It is possible for a 0xFEFF BOM to come before the
        112  // header text.
        113  if (block.size() != 1) {
        114  LOG(ERROR) << "Failed to read WEBVTT header - "
        115  << "block size should be 1 but was " << block.size() << ".";
        116  return false;
        117  }
        118  if (block[0] != "WEBVTT" && block[0] != "\xEF\xBB\xBFWEBVTT") {
        119  LOG(ERROR) << "Failed to read WEBVTT header - should be WEBVTT but was "
        120  << block[0];
        121  return false;
        122  }
        123 
        124  const Status send_stream_info_result = DispatchTextStreamInfo();
        125 
        126  if (send_stream_info_result != Status::OK) {
        127  LOG(ERROR) << "Failed to send stream info down stream:"
        128  << send_stream_info_result.error_message();
        129  return false;
        130  }
        131 
        132  bool saw_cue = false;
        133 
        134  while (reader_.Next(&block) && keep_reading_) {
        135  // NOTE
        136  if (IsLikelyNote(block[0])) {
        137  // We can safely ignore the whole block.
        138  continue;
        139  }
        140 
        141  // STYLE
        142  if (IsLikelyStyle(block[0])) {
        143  if (saw_cue) {
        144  LOG(ERROR)
        145  << "Found style block after seeing cue. Ignoring style block";
        146  } else {
        147  LOG(WARNING) << "Missing support for style blocks. Skipping block:\n"
        148  << BlockToString(block.data(), block.size());
        149  }
        150  continue;
        151  }
        152 
        153  // REGION
        154  if (IsLikelyRegion(block[0])) {
        155  if (saw_cue) {
        156  LOG(ERROR)
        157  << "Found region block after seeing cue. Ignoring region block";
        158  } else {
        159  LOG(WARNING) << "Missing support for region blocks. Skipping block:\n"
        160  << BlockToString(block.data(), block.size());
        161  }
        162  continue;
        163  }
        164 
        165  // CUE with ID
        166  if (block.size() > 2 && MaybeCueId(block[0]) &&
        167  IsLikelyCueTiming(block[1]) && ParseCueWithId(block)) {
        168  saw_cue = true;
        169  continue;
        170  }
        171 
        172  // CUE with no ID
        173  if (block.size() > 1 && IsLikelyCueTiming(block[0]) &&
        174  ParseCueWithNoId(block)) {
        175  saw_cue = true;
        176  continue;
        177  }
        178 
        179  LOG(ERROR) << "Failed to determine block classification:\n"
        180  << BlockToString(block.data(), block.size());
        181  return false;
        182  }
        183 
        184  return keep_reading_;
        185 }
        186 
        187 bool WebVttParser::ParseCueWithNoId(const std::vector<std::string>& block) {
        188  const Status status = ParseCue("", block.data(), block.size());
        189 
        190  if (!status.ok()) {
        191  LOG(ERROR) << "Failed to parse cue: " << status.error_message();
        192  }
        193 
        194  return status.ok();
        195 }
        196 
        197 bool WebVttParser::ParseCueWithId(const std::vector<std::string>& block) {
        198  const Status status = ParseCue(block[0], block.data() + 1, block.size() - 1);
        199 
        200  if (!status.ok()) {
        201  LOG(ERROR) << "Failed to parse cue: " << status.error_message();
        202  }
        203 
        204  return status.ok();
        205 }
        206 
        207 Status WebVttParser::ParseCue(const std::string& id,
        208  const std::string* block,
        209  size_t block_size) {
        210  const std::vector<std::string> time_and_style = base::SplitString(
        211  block[0], " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
        212 
        213  uint64_t start_time = 0;
        214  uint64_t end_time = 0;
        215 
        216  const bool parsed_time =
        217  time_and_style.size() >= 3 && time_and_style[1] == "-->" &&
        218  WebVttTimestampToMs(time_and_style[0], &start_time) &&
        219  WebVttTimestampToMs(time_and_style[2], &end_time);
        220 
        221  if (!parsed_time) {
        222  return Status(
        223  error::INTERNAL_ERROR,
        224  "Could not parse start time, -->, and end time from " + block[0]);
        225  }
        226 
        227  // According to the WebVTT spec
        228  // (https://www.w3.org/TR/webvtt1/#webvtt-cue-timings) end time must be
        229  // greater than the start time of the cue. Since we are seeing content with
        230  // zero-duration cues in the field, we are going to drop the cue instead of
        231  // failing to package.
        232  //
        233  // Print a warning so that those packaging content can know that their
        234  // content is not spec compliant.
        235  if (start_time == end_time) {
        236  LOG(WARNING) << "WebVTT input is not spec compliant."
        237  " Skipping zero-duration cue\n"
        238  << BlockToString(block, block_size);
        239 
        240  return Status::OK;
        241  }
        242 
        243  std::shared_ptr<TextSample> sample = std::make_shared<TextSample>();
        244  sample->set_id(id);
        245  sample->SetTime(start_time, end_time);
        246 
        247  // The rest of time_and_style are the style tokens.
        248  for (size_t i = 3; i < time_and_style.size(); i++) {
        249  sample->AppendStyle(time_and_style[i]);
        250  }
        251 
        252  // The rest of the block is the payload.
        253  for (size_t i = 1; i < block_size; i++) {
        254  sample->AppendPayload(block[i]);
        255  }
        256 
        257  return DispatchTextSample(kStreamIndex, sample);
        258 }
        259 
        260 Status WebVttParser::DispatchTextStreamInfo() {
        261  const int kTrackId = 0;
        262  // The resolution of timings are in milliseconds.
        263  const int kTimescale = 1000;
        264  // The duration passed here is not very important. Also the whole file
        265  // must be read before determining the real duration which doesn't
        266  // work nicely with the current demuxer.
        267  const int kDuration = 0;
        268  const char kWebVttCodecString[] = "wvtt";
        269  const char kCodecConfig[] = "";
        270  const int64_t kNoWidth = 0;
        271  const int64_t kNoHeight = 0;
        272 
        273  std::shared_ptr<StreamInfo> info = std::make_shared<TextStreamInfo>(
        274  kTrackId, kTimescale, kDuration, kCodecWebVtt, kWebVttCodecString,
        275  kCodecConfig, kNoWidth, kNoHeight, language_);
        276 
        277  return DispatchStreamInfo(kStreamIndex, std::move(info));
        278 }
        279 } // namespace media
        280 } // namespace shaka
        STL namespace.
        All the methods that are virtual are virtual for mocking.
        -
        Status DispatchTextSample(size_t stream_index, std::shared_ptr< const TextSample > text_sample) const
        Dispatch the text sample to downstream handlers.
        -
        Status FlushDownstream(size_t output_stream_index)
        Flush the downstream connected at the specified output stream index.
        diff --git a/docs/db/d05/structshaka_1_1media_1_1H265SliceHeader.html b/docs/db/d05/structshaka_1_1media_1_1H265SliceHeader.html index fdf583175a..eb285422c0 100644 --- a/docs/db/d05/structshaka_1_1media_1_1H265SliceHeader.html +++ b/docs/db/d05/structshaka_1_1media_1_1H265SliceHeader.html @@ -212,7 +212,7 @@ std::vector< int > e
        diff --git a/docs/db/d11/structshaka_1_1media_1_1mp4_1_1CodecConfiguration.html b/docs/db/d11/structshaka_1_1media_1_1mp4_1_1CodecConfiguration.html index 62086ec088..1a7e2f42bf 100644 --- a/docs/db/d11/structshaka_1_1media_1_1mp4_1_1CodecConfiguration.html +++ b/docs/db/d11/structshaka_1_1media_1_1mp4_1_1CodecConfiguration.html @@ -101,7 +101,7 @@ Public Member Functions

        Public Attributes

        -FourCC box_type +FourCC box_type = FOURCC_NULL   std::vector< uint8_t > data @@ -143,7 +143,7 @@ Additional Inherited Members

        Implements shaka::media::mp4::Box.

        -

        Definition at line 1371 of file box_definitions.cc.

        +

        Definition at line 1401 of file box_definitions.cc.

        @@ -154,7 +154,7 @@ Additional Inherited Members diff --git a/docs/db/d14/classshaka_1_1media_1_1H265Parser-members.html b/docs/db/d14/classshaka_1_1media_1_1H265Parser-members.html index c57792095d..deace16c81 100644 --- a/docs/db/d14/classshaka_1_1media_1_1H265Parser-members.html +++ b/docs/db/d14/classshaka_1_1media_1_1H265Parser-members.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/db/d14/structshaka_1_1media_1_1H264WeightingFactors-members.html b/docs/db/d14/structshaka_1_1media_1_1H264WeightingFactors-members.html index f34f46c6f8..fec8444f68 100644 --- a/docs/db/d14/structshaka_1_1media_1_1H264WeightingFactors-members.html +++ b/docs/db/d14/structshaka_1_1media_1_1H264WeightingFactors-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/db/d1b/classshaka_1_1MemoryFile-members.html b/docs/db/d1b/classshaka_1_1MemoryFile-members.html index e21a72e18f..3362f94003 100644 --- a/docs/db/d1b/classshaka_1_1MemoryFile-members.html +++ b/docs/db/d1b/classshaka_1_1MemoryFile-members.html @@ -99,7 +99,7 @@ $(function() { diff --git a/docs/db/d1f/classshaka_1_1media_1_1TextSample.html b/docs/db/d1f/classshaka_1_1media_1_1TextSample.html index 41706be5fd..f97860d3b3 100644 --- a/docs/db/d1f/classshaka_1_1media_1_1TextSample.html +++ b/docs/db/d1f/classshaka_1_1media_1_1TextSample.html @@ -113,7 +113,7 @@ void AppendPayload (co diff --git a/docs/db/d21/structshaka_1_1media_1_1mp4_1_1SubtitleMediaHeader.html b/docs/db/d21/structshaka_1_1media_1_1mp4_1_1SubtitleMediaHeader.html index 47e769b169..b0cbc412e2 100644 --- a/docs/db/d21/structshaka_1_1media_1_1mp4_1_1SubtitleMediaHeader.html +++ b/docs/db/d21/structshaka_1_1media_1_1mp4_1_1SubtitleMediaHeader.html @@ -103,10 +103,10 @@ Public Member Functions Additional Inherited Members - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0   - Protected Member Functions inherited from shaka::media::mp4::FullBox bool ReadWriteHeaderInternal (BoxBuffer *buffer) final @@ -114,7 +114,7 @@ uint32_t flags

        Detailed Description

        -

        Definition at line 580 of file box_definitions.h.

        +

        Definition at line 585 of file box_definitions.h.

        Member Function Documentation

        ◆ BoxType()

        @@ -142,7 +142,7 @@ uint32_t flagsImplements shaka::media::mp4::Box.

        -

        Definition at line 1945 of file box_definitions.cc.

        +

        Definition at line 1986 of file box_definitions.cc.

        @@ -153,7 +153,7 @@ uint32_t flags diff --git a/docs/db/d2c/classshaka_1_1media_1_1mp2t_1_1VideoProgramMapTableWriter-members.html b/docs/db/d2c/classshaka_1_1media_1_1mp2t_1_1VideoProgramMapTableWriter-members.html index 07b30bbadd..3a44f5eaaa 100644 --- a/docs/db/d2c/classshaka_1_1media_1_1mp2t_1_1VideoProgramMapTableWriter-members.html +++ b/docs/db/d2c/classshaka_1_1media_1_1mp2t_1_1VideoProgramMapTableWriter-members.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/db/d30/classshaka_1_1media_1_1mp4_1_1MP4Muxer.html b/docs/db/d30/classshaka_1_1media_1_1mp4_1_1MP4Muxer.html index 2fb21068cf..1e4f971e4b 100644 --- a/docs/db/d30/classshaka_1_1media_1_1mp4_1_1MP4Muxer.html +++ b/docs/db/d30/classshaka_1_1media_1_1mp4_1_1MP4Muxer.html @@ -205,7 +205,7 @@ const std::map< size_t, std::pair< std::shared_ptr< diff --git a/docs/db/d31/h26x__byte__to__unit__stream__converter_8h_source.html b/docs/db/d31/h26x__byte__to__unit__stream__converter_8h_source.html index ac1056693c..99a1d3489c 100644 --- a/docs/db/d31/h26x__byte__to__unit__stream__converter_8h_source.html +++ b/docs/db/d31/h26x__byte__to__unit__stream__converter_8h_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/db/d31/track__run__iterator_8cc_source.html b/docs/db/d31/track__run__iterator_8cc_source.html index ab963eeced..4b6687de71 100644 --- a/docs/db/d31/track__run__iterator_8cc_source.html +++ b/docs/db/d31/track__run__iterator_8cc_source.html @@ -68,10 +68,10 @@ $(function() {
        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 #include "packager/media/formats/mp4/track_run_iterator.h"
        6 
        7 #include <algorithm>
        8 #include <limits>
        9 
        10 #include "packager/media/base/buffer_reader.h"
        11 #include "packager/media/base/fourccs.h"
        12 #include "packager/media/base/rcheck.h"
        13 #include "packager/media/formats/mp4/chunk_info_iterator.h"
        14 #include "packager/media/formats/mp4/composition_offset_iterator.h"
        15 #include "packager/media/formats/mp4/decoding_time_iterator.h"
        16 #include "packager/media/formats/mp4/sync_sample_iterator.h"
        17 
        18 namespace {
        19 const int64_t kInvalidOffset = std::numeric_limits<int64_t>::max();
        20 } // namespace
        21 
        22 namespace shaka {
        23 namespace media {
        24 namespace mp4 {
        25 
        26 struct SampleInfo {
        27  int64_t size;
        28  int64_t duration;
        29  int64_t cts_offset;
        30  bool is_keyframe;
        31 };
        32 
        33 struct TrackRunInfo {
        34  uint32_t track_id;
        35  std::vector<SampleInfo> samples;
        36  int64_t timescale;
        37  int64_t start_dts;
        38  int64_t sample_start_offset;
        39 
        40  TrackType track_type;
        41  const AudioSampleEntry* audio_description;
        42  const VideoSampleEntry* video_description;
        43 
        44  // Stores sample encryption entries, which is populated from 'senc' box if it
        45  // is available, otherwise will try to load from cenc auxiliary information.
        46  std::vector<SampleEncryptionEntry> sample_encryption_entries;
        47 
        48  // These variables are useful to load |sample_encryption_entries| from cenc
        49  // auxiliary information when 'senc' box is not available.
        50  int64_t aux_info_start_offset; // Only valid if aux_info_total_size > 0.
        51  int aux_info_default_size;
        52  std::vector<uint8_t> aux_info_sizes; // Populated if default_size == 0.
        53  int aux_info_total_size;
        54 
        55  TrackRunInfo();
        56  ~TrackRunInfo();
        57 };
        58 
        59 TrackRunInfo::TrackRunInfo()
        60  : track_id(0),
        61  timescale(-1),
        62  start_dts(-1),
        63  sample_start_offset(-1),
        64  track_type(kInvalid),
        65  audio_description(NULL),
        66  video_description(NULL),
        67  aux_info_start_offset(-1),
        68  aux_info_default_size(0),
        69  aux_info_total_size(0) {}
        70 TrackRunInfo::~TrackRunInfo() {}
        71 
        73  : moov_(moov), sample_dts_(0), sample_offset_(0) {
        74  CHECK(moov);
        75 }
        76 
        77 TrackRunIterator::~TrackRunIterator() {}
        78 
        79 static void PopulateSampleInfo(const TrackExtends& trex,
        80  const TrackFragmentHeader& tfhd,
        81  const TrackFragmentRun& trun,
        82  const size_t i,
        83  SampleInfo* sample_info) {
        84  if (i < trun.sample_sizes.size()) {
        85  sample_info->size = trun.sample_sizes[i];
        86  } else if (tfhd.default_sample_size > 0) {
        87  sample_info->size = tfhd.default_sample_size;
        88  } else {
        89  sample_info->size = trex.default_sample_size;
        90  }
        91 
        92  if (i < trun.sample_durations.size()) {
        93  sample_info->duration = trun.sample_durations[i];
        94  } else if (tfhd.default_sample_duration > 0) {
        95  sample_info->duration = tfhd.default_sample_duration;
        96  } else {
        97  sample_info->duration = trex.default_sample_duration;
        98  }
        99 
        100  if (i < trun.sample_composition_time_offsets.size()) {
        101  sample_info->cts_offset = trun.sample_composition_time_offsets[i];
        102  } else {
        103  sample_info->cts_offset = 0;
        104  }
        105 
        106  uint32_t flags;
        107  if (i < trun.sample_flags.size()) {
        108  flags = trun.sample_flags[i];
        109  } else if (tfhd.flags & TrackFragmentHeader::kDefaultSampleFlagsPresentMask) {
        110  flags = tfhd.default_sample_flags;
        111  } else {
        112  flags = trex.default_sample_flags;
        113  }
        114  sample_info->is_keyframe = !(flags & TrackFragmentHeader::kNonKeySampleMask);
        115 }
        116 
        117 // In well-structured encrypted media, each track run will be immediately
        118 // preceded by its auxiliary information; this is the only optimal storage
        119 // pattern in terms of minimum number of bytes from a serial stream needed to
        120 // begin playback. It also allows us to optimize caching on memory-constrained
        121 // architectures, because we can cache the relatively small auxiliary
        122 // information for an entire run and then discard data from the input stream,
        123 // instead of retaining the entire 'mdat' box.
        124 //
        125 // We optimize for this situation (with no loss of generality) by sorting track
        126 // runs during iteration in order of their first data offset (either sample data
        127 // or auxiliary data).
        128 class CompareMinTrackRunDataOffset {
        129  public:
        130  bool operator()(const TrackRunInfo& a, const TrackRunInfo& b) {
        131  int64_t a_aux = a.aux_info_total_size ? a.aux_info_start_offset : kInvalidOffset;
        132  int64_t b_aux = b.aux_info_total_size ? b.aux_info_start_offset : kInvalidOffset;
        133 
        134  int64_t a_lesser = std::min(a_aux, a.sample_start_offset);
        135  int64_t a_greater = std::max(a_aux, a.sample_start_offset);
        136  int64_t b_lesser = std::min(b_aux, b.sample_start_offset);
        137  int64_t b_greater = std::max(b_aux, b.sample_start_offset);
        138 
        139  if (a_lesser == b_lesser)
        140  return a_greater < b_greater;
        141  return a_lesser < b_lesser;
        142  }
        143 };
        144 
        146  runs_.clear();
        147 
        148  for (std::vector<Track>::const_iterator trak = moov_->tracks.begin();
        149  trak != moov_->tracks.end(); ++trak) {
        150  const SampleDescription& stsd =
        151  trak->media.information.sample_table.description;
        152  if (stsd.type != kAudio && stsd.type != kVideo) {
        153  DVLOG(1) << "Skipping unhandled track type";
        154  continue;
        155  }
        156 
        157  // Edit list is ignored.
        158  // We may consider supporting the single edit with a nonnegative media time
        159  // if it is required. Just need to pass the media_time to Muxer and
        160  // generate the edit list.
        161  const std::vector<EditListEntry>& edits = trak->edit.list.edits;
        162  if (!edits.empty()) {
        163  if (edits.size() > 1)
        164  DVLOG(1) << "Multi-entry edit box detected.";
        165 
        166  DLOG(INFO) << "Edit list with media time " << edits[0].media_time
        167  << " ignored.";
        168  }
        169 
        170  DecodingTimeIterator decoding_time(
        171  trak->media.information.sample_table.decoding_time_to_sample);
        172  CompositionOffsetIterator composition_offset(
        173  trak->media.information.sample_table.composition_time_to_sample);
        174  bool has_composition_offset = composition_offset.IsValid();
        175  ChunkInfoIterator chunk_info(
        176  trak->media.information.sample_table.sample_to_chunk);
        177  SyncSampleIterator sync_sample(
        178  trak->media.information.sample_table.sync_sample);
        179  // Skip processing saiz and saio boxes for non-fragmented mp4 as we
        180  // don't support encrypted non-fragmented mp4.
        181 
        182  const SampleSize& sample_size =
        183  trak->media.information.sample_table.sample_size;
        184  const std::vector<uint64_t>& chunk_offset_vector =
        185  trak->media.information.sample_table.chunk_large_offset.offsets;
        186 
        187  int64_t run_start_dts = 0;
        188 
        189  uint32_t num_samples = sample_size.sample_count;
        190  uint32_t num_chunks = static_cast<uint32_t>(chunk_offset_vector.size());
        191 
        192  // Check that total number of samples match.
        193  DCHECK_EQ(num_samples, decoding_time.NumSamples());
        194  if (has_composition_offset) {
        195  DCHECK_EQ(num_samples, composition_offset.NumSamples());
        196  }
        197  if (num_chunks > 0) {
        198  DCHECK_EQ(num_samples, chunk_info.NumSamples(1, num_chunks));
        199  }
        200  DCHECK_GE(num_chunks, chunk_info.LastFirstChunk());
        201 
        202  if (num_samples > 0) {
        203  // Verify relevant tables are not empty.
        204  RCHECK(decoding_time.IsValid());
        205  RCHECK(chunk_info.IsValid());
        206  }
        207 
        208  uint32_t sample_index = 0;
        209  for (uint32_t chunk_index = 0; chunk_index < num_chunks; ++chunk_index) {
        210  RCHECK(chunk_info.current_chunk() == chunk_index + 1);
        211 
        212  TrackRunInfo tri;
        213  tri.track_id = trak->header.track_id;
        214  tri.timescale = trak->media.header.timescale;
        215  tri.start_dts = run_start_dts;
        216  tri.sample_start_offset = chunk_offset_vector[chunk_index];
        217 
        218  uint32_t desc_idx = chunk_info.sample_description_index();
        219  RCHECK(desc_idx > 0); // Descriptions are one-indexed in the file.
        220  desc_idx -= 1;
        221 
        222  tri.track_type = stsd.type;
        223  if (tri.track_type == kAudio) {
        224  RCHECK(!stsd.audio_entries.empty());
        225  if (desc_idx > stsd.audio_entries.size())
        226  desc_idx = 0;
        227  tri.audio_description = &stsd.audio_entries[desc_idx];
        228  // We don't support encrypted non-fragmented mp4 for now.
        229  RCHECK(tri.audio_description->sinf.info.track_encryption
        230  .default_is_protected == 0);
        231  } else if (tri.track_type == kVideo) {
        232  RCHECK(!stsd.video_entries.empty());
        233  if (desc_idx > stsd.video_entries.size())
        234  desc_idx = 0;
        235  tri.video_description = &stsd.video_entries[desc_idx];
        236  // We don't support encrypted non-fragmented mp4 for now.
        237  RCHECK(tri.video_description->sinf.info.track_encryption
        238  .default_is_protected == 0);
        239  }
        240 
        241  uint32_t samples_per_chunk = chunk_info.samples_per_chunk();
        242  tri.samples.resize(samples_per_chunk);
        243  for (uint32_t k = 0; k < samples_per_chunk; ++k) {
        244  SampleInfo& sample = tri.samples[k];
        245  sample.size = sample_size.sample_size != 0
        246  ? sample_size.sample_size
        247  : sample_size.sizes[sample_index];
        248  sample.duration = decoding_time.sample_delta();
        249  sample.cts_offset =
        250  has_composition_offset ? composition_offset.sample_offset() : 0;
        251  sample.is_keyframe = sync_sample.IsSyncSample();
        252 
        253  run_start_dts += sample.duration;
        254 
        255  // Advance to next sample. Should success except for last sample.
        256  ++sample_index;
        257  RCHECK(chunk_info.AdvanceSample() && sync_sample.AdvanceSample());
        258  if (sample_index == num_samples) {
        259  // We should hit end of tables for decoding time and composition
        260  // offset.
        261  RCHECK(!decoding_time.AdvanceSample());
        262  if (has_composition_offset)
        263  RCHECK(!composition_offset.AdvanceSample());
        264  } else {
        265  RCHECK(decoding_time.AdvanceSample());
        266  if (has_composition_offset)
        267  RCHECK(composition_offset.AdvanceSample());
        268  }
        269  }
        270 
        271  runs_.push_back(tri);
        272  }
        273  }
        274 
        275  std::sort(runs_.begin(), runs_.end(), CompareMinTrackRunDataOffset());
        276  run_itr_ = runs_.begin();
        277  ResetRun();
        278  return true;
        279 }
        280 
        282  runs_.clear();
        283 
        284  next_fragment_start_dts_.resize(moof.tracks.size(), 0);
        285  for (size_t i = 0; i < moof.tracks.size(); i++) {
        286  const TrackFragment& traf = moof.tracks[i];
        287 
        288  const Track* trak = NULL;
        289  for (size_t t = 0; t < moov_->tracks.size(); t++) {
        290  if (moov_->tracks[t].header.track_id == traf.header.track_id)
        291  trak = &moov_->tracks[t];
        292  }
        293  RCHECK(trak);
        294 
        295  const TrackExtends* trex = NULL;
        296  for (size_t t = 0; t < moov_->extends.tracks.size(); t++) {
        297  if (moov_->extends.tracks[t].track_id == traf.header.track_id)
        298  trex = &moov_->extends.tracks[t];
        299  }
        300  RCHECK(trex);
        301 
        302  const SampleDescription& stsd =
        303  trak->media.information.sample_table.description;
        304  if (stsd.type != kAudio && stsd.type != kVideo) {
        305  DVLOG(1) << "Skipping unhandled track type";
        306  continue;
        307  }
        308  size_t desc_idx = traf.header.sample_description_index;
        309  if (!desc_idx)
        310  desc_idx = trex->default_sample_description_index;
        311  RCHECK(desc_idx > 0); // Descriptions are one-indexed in the file
        312  desc_idx -= 1;
        313 
        314  const AudioSampleEntry* audio_sample_entry = NULL;
        315  const VideoSampleEntry* video_sample_entry = NULL;
        316  switch (stsd.type) {
        317  case kAudio:
        318  RCHECK(!stsd.audio_entries.empty());
        319  if (desc_idx > stsd.audio_entries.size())
        320  desc_idx = 0;
        321  audio_sample_entry = &stsd.audio_entries[desc_idx];
        322  break;
        323  case kVideo:
        324  RCHECK(!stsd.video_entries.empty());
        325  if (desc_idx > stsd.video_entries.size())
        326  desc_idx = 0;
        327  video_sample_entry = &stsd.video_entries[desc_idx];
        328  break;
        329  default:
        330  NOTREACHED();
        331  break;
        332  }
        333 
        334  // SampleEncryptionEntries should not have been parsed, without having
        335  // iv_size. Parse the box now.
        336  DCHECK(traf.sample_encryption.sample_encryption_entries.empty());
        337  std::vector<SampleEncryptionEntry> sample_encryption_entries;
        338  if (!traf.sample_encryption.sample_encryption_data.empty()) {
        339  RCHECK(audio_sample_entry || video_sample_entry);
        340  const uint8_t default_per_sample_iv_size =
        341  audio_sample_entry
        342  ? audio_sample_entry->sinf.info.track_encryption
        343  .default_per_sample_iv_size
        344  : video_sample_entry->sinf.info.track_encryption
        345  .default_per_sample_iv_size;
        346  RCHECK(traf.sample_encryption.ParseFromSampleEncryptionData(
        347  default_per_sample_iv_size, &sample_encryption_entries));
        348  }
        349 
        350  int64_t run_start_dts = traf.decode_time_absent
        351  ? next_fragment_start_dts_[i]
        352  : traf.decode_time.decode_time;
        353  int sample_count_sum = 0;
        354 
        355  for (size_t j = 0; j < traf.runs.size(); j++) {
        356  const TrackFragmentRun& trun = traf.runs[j];
        357  TrackRunInfo tri;
        358  tri.track_id = traf.header.track_id;
        359  tri.timescale = trak->media.header.timescale;
        360  tri.start_dts = run_start_dts;
        361  tri.sample_start_offset = trun.data_offset;
        362 
        363  tri.track_type = stsd.type;
        364  tri.audio_description = audio_sample_entry;
        365  tri.video_description = video_sample_entry;
        366 
        367  tri.aux_info_start_offset = -1;
        368  tri.aux_info_total_size = 0;
        369  // Populate sample encryption entries from SampleEncryption 'senc' box if
        370  // it is available; otherwise initialize aux_info variables, which will
        371  // be used to populate sample encryption entries later in CacheAuxInfo.
        372  if (!sample_encryption_entries.empty()) {
        373  RCHECK(sample_encryption_entries.size() >=
        374  sample_count_sum + trun.sample_count);
        375  for (size_t k = 0; k < trun.sample_count; ++k) {
        376  tri.sample_encryption_entries.push_back(
        377  sample_encryption_entries[sample_count_sum + k]);
        378  }
        379  } else if (traf.auxiliary_offset.offsets.size() > j) {
        380  // Collect information from the auxiliary_offset entry with the same
        381  // index in the 'saiz' container as the current run's index in the
        382  // 'trun' container, if it is present.
        383  tri.aux_info_start_offset = traf.auxiliary_offset.offsets[j];
        384  // There should be an auxiliary info entry corresponding to each sample
        385  // in the auxiliary offset entry's corresponding track run.
        386  RCHECK(traf.auxiliary_size.sample_count >=
        387  sample_count_sum + trun.sample_count);
        388  tri.aux_info_default_size =
        389  traf.auxiliary_size.default_sample_info_size;
        390  if (tri.aux_info_default_size == 0) {
        391  const std::vector<uint8_t>& sizes =
        392  traf.auxiliary_size.sample_info_sizes;
        393  tri.aux_info_sizes.insert(
        394  tri.aux_info_sizes.begin(),
        395  sizes.begin() + sample_count_sum,
        396  sizes.begin() + sample_count_sum + trun.sample_count);
        397  }
        398 
        399  // If the default info size is positive, find the total size of the aux
        400  // info block from it, otherwise sum over the individual sizes of each
        401  // aux info entry in the aux_offset entry.
        402  if (tri.aux_info_default_size) {
        403  tri.aux_info_total_size =
        404  tri.aux_info_default_size * trun.sample_count;
        405  } else {
        406  tri.aux_info_total_size = 0;
        407  for (size_t k = 0; k < trun.sample_count; k++) {
        408  tri.aux_info_total_size += tri.aux_info_sizes[k];
        409  }
        410  }
        411  }
        412 
        413  tri.samples.resize(trun.sample_count);
        414  for (size_t k = 0; k < trun.sample_count; k++) {
        415  PopulateSampleInfo(*trex, traf.header, trun, k,
        416  &tri.samples[k]);
        417  run_start_dts += tri.samples[k].duration;
        418  }
        419  runs_.push_back(tri);
        420  sample_count_sum += trun.sample_count;
        421  }
        422  next_fragment_start_dts_[i] = run_start_dts;
        423  }
        424 
        425  std::sort(runs_.begin(), runs_.end(), CompareMinTrackRunDataOffset());
        426  run_itr_ = runs_.begin();
        427  ResetRun();
        428  return true;
        429 }
        430 
        432  ++run_itr_;
        433  ResetRun();
        434 }
        435 
        436 void TrackRunIterator::ResetRun() {
        437  if (!IsRunValid())
        438  return;
        439  sample_dts_ = run_itr_->start_dts;
        440  sample_offset_ = run_itr_->sample_start_offset;
        441  sample_itr_ = run_itr_->samples.begin();
        442 }
        443 
        445  DCHECK(IsSampleValid());
        446  sample_dts_ += sample_itr_->duration;
        447  sample_offset_ += sample_itr_->size;
        448  ++sample_itr_;
        449 }
        450 
        451 // This implementation only indicates a need for caching if CENC auxiliary
        452 // info is available in the stream.
        454  DCHECK(IsRunValid());
        455  return is_encrypted() && aux_info_size() > 0 &&
        456  run_itr_->sample_encryption_entries.size() == 0;
        457 }
        458 
        459 // This implementation currently only caches CENC auxiliary info.
        460 bool TrackRunIterator::CacheAuxInfo(const uint8_t* buf, int buf_size) {
        461  RCHECK(AuxInfoNeedsToBeCached() && buf_size >= aux_info_size());
        462 
        463  std::vector<SampleEncryptionEntry>& sample_encryption_entries =
        464  runs_[run_itr_ - runs_.begin()].sample_encryption_entries;
        465  sample_encryption_entries.resize(run_itr_->samples.size());
        466  int64_t pos = 0;
        467  for (size_t i = 0; i < run_itr_->samples.size(); i++) {
        468  int info_size = run_itr_->aux_info_default_size;
        469  if (!info_size)
        470  info_size = run_itr_->aux_info_sizes[i];
        471 
        472  BufferReader reader(buf + pos, info_size);
        473  const bool has_subsamples =
        474  info_size > track_encryption().default_per_sample_iv_size;
        475  RCHECK(sample_encryption_entries[i].ParseFromBuffer(
        476  track_encryption().default_per_sample_iv_size, has_subsamples,
        477  &reader));
        478  pos += info_size;
        479  }
        480 
        481  return true;
        482 }
        483 
        484 bool TrackRunIterator::IsRunValid() const { return run_itr_ != runs_.end(); }
        485 
        487  return IsRunValid() && (sample_itr_ != run_itr_->samples.end());
        488 }
        489 
        490 // Because tracks are in sorted order and auxiliary information is cached when
        491 // returning samples, it is guaranteed that no data will be required before the
        492 // lesser of the minimum data offset of this track and the next in sequence.
        493 // (The stronger condition - that no data is required before the minimum data
        494 // offset of this track alone - is not guaranteed, because the BMFF spec does
        495 // not have any inter-run ordering restrictions.)
        497  int64_t offset = kInvalidOffset;
        498 
        499  if (IsSampleValid()) {
        500  offset = std::min(offset, sample_offset_);
        502  offset = std::min(offset, aux_info_offset());
        503  }
        504  if (run_itr_ != runs_.end()) {
        505  std::vector<TrackRunInfo>::const_iterator next_run = run_itr_ + 1;
        506  if (next_run != runs_.end()) {
        507  offset = std::min(offset, next_run->sample_start_offset);
        508  if (next_run->aux_info_total_size)
        509  offset = std::min(offset, next_run->aux_info_start_offset);
        510  }
        511  }
        512  if (offset == kInvalidOffset)
        513  return runs_.empty() ? 0 : runs_[0].sample_start_offset;
        514  return offset;
        515 }
        516 
        517 uint32_t TrackRunIterator::track_id() const {
        518  DCHECK(IsRunValid());
        519  return run_itr_->track_id;
        520 }
        521 
        522 bool TrackRunIterator::is_encrypted() const {
        523  DCHECK(IsRunValid());
        524  return track_encryption().default_is_protected == 1;
        525 }
        526 
        527 int64_t TrackRunIterator::aux_info_offset() const {
        528  return run_itr_->aux_info_start_offset;
        529 }
        530 
        531 int TrackRunIterator::aux_info_size() const {
        532  return run_itr_->aux_info_total_size;
        533 }
        534 
        535 bool TrackRunIterator::is_audio() const {
        536  DCHECK(IsRunValid());
        537  return run_itr_->track_type == kAudio;
        538 }
        539 
        540 bool TrackRunIterator::is_video() const {
        541  DCHECK(IsRunValid());
        542  return run_itr_->track_type == kVideo;
        543 }
        544 
        546  DCHECK(is_audio());
        547  DCHECK(run_itr_->audio_description);
        548  return *run_itr_->audio_description;
        549 }
        550 
        552  DCHECK(is_video());
        553  DCHECK(run_itr_->video_description);
        554  return *run_itr_->video_description;
        555 }
        556 
        557 int64_t TrackRunIterator::sample_offset() const {
        558  DCHECK(IsSampleValid());
        559  return sample_offset_;
        560 }
        561 
        562 int TrackRunIterator::sample_size() const {
        563  DCHECK(IsSampleValid());
        564  return sample_itr_->size;
        565 }
        566 
        567 int64_t TrackRunIterator::dts() const {
        568  DCHECK(IsSampleValid());
        569  return sample_dts_;
        570 }
        571 
        572 int64_t TrackRunIterator::cts() const {
        573  DCHECK(IsSampleValid());
        574  return sample_dts_ + sample_itr_->cts_offset;
        575 }
        576 
        577 int64_t TrackRunIterator::duration() const {
        578  DCHECK(IsSampleValid());
        579  return sample_itr_->duration;
        580 }
        581 
        582 bool TrackRunIterator::is_keyframe() const {
        583  DCHECK(IsSampleValid());
        584  return sample_itr_->is_keyframe;
        585 }
        586 
        587 const TrackEncryption& TrackRunIterator::track_encryption() const {
        588  if (is_audio())
        589  return audio_description().sinf.info.track_encryption;
        590  DCHECK(is_video());
        591  return video_description().sinf.info.track_encryption;
        592 }
        593 
        594 std::unique_ptr<DecryptConfig> TrackRunIterator::GetDecryptConfig() {
        595  std::vector<uint8_t> iv;
        596  std::vector<SubsampleEntry> subsamples;
        597 
        598  size_t sample_idx = sample_itr_ - run_itr_->samples.begin();
        599  if (sample_idx < run_itr_->sample_encryption_entries.size()) {
        600  const SampleEncryptionEntry& sample_encryption_entry =
        601  run_itr_->sample_encryption_entries[sample_idx];
        602  DCHECK(is_encrypted());
        603  DCHECK(!AuxInfoNeedsToBeCached());
        604 
        605  const size_t total_size_of_subsamples =
        606  sample_encryption_entry.GetTotalSizeOfSubsamples();
        607  if (total_size_of_subsamples != 0 &&
        608  total_size_of_subsamples != static_cast<size_t>(sample_size())) {
        609  LOG(ERROR) << "Incorrect CENC subsample size.";
        610  return std::unique_ptr<DecryptConfig>();
        611  }
        612 
        613  iv = sample_encryption_entry.initialization_vector;
        614  subsamples = sample_encryption_entry.subsamples;
        615  }
        616 
        617  FourCC protection_scheme = is_audio() ? audio_description().sinf.type.type
        618  : video_description().sinf.type.type;
        619  if (iv.empty()) {
        620  if (protection_scheme != FOURCC_cbcs) {
        621  LOG(WARNING)
        622  << "Constant IV should only be used with 'cbcs' protection scheme.";
        623  }
        624  iv = track_encryption().default_constant_iv;
        625  if (iv.empty()) {
        626  LOG(ERROR) << "IV cannot be empty.";
        627  return std::unique_ptr<DecryptConfig>();
        628  }
        629  }
        630  return std::unique_ptr<DecryptConfig>(new DecryptConfig(
        631  track_encryption().default_kid, iv, subsamples, protection_scheme,
        632  track_encryption().default_crypt_byte_block,
        633  track_encryption().default_skip_byte_block));
        634 }
        635 
        636 } // namespace mp4
        637 } // namespace media
        638 } // namespace shaka
        - + - - + + @@ -82,31 +82,31 @@ $(function() { - +
        All the methods that are virtual are virtual for mocking.
        const VideoSampleEntry & video_description() const
        Only valid if is_video() is true.
        - -
        bool ParseFromSampleEncryptionData(uint8_t iv_size, std::vector< SampleEncryptionEntry > *sample_encryption_entries) const
        + +
        bool ParseFromSampleEncryptionData(uint8_t iv_size, std::vector< SampleEncryptionEntry > *sample_encryption_entries) const
        - -
        std::vector< uint8_t > sample_encryption_data
        - - - + +
        std::vector< uint8_t > sample_encryption_data
        + + +
        std::unique_ptr< DecryptConfig > GetDecryptConfig()
        - - + + - + @@ -117,11 +117,11 @@ $(function() {
        bool CacheAuxInfo(const uint8_t *buf, int size)
        const AudioSampleEntry & audio_description() const
        Only valid if is_audio() is true.
        - +
        diff --git a/docs/db/d38/classshaka_1_1media_1_1mp2t_1_1PesPacketGenerator-members.html b/docs/db/d38/classshaka_1_1media_1_1mp2t_1_1PesPacketGenerator-members.html index 84a3ac2e71..17042c2e49 100644 --- a/docs/db/d38/classshaka_1_1media_1_1mp2t_1_1PesPacketGenerator-members.html +++ b/docs/db/d38/classshaka_1_1media_1_1mp2t_1_1PesPacketGenerator-members.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/db/d3b/classshaka_1_1media_1_1VideoSliceHeaderParser-members.html b/docs/db/d3b/classshaka_1_1media_1_1VideoSliceHeaderParser-members.html index 89419ed5f0..6c64e4a250 100644 --- a/docs/db/d3b/classshaka_1_1media_1_1VideoSliceHeaderParser-members.html +++ b/docs/db/d3b/classshaka_1_1media_1_1VideoSliceHeaderParser-members.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/db/d45/mpd__notify__muxer__listener_8h_source.html b/docs/db/d45/mpd__notify__muxer__listener_8h_source.html index 80f68e1dbb..807acb324b 100644 --- a/docs/db/d45/mpd__notify__muxer__listener_8h_source.html +++ b/docs/db/d45/mpd__notify__muxer__listener_8h_source.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/db/d49/structshaka_1_1media_1_1EventInfo.html b/docs/db/d49/structshaka_1_1media_1_1EventInfo.html index 94715e57a7..6e1c488ed8 100644 --- a/docs/db/d49/structshaka_1_1media_1_1EventInfo.html +++ b/docs/db/d49/structshaka_1_1media_1_1EventInfo.html @@ -98,7 +98,7 @@ union { diff --git a/docs/db/d4b/classshaka_1_1MockAdaptationSet.html b/docs/db/d4b/classshaka_1_1MockAdaptationSet.html index 371a6cb9f2..5b32d73658 100644 --- a/docs/db/d4b/classshaka_1_1MockAdaptationSet.html +++ b/docs/db/d4b/classshaka_1_1MockAdaptationSet.html @@ -170,7 +170,7 @@ Additional Inherited Members diff --git a/docs/db/d4e/classshaka_1_1media_1_1mp4_1_1CompositionOffsetIterator.html b/docs/db/d4e/classshaka_1_1media_1_1mp4_1_1CompositionOffsetIterator.html index 25ced94120..1511d933b5 100644 --- a/docs/db/d4e/classshaka_1_1media_1_1mp4_1_1CompositionOffsetIterator.html +++ b/docs/db/d4e/classshaka_1_1media_1_1mp4_1_1CompositionOffsetIterator.html @@ -210,7 +210,7 @@ Public Member Functions diff --git a/docs/db/d51/mp2t__media__parser_8h_source.html b/docs/db/d51/mp2t__media__parser_8h_source.html index d732e08198..3af8b68bb5 100644 --- a/docs/db/d51/mp2t__media__parser_8h_source.html +++ b/docs/db/d51/mp2t__media__parser_8h_source.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/db/d51/two__pass__single__segment__segmenter_8h_source.html b/docs/db/d51/two__pass__single__segment__segmenter_8h_source.html index 9f77807d54..764745de2c 100644 --- a/docs/db/d51/two__pass__single__segment__segmenter_8h_source.html +++ b/docs/db/d51/two__pass__single__segment__segmenter_8h_source.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/db/d59/media__handler__test__base_8h_source.html b/docs/db/d59/media__handler__test__base_8h_source.html index 51e9ba8a82..f6c54644a5 100644 --- a/docs/db/d59/media__handler__test__base_8h_source.html +++ b/docs/db/d59/media__handler__test__base_8h_source.html @@ -66,25 +66,25 @@ $(function() {
        media_handler_test_base.h
        -
        1 // Copyright 2017 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_BASE_MEDIA_HANDLER_TEST_BASE_H_
        8 #define PACKAGER_MEDIA_BASE_MEDIA_HANDLER_TEST_BASE_H_
        9 
        10 #include <gmock/gmock.h>
        11 #include <gtest/gtest.h>
        12 
        13 #include "packager/base/strings/string_number_conversions.h"
        14 #include "packager/media/base/media_handler.h"
        15 
        16 namespace shaka {
        17 namespace media {
        18 
        19 std::string StreamDataTypeToString(StreamDataType stream_data_type);
        20 std::string BoolToString(bool value);
        21 
        22 MATCHER_P(IsStreamInfo, stream_index, "") {
        23  return arg->stream_index == stream_index &&
        24  arg->stream_data_type == StreamDataType::kStreamInfo;
        25 }
        26 
        27 MATCHER_P3(IsStreamInfo, stream_index, time_scale, encrypted, "") {
        28  if (arg->stream_data_type != StreamDataType::kStreamInfo) {
        29  *result_listener << "which is "
        30  << StreamDataTypeToString(arg->stream_data_type);
        31  return false;
        32  }
        33 
        34  *result_listener << "which is (" << arg->stream_index << ","
        35  << arg->stream_info->time_scale() << ","
        36  << BoolToString(arg->stream_info->is_encrypted()) << ")";
        37  return arg->stream_index == stream_index &&
        38  arg->stream_info->time_scale() == time_scale &&
        39  arg->stream_info->is_encrypted() == encrypted;
        40 }
        41 
        42 MATCHER_P4(IsStreamInfo, stream_index, time_scale, encrypted, language, "") {
        43  if (arg->stream_data_type != StreamDataType::kStreamInfo) {
        44  *result_listener << "which is "
        45  << StreamDataTypeToString(arg->stream_data_type);
        46  return false;
        47  }
        48 
        49  *result_listener << "which is (" << arg->stream_index << ","
        50  << arg->stream_info->time_scale() << ","
        51  << BoolToString(arg->stream_info->is_encrypted()) << ","
        52  << arg->stream_info->language() << ")";
        53  return arg->stream_index == stream_index &&
        54  arg->stream_info->time_scale() == time_scale &&
        55  arg->stream_info->is_encrypted() == encrypted &&
        56  arg->stream_info->language() == language;
        57 }
        58 
        59 MATCHER_P5(IsSegmentInfo,
        60  stream_index,
        61  start_timestamp,
        62  duration,
        63  subsegment,
        64  encrypted,
        65  "") {
        66  if (arg->stream_data_type != StreamDataType::kSegmentInfo) {
        67  *result_listener << "which is "
        68  << StreamDataTypeToString(arg->stream_data_type);
        69  return false;
        70  }
        71 
        72  *result_listener << "which is (" << arg->stream_index << ","
        73  << arg->segment_info->start_timestamp << ","
        74  << arg->segment_info->duration << ","
        75  << BoolToString(arg->segment_info->is_subsegment) << ","
        76  << BoolToString(arg->segment_info->is_encrypted) << ")";
        77  return arg->stream_index == stream_index &&
        78  arg->segment_info->start_timestamp == start_timestamp &&
        79  arg->segment_info->duration == duration &&
        80  arg->segment_info->is_subsegment == subsegment &&
        81  arg->segment_info->is_encrypted == encrypted;
        82 }
        83 
        84 MATCHER_P6(MatchEncryptionConfig,
        85  protection_scheme,
        86  crypt_byte_block,
        87  skip_byte_block,
        88  per_sample_iv_size,
        89  constant_iv,
        90  key_id,
        91  "") {
        92  *result_listener << "which is (" << FourCCToString(arg.protection_scheme)
        93  << "," << static_cast<int>(arg.crypt_byte_block) << ","
        94  << static_cast<int>(arg.skip_byte_block) << ","
        95  << static_cast<int>(arg.per_sample_iv_size) << ","
        96  << base::HexEncode(arg.constant_iv.data(),
        97  arg.constant_iv.size())
        98  << ","
        99  << base::HexEncode(arg.key_id.data(), arg.key_id.size())
        100  << ")";
        101  return arg.protection_scheme == protection_scheme &&
        102  arg.crypt_byte_block == crypt_byte_block &&
        103  arg.skip_byte_block == skip_byte_block &&
        104  arg.per_sample_iv_size == per_sample_iv_size &&
        105  arg.constant_iv == constant_iv && arg.key_id == key_id;
        106 }
        107 
        108 MATCHER_P4(IsMediaSample, stream_index, timestamp, duration, encrypted, "") {
        109  if (arg->stream_data_type != StreamDataType::kMediaSample) {
        110  *result_listener << "which is "
        111  << StreamDataTypeToString(arg->stream_data_type);
        112  return false;
        113  }
        114  *result_listener << "which is (" << arg->stream_index << ","
        115  << arg->media_sample->dts() << ","
        116  << arg->media_sample->duration() << ","
        117  << BoolToString(arg->media_sample->is_encrypted()) << ")";
        118  return arg->stream_index == stream_index &&
        119  arg->media_sample->dts() == static_cast<int64_t>(timestamp) &&
        120  arg->media_sample->duration() == static_cast<int64_t>(duration) &&
        121  arg->media_sample->is_encrypted() == encrypted;
        122 }
        123 
        124 MATCHER_P5(IsTextSample, id, start_time, end_time, settings, payload, "") {
        125  if (arg->stream_data_type != StreamDataType::kTextSample) {
        126  *result_listener << "which is "
        127  << StreamDataTypeToString(arg->stream_data_type);
        128  return false;
        129  }
        130  *result_listener << "which is (" << arg->text_sample->id() << ","
        131  << arg->text_sample->start_time() << ","
        132  << arg->text_sample->EndTime() << ","
        133  << arg->text_sample->settings() << ","
        134  << arg->text_sample->payload() << ")";
        135  return arg->text_sample->id() == id &&
        136  arg->text_sample->start_time() == start_time &&
        137  arg->text_sample->EndTime() == end_time &&
        138  arg->text_sample->settings() == settings &&
        139  arg->text_sample->payload() == payload;
        140 }
        141 
        142 MATCHER_P2(IsCueEvent, stream_index, time_in_seconds, "") {
        143  if (arg->stream_data_type != StreamDataType::kCueEvent) {
        144  *result_listener << "which is "
        145  << StreamDataTypeToString(arg->stream_data_type);
        146  return false;
        147  }
        148  *result_listener << "which is (" << arg->stream_index << ","
        149  << arg->cue_event->time_in_seconds << ")";
        150  return arg->stream_index == stream_index &&
        151  arg->cue_event->time_in_seconds == time_in_seconds;
        152 }
        153 
        155  public:
        159 
        160  private:
        161  bool ValidateOutputStreamIndex(size_t index) const override;
        162  Status InitializeInternal() override;
        163  Status Process(std::unique_ptr<StreamData> stream_data) override;
        164 };
        165 
        167  public:
        168  MOCK_METHOD1(OnProcess, void(const StreamData*));
        169  MOCK_METHOD1(OnFlush, void(size_t index));
        170 
        171  private:
        172  Status InitializeInternal() override;
        173  Status Process(std::unique_ptr<StreamData> stream_data) override;
        174  Status OnFlushRequest(size_t index) override;
        175 };
        176 
        177 // TODO(vaage) : Remove this test handler and convert other tests to use
        178 // FakeInputMediaHandler and MockOutputMediaHandler.
        180  public:
        181  const std::vector<std::unique_ptr<StreamData>>& stream_data_vector() const {
        182  return stream_data_vector_;
        183  }
        184  void clear_stream_data_vector() { stream_data_vector_.clear(); }
        185 
        186  protected:
        187  Status InitializeInternal() override;
        188  Status Process(std::unique_ptr<StreamData> stream_data) override;
        189  Status OnFlushRequest(size_t input_stream_index) override;
        190  bool ValidateOutputStreamIndex(size_t stream_index) const override;
        191 
        192  std::vector<std::unique_ptr<StreamData>> stream_data_vector_;
        193 };
        194 
        195 class MediaHandlerTestBase : public ::testing::Test {
        196  public:
        197  MediaHandlerTestBase() = default;
        198 
        199  protected:
        200  bool IsVideoCodec(Codec codec) const;
        201 
        202  std::unique_ptr<StreamInfo> GetVideoStreamInfo(uint32_t time_scale) const;
        203 
        204  std::unique_ptr<StreamInfo> GetVideoStreamInfo(uint32_t time_scale,
        205  uint32_t width,
        206  uint64_t height) const;
        207 
        208  std::unique_ptr<StreamInfo> GetVideoStreamInfo(uint32_t time_scale,
        209  Codec codec) const;
        210 
        211  std::unique_ptr<StreamInfo> GetVideoStreamInfo(uint32_t time_scale,
        212  Codec codec,
        213  uint32_t width,
        214  uint64_t height) const;
        215 
        216  std::unique_ptr<StreamInfo> GetAudioStreamInfo(uint32_t time_scale) const;
        217 
        218  std::unique_ptr<StreamInfo> GetAudioStreamInfo(uint32_t time_scale,
        219  Codec codec) const;
        220 
        221  std::shared_ptr<MediaSample> GetMediaSample(int64_t timestamp,
        222  int64_t duration,
        223  bool is_keyframe) const;
        224 
        225  std::shared_ptr<MediaSample> GetMediaSample(int64_t timestamp,
        226  int64_t duration,
        227  bool is_keyframe,
        228  const uint8_t* data,
        229  size_t data_length) const;
        230 
        231  std::unique_ptr<SegmentInfo> GetSegmentInfo(int64_t start_timestamp,
        232  int64_t duration,
        233  bool is_subsegment) const;
        234 
        235  std::unique_ptr<StreamInfo> GetTextStreamInfo() const;
        236 
        237  std::unique_ptr<TextSample> GetTextSample(const std::string& id,
        238  int64_t start,
        239  int64_t end,
        240  const std::string& payload) const;
        241 
        242  std::unique_ptr<CueEvent> GetCueEvent(double time_in_seconds) const;
        243 
        244  // Connect and initialize all handlers.
        245  Status SetUpAndInitializeGraph(std::shared_ptr<MediaHandler> handler,
        246  size_t input_count,
        247  size_t output_count);
        248 
        249  // Get the input handler at |index|. The values of |index| will match the
        250  // call to |AddInput|.
        251  FakeInputMediaHandler* Input(size_t index);
        252 
        253  // Get the output handler at |index|. The values of |index| will match the
        254  // call to |AddOutput|.
        255  MockOutputMediaHandler* Output(size_t index);
        256 
        257  private:
        259  MediaHandlerTestBase& operator=(const MediaHandlerTestBase&) = delete;
        260 
        261  std::shared_ptr<MediaHandler> handler_;
        262 
        263  std::vector<std::shared_ptr<FakeInputMediaHandler>> inputs_;
        264  std::vector<std::shared_ptr<MockOutputMediaHandler>> outputs_;
        265 };
        266 
        268  public:
        270 
        271  protected:
        273  void SetUpGraph(size_t num_inputs,
        274  size_t num_outputs,
        275  std::shared_ptr<MediaHandler> handler);
        276 
        278  const std::vector<std::unique_ptr<StreamData>>& GetOutputStreamDataVector()
        279  const;
        280 
        282  void ClearOutputStreamDataVector();
        283 
        285  std::shared_ptr<MediaHandler> some_handler() { return some_handler_; }
        286 
        288  std::shared_ptr<FakeMediaHandler> next_handler() { return next_handler_; }
        289 
        290  private:
        292  MediaHandlerGraphTestBase& operator=(const MediaHandlerTestBase&) = delete;
        293 
        294  // Downstream handler used in testing graph.
        295  std::shared_ptr<FakeMediaHandler> next_handler_;
        296  // Some random handler which can be used for testing.
        297  std::shared_ptr<MediaHandler> some_handler_;
        298 };
        299 
        300 } // namespace media
        301 } // namespace shaka
        302 
        303 #endif // PACKAGER_MEDIA_BASE_MEDIA_HANDLER_TEST_BASE_H_
        -
        Status Dispatch(std::unique_ptr< StreamData > stream_data) const
        - - - -
        virtual Status OnFlushRequest(size_t input_stream_index)
        Event handler for flush request at the specific input stream index.
        -
        std::shared_ptr< FakeMediaHandler > next_handler()
        +
        1 // Copyright 2017 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_BASE_MEDIA_HANDLER_TEST_BASE_H_
        8 #define PACKAGER_MEDIA_BASE_MEDIA_HANDLER_TEST_BASE_H_
        9 
        10 #include <gmock/gmock.h>
        11 #include <gtest/gtest.h>
        12 
        13 #include "packager/base/strings/string_number_conversions.h"
        14 #include "packager/media/base/media_handler.h"
        15 
        16 namespace shaka {
        17 namespace media {
        18 
        19 std::string BoolToString(bool value);
        20 
        21 MATCHER_P(IsStreamInfo, stream_index, "") {
        22  return arg->stream_index == stream_index &&
        23  arg->stream_data_type == StreamDataType::kStreamInfo;
        24 }
        25 
        26 MATCHER_P3(IsStreamInfo, stream_index, time_scale, encrypted, "") {
        27  if (arg->stream_data_type != StreamDataType::kStreamInfo) {
        28  *result_listener << "which is "
        29  << StreamDataTypeToString(arg->stream_data_type);
        30  return false;
        31  }
        32 
        33  *result_listener << "which is (" << arg->stream_index << ","
        34  << arg->stream_info->time_scale() << ","
        35  << BoolToString(arg->stream_info->is_encrypted()) << ")";
        36  return arg->stream_index == stream_index &&
        37  arg->stream_info->time_scale() == time_scale &&
        38  arg->stream_info->is_encrypted() == encrypted;
        39 }
        40 
        41 MATCHER_P4(IsStreamInfo, stream_index, time_scale, encrypted, language, "") {
        42  if (arg->stream_data_type != StreamDataType::kStreamInfo) {
        43  *result_listener << "which is "
        44  << StreamDataTypeToString(arg->stream_data_type);
        45  return false;
        46  }
        47 
        48  *result_listener << "which is (" << arg->stream_index << ","
        49  << arg->stream_info->time_scale() << ","
        50  << BoolToString(arg->stream_info->is_encrypted()) << ","
        51  << arg->stream_info->language() << ")";
        52  return arg->stream_index == stream_index &&
        53  arg->stream_info->time_scale() == time_scale &&
        54  arg->stream_info->is_encrypted() == encrypted &&
        55  arg->stream_info->language() == language;
        56 }
        57 
        58 MATCHER_P5(IsSegmentInfo,
        59  stream_index,
        60  start_timestamp,
        61  duration,
        62  subsegment,
        63  encrypted,
        64  "") {
        65  if (arg->stream_data_type != StreamDataType::kSegmentInfo) {
        66  *result_listener << "which is "
        67  << StreamDataTypeToString(arg->stream_data_type);
        68  return false;
        69  }
        70 
        71  *result_listener << "which is (" << arg->stream_index << ","
        72  << arg->segment_info->start_timestamp << ","
        73  << arg->segment_info->duration << ","
        74  << BoolToString(arg->segment_info->is_subsegment) << ","
        75  << BoolToString(arg->segment_info->is_encrypted) << ")";
        76  return arg->stream_index == stream_index &&
        77  arg->segment_info->start_timestamp == start_timestamp &&
        78  arg->segment_info->duration == duration &&
        79  arg->segment_info->is_subsegment == subsegment &&
        80  arg->segment_info->is_encrypted == encrypted;
        81 }
        82 
        83 MATCHER_P6(MatchEncryptionConfig,
        84  protection_scheme,
        85  crypt_byte_block,
        86  skip_byte_block,
        87  per_sample_iv_size,
        88  constant_iv,
        89  key_id,
        90  "") {
        91  *result_listener << "which is (" << FourCCToString(arg.protection_scheme)
        92  << "," << static_cast<int>(arg.crypt_byte_block) << ","
        93  << static_cast<int>(arg.skip_byte_block) << ","
        94  << static_cast<int>(arg.per_sample_iv_size) << ","
        95  << base::HexEncode(arg.constant_iv.data(),
        96  arg.constant_iv.size())
        97  << ","
        98  << base::HexEncode(arg.key_id.data(), arg.key_id.size())
        99  << ")";
        100  return arg.protection_scheme == protection_scheme &&
        101  arg.crypt_byte_block == crypt_byte_block &&
        102  arg.skip_byte_block == skip_byte_block &&
        103  arg.per_sample_iv_size == per_sample_iv_size &&
        104  arg.constant_iv == constant_iv && arg.key_id == key_id;
        105 }
        106 
        107 MATCHER_P4(IsMediaSample, stream_index, timestamp, duration, encrypted, "") {
        108  if (arg->stream_data_type != StreamDataType::kMediaSample) {
        109  *result_listener << "which is "
        110  << StreamDataTypeToString(arg->stream_data_type);
        111  return false;
        112  }
        113  *result_listener << "which is (" << arg->stream_index << ","
        114  << arg->media_sample->dts() << ","
        115  << arg->media_sample->duration() << ","
        116  << BoolToString(arg->media_sample->is_encrypted()) << ")";
        117  return arg->stream_index == stream_index &&
        118  arg->media_sample->dts() == static_cast<int64_t>(timestamp) &&
        119  arg->media_sample->duration() == static_cast<int64_t>(duration) &&
        120  arg->media_sample->is_encrypted() == encrypted;
        121 }
        122 
        123 MATCHER_P5(IsTextSample, id, start_time, end_time, settings, payload, "") {
        124  if (arg->stream_data_type != StreamDataType::kTextSample) {
        125  *result_listener << "which is "
        126  << StreamDataTypeToString(arg->stream_data_type);
        127  return false;
        128  }
        129  *result_listener << "which is (" << arg->text_sample->id() << ","
        130  << arg->text_sample->start_time() << ","
        131  << arg->text_sample->EndTime() << ","
        132  << arg->text_sample->settings() << ","
        133  << arg->text_sample->payload() << ")";
        134  return arg->text_sample->id() == id &&
        135  arg->text_sample->start_time() == start_time &&
        136  arg->text_sample->EndTime() == end_time &&
        137  arg->text_sample->settings() == settings &&
        138  arg->text_sample->payload() == payload;
        139 }
        140 
        141 MATCHER_P2(IsCueEvent, stream_index, time_in_seconds, "") {
        142  if (arg->stream_data_type != StreamDataType::kCueEvent) {
        143  *result_listener << "which is "
        144  << StreamDataTypeToString(arg->stream_data_type);
        145  return false;
        146  }
        147  *result_listener << "which is (" << arg->stream_index << ","
        148  << arg->cue_event->time_in_seconds << ")";
        149  return arg->stream_index == stream_index &&
        150  arg->cue_event->time_in_seconds == time_in_seconds;
        151 }
        152 
        154  public:
        158 
        159  private:
        160  bool ValidateOutputStreamIndex(size_t index) const override;
        161  Status InitializeInternal() override;
        162  Status Process(std::unique_ptr<StreamData> stream_data) override;
        163 };
        164 
        166  public:
        167  MOCK_METHOD1(OnProcess, void(const StreamData*));
        168  MOCK_METHOD1(OnFlush, void(size_t index));
        169 
        170  private:
        171  Status InitializeInternal() override;
        172  Status Process(std::unique_ptr<StreamData> stream_data) override;
        173  Status OnFlushRequest(size_t index) override;
        174 };
        175 
        176 // TODO(vaage) : Remove this test handler and convert other tests to use
        177 // FakeInputMediaHandler and MockOutputMediaHandler.
        179  public:
        180  const std::vector<std::unique_ptr<StreamData>>& stream_data_vector() const {
        181  return stream_data_vector_;
        182  }
        183  void clear_stream_data_vector() { stream_data_vector_.clear(); }
        184 
        185  protected:
        186  Status InitializeInternal() override;
        187  Status Process(std::unique_ptr<StreamData> stream_data) override;
        188  Status OnFlushRequest(size_t input_stream_index) override;
        189  bool ValidateOutputStreamIndex(size_t stream_index) const override;
        190 
        191  std::vector<std::unique_ptr<StreamData>> stream_data_vector_;
        192 };
        193 
        194 class MediaHandlerTestBase : public ::testing::Test {
        195  public:
        196  MediaHandlerTestBase() = default;
        197 
        198  protected:
        199  bool IsVideoCodec(Codec codec) const;
        200 
        201  std::unique_ptr<StreamInfo> GetVideoStreamInfo(uint32_t time_scale) const;
        202 
        203  std::unique_ptr<StreamInfo> GetVideoStreamInfo(uint32_t time_scale,
        204  uint32_t width,
        205  uint64_t height) const;
        206 
        207  std::unique_ptr<StreamInfo> GetVideoStreamInfo(uint32_t time_scale,
        208  Codec codec) const;
        209 
        210  std::unique_ptr<StreamInfo> GetVideoStreamInfo(uint32_t time_scale,
        211  Codec codec,
        212  uint32_t width,
        213  uint64_t height) const;
        214 
        215  std::unique_ptr<StreamInfo> GetAudioStreamInfo(uint32_t time_scale) const;
        216 
        217  std::unique_ptr<StreamInfo> GetAudioStreamInfo(uint32_t time_scale,
        218  Codec codec) const;
        219 
        220  std::shared_ptr<MediaSample> GetMediaSample(int64_t timestamp,
        221  int64_t duration,
        222  bool is_keyframe) const;
        223 
        224  std::shared_ptr<MediaSample> GetMediaSample(int64_t timestamp,
        225  int64_t duration,
        226  bool is_keyframe,
        227  const uint8_t* data,
        228  size_t data_length) const;
        229 
        230  std::unique_ptr<SegmentInfo> GetSegmentInfo(int64_t start_timestamp,
        231  int64_t duration,
        232  bool is_subsegment) const;
        233 
        234  std::unique_ptr<StreamInfo> GetTextStreamInfo() const;
        235 
        236  std::unique_ptr<TextSample> GetTextSample(const std::string& id,
        237  int64_t start,
        238  int64_t end,
        239  const std::string& payload) const;
        240 
        241  std::unique_ptr<CueEvent> GetCueEvent(double time_in_seconds) const;
        242 
        243  // Connect and initialize all handlers.
        244  Status SetUpAndInitializeGraph(std::shared_ptr<MediaHandler> handler,
        245  size_t input_count,
        246  size_t output_count);
        247 
        248  // Get the input handler at |index|. The values of |index| will match the
        249  // call to |AddInput|.
        250  FakeInputMediaHandler* Input(size_t index);
        251 
        252  // Get the output handler at |index|. The values of |index| will match the
        253  // call to |AddOutput|.
        254  MockOutputMediaHandler* Output(size_t index);
        255 
        256  private:
        258  MediaHandlerTestBase& operator=(const MediaHandlerTestBase&) = delete;
        259 
        260  std::shared_ptr<MediaHandler> handler_;
        261 
        262  std::vector<std::shared_ptr<FakeInputMediaHandler>> inputs_;
        263  std::vector<std::shared_ptr<MockOutputMediaHandler>> outputs_;
        264 };
        265 
        267  public:
        269 
        270  protected:
        272  void SetUpGraph(size_t num_inputs,
        273  size_t num_outputs,
        274  std::shared_ptr<MediaHandler> handler);
        275 
        277  const std::vector<std::unique_ptr<StreamData>>& GetOutputStreamDataVector()
        278  const;
        279 
        281  void ClearOutputStreamDataVector();
        282 
        284  std::shared_ptr<MediaHandler> some_handler() { return some_handler_; }
        285 
        287  std::shared_ptr<FakeMediaHandler> next_handler() { return next_handler_; }
        288 
        289  private:
        291  MediaHandlerGraphTestBase& operator=(const MediaHandlerTestBase&) = delete;
        292 
        293  // Downstream handler used in testing graph.
        294  std::shared_ptr<FakeMediaHandler> next_handler_;
        295  // Some random handler which can be used for testing.
        296  std::shared_ptr<MediaHandler> some_handler_;
        297 };
        298 
        299 } // namespace media
        300 } // namespace shaka
        301 
        302 #endif // PACKAGER_MEDIA_BASE_MEDIA_HANDLER_TEST_BASE_H_
        +
        Status Dispatch(std::unique_ptr< StreamData > stream_data) const
        + + + +
        virtual Status OnFlushRequest(size_t input_stream_index)
        Event handler for flush request at the specific input stream index.
        +
        std::shared_ptr< FakeMediaHandler > next_handler()
        All the methods that are virtual are virtual for mocking.
        -
        Status FlushAllDownstreams()
        Flush all connected downstream handlers.
        -
        Status FlushDownstream(size_t output_stream_index)
        Flush the downstream connected at the specified output stream index.
        - - - -
        std::shared_ptr< MediaHandler > some_handler()
        +
        Status FlushAllDownstreams()
        Flush all connected downstream handlers.
        +
        Status FlushDownstream(size_t output_stream_index)
        Flush the downstream connected at the specified output stream index.
        + + + +
        std::shared_ptr< MediaHandler > some_handler()
        diff --git a/docs/db/d5a/classshaka_1_1media_1_1VP9Parser.html b/docs/db/d5a/classshaka_1_1media_1_1VP9Parser.html index 4d1952b780..ce806c0b90 100644 --- a/docs/db/d5a/classshaka_1_1media_1_1VP9Parser.html +++ b/docs/db/d5a/classshaka_1_1media_1_1VP9Parser.html @@ -216,7 +216,7 @@ Additional Inherited Members
        diff --git a/docs/db/d60/mpd__options_8h_source.html b/docs/db/d60/mpd__options_8h_source.html index 159df063e9..506eac80e4 100644 --- a/docs/db/d60/mpd__options_8h_source.html +++ b/docs/db/d60/mpd__options_8h_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/db/d66/structshaka_1_1media_1_1mp4_1_1SegmentType-members.html b/docs/db/d66/structshaka_1_1media_1_1mp4_1_1SegmentType-members.html index 69fac13b40..c65ef09ed7 100644 --- a/docs/db/d66/structshaka_1_1media_1_1mp4_1_1SegmentType-members.html +++ b/docs/db/d66/structshaka_1_1media_1_1mp4_1_1SegmentType-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/docs/db/d66/udp__file_8cc_source.html b/docs/db/d66/udp__file_8cc_source.html index 275fa2130c..e41241e238 100644 --- a/docs/db/d66/udp__file_8cc_source.html +++ b/docs/db/d66/udp__file_8cc_source.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/db/d6b/structshaka_1_1MpdParams-members.html b/docs/db/d6b/structshaka_1_1MpdParams-members.html index 991450fbc1..e0ca2705db 100644 --- a/docs/db/d6b/structshaka_1_1MpdParams-members.html +++ b/docs/db/d6b/structshaka_1_1MpdParams-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/db/d71/http__key__fetcher_8h_source.html b/docs/db/d71/http__key__fetcher_8h_source.html index 569703b504..681b9e29dc 100644 --- a/docs/db/d71/http__key__fetcher_8h_source.html +++ b/docs/db/d71/http__key__fetcher_8h_source.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/db/d74/classshaka_1_1media_1_1HEVCDecoderConfigurationRecord-members.html b/docs/db/d74/classshaka_1_1media_1_1HEVCDecoderConfigurationRecord-members.html index abd0e22246..8257ea269b 100644 --- a/docs/db/d74/classshaka_1_1media_1_1HEVCDecoderConfigurationRecord-members.html +++ b/docs/db/d74/classshaka_1_1media_1_1HEVCDecoderConfigurationRecord-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/docs/db/d75/classshaka_1_1media_1_1webm_1_1TwoPassSingleSegmentSegmenter-members.html b/docs/db/d75/classshaka_1_1media_1_1webm_1_1TwoPassSingleSegmentSegmenter-members.html index 7d11c44d43..0387a47688 100644 --- a/docs/db/d75/classshaka_1_1media_1_1webm_1_1TwoPassSingleSegmentSegmenter-members.html +++ b/docs/db/d75/classshaka_1_1media_1_1webm_1_1TwoPassSingleSegmentSegmenter-members.html @@ -108,7 +108,7 @@ $(function() { diff --git a/docs/db/d78/classshaka_1_1media_1_1mp2t_1_1ContinuityCounter-members.html b/docs/db/d78/classshaka_1_1media_1_1mp2t_1_1ContinuityCounter-members.html index 34d0e92ba0..83a033d8ed 100644 --- a/docs/db/d78/classshaka_1_1media_1_1mp2t_1_1ContinuityCounter-members.html +++ b/docs/db/d78/classshaka_1_1media_1_1mp2t_1_1ContinuityCounter-members.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/db/d79/chunking__params_8h_source.html b/docs/db/d79/chunking__params_8h_source.html index 60cf021030..bf8337c8a9 100644 --- a/docs/db/d79/chunking__params_8h_source.html +++ b/docs/db/d79/chunking__params_8h_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/db/d7e/muxer__options_8cc_source.html b/docs/db/d7e/muxer__options_8cc_source.html index 8ee2541cfd..2ff5d2f4a5 100644 --- a/docs/db/d7e/muxer__options_8cc_source.html +++ b/docs/db/d7e/muxer__options_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/db/d84/classshaka_1_1media_1_1AACAudioSpecificConfig-members.html b/docs/db/d84/classshaka_1_1media_1_1AACAudioSpecificConfig-members.html index 76f2cbf2b9..86e9128901 100644 --- a/docs/db/d84/classshaka_1_1media_1_1AACAudioSpecificConfig-members.html +++ b/docs/db/d84/classshaka_1_1media_1_1AACAudioSpecificConfig-members.html @@ -126,7 +126,7 @@ $(function() { diff --git a/docs/db/d86/classshaka_1_1media_1_1NaluReader.html b/docs/db/d86/classshaka_1_1media_1_1NaluReader.html index 4ff015fb58..c4098d900c 100644 --- a/docs/db/d86/classshaka_1_1media_1_1NaluReader.html +++ b/docs/db/d86/classshaka_1_1media_1_1NaluReader.html @@ -333,7 +333,7 @@ static bool FindStartCode< diff --git a/docs/db/d8f/mp4__muxer_8h_source.html b/docs/db/d8f/mp4__muxer_8h_source.html index 36be7baea3..d2fc1de883 100644 --- a/docs/db/d8f/mp4__muxer_8h_source.html +++ b/docs/db/d8f/mp4__muxer_8h_source.html @@ -67,11 +67,11 @@ $(function() {
        1 // Copyright 2014 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_FORMATS_MP4_MP4_MUXER_H_
        8 #define PACKAGER_MEDIA_FORMATS_MP4_MP4_MUXER_H_
        9 
        10 #include <vector>
        11 
        12 #include "packager/base/optional.h"
        13 #include "packager/media/base/muxer.h"
        14 
        15 namespace shaka {
        16 namespace media {
        17 
        18 class AudioStreamInfo;
        19 class StreamInfo;
        20 class TextStreamInfo;
        21 class VideoStreamInfo;
        22 
        23 namespace mp4 {
        24 
        25 class Segmenter;
        26 
        27 struct ProtectionSchemeInfo;
        28 struct Track;
        29 
        32 class MP4Muxer : public Muxer {
        33  public:
        35  explicit MP4Muxer(const MuxerOptions& options);
        36  ~MP4Muxer() override;
        37 
        38  private:
        39  // Muxer implementation overrides.
        40  Status InitializeMuxer() override;
        41  Status Finalize() override;
        42  Status AddSample(size_t stream_id, const MediaSample& sample) override;
        43  Status FinalizeSegment(size_t stream_id,
        44  const SegmentInfo& segment_info) override;
        45 
        46  // Generate Audio/Video Track box.
        47  void InitializeTrak(const StreamInfo* info, Track* trak);
        48  bool GenerateAudioTrak(const AudioStreamInfo* audio_info,
        49  Track* trak,
        50  uint32_t track_id);
        51  bool GenerateVideoTrak(const VideoStreamInfo* video_info,
        52  Track* trak,
        53  uint32_t track_id);
        54  bool GenerateTextTrak(const TextStreamInfo* video_info,
        55  Track* trak,
        56  uint32_t track_id);
        57 
        58  // Gets |start| and |end| initialization range. Returns true if there is an
        59  // init range and sets start-end byte-range-spec specified in RFC2616.
        60  base::Optional<Range> GetInitRangeStartAndEnd();
        61 
        62  // Gets |start| and |end| index range. Returns true if there is an index range
        63  // and sets start-end byte-range-spec specified in RFC2616.
        64  base::Optional<Range> GetIndexRangeStartAndEnd();
        65 
        66  // Fire events if there are no errors and Muxer::muxer_listener() is not NULL.
        67  void FireOnMediaStartEvent();
        68  void FireOnMediaEndEvent();
        69 
        70  // Get time in seconds since midnight, Jan. 1, 1904, in UTC Time.
        71  uint64_t IsoTimeNow();
        72 
        73  std::unique_ptr<Segmenter> segmenter_;
        74 
        75  DISALLOW_COPY_AND_ASSIGN(MP4Muxer);
        76 };
        77 
        78 } // namespace mp4
        79 } // namespace media
        80 } // namespace shaka
        81 
        82 #endif // PACKAGER_MEDIA_FORMATS_MP4_MP4_MUXER_H_
        Abstract class holds stream information.
        Definition: stream_info.h:59
        - +
        MP4Muxer(const MuxerOptions &options)
        Create a MP4Muxer object from MuxerOptions.
        Definition: mp4_muxer.cc:137
        All the methods that are virtual are virtual for mocking.
        This structure contains the list of configuration options for Muxer.
        Definition: muxer_options.h:20
        - +
        Class to hold a media sample.
        Definition: media_sample.h:22
        @@ -82,7 +82,7 @@ $(function() {
        diff --git a/docs/db/d94/classshaka_1_1media_1_1ClusterBuilder.html b/docs/db/d94/classshaka_1_1media_1_1ClusterBuilder.html index 63c0daae27..dac7707715 100644 --- a/docs/db/d94/classshaka_1_1media_1_1ClusterBuilder.html +++ b/docs/db/d94/classshaka_1_1media_1_1ClusterBuilder.html @@ -101,7 +101,7 @@ std::unique_ptr< diff --git a/docs/db/d95/classshaka_1_1media_1_1mp4_1_1Fragmenter.html b/docs/db/d95/classshaka_1_1media_1_1mp4_1_1Fragmenter.html index 8b820fdc4a..d7bbb79967 100644 --- a/docs/db/d95/classshaka_1_1media_1_1mp4_1_1Fragmenter.html +++ b/docs/db/d95/classshaka_1_1media_1_1mp4_1_1Fragmenter.html @@ -115,6 +115,8 @@ const std::vector<   void set_use_decoding_timestamp_in_timeline (bool use_decoding_timestamp_in_timeline)   +void set_allow_adjust_earliest_presentation_time (bool allow_adjust_earliest_presentation_time) +  @@ -259,7 +261,36 @@ template<typename T >

        Optimize sample entries table. If all values in entries are identical, then entries is cleared and the value is assigned to default_value; otherwise it is a NOP. Return true if the table is optimized.

        -

        Definition at line 111 of file fragmenter.h.

        +

        Definition at line 121 of file fragmenter.h.

        + +
        + + +

        ◆ set_allow_adjust_earliest_presentation_time()

        + +
        +
        +

        Protected Member Functions

        + + + + +
        + + + + + + + + +
        void shaka::media::mp4::Fragmenter::set_allow_adjust_earliest_presentation_time (bool allow_adjust_earliest_presentation_time)
        +
        +inline
        +
        +

        Set the flag allow_use_adjust_earliest_presentation_time, which if set to true, earlist_presentation_time (EPT) may be adjusted not to be smaller than the decoding timestamp (dts) for the first fragment.

        + +

        Definition at line 82 of file fragmenter.h.

        @@ -299,7 +330,7 @@ template<typename T > diff --git a/docs/db/d95/structshaka_1_1media_1_1mp4_1_1ChunkLargeOffset.html b/docs/db/d95/structshaka_1_1media_1_1mp4_1_1ChunkLargeOffset.html index 2e7206d5b4..45caa68741 100644 --- a/docs/db/d95/structshaka_1_1media_1_1mp4_1_1ChunkLargeOffset.html +++ b/docs/db/d95/structshaka_1_1media_1_1mp4_1_1ChunkLargeOffset.html @@ -108,10 +108,10 @@ std::vector< uint64_t >   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

        @@ -122,7 +122,7 @@ Additional Inherited Members

        Detailed Description

        -

        Definition at line 459 of file box_definitions.h.

        +

        Definition at line 470 of file box_definitions.h.

        Member Function Documentation

        ◆ BoxType()

        @@ -152,7 +152,7 @@ Additional Inherited Members

        Reimplemented in shaka::media::mp4::ChunkOffset.

        -

        Definition at line 874 of file box_definitions.cc.

        +

        Definition at line 895 of file box_definitions.cc.

        @@ -163,7 +163,7 @@ Additional Inherited Members diff --git a/docs/db/d96/wvm__media__parser_8h_source.html b/docs/db/d96/wvm__media__parser_8h_source.html index f1364d9275..183254585c 100644 --- a/docs/db/d96/wvm__media__parser_8h_source.html +++ b/docs/db/d96/wvm__media__parser_8h_source.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/db/da6/memory__file_8h_source.html b/docs/db/da6/memory__file_8h_source.html index 7a10c2fe3a..f089a87d0b 100644 --- a/docs/db/da6/memory__file_8h_source.html +++ b/docs/db/da6/memory__file_8h_source.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/db/dab/classshaka_1_1media_1_1TextStreamInfo.html b/docs/db/dab/classshaka_1_1media_1_1TextStreamInfo.html index 9252a57cec..46d878d827 100644 --- a/docs/db/dab/classshaka_1_1media_1_1TextStreamInfo.html +++ b/docs/db/dab/classshaka_1_1media_1_1TextStreamInfo.html @@ -315,7 +315,7 @@ void set_encryption_config diff --git a/docs/db/dab/cue__alignment__handler_8cc_source.html b/docs/db/dab/cue__alignment__handler_8cc_source.html index 9fc33a0c62..b40b9c2478 100644 --- a/docs/db/dab/cue__alignment__handler_8cc_source.html +++ b/docs/db/dab/cue__alignment__handler_8cc_source.html @@ -66,14 +66,14 @@ $(function() {
        cue_alignment_handler.cc
        -
        1 // Copyright 2018 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #include "packager/media/chunking/cue_alignment_handler.h"
        8 
        9 #include "packager/status_macros.h"
        10 
        11 namespace shaka {
        12 namespace media {
        13 namespace {
        14 // The max number of samples that are allowed to be buffered before we shutdown
        15 // because there is likely a problem with the content or how the pipeline was
        16 // configured. This is about 20 seconds of buffer for audio with 48kHz.
        17 const size_t kMaxBufferSize = 1000;
        18 
        19 double TimeInSeconds(const StreamInfo& info, const StreamData& data) {
        20  int64_t time_scale;
        21  int64_t scaled_time;
        22  switch (data.stream_data_type) {
        23  case StreamDataType::kMediaSample:
        24  time_scale = info.time_scale();
        25  if (info.stream_type() == kStreamAudio) {
        26  // Return the start time for video and mid-point for audio, so that for
        27  // an audio sample, if the portion of the sample after the cue point is
        28  // bigger than the portion of the sample before the cue point, the
        29  // sample is placed after the cue.
        30  // It does not matter for text samples as text samples will be cut at
        31  // cue point.
        32  scaled_time =
        33  data.media_sample->pts() + data.media_sample->duration() / 2;
        34  } else {
        35  scaled_time = data.media_sample->pts();
        36  }
        37  break;
        38  case StreamDataType::kTextSample:
        39  // Text is always in MS but the stream info time scale is 0.
        40  time_scale = 1000;
        41  scaled_time = data.text_sample->start_time();
        42  break;
        43  default:
        44  time_scale = 0;
        45  scaled_time = 0;
        46  NOTREACHED() << "TimeInSeconds should only be called on media samples "
        47  "and text samples.";
        48  break;
        49  }
        50 
        51  return static_cast<double>(scaled_time) / time_scale;
        52 }
        53 
        54 Status GetNextCue(double hint,
        55  SyncPointQueue* sync_points,
        56  std::shared_ptr<const CueEvent>* out_cue) {
        57  DCHECK(sync_points);
        58  DCHECK(out_cue);
        59 
        60  *out_cue = sync_points->GetNext(hint);
        61 
        62  // |*out_cue| will only be null if the job was cancelled.
        63  return *out_cue ? Status::OK
        64  : Status(error::CANCELLED, "SyncPointQueue is cancelled.");
        65 }
        66 } // namespace
        67 
        68 CueAlignmentHandler::CueAlignmentHandler(SyncPointQueue* sync_points)
        69  : sync_points_(sync_points) {}
        70 
        71 Status CueAlignmentHandler::InitializeInternal() {
        72  sync_points_->AddThread();
        73  stream_states_.resize(num_input_streams());
        74 
        75  // Get the first hint for the stream. Use a negative hint so that if there is
        76  // suppose to be a sync point at zero, we will still respect it.
        77  hint_ = sync_points_->GetHint(-1);
        78 
        79  return Status::OK;
        80 }
        81 
        82 Status CueAlignmentHandler::Process(std::unique_ptr<StreamData> data) {
        83  switch (data->stream_data_type) {
        84  case StreamDataType::kStreamInfo:
        85  return OnStreamInfo(std::move(data));
        86  case StreamDataType::kTextSample:
        87  case StreamDataType::kMediaSample:
        88  return OnSample(std::move(data));
        89  default:
        90  VLOG(3) << "Dropping unsupported data type "
        91  << static_cast<int>(data->stream_data_type);
        92  return Status::OK;
        93  }
        94 }
        95 
        96 Status CueAlignmentHandler::OnFlushRequest(size_t stream_index) {
        97  stream_states_[stream_index].to_be_flushed = true;
        98 
        99  // We need to wait for all stream to flush before we can flush each stream.
        100  // This allows cached buffers to be cleared and cues to be properly
        101  // synchronized and set on all streams.
        102  for (const StreamState& stream_state : stream_states_) {
        103  if (!stream_state.to_be_flushed) {
        104  return Status::OK;
        105  }
        106  }
        107 
        108  // Do a once over all the streams to ensure that their states are as we expect
        109  // them. Video and non-video streams have different allowances here. Video
        110  // should absolutely have no cues or samples where as non-video streams may
        111  // have cues or samples.
        112  for (StreamState& stream : stream_states_) {
        113  DCHECK(stream.to_be_flushed);
        114 
        115  if (stream.info->stream_type() == kStreamVideo) {
        116  DCHECK_EQ(stream.samples.size(), 0u)
        117  << "Video streams should not store samples";
        118  DCHECK_EQ(stream.cues.size(), 0u)
        119  << "Video streams should not store cues";
        120  }
        121  }
        122 
        123  // It is possible that we did not get all the cues. |hint_| will get updated
        124  // when we call |UseNextSyncPoint|.
        125  while (sync_points_->HasMore(hint_)) {
        126  std::shared_ptr<const CueEvent> next_cue;
        127  RETURN_IF_ERROR(GetNextCue(hint_, sync_points_, &next_cue));
        128  RETURN_IF_ERROR(UseNewSyncPoint(std::move(next_cue)));
        129  }
        130 
        131  // Now that there are new cues, it may be possible to dispatch some of the
        132  // samples that may be left waiting.
        133  for (StreamState& stream : stream_states_) {
        134  RETURN_IF_ERROR(RunThroughSamples(&stream));
        135  DCHECK_EQ(stream.samples.size(), 0u);
        136 
        137  // It is possible for there to be cues that come after all the samples. Make
        138  // sure to send them out too.
        139  while (stream.cues.size()) {
        140  RETURN_IF_ERROR(Dispatch(std::move(stream.cues.front())));
        141  stream.cues.pop_front();
        142  }
        143  }
        144 
        145  return FlushAllDownstreams();
        146 }
        147 
        148 Status CueAlignmentHandler::OnStreamInfo(std::unique_ptr<StreamData> data) {
        149  StreamState& stream_state = stream_states_[data->stream_index];
        150  // Keep a copy of the stream info so that we can check type and check
        151  // timescale.
        152  stream_state.info = data->stream_info;
        153 
        154  return Dispatch(std::move(data));
        155 }
        156 
        157 Status CueAlignmentHandler::OnVideoSample(std::unique_ptr<StreamData> sample) {
        158  DCHECK(sample);
        159  DCHECK(sample->media_sample);
        160 
        161  const size_t stream_index = sample->stream_index;
        162  StreamState& stream = stream_states_[stream_index];
        163 
        164  const double sample_time = TimeInSeconds(*stream.info, *sample);
        165  const bool is_key_frame = sample->media_sample->is_key_frame();
        166 
        167  if (is_key_frame && sample_time >= hint_) {
        168  auto next_sync = sync_points_->PromoteAt(sample_time);
        169 
        170  if (!next_sync) {
        171  LOG(ERROR) << "Failed to promote sync point at " << sample_time
        172  << ". This happens only if video streams are not GOP-aligned.";
        173  return Status(error::INVALID_ARGUMENT,
        174  "Streams are not properly GOP-aligned.");
        175  }
        176 
        177  RETURN_IF_ERROR(UseNewSyncPoint(std::move(next_sync)));
        178  DCHECK_EQ(stream.cues.size(), 1u);
        179  RETURN_IF_ERROR(Dispatch(std::move(stream.cues.front())));
        180  stream.cues.pop_front();
        181  }
        182 
        183  return Dispatch(std::move(sample));
        184 }
        185 
        186 Status CueAlignmentHandler::OnNonVideoSample(
        187  std::unique_ptr<StreamData> sample) {
        188  DCHECK(sample);
        189  DCHECK(sample->media_sample || sample->text_sample);
        190 
        191  const size_t stream_index = sample->stream_index;
        192  StreamState& stream_state = stream_states_[stream_index];
        193 
        194  // Accept the sample. This will output it if it comes before the hint point or
        195  // will cache it if it comes after the hint point.
        196  RETURN_IF_ERROR(AcceptSample(std::move(sample), &stream_state));
        197 
        198  // If all the streams are waiting on a hint, it means that none has next sync
        199  // point determined. It also means that there are no video streams and we need
        200  // to wait for all streams to converge on a hint so that we can get the next
        201  // sync point.
        202  if (EveryoneWaitingAtHint()) {
        203  std::shared_ptr<const CueEvent> next_sync;
        204  RETURN_IF_ERROR(GetNextCue(hint_, sync_points_, &next_sync));
        205  RETURN_IF_ERROR(UseNewSyncPoint(next_sync));
        206  }
        207 
        208  return Status::OK;
        209 }
        210 
        211 Status CueAlignmentHandler::OnSample(std::unique_ptr<StreamData> sample) {
        212  // There are two modes:
        213  // 1. There is a video input.
        214  // 2. There are no video inputs.
        215  //
        216  // When there is a video input, we rely on the video input get the next sync
        217  // point and release all the samples.
        218  //
        219  // When there are no video inputs, we rely on the sync point queue to block
        220  // us until there is a sync point.
        221 
        222  const size_t stream_index = sample->stream_index;
        223  const StreamType stream_type =
        224  stream_states_[stream_index].info->stream_type();
        225 
        226  const bool is_video = stream_type == kStreamVideo;
        227 
        228  return is_video ? OnVideoSample(std::move(sample))
        229  : OnNonVideoSample(std::move(sample));
        230 }
        231 
        232 Status CueAlignmentHandler::UseNewSyncPoint(
        233  std::shared_ptr<const CueEvent> new_sync) {
        234  hint_ = sync_points_->GetHint(new_sync->time_in_seconds);
        235  DCHECK_GT(hint_, new_sync->time_in_seconds);
        236 
        237  for (size_t stream_index = 0; stream_index < stream_states_.size();
        238  stream_index++) {
        239  StreamState& stream = stream_states_[stream_index];
        240  stream.cues.push_back(StreamData::FromCueEvent(stream_index, new_sync));
        241 
        242  RETURN_IF_ERROR(RunThroughSamples(&stream));
        243  }
        244 
        245  return Status::OK;
        246 }
        247 
        248 bool CueAlignmentHandler::EveryoneWaitingAtHint() const {
        249  for (const StreamState& stream_state : stream_states_) {
        250  if (stream_state.samples.empty()) {
        251  return false;
        252  }
        253  }
        254  return true;
        255 }
        256 
        257 Status CueAlignmentHandler::AcceptSample(std::unique_ptr<StreamData> sample,
        258  StreamState* stream) {
        259  DCHECK(sample);
        260  DCHECK(sample->media_sample || sample->text_sample);
        261  DCHECK(stream);
        262 
        263  // Need to cache the stream index as we will lose the pointer when we add
        264  // the sample to the queue.
        265  const size_t stream_index = sample->stream_index;
        266 
        267  stream->samples.push_back(std::move(sample));
        268 
        269  if (stream->samples.size() > kMaxBufferSize) {
        270  LOG(ERROR) << "Stream " << stream_index << " has buffered "
        271  << stream->samples.size() << " when the max is "
        272  << kMaxBufferSize;
        273  return Status(error::INVALID_ARGUMENT,
        274  "Streams are not properly multiplexed.");
        275  }
        276 
        277  return RunThroughSamples(stream);
        278 }
        279 
        280 Status CueAlignmentHandler::RunThroughSamples(StreamState* stream) {
        281  // Step through all our samples until we find where we can insert the cue.
        282  // Think of this as a merge sort.
        283  while (stream->cues.size() && stream->samples.size()) {
        284  const double cue_time = stream->cues.front()->cue_event->time_in_seconds;
        285  const double sample_time =
        286  TimeInSeconds(*stream->info, *stream->samples.front());
        287 
        288  if (sample_time < cue_time) {
        289  RETURN_IF_ERROR(Dispatch(std::move(stream->samples.front())));
        290  stream->samples.pop_front();
        291  } else {
        292  RETURN_IF_ERROR(Dispatch(std::move(stream->cues.front())));
        293  stream->cues.pop_front();
        294  }
        295  }
        296 
        297  // If we still have samples, then it means that we sent out the cue and can
        298  // now work up to the hint. So now send all samples that come before the hint
        299  // downstream.
        300  while (stream->samples.size() &&
        301  TimeInSeconds(*stream->info, *stream->samples.front()) < hint_) {
        302  RETURN_IF_ERROR(Dispatch(std::move(stream->samples.front())));
        303  stream->samples.pop_front();
        304  }
        305 
        306  return Status::OK;
        307 }
        308 } // namespace media
        309 } // namespace shaka
        Status Dispatch(std::unique_ptr< StreamData > stream_data) const
        +
        1 // Copyright 2018 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #include "packager/media/chunking/cue_alignment_handler.h"
        8 
        9 #include "packager/status_macros.h"
        10 
        11 namespace shaka {
        12 namespace media {
        13 namespace {
        14 // The max number of samples that are allowed to be buffered before we shutdown
        15 // because there is likely a problem with the content or how the pipeline was
        16 // configured. This is about 20 seconds of buffer for audio with 48kHz.
        17 const size_t kMaxBufferSize = 1000;
        18 
        19 double TimeInSeconds(const StreamInfo& info, const StreamData& data) {
        20  int64_t time_scale;
        21  int64_t scaled_time;
        22  switch (data.stream_data_type) {
        23  case StreamDataType::kMediaSample:
        24  time_scale = info.time_scale();
        25  if (info.stream_type() == kStreamAudio) {
        26  // Return the start time for video and mid-point for audio, so that for
        27  // an audio sample, if the portion of the sample after the cue point is
        28  // bigger than the portion of the sample before the cue point, the
        29  // sample is placed after the cue.
        30  // It does not matter for text samples as text samples will be cut at
        31  // cue point.
        32  scaled_time =
        33  data.media_sample->pts() + data.media_sample->duration() / 2;
        34  } else {
        35  scaled_time = data.media_sample->pts();
        36  }
        37  break;
        38  case StreamDataType::kTextSample:
        39  // Text is always in MS but the stream info time scale is 0.
        40  time_scale = 1000;
        41  scaled_time = data.text_sample->start_time();
        42  break;
        43  default:
        44  time_scale = 0;
        45  scaled_time = 0;
        46  NOTREACHED() << "TimeInSeconds should only be called on media samples "
        47  "and text samples.";
        48  break;
        49  }
        50 
        51  return static_cast<double>(scaled_time) / time_scale;
        52 }
        53 
        54 Status GetNextCue(double hint,
        55  SyncPointQueue* sync_points,
        56  std::shared_ptr<const CueEvent>* out_cue) {
        57  DCHECK(sync_points);
        58  DCHECK(out_cue);
        59 
        60  *out_cue = sync_points->GetNext(hint);
        61 
        62  // |*out_cue| will only be null if the job was cancelled.
        63  return *out_cue ? Status::OK
        64  : Status(error::CANCELLED, "SyncPointQueue is cancelled.");
        65 }
        66 } // namespace
        67 
        68 CueAlignmentHandler::CueAlignmentHandler(SyncPointQueue* sync_points)
        69  : sync_points_(sync_points) {}
        70 
        71 Status CueAlignmentHandler::InitializeInternal() {
        72  sync_points_->AddThread();
        73  stream_states_.resize(num_input_streams());
        74 
        75  // Get the first hint for the stream. Use a negative hint so that if there is
        76  // suppose to be a sync point at zero, we will still respect it.
        77  hint_ = sync_points_->GetHint(-1);
        78 
        79  return Status::OK;
        80 }
        81 
        82 Status CueAlignmentHandler::Process(std::unique_ptr<StreamData> data) {
        83  switch (data->stream_data_type) {
        84  case StreamDataType::kStreamInfo:
        85  return OnStreamInfo(std::move(data));
        86  case StreamDataType::kTextSample:
        87  case StreamDataType::kMediaSample:
        88  return OnSample(std::move(data));
        89  default:
        90  VLOG(3) << "Dropping unsupported data type "
        91  << static_cast<int>(data->stream_data_type);
        92  return Status::OK;
        93  }
        94 }
        95 
        96 Status CueAlignmentHandler::OnFlushRequest(size_t stream_index) {
        97  stream_states_[stream_index].to_be_flushed = true;
        98 
        99  // We need to wait for all stream to flush before we can flush each stream.
        100  // This allows cached buffers to be cleared and cues to be properly
        101  // synchronized and set on all streams.
        102  for (const StreamState& stream_state : stream_states_) {
        103  if (!stream_state.to_be_flushed) {
        104  return Status::OK;
        105  }
        106  }
        107 
        108  // Do a once over all the streams to ensure that their states are as we expect
        109  // them. Video and non-video streams have different allowances here. Video
        110  // should absolutely have no cues or samples where as non-video streams may
        111  // have cues or samples.
        112  for (StreamState& stream : stream_states_) {
        113  DCHECK(stream.to_be_flushed);
        114 
        115  if (stream.info->stream_type() == kStreamVideo) {
        116  DCHECK_EQ(stream.samples.size(), 0u)
        117  << "Video streams should not store samples";
        118  DCHECK_EQ(stream.cues.size(), 0u)
        119  << "Video streams should not store cues";
        120  }
        121  }
        122 
        123  // It is possible that we did not get all the cues. |hint_| will get updated
        124  // when we call |UseNextSyncPoint|.
        125  while (sync_points_->HasMore(hint_)) {
        126  std::shared_ptr<const CueEvent> next_cue;
        127  RETURN_IF_ERROR(GetNextCue(hint_, sync_points_, &next_cue));
        128  RETURN_IF_ERROR(UseNewSyncPoint(std::move(next_cue)));
        129  }
        130 
        131  // Now that there are new cues, it may be possible to dispatch some of the
        132  // samples that may be left waiting.
        133  for (StreamState& stream : stream_states_) {
        134  RETURN_IF_ERROR(RunThroughSamples(&stream));
        135  DCHECK_EQ(stream.samples.size(), 0u);
        136 
        137  // It is possible for there to be cues that come after all the samples. Make
        138  // sure to send them out too.
        139  while (stream.cues.size()) {
        140  RETURN_IF_ERROR(Dispatch(std::move(stream.cues.front())));
        141  stream.cues.pop_front();
        142  }
        143  }
        144 
        145  return FlushAllDownstreams();
        146 }
        147 
        148 Status CueAlignmentHandler::OnStreamInfo(std::unique_ptr<StreamData> data) {
        149  StreamState& stream_state = stream_states_[data->stream_index];
        150  // Keep a copy of the stream info so that we can check type and check
        151  // timescale.
        152  stream_state.info = data->stream_info;
        153 
        154  return Dispatch(std::move(data));
        155 }
        156 
        157 Status CueAlignmentHandler::OnVideoSample(std::unique_ptr<StreamData> sample) {
        158  DCHECK(sample);
        159  DCHECK(sample->media_sample);
        160 
        161  const size_t stream_index = sample->stream_index;
        162  StreamState& stream = stream_states_[stream_index];
        163 
        164  const double sample_time = TimeInSeconds(*stream.info, *sample);
        165  const bool is_key_frame = sample->media_sample->is_key_frame();
        166 
        167  if (is_key_frame && sample_time >= hint_) {
        168  auto next_sync = sync_points_->PromoteAt(sample_time);
        169 
        170  if (!next_sync) {
        171  LOG(ERROR) << "Failed to promote sync point at " << sample_time
        172  << ". This happens only if video streams are not GOP-aligned.";
        173  return Status(error::INVALID_ARGUMENT,
        174  "Streams are not properly GOP-aligned.");
        175  }
        176 
        177  RETURN_IF_ERROR(UseNewSyncPoint(std::move(next_sync)));
        178  DCHECK_EQ(stream.cues.size(), 1u);
        179  RETURN_IF_ERROR(Dispatch(std::move(stream.cues.front())));
        180  stream.cues.pop_front();
        181  }
        182 
        183  return Dispatch(std::move(sample));
        184 }
        185 
        186 Status CueAlignmentHandler::OnNonVideoSample(
        187  std::unique_ptr<StreamData> sample) {
        188  DCHECK(sample);
        189  DCHECK(sample->media_sample || sample->text_sample);
        190 
        191  const size_t stream_index = sample->stream_index;
        192  StreamState& stream_state = stream_states_[stream_index];
        193 
        194  // Accept the sample. This will output it if it comes before the hint point or
        195  // will cache it if it comes after the hint point.
        196  RETURN_IF_ERROR(AcceptSample(std::move(sample), &stream_state));
        197 
        198  // If all the streams are waiting on a hint, it means that none has next sync
        199  // point determined. It also means that there are no video streams and we need
        200  // to wait for all streams to converge on a hint so that we can get the next
        201  // sync point.
        202  if (EveryoneWaitingAtHint()) {
        203  std::shared_ptr<const CueEvent> next_sync;
        204  RETURN_IF_ERROR(GetNextCue(hint_, sync_points_, &next_sync));
        205  RETURN_IF_ERROR(UseNewSyncPoint(next_sync));
        206  }
        207 
        208  return Status::OK;
        209 }
        210 
        211 Status CueAlignmentHandler::OnSample(std::unique_ptr<StreamData> sample) {
        212  // There are two modes:
        213  // 1. There is a video input.
        214  // 2. There are no video inputs.
        215  //
        216  // When there is a video input, we rely on the video input get the next sync
        217  // point and release all the samples.
        218  //
        219  // When there are no video inputs, we rely on the sync point queue to block
        220  // us until there is a sync point.
        221 
        222  const size_t stream_index = sample->stream_index;
        223  const StreamType stream_type =
        224  stream_states_[stream_index].info->stream_type();
        225 
        226  const bool is_video = stream_type == kStreamVideo;
        227 
        228  return is_video ? OnVideoSample(std::move(sample))
        229  : OnNonVideoSample(std::move(sample));
        230 }
        231 
        232 Status CueAlignmentHandler::UseNewSyncPoint(
        233  std::shared_ptr<const CueEvent> new_sync) {
        234  hint_ = sync_points_->GetHint(new_sync->time_in_seconds);
        235  DCHECK_GT(hint_, new_sync->time_in_seconds);
        236 
        237  for (size_t stream_index = 0; stream_index < stream_states_.size();
        238  stream_index++) {
        239  StreamState& stream = stream_states_[stream_index];
        240  stream.cues.push_back(StreamData::FromCueEvent(stream_index, new_sync));
        241 
        242  RETURN_IF_ERROR(RunThroughSamples(&stream));
        243  }
        244 
        245  return Status::OK;
        246 }
        247 
        248 bool CueAlignmentHandler::EveryoneWaitingAtHint() const {
        249  for (const StreamState& stream_state : stream_states_) {
        250  if (stream_state.samples.empty()) {
        251  return false;
        252  }
        253  }
        254  return true;
        255 }
        256 
        257 Status CueAlignmentHandler::AcceptSample(std::unique_ptr<StreamData> sample,
        258  StreamState* stream) {
        259  DCHECK(sample);
        260  DCHECK(sample->media_sample || sample->text_sample);
        261  DCHECK(stream);
        262 
        263  // Need to cache the stream index as we will lose the pointer when we add
        264  // the sample to the queue.
        265  const size_t stream_index = sample->stream_index;
        266 
        267  stream->samples.push_back(std::move(sample));
        268 
        269  if (stream->samples.size() > kMaxBufferSize) {
        270  LOG(ERROR) << "Stream " << stream_index << " has buffered "
        271  << stream->samples.size() << " when the max is "
        272  << kMaxBufferSize;
        273  return Status(error::INVALID_ARGUMENT,
        274  "Streams are not properly multiplexed.");
        275  }
        276 
        277  return RunThroughSamples(stream);
        278 }
        279 
        280 Status CueAlignmentHandler::RunThroughSamples(StreamState* stream) {
        281  // Step through all our samples until we find where we can insert the cue.
        282  // Think of this as a merge sort.
        283  while (stream->cues.size() && stream->samples.size()) {
        284  const double cue_time = stream->cues.front()->cue_event->time_in_seconds;
        285  const double sample_time =
        286  TimeInSeconds(*stream->info, *stream->samples.front());
        287 
        288  if (sample_time < cue_time) {
        289  RETURN_IF_ERROR(Dispatch(std::move(stream->samples.front())));
        290  stream->samples.pop_front();
        291  } else {
        292  RETURN_IF_ERROR(Dispatch(std::move(stream->cues.front())));
        293  stream->cues.pop_front();
        294  }
        295  }
        296 
        297  // If we still have samples, then it means that we sent out the cue and can
        298  // now work up to the hint. So now send all samples that come before the hint
        299  // downstream.
        300  while (stream->samples.size() &&
        301  TimeInSeconds(*stream->info, *stream->samples.front()) < hint_) {
        302  RETURN_IF_ERROR(Dispatch(std::move(stream->samples.front())));
        303  stream->samples.pop_front();
        304  }
        305 
        306  return Status::OK;
        307 }
        308 } // namespace media
        309 } // namespace shaka
        Status Dispatch(std::unique_ptr< StreamData > stream_data) const
        STL namespace.
        All the methods that are virtual are virtual for mocking.
        -
        Status FlushAllDownstreams()
        Flush all connected downstream handlers.
        +
        Status FlushAllDownstreams()
        Flush all connected downstream handlers.
        diff --git a/docs/db/dae/classshaka_1_1media_1_1WebMInfoParser.html b/docs/db/dae/classshaka_1_1media_1_1WebMInfoParser.html index 957e1068bb..3c95a8ea5a 100644 --- a/docs/db/dae/classshaka_1_1media_1_1WebMInfoParser.html +++ b/docs/db/dae/classshaka_1_1media_1_1WebMInfoParser.html @@ -152,7 +152,7 @@ The number of bytes parsed on success.
        diff --git a/docs/db/dae/structshaka_1_1media_1_1mp4_1_1SoundMediaHeader-members.html b/docs/db/dae/structshaka_1_1media_1_1mp4_1_1SoundMediaHeader-members.html index df9922bfdc..36b3148042 100644 --- a/docs/db/dae/structshaka_1_1media_1_1mp4_1_1SoundMediaHeader-members.html +++ b/docs/db/dae/structshaka_1_1media_1_1mp4_1_1SoundMediaHeader-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/db/db1/structshaka_1_1media_1_1mp4_1_1CencSampleEncryptionInfoEntry-members.html b/docs/db/db1/structshaka_1_1media_1_1mp4_1_1CencSampleEncryptionInfoEntry-members.html index 2c9b0c8b50..60da07f8a3 100644 --- a/docs/db/db1/structshaka_1_1media_1_1mp4_1_1CencSampleEncryptionInfoEntry-members.html +++ b/docs/db/db1/structshaka_1_1media_1_1mp4_1_1CencSampleEncryptionInfoEntry-members.html @@ -69,20 +69,18 @@ $(function() {

        This is the complete list of members for shaka::media::mp4::CencSampleEncryptionInfoEntry, including all inherited members.

        - - - - - - - - - - + + + + + + + +
        CencSampleEncryptionInfoEntry() (defined in shaka::media::mp4::CencSampleEncryptionInfoEntry)shaka::media::mp4::CencSampleEncryptionInfoEntry
        ComputeSize() const (defined in shaka::media::mp4::CencSampleEncryptionInfoEntry)shaka::media::mp4::CencSampleEncryptionInfoEntry
        constant_iv (defined in shaka::media::mp4::CencSampleEncryptionInfoEntry)shaka::media::mp4::CencSampleEncryptionInfoEntry
        crypt_byte_block (defined in shaka::media::mp4::CencSampleEncryptionInfoEntry)shaka::media::mp4::CencSampleEncryptionInfoEntry
        is_protected (defined in shaka::media::mp4::CencSampleEncryptionInfoEntry)shaka::media::mp4::CencSampleEncryptionInfoEntry
        key_id (defined in shaka::media::mp4::CencSampleEncryptionInfoEntry)shaka::media::mp4::CencSampleEncryptionInfoEntry
        per_sample_iv_size (defined in shaka::media::mp4::CencSampleEncryptionInfoEntry)shaka::media::mp4::CencSampleEncryptionInfoEntry
        ReadWrite(BoxBuffer *buffer) (defined in shaka::media::mp4::CencSampleEncryptionInfoEntry)shaka::media::mp4::CencSampleEncryptionInfoEntry
        skip_byte_block (defined in shaka::media::mp4::CencSampleEncryptionInfoEntry)shaka::media::mp4::CencSampleEncryptionInfoEntry
        ~CencSampleEncryptionInfoEntry() (defined in shaka::media::mp4::CencSampleEncryptionInfoEntry)shaka::media::mp4::CencSampleEncryptionInfoEntry
        ComputeSize() const (defined in shaka::media::mp4::CencSampleEncryptionInfoEntry)shaka::media::mp4::CencSampleEncryptionInfoEntry
        constant_iv (defined in shaka::media::mp4::CencSampleEncryptionInfoEntry)shaka::media::mp4::CencSampleEncryptionInfoEntry
        crypt_byte_block (defined in shaka::media::mp4::CencSampleEncryptionInfoEntry)shaka::media::mp4::CencSampleEncryptionInfoEntry
        is_protected (defined in shaka::media::mp4::CencSampleEncryptionInfoEntry)shaka::media::mp4::CencSampleEncryptionInfoEntry
        key_id (defined in shaka::media::mp4::CencSampleEncryptionInfoEntry)shaka::media::mp4::CencSampleEncryptionInfoEntry
        per_sample_iv_size (defined in shaka::media::mp4::CencSampleEncryptionInfoEntry)shaka::media::mp4::CencSampleEncryptionInfoEntry
        ReadWrite(BoxBuffer *buffer) (defined in shaka::media::mp4::CencSampleEncryptionInfoEntry)shaka::media::mp4::CencSampleEncryptionInfoEntry
        skip_byte_block (defined in shaka::media::mp4::CencSampleEncryptionInfoEntry)shaka::media::mp4::CencSampleEncryptionInfoEntry
        diff --git a/docs/db/db8/structshaka_1_1media_1_1OnMediaEndParameters.html b/docs/db/db8/structshaka_1_1media_1_1OnMediaEndParameters.html index c369886e95..6f5caab005 100644 --- a/docs/db/db8/structshaka_1_1media_1_1OnMediaEndParameters.html +++ b/docs/db/db8/structshaka_1_1media_1_1OnMediaEndParameters.html @@ -88,7 +88,7 @@ float duration_seconds diff --git a/docs/db/db8/structshaka_1_1media_1_1mp4_1_1TrackEncryption.html b/docs/db/db8/structshaka_1_1media_1_1mp4_1_1TrackEncryption.html index c02d15799d..e57447342b 100644 --- a/docs/db/db8/structshaka_1_1media_1_1mp4_1_1TrackEncryption.html +++ b/docs/db/db8/structshaka_1_1media_1_1mp4_1_1TrackEncryption.html @@ -103,29 +103,29 @@ Public Member Functions

        Public Attributes

        -uint8_t default_is_protected +uint8_t default_is_protected = 0   -uint8_t default_per_sample_iv_size +uint8_t default_per_sample_iv_size = 0   -std::vector< uint8_t > default_kid +std::vector< uint8_t > default_kid = std::vector<uint8_t>(16, 0)   -uint8_t default_crypt_byte_block +uint8_t default_crypt_byte_block = 0   -uint8_t default_skip_byte_block +uint8_t default_skip_byte_block = 0   std::vector< uint8_t > default_constant_iv   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

        @@ -136,7 +136,7 @@ Additional Inherited Members

        Detailed Description

        -

        Definition at line 144 of file box_definitions.h.

        +

        Definition at line 143 of file box_definitions.h.

        Member Function Documentation

        ◆ BoxType()

        @@ -164,7 +164,7 @@ Additional Inherited Members

        Implements shaka::media::mp4::Box.

        -

        Definition at line 409 of file box_definitions.cc.

        +

        Definition at line 418 of file box_definitions.cc.

        @@ -175,7 +175,7 @@ Additional Inherited Members diff --git a/docs/db/db9/text__chunker_8cc_source.html b/docs/db/db9/text__chunker_8cc_source.html index 81d2e86e12..6b61110549 100644 --- a/docs/db/db9/text__chunker_8cc_source.html +++ b/docs/db/db9/text__chunker_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/db/dcb/classshaka_1_1media_1_1VPxParser.html b/docs/db/dcb/classshaka_1_1media_1_1VPxParser.html index 3fe71b58be..d3abd7cc52 100644 --- a/docs/db/dcb/classshaka_1_1media_1_1VPxParser.html +++ b/docs/db/dcb/classshaka_1_1media_1_1VPxParser.html @@ -184,7 +184,7 @@ Protected Member Functions diff --git a/docs/db/dcd/classshaka_1_1MpdWriter.html b/docs/db/dcd/classshaka_1_1MpdWriter.html index 4dcc219f19..0785bfac25 100644 --- a/docs/db/dcd/classshaka_1_1MpdWriter.html +++ b/docs/db/dcd/classshaka_1_1MpdWriter.html @@ -99,7 +99,7 @@ class MpdWriterTest diff --git a/docs/db/dcd/structshaka_1_1media_1_1mp4_1_1DTSSpecific-members.html b/docs/db/dcd/structshaka_1_1media_1_1mp4_1_1DTSSpecific-members.html index 7ea3043bd3..d2d433aeb7 100644 --- a/docs/db/dcd/structshaka_1_1media_1_1mp4_1_1DTSSpecific-members.html +++ b/docs/db/dcd/structshaka_1_1media_1_1mp4_1_1DTSSpecific-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/db/dd0/classshaka_1_1Packager.html b/docs/db/dd0/classshaka_1_1Packager.html index 0aa33e78d6..1caab71fe8 100644 --- a/docs/db/dd0/classshaka_1_1Packager.html +++ b/docs/db/dd0/classshaka_1_1Packager.html @@ -149,7 +149,7 @@ Static Public Member Functions
        Returns
        the stream label associated with stream_info. Can be "AUDIO", "SD", "HD", "UHD1" or "UHD2".
        -

        Definition at line 993 of file packager.cc.

        +

        Definition at line 963 of file packager.cc.

        @@ -177,7 +177,7 @@ Static Public Member Functions
        Returns
        The version of the library.
        -

        Definition at line 989 of file packager.cc.

        +

        Definition at line 959 of file packager.cc.

        @@ -215,7 +215,7 @@ Static Public Member Functions
        Returns
        OK on success, an appropriate error code on failure.
        -

        Definition at line 829 of file packager.cc.

        +

        Definition at line 809 of file packager.cc.

        @@ -235,7 +235,7 @@ Static Public Member Functions

        Run the pipeline to completion (or failed / been cancelled). Note that it blocks until completion.

        Returns
        OK on success, an appropriate error code on failure.
        -

        Definition at line 962 of file packager.cc.

        +

        Definition at line 934 of file packager.cc.

        @@ -246,7 +246,7 @@ Static Public Member Functions diff --git a/docs/db/dd0/classshaka_1_1media_1_1RawKeySource.html b/docs/db/dd0/classshaka_1_1media_1_1RawKeySource.html index 6710fcfb5f..8d588968b3 100644 --- a/docs/db/dd0/classshaka_1_1media_1_1RawKeySource.html +++ b/docs/db/dd0/classshaka_1_1media_1_1RawKeySource.html @@ -366,7 +366,7 @@ Additional Inherited Members diff --git a/docs/db/dd0/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener.html b/docs/db/dd0/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener.html index fab7f59e6d..12873cdf98 100644 --- a/docs/db/dd0/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener.html +++ b/docs/db/dd0/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener.html @@ -583,7 +583,7 @@ Additional Inherited Members diff --git a/docs/db/dd2/chunk__info__iterator_8h_source.html b/docs/db/dd2/chunk__info__iterator_8h_source.html index 4bc2c9ffc3..d5007fd7e8 100644 --- a/docs/db/dd2/chunk__info__iterator_8h_source.html +++ b/docs/db/dd2/chunk__info__iterator_8h_source.html @@ -74,14 +74,14 @@ $(function() {
        All the methods that are virtual are virtual for mocking.
        - +
        uint32_t NumSamples(uint32_t start_chunk, uint32_t end_chunk) const
        ChunkInfoIterator(const SampleToChunk &sample_to_chunk)
        Create ChunkInfoIterator from sample to chunk box.
        diff --git a/docs/db/dd9/sync__sample__iterator_8h_source.html b/docs/db/dd9/sync__sample__iterator_8h_source.html index 41826590d9..8b1a8242c3 100644 --- a/docs/db/dd9/sync__sample__iterator_8h_source.html +++ b/docs/db/dd9/sync__sample__iterator_8h_source.html @@ -66,7 +66,7 @@ $(function() {
        sync_sample_iterator.h
        -
        1 // Copyright 2014 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_FORMATS_MP4_SYNC_SAMPLE_ITERATOR_H_
        8 #define PACKAGER_MEDIA_FORMATS_MP4_SYNC_SAMPLE_ITERATOR_H_
        9 
        10 #include <stdint.h>
        11 
        12 #include <vector>
        13 
        14 #include "packager/base/macros.h"
        15 #include "packager/media/formats/mp4/box_definitions.h"
        16 
        17 namespace shaka {
        18 namespace media {
        19 namespace mp4 {
        20 
        24  public:
        26  explicit SyncSampleIterator(const SyncSample& sync_sample);
        28 
        31  bool AdvanceSample();
        32 
        34  bool IsSyncSample() const;
        35 
        37  bool IsSyncSample(uint32_t sample) const;
        38 
        39  private:
        40  uint32_t sample_number_;
        41  const std::vector<uint32_t>& sync_sample_vector_;
        42  std::vector<uint32_t>::const_iterator iterator_;
        43  bool is_empty_;
        44 
        45  DISALLOW_COPY_AND_ASSIGN(SyncSampleIterator);
        46 };
        47 
        48 } // namespace mp4
        49 } // namespace media
        50 } // namespace shaka
        51 
        52 #endif // PACKAGER_MEDIA_FORMATS_MP4_SYNC_SAMPLE_ITERATOR_H_
        +
        1 // Copyright 2014 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_FORMATS_MP4_SYNC_SAMPLE_ITERATOR_H_
        8 #define PACKAGER_MEDIA_FORMATS_MP4_SYNC_SAMPLE_ITERATOR_H_
        9 
        10 #include <stdint.h>
        11 
        12 #include <vector>
        13 
        14 #include "packager/base/macros.h"
        15 #include "packager/media/formats/mp4/box_definitions.h"
        16 
        17 namespace shaka {
        18 namespace media {
        19 namespace mp4 {
        20 
        24  public:
        26  explicit SyncSampleIterator(const SyncSample& sync_sample);
        28 
        31  bool AdvanceSample();
        32 
        34  bool IsSyncSample() const;
        35 
        37  bool IsSyncSample(uint32_t sample) const;
        38 
        39  private:
        40  uint32_t sample_number_;
        41  const std::vector<uint32_t>& sync_sample_vector_;
        42  std::vector<uint32_t>::const_iterator iterator_;
        43  bool is_empty_;
        44 
        45  DISALLOW_COPY_AND_ASSIGN(SyncSampleIterator);
        46 };
        47 
        48 } // namespace mp4
        49 } // namespace media
        50 } // namespace shaka
        51 
        52 #endif // PACKAGER_MEDIA_FORMATS_MP4_SYNC_SAMPLE_ITERATOR_H_
        SyncSampleIterator(const SyncSample &sync_sample)
        Create a new SyncSampleIterator from sync sample box.
        All the methods that are virtual are virtual for mocking.
        @@ -75,7 +75,7 @@ $(function() {
        diff --git a/docs/db/dde/h265__parser_8cc_source.html b/docs/db/dde/h265__parser_8cc_source.html index c21a2e4af2..60712351f5 100644 --- a/docs/db/dde/h265__parser_8cc_source.html +++ b/docs/db/dde/h265__parser_8cc_source.html @@ -87,7 +87,7 @@ $(function() {
        diff --git a/docs/db/de2/classshaka_1_1media_1_1LineReader.html b/docs/db/de2/classshaka_1_1media_1_1LineReader.html index e87a1dea11..08230b1d8d 100644 --- a/docs/db/de2/classshaka_1_1media_1_1LineReader.html +++ b/docs/db/de2/classshaka_1_1media_1_1LineReader.html @@ -89,7 +89,7 @@ bool Next (std::string diff --git a/docs/db/dea/classshaka_1_1media_1_1TrickPlayHandler.html b/docs/db/dea/classshaka_1_1media_1_1TrickPlayHandler.html index fd5b6b360c..7e9070300e 100644 --- a/docs/db/dea/classshaka_1_1media_1_1TrickPlayHandler.html +++ b/docs/db/dea/classshaka_1_1media_1_1TrickPlayHandler.html @@ -167,7 +167,7 @@ const std::map< size_t, std::pair< std::shared_ptr< diff --git a/docs/db/dec/audio__timestamp__helper_8cc_source.html b/docs/db/dec/audio__timestamp__helper_8cc_source.html index 8930216acd..ae302f35e9 100644 --- a/docs/db/dec/audio__timestamp__helper_8cc_source.html +++ b/docs/db/dec/audio__timestamp__helper_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/db/dee/pes__packet_8cc_source.html b/docs/db/dee/pes__packet_8cc_source.html index a6e0a73754..2a760e1a8a 100644 --- a/docs/db/dee/pes__packet_8cc_source.html +++ b/docs/db/dee/pes__packet_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/db/df2/structshaka_1_1media_1_1H265SliceHeader-members.html b/docs/db/df2/structshaka_1_1media_1_1H265SliceHeader-members.html index 52509264af..c9241482d3 100644 --- a/docs/db/df2/structshaka_1_1media_1_1H265SliceHeader-members.html +++ b/docs/db/df2/structshaka_1_1media_1_1H265SliceHeader-members.html @@ -115,7 +115,7 @@ $(function() { diff --git a/docs/db/df6/classshaka_1_1media_1_1Cluster-members.html b/docs/db/df6/classshaka_1_1media_1_1Cluster-members.html index f73fb5eea9..dc5d80e865 100644 --- a/docs/db/df6/classshaka_1_1media_1_1Cluster-members.html +++ b/docs/db/df6/classshaka_1_1media_1_1Cluster-members.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/db/df6/muxer_8h_source.html b/docs/db/df6/muxer_8h_source.html index beeaeec1fb..7347343f58 100644 --- a/docs/db/df6/muxer_8h_source.html +++ b/docs/db/df6/muxer_8h_source.html @@ -66,26 +66,26 @@ $(function() {
        muxer.h
        -
        1 // Copyright 2014 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 //
        7 // Defines the muxer interface.
        8 
        9 #ifndef PACKAGER_MEDIA_BASE_MUXER_H_
        10 #define PACKAGER_MEDIA_BASE_MUXER_H_
        11 
        12 #include <memory>
        13 #include <vector>
        14 
        15 #include "packager/base/time/clock.h"
        16 #include "packager/media/base/media_handler.h"
        17 #include "packager/media/base/muxer_options.h"
        18 #include "packager/media/event/muxer_listener.h"
        19 #include "packager/media/event/progress_listener.h"
        20 #include "packager/status.h"
        21 
        22 namespace shaka {
        23 namespace media {
        24 
        25 class MediaSample;
        26 
        30 class Muxer : public MediaHandler {
        31  public:
        32  explicit Muxer(const MuxerOptions& options);
        33  virtual ~Muxer();
        34 
        37  void Cancel();
        38 
        41  void SetMuxerListener(std::unique_ptr<MuxerListener> muxer_listener);
        42 
        45  void SetProgressListener(std::unique_ptr<ProgressListener> progress_listener);
        46 
        47  const std::vector<std::shared_ptr<const StreamInfo>>& streams() const {
        48  return streams_;
        49  }
        50 
        57  void set_clock(base::Clock* clock) {
        58  clock_ = clock;
        59  }
        60 
        61  protected:
        64  Status InitializeInternal() override { return Status::OK; }
        65  Status Process(std::unique_ptr<StreamData> stream_data) override;
        66  Status OnFlushRequest(size_t input_stream_index) override { return Finalize(); }
        68 
        69  const MuxerOptions& options() const { return options_; }
        70  MuxerListener* muxer_listener() { return muxer_listener_.get(); }
        71  ProgressListener* progress_listener() { return progress_listener_.get(); }
        72  base::Clock* clock() { return clock_; }
        73 
        74  private:
        75  // Initialize the muxer.
        76  virtual Status InitializeMuxer() = 0;
        77 
        78  // Final clean up.
        79  virtual Status Finalize() = 0;
        80 
        81  // Add a new sample.
        82  virtual Status AddSample(
        83  size_t stream_id,
        84  const MediaSample& sample) = 0;
        85 
        86  // Finalize the segment or subsegment.
        87  virtual Status FinalizeSegment(
        88  size_t stream_id,
        89  const SegmentInfo& segment_info) = 0;
        90 
        91  MuxerOptions options_;
        92  std::vector<std::shared_ptr<const StreamInfo>> streams_;
        93  std::vector<uint8_t> current_key_id_;
        94  bool encryption_started_ = false;
        95  bool cancelled_;
        96 
        97  std::unique_ptr<MuxerListener> muxer_listener_;
        98  std::unique_ptr<ProgressListener> progress_listener_;
        99  // An external injected clock, can be NULL.
        100  base::Clock* clock_;
        101 
        102  DISALLOW_COPY_AND_ASSIGN(Muxer);
        103 };
        104 
        105 } // namespace media
        106 } // namespace shaka
        107 
        108 #endif // PACKAGER_MEDIA_BASE_MUXER_H_
        -
        Status OnFlushRequest(size_t input_stream_index) override
        Event handler for flush request at the specific input stream index.
        Definition: muxer.h:66
        - - +
        1 // Copyright 2014 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 //
        7 // Defines the muxer interface.
        8 
        9 #ifndef PACKAGER_MEDIA_BASE_MUXER_H_
        10 #define PACKAGER_MEDIA_BASE_MUXER_H_
        11 
        12 #include <memory>
        13 #include <vector>
        14 
        15 #include "packager/base/time/clock.h"
        16 #include "packager/media/base/media_handler.h"
        17 #include "packager/media/base/muxer_options.h"
        18 #include "packager/media/event/muxer_listener.h"
        19 #include "packager/media/event/progress_listener.h"
        20 #include "packager/status.h"
        21 
        22 namespace shaka {
        23 namespace media {
        24 
        25 class MediaSample;
        26 
        30 class Muxer : public MediaHandler {
        31  public:
        32  explicit Muxer(const MuxerOptions& options);
        33  virtual ~Muxer();
        34 
        37  void Cancel();
        38 
        41  void SetMuxerListener(std::unique_ptr<MuxerListener> muxer_listener);
        42 
        45  void SetProgressListener(std::unique_ptr<ProgressListener> progress_listener);
        46 
        47  const std::vector<std::shared_ptr<const StreamInfo>>& streams() const {
        48  return streams_;
        49  }
        50 
        57  void set_clock(base::Clock* clock) {
        58  clock_ = clock;
        59  }
        60 
        61  protected:
        64  Status InitializeInternal() override { return Status::OK; }
        65  Status Process(std::unique_ptr<StreamData> stream_data) override;
        66  Status OnFlushRequest(size_t input_stream_index) override;
        68 
        69  const MuxerOptions& options() const { return options_; }
        70  MuxerListener* muxer_listener() { return muxer_listener_.get(); }
        71  ProgressListener* progress_listener() { return progress_listener_.get(); }
        72  base::Clock* clock() { return clock_; }
        73 
        74  private:
        75  Muxer(const Muxer&) = delete;
        76  Muxer& operator=(const Muxer&) = delete;
        77 
        78  // Initialize the muxer. InitializeMuxer may be called multiple times with
        79  // |options()| updated between calls, which is used to support separate file
        80  // per Representation per Period for Ad Insertion.
        81  virtual Status InitializeMuxer() = 0;
        82 
        83  // Final clean up.
        84  virtual Status Finalize() = 0;
        85 
        86  // Add a new sample.
        87  virtual Status AddSample(
        88  size_t stream_id,
        89  const MediaSample& sample) = 0;
        90 
        91  // Finalize the segment or subsegment.
        92  virtual Status FinalizeSegment(
        93  size_t stream_id,
        94  const SegmentInfo& segment_info) = 0;
        95 
        96  // Re-initialize Muxer. Could be called on StreamInfo or CueEvent.
        97  // |timestamp| may be used to set the output file name.
        98  Status ReinitializeMuxer(int64_t timestamp);
        99 
        100  MuxerOptions options_;
        101  std::vector<std::shared_ptr<const StreamInfo>> streams_;
        102  std::vector<uint8_t> current_key_id_;
        103  bool encryption_started_ = false;
        104  bool cancelled_ = false;
        105 
        106  std::unique_ptr<MuxerListener> muxer_listener_;
        107  std::unique_ptr<ProgressListener> progress_listener_;
        108  // An external injected clock, can be NULL.
        109  base::Clock* clock_ = nullptr;
        110 
        111  // In VOD single segment case with Ad Cues, |output_file_name| is allowed to
        112  // be a template. In this case, there will be NumAdCues + 1 files generated.
        113  std::string output_file_template_;
        114  size_t output_file_index_ = 0;
        115 };
        116 
        117 } // namespace media
        118 } // namespace shaka
        119 
        120 #endif // PACKAGER_MEDIA_BASE_MUXER_H_
        +
        Status OnFlushRequest(size_t input_stream_index) override
        Event handler for flush request at the specific input stream index.
        Definition: muxer.cc:98
        + +
        All the methods that are virtual are virtual for mocking.
        This structure contains the list of configuration options for Muxer.
        Definition: muxer_options.h:20
        This class listens to progress updates events.
        Class to hold a media sample.
        Definition: media_sample.h:22
        -
        void SetProgressListener(std::unique_ptr< ProgressListener > progress_listener)
        Definition: muxer.cc:32
        +
        void SetProgressListener(std::unique_ptr< ProgressListener > progress_listener)
        Definition: muxer.cc:39
        Status InitializeInternal() override
        Definition: muxer.h:64
        -
        Status Process(std::unique_ptr< StreamData > stream_data) override
        Definition: muxer.cc:37
        +
        Status Process(std::unique_ptr< StreamData > stream_data) override
        Definition: muxer.cc:44
        void set_clock(base::Clock *clock)
        Definition: muxer.h:57
        -
        void SetMuxerListener(std::unique_ptr< MuxerListener > muxer_listener)
        Definition: muxer.cc:28
        +
        void SetMuxerListener(std::unique_ptr< MuxerListener > muxer_listener)
        Definition: muxer.cc:35
        diff --git a/docs/db/df8/classshaka_1_1media_1_1H265ByteToUnitStreamConverter.html b/docs/db/df8/classshaka_1_1media_1_1H265ByteToUnitStreamConverter.html index 17e6b5f26f..cb6fbaf87d 100644 --- a/docs/db/df8/classshaka_1_1media_1_1H265ByteToUnitStreamConverter.html +++ b/docs/db/df8/classshaka_1_1media_1_1H265ByteToUnitStreamConverter.html @@ -214,7 +214,7 @@ void WarnIfNotMatch (i
        diff --git a/docs/db/df8/pssh__generator__util_8cc_source.html b/docs/db/df8/pssh__generator__util_8cc_source.html index 82b91056f9..ea447ad4b3 100644 --- a/docs/db/df8/pssh__generator__util_8cc_source.html +++ b/docs/db/df8/pssh__generator__util_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/db/dfb/mpd__utils_8cc_source.html b/docs/db/dfb/mpd__utils_8cc_source.html index 00560c0a94..99496d225c 100644 --- a/docs/db/dfb/mpd__utils_8cc_source.html +++ b/docs/db/dfb/mpd__utils_8cc_source.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/db/dfc/mpd__notify__muxer__listener_8cc_source.html b/docs/db/dfc/mpd__notify__muxer__listener_8cc_source.html index 4252302e6f..0d89f7dfe6 100644 --- a/docs/db/dfc/mpd__notify__muxer__listener_8cc_source.html +++ b/docs/db/dfc/mpd__notify__muxer__listener_8cc_source.html @@ -94,7 +94,7 @@ $(function() { diff --git a/docs/db/dff/structshaka_1_1media_1_1mp4_1_1ChunkInfo-members.html b/docs/db/dff/structshaka_1_1media_1_1mp4_1_1ChunkInfo-members.html index 2e64335b52..1c35647cbd 100644 --- a/docs/db/dff/structshaka_1_1media_1_1mp4_1_1ChunkInfo-members.html +++ b/docs/db/dff/structshaka_1_1media_1_1mp4_1_1ChunkInfo-members.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/db/dff/webvtt__file__buffer_8h_source.html b/docs/db/dff/webvtt__file__buffer_8h_source.html new file mode 100644 index 0000000000..cadf9f6e5f --- /dev/null +++ b/docs/db/dff/webvtt__file__buffer_8h_source.html @@ -0,0 +1,81 @@ + + + + + + + +Shaka Packager SDK: packager/media/formats/webvtt/webvtt_file_buffer.h Source File + + + + + + + + + +
        +
        + + + + + + +
        +
        Shaka Packager SDK +
        +
        +
        + + + + + + + + +
        +
        + + +
        + +
        + + +
        +
        +
        +
        webvtt_file_buffer.h
        +
        +
        +
        1 // Copyright 2018 Google LLC All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_FORMATS_WEBVTT_WEBVTT_FILE_BUFFER_H_
        8 #define PACKAGER_MEDIA_FORMATS_WEBVTT_WEBVTT_FILE_BUFFER_H_
        9 
        10 #include <string>
        11 
        12 #include "packager/file/file.h"
        13 
        14 namespace shaka {
        15 namespace media {
        16 
        17 class TextSample;
        18 
        19 // A class to abstract writing a webvtt file to disk. This class will handle
        20 // all the formatting requirements for a webvtt file.
        22  public:
        24  virtual ~WebVttFileBuffer() = default;
        25 
        26  void Reset();
        27  void Append(const TextSample& sample);
        28 
        29  bool WriteTo(File* file);
        30 
        31  // Get the number of samples that have been appended to this file.
        32  size_t sample_count() const { return sample_count_; }
        33 
        34  private:
        35  WebVttFileBuffer(const WebVttFileBuffer&) = delete;
        36  WebVttFileBuffer& operator=(const WebVttFileBuffer&) = delete;
        37 
        38  std::string buffer_;
        39  size_t sample_count_ = 0;
        40 };
        41 
        42 } // namespace media
        43 } // namespace shaka
        44 
        45 #endif // PACKAGER_MEDIA_FORMATS_WEBVTT_WEBVTT_FILE_BUFFER_H_
        Define an abstract file interface.
        Definition: file.h:26
        +
        All the methods that are virtual are virtual for mocking.
        + + +
        + + + + diff --git a/docs/dc/d03/classshaka_1_1media_1_1mp2t_1_1ProgramMapTableWriter.html b/docs/dc/d03/classshaka_1_1media_1_1mp2t_1_1ProgramMapTableWriter.html index 8871e1d39a..dfeb6171a4 100644 --- a/docs/dc/d03/classshaka_1_1media_1_1mp2t_1_1ProgramMapTableWriter.html +++ b/docs/dc/d03/classshaka_1_1media_1_1mp2t_1_1ProgramMapTableWriter.html @@ -155,7 +155,7 @@ Protected Member Functions diff --git a/docs/dc/d06/classshaka_1_1media_1_1StreamInfo-members.html b/docs/dc/d06/classshaka_1_1media_1_1StreamInfo-members.html index d27f85c256..b470762240 100644 --- a/docs/dc/d06/classshaka_1_1media_1_1StreamInfo-members.html +++ b/docs/dc/d06/classshaka_1_1media_1_1StreamInfo-members.html @@ -97,7 +97,7 @@ $(function() { diff --git a/docs/dc/d08/raw__key__encryption__flags_8cc_source.html b/docs/dc/d08/raw__key__encryption__flags_8cc_source.html index 1d1b7dba1b..6dc1b7ca50 100644 --- a/docs/dc/d08/raw__key__encryption__flags_8cc_source.html +++ b/docs/dc/d08/raw__key__encryption__flags_8cc_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/dc/d0b/classshaka_1_1media_1_1ESDescriptor-members.html b/docs/dc/d0b/classshaka_1_1media_1_1ESDescriptor-members.html index 5bcec8cba1..f350b2ac9c 100644 --- a/docs/dc/d0b/classshaka_1_1media_1_1ESDescriptor-members.html +++ b/docs/dc/d0b/classshaka_1_1media_1_1ESDescriptor-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/dc/d16/classshaka_1_1media_1_1SeekHead.html b/docs/dc/d16/classshaka_1_1media_1_1SeekHead.html index 34bd47e599..9321ba59de 100644 --- a/docs/dc/d16/classshaka_1_1media_1_1SeekHead.html +++ b/docs/dc/d16/classshaka_1_1media_1_1SeekHead.html @@ -127,7 +127,7 @@ void set_tracks_pos (u diff --git a/docs/dc/d17/status__test__util_8h_source.html b/docs/dc/d17/status__test__util_8h_source.html index 4f3cd822f6..a5cc502f3f 100644 --- a/docs/dc/d17/status__test__util_8h_source.html +++ b/docs/dc/d17/status__test__util_8h_source.html @@ -69,7 +69,7 @@ $(function() {
        1 // Copyright 2014 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_STATUS_TEST_UTIL_H_
        8 #define PACKAGER_STATUS_TEST_UTIL_H_
        9 
        10 #include <gtest/gtest.h>
        11 
        12 #include "packager/status.h"
        13 
        14 #define EXPECT_OK(val) EXPECT_EQ(shaka::Status::OK, (val))
        15 #define ASSERT_OK(val) ASSERT_EQ(shaka::Status::OK, (val))
        16 #define EXPECT_NOT_OK(val) EXPECT_NE(shaka::Status::OK, (val))
        17 #define ASSERT_NOT_OK(val) ASSERT_NE(shaka::Status::OK, (val))
        18 
        19 #endif // PACKAGER_STATUS_TEST_UTIL_H_
        diff --git a/docs/dc/d18/classshaka_1_1media_1_1wvm_1_1WvmMediaParser.html b/docs/dc/d18/classshaka_1_1media_1_1wvm_1_1WvmMediaParser.html index 21902936e7..0a2dd5b883 100644 --- a/docs/dc/d18/classshaka_1_1media_1_1wvm_1_1WvmMediaParser.html +++ b/docs/dc/d18/classshaka_1_1media_1_1wvm_1_1WvmMediaParser.html @@ -231,7 +231,7 @@ Additional Inherited Members diff --git a/docs/dc/d18/structshaka_1_1media_1_1mp4_1_1ProtectionSchemeInfo-members.html b/docs/dc/d18/structshaka_1_1media_1_1mp4_1_1ProtectionSchemeInfo-members.html index c9d183f2f5..e5795954e4 100644 --- a/docs/dc/d18/structshaka_1_1media_1_1mp4_1_1ProtectionSchemeInfo-members.html +++ b/docs/dc/d18/structshaka_1_1media_1_1mp4_1_1ProtectionSchemeInfo-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/docs/dc/d19/box_8h_source.html b/docs/dc/d19/box_8h_source.html index 0db89edd6f..20e9ca4ef6 100644 --- a/docs/dc/d19/box_8h_source.html +++ b/docs/dc/d19/box_8h_source.html @@ -66,7 +66,7 @@ $(function() {
        box.h
        -
        1 // Copyright 2014 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_FORMATS_MP4_BOX_H_
        8 #define PACKAGER_MEDIA_FORMATS_MP4_BOX_H_
        9 
        10 #include <stdint.h>
        11 
        12 #include "packager/media/base/fourccs.h"
        13 
        14 namespace shaka {
        15 namespace media {
        16 
        17 class BufferWriter;
        18 
        19 namespace mp4 {
        20 
        21 class BoxBuffer;
        22 class BoxReader;
        23 
        27 struct Box {
        28  public:
        29  Box();
        30  virtual ~Box();
        33  bool Parse(BoxReader* reader);
        38  void Write(BufferWriter* writer);
        43  void WriteHeader(BufferWriter* writer);
        47  uint32_t ComputeSize();
        49  virtual uint32_t HeaderSize() const;
        51  virtual FourCC BoxType() const = 0;
        52 
        54  // function expects that ComputeSize has been invoked already.
        55  uint32_t box_size() { return box_size_; }
        56 
        57  protected:
        61  virtual bool ReadWriteHeaderInternal(BoxBuffer* buffer);
        62 
        63  private:
        64  friend class BoxBuffer;
        65  // Read/write the mp4 box from/to BoxBuffer. Note that this function expects
        66  // that ComputeSize has been invoked already.
        67  virtual bool ReadWriteInternal(BoxBuffer* buffer) = 0;
        68  // Compute the size of this box. A value of 0 should be returned if the box
        69  // should not be written. Note that this function won't update box size.
        70  virtual size_t ComputeSizeInternal() = 0;
        71 
        72  // We don't support 64-bit box sizes. 32-bit should be large enough for our
        73  // current needs.
        74  uint32_t box_size_;
        75 
        76  // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
        77  // generated copy constructor and assignment operator.
        78 };
        79 
        83 struct FullBox : Box {
        84  public:
        85  FullBox();
        86  ~FullBox() override;
        87 
        88  uint32_t HeaderSize() const final;
        89 
        90  uint8_t version;
        91  uint32_t flags;
        92 
        93  protected:
        94  bool ReadWriteHeaderInternal(BoxBuffer* buffer) final;
        95 
        96  // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
        97  // generated copy constructor and assignment operator.
        98 };
        99 
        100 } // namespace mp4
        101 } // namespace media
        102 } // namespace shaka
        103 
        104 #endif // PACKAGER_MEDIA_FORMATS_MP4_BOX_H_
        virtual FourCC BoxType() const =0
        +
        1 // Copyright 2014 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_FORMATS_MP4_BOX_H_
        8 #define PACKAGER_MEDIA_FORMATS_MP4_BOX_H_
        9 
        10 #include <stdint.h>
        11 
        12 #include "packager/media/base/fourccs.h"
        13 
        14 namespace shaka {
        15 namespace media {
        16 
        17 class BufferWriter;
        18 
        19 namespace mp4 {
        20 
        21 class BoxBuffer;
        22 class BoxReader;
        23 
        27 struct Box {
        28  public:
        29  Box();
        30  virtual ~Box();
        33  bool Parse(BoxReader* reader);
        38  void Write(BufferWriter* writer);
        43  void WriteHeader(BufferWriter* writer);
        47  uint32_t ComputeSize();
        49  virtual uint32_t HeaderSize() const;
        51  virtual FourCC BoxType() const = 0;
        52 
        54  // function expects that ComputeSize has been invoked already.
        55  uint32_t box_size() { return box_size_; }
        56 
        57  protected:
        61  virtual bool ReadWriteHeaderInternal(BoxBuffer* buffer);
        62 
        63  private:
        64  friend class BoxBuffer;
        65  // Read/write the mp4 box from/to BoxBuffer. Note that this function expects
        66  // that ComputeSize has been invoked already.
        67  virtual bool ReadWriteInternal(BoxBuffer* buffer) = 0;
        68  // Compute the size of this box. A value of 0 should be returned if the box
        69  // should not be written. Note that this function won't update box size.
        70  virtual size_t ComputeSizeInternal() = 0;
        71 
        72  // We don't support 64-bit box sizes. 32-bit should be large enough for our
        73  // current needs.
        74  uint32_t box_size_;
        75 
        76  // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
        77  // generated copy constructor and assignment operator.
        78 };
        79 
        83 struct FullBox : Box {
        84  public:
        85  FullBox();
        86  ~FullBox() override;
        87 
        88  uint32_t HeaderSize() const final;
        89 
        90  uint8_t version = 0;
        91  uint32_t flags = 0;
        92 
        93  protected:
        94  bool ReadWriteHeaderInternal(BoxBuffer* buffer) final;
        95 
        96  // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
        97  // generated copy constructor and assignment operator.
        98 };
        99 
        100 } // namespace mp4
        101 } // namespace media
        102 } // namespace shaka
        103 
        104 #endif // PACKAGER_MEDIA_FORMATS_MP4_BOX_H_
        virtual FourCC BoxType() const =0
        virtual bool ReadWriteHeaderInternal(BoxBuffer *buffer)
        Definition: box.cc:61
        @@ -83,7 +83,7 @@ $(function() {
        diff --git a/docs/dc/d1c/classshaka_1_1media_1_1mp2t_1_1AudioProgramMapTableWriter.html b/docs/dc/d1c/classshaka_1_1media_1_1mp2t_1_1AudioProgramMapTableWriter.html index 9248a317d7..b1bab85ec6 100644 --- a/docs/dc/d1c/classshaka_1_1media_1_1mp2t_1_1AudioProgramMapTableWriter.html +++ b/docs/dc/d1c/classshaka_1_1media_1_1mp2t_1_1AudioProgramMapTableWriter.html @@ -126,7 +126,7 @@ static const uint8_t kElem
        diff --git a/docs/dc/d1c/replicator_8h_source.html b/docs/dc/d1c/replicator_8h_source.html index 0271900ecf..f608cf1f25 100644 --- a/docs/dc/d1c/replicator_8h_source.html +++ b/docs/dc/d1c/replicator_8h_source.html @@ -66,14 +66,14 @@ $(function() {
        replicator.h
        -
        1 // Copyright 2017 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_REPLICATOR_HANDLER_H_
        8 #define PACKAGER_MEDIA_REPLICATOR_HANDLER_H_
        9 
        10 #include "packager/media/base/media_handler.h"
        11 
        12 namespace shaka {
        13 namespace media {
        14 
        19 class Replicator : public MediaHandler {
        20  private:
        21  Status InitializeInternal() override;
        22  Status Process(std::unique_ptr<StreamData> stream_data) override;
        23  bool ValidateOutputStreamIndex(size_t stream_index) const override;
        24  Status OnFlushRequest(size_t input_stream_index) override;
        25 };
        26 
        27 } // namespace media
        28 } // namespace shaka
        29 
        30 #endif // PACKAGER_MEDIA_REPLICATOR_HANDLER_H_
        +
        1 // Copyright 2017 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_REPLICATOR_HANDLER_H_
        8 #define PACKAGER_MEDIA_REPLICATOR_HANDLER_H_
        9 
        10 #include "packager/media/base/media_handler.h"
        11 
        12 namespace shaka {
        13 namespace media {
        14 
        19 class Replicator : public MediaHandler {
        20  private:
        21  Status InitializeInternal() override;
        22  Status Process(std::unique_ptr<StreamData> stream_data) override;
        23  bool ValidateOutputStreamIndex(size_t stream_index) const override;
        24  Status OnFlushRequest(size_t input_stream_index) override;
        25 };
        26 
        27 } // namespace media
        28 } // namespace shaka
        29 
        30 #endif // PACKAGER_MEDIA_REPLICATOR_HANDLER_H_
        All the methods that are virtual are virtual for mocking.
        diff --git a/docs/dc/d1f/classshaka_1_1media_1_1WebVttParser-members.html b/docs/dc/d1f/classshaka_1_1media_1_1WebVttParser-members.html index daeaa32d8b..e6cfe89414 100644 --- a/docs/dc/d1f/classshaka_1_1media_1_1WebVttParser-members.html +++ b/docs/dc/d1f/classshaka_1_1media_1_1WebVttParser-members.html @@ -96,7 +96,7 @@ $(function() {
        diff --git a/docs/dc/d21/classshaka_1_1media_1_1mp2t_1_1Ac3Header.html b/docs/dc/d21/classshaka_1_1media_1_1mp2t_1_1Ac3Header.html index e448f16500..70dc3aed96 100644 --- a/docs/dc/d21/classshaka_1_1media_1_1mp2t_1_1Ac3Header.html +++ b/docs/dc/d21/classshaka_1_1media_1_1mp2t_1_1Ac3Header.html @@ -448,7 +448,7 @@ Public Member Functions diff --git a/docs/dc/d35/structshaka_1_1EncryptionParams-members.html b/docs/dc/d35/structshaka_1_1EncryptionParams-members.html index 75a5e2c2e3..715cde0f7f 100644 --- a/docs/dc/d35/structshaka_1_1EncryptionParams-members.html +++ b/docs/dc/d35/structshaka_1_1EncryptionParams-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/dc/d3c/webm__cluster__parser_8h_source.html b/docs/dc/d3c/webm__cluster__parser_8h_source.html index 5706ec208d..5c3f2f10b9 100644 --- a/docs/dc/d3c/webm__cluster__parser_8h_source.html +++ b/docs/dc/d3c/webm__cluster__parser_8h_source.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/dc/d3f/key__source_8h_source.html b/docs/dc/d3f/key__source_8h_source.html index f4741299dc..fb445d102b 100644 --- a/docs/dc/d3f/key__source_8h_source.html +++ b/docs/dc/d3f/key__source_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/dc/d40/classshaka_1_1hls_1_1HlsNotifier-members.html b/docs/dc/d40/classshaka_1_1hls_1_1HlsNotifier-members.html index b8c7f66581..41e147a58c 100644 --- a/docs/dc/d40/classshaka_1_1hls_1_1HlsNotifier-members.html +++ b/docs/dc/d40/classshaka_1_1hls_1_1HlsNotifier-members.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/dc/d40/classshaka_1_1xml_1_1XmlNode-members.html b/docs/dc/d40/classshaka_1_1xml_1_1XmlNode-members.html index 8c4b33b2e6..feaeaef85c 100644 --- a/docs/dc/d40/classshaka_1_1xml_1_1XmlNode-members.html +++ b/docs/dc/d40/classshaka_1_1xml_1_1XmlNode-members.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/dc/d41/classshaka_1_1media_1_1BufferWriter.html b/docs/dc/d41/classshaka_1_1media_1_1BufferWriter.html index 97898ceafb..261ef9926c 100644 --- a/docs/dc/d41/classshaka_1_1media_1_1BufferWriter.html +++ b/docs/dc/d41/classshaka_1_1media_1_1BufferWriter.html @@ -287,7 +287,7 @@ void AppendInt (int64_ diff --git a/docs/dc/d48/pssh__generator_8h_source.html b/docs/dc/d48/pssh__generator_8h_source.html index 634b1e6a7a..0e0202a480 100644 --- a/docs/dc/d48/pssh__generator_8h_source.html +++ b/docs/dc/d48/pssh__generator_8h_source.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/dc/d4a/structshaka_1_1media_1_1mp4_1_1ProtectionSystemSpecificHeader-members.html b/docs/dc/d4a/structshaka_1_1media_1_1mp4_1_1ProtectionSystemSpecificHeader-members.html index b618697d54..248f8739c4 100644 --- a/docs/dc/d4a/structshaka_1_1media_1_1mp4_1_1ProtectionSystemSpecificHeader-members.html +++ b/docs/dc/d4a/structshaka_1_1media_1_1mp4_1_1ProtectionSystemSpecificHeader-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/dc/d4f/structshaka_1_1media_1_1mp4_1_1TrackHeader-members.html b/docs/dc/d4f/structshaka_1_1media_1_1mp4_1_1TrackHeader-members.html index 3c1bee5a07..644fbad87e 100644 --- a/docs/dc/d4f/structshaka_1_1media_1_1mp4_1_1TrackHeader-members.html +++ b/docs/dc/d4f/structshaka_1_1media_1_1mp4_1_1TrackHeader-members.html @@ -101,7 +101,7 @@ $(function() { diff --git a/docs/dc/d51/h265__byte__to__unit__stream__converter_8cc_source.html b/docs/dc/d51/h265__byte__to__unit__stream__converter_8cc_source.html index b29a11a641..3e7a4007f3 100644 --- a/docs/dc/d51/h265__byte__to__unit__stream__converter_8cc_source.html +++ b/docs/dc/d51/h265__byte__to__unit__stream__converter_8cc_source.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/dc/d52/decoding__time__iterator_8h_source.html b/docs/dc/d52/decoding__time__iterator_8h_source.html index a8c9162873..d7dcaa13af 100644 --- a/docs/dc/d52/decoding__time__iterator_8h_source.html +++ b/docs/dc/d52/decoding__time__iterator_8h_source.html @@ -74,11 +74,11 @@ $(function() { - + diff --git a/docs/dc/d52/sync__point__queue_8cc_source.html b/docs/dc/d52/sync__point__queue_8cc_source.html index ed1b43dc30..498cd86938 100644 --- a/docs/dc/d52/sync__point__queue_8cc_source.html +++ b/docs/dc/d52/sync__point__queue_8cc_source.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/dc/d53/webm_2segmenter_8cc_source.html b/docs/dc/d53/webm_2segmenter_8cc_source.html index cbc43dfed0..abfd63283c 100644 --- a/docs/dc/d53/webm_2segmenter_8cc_source.html +++ b/docs/dc/d53/webm_2segmenter_8cc_source.html @@ -70,10 +70,10 @@ $(function() {
        void WriteWebM(std::vector< uint8_t > *data) const
        Status Initialize(const std::vector< std::shared_ptr< const StreamInfo >> &streams, MuxerListener *muxer_listener, ProgressListener *progress_listener)
        Definition: segmenter.cc:51
        Abstract class holds stream information.
        Definition: stream_info.h:59
        -
        void UpdateProgress(uint64_t progress)
        Update segmentation progress using ProgressListener.
        Definition: segmenter.cc:246
        +
        void UpdateProgress(uint64_t progress)
        Update segmentation progress using ProgressListener.
        Definition: segmenter.cc:251
        virtual void OnSampleDurationReady(uint32_t sample_duration)=0
        Class for parsing or writing VP codec configuration record.
        -
        Status AddSample(size_t stream_id, const MediaSample &sample)
        Definition: segmenter.cc:119
        +
        Status AddSample(size_t stream_id, const MediaSample &sample)
        Definition: segmenter.cc:124
        All the methods that are virtual are virtual for mocking.
        This class listens to progress updates events.
        @@ -82,9 +82,9 @@ $(function() {
        bool ParseMP4(const std::vector< uint8_t > &data)
        Class to hold a media sample.
        Definition: media_sample.h:22
        - +
        virtual void OnProgress(double progress)=0
        -
        Status FinalizeSegment(size_t stream_id, const SegmentInfo &segment_info)
        Definition: segmenter.cc:143
        +
        Status FinalizeSegment(size_t stream_id, const SegmentInfo &segment_info)
        Definition: segmenter.cc:148
        Holds video stream information.
        Holds audio stream information.
        @@ -92,7 +92,7 @@ $(function() { diff --git a/docs/dc/d54/structshaka_1_1media_1_1H264DecRefPicMarking.html b/docs/dc/d54/structshaka_1_1media_1_1H264DecRefPicMarking.html index 344eea66a3..ecef9321f8 100644 --- a/docs/dc/d54/structshaka_1_1media_1_1H264DecRefPicMarking.html +++ b/docs/dc/d54/structshaka_1_1media_1_1H264DecRefPicMarking.html @@ -97,7 +97,7 @@ int max_long_term_frame_id diff --git a/docs/dc/d56/audio__header_8h_source.html b/docs/dc/d56/audio__header_8h_source.html index c9576a0eeb..db6fcdbe6a 100644 --- a/docs/dc/d56/audio__header_8h_source.html +++ b/docs/dc/d56/audio__header_8h_source.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/dc/d58/webm__media__parser_8h_source.html b/docs/dc/d58/webm__media__parser_8h_source.html index d7092c0ceb..0604bb4f7a 100644 --- a/docs/dc/d58/webm__media__parser_8h_source.html +++ b/docs/dc/d58/webm__media__parser_8h_source.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/dc/d5c/classshaka_1_1MockMpdNotifier.html b/docs/dc/d5c/classshaka_1_1MockMpdNotifier.html index 78f49788cf..e43b10b04b 100644 --- a/docs/dc/d5c/classshaka_1_1MockMpdNotifier.html +++ b/docs/dc/d5c/classshaka_1_1MockMpdNotifier.html @@ -143,7 +143,7 @@ Public Member Functions diff --git a/docs/dc/d69/structshaka_1_1media_1_1mp4_1_1CueSettingsBox-members.html b/docs/dc/d69/structshaka_1_1media_1_1mp4_1_1CueSettingsBox-members.html index 529707ec3a..7cb46c0f2c 100644 --- a/docs/dc/d69/structshaka_1_1media_1_1mp4_1_1CueSettingsBox-members.html +++ b/docs/dc/d69/structshaka_1_1media_1_1mp4_1_1CueSettingsBox-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/dc/d6f/classshaka_1_1media_1_1webm_1_1Segmenter-members.html b/docs/dc/d6f/classshaka_1_1media_1_1webm_1_1Segmenter-members.html index 38b2fbbc3e..5abaaef97d 100644 --- a/docs/dc/d6f/classshaka_1_1media_1_1webm_1_1Segmenter-members.html +++ b/docs/dc/d6f/classshaka_1_1media_1_1webm_1_1Segmenter-members.html @@ -98,7 +98,7 @@ $(function() { diff --git a/docs/dc/d71/classshaka_1_1media_1_1mp2t_1_1TsSection-members.html b/docs/dc/d71/classshaka_1_1media_1_1mp2t_1_1TsSection-members.html index 363fd19b2d..c1bf24097a 100644 --- a/docs/dc/d71/classshaka_1_1media_1_1mp2t_1_1TsSection-members.html +++ b/docs/dc/d71/classshaka_1_1media_1_1mp2t_1_1TsSection-members.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/dc/d73/classshaka_1_1media_1_1MockMuxerListener.html b/docs/dc/d73/classshaka_1_1media_1_1MockMuxerListener.html index f6599212eb..02c78da55e 100644 --- a/docs/dc/d73/classshaka_1_1media_1_1MockMuxerListener.html +++ b/docs/dc/d73/classshaka_1_1media_1_1MockMuxerListener.html @@ -196,7 +196,7 @@ Additional Inherited Members diff --git a/docs/dc/d76/classshaka_1_1media_1_1BitWriter.html b/docs/dc/d76/classshaka_1_1media_1_1BitWriter.html index 6d3e965288..fec966a837 100644 --- a/docs/dc/d76/classshaka_1_1media_1_1BitWriter.html +++ b/docs/dc/d76/classshaka_1_1media_1_1BitWriter.html @@ -224,7 +224,7 @@ void  diff --git a/docs/dc/d7b/classshaka_1_1media_1_1PsshBoxBuilder-members.html b/docs/dc/d7b/classshaka_1_1media_1_1PsshBoxBuilder-members.html index a2e41033c0..730620af00 100644 --- a/docs/dc/d7b/classshaka_1_1media_1_1PsshBoxBuilder-members.html +++ b/docs/dc/d7b/classshaka_1_1media_1_1PsshBoxBuilder-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/dc/d7b/closure__thread_8cc_source.html b/docs/dc/d7b/closure__thread_8cc_source.html index d828aefe87..e770585d7b 100644 --- a/docs/dc/d7b/closure__thread_8cc_source.html +++ b/docs/dc/d7b/closure__thread_8cc_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/dc/d7b/h264__parser_8cc_source.html b/docs/dc/d7b/h264__parser_8cc_source.html index 8ccfef899c..665f6111d1 100644 --- a/docs/dc/d7b/h264__parser_8cc_source.html +++ b/docs/dc/d7b/h264__parser_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/dc/d86/structshaka_1_1media_1_1mp4_1_1ElementaryStreamDescriptor-members.html b/docs/dc/d86/structshaka_1_1media_1_1mp4_1_1ElementaryStreamDescriptor-members.html index b63b1c0568..c81fd5796a 100644 --- a/docs/dc/d86/structshaka_1_1media_1_1mp4_1_1ElementaryStreamDescriptor-members.html +++ b/docs/dc/d86/structshaka_1_1media_1_1mp4_1_1ElementaryStreamDescriptor-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/docs/dc/d8a/classshaka_1_1media_1_1mp2t_1_1EsParserAudio.html b/docs/dc/d8a/classshaka_1_1media_1_1mp2t_1_1EsParserAudio.html index ce40634d28..528324a3fd 100644 --- a/docs/dc/d8a/classshaka_1_1media_1_1mp2t_1_1EsParserAudio.html +++ b/docs/dc/d8a/classshaka_1_1media_1_1mp2t_1_1EsParserAudio.html @@ -121,7 +121,7 @@ typedef base::Callback< void(uint32_t, const std::shared_ptr< diff --git a/docs/dc/d8f/structshaka_1_1media_1_1mp4_1_1MovieFragmentHeader.html b/docs/dc/d8f/structshaka_1_1media_1_1mp4_1_1MovieFragmentHeader.html index aff0df2a96..b2d429572e 100644 --- a/docs/dc/d8f/structshaka_1_1media_1_1mp4_1_1MovieFragmentHeader.html +++ b/docs/dc/d8f/structshaka_1_1media_1_1mp4_1_1MovieFragmentHeader.html @@ -103,14 +103,14 @@ Public Member Functions

        Public Attributes

        -uint32_t sequence_number +uint32_t sequence_number = 0u   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

        @@ -121,7 +121,7 @@ Additional Inherited Members

        Detailed Description

        -

        Definition at line 670 of file box_definitions.h.

        +

        Definition at line 675 of file box_definitions.h.

        Member Function Documentation

        ◆ BoxType()

        @@ -149,7 +149,7 @@ Additional Inherited Members

        Implements shaka::media::mp4::Box.

        -

        Definition at line 2243 of file box_definitions.cc.

        +

        Definition at line 2307 of file box_definitions.cc.

        @@ -160,7 +160,7 @@ Additional Inherited Members diff --git a/docs/dc/d9a/structshaka_1_1media_1_1Range-members.html b/docs/dc/d9a/structshaka_1_1media_1_1Range-members.html index a8adb3f2cc..d5712c0b85 100644 --- a/docs/dc/d9a/structshaka_1_1media_1_1Range-members.html +++ b/docs/dc/d9a/structshaka_1_1media_1_1Range-members.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/dc/da0/structshaka_1_1EncryptionParams.html b/docs/dc/da0/structshaka_1_1EncryptionParams.html index 9f963be6f8..c1e912b96a 100644 --- a/docs/dc/da0/structshaka_1_1EncryptionParams.html +++ b/docs/dc/da0/structshaka_1_1EncryptionParams.html @@ -258,7 +258,7 @@ static constexpr uint32_t  diff --git a/docs/dc/da0/structshaka_1_1media_1_1mp4_1_1DTSSpecific.html b/docs/dc/da0/structshaka_1_1media_1_1mp4_1_1DTSSpecific.html index 96a7117112..4623ab3973 100644 --- a/docs/dc/da0/structshaka_1_1media_1_1mp4_1_1DTSSpecific.html +++ b/docs/dc/da0/structshaka_1_1media_1_1mp4_1_1DTSSpecific.html @@ -101,16 +101,16 @@ Public Member Functions

        Public Attributes

        -uint32_t sampling_frequency +uint32_t sampling_frequency = 0u   -uint32_t max_bitrate +uint32_t max_bitrate = 0u   -uint32_t avg_bitrate +uint32_t avg_bitrate = 0u   -uint8_t pcm_sample_depth +uint8_t pcm_sample_depth = 0u   std::vector< uint8_t > extra_data @@ -124,7 +124,7 @@ Additional Inherited Members

        Detailed Description

        -

        Definition at line 303 of file box_definitions.h.

        +

        Definition at line 306 of file box_definitions.h.

        Member Function Documentation

        ◆ BoxType()

        @@ -152,7 +152,7 @@ Additional Inherited Members

        Implements shaka::media::mp4::Box.

        -

        Definition at line 1593 of file box_definitions.cc.

        +

        Definition at line 1625 of file box_definitions.cc.

        @@ -163,7 +163,7 @@ Additional Inherited Members diff --git a/docs/dc/da1/classshaka_1_1MpdBuilder.html b/docs/dc/da1/classshaka_1_1MpdBuilder.html index 753cf8478d..0711596c16 100644 --- a/docs/dc/da1/classshaka_1_1MpdBuilder.html +++ b/docs/dc/da1/classshaka_1_1MpdBuilder.html @@ -304,7 +304,7 @@ template<DashProfile profile> diff --git a/docs/dc/da3/buffer__callback__params_8h_source.html b/docs/dc/da3/buffer__callback__params_8h_source.html index 7abb15316c..0d3f34052a 100644 --- a/docs/dc/da3/buffer__callback__params_8h_source.html +++ b/docs/dc/da3/buffer__callback__params_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/dc/da3/es__parser__audio_8h_source.html b/docs/dc/da3/es__parser__audio_8h_source.html index 2a3590e54e..310ff9e469 100644 --- a/docs/dc/da3/es__parser__audio_8h_source.html +++ b/docs/dc/da3/es__parser__audio_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/dc/da4/muxer__listener__factory_8h_source.html b/docs/dc/da4/muxer__listener__factory_8h_source.html index 4318534b08..f3ed57ab0d 100644 --- a/docs/dc/da4/muxer__listener__factory_8h_source.html +++ b/docs/dc/da4/muxer__listener__factory_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/dc/da6/classshaka_1_1media_1_1ContentEncoding.html b/docs/dc/da6/classshaka_1_1media_1_1ContentEncoding.html index 76b4a3dff3..a7a4260f90 100644 --- a/docs/dc/da6/classshaka_1_1media_1_1ContentEncoding.html +++ b/docs/dc/da6/classshaka_1_1media_1_1ContentEncoding.html @@ -186,7 +186,7 @@ Static Public Attributes diff --git a/docs/dc/dbf/box__buffer_8h_source.html b/docs/dc/dbf/box__buffer_8h_source.html index de9897482f..117291c956 100644 --- a/docs/dc/dbf/box__buffer_8h_source.html +++ b/docs/dc/dbf/box__buffer_8h_source.html @@ -97,7 +97,7 @@ $(function() { diff --git a/docs/dc/dc1/classshaka_1_1xml_1_1RepresentationXmlNode-members.html b/docs/dc/dc1/classshaka_1_1xml_1_1RepresentationXmlNode-members.html index 2a9e8864be..172dd6a6a8 100644 --- a/docs/dc/dc1/classshaka_1_1xml_1_1RepresentationXmlNode-members.html +++ b/docs/dc/dc1/classshaka_1_1xml_1_1RepresentationXmlNode-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/docs/dc/dc2/classshaka_1_1media_1_1mp2t_1_1EsParserAudio-members.html b/docs/dc/dc2/classshaka_1_1media_1_1mp2t_1_1EsParserAudio-members.html index 4cc3ec244d..41238ae1c8 100644 --- a/docs/dc/dc2/classshaka_1_1media_1_1mp2t_1_1EsParserAudio-members.html +++ b/docs/dc/dc2/classshaka_1_1media_1_1mp2t_1_1EsParserAudio-members.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/dc/dca/classshaka_1_1media_1_1WebMListParser.html b/docs/dc/dca/classshaka_1_1media_1_1WebMListParser.html index 340db94551..69a605a088 100644 --- a/docs/dc/dca/classshaka_1_1media_1_1WebMListParser.html +++ b/docs/dc/dca/classshaka_1_1media_1_1WebMListParser.html @@ -191,7 +191,7 @@ void  diff --git a/docs/dc/dd8/structshaka_1_1media_1_1CueEvent-members.html b/docs/dc/dd8/structshaka_1_1media_1_1CueEvent-members.html index 3a318de7c9..cf6f88fdbe 100644 --- a/docs/dc/dd8/structshaka_1_1media_1_1CueEvent-members.html +++ b/docs/dc/dd8/structshaka_1_1media_1_1CueEvent-members.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/dc/dd9/rsa__key_8cc_source.html b/docs/dc/dd9/rsa__key_8cc_source.html index 101de7f037..bc397ec56c 100644 --- a/docs/dc/dd9/rsa__key_8cc_source.html +++ b/docs/dc/dd9/rsa__key_8cc_source.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/dc/ddf/structshaka_1_1media_1_1mp4_1_1Media.html b/docs/dc/ddf/structshaka_1_1media_1_1mp4_1_1Media.html index 3c27cc4b97..c717c90cab 100644 --- a/docs/dc/ddf/structshaka_1_1media_1_1mp4_1_1Media.html +++ b/docs/dc/ddf/structshaka_1_1media_1_1mp4_1_1Media.html @@ -118,7 +118,7 @@ Additional Inherited Members

        Detailed Description

        -

        Definition at line 614 of file box_definitions.h.

        +

        Definition at line 619 of file box_definitions.h.

        Member Function Documentation

        ◆ BoxType()

        @@ -146,7 +146,7 @@ Additional Inherited Members

        Implements shaka::media::mp4::Box.

        -

        Definition at line 2061 of file box_definitions.cc.

        +

        Definition at line 2113 of file box_definitions.cc.

        @@ -157,7 +157,7 @@ Additional Inherited Members diff --git a/docs/dc/de1/structshaka_1_1SegmentInfo.html b/docs/dc/de1/structshaka_1_1SegmentInfo.html index 24eb31a785..d64add1c66 100644 --- a/docs/dc/de1/structshaka_1_1SegmentInfo.html +++ b/docs/dc/de1/structshaka_1_1SegmentInfo.html @@ -94,7 +94,7 @@ uint64_t repeat diff --git a/docs/dc/deb/classshaka_1_1media_1_1mp4_1_1Fragmenter-members.html b/docs/dc/deb/classshaka_1_1media_1_1mp4_1_1Fragmenter-members.html index 6d5bec8c19..f4ce62df71 100644 --- a/docs/dc/deb/classshaka_1_1media_1_1mp4_1_1Fragmenter-members.html +++ b/docs/dc/deb/classshaka_1_1media_1_1mp4_1_1Fragmenter-members.html @@ -83,13 +83,14 @@ $(function() { InitializeFragment(int64_t first_sample_dts)shaka::media::mp4::Fragmenter key_frame_infos() const (defined in shaka::media::mp4::Fragmenter)shaka::media::mp4::Fragmenterinline OptimizeSampleEntries(std::vector< T > *entries, T *default_value)shaka::media::mp4::Fragmenterprotected - set_use_decoding_timestamp_in_timeline(bool use_decoding_timestamp_in_timeline)shaka::media::mp4::Fragmenterinline - traf() (defined in shaka::media::mp4::Fragmenter)shaka::media::mp4::Fragmenterinlineprotected - ~Fragmenter() (defined in shaka::media::mp4::Fragmenter)shaka::media::mp4::Fragmenter + set_allow_adjust_earliest_presentation_time(bool allow_adjust_earliest_presentation_time)shaka::media::mp4::Fragmenterinline + set_use_decoding_timestamp_in_timeline(bool use_decoding_timestamp_in_timeline)shaka::media::mp4::Fragmenterinline + traf() (defined in shaka::media::mp4::Fragmenter)shaka::media::mp4::Fragmenterinlineprotected + ~Fragmenter() (defined in shaka::media::mp4::Fragmenter)shaka::media::mp4::Fragmenter diff --git a/docs/dc/deb/h265__byte__to__unit__stream__converter_8h_source.html b/docs/dc/deb/h265__byte__to__unit__stream__converter_8h_source.html index 73af3d8495..d71efbe86f 100644 --- a/docs/dc/deb/h265__byte__to__unit__stream__converter_8h_source.html +++ b/docs/dc/deb/h265__byte__to__unit__stream__converter_8h_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/dc/dec/ts__section__pmt_8cc_source.html b/docs/dc/dec/ts__section__pmt_8cc_source.html index b8c2498c8b..b383669768 100644 --- a/docs/dc/dec/ts__section__pmt_8cc_source.html +++ b/docs/dc/dec/ts__section__pmt_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/dc/df0/classshaka_1_1media_1_1ClosureThread.html b/docs/dc/df0/classshaka_1_1media_1_1ClosureThread.html index 1e556a847c..2a4e55107e 100644 --- a/docs/dc/df0/classshaka_1_1media_1_1ClosureThread.html +++ b/docs/dc/df0/classshaka_1_1media_1_1ClosureThread.html @@ -156,7 +156,7 @@ void  diff --git a/docs/dc/df0/structshaka_1_1TestParams-members.html b/docs/dc/df0/structshaka_1_1TestParams-members.html index 98842b956a..9670e932d4 100644 --- a/docs/dc/df0/structshaka_1_1TestParams-members.html +++ b/docs/dc/df0/structshaka_1_1TestParams-members.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/dc/df4/classshaka_1_1media_1_1webm_1_1SingleSegmentSegmenter-members.html b/docs/dc/df4/classshaka_1_1media_1_1webm_1_1SingleSegmentSegmenter-members.html index 9afbf060dc..c4cf6e750c 100644 --- a/docs/dc/df4/classshaka_1_1media_1_1webm_1_1SingleSegmentSegmenter-members.html +++ b/docs/dc/df4/classshaka_1_1media_1_1webm_1_1SingleSegmentSegmenter-members.html @@ -106,7 +106,7 @@ $(function() { diff --git a/docs/dc/df7/structshaka_1_1media_1_1mp4_1_1TrackFragmentRun-members.html b/docs/dc/df7/structshaka_1_1media_1_1mp4_1_1TrackFragmentRun-members.html index 988a32c4f5..4ce74ab726 100644 --- a/docs/dc/df7/structshaka_1_1media_1_1mp4_1_1TrackFragmentRun-members.html +++ b/docs/dc/df7/structshaka_1_1media_1_1mp4_1_1TrackFragmentRun-members.html @@ -101,7 +101,7 @@ $(function() { diff --git a/docs/dc/df8/closure__thread_8h_source.html b/docs/dc/df8/closure__thread_8h_source.html index f592e6f6d0..a279255132 100644 --- a/docs/dc/df8/closure__thread_8h_source.html +++ b/docs/dc/df8/closure__thread_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/dd/d03/structshaka_1_1media_1_1SegmentEventInfo.html b/docs/dd/d03/structshaka_1_1media_1_1SegmentEventInfo.html index 436c14937c..c477caee90 100644 --- a/docs/dd/d03/structshaka_1_1media_1_1SegmentEventInfo.html +++ b/docs/dd/d03/structshaka_1_1media_1_1SegmentEventInfo.html @@ -91,7 +91,7 @@ uint64_t segment_file_size diff --git a/docs/dd/d05/encryption__config_8h_source.html b/docs/dd/d05/encryption__config_8h_source.html index 8714a23220..365e4bff49 100644 --- a/docs/dd/d05/encryption__config_8h_source.html +++ b/docs/dd/d05/encryption__config_8h_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/dd/d06/structshaka_1_1media_1_1mp4_1_1ChunkOffset.html b/docs/dd/d06/structshaka_1_1media_1_1mp4_1_1ChunkOffset.html index c9ecf41952..081d20a679 100644 --- a/docs/dd/d06/structshaka_1_1media_1_1mp4_1_1ChunkOffset.html +++ b/docs/dd/d06/structshaka_1_1media_1_1mp4_1_1ChunkOffset.html @@ -108,10 +108,10 @@ std::vector< uint64_t >   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0   - Protected Member Functions inherited from shaka::media::mp4::FullBox bool ReadWriteHeaderInternal (BoxBuffer *buffer) final @@ -119,7 +119,7 @@ uint32_t flags

        Detailed Description

        -

        Definition at line 466 of file box_definitions.h.

        +

        Definition at line 477 of file box_definitions.h.

        Member Function Documentation

        ◆ BoxType()

        @@ -147,7 +147,7 @@ uint32_t flagsReimplemented from shaka::media::mp4::ChunkLargeOffset.

        -

        Definition at line 855 of file box_definitions.cc.

        +

        Definition at line 874 of file box_definitions.cc.

        @@ -158,7 +158,7 @@ uint32_t flags diff --git a/docs/dd/d0c/classshaka_1_1ThreadedIoFile.html b/docs/dd/d0c/classshaka_1_1ThreadedIoFile.html index 0450c3b0ed..f9f5272ad7 100644 --- a/docs/dd/d0c/classshaka_1_1ThreadedIoFile.html +++ b/docs/dd/d0c/classshaka_1_1ThreadedIoFile.html @@ -430,7 +430,7 @@ Additional Inherited Members diff --git a/docs/dd/d10/muxer__factory_8h_source.html b/docs/dd/d10/muxer__factory_8h_source.html index 0ef8fe584c..a2975fd116 100644 --- a/docs/dd/d10/muxer__factory_8h_source.html +++ b/docs/dd/d10/muxer__factory_8h_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/dd/d11/mpd__builder_8cc_source.html b/docs/dd/d11/mpd__builder_8cc_source.html index 5f62206a1c..64b1669288 100644 --- a/docs/dd/d11/mpd__builder_8cc_source.html +++ b/docs/dd/d11/mpd__builder_8cc_source.html @@ -88,7 +88,7 @@ $(function() { diff --git a/docs/dd/d12/mpd__writer_8cc_source.html b/docs/dd/d12/mpd__writer_8cc_source.html index e9a9bba5d5..694471bc0d 100644 --- a/docs/dd/d12/mpd__writer_8cc_source.html +++ b/docs/dd/d12/mpd__writer_8cc_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/dd/d13/structshaka_1_1media_1_1mp4_1_1SampleAuxiliaryInformationSize.html b/docs/dd/d13/structshaka_1_1media_1_1mp4_1_1SampleAuxiliaryInformationSize.html index 0a7209bc11..f5e7865549 100644 --- a/docs/dd/d13/structshaka_1_1media_1_1mp4_1_1SampleAuxiliaryInformationSize.html +++ b/docs/dd/d13/structshaka_1_1media_1_1mp4_1_1SampleAuxiliaryInformationSize.html @@ -103,20 +103,20 @@ Public Member Functions

        Public Attributes

        -uint8_t default_sample_info_size +uint8_t default_sample_info_size = 0   -uint32_t sample_count +uint32_t sample_count = 0   std::vector< uint8_t > sample_info_sizes   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

        @@ -127,7 +127,7 @@ Additional Inherited Members

        Detailed Description

        -

        Definition at line 69 of file box_definitions.h.

        +

        Definition at line 70 of file box_definitions.h.

        Member Function Documentation

        ◆ BoxType()

        @@ -155,7 +155,7 @@ Additional Inherited Members

        Implements shaka::media::mp4::Box.

        -

        Definition at line 210 of file box_definitions.cc.

        +

        Definition at line 216 of file box_definitions.cc.

        @@ -166,7 +166,7 @@ Additional Inherited Members diff --git a/docs/dd/d14/job__manager_8cc_source.html b/docs/dd/d14/job__manager_8cc_source.html index ecb68af491..63e0619ee2 100644 --- a/docs/dd/d14/job__manager_8cc_source.html +++ b/docs/dd/d14/job__manager_8cc_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/dd/d17/classshaka_1_1media_1_1Demuxer.html b/docs/dd/d17/classshaka_1_1media_1_1Demuxer.html index 4ec68c8388..60919aed05 100644 --- a/docs/dd/d17/classshaka_1_1media_1_1Demuxer.html +++ b/docs/dd/d17/classshaka_1_1media_1_1Demuxer.html @@ -477,7 +477,7 @@ const std::map< size_t, std::pair< std::shared_ptr< diff --git a/docs/dd/d19/video__stream__info_8cc_source.html b/docs/dd/d19/video__stream__info_8cc_source.html index b28e4a369f..7d2d11122a 100644 --- a/docs/dd/d19/video__stream__info_8cc_source.html +++ b/docs/dd/d19/video__stream__info_8cc_source.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/dd/d1c/classshaka_1_1hls_1_1MediaPlaylist.html b/docs/dd/d1c/classshaka_1_1hls_1_1MediaPlaylist.html index 4543e3f23e..8d1bde3a92 100644 --- a/docs/dd/d1c/classshaka_1_1hls_1_1MediaPlaylist.html +++ b/docs/dd/d1c/classshaka_1_1hls_1_1MediaPlaylist.html @@ -213,7 +213,7 @@ void Definition at line 325 of file media_playlist.cc.

        +

        Definition at line 326 of file media_playlist.cc.

        @@ -286,7 +286,7 @@ void Definition at line 420 of file media_playlist.cc.

        +

        Definition at line 418 of file media_playlist.cc.

        @@ -338,7 +338,7 @@ void Definition at line 402 of file media_playlist.cc.

        +

        Definition at line 403 of file media_playlist.cc.

        @@ -366,7 +366,7 @@ void 

        Add #EXT-X-PLACEMENT-OPPORTUNITY for mid-roll ads. See https://support.google.com/dfp_premium/answer/7295798?hl=en.

        -

        Definition at line 437 of file media_playlist.cc.

        +

        Definition at line 435 of file media_playlist.cc.

        @@ -432,7 +432,7 @@ void Definition at line 374 of file media_playlist.cc.

        +

        Definition at line 375 of file media_playlist.cc.

        @@ -460,7 +460,7 @@ void 

        If bitrate is specified in MediaInfo then it will use that value. Otherwise, returns the max bitrate.

        Returns
        the bitrate (in bits per second) of this MediaPlaylist.
        -

        Definition at line 476 of file media_playlist.cc.

        +

        Definition at line 462 of file media_playlist.cc.

        @@ -499,7 +499,7 @@ void 
        Returns
        true if |width| and |height| have been set with a valid resolution values.
        -

        Definition at line 501 of file media_playlist.cc.

        +

        Definition at line 487 of file media_playlist.cc.

        @@ -527,7 +527,7 @@ void 
        Returns
        the longest segment’s duration. This will return 0 if no segments have been added.
        -

        Definition at line 482 of file media_playlist.cc.

        +

        Definition at line 468 of file media_playlist.cc.

        @@ -555,7 +555,7 @@ void 
        Returns
        number of channels for audio. 0 is returned for video.
        -

        Definition at line 497 of file media_playlist.cc.

        +

        Definition at line 483 of file media_playlist.cc.

        @@ -618,7 +618,7 @@ void 
        Returns
        true on success, false otherwise.
        -

        Definition at line 349 of file media_playlist.cc.

        +

        Definition at line 350 of file media_playlist.cc.

        @@ -652,7 +652,7 @@ void Definition at line 486 of file media_playlist.cc.

        +

        Definition at line 472 of file media_playlist.cc.

        @@ -687,7 +687,7 @@ void 
        Returns
        true on success, false otherwise.
        -

        Definition at line 441 of file media_playlist.cc.

        +

        Definition at line 439 of file media_playlist.cc.

        @@ -698,7 +698,7 @@ void  diff --git a/docs/dd/d20/cue__alignment__handler_8h_source.html b/docs/dd/d20/cue__alignment__handler_8h_source.html index 7fafd2dc52..df1f2fb65f 100644 --- a/docs/dd/d20/cue__alignment__handler_8h_source.html +++ b/docs/dd/d20/cue__alignment__handler_8h_source.html @@ -66,7 +66,7 @@ $(function() {
        cue_alignment_handler.h
        -
        1 // Copyright 2018 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_CHUNKING_CUE_ALIGNMENT_HANDLER_
        8 #define PACKAGER_MEDIA_CHUNKING_CUE_ALIGNMENT_HANDLER_
        9 
        10 #include <list>
        11 
        12 #include "packager/media/base/media_handler.h"
        13 #include "packager/media/chunking/sync_point_queue.h"
        14 
        15 namespace shaka {
        16 namespace media {
        17 
        26  public:
        27  explicit CueAlignmentHandler(SyncPointQueue* sync_points);
        28  ~CueAlignmentHandler() = default;
        29 
        30  private:
        32  CueAlignmentHandler& operator=(const CueAlignmentHandler&) = delete;
        33 
        34  struct StreamState {
        35  // Information for the stream.
        36  std::shared_ptr<const StreamInfo> info;
        37  // Cached samples that cannot be dispatched. All the samples should be at or
        38  // after |hint|.
        39  std::list<std::unique_ptr<StreamData>> samples;
        40  // If set, the stream is pending to be flushed.
        41  bool to_be_flushed = false;
        42 
        43  // A list of cues that the stream should inject between media samples. When
        44  // there are no cues, the stream should run up to the hint.
        45  std::list<std::unique_ptr<StreamData>> cues;
        46  };
        47 
        48  // MediaHandler overrides.
        49  Status InitializeInternal() override;
        50  Status Process(std::unique_ptr<StreamData> data) override;
        51  Status OnFlushRequest(size_t stream_index) override;
        52 
        53  // Internal handling functions for different stream data.
        54  Status OnStreamInfo(std::unique_ptr<StreamData> data);
        55 
        56  Status OnVideoSample(std::unique_ptr<StreamData> sample);
        57  Status OnNonVideoSample(std::unique_ptr<StreamData> sample);
        58  Status OnSample(std::unique_ptr<StreamData> sample);
        59 
        60  // Update stream states with new sync point.
        61  Status UseNewSyncPoint(std::shared_ptr<const CueEvent> new_sync);
        62 
        63  // Check if everyone is waiting for new hint points.
        64  bool EveryoneWaitingAtHint() const;
        65 
        66  // Dispatch or save incoming sample.
        67  Status AcceptSample(std::unique_ptr<StreamData> sample,
        68  StreamState* stream_state);
        69 
        70  // Dispatch all samples and cues (in the correct order) for the given stream.
        71  Status RunThroughSamples(StreamState* stream);
        72 
        73  SyncPointQueue* const sync_points_ = nullptr;
        74  std::vector<StreamState> stream_states_;
        75 
        76  // A common hint used by all streams. When a new cue is given to all streams,
        77  // the hint will be updated. The hint will always be larger than any cue. The
        78  // hint represents the min time in seconds for the next cue appear. The hints
        79  // are based off the un-promoted cue event times in |sync_points_|.
        80  //
        81  // When a video stream passes the hint, it will promote the corresponding cue
        82  // event. If all streams get to the hint and there are no video streams, the
        83  // thread will block until |sync_points_| gives back a promoted cue event.
        84  double hint_;
        85 };
        86 
        87 } // namespace media
        88 } // namespace shaka
        89 
        90 #endif // PACKAGER_MEDIA_CHUNKING_CUE_ALIGNMENT_HANDLER_
        +
        1 // Copyright 2018 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_CHUNKING_CUE_ALIGNMENT_HANDLER_
        8 #define PACKAGER_MEDIA_CHUNKING_CUE_ALIGNMENT_HANDLER_
        9 
        10 #include <list>
        11 
        12 #include "packager/media/base/media_handler.h"
        13 #include "packager/media/chunking/sync_point_queue.h"
        14 
        15 namespace shaka {
        16 namespace media {
        17 
        26  public:
        27  explicit CueAlignmentHandler(SyncPointQueue* sync_points);
        28  ~CueAlignmentHandler() = default;
        29 
        30  private:
        32  CueAlignmentHandler& operator=(const CueAlignmentHandler&) = delete;
        33 
        34  struct StreamState {
        35  // Information for the stream.
        36  std::shared_ptr<const StreamInfo> info;
        37  // Cached samples that cannot be dispatched. All the samples should be at or
        38  // after |hint|.
        39  std::list<std::unique_ptr<StreamData>> samples;
        40  // If set, the stream is pending to be flushed.
        41  bool to_be_flushed = false;
        42 
        43  // A list of cues that the stream should inject between media samples. When
        44  // there are no cues, the stream should run up to the hint.
        45  std::list<std::unique_ptr<StreamData>> cues;
        46  };
        47 
        48  // MediaHandler overrides.
        49  Status InitializeInternal() override;
        50  Status Process(std::unique_ptr<StreamData> data) override;
        51  Status OnFlushRequest(size_t stream_index) override;
        52 
        53  // Internal handling functions for different stream data.
        54  Status OnStreamInfo(std::unique_ptr<StreamData> data);
        55 
        56  Status OnVideoSample(std::unique_ptr<StreamData> sample);
        57  Status OnNonVideoSample(std::unique_ptr<StreamData> sample);
        58  Status OnSample(std::unique_ptr<StreamData> sample);
        59 
        60  // Update stream states with new sync point.
        61  Status UseNewSyncPoint(std::shared_ptr<const CueEvent> new_sync);
        62 
        63  // Check if everyone is waiting for new hint points.
        64  bool EveryoneWaitingAtHint() const;
        65 
        66  // Dispatch or save incoming sample.
        67  Status AcceptSample(std::unique_ptr<StreamData> sample,
        68  StreamState* stream_state);
        69 
        70  // Dispatch all samples and cues (in the correct order) for the given stream.
        71  Status RunThroughSamples(StreamState* stream);
        72 
        73  SyncPointQueue* const sync_points_ = nullptr;
        74  std::vector<StreamState> stream_states_;
        75 
        76  // A common hint used by all streams. When a new cue is given to all streams,
        77  // the hint will be updated. The hint will always be larger than any cue. The
        78  // hint represents the min time in seconds for the next cue appear. The hints
        79  // are based off the un-promoted cue event times in |sync_points_|.
        80  //
        81  // When a video stream passes the hint, it will promote the corresponding cue
        82  // event. If all streams get to the hint and there are no video streams, the
        83  // thread will block until |sync_points_| gives back a promoted cue event.
        84  double hint_;
        85 };
        86 
        87 } // namespace media
        88 } // namespace shaka
        89 
        90 #endif // PACKAGER_MEDIA_CHUNKING_CUE_ALIGNMENT_HANDLER_
        All the methods that are virtual are virtual for mocking.
        @@ -74,7 +74,7 @@ $(function() {
        diff --git a/docs/dd/d30/wvm__media__parser_8cc_source.html b/docs/dd/d30/wvm__media__parser_8cc_source.html index 8d680a28c9..9bc201dfea 100644 --- a/docs/dd/d30/wvm__media__parser_8cc_source.html +++ b/docs/dd/d30/wvm__media__parser_8cc_source.html @@ -97,7 +97,7 @@ $(function() {
        diff --git a/docs/dd/d3a/gflags__hex__bytes_8h_source.html b/docs/dd/d3a/gflags__hex__bytes_8h_source.html index d52c1117f7..9bdb7dd5f7 100644 --- a/docs/dd/d3a/gflags__hex__bytes_8h_source.html +++ b/docs/dd/d3a/gflags__hex__bytes_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/dd/d3b/mp4_2segmenter_8h_source.html b/docs/dd/d3b/mp4_2segmenter_8h_source.html index bbd83d668e..208e799515 100644 --- a/docs/dd/d3b/mp4_2segmenter_8h_source.html +++ b/docs/dd/d3b/mp4_2segmenter_8h_source.html @@ -67,32 +67,32 @@ $(function() {
        1 // Copyright 2014 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_FORMATS_MP4_SEGMENTER_H_
        8 #define PACKAGER_MEDIA_FORMATS_MP4_SEGMENTER_H_
        9 
        10 #include <map>
        11 #include <memory>
        12 #include <vector>
        13 
        14 #include "packager/base/optional.h"
        15 #include "packager/media/base/fourccs.h"
        16 #include "packager/media/base/range.h"
        17 #include "packager/media/formats/mp4/box_definitions.h"
        18 #include "packager/status.h"
        19 
        20 namespace shaka {
        21 namespace media {
        22 
        23 struct EncryptionConfig;
        24 struct MuxerOptions;
        25 struct SegmentInfo;
        26 
        27 class BufferWriter;
        28 class MediaSample;
        29 class MuxerListener;
        30 class ProgressListener;
        31 class StreamInfo;
        32 
        33 namespace mp4 {
        34 
        35 class Fragmenter;
        36 struct KeyFrameInfo;
        37 
        44 class Segmenter {
        45  public:
        46  Segmenter(const MuxerOptions& options,
        47  std::unique_ptr<FileType> ftyp,
        48  std::unique_ptr<Movie> moov);
        49  virtual ~Segmenter();
        50 
        59  const std::vector<std::shared_ptr<const StreamInfo>>& streams,
        60  MuxerListener* muxer_listener,
        61  ProgressListener* progress_listener);
        62 
        65  Status Finalize();
        66 
        71  Status AddSample(size_t stream_id, const MediaSample& sample);
        72 
        77  Status FinalizeSegment(size_t stream_id, const SegmentInfo& segment_info);
        78 
        79  // TODO(rkuroiwa): Change these Get*Range() methods to return
        80  // base::Optional<Range> as well.
        83  virtual bool GetInitRange(size_t* offset, size_t* size) = 0;
        84 
        87  virtual bool GetIndexRange(size_t* offset, size_t* size) = 0;
        88 
        89  // Returns an empty vector if there are no specific ranges for the segments,
        90  // e.g. the media is in multiple files.
        91  // Otherwise, a vector of ranges for the media segments are returned.
        92  virtual std::vector<Range> GetSegmentRanges() = 0;
        93 
        94  uint32_t GetReferenceTimeScale() const;
        95 
        97  double GetDuration() const;
        98 
        101  uint32_t sample_duration() const { return sample_duration_; }
        102 
        103  protected:
        105  void UpdateProgress(uint64_t progress);
        107  void SetComplete();
        108 
        109  const MuxerOptions& options() const { return options_; }
        110  FileType* ftyp() { return ftyp_.get(); }
        111  Movie* moov() { return moov_.get(); }
        112  BufferWriter* fragment_buffer() { return fragment_buffer_.get(); }
        113  SegmentIndex* sidx() { return sidx_.get(); }
        114  MuxerListener* muxer_listener() { return muxer_listener_; }
        115  uint64_t progress_target() { return progress_target_; }
        116  const std::vector<KeyFrameInfo>& key_frame_infos() const {
        117  return key_frame_infos_;
        118  }
        119 
        120  void set_progress_target(uint64_t progress_target) {
        121  progress_target_ = progress_target;
        122  }
        123 
        124  private:
        125  virtual Status DoInitialize() = 0;
        126  virtual Status DoFinalize() = 0;
        127  virtual Status DoFinalizeSegment() = 0;
        128 
        129  uint32_t GetReferenceStreamId();
        130 
        131  void FinalizeFragmentForKeyRotation(
        132  size_t stream_id,
        133  bool fragment_encrypted,
        134  const EncryptionConfig& encryption_config);
        135 
        136  const MuxerOptions& options_;
        137  std::unique_ptr<FileType> ftyp_;
        138  std::unique_ptr<Movie> moov_;
        139  std::unique_ptr<MovieFragment> moof_;
        140  std::unique_ptr<BufferWriter> fragment_buffer_;
        141  std::unique_ptr<SegmentIndex> sidx_;
        142  std::vector<std::unique_ptr<Fragmenter>> fragmenters_;
        143  MuxerListener* muxer_listener_ = nullptr;
        144  ProgressListener* progress_listener_ = nullptr;
        145  uint64_t progress_target_ = 0u;
        146  uint64_t accumulated_progress_ = 0u;
        147  uint32_t sample_duration_ = 0u;
        148  std::vector<uint64_t> stream_durations_;
        149  std::vector<KeyFrameInfo> key_frame_infos_;
        150 
        151  DISALLOW_COPY_AND_ASSIGN(Segmenter);
        152 };
        153 
        154 } // namespace mp4
        155 } // namespace media
        156 } // namespace shaka
        157 
        158 #endif // PACKAGER_MEDIA_FORMATS_MP4_SEGMENTER_H_
        Status Initialize(const std::vector< std::shared_ptr< const StreamInfo >> &streams, MuxerListener *muxer_listener, ProgressListener *progress_listener)
        Definition: segmenter.cc:51
        -
        void UpdateProgress(uint64_t progress)
        Update segmentation progress using ProgressListener.
        Definition: segmenter.cc:246
        -
        void SetComplete()
        Set progress to 100%.
        Definition: segmenter.cc:262
        - - +
        void UpdateProgress(uint64_t progress)
        Update segmentation progress using ProgressListener.
        Definition: segmenter.cc:251
        +
        void SetComplete()
        Set progress to 100%.
        Definition: segmenter.cc:267
        + +
        virtual bool GetInitRange(size_t *offset, size_t *size)=0
        -
        Status AddSample(size_t stream_id, const MediaSample &sample)
        Definition: segmenter.cc:119
        +
        Status AddSample(size_t stream_id, const MediaSample &sample)
        Definition: segmenter.cc:124
        All the methods that are virtual are virtual for mocking.
        This structure contains the list of configuration options for Muxer.
        Definition: muxer_options.h:20
        This class listens to progress updates events.
        - + - +
        Class to hold a media sample.
        Definition: media_sample.h:22
        - -
        double GetDuration() const
        Definition: segmenter.cc:237
        -
        Status FinalizeSegment(size_t stream_id, const SegmentInfo &segment_info)
        Definition: segmenter.cc:143
        + +
        double GetDuration() const
        Definition: segmenter.cc:242
        +
        Status FinalizeSegment(size_t stream_id, const SegmentInfo &segment_info)
        Definition: segmenter.cc:148
        uint32_t sample_duration() const
        Definition: segmenter.h:101
        virtual bool GetIndexRange(size_t *offset, size_t *size)=0
        diff --git a/docs/dd/d3e/callback__file_8cc_source.html b/docs/dd/d3e/callback__file_8cc_source.html index c6653f89b1..7019e54d64 100644 --- a/docs/dd/d3e/callback__file_8cc_source.html +++ b/docs/dd/d3e/callback__file_8cc_source.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/dd/d3f/structshaka_1_1media_1_1mp4_1_1SyncSample.html b/docs/dd/d3f/structshaka_1_1media_1_1mp4_1_1SyncSample.html index ef470af93a..5b9892c227 100644 --- a/docs/dd/d3f/structshaka_1_1media_1_1mp4_1_1SyncSample.html +++ b/docs/dd/d3f/structshaka_1_1media_1_1mp4_1_1SyncSample.html @@ -107,10 +107,10 @@ std::vector< uint32_t >   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

        @@ -121,7 +121,7 @@ Additional Inherited Members

        Detailed Description

        -

        Definition at line 471 of file box_definitions.h.

        +

        Definition at line 482 of file box_definitions.h.

        Member Function Documentation

        ◆ BoxType()

        @@ -149,7 +149,7 @@ Additional Inherited Members

        Implements shaka::media::mp4::Box.

        -

        Definition at line 910 of file box_definitions.cc.

        +

        Definition at line 933 of file box_definitions.cc.

        @@ -160,7 +160,7 @@ Additional Inherited Members diff --git a/docs/dd/d40/classshaka_1_1CallbackFile.html b/docs/dd/d40/classshaka_1_1CallbackFile.html index 34df313272..e7e5ed2a54 100644 --- a/docs/dd/d40/classshaka_1_1CallbackFile.html +++ b/docs/dd/d40/classshaka_1_1CallbackFile.html @@ -456,7 +456,7 @@ Additional Inherited Members diff --git a/docs/dd/d42/encryptor_8h_source.html b/docs/dd/d42/encryptor_8h_source.html index be36048e80..def8d9aa9c 100644 --- a/docs/dd/d42/encryptor_8h_source.html +++ b/docs/dd/d42/encryptor_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/dd/d46/webm__parser_8h_source.html b/docs/dd/d46/webm__parser_8h_source.html index 91483c66d4..04fd04d9df 100644 --- a/docs/dd/d46/webm__parser_8h_source.html +++ b/docs/dd/d46/webm__parser_8h_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/dd/d4b/event__info_8h_source.html b/docs/dd/d4b/event__info_8h_source.html index 155bb2f728..ab572b4fac 100644 --- a/docs/dd/d4b/event__info_8h_source.html +++ b/docs/dd/d4b/event__info_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/dd/d4d/structshaka_1_1media_1_1mp4_1_1MovieFragment-members.html b/docs/dd/d4d/structshaka_1_1media_1_1mp4_1_1MovieFragment-members.html index 9869d89349..a318ed8109 100644 --- a/docs/dd/d4d/structshaka_1_1media_1_1mp4_1_1MovieFragment-members.html +++ b/docs/dd/d4d/structshaka_1_1media_1_1mp4_1_1MovieFragment-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/docs/dd/d4e/classshaka_1_1Period-members.html b/docs/dd/d4e/classshaka_1_1Period-members.html index 50a72cb9d2..ab7a29582d 100644 --- a/docs/dd/d4e/classshaka_1_1Period-members.html +++ b/docs/dd/d4e/classshaka_1_1Period-members.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/dd/d4f/classshaka_1_1hls_1_1SimpleHlsNotifier-members.html b/docs/dd/d4f/classshaka_1_1hls_1_1SimpleHlsNotifier-members.html index 6a3d97dc19..b07c8667d4 100644 --- a/docs/dd/d4f/classshaka_1_1hls_1_1SimpleHlsNotifier-members.html +++ b/docs/dd/d4f/classshaka_1_1hls_1_1SimpleHlsNotifier-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/dd/d51/structshaka_1_1PlayReadyEncryptionParams-members.html b/docs/dd/d51/structshaka_1_1PlayReadyEncryptionParams-members.html index fa28cfbe22..8c0c14906a 100644 --- a/docs/dd/d51/structshaka_1_1PlayReadyEncryptionParams-members.html +++ b/docs/dd/d51/structshaka_1_1PlayReadyEncryptionParams-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/dd/d53/structshaka_1_1media_1_1wvm_1_1DemuxStreamIdMediaSample-members.html b/docs/dd/d53/structshaka_1_1media_1_1wvm_1_1DemuxStreamIdMediaSample-members.html index a5f60b19c3..1b8cc3a2e8 100644 --- a/docs/dd/d53/structshaka_1_1media_1_1wvm_1_1DemuxStreamIdMediaSample-members.html +++ b/docs/dd/d53/structshaka_1_1media_1_1wvm_1_1DemuxStreamIdMediaSample-members.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/dd/d54/widevine__encryption__flags_8h_source.html b/docs/dd/d54/widevine__encryption__flags_8h_source.html index 481c7a61a0..c70787891c 100644 --- a/docs/dd/d54/widevine__encryption__flags_8h_source.html +++ b/docs/dd/d54/widevine__encryption__flags_8h_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/dd/d58/bit__writer_8cc_source.html b/docs/dd/d58/bit__writer_8cc_source.html index 896ef5676a..7a1e937594 100644 --- a/docs/dd/d58/bit__writer_8cc_source.html +++ b/docs/dd/d58/bit__writer_8cc_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/dd/d58/crypto__params_8h_source.html b/docs/dd/d58/crypto__params_8h_source.html index e3ace7ce1d..52a1cb83c5 100644 --- a/docs/dd/d58/crypto__params_8h_source.html +++ b/docs/dd/d58/crypto__params_8h_source.html @@ -103,7 +103,7 @@ $(function() { diff --git a/docs/dd/d59/classshaka_1_1media_1_1mp2t_1_1EsParserH265-members.html b/docs/dd/d59/classshaka_1_1media_1_1mp2t_1_1EsParserH265-members.html index bf01091e4c..30630022b7 100644 --- a/docs/dd/d59/classshaka_1_1media_1_1mp2t_1_1EsParserH265-members.html +++ b/docs/dd/d59/classshaka_1_1media_1_1mp2t_1_1EsParserH265-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/dd/d59/structshaka_1_1media_1_1mp4_1_1SchemeInfo-members.html b/docs/dd/d59/structshaka_1_1media_1_1mp4_1_1SchemeInfo-members.html index cdacdf7860..a89c241e6c 100644 --- a/docs/dd/d59/structshaka_1_1media_1_1mp4_1_1SchemeInfo-members.html +++ b/docs/dd/d59/structshaka_1_1media_1_1mp4_1_1SchemeInfo-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/dd/d60/raw__key__source_8h_source.html b/docs/dd/d60/raw__key__source_8h_source.html index 153c454419..39984cc4ee 100644 --- a/docs/dd/d60/raw__key__source_8h_source.html +++ b/docs/dd/d60/raw__key__source_8h_source.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/dd/d64/structshaka_1_1media_1_1mp4_1_1SyncSample-members.html b/docs/dd/d64/structshaka_1_1media_1_1mp4_1_1SyncSample-members.html index cede439720..3a17c8ccb2 100644 --- a/docs/dd/d64/structshaka_1_1media_1_1mp4_1_1SyncSample-members.html +++ b/docs/dd/d64/structshaka_1_1media_1_1mp4_1_1SyncSample-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/dd/d65/vp8__parser_8h_source.html b/docs/dd/d65/vp8__parser_8h_source.html index 62b85d0423..0f3f5fe9fa 100644 --- a/docs/dd/d65/vp8__parser_8h_source.html +++ b/docs/dd/d65/vp8__parser_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/dd/d67/h264__byte__to__unit__stream__converter_8cc_source.html b/docs/dd/d67/h264__byte__to__unit__stream__converter_8cc_source.html index 50e77b4188..e17139c3be 100644 --- a/docs/dd/d67/h264__byte__to__unit__stream__converter_8cc_source.html +++ b/docs/dd/d67/h264__byte__to__unit__stream__converter_8cc_source.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/dd/d6e/classshaka_1_1media_1_1H265VideoSliceHeaderParser-members.html b/docs/dd/d6e/classshaka_1_1media_1_1H265VideoSliceHeaderParser-members.html index 657330ade5..b141590e20 100644 --- a/docs/dd/d6e/classshaka_1_1media_1_1H265VideoSliceHeaderParser-members.html +++ b/docs/dd/d6e/classshaka_1_1media_1_1H265VideoSliceHeaderParser-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/dd/d71/structshaka_1_1media_1_1mp4_1_1PixelAspectRatio.html b/docs/dd/d71/structshaka_1_1media_1_1mp4_1_1PixelAspectRatio.html index 1f71518810..400ae28b34 100644 --- a/docs/dd/d71/structshaka_1_1media_1_1mp4_1_1PixelAspectRatio.html +++ b/docs/dd/d71/structshaka_1_1media_1_1mp4_1_1PixelAspectRatio.html @@ -101,10 +101,10 @@ Public Member Functions

        Public Attributes

        -uint32_t h_spacing +uint32_t h_spacing = 0u   -uint32_t v_spacing +uint32_t v_spacing = 0u  

        Implements shaka::media::mp4::Box.

        -

        Definition at line 1409 of file box_definitions.cc.

        +

        Definition at line 1440 of file box_definitions.cc.

        @@ -154,7 +154,7 @@ Additional Inherited Members diff --git a/docs/dd/d74/classshaka_1_1media_1_1MediaHandlerGraphTestBase-members.html b/docs/dd/d74/classshaka_1_1media_1_1MediaHandlerGraphTestBase-members.html index 5e1cbd9b60..e6d808e3ad 100644 --- a/docs/dd/d74/classshaka_1_1media_1_1MediaHandlerGraphTestBase-members.html +++ b/docs/dd/d74/classshaka_1_1media_1_1MediaHandlerGraphTestBase-members.html @@ -95,7 +95,7 @@ $(function() {

        @@ -143,7 +143,7 @@ Additional Inherited Members

        diff --git a/docs/dd/d7a/classshaka_1_1media_1_1MuxerListener.html b/docs/dd/d7a/classshaka_1_1media_1_1MuxerListener.html index a44ee86a9f..17373b29a9 100644 --- a/docs/dd/d7a/classshaka_1_1media_1_1MuxerListener.html +++ b/docs/dd/d7a/classshaka_1_1media_1_1MuxerListener.html @@ -523,7 +523,7 @@ Public Member Functions diff --git a/docs/dd/d80/media__sample_8h_source.html b/docs/dd/d80/media__sample_8h_source.html index cb682af828..c85c1021f0 100644 --- a/docs/dd/d80/media__sample_8h_source.html +++ b/docs/dd/d80/media__sample_8h_source.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/dd/d87/memory__file_8cc_source.html b/docs/dd/d87/memory__file_8cc_source.html index 1765769d61..4d713d3b6c 100644 --- a/docs/dd/d87/memory__file_8cc_source.html +++ b/docs/dd/d87/memory__file_8cc_source.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/dd/d88/pes__packet__generator_8h_source.html b/docs/dd/d88/pes__packet__generator_8h_source.html index 6bec8422e7..b853f09a4f 100644 --- a/docs/dd/d88/pes__packet__generator_8h_source.html +++ b/docs/dd/d88/pes__packet__generator_8h_source.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/dd/d8c/file__test__util_8h_source.html b/docs/dd/d8c/file__test__util_8h_source.html index 25a9fb94b9..a84a94c867 100644 --- a/docs/dd/d8c/file__test__util_8h_source.html +++ b/docs/dd/d8c/file__test__util_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/dd/d8d/structshaka_1_1media_1_1mp4_1_1SegmentIndex-members.html b/docs/dd/d8d/structshaka_1_1media_1_1mp4_1_1SegmentIndex-members.html index ad9ad811da..c6357ffb9d 100644 --- a/docs/dd/d8d/structshaka_1_1media_1_1mp4_1_1SegmentIndex-members.html +++ b/docs/dd/d8d/structshaka_1_1media_1_1mp4_1_1SegmentIndex-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/docs/dd/d95/classshaka_1_1ThreadedIoFile-members.html b/docs/dd/d95/classshaka_1_1ThreadedIoFile-members.html index c6308d5f9b..ea0ac06778 100644 --- a/docs/dd/d95/classshaka_1_1ThreadedIoFile-members.html +++ b/docs/dd/d95/classshaka_1_1ThreadedIoFile-members.html @@ -100,7 +100,7 @@ $(function() { diff --git a/docs/dd/d98/ts__packet__writer__util_8h_source.html b/docs/dd/d98/ts__packet__writer__util_8h_source.html index 745bea1d58..dcf3b39d7b 100644 --- a/docs/dd/d98/ts__packet__writer__util_8h_source.html +++ b/docs/dd/d98/ts__packet__writer__util_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/dd/d9a/audio__timestamp__helper_8h_source.html b/docs/dd/d9a/audio__timestamp__helper_8h_source.html index 9eeb1fa00c..030ae00f87 100644 --- a/docs/dd/d9a/audio__timestamp__helper_8h_source.html +++ b/docs/dd/d9a/audio__timestamp__helper_8h_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/dd/d9b/structshaka_1_1media_1_1mp4_1_1SegmentReference.html b/docs/dd/d9b/structshaka_1_1media_1_1mp4_1_1SegmentReference.html index 2620bae982..af0f38fb00 100644 --- a/docs/dd/d9b/structshaka_1_1media_1_1mp4_1_1SegmentReference.html +++ b/docs/dd/d9b/structshaka_1_1media_1_1mp4_1_1SegmentReference.html @@ -89,37 +89,37 @@ Public Types

        Public Attributes

        -bool reference_type +bool reference_type = false   -uint32_t referenced_size +uint32_t referenced_size = 0u   -uint32_t subsegment_duration +uint32_t subsegment_duration = 0u   -bool starts_with_sap +bool starts_with_sap = false   -SAPType sap_type +SAPType sap_type = TypeUnknown   -uint32_t sap_delta_time +uint32_t sap_delta_time = 0u   -uint64_t earliest_presentation_time +uint64_t earliest_presentation_time = 0u  

        Detailed Description

        -

        Definition at line 748 of file box_definitions.h.

        +

        Definition at line 753 of file box_definitions.h.


        The documentation for this struct was generated from the following file: diff --git a/docs/dd/d9d/classshaka_1_1MpdNotifier-members.html b/docs/dd/d9d/classshaka_1_1MpdNotifier-members.html index f5822feaec..83d0a0928e 100644 --- a/docs/dd/d9d/classshaka_1_1MpdNotifier-members.html +++ b/docs/dd/d9d/classshaka_1_1MpdNotifier-members.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/dd/da4/structshaka_1_1xml_1_1XmlDeleter.html b/docs/dd/da4/structshaka_1_1xml_1_1XmlDeleter.html index 93e23c4929..d458f581e8 100644 --- a/docs/dd/da4/structshaka_1_1xml_1_1XmlDeleter.html +++ b/docs/dd/da4/structshaka_1_1xml_1_1XmlDeleter.html @@ -103,7 +103,7 @@ void operator() (xmlCh diff --git a/docs/dd/da5/classshaka_1_1media_1_1webm_1_1TwoPassSingleSegmentSegmenter.html b/docs/dd/da5/classshaka_1_1media_1_1webm_1_1TwoPassSingleSegmentSegmenter.html index 9006c0b15c..9c3d8f2a5e 100644 --- a/docs/dd/da5/classshaka_1_1media_1_1webm_1_1TwoPassSingleSegmentSegmenter.html +++ b/docs/dd/da5/classshaka_1_1media_1_1webm_1_1TwoPassSingleSegmentSegmenter.html @@ -202,7 +202,7 @@ uint64_t duration () c diff --git a/docs/dd/daa/vod__media__info__dump__muxer__listener_8h_source.html b/docs/dd/daa/vod__media__info__dump__muxer__listener_8h_source.html index 6230ca808d..07bd301071 100644 --- a/docs/dd/daa/vod__media__info__dump__muxer__listener_8h_source.html +++ b/docs/dd/daa/vod__media__info__dump__muxer__listener_8h_source.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/dd/dab/webm__muxer_8h_source.html b/docs/dd/dab/webm__muxer_8h_source.html index c92e1399ce..c7a04aa0f7 100644 --- a/docs/dd/dab/webm__muxer_8h_source.html +++ b/docs/dd/dab/webm__muxer_8h_source.html @@ -66,7 +66,7 @@ $(function() {
        webm_muxer.h
        -
        1 // Copyright 2015 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_FORMATS_WEBM_WEBM_MUXER_H_
        8 #define PACKAGER_MEDIA_FORMATS_WEBM_WEBM_MUXER_H_
        9 
        10 #include "packager/media/base/muxer.h"
        11 
        12 namespace shaka {
        13 namespace media {
        14 namespace webm {
        15 
        16 class Segmenter;
        17 
        19 class WebMMuxer : public Muxer {
        20  public:
        22  explicit WebMMuxer(const MuxerOptions& options);
        23  ~WebMMuxer() override;
        24 
        25  private:
        26  // Muxer implementation overrides.
        27  Status InitializeMuxer() override;
        28  Status Finalize() override;
        29  Status AddSample(size_t stream_id, const MediaSample& sample) override;
        30  Status FinalizeSegment(size_t stream_id,
        31  const SegmentInfo& segment_info) override;
        32 
        33  void FireOnMediaStartEvent();
        34  void FireOnMediaEndEvent();
        35 
        36  std::unique_ptr<Segmenter> segmenter_;
        37 
        38  DISALLOW_COPY_AND_ASSIGN(WebMMuxer);
        39 };
        40 
        41 } // namespace webm
        42 } // namespace media
        43 } // namespace shaka
        44 
        45 #endif // PACKAGER_MEDIA_FORMATS_WEBM_WEBM_MUXER_H_
        +
        1 // Copyright 2015 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_FORMATS_WEBM_WEBM_MUXER_H_
        8 #define PACKAGER_MEDIA_FORMATS_WEBM_WEBM_MUXER_H_
        9 
        10 #include "packager/media/base/muxer.h"
        11 
        12 namespace shaka {
        13 namespace media {
        14 namespace webm {
        15 
        16 class Segmenter;
        17 
        19 class WebMMuxer : public Muxer {
        20  public:
        22  explicit WebMMuxer(const MuxerOptions& options);
        23  ~WebMMuxer() override;
        24 
        25  private:
        26  // Muxer implementation overrides.
        27  Status InitializeMuxer() override;
        28  Status Finalize() override;
        29  Status AddSample(size_t stream_id, const MediaSample& sample) override;
        30  Status FinalizeSegment(size_t stream_id,
        31  const SegmentInfo& segment_info) override;
        32 
        33  void FireOnMediaStartEvent();
        34  void FireOnMediaEndEvent();
        35 
        36  std::unique_ptr<Segmenter> segmenter_;
        37 
        38  DISALLOW_COPY_AND_ASSIGN(WebMMuxer);
        39 };
        40 
        41 } // namespace webm
        42 } // namespace media
        43 } // namespace shaka
        44 
        45 #endif // PACKAGER_MEDIA_FORMATS_WEBM_WEBM_MUXER_H_
        All the methods that are virtual are virtual for mocking.
        This structure contains the list of configuration options for Muxer.
        Definition: muxer_options.h:20
        @@ -77,7 +77,7 @@ $(function() {
        diff --git a/docs/dd/dae/structshaka_1_1media_1_1mp4_1_1WebVTTSourceLabelBox-members.html b/docs/dd/dae/structshaka_1_1media_1_1mp4_1_1WebVTTSourceLabelBox-members.html index 0f403e912d..b14f980099 100644 --- a/docs/dd/dae/structshaka_1_1media_1_1mp4_1_1WebVTTSourceLabelBox-members.html +++ b/docs/dd/dae/structshaka_1_1media_1_1mp4_1_1WebVTTSourceLabelBox-members.html @@ -85,7 +85,7 @@ $(function() {
        diff --git a/docs/dd/db0/classshaka_1_1media_1_1WebMAudioClient-members.html b/docs/dd/db0/classshaka_1_1media_1_1WebMAudioClient-members.html index 91c8473aeb..2755a12b95 100644 --- a/docs/dd/db0/classshaka_1_1media_1_1WebMAudioClient-members.html +++ b/docs/dd/db0/classshaka_1_1media_1_1WebMAudioClient-members.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/dd/db3/structshaka_1_1media_1_1mp4_1_1SampleTable-members.html b/docs/dd/db3/structshaka_1_1media_1_1mp4_1_1SampleTable-members.html index 7b8eef617b..a2ea715f84 100644 --- a/docs/dd/db3/structshaka_1_1media_1_1mp4_1_1SampleTable-members.html +++ b/docs/dd/db3/structshaka_1_1media_1_1mp4_1_1SampleTable-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/docs/dd/db5/packager_8h_source.html b/docs/dd/db5/packager_8h_source.html index 8fc7966232..5181c002e9 100644 --- a/docs/dd/db5/packager_8h_source.html +++ b/docs/dd/db5/packager_8h_source.html @@ -106,7 +106,7 @@ $(function() { diff --git a/docs/dd/db9/classshaka_1_1xml_1_1RepresentationBaseXmlNode.html b/docs/dd/db9/classshaka_1_1xml_1_1RepresentationBaseXmlNode.html index 12e3bca5ef..23f5d781d2 100644 --- a/docs/dd/db9/classshaka_1_1xml_1_1RepresentationBaseXmlNode.html +++ b/docs/dd/db9/classshaka_1_1xml_1_1RepresentationBaseXmlNode.html @@ -211,7 +211,7 @@ Protected Member Functions diff --git a/docs/dd/dbc/buffer__reader_8cc_source.html b/docs/dd/dbc/buffer__reader_8cc_source.html index fc15c30ea9..5600e12791 100644 --- a/docs/dd/dbc/buffer__reader_8cc_source.html +++ b/docs/dd/dbc/buffer__reader_8cc_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/dd/dbc/encryption__handler_8h_source.html b/docs/dd/dbc/encryption__handler_8h_source.html index 7cc422376f..382d0c2be1 100644 --- a/docs/dd/dbc/encryption__handler_8h_source.html +++ b/docs/dd/dbc/encryption__handler_8h_source.html @@ -69,7 +69,7 @@ $(function() {
        1 // Copyright 2017 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_CRYPTO_ENCRYPTION_HANDLER_H_
        8 #define PACKAGER_MEDIA_CRYPTO_ENCRYPTION_HANDLER_H_
        9 
        10 #include "packager/media/base/key_source.h"
        11 #include "packager/media/base/media_handler.h"
        12 #include "packager/media/public/crypto_params.h"
        13 
        14 namespace shaka {
        15 namespace media {
        16 
        17 class AesCryptor;
        18 class VideoSliceHeaderParser;
        19 class VPxParser;
        20 struct EncryptionKey;
        21 struct VPxFrameInfo;
        22 
        24  public:
        25  EncryptionHandler(const EncryptionParams& encryption_params,
        26  KeySource* key_source);
        27 
        28  ~EncryptionHandler() override;
        29 
        30  protected:
        33  Status InitializeInternal() override;
        34  Status Process(std::unique_ptr<StreamData> stream_data) override;
        36 
        37  private:
        38  friend class EncryptionHandlerTest;
        39 
        40  EncryptionHandler(const EncryptionHandler&) = delete;
        41  EncryptionHandler& operator=(const EncryptionHandler&) = delete;
        42 
        43  // Processes |stream_info| and sets up stream specific variables.
        44  Status ProcessStreamInfo(const StreamInfo& stream_info);
        45  // Processes media sample and encrypts it if needed.
        46  Status ProcessMediaSample(std::shared_ptr<const MediaSample> clear_sample);
        47 
        48  Status SetupProtectionPattern(StreamType stream_type);
        49  bool CreateEncryptor(const EncryptionKey& encryption_key);
        50  // Encrypt a VPx frame with size |source_size|. |dest| should have at least
        51  // |source_size| bytes.
        52  bool EncryptVpxFrame(const std::vector<VPxFrameInfo>& vpx_frames,
        53  const uint8_t* source,
        54  size_t source_size,
        55  uint8_t* dest,
        56  DecryptConfig* decrypt_config);
        57  // Encrypt a NAL unit frame with size |source_size|. |dest| should have at
        58  // least |source_size| bytes.
        59  bool EncryptNalFrame(const uint8_t* source,
        60  size_t source_size,
        61  uint8_t* dest,
        62  DecryptConfig* decrypt_config);
        63  // Encrypt an E-AC3 frame with size |source_size| according to SAMPLE-AES
        64  // specification. |dest| should have at least |source_size| bytes.
        65  bool SampleAesEncryptEac3Frame(const uint8_t* source,
        66  size_t source_size,
        67  uint8_t* dest);
        68  // Encrypt an array with size |source_size|. |dest| should have at
        69  // least |source_size| bytes.
        70  void EncryptBytes(const uint8_t* source, size_t source_size, uint8_t* dest);
        71 
        72  // An E-AC3 frame comprises of one or more syncframes. This function extracts
        73  // the syncframe sizes from the source bytes.
        74  // Returns false if the frame is not well formed.
        75  bool ExtractEac3SyncframeSizes(const uint8_t* source,
        76  size_t source_size,
        77  std::vector<size_t>* syncframe_sizes);
        78 
        79  // Testing injections.
        80  void InjectVpxParserForTesting(std::unique_ptr<VPxParser> vpx_parser);
        81  void InjectVideoSliceHeaderParserForTesting(
        82  std::unique_ptr<VideoSliceHeaderParser> header_parser);
        83 
        84  const EncryptionParams encryption_params_;
        85  const FourCC protection_scheme_ = FOURCC_NULL;
        86  KeySource* key_source_ = nullptr;
        87  std::string stream_label_;
        88  // Current encryption config and encryptor.
        89  std::shared_ptr<EncryptionConfig> encryption_config_;
        90  std::unique_ptr<AesCryptor> encryptor_;
        91  Codec codec_ = kUnknownCodec;
        92  // Specifies the size of NAL unit length in bytes. Can be 1, 2 or 4 bytes. 0
        93  // if it is not a NAL structured video.
        94  uint8_t nalu_length_size_ = 0;
        95  // For Sample AES, 32 bytes for Video and 16 bytes for audio.
        96  size_t leading_clear_bytes_size_ = 0;
        97  // For Sample AES, if the data size is less than this value, none of the bytes
        98  // are encrypted. The size is 48+1 bytes for video NAL and 16+15 bytes for
        99  // audio according to MPEG-2 Stream Encryption Format for HTTP Live Streaming.
        100  size_t min_protected_data_size_ = 0;
        101  // Remaining clear lead in the stream's time scale.
        102  int64_t remaining_clear_lead_ = 0;
        103  // Crypto period duration in the stream's time scale.
        104  uint64_t crypto_period_duration_ = 0;
        105  // Previous crypto period index if key rotation is enabled.
        106  int64_t prev_crypto_period_index_ = -1;
        107  bool check_new_crypto_period_ = false;
        108 
        109  // Number of encrypted blocks (16-byte-block) in pattern based encryption.
        110  uint8_t crypt_byte_block_ = 0;
        112  uint8_t skip_byte_block_ = 0;
        113 
        114  // VPx parser for VPx streams.
        115  std::unique_ptr<VPxParser> vpx_parser_;
        116  // Video slice header parser for NAL strucutred streams.
        117  std::unique_ptr<VideoSliceHeaderParser> header_parser_;
        118 };
        119 
        120 } // namespace media
        121 } // namespace shaka
        122 
        123 #endif // PACKAGER_MEDIA_CRYPTO_ENCRYPTION_HANDLER_H_
        Abstract class holds stream information.
        Definition: stream_info.h:59
        - +
        All the methods that are virtual are virtual for mocking.
        @@ -80,7 +80,7 @@ $(function() {
        diff --git a/docs/dd/dbd/structshaka_1_1media_1_1EncryptionKey.html b/docs/dd/dbd/structshaka_1_1media_1_1EncryptionKey.html index 079771abba..db96cb8d33 100644 --- a/docs/dd/dbd/structshaka_1_1media_1_1EncryptionKey.html +++ b/docs/dd/dbd/structshaka_1_1media_1_1EncryptionKey.html @@ -95,7 +95,7 @@ std::vector< uint8_t >  diff --git a/docs/dd/dbd/structshaka_1_1media_1_1mp4_1_1TrackEncryption-members.html b/docs/dd/dbd/structshaka_1_1media_1_1mp4_1_1TrackEncryption-members.html index dde352beec..f981a2e41a 100644 --- a/docs/dd/dbd/structshaka_1_1media_1_1mp4_1_1TrackEncryption-members.html +++ b/docs/dd/dbd/structshaka_1_1media_1_1mp4_1_1TrackEncryption-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/docs/dd/dbf/webm__webvtt__parser_8h_source.html b/docs/dd/dbf/webm__webvtt__parser_8h_source.html index c94021364e..64ba9dcf27 100644 --- a/docs/dd/dbf/webm__webvtt__parser_8h_source.html +++ b/docs/dd/dbf/webm__webvtt__parser_8h_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/dd/dc1/structshaka_1_1media_1_1mp4_1_1FullBox.html b/docs/dd/dc1/structshaka_1_1media_1_1mp4_1_1FullBox.html index 7a34f3c05c..817852e653 100644 --- a/docs/dd/dc1/structshaka_1_1media_1_1mp4_1_1FullBox.html +++ b/docs/dd/dc1/structshaka_1_1media_1_1mp4_1_1FullBox.html @@ -141,10 +141,10 @@ Public Member Functions

        Public Attributes

        -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0   diff --git a/docs/dd/dc4/classshaka_1_1media_1_1ProducerConsumerQueue-members.html b/docs/dd/dc4/classshaka_1_1media_1_1ProducerConsumerQueue-members.html index 2be369a214..9ead34d087 100644 --- a/docs/dd/dc4/classshaka_1_1media_1_1ProducerConsumerQueue-members.html +++ b/docs/dd/dc4/classshaka_1_1media_1_1ProducerConsumerQueue-members.html @@ -84,7 +84,7 @@ $(function() {

        @@ -225,7 +225,7 @@ Protected Member Functions

        diff --git a/docs/dd/dc5/classshaka_1_1media_1_1webm_1_1Segmenter.html b/docs/dd/dc5/classshaka_1_1media_1_1webm_1_1Segmenter.html index cc47d889e1..4a17d64b4a 100644 --- a/docs/dd/dc5/classshaka_1_1media_1_1webm_1_1Segmenter.html +++ b/docs/dd/dc5/classshaka_1_1media_1_1webm_1_1Segmenter.html @@ -363,7 +363,7 @@ virtual Status&# diff --git a/docs/dd/dca/structshaka_1_1media_1_1mp4_1_1OriginalFormat-members.html b/docs/dd/dca/structshaka_1_1media_1_1mp4_1_1OriginalFormat-members.html index 0274f731f4..6de47ff8a0 100644 --- a/docs/dd/dca/structshaka_1_1media_1_1mp4_1_1OriginalFormat-members.html +++ b/docs/dd/dca/structshaka_1_1media_1_1mp4_1_1OriginalFormat-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/dd/dd2/buffer__writer_8h_source.html b/docs/dd/dd2/buffer__writer_8h_source.html index 92b110508f..8be456ac4c 100644 --- a/docs/dd/dd2/buffer__writer_8h_source.html +++ b/docs/dd/dd2/buffer__writer_8h_source.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/dd/dd3/buffer__writer_8cc_source.html b/docs/dd/dd3/buffer__writer_8cc_source.html index 9f512d2be2..a456f8a46f 100644 --- a/docs/dd/dd3/buffer__writer_8cc_source.html +++ b/docs/dd/dd3/buffer__writer_8cc_source.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/dd/dd6/classshaka_1_1media_1_1WebMVideoClient-members.html b/docs/dd/dd6/classshaka_1_1media_1_1WebMVideoClient-members.html index 603b22eaba..f8c19b7fdf 100644 --- a/docs/dd/dd6/classshaka_1_1media_1_1WebMVideoClient-members.html +++ b/docs/dd/dd6/classshaka_1_1media_1_1WebMVideoClient-members.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/dd/dd8/mock__muxer__listener_8cc_source.html b/docs/dd/dd8/mock__muxer__listener_8cc_source.html index 5264ec04cb..ff8341b67a 100644 --- a/docs/dd/dd8/mock__muxer__listener_8cc_source.html +++ b/docs/dd/dd8/mock__muxer__listener_8cc_source.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/dd/dd9/structshaka_1_1media_1_1mp4_1_1Box-members.html b/docs/dd/dd9/structshaka_1_1media_1_1mp4_1_1Box-members.html index 1156bbb304..703dabb43b 100644 --- a/docs/dd/dd9/structshaka_1_1media_1_1mp4_1_1Box-members.html +++ b/docs/dd/dd9/structshaka_1_1media_1_1mp4_1_1Box-members.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/dd/ddc/trick__play__handler_8h_source.html b/docs/dd/ddc/trick__play__handler_8h_source.html index 7335ed1fa3..c56b9b9501 100644 --- a/docs/dd/ddc/trick__play__handler_8h_source.html +++ b/docs/dd/ddc/trick__play__handler_8h_source.html @@ -68,14 +68,14 @@ $(function() {
        1 // Copyright 2017 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_BASE_TRICK_PLAY_HANDLER_H_
        8 #define PACKAGER_MEDIA_BASE_TRICK_PLAY_HANDLER_H_
        9 
        10 #include <list>
        11 
        12 #include "packager/media/base/media_handler.h"
        13 
        14 namespace shaka {
        15 namespace media {
        16 
        17 class VideoStreamInfo;
        18 
        22 // The stream data in trick play streams are not simple duplicates. Some
        23 // information get changed (e.g. VideoStreamInfo.trick_play_factor).
        25  public:
        26  explicit TrickPlayHandler(uint32_t factor);
        27 
        28  private:
        29  TrickPlayHandler(const TrickPlayHandler&) = delete;
        30  TrickPlayHandler& operator=(const TrickPlayHandler&) = delete;
        31 
        32  Status InitializeInternal() override;
        33  Status Process(std::unique_ptr<StreamData> stream_data) override;
        34  Status OnFlushRequest(size_t input_stream_index) override;
        35 
        36  Status OnStreamInfo(const StreamInfo& info);
        37  Status OnSegmentInfo(std::shared_ptr<const SegmentInfo> info);
        38  Status OnMediaSample(const MediaSample& sample);
        39  Status OnTrickFrame(const MediaSample& sample);
        40 
        41  const uint32_t factor_;
        42 
        43  uint64_t total_frames_ = 0;
        44  uint64_t total_key_frames_ = 0;
        45  uint64_t total_trick_frames_ = 0;
        46 
        47  // We cannot just send video info through as we need to calculate the play
        48  // rate using the first two trick play frames. This reference should only be
        49  // used to update the play back rate before video info is sent downstream.
        50  // After getting sent downstream, this should never be used.
        51  std::shared_ptr<VideoStreamInfo> video_info_;
        52 
        53  // We need to track the segment that most recently finished so that we can
        54  // extend its duration if there are empty segments.
        55  std::shared_ptr<SegmentInfo> previous_segment_;
        56 
        57  // Since we are dropping frames, the time that those frames would have been
        58  // on screen need to be added to the frame before them. Keep a reference to
        59  // the most recent trick play frame so that we can grow its duration as we
        60  // drop other frames.
        61  std::shared_ptr<MediaSample> previous_trick_frame_;
        62 
        63  // Since we cannot send messages downstream right away, keep a queue of
        64  // messages that need to be sent down. At the start, we use this to queue
        65  // messages until we can send out |video_info_|. To ensure messages are
        66  // kept in order, messages are only dispatched through this queue and never
        67  // directly.
        68  std::list<std::unique_ptr<StreamData>> delayed_messages_;
        69 };
        70 
        71 } // namespace media
        72 } // namespace shaka
        73 
        74 #endif // PACKAGER_MEDIA_BASE_TRICK_PLAY_HANDLER_H_
        Abstract class holds stream information.
        Definition: stream_info.h:59
        - +
        All the methods that are virtual are virtual for mocking.
        Class to hold a media sample.
        Definition: media_sample.h:22
        diff --git a/docs/dd/de1/period_8cc_source.html b/docs/dd/de1/period_8cc_source.html index fe0ecd517e..e9694f32ac 100644 --- a/docs/dd/de1/period_8cc_source.html +++ b/docs/dd/de1/period_8cc_source.html @@ -66,7 +66,7 @@ $(function() {
        period.cc
        -
        1 // Copyright 2017 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #include "packager/mpd/base/period.h"
        8 
        9 #include "packager/base/stl_util.h"
        10 #include "packager/mpd/base/adaptation_set.h"
        11 #include "packager/mpd/base/mpd_options.h"
        12 #include "packager/mpd/base/mpd_utils.h"
        13 #include "packager/mpd/base/xml/xml_node.h"
        14 
        15 namespace shaka {
        16 namespace {
        17 
        18 // The easiest way to check whether two protobufs are equal, is to compare the
        19 // serialized version.
        20 bool ProtectedContentEq(
        21  const MediaInfo::ProtectedContent& content_protection1,
        22  const MediaInfo::ProtectedContent& content_protection2) {
        23  return content_protection1.SerializeAsString() ==
        24  content_protection2.SerializeAsString();
        25 }
        26 
        27 std::set<std::string> GetUUIDs(
        28  const MediaInfo::ProtectedContent& protected_content) {
        29  std::set<std::string> uuids;
        30  for (const auto& entry : protected_content.content_protection_entry())
        31  uuids.insert(entry.uuid());
        32  return uuids;
        33 }
        34 
        35 } // namespace
        36 
        37 Period::Period(uint32_t period_id,
        38  double start_time_in_seconds,
        39  const MpdOptions& mpd_options,
        40  base::AtomicSequenceNumber* representation_counter)
        41  : id_(period_id),
        42  start_time_in_seconds_(start_time_in_seconds),
        43  mpd_options_(mpd_options),
        44  representation_counter_(representation_counter) {}
        45 
        47  const MediaInfo& media_info,
        48  bool content_protection_in_adaptation_set) {
        49  // AdaptationSets with the same key should only differ in ContentProtection,
        50  // which also means that if |content_protection_in_adaptation_set| is false,
        51  // there should be at most one entry in |adaptation_sets|.
        52  const std::string key = GetAdaptationSetKey(media_info);
        53  std::list<AdaptationSet*>& adaptation_sets = adaptation_set_list_map_[key];
        54  if (content_protection_in_adaptation_set) {
        55  for (AdaptationSet* adaptation_set : adaptation_sets) {
        56  if (protected_adaptation_set_map_.Match(*adaptation_set, media_info))
        57  return adaptation_set;
        58  }
        59  } else {
        60  if (!adaptation_sets.empty()) {
        61  DCHECK_EQ(adaptation_sets.size(), 1u);
        62  return adaptation_sets.front();
        63  }
        64  }
        65  // None of the adaptation sets match with the new content protection.
        66  // Need a new one.
        67  const std::string language = GetLanguage(media_info);
        68  std::unique_ptr<AdaptationSet> new_adaptation_set =
        69  NewAdaptationSet(language, mpd_options_, representation_counter_);
        70  if (!SetNewAdaptationSetAttributes(language, media_info, adaptation_sets,
        71  new_adaptation_set.get())) {
        72  return nullptr;
        73  }
        74 
        75  if (content_protection_in_adaptation_set &&
        76  media_info.has_protected_content()) {
        77  protected_adaptation_set_map_.Register(*new_adaptation_set, media_info);
        78  AddContentProtectionElements(media_info, new_adaptation_set.get());
        79 
        80  for (AdaptationSet* adaptation_set : adaptation_sets) {
        81  if (protected_adaptation_set_map_.Switchable(*adaptation_set,
        82  *new_adaptation_set)) {
        83  adaptation_set->AddAdaptationSetSwitching(new_adaptation_set.get());
        84  new_adaptation_set->AddAdaptationSetSwitching(adaptation_set);
        85  }
        86  }
        87  }
        88  AdaptationSet* adaptation_set_ptr = new_adaptation_set.get();
        89  adaptation_sets.push_back(adaptation_set_ptr);
        90  adaptation_sets_.emplace_back(std::move(new_adaptation_set));
        91  return adaptation_set_ptr;
        92 }
        93 
        94 xml::scoped_xml_ptr<xmlNode> Period::GetXml(bool output_period_duration) {
        95  adaptation_sets_.sort(
        96  [](const std::unique_ptr<AdaptationSet>& adaptation_set_a,
        97  const std::unique_ptr<AdaptationSet>& adaptation_set_b) {
        98  if (!adaptation_set_a->has_id())
        99  return false;
        100  if (!adaptation_set_b->has_id())
        101  return true;
        102  return adaptation_set_a->id() < adaptation_set_b->id();
        103  });
        104 
        105  xml::XmlNode period("Period");
        106 
        107  // Required for 'dynamic' MPDs.
        108  period.SetId(id_);
        109  // Iterate thru AdaptationSets and add them to one big Period element.
        110  for (const auto& adaptation_set : adaptation_sets_) {
        111  xml::scoped_xml_ptr<xmlNode> child(adaptation_set->GetXml());
        112  if (!child || !period.AddChild(std::move(child)))
        113  return nullptr;
        114  }
        115 
        116  if (output_period_duration) {
        117  period.SetStringAttribute("duration",
        118  SecondsToXmlDuration(duration_seconds_));
        119  } else if (mpd_options_.mpd_type == MpdType::kDynamic) {
        120  period.SetStringAttribute("start",
        121  SecondsToXmlDuration(start_time_in_seconds_));
        122  }
        123  return period.PassScopedPtr();
        124 }
        125 
        126 const std::list<AdaptationSet*> Period::GetAdaptationSets() const {
        127  std::list<AdaptationSet*> adaptation_sets;
        128  for (const auto& adaptation_set : adaptation_sets_) {
        129  adaptation_sets.push_back(adaptation_set.get());
        130  }
        131  return adaptation_sets;
        132 }
        133 
        134 std::unique_ptr<AdaptationSet> Period::NewAdaptationSet(
        135  const std::string& language,
        136  const MpdOptions& options,
        137  base::AtomicSequenceNumber* representation_counter) {
        138  return std::unique_ptr<AdaptationSet>(
        139  new AdaptationSet(language, options, representation_counter));
        140 }
        141 
        142 bool Period::SetNewAdaptationSetAttributes(
        143  const std::string& language,
        144  const MediaInfo& media_info,
        145  const std::list<AdaptationSet*>& adaptation_sets,
        146  AdaptationSet* new_adaptation_set) {
        147  if (!language.empty() && language == mpd_options_.mpd_params.default_language)
        148  new_adaptation_set->AddRole(AdaptationSet::kRoleMain);
        149 
        150  if (media_info.has_video_info()) {
        151  // Because 'language' is ignored for videos, |adaptation_sets| must have
        152  // all the video AdaptationSets.
        153  if (adaptation_sets.size() > 1) {
        154  new_adaptation_set->AddRole(AdaptationSet::kRoleMain);
        155  } else if (adaptation_sets.size() == 1) {
        156  (*adaptation_sets.begin())->AddRole(AdaptationSet::kRoleMain);
        157  new_adaptation_set->AddRole(AdaptationSet::kRoleMain);
        158  }
        159 
        160  if (media_info.video_info().has_playback_rate()) {
        161  const AdaptationSet* trick_play_reference_adaptation_set =
        162  FindOriginalAdaptationSetForTrickPlay(media_info);
        163  if (!trick_play_reference_adaptation_set) {
        164  LOG(ERROR) << "Failed to find original AdaptationSet for trick play.";
        165  return false;
        166  }
        167  new_adaptation_set->AddTrickPlayReference(
        168  trick_play_reference_adaptation_set);
        169  }
        170  } else if (media_info.has_text_info()) {
        171  // IOP requires all AdaptationSets to have (sub)segmentAlignment set to
        172  // true, so carelessly set it to true.
        173  // In practice it doesn't really make sense to adapt between text tracks.
        174  new_adaptation_set->ForceSetSegmentAlignment(true);
        175  }
        176  return true;
        177 }
        178 
        179 const AdaptationSet* Period::FindOriginalAdaptationSetForTrickPlay(
        180  const MediaInfo& media_info) {
        181  MediaInfo media_info_no_trickplay = media_info;
        182  media_info_no_trickplay.mutable_video_info()->clear_playback_rate();
        183 
        184  std::string key = GetAdaptationSetKey(media_info_no_trickplay);
        185  const std::list<AdaptationSet*>& adaptation_sets =
        186  adaptation_set_list_map_[key];
        187  for (AdaptationSet* adaptation_set : adaptation_sets) {
        188  if (protected_adaptation_set_map_.Match(*adaptation_set, media_info)) {
        189  return adaptation_set;
        190  }
        191  }
        192  return nullptr;
        193 }
        194 
        195 void Period::ProtectedAdaptationSetMap::Register(
        196  const AdaptationSet& adaptation_set,
        197  const MediaInfo& media_info) {
        198  DCHECK(!ContainsKey(protected_content_map_, &adaptation_set));
        199  protected_content_map_[&adaptation_set] = media_info.protected_content();
        200 }
        201 
        202 bool Period::ProtectedAdaptationSetMap::Match(
        203  const AdaptationSet& adaptation_set,
        204  const MediaInfo& media_info) {
        205  const auto protected_content_it =
        206  protected_content_map_.find(&adaptation_set);
        207  // If the AdaptationSet ID is not registered in the map, then it is clear
        208  // content.
        209  if (protected_content_it == protected_content_map_.end())
        210  return !media_info.has_protected_content();
        211  if (!media_info.has_protected_content())
        212  return false;
        213  return ProtectedContentEq(protected_content_it->second,
        214  media_info.protected_content());
        215 }
        216 
        217 bool Period::ProtectedAdaptationSetMap::Switchable(
        218  const AdaptationSet& adaptation_set_a,
        219  const AdaptationSet& adaptation_set_b) {
        220  const auto protected_content_it_a =
        221  protected_content_map_.find(&adaptation_set_a);
        222  const auto protected_content_it_b =
        223  protected_content_map_.find(&adaptation_set_b);
        224 
        225  if (protected_content_it_a == protected_content_map_.end())
        226  return protected_content_it_b == protected_content_map_.end();
        227  if (protected_content_it_b == protected_content_map_.end())
        228  return false;
        229  // Get all the UUIDs of the AdaptationSet. If another AdaptationSet has the
        230  // same UUIDs then those are switchable.
        231  return GetUUIDs(protected_content_it_a->second) ==
        232  GetUUIDs(protected_content_it_b->second);
        233 }
        234 
        235 } // namespace shaka
        std::string default_language
        Definition: mpd_params.h:56
        +
        1 // Copyright 2017 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #include "packager/mpd/base/period.h"
        8 
        9 #include "packager/base/stl_util.h"
        10 #include "packager/mpd/base/adaptation_set.h"
        11 #include "packager/mpd/base/mpd_options.h"
        12 #include "packager/mpd/base/mpd_utils.h"
        13 #include "packager/mpd/base/xml/xml_node.h"
        14 
        15 namespace shaka {
        16 namespace {
        17 
        18 // The easiest way to check whether two protobufs are equal, is to compare the
        19 // serialized version.
        20 bool ProtectedContentEq(
        21  const MediaInfo::ProtectedContent& content_protection1,
        22  const MediaInfo::ProtectedContent& content_protection2) {
        23  return content_protection1.SerializeAsString() ==
        24  content_protection2.SerializeAsString();
        25 }
        26 
        27 std::set<std::string> GetUUIDs(
        28  const MediaInfo::ProtectedContent& protected_content) {
        29  std::set<std::string> uuids;
        30  for (const auto& entry : protected_content.content_protection_entry())
        31  uuids.insert(entry.uuid());
        32  return uuids;
        33 }
        34 
        35 } // namespace
        36 
        37 Period::Period(uint32_t period_id,
        38  double start_time_in_seconds,
        39  const MpdOptions& mpd_options,
        40  base::AtomicSequenceNumber* representation_counter)
        41  : id_(period_id),
        42  start_time_in_seconds_(start_time_in_seconds),
        43  mpd_options_(mpd_options),
        44  representation_counter_(representation_counter) {}
        45 
        47  const MediaInfo& media_info,
        48  bool content_protection_in_adaptation_set) {
        49  // Set duration if it is not set. It may be updated later from duration
        50  // calculated from segments.
        51  if (duration_seconds_ == 0)
        52  duration_seconds_ = media_info.media_duration_seconds();
        53 
        54  // AdaptationSets with the same key should only differ in ContentProtection,
        55  // which also means that if |content_protection_in_adaptation_set| is false,
        56  // there should be at most one entry in |adaptation_sets|.
        57  const std::string key = GetAdaptationSetKey(media_info);
        58  std::list<AdaptationSet*>& adaptation_sets = adaptation_set_list_map_[key];
        59  if (content_protection_in_adaptation_set) {
        60  for (AdaptationSet* adaptation_set : adaptation_sets) {
        61  if (protected_adaptation_set_map_.Match(*adaptation_set, media_info))
        62  return adaptation_set;
        63  }
        64  } else {
        65  if (!adaptation_sets.empty()) {
        66  DCHECK_EQ(adaptation_sets.size(), 1u);
        67  return adaptation_sets.front();
        68  }
        69  }
        70  // None of the adaptation sets match with the new content protection.
        71  // Need a new one.
        72  const std::string language = GetLanguage(media_info);
        73  std::unique_ptr<AdaptationSet> new_adaptation_set =
        74  NewAdaptationSet(language, mpd_options_, representation_counter_);
        75  if (!SetNewAdaptationSetAttributes(language, media_info, adaptation_sets,
        76  new_adaptation_set.get())) {
        77  return nullptr;
        78  }
        79 
        80  if (content_protection_in_adaptation_set &&
        81  media_info.has_protected_content()) {
        82  protected_adaptation_set_map_.Register(*new_adaptation_set, media_info);
        83  AddContentProtectionElements(media_info, new_adaptation_set.get());
        84 
        85  for (AdaptationSet* adaptation_set : adaptation_sets) {
        86  if (protected_adaptation_set_map_.Switchable(*adaptation_set,
        87  *new_adaptation_set)) {
        88  adaptation_set->AddAdaptationSetSwitching(new_adaptation_set.get());
        89  new_adaptation_set->AddAdaptationSetSwitching(adaptation_set);
        90  }
        91  }
        92  }
        93  AdaptationSet* adaptation_set_ptr = new_adaptation_set.get();
        94  adaptation_sets.push_back(adaptation_set_ptr);
        95  adaptation_sets_.emplace_back(std::move(new_adaptation_set));
        96  return adaptation_set_ptr;
        97 }
        98 
        99 xml::scoped_xml_ptr<xmlNode> Period::GetXml(bool output_period_duration) {
        100  adaptation_sets_.sort(
        101  [](const std::unique_ptr<AdaptationSet>& adaptation_set_a,
        102  const std::unique_ptr<AdaptationSet>& adaptation_set_b) {
        103  if (!adaptation_set_a->has_id())
        104  return false;
        105  if (!adaptation_set_b->has_id())
        106  return true;
        107  return adaptation_set_a->id() < adaptation_set_b->id();
        108  });
        109 
        110  xml::XmlNode period("Period");
        111 
        112  // Required for 'dynamic' MPDs.
        113  period.SetId(id_);
        114  // Iterate thru AdaptationSets and add them to one big Period element.
        115  for (const auto& adaptation_set : adaptation_sets_) {
        116  xml::scoped_xml_ptr<xmlNode> child(adaptation_set->GetXml());
        117  if (!child || !period.AddChild(std::move(child)))
        118  return nullptr;
        119  }
        120 
        121  if (output_period_duration) {
        122  period.SetStringAttribute("duration",
        123  SecondsToXmlDuration(duration_seconds_));
        124  } else if (mpd_options_.mpd_type == MpdType::kDynamic) {
        125  period.SetStringAttribute("start",
        126  SecondsToXmlDuration(start_time_in_seconds_));
        127  }
        128  return period.PassScopedPtr();
        129 }
        130 
        131 const std::list<AdaptationSet*> Period::GetAdaptationSets() const {
        132  std::list<AdaptationSet*> adaptation_sets;
        133  for (const auto& adaptation_set : adaptation_sets_) {
        134  adaptation_sets.push_back(adaptation_set.get());
        135  }
        136  return adaptation_sets;
        137 }
        138 
        139 std::unique_ptr<AdaptationSet> Period::NewAdaptationSet(
        140  const std::string& language,
        141  const MpdOptions& options,
        142  base::AtomicSequenceNumber* representation_counter) {
        143  return std::unique_ptr<AdaptationSet>(
        144  new AdaptationSet(language, options, representation_counter));
        145 }
        146 
        147 bool Period::SetNewAdaptationSetAttributes(
        148  const std::string& language,
        149  const MediaInfo& media_info,
        150  const std::list<AdaptationSet*>& adaptation_sets,
        151  AdaptationSet* new_adaptation_set) {
        152  if (!language.empty() && language == mpd_options_.mpd_params.default_language)
        153  new_adaptation_set->AddRole(AdaptationSet::kRoleMain);
        154 
        155  if (media_info.has_video_info()) {
        156  // Because 'language' is ignored for videos, |adaptation_sets| must have
        157  // all the video AdaptationSets.
        158  if (adaptation_sets.size() > 1) {
        159  new_adaptation_set->AddRole(AdaptationSet::kRoleMain);
        160  } else if (adaptation_sets.size() == 1) {
        161  (*adaptation_sets.begin())->AddRole(AdaptationSet::kRoleMain);
        162  new_adaptation_set->AddRole(AdaptationSet::kRoleMain);
        163  }
        164 
        165  if (media_info.video_info().has_playback_rate()) {
        166  const AdaptationSet* trick_play_reference_adaptation_set =
        167  FindOriginalAdaptationSetForTrickPlay(media_info);
        168  if (!trick_play_reference_adaptation_set) {
        169  LOG(ERROR) << "Failed to find original AdaptationSet for trick play.";
        170  return false;
        171  }
        172  new_adaptation_set->AddTrickPlayReference(
        173  trick_play_reference_adaptation_set);
        174  }
        175  } else if (media_info.has_text_info()) {
        176  // IOP requires all AdaptationSets to have (sub)segmentAlignment set to
        177  // true, so carelessly set it to true.
        178  // In practice it doesn't really make sense to adapt between text tracks.
        179  new_adaptation_set->ForceSetSegmentAlignment(true);
        180  }
        181  return true;
        182 }
        183 
        184 const AdaptationSet* Period::FindOriginalAdaptationSetForTrickPlay(
        185  const MediaInfo& media_info) {
        186  MediaInfo media_info_no_trickplay = media_info;
        187  media_info_no_trickplay.mutable_video_info()->clear_playback_rate();
        188 
        189  std::string key = GetAdaptationSetKey(media_info_no_trickplay);
        190  const std::list<AdaptationSet*>& adaptation_sets =
        191  adaptation_set_list_map_[key];
        192  for (AdaptationSet* adaptation_set : adaptation_sets) {
        193  if (protected_adaptation_set_map_.Match(*adaptation_set, media_info)) {
        194  return adaptation_set;
        195  }
        196  }
        197  return nullptr;
        198 }
        199 
        200 void Period::ProtectedAdaptationSetMap::Register(
        201  const AdaptationSet& adaptation_set,
        202  const MediaInfo& media_info) {
        203  DCHECK(!ContainsKey(protected_content_map_, &adaptation_set));
        204  protected_content_map_[&adaptation_set] = media_info.protected_content();
        205 }
        206 
        207 bool Period::ProtectedAdaptationSetMap::Match(
        208  const AdaptationSet& adaptation_set,
        209  const MediaInfo& media_info) {
        210  const auto protected_content_it =
        211  protected_content_map_.find(&adaptation_set);
        212  // If the AdaptationSet ID is not registered in the map, then it is clear
        213  // content.
        214  if (protected_content_it == protected_content_map_.end())
        215  return !media_info.has_protected_content();
        216  if (!media_info.has_protected_content())
        217  return false;
        218  return ProtectedContentEq(protected_content_it->second,
        219  media_info.protected_content());
        220 }
        221 
        222 bool Period::ProtectedAdaptationSetMap::Switchable(
        223  const AdaptationSet& adaptation_set_a,
        224  const AdaptationSet& adaptation_set_b) {
        225  const auto protected_content_it_a =
        226  protected_content_map_.find(&adaptation_set_a);
        227  const auto protected_content_it_b =
        228  protected_content_map_.find(&adaptation_set_b);
        229 
        230  if (protected_content_it_a == protected_content_map_.end())
        231  return protected_content_it_b == protected_content_map_.end();
        232  if (protected_content_it_b == protected_content_map_.end())
        233  return false;
        234  // Get all the UUIDs of the AdaptationSet. If another AdaptationSet has the
        235  // same UUIDs then those are switchable.
        236  return GetUUIDs(protected_content_it_a->second) ==
        237  GetUUIDs(protected_content_it_b->second);
        238 }
        239 
        240 } // namespace shaka
        std::string default_language
        Definition: mpd_params.h:56
        virtual AdaptationSet * GetOrCreateAdaptationSet(const MediaInfo &media_info, bool content_protection_in_adaptation_set)
        Definition: period.cc:46
        @@ -75,18 +75,18 @@ $(function() {
        void SetStringAttribute(const char *attribute_name, const std::string &attribute)
        Definition: xml_node.cc:137
        bool AddChild(scoped_xml_ptr< xmlNode > child)
        Definition: xml_node.cc:95
        virtual void AddRole(Role role)
        -
        xml::scoped_xml_ptr< xmlNode > GetXml(bool output_period_duration)
        Definition: period.cc:94
        +
        xml::scoped_xml_ptr< xmlNode > GetXml(bool output_period_duration)
        Definition: period.cc:99
        void AddContentProtectionElements(const MediaInfo &media_info, Representation *parent)
        Definition: mpd_utils.cc:369
        void SetId(uint32_t id)
        Definition: xml_node.cc:160
        virtual void ForceSetSegmentAlignment(bool segment_alignment)
        -
        const std::list< AdaptationSet * > GetAdaptationSets() const
        Definition: period.cc:126
        +
        const std::list< AdaptationSet * > GetAdaptationSets() const
        Definition: period.cc:131
        Defines Mpd Options.
        Definition: mpd_options.h:25
        Period(uint32_t period_id, double start_time_in_seconds, const MpdOptions &mpd_options, base::AtomicSequenceNumber *representation_counter)
        Definition: period.cc:37
        virtual void AddTrickPlayReference(const AdaptationSet *adaptation_set)
        diff --git a/docs/dd/de4/classshaka_1_1media_1_1VideoSliceHeaderParser.html b/docs/dd/de4/classshaka_1_1media_1_1VideoSliceHeaderParser.html index e966ab8b1d..3888ae2525 100644 --- a/docs/dd/de4/classshaka_1_1media_1_1VideoSliceHeaderParser.html +++ b/docs/dd/de4/classshaka_1_1media_1_1VideoSliceHeaderParser.html @@ -128,7 +128,7 @@ virtual int64_t  diff --git a/docs/dd/de7/structshaka_1_1media_1_1H265Pps-members.html b/docs/dd/de7/structshaka_1_1media_1_1H265Pps-members.html index 681ac2b1f0..3567afbb09 100644 --- a/docs/dd/de7/structshaka_1_1media_1_1H265Pps-members.html +++ b/docs/dd/de7/structshaka_1_1media_1_1H265Pps-members.html @@ -113,7 +113,7 @@ $(function() {
        diff --git a/docs/dd/de7/xml__node_8h_source.html b/docs/dd/de7/xml__node_8h_source.html index f58085aab7..f03a83777a 100644 --- a/docs/dd/de7/xml__node_8h_source.html +++ b/docs/dd/de7/xml__node_8h_source.html @@ -87,7 +87,7 @@ $(function() { diff --git a/docs/dd/de9/classshaka_1_1media_1_1MediaHandler-members.html b/docs/dd/de9/classshaka_1_1media_1_1MediaHandler-members.html index a62df4634e..996eb24e4f 100644 --- a/docs/dd/de9/classshaka_1_1media_1_1MediaHandler-members.html +++ b/docs/dd/de9/classshaka_1_1media_1_1MediaHandler-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/docs/dd/de9/structshaka_1_1ChunkingParams-members.html b/docs/dd/de9/structshaka_1_1ChunkingParams-members.html index 4dd96b47fd..b83d7aad02 100644 --- a/docs/dd/de9/structshaka_1_1ChunkingParams-members.html +++ b/docs/dd/de9/structshaka_1_1ChunkingParams-members.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/dd/dee/box__definitions_8cc_source.html b/docs/dd/dee/box__definitions_8cc_source.html index 07939c2530..54506abfc3 100644 --- a/docs/dd/dee/box__definitions_8cc_source.html +++ b/docs/dd/dee/box__definitions_8cc_source.html @@ -66,117 +66,121 @@ $(function() {
        box_definitions.cc
        -
        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 #include "packager/media/formats/mp4/box_definitions.h"
        6 
        7 #include <limits>
        8 
        9 #include "packager/base/logging.h"
        10 #include "packager/media/base/bit_reader.h"
        11 #include "packager/media/base/macros.h"
        12 #include "packager/media/base/rcheck.h"
        13 #include "packager/media/formats/mp4/box_buffer.h"
        14 
        15 namespace {
        16 const uint32_t kFourCCSize = 4;
        17 
        18 // Key Id size as defined in CENC spec.
        19 const uint32_t kCencKeyIdSize = 16;
        20 
        21 // 9 uint32_t in big endian formatted array.
        22 const uint8_t kUnityMatrix[] = {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        23  0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
        24  0, 0, 0, 0, 0, 0, 0, 0, 0x40, 0, 0, 0};
        25 
        26 // Default entries for HandlerReference box.
        27 const char kVideoHandlerName[] = "VideoHandler";
        28 const char kAudioHandlerName[] = "SoundHandler";
        29 const char kTextHandlerName[] = "TextHandler";
        30 
        31 // Default values for VideoSampleEntry box.
        32 const uint32_t kVideoResolution = 0x00480000; // 72 dpi.
        33 const uint16_t kVideoFrameCount = 1;
        34 const uint16_t kVideoDepth = 0x0018;
        35 
        36 const uint32_t kCompressorNameSize = 32u;
        37 const char kAvcCompressorName[] = "\012AVC Coding";
        38 const char kHevcCompressorName[] = "\013HEVC Coding";
        39 const char kVpcCompressorName[] = "\012VPC Coding";
        40 
        41 // Using negative value as "not set". It is very unlikely that 2^31 cues happen
        42 // at once.
        43 const int kCueSourceIdNotSet = -1;
        44 
        45 const size_t kInvalidIvSize = 1;
        46 // According to ISO/IEC FDIS 23001-7: CENC spec, IV should be either
        47 // 64-bit (8-byte) or 128-bit (16-byte).
        48 // |per_sample_iv_size| of 0 means constant_iv is used.
        49 bool IsIvSizeValid(uint8_t per_sample_iv_size) {
        50  return per_sample_iv_size == 0 || per_sample_iv_size == 8 ||
        51  per_sample_iv_size == 16;
        52 }
        53 
        54 // Default values to construct the following fields in ddts box. Values are set
        55 // according to FFMPEG.
        56 // bit(2) FrameDuration; // 3 = 4096
        57 // bit(5) StreamConstruction; // 18
        58 // bit(1) CoreLFEPresent; // 0 = none
        59 // bit(6) CoreLayout; // 31 = ignore core layout
        60 // bit(14) CoreSize; // 0
        61 // bit(1) StereoDownmix // 0 = none
        62 // bit(3) RepresentationType; // 4
        63 // bit(16) ChannelLayout; // 0xf = 5.1 channel layout.
        64 // bit(1) MultiAssetFlag // 0 = single asset
        65 // bit(1) LBRDurationMod // 0 = ignore
        66 // bit(1) ReservedBoxPresent // 0 = none
        67 // bit(5) Reserved // 0
        68 const uint8_t kDdtsExtraData[] = {0xe4, 0x7c, 0, 4, 0, 0x0f, 0};
        69 
        70 // Utility functions to check if the 64bit integers can fit in 32bit integer.
        71 bool IsFitIn32Bits(uint64_t a) {
        72  return a <= std::numeric_limits<uint32_t>::max();
        73 }
        74 
        75 bool IsFitIn32Bits(int64_t a) {
        76  return a <= std::numeric_limits<int32_t>::max() &&
        77  a >= std::numeric_limits<int32_t>::min();
        78 }
        79 
        80 template <typename T1, typename T2>
        81 bool IsFitIn32Bits(T1 a1, T2 a2) {
        82  return IsFitIn32Bits(a1) && IsFitIn32Bits(a2);
        83 }
        84 
        85 template <typename T1, typename T2, typename T3>
        86 bool IsFitIn32Bits(T1 a1, T2 a2, T3 a3) {
        87  return IsFitIn32Bits(a1) && IsFitIn32Bits(a2) && IsFitIn32Bits(a3);
        88 }
        89 
        90 } // namespace
        91 
        92 namespace shaka {
        93 namespace media {
        94 namespace mp4 {
        95 
        96 namespace {
        97 
        98 TrackType FourCCToTrackType(FourCC fourcc) {
        99  switch (fourcc) {
        100  case FOURCC_vide:
        101  return kVideo;
        102  case FOURCC_soun:
        103  return kAudio;
        104  case FOURCC_text:
        105  return kText;
        106  default:
        107  return kInvalid;
        108  }
        109 }
        110 
        111 FourCC TrackTypeToFourCC(TrackType track_type) {
        112  switch (track_type) {
        113  case kVideo:
        114  return FOURCC_vide;
        115  case kAudio:
        116  return FOURCC_soun;
        117  case kText:
        118  return FOURCC_text;
        119  default:
        120  return FOURCC_NULL;
        121  }
        122 }
        123 
        124 bool IsProtectionSchemeSupported(FourCC scheme) {
        125  return scheme == FOURCC_cenc || scheme == FOURCC_cens ||
        126  scheme == FOURCC_cbc1 || scheme == FOURCC_cbcs;
        127 }
        128 
        129 } // namespace
        130 
        131 FileType::FileType() : major_brand(FOURCC_NULL), minor_version(0) {}
        132 FileType::~FileType() {}
        133 FourCC FileType::BoxType() const { return FOURCC_ftyp; }
        134 
        135 bool FileType::ReadWriteInternal(BoxBuffer* buffer) {
        136  RCHECK(ReadWriteHeaderInternal(buffer) &&
        137  buffer->ReadWriteFourCC(&major_brand) &&
        138  buffer->ReadWriteUInt32(&minor_version));
        139  size_t num_brands;
        140  if (buffer->Reading()) {
        141  RCHECK(buffer->BytesLeft() % sizeof(FourCC) == 0);
        142  num_brands = buffer->BytesLeft() / sizeof(FourCC);
        143  compatible_brands.resize(num_brands);
        144  } else {
        145  num_brands = compatible_brands.size();
        146  }
        147  for (size_t i = 0; i < num_brands; ++i)
        148  RCHECK(buffer->ReadWriteFourCC(&compatible_brands[i]));
        149  return true;
        150 }
        151 
        152 size_t FileType::ComputeSizeInternal() {
        153  return HeaderSize() + kFourCCSize + sizeof(minor_version) +
        154  kFourCCSize * compatible_brands.size();
        155 }
        156 
        157 FourCC SegmentType::BoxType() const { return FOURCC_styp; }
        158 
        159 ProtectionSystemSpecificHeader::ProtectionSystemSpecificHeader() {}
        160 ProtectionSystemSpecificHeader::~ProtectionSystemSpecificHeader() {}
        161 FourCC ProtectionSystemSpecificHeader::BoxType() const { return FOURCC_pssh; }
        162 
        163 bool ProtectionSystemSpecificHeader::ReadWriteInternal(BoxBuffer* buffer) {
        164  if (buffer->Reading()) {
        165  BoxReader* reader = buffer->reader();
        166  DCHECK(reader);
        167  raw_box.assign(reader->data(), reader->data() + reader->size());
        168  } else {
        169  DCHECK(!raw_box.empty());
        170  buffer->writer()->AppendVector(raw_box);
        171  }
        172 
        173  return true;
        174 }
        175 
        176 size_t ProtectionSystemSpecificHeader::ComputeSizeInternal() {
        177  return raw_box.size();
        178 }
        179 
        180 SampleAuxiliaryInformationOffset::SampleAuxiliaryInformationOffset() {}
        181 SampleAuxiliaryInformationOffset::~SampleAuxiliaryInformationOffset() {}
        182 FourCC SampleAuxiliaryInformationOffset::BoxType() const { return FOURCC_saio; }
        183 
        184 bool SampleAuxiliaryInformationOffset::ReadWriteInternal(BoxBuffer* buffer) {
        185  RCHECK(ReadWriteHeaderInternal(buffer));
        186  if (flags & 1)
        187  RCHECK(buffer->IgnoreBytes(8)); // aux_info_type and parameter.
        188 
        189  uint32_t count = static_cast<uint32_t>(offsets.size());
        190  RCHECK(buffer->ReadWriteUInt32(&count));
        191  offsets.resize(count);
        192 
        193  size_t num_bytes = (version == 1) ? sizeof(uint64_t) : sizeof(uint32_t);
        194  for (uint32_t i = 0; i < count; ++i)
        195  RCHECK(buffer->ReadWriteUInt64NBytes(&offsets[i], num_bytes));
        196  return true;
        197 }
        198 
        199 size_t SampleAuxiliaryInformationOffset::ComputeSizeInternal() {
        200  // This box is optional. Skip it if it is empty.
        201  if (offsets.size() == 0)
        202  return 0;
        203  size_t num_bytes = (version == 1) ? sizeof(uint64_t) : sizeof(uint32_t);
        204  return HeaderSize() + sizeof(uint32_t) + num_bytes * offsets.size();
        205 }
        206 
        207 SampleAuxiliaryInformationSize::SampleAuxiliaryInformationSize()
        208  : default_sample_info_size(0), sample_count(0) {}
        209 SampleAuxiliaryInformationSize::~SampleAuxiliaryInformationSize() {}
        210 FourCC SampleAuxiliaryInformationSize::BoxType() const { return FOURCC_saiz; }
        211 
        212 bool SampleAuxiliaryInformationSize::ReadWriteInternal(BoxBuffer* buffer) {
        213  RCHECK(ReadWriteHeaderInternal(buffer));
        214  if (flags & 1)
        215  RCHECK(buffer->IgnoreBytes(8));
        216 
        217  RCHECK(buffer->ReadWriteUInt8(&default_sample_info_size) &&
        218  buffer->ReadWriteUInt32(&sample_count));
        219  if (default_sample_info_size == 0)
        220  RCHECK(buffer->ReadWriteVector(&sample_info_sizes, sample_count));
        221  return true;
        222 }
        223 
        224 size_t SampleAuxiliaryInformationSize::ComputeSizeInternal() {
        225  // This box is optional. Skip it if it is empty.
        226  if (sample_count == 0)
        227  return 0;
        228  return HeaderSize() + sizeof(default_sample_info_size) +
        229  sizeof(sample_count) +
        230  (default_sample_info_size == 0 ? sample_info_sizes.size() : 0);
        231 }
        232 
        233 SampleEncryptionEntry::SampleEncryptionEntry() {}
        234 SampleEncryptionEntry::~SampleEncryptionEntry() {}
        235 
        236 bool SampleEncryptionEntry::ReadWrite(uint8_t iv_size,
        237  bool has_subsamples,
        238  BoxBuffer* buffer) {
        239  DCHECK(IsIvSizeValid(iv_size));
        240  DCHECK(buffer);
        241 
        242  RCHECK(buffer->ReadWriteVector(&initialization_vector, iv_size));
        243 
        244  if (!has_subsamples) {
        245  subsamples.clear();
        246  return true;
        247  }
        248 
        249  uint16_t subsample_count = static_cast<uint16_t>(subsamples.size());
        250  RCHECK(buffer->ReadWriteUInt16(&subsample_count));
        251  RCHECK(subsample_count > 0);
        252  subsamples.resize(subsample_count);
        253  for (auto& subsample : subsamples) {
        254  RCHECK(buffer->ReadWriteUInt16(&subsample.clear_bytes) &&
        255  buffer->ReadWriteUInt32(&subsample.cipher_bytes));
        256  }
        257  return true;
        258 }
        259 
        261  bool has_subsamples,
        262  BufferReader* reader) {
        263  DCHECK(IsIvSizeValid(iv_size));
        264  DCHECK(reader);
        265 
        266  initialization_vector.resize(iv_size);
        267  RCHECK(reader->ReadToVector(&initialization_vector, iv_size));
        268 
        269  if (!has_subsamples) {
        270  subsamples.clear();
        271  return true;
        272  }
        273 
        274  uint16_t subsample_count;
        275  RCHECK(reader->Read2(&subsample_count));
        276  RCHECK(subsample_count > 0);
        277  subsamples.resize(subsample_count);
        278  for (auto& subsample : subsamples) {
        279  RCHECK(reader->Read2(&subsample.clear_bytes) &&
        280  reader->Read4(&subsample.cipher_bytes));
        281  }
        282  return true;
        283 }
        284 
        286  const uint32_t subsample_entry_size = sizeof(uint16_t) + sizeof(uint32_t);
        287  const uint16_t subsample_count = static_cast<uint16_t>(subsamples.size());
        288  return static_cast<uint32_t>(
        289  initialization_vector.size() +
        290  (subsample_count > 0
        291  ? (sizeof(subsample_count) + subsample_entry_size * subsample_count)
        292  : 0));
        293 }
        294 
        296  uint32_t size = 0;
        297  for (uint32_t i = 0; i < subsamples.size(); ++i)
        298  size += subsamples[i].clear_bytes + subsamples[i].cipher_bytes;
        299  return size;
        300 }
        301 
        302 SampleEncryption::SampleEncryption() : iv_size(kInvalidIvSize) {}
        303 SampleEncryption::~SampleEncryption() {}
        304 FourCC SampleEncryption::BoxType() const { return FOURCC_senc; }
        305 
        306 bool SampleEncryption::ReadWriteInternal(BoxBuffer* buffer) {
        307  RCHECK(ReadWriteHeaderInternal(buffer));
        308 
        309  // If we don't know |iv_size|, store sample encryption data to parse later
        310  // after we know iv_size.
        311  if (buffer->Reading() && iv_size == kInvalidIvSize) {
        312  RCHECK(
        313  buffer->ReadWriteVector(&sample_encryption_data, buffer->BytesLeft()));
        314  return true;
        315  }
        316 
        317  if (!IsIvSizeValid(iv_size)) {
        318  LOG(ERROR)
        319  << "IV_size can only be 8 or 16 or 0 for constant iv, but seeing "
        320  << iv_size;
        321  return false;
        322  }
        323 
        324  uint32_t sample_count =
        325  static_cast<uint32_t>(sample_encryption_entries.size());
        326  RCHECK(buffer->ReadWriteUInt32(&sample_count));
        327 
        328  sample_encryption_entries.resize(sample_count);
        329  for (auto& sample_encryption_entry : sample_encryption_entries) {
        330  RCHECK(sample_encryption_entry.ReadWrite(
        331  iv_size, (flags & kUseSubsampleEncryption) != 0, buffer) != 0);
        332  }
        333  return true;
        334 }
        335 
        336 size_t SampleEncryption::ComputeSizeInternal() {
        337  const uint32_t sample_count =
        338  static_cast<uint32_t>(sample_encryption_entries.size());
        339  if (sample_count == 0) {
        340  // Sample encryption box is optional. Skip it if it is empty.
        341  return 0;
        342  }
        343 
        344  DCHECK(IsIvSizeValid(iv_size));
        345  size_t box_size = HeaderSize() + sizeof(sample_count);
        346  if (flags & kUseSubsampleEncryption) {
        347  for (const SampleEncryptionEntry& sample_encryption_entry :
        348  sample_encryption_entries) {
        349  box_size += sample_encryption_entry.ComputeSize();
        350  }
        351  } else {
        352  box_size += sample_count * iv_size;
        353  }
        354  return box_size;
        355 }
        356 
        358  uint8_t iv_size,
        359  std::vector<SampleEncryptionEntry>* sample_encryption_entries) const {
        360  DCHECK(IsIvSizeValid(iv_size));
        361 
        362  BufferReader reader(sample_encryption_data.data(),
        363  sample_encryption_data.size());
        364  uint32_t sample_count = 0;
        365  RCHECK(reader.Read4(&sample_count));
        366 
        367  sample_encryption_entries->resize(sample_count);
        368  for (auto& sample_encryption_entry : *sample_encryption_entries) {
        369  RCHECK(sample_encryption_entry.ParseFromBuffer(
        370  iv_size, (flags & kUseSubsampleEncryption) != 0, &reader) != 0);
        371  }
        372  return true;
        373 }
        374 
        375 OriginalFormat::OriginalFormat() : format(FOURCC_NULL) {}
        376 OriginalFormat::~OriginalFormat() {}
        377 FourCC OriginalFormat::BoxType() const { return FOURCC_frma; }
        378 
        379 bool OriginalFormat::ReadWriteInternal(BoxBuffer* buffer) {
        380  return ReadWriteHeaderInternal(buffer) && buffer->ReadWriteFourCC(&format);
        381 }
        382 
        383 size_t OriginalFormat::ComputeSizeInternal() {
        384  return HeaderSize() + kFourCCSize;
        385 }
        386 
        387 SchemeType::SchemeType() : type(FOURCC_NULL), version(0) {}
        388 SchemeType::~SchemeType() {}
        389 FourCC SchemeType::BoxType() const { return FOURCC_schm; }
        390 
        391 bool SchemeType::ReadWriteInternal(BoxBuffer* buffer) {
        392  RCHECK(ReadWriteHeaderInternal(buffer) &&
        393  buffer->ReadWriteFourCC(&type) &&
        394  buffer->ReadWriteUInt32(&version));
        395  return true;
        396 }
        397 
        398 size_t SchemeType::ComputeSizeInternal() {
        399  return HeaderSize() + kFourCCSize + sizeof(version);
        400 }
        401 
        402 TrackEncryption::TrackEncryption()
        403  : default_is_protected(0),
        404  default_per_sample_iv_size(0),
        405  default_kid(16, 0),
        406  default_crypt_byte_block(0),
        407  default_skip_byte_block(0) {}
        408 TrackEncryption::~TrackEncryption() {}
        409 FourCC TrackEncryption::BoxType() const { return FOURCC_tenc; }
        410 
        411 bool TrackEncryption::ReadWriteInternal(BoxBuffer* buffer) {
        412  if (!buffer->Reading()) {
        413  if (default_kid.size() != kCencKeyIdSize) {
        414  LOG(WARNING) << "CENC defines key id length of " << kCencKeyIdSize
        415  << " bytes; got " << default_kid.size()
        416  << ". Resized accordingly.";
        417  default_kid.resize(kCencKeyIdSize);
        418  }
        419  RCHECK(default_crypt_byte_block < 16 && default_skip_byte_block < 16);
        420  if (default_crypt_byte_block != 0 && default_skip_byte_block != 0) {
        421  // Version 1 box is needed for pattern-based encryption.
        422  version = 1;
        423  }
        424  }
        425 
        426  RCHECK(ReadWriteHeaderInternal(buffer) &&
        427  buffer->IgnoreBytes(1)); // reserved.
        428 
        429  uint8_t pattern = default_crypt_byte_block << 4 | default_skip_byte_block;
        430  RCHECK(buffer->ReadWriteUInt8(&pattern));
        431  default_crypt_byte_block = pattern >> 4;
        432  default_skip_byte_block = pattern & 0x0F;
        433 
        434  RCHECK(buffer->ReadWriteUInt8(&default_is_protected) &&
        435  buffer->ReadWriteUInt8(&default_per_sample_iv_size) &&
        436  buffer->ReadWriteVector(&default_kid, kCencKeyIdSize));
        437 
        438  if (default_is_protected == 1) {
        439  if (default_per_sample_iv_size == 0) { // For constant iv.
        440  uint8_t default_constant_iv_size =
        441  static_cast<uint8_t>(default_constant_iv.size());
        442  RCHECK(buffer->ReadWriteUInt8(&default_constant_iv_size));
        443  RCHECK(default_constant_iv_size == 8 || default_constant_iv_size == 16);
        444  RCHECK(buffer->ReadWriteVector(&default_constant_iv,
        445  default_constant_iv_size));
        446  } else {
        447  RCHECK(default_per_sample_iv_size == 8 ||
        448  default_per_sample_iv_size == 16);
        449  RCHECK(default_constant_iv.empty());
        450  }
        451  } else {
        452  // Expect |default_is_protected| to be 0, i.e. not protected. Other values
        453  // of |default_is_protected| is not supported.
        454  RCHECK(default_is_protected == 0);
        455  RCHECK(default_per_sample_iv_size == 0);
        456  RCHECK(default_constant_iv.empty());
        457  }
        458  return true;
        459 }
        460 
        461 size_t TrackEncryption::ComputeSizeInternal() {
        462  return HeaderSize() + sizeof(uint32_t) + kCencKeyIdSize +
        463  (default_constant_iv.empty() ? 0 : (sizeof(uint8_t) +
        464  default_constant_iv.size()));
        465 }
        466 
        467 SchemeInfo::SchemeInfo() {}
        468 SchemeInfo::~SchemeInfo() {}
        469 FourCC SchemeInfo::BoxType() const { return FOURCC_schi; }
        470 
        471 bool SchemeInfo::ReadWriteInternal(BoxBuffer* buffer) {
        472  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->PrepareChildren() &&
        473  buffer->ReadWriteChild(&track_encryption));
        474  return true;
        475 }
        476 
        477 size_t SchemeInfo::ComputeSizeInternal() {
        478  return HeaderSize() + track_encryption.ComputeSize();
        479 }
        480 
        481 ProtectionSchemeInfo::ProtectionSchemeInfo() {}
        482 ProtectionSchemeInfo::~ProtectionSchemeInfo() {}
        483 FourCC ProtectionSchemeInfo::BoxType() const { return FOURCC_sinf; }
        484 
        485 bool ProtectionSchemeInfo::ReadWriteInternal(BoxBuffer* buffer) {
        486  RCHECK(ReadWriteHeaderInternal(buffer) &&
        487  buffer->PrepareChildren() &&
        488  buffer->ReadWriteChild(&format) &&
        489  buffer->ReadWriteChild(&type));
        490  if (IsProtectionSchemeSupported(type.type)) {
        491  RCHECK(buffer->ReadWriteChild(&info));
        492  } else {
        493  DLOG(WARNING) << "Ignore unsupported protection scheme: "
        494  << FourCCToString(type.type);
        495  }
        496  // Other protection schemes are silently ignored. Since the protection scheme
        497  // type can't be determined until this box is opened, we return 'true' for
        498  // non-CENC protection scheme types. It is the parent box's responsibility to
        499  // ensure that this scheme type is a supported one.
        500  return true;
        501 }
        502 
        503 size_t ProtectionSchemeInfo::ComputeSizeInternal() {
        504  // Skip sinf box if it is not initialized.
        505  if (format.format == FOURCC_NULL)
        506  return 0;
        507  return HeaderSize() + format.ComputeSize() + type.ComputeSize() +
        508  info.ComputeSize();
        509 }
        510 
        511 MovieHeader::MovieHeader()
        512  : creation_time(0),
        513  modification_time(0),
        514  timescale(0),
        515  duration(0),
        516  rate(1 << 16),
        517  volume(1 << 8),
        518  next_track_id(0) {}
        519 MovieHeader::~MovieHeader() {}
        520 FourCC MovieHeader::BoxType() const { return FOURCC_mvhd; }
        521 
        522 bool MovieHeader::ReadWriteInternal(BoxBuffer* buffer) {
        523  RCHECK(ReadWriteHeaderInternal(buffer));
        524 
        525  size_t num_bytes = (version == 1) ? sizeof(uint64_t) : sizeof(uint32_t);
        526  RCHECK(buffer->ReadWriteUInt64NBytes(&creation_time, num_bytes) &&
        527  buffer->ReadWriteUInt64NBytes(&modification_time, num_bytes) &&
        528  buffer->ReadWriteUInt32(&timescale) &&
        529  buffer->ReadWriteUInt64NBytes(&duration, num_bytes));
        530 
        531  std::vector<uint8_t> matrix(kUnityMatrix,
        532  kUnityMatrix + arraysize(kUnityMatrix));
        533  RCHECK(buffer->ReadWriteInt32(&rate) &&
        534  buffer->ReadWriteInt16(&volume) &&
        535  buffer->IgnoreBytes(10) && // reserved
        536  buffer->ReadWriteVector(&matrix, matrix.size()) &&
        537  buffer->IgnoreBytes(24) && // predefined zero
        538  buffer->ReadWriteUInt32(&next_track_id));
        539  return true;
        540 }
        541 
        542 size_t MovieHeader::ComputeSizeInternal() {
        543  version = IsFitIn32Bits(creation_time, modification_time, duration) ? 0 : 1;
        544  return HeaderSize() + sizeof(uint32_t) * (1 + version) * 3 +
        545  sizeof(timescale) + sizeof(rate) + sizeof(volume) +
        546  sizeof(next_track_id) + sizeof(kUnityMatrix) + 10 +
        547  24; // 10 bytes reserved, 24 bytes predefined.
        548 }
        549 
        550 TrackHeader::TrackHeader()
        551  : creation_time(0),
        552  modification_time(0),
        553  track_id(0),
        554  duration(0),
        555  layer(0),
        556  alternate_group(0),
        557  volume(-1),
        558  width(0),
        559  height(0) {
        560  flags = kTrackEnabled | kTrackInMovie | kTrackInPreview;
        561 }
        562 TrackHeader::~TrackHeader() {}
        563 FourCC TrackHeader::BoxType() const { return FOURCC_tkhd; }
        564 
        565 bool TrackHeader::ReadWriteInternal(BoxBuffer* buffer) {
        566  RCHECK(ReadWriteHeaderInternal(buffer));
        567 
        568  size_t num_bytes = (version == 1) ? sizeof(uint64_t) : sizeof(uint32_t);
        569  RCHECK(buffer->ReadWriteUInt64NBytes(&creation_time, num_bytes) &&
        570  buffer->ReadWriteUInt64NBytes(&modification_time, num_bytes) &&
        571  buffer->ReadWriteUInt32(&track_id) &&
        572  buffer->IgnoreBytes(4) && // reserved
        573  buffer->ReadWriteUInt64NBytes(&duration, num_bytes));
        574 
        575  if (!buffer->Reading()) {
        576  // Set default value for volume, if track is audio, 0x100 else 0.
        577  if (volume == -1)
        578  volume = (width != 0 && height != 0) ? 0 : 0x100;
        579  }
        580  std::vector<uint8_t> matrix(kUnityMatrix,
        581  kUnityMatrix + arraysize(kUnityMatrix));
        582  RCHECK(buffer->IgnoreBytes(8) && // reserved
        583  buffer->ReadWriteInt16(&layer) &&
        584  buffer->ReadWriteInt16(&alternate_group) &&
        585  buffer->ReadWriteInt16(&volume) &&
        586  buffer->IgnoreBytes(2) && // reserved
        587  buffer->ReadWriteVector(&matrix, matrix.size()) &&
        588  buffer->ReadWriteUInt32(&width) &&
        589  buffer->ReadWriteUInt32(&height));
        590  return true;
        591 }
        592 
        593 size_t TrackHeader::ComputeSizeInternal() {
        594  version = IsFitIn32Bits(creation_time, modification_time, duration) ? 0 : 1;
        595  return HeaderSize() + sizeof(track_id) +
        596  sizeof(uint32_t) * (1 + version) * 3 + sizeof(layer) +
        597  sizeof(alternate_group) + sizeof(volume) + sizeof(width) +
        598  sizeof(height) + sizeof(kUnityMatrix) + 14; // 14 bytes reserved.
        599 }
        600 
        601 SampleDescription::SampleDescription() : type(kInvalid) {}
        602 SampleDescription::~SampleDescription() {}
        603 FourCC SampleDescription::BoxType() const { return FOURCC_stsd; }
        604 
        605 bool SampleDescription::ReadWriteInternal(BoxBuffer* buffer) {
        606  uint32_t count = 0;
        607  switch (type) {
        608  case kVideo:
        609  count = static_cast<uint32_t>(video_entries.size());
        610  break;
        611  case kAudio:
        612  count = static_cast<uint32_t>(audio_entries.size());
        613  break;
        614  case kText:
        615  count = static_cast<uint32_t>(text_entries.size());
        616  break;
        617  default:
        618  NOTIMPLEMENTED() << "SampleDecryption type " << type
        619  << " is not handled. Skipping.";
        620  }
        621  RCHECK(ReadWriteHeaderInternal(buffer) &&
        622  buffer->ReadWriteUInt32(&count));
        623 
        624  if (buffer->Reading()) {
        625  BoxReader* reader = buffer->reader();
        626  DCHECK(reader);
        627  video_entries.clear();
        628  audio_entries.clear();
        629  // Note: this value is preset before scanning begins. See comments in the
        630  // Parse(Media*) function.
        631  if (type == kVideo) {
        632  RCHECK(reader->ReadAllChildren(&video_entries));
        633  RCHECK(video_entries.size() == count);
        634  } else if (type == kAudio) {
        635  RCHECK(reader->ReadAllChildren(&audio_entries));
        636  RCHECK(audio_entries.size() == count);
        637  } else if (type == kText) {
        638  RCHECK(reader->ReadAllChildren(&text_entries));
        639  RCHECK(text_entries.size() == count);
        640  }
        641  } else {
        642  DCHECK_LT(0u, count);
        643  if (type == kVideo) {
        644  for (uint32_t i = 0; i < count; ++i)
        645  RCHECK(buffer->ReadWriteChild(&video_entries[i]));
        646  } else if (type == kAudio) {
        647  for (uint32_t i = 0; i < count; ++i)
        648  RCHECK(buffer->ReadWriteChild(&audio_entries[i]));
        649  } else if (type == kText) {
        650  for (uint32_t i = 0; i < count; ++i)
        651  RCHECK(buffer->ReadWriteChild(&text_entries[i]));
        652  } else {
        653  NOTIMPLEMENTED();
        654  }
        655  }
        656  return true;
        657 }
        658 
        659 size_t SampleDescription::ComputeSizeInternal() {
        660  size_t box_size = HeaderSize() + sizeof(uint32_t);
        661  if (type == kVideo) {
        662  for (uint32_t i = 0; i < video_entries.size(); ++i)
        663  box_size += video_entries[i].ComputeSize();
        664  } else if (type == kAudio) {
        665  for (uint32_t i = 0; i < audio_entries.size(); ++i)
        666  box_size += audio_entries[i].ComputeSize();
        667  } else if (type == kText) {
        668  for (uint32_t i = 0; i < text_entries.size(); ++i)
        669  box_size += text_entries[i].ComputeSize();
        670  }
        671  return box_size;
        672 }
        673 
        674 DecodingTimeToSample::DecodingTimeToSample() {}
        675 DecodingTimeToSample::~DecodingTimeToSample() {}
        676 FourCC DecodingTimeToSample::BoxType() const { return FOURCC_stts; }
        677 
        678 bool DecodingTimeToSample::ReadWriteInternal(BoxBuffer* buffer) {
        679  uint32_t count = static_cast<uint32_t>(decoding_time.size());
        680  RCHECK(ReadWriteHeaderInternal(buffer) &&
        681  buffer->ReadWriteUInt32(&count));
        682 
        683  decoding_time.resize(count);
        684  for (uint32_t i = 0; i < count; ++i) {
        685  RCHECK(buffer->ReadWriteUInt32(&decoding_time[i].sample_count) &&
        686  buffer->ReadWriteUInt32(&decoding_time[i].sample_delta));
        687  }
        688  return true;
        689 }
        690 
        691 size_t DecodingTimeToSample::ComputeSizeInternal() {
        692  return HeaderSize() + sizeof(uint32_t) +
        693  sizeof(DecodingTime) * decoding_time.size();
        694 }
        695 
        696 CompositionTimeToSample::CompositionTimeToSample() {}
        697 CompositionTimeToSample::~CompositionTimeToSample() {}
        698 FourCC CompositionTimeToSample::BoxType() const { return FOURCC_ctts; }
        699 
        700 bool CompositionTimeToSample::ReadWriteInternal(BoxBuffer* buffer) {
        701  uint32_t count = static_cast<uint32_t>(composition_offset.size());
        702  if (!buffer->Reading()) {
        703  // Determine whether version 0 or version 1 should be used.
        704  // Use version 0 if possible, use version 1 if there is a negative
        705  // sample_offset value.
        706  version = 0;
        707  for (uint32_t i = 0; i < count; ++i) {
        708  if (composition_offset[i].sample_offset < 0) {
        709  version = 1;
        710  break;
        711  }
        712  }
        713  }
        714 
        715  RCHECK(ReadWriteHeaderInternal(buffer) &&
        716  buffer->ReadWriteUInt32(&count));
        717 
        718  composition_offset.resize(count);
        719  for (uint32_t i = 0; i < count; ++i) {
        720  RCHECK(buffer->ReadWriteUInt32(&composition_offset[i].sample_count));
        721 
        722  if (version == 0) {
        723  uint32_t sample_offset = composition_offset[i].sample_offset;
        724  RCHECK(buffer->ReadWriteUInt32(&sample_offset));
        725  composition_offset[i].sample_offset = sample_offset;
        726  } else {
        727  int32_t sample_offset = composition_offset[i].sample_offset;
        728  RCHECK(buffer->ReadWriteInt32(&sample_offset));
        729  composition_offset[i].sample_offset = sample_offset;
        730  }
        731  }
        732  return true;
        733 }
        734 
        735 size_t CompositionTimeToSample::ComputeSizeInternal() {
        736  // This box is optional. Skip it if it is empty.
        737  if (composition_offset.empty())
        738  return 0;
        739  // Structure CompositionOffset contains |sample_offset| (uint32_t) and
        740  // |sample_offset| (int64_t). The actual size of |sample_offset| is
        741  // 4 bytes (uint32_t for version 0 and int32_t for version 1).
        742  const size_t kCompositionOffsetSize = sizeof(uint32_t) * 2;
        743  return HeaderSize() + sizeof(uint32_t) +
        744  kCompositionOffsetSize * composition_offset.size();
        745 }
        746 
        747 SampleToChunk::SampleToChunk() {}
        748 SampleToChunk::~SampleToChunk() {}
        749 FourCC SampleToChunk::BoxType() const { return FOURCC_stsc; }
        750 
        751 bool SampleToChunk::ReadWriteInternal(BoxBuffer* buffer) {
        752  uint32_t count = static_cast<uint32_t>(chunk_info.size());
        753  RCHECK(ReadWriteHeaderInternal(buffer) &&
        754  buffer->ReadWriteUInt32(&count));
        755 
        756  chunk_info.resize(count);
        757  for (uint32_t i = 0; i < count; ++i) {
        758  RCHECK(buffer->ReadWriteUInt32(&chunk_info[i].first_chunk) &&
        759  buffer->ReadWriteUInt32(&chunk_info[i].samples_per_chunk) &&
        760  buffer->ReadWriteUInt32(&chunk_info[i].sample_description_index));
        761  // first_chunk values are always increasing.
        762  RCHECK(i == 0 ? chunk_info[i].first_chunk == 1
        763  : chunk_info[i].first_chunk > chunk_info[i - 1].first_chunk);
        764  }
        765  return true;
        766 }
        767 
        768 size_t SampleToChunk::ComputeSizeInternal() {
        769  return HeaderSize() + sizeof(uint32_t) +
        770  sizeof(ChunkInfo) * chunk_info.size();
        771 }
        772 
        773 SampleSize::SampleSize() : sample_size(0), sample_count(0) {}
        774 SampleSize::~SampleSize() {}
        775 FourCC SampleSize::BoxType() const { return FOURCC_stsz; }
        776 
        777 bool SampleSize::ReadWriteInternal(BoxBuffer* buffer) {
        778  RCHECK(ReadWriteHeaderInternal(buffer) &&
        779  buffer->ReadWriteUInt32(&sample_size) &&
        780  buffer->ReadWriteUInt32(&sample_count));
        781 
        782  if (sample_size == 0) {
        783  if (buffer->Reading())
        784  sizes.resize(sample_count);
        785  else
        786  DCHECK(sample_count == sizes.size());
        787  for (uint32_t i = 0; i < sample_count; ++i)
        788  RCHECK(buffer->ReadWriteUInt32(&sizes[i]));
        789  }
        790  return true;
        791 }
        792 
        793 size_t SampleSize::ComputeSizeInternal() {
        794  return HeaderSize() + sizeof(sample_size) + sizeof(sample_count) +
        795  (sample_size == 0 ? sizeof(uint32_t) * sizes.size() : 0);
        796 }
        797 
        798 CompactSampleSize::CompactSampleSize() : field_size(0) {}
        799 CompactSampleSize::~CompactSampleSize() {}
        800 FourCC CompactSampleSize::BoxType() const { return FOURCC_stz2; }
        801 
        802 bool CompactSampleSize::ReadWriteInternal(BoxBuffer* buffer) {
        803  uint32_t sample_count = static_cast<uint32_t>(sizes.size());
        804  RCHECK(ReadWriteHeaderInternal(buffer) &&
        805  buffer->IgnoreBytes(3) &&
        806  buffer->ReadWriteUInt8(&field_size) &&
        807  buffer->ReadWriteUInt32(&sample_count));
        808 
        809  // Reserve one more entry if field size is 4 bits.
        810  sizes.resize(sample_count + (field_size == 4 ? 1 : 0), 0);
        811  switch (field_size) {
        812  case 4:
        813  for (uint32_t i = 0; i < sample_count; i += 2) {
        814  if (buffer->Reading()) {
        815  uint8_t size = 0;
        816  RCHECK(buffer->ReadWriteUInt8(&size));
        817  sizes[i] = size >> 4;
        818  sizes[i + 1] = size & 0x0F;
        819  } else {
        820  DCHECK_LT(sizes[i], 16u);
        821  DCHECK_LT(sizes[i + 1], 16u);
        822  uint8_t size = (sizes[i] << 4) | sizes[i + 1];
        823  RCHECK(buffer->ReadWriteUInt8(&size));
        824  }
        825  }
        826  break;
        827  case 8:
        828  for (uint32_t i = 0; i < sample_count; ++i) {
        829  uint8_t size = sizes[i];
        830  RCHECK(buffer->ReadWriteUInt8(&size));
        831  sizes[i] = size;
        832  }
        833  break;
        834  case 16:
        835  for (uint32_t i = 0; i < sample_count; ++i) {
        836  uint16_t size = sizes[i];
        837  RCHECK(buffer->ReadWriteUInt16(&size));
        838  sizes[i] = size;
        839  }
        840  break;
        841  default:
        842  RCHECK(false);
        843  }
        844  sizes.resize(sample_count);
        845  return true;
        846 }
        847 
        848 size_t CompactSampleSize::ComputeSizeInternal() {
        849  return HeaderSize() + sizeof(uint32_t) + sizeof(uint32_t) +
        850  (field_size * sizes.size() + 7) / 8;
        851 }
        852 
        853 ChunkOffset::ChunkOffset() {}
        854 ChunkOffset::~ChunkOffset() {}
        855 FourCC ChunkOffset::BoxType() const { return FOURCC_stco; }
        856 
        857 bool ChunkOffset::ReadWriteInternal(BoxBuffer* buffer) {
        858  uint32_t count = static_cast<uint32_t>(offsets.size());
        859  RCHECK(ReadWriteHeaderInternal(buffer) &&
        860  buffer->ReadWriteUInt32(&count));
        861 
        862  offsets.resize(count);
        863  for (uint32_t i = 0; i < count; ++i)
        864  RCHECK(buffer->ReadWriteUInt64NBytes(&offsets[i], sizeof(uint32_t)));
        865  return true;
        866 }
        867 
        868 size_t ChunkOffset::ComputeSizeInternal() {
        869  return HeaderSize() + sizeof(uint32_t) + sizeof(uint32_t) * offsets.size();
        870 }
        871 
        872 ChunkLargeOffset::ChunkLargeOffset() {}
        873 ChunkLargeOffset::~ChunkLargeOffset() {}
        874 FourCC ChunkLargeOffset::BoxType() const { return FOURCC_co64; }
        875 
        876 bool ChunkLargeOffset::ReadWriteInternal(BoxBuffer* buffer) {
        877  uint32_t count = static_cast<uint32_t>(offsets.size());
        878 
        879  if (!buffer->Reading()) {
        880  // Switch to ChunkOffset box if it is able to fit in 32 bits offset.
        881  if (count == 0 || IsFitIn32Bits(offsets[count - 1])) {
        882  ChunkOffset stco;
        883  stco.offsets.swap(offsets);
        884  DCHECK(buffer->writer());
        885  stco.Write(buffer->writer());
        886  stco.offsets.swap(offsets);
        887  return true;
        888  }
        889  }
        890 
        891  RCHECK(ReadWriteHeaderInternal(buffer) &&
        892  buffer->ReadWriteUInt32(&count));
        893 
        894  offsets.resize(count);
        895  for (uint32_t i = 0; i < count; ++i)
        896  RCHECK(buffer->ReadWriteUInt64(&offsets[i]));
        897  return true;
        898 }
        899 
        900 size_t ChunkLargeOffset::ComputeSizeInternal() {
        901  uint32_t count = static_cast<uint32_t>(offsets.size());
        902  int use_large_offset =
        903  (count > 0 && !IsFitIn32Bits(offsets[count - 1])) ? 1 : 0;
        904  return HeaderSize() + sizeof(count) +
        905  sizeof(uint32_t) * (1 + use_large_offset) * offsets.size();
        906 }
        907 
        908 SyncSample::SyncSample() {}
        909 SyncSample::~SyncSample() {}
        910 FourCC SyncSample::BoxType() const { return FOURCC_stss; }
        911 
        912 bool SyncSample::ReadWriteInternal(BoxBuffer* buffer) {
        913  uint32_t count = static_cast<uint32_t>(sample_number.size());
        914  RCHECK(ReadWriteHeaderInternal(buffer) &&
        915  buffer->ReadWriteUInt32(&count));
        916 
        917  sample_number.resize(count);
        918  for (uint32_t i = 0; i < count; ++i)
        919  RCHECK(buffer->ReadWriteUInt32(&sample_number[i]));
        920  return true;
        921 }
        922 
        923 size_t SyncSample::ComputeSizeInternal() {
        924  // Sync sample box is optional. Skip it if it is empty.
        925  if (sample_number.empty())
        926  return 0;
        927  return HeaderSize() + sizeof(uint32_t) +
        928  sizeof(uint32_t) * sample_number.size();
        929 }
        930 
        931 CencSampleEncryptionInfoEntry::CencSampleEncryptionInfoEntry()
        932  : is_protected(0),
        933  per_sample_iv_size(0),
        934  crypt_byte_block(0),
        935  skip_byte_block(0) {}
        936 CencSampleEncryptionInfoEntry::~CencSampleEncryptionInfoEntry() {};
        937 
        938 bool CencSampleEncryptionInfoEntry::ReadWrite(BoxBuffer* buffer) {
        939  if (!buffer->Reading()) {
        940  if (key_id.size() != kCencKeyIdSize) {
        941  LOG(WARNING) << "CENC defines key id length of " << kCencKeyIdSize
        942  << " bytes; got " << key_id.size()
        943  << ". Resized accordingly.";
        944  key_id.resize(kCencKeyIdSize);
        945  }
        946  RCHECK(crypt_byte_block < 16 && skip_byte_block < 16);
        947  }
        948 
        949  RCHECK(buffer->IgnoreBytes(1)); // reserved.
        950 
        951  uint8_t pattern = crypt_byte_block << 4 | skip_byte_block;
        952  RCHECK(buffer->ReadWriteUInt8(&pattern));
        953  crypt_byte_block = pattern >> 4;
        954  skip_byte_block = pattern & 0x0F;
        955 
        956  RCHECK(buffer->ReadWriteUInt8(&is_protected) &&
        957  buffer->ReadWriteUInt8(&per_sample_iv_size) &&
        958  buffer->ReadWriteVector(&key_id, kCencKeyIdSize));
        959 
        960  if (is_protected == 1) {
        961  if (per_sample_iv_size == 0) { // For constant iv.
        962  uint8_t constant_iv_size = static_cast<uint8_t>(constant_iv.size());
        963  RCHECK(buffer->ReadWriteUInt8(&constant_iv_size));
        964  RCHECK(constant_iv_size == 8 || constant_iv_size == 16);
        965  RCHECK(buffer->ReadWriteVector(&constant_iv, constant_iv_size));
        966  } else {
        967  RCHECK(per_sample_iv_size == 8 || per_sample_iv_size == 16);
        968  DCHECK(constant_iv.empty());
        969  }
        970  } else {
        971  // Expect |is_protected| to be 0, i.e. not protected. Other values of
        972  // |is_protected| is not supported.
        973  RCHECK(is_protected == 0);
        974  RCHECK(per_sample_iv_size == 0);
        975  }
        976  return true;
        977 }
        978 
        979 uint32_t CencSampleEncryptionInfoEntry::ComputeSize() const {
        980  return static_cast<uint32_t>(
        981  sizeof(uint32_t) + kCencKeyIdSize +
        982  (constant_iv.empty() ? 0 : (sizeof(uint8_t) + constant_iv.size())));
        983 }
        984 
        985 AudioRollRecoveryEntry::AudioRollRecoveryEntry(): roll_distance(0) {}
        986 AudioRollRecoveryEntry::~AudioRollRecoveryEntry() {}
        987 
        988 bool AudioRollRecoveryEntry::ReadWrite(BoxBuffer* buffer) {
        989  RCHECK(buffer->ReadWriteInt16(&roll_distance));
        990  return true;
        991 }
        992 
        993 uint32_t AudioRollRecoveryEntry::ComputeSize() const {
        994  return sizeof(roll_distance);
        995 }
        996 
        997 SampleGroupDescription::SampleGroupDescription() : grouping_type(0) {}
        998 SampleGroupDescription::~SampleGroupDescription() {}
        999 FourCC SampleGroupDescription::BoxType() const { return FOURCC_sgpd; }
        1000 
        1001 bool SampleGroupDescription::ReadWriteInternal(BoxBuffer* buffer) {
        1002  RCHECK(ReadWriteHeaderInternal(buffer) &&
        1003  buffer->ReadWriteUInt32(&grouping_type));
        1004 
        1005  switch (grouping_type) {
        1006  case FOURCC_seig:
        1007  return ReadWriteEntries(buffer, &cenc_sample_encryption_info_entries);
        1008  case FOURCC_roll:
        1009  return ReadWriteEntries(buffer, &audio_roll_recovery_entries);
        1010  default:
        1011  DCHECK(buffer->Reading());
        1012  DLOG(WARNING) << "Ignore unsupported sample group: "
        1013  << FourCCToString(static_cast<FourCC>(grouping_type));
        1014  return true;
        1015  }
        1016 }
        1017 
        1018 template <typename T>
        1019 bool SampleGroupDescription::ReadWriteEntries(BoxBuffer* buffer,
        1020  std::vector<T>* entries) {
        1021  uint32_t default_length = 0;
        1022  if (!buffer->Reading()) {
        1023  DCHECK(!entries->empty());
        1024  default_length = (*entries)[0].ComputeSize();
        1025  DCHECK_NE(default_length, 0u);
        1026  }
        1027  if (version == 1)
        1028  RCHECK(buffer->ReadWriteUInt32(&default_length));
        1029  if (version >= 2) {
        1030  NOTIMPLEMENTED() << "Unsupported SampleGroupDescriptionBox 'sgpd' version "
        1031  << static_cast<int>(version);
        1032  return false;
        1033  }
        1034 
        1035  uint32_t count = static_cast<uint32_t>(entries->size());
        1036  RCHECK(buffer->ReadWriteUInt32(&count));
        1037  RCHECK(count != 0);
        1038  entries->resize(count);
        1039 
        1040  for (T& entry : *entries) {
        1041  if (version == 1) {
        1042  uint32_t description_length = default_length;
        1043  if (buffer->Reading() && default_length == 0)
        1044  RCHECK(buffer->ReadWriteUInt32(&description_length));
        1045  RCHECK(entry.ReadWrite(buffer));
        1046  RCHECK(entry.ComputeSize() == description_length);
        1047  } else {
        1048  RCHECK(entry.ReadWrite(buffer));
        1049  }
        1050  }
        1051  return true;
        1052 }
        1053 
        1054 size_t SampleGroupDescription::ComputeSizeInternal() {
        1055  // Version 0 is obsoleted, so always generate version 1 box.
        1056  version = 1;
        1057  size_t entries_size = 0;
        1058  switch (grouping_type) {
        1059  case FOURCC_seig:
        1060  for (const auto& entry : cenc_sample_encryption_info_entries)
        1061  entries_size += entry.ComputeSize();
        1062  break;
        1063  case FOURCC_roll:
        1064  for (const auto& entry : audio_roll_recovery_entries)
        1065  entries_size += entry.ComputeSize();
        1066  break;
        1067  }
        1068  // This box is optional. Skip it if it is not used.
        1069  if (entries_size == 0)
        1070  return 0;
        1071  return HeaderSize() + sizeof(grouping_type) +
        1072  (version == 1 ? sizeof(uint32_t) : 0) + sizeof(uint32_t) +
        1073  entries_size;
        1074 }
        1075 
        1076 SampleToGroup::SampleToGroup() : grouping_type(0), grouping_type_parameter(0) {}
        1077 SampleToGroup::~SampleToGroup() {}
        1078 FourCC SampleToGroup::BoxType() const { return FOURCC_sbgp; }
        1079 
        1080 bool SampleToGroup::ReadWriteInternal(BoxBuffer* buffer) {
        1081  RCHECK(ReadWriteHeaderInternal(buffer) &&
        1082  buffer->ReadWriteUInt32(&grouping_type));
        1083  if (version == 1)
        1084  RCHECK(buffer->ReadWriteUInt32(&grouping_type_parameter));
        1085 
        1086  if (grouping_type != FOURCC_seig && grouping_type != FOURCC_roll) {
        1087  DCHECK(buffer->Reading());
        1088  DLOG(WARNING) << "Ignore unsupported sample group: "
        1089  << FourCCToString(static_cast<FourCC>(grouping_type));
        1090  return true;
        1091  }
        1092 
        1093  uint32_t count = static_cast<uint32_t>(entries.size());
        1094  RCHECK(buffer->ReadWriteUInt32(&count));
        1095  entries.resize(count);
        1096  for (uint32_t i = 0; i < count; ++i) {
        1097  RCHECK(buffer->ReadWriteUInt32(&entries[i].sample_count) &&
        1098  buffer->ReadWriteUInt32(&entries[i].group_description_index));
        1099  }
        1100  return true;
        1101 }
        1102 
        1103 size_t SampleToGroup::ComputeSizeInternal() {
        1104  // This box is optional. Skip it if it is not used.
        1105  if (entries.empty())
        1106  return 0;
        1107  return HeaderSize() + sizeof(grouping_type) +
        1108  (version == 1 ? sizeof(grouping_type_parameter) : 0) +
        1109  sizeof(uint32_t) + entries.size() * sizeof(entries[0]);
        1110 }
        1111 
        1112 SampleTable::SampleTable() {}
        1113 SampleTable::~SampleTable() {}
        1114 FourCC SampleTable::BoxType() const { return FOURCC_stbl; }
        1115 
        1116 bool SampleTable::ReadWriteInternal(BoxBuffer* buffer) {
        1117  RCHECK(ReadWriteHeaderInternal(buffer) &&
        1118  buffer->PrepareChildren() &&
        1119  buffer->ReadWriteChild(&description) &&
        1120  buffer->ReadWriteChild(&decoding_time_to_sample) &&
        1121  buffer->TryReadWriteChild(&composition_time_to_sample) &&
        1122  buffer->ReadWriteChild(&sample_to_chunk));
        1123 
        1124  if (buffer->Reading()) {
        1125  BoxReader* reader = buffer->reader();
        1126  DCHECK(reader);
        1127 
        1128  // Either SampleSize or CompactSampleSize must present.
        1129  if (reader->ChildExist(&sample_size)) {
        1130  RCHECK(reader->ReadChild(&sample_size));
        1131  } else {
        1132  CompactSampleSize compact_sample_size;
        1133  RCHECK(reader->ReadChild(&compact_sample_size));
        1134  sample_size.sample_size = 0;
        1135  sample_size.sample_count =
        1136  static_cast<uint32_t>(compact_sample_size.sizes.size());
        1137  sample_size.sizes.swap(compact_sample_size.sizes);
        1138  }
        1139 
        1140  // Either ChunkOffset or ChunkLargeOffset must present.
        1141  if (reader->ChildExist(&chunk_large_offset)) {
        1142  RCHECK(reader->ReadChild(&chunk_large_offset));
        1143  } else {
        1144  ChunkOffset chunk_offset;
        1145  RCHECK(reader->ReadChild(&chunk_offset));
        1146  chunk_large_offset.offsets.swap(chunk_offset.offsets);
        1147  }
        1148  } else {
        1149  RCHECK(buffer->ReadWriteChild(&sample_size) &&
        1150  buffer->ReadWriteChild(&chunk_large_offset));
        1151  }
        1152  RCHECK(buffer->TryReadWriteChild(&sync_sample));
        1153  if (buffer->Reading()) {
        1154  RCHECK(buffer->reader()->TryReadChildren(&sample_group_descriptions) &&
        1155  buffer->reader()->TryReadChildren(&sample_to_groups));
        1156  } else {
        1157  for (auto& sample_group_description : sample_group_descriptions)
        1158  RCHECK(buffer->ReadWriteChild(&sample_group_description));
        1159  for (auto& sample_to_group : sample_to_groups)
        1160  RCHECK(buffer->ReadWriteChild(&sample_to_group));
        1161  }
        1162  return true;
        1163 }
        1164 
        1165 size_t SampleTable::ComputeSizeInternal() {
        1166  size_t box_size = HeaderSize() + description.ComputeSize() +
        1167  decoding_time_to_sample.ComputeSize() +
        1168  composition_time_to_sample.ComputeSize() +
        1169  sample_to_chunk.ComputeSize() + sample_size.ComputeSize() +
        1170  chunk_large_offset.ComputeSize() +
        1171  sync_sample.ComputeSize();
        1172  for (auto& sample_group_description : sample_group_descriptions)
        1173  box_size += sample_group_description.ComputeSize();
        1174  for (auto& sample_to_group : sample_to_groups)
        1175  box_size += sample_to_group.ComputeSize();
        1176  return box_size;
        1177 }
        1178 
        1179 EditList::EditList() {}
        1180 EditList::~EditList() {}
        1181 FourCC EditList::BoxType() const { return FOURCC_elst; }
        1182 
        1183 bool EditList::ReadWriteInternal(BoxBuffer* buffer) {
        1184  uint32_t count = static_cast<uint32_t>(edits.size());
        1185  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->ReadWriteUInt32(&count));
        1186  edits.resize(count);
        1187 
        1188  size_t num_bytes = (version == 1) ? sizeof(uint64_t) : sizeof(uint32_t);
        1189  for (uint32_t i = 0; i < count; ++i) {
        1190  RCHECK(
        1191  buffer->ReadWriteUInt64NBytes(&edits[i].segment_duration, num_bytes) &&
        1192  buffer->ReadWriteInt64NBytes(&edits[i].media_time, num_bytes) &&
        1193  buffer->ReadWriteInt16(&edits[i].media_rate_integer) &&
        1194  buffer->ReadWriteInt16(&edits[i].media_rate_fraction));
        1195  }
        1196  return true;
        1197 }
        1198 
        1199 size_t EditList::ComputeSizeInternal() {
        1200  // EditList box is optional. Skip it if it is empty.
        1201  if (edits.empty())
        1202  return 0;
        1203 
        1204  version = 0;
        1205  for (uint32_t i = 0; i < edits.size(); ++i) {
        1206  if (!IsFitIn32Bits(edits[i].segment_duration, edits[i].media_time)) {
        1207  version = 1;
        1208  break;
        1209  }
        1210  }
        1211  return HeaderSize() + sizeof(uint32_t) +
        1212  (sizeof(uint32_t) * (1 + version) * 2 + sizeof(int16_t) * 2) *
        1213  edits.size();
        1214 }
        1215 
        1216 Edit::Edit() {}
        1217 Edit::~Edit() {}
        1218 FourCC Edit::BoxType() const { return FOURCC_edts; }
        1219 
        1220 bool Edit::ReadWriteInternal(BoxBuffer* buffer) {
        1221  return ReadWriteHeaderInternal(buffer) &&
        1222  buffer->PrepareChildren() &&
        1223  buffer->ReadWriteChild(&list);
        1224 }
        1225 
        1226 size_t Edit::ComputeSizeInternal() {
        1227  // Edit box is optional. Skip it if it is empty.
        1228  if (list.edits.empty())
        1229  return 0;
        1230  return HeaderSize() + list.ComputeSize();
        1231 }
        1232 
        1233 HandlerReference::HandlerReference() : handler_type(FOURCC_NULL) {}
        1234 HandlerReference::~HandlerReference() {}
        1235 FourCC HandlerReference::BoxType() const { return FOURCC_hdlr; }
        1236 
        1237 bool HandlerReference::ReadWriteInternal(BoxBuffer* buffer) {
        1238  std::vector<uint8_t> handler_name;
        1239  if (!buffer->Reading()) {
        1240  switch (handler_type) {
        1241  case FOURCC_vide:
        1242  handler_name.assign(kVideoHandlerName,
        1243  kVideoHandlerName + arraysize(kVideoHandlerName));
        1244  break;
        1245  case FOURCC_soun:
        1246  handler_name.assign(kAudioHandlerName,
        1247  kAudioHandlerName + arraysize(kAudioHandlerName));
        1248  break;
        1249  case FOURCC_text:
        1250  handler_name.assign(kTextHandlerName,
        1251  kTextHandlerName + arraysize(kTextHandlerName));
        1252  break;
        1253  case FOURCC_ID32:
        1254  break;
        1255  default:
        1256  NOTIMPLEMENTED();
        1257  return false;
        1258  }
        1259  }
        1260  RCHECK(ReadWriteHeaderInternal(buffer) &&
        1261  buffer->IgnoreBytes(4) && // predefined.
        1262  buffer->ReadWriteFourCC(&handler_type));
        1263  if (!buffer->Reading()) {
        1264  RCHECK(buffer->IgnoreBytes(12) && // reserved.
        1265  buffer->ReadWriteVector(&handler_name, handler_name.size()));
        1266  }
        1267  return true;
        1268 }
        1269 
        1270 size_t HandlerReference::ComputeSizeInternal() {
        1271  size_t box_size = HeaderSize() + kFourCCSize + 16; // 16 bytes Reserved
        1272  switch (handler_type) {
        1273  case FOURCC_vide:
        1274  box_size += sizeof(kVideoHandlerName);
        1275  break;
        1276  case FOURCC_soun:
        1277  box_size += sizeof(kAudioHandlerName);
        1278  break;
        1279  case FOURCC_text:
        1280  box_size += sizeof(kTextHandlerName);
        1281  break;
        1282  case FOURCC_ID32:
        1283  break;
        1284  default:
        1285  NOTIMPLEMENTED();
        1286  }
        1287  return box_size;
        1288 }
        1289 
        1290 bool Language::ReadWrite(BoxBuffer* buffer) {
        1291  if (buffer->Reading()) {
        1292  // Read language codes into temp first then use BitReader to read the
        1293  // values. ISO-639-2/T language code: unsigned int(5)[3] language (2 bytes).
        1294  std::vector<uint8_t> temp;
        1295  RCHECK(buffer->ReadWriteVector(&temp, 2));
        1296 
        1297  BitReader bit_reader(&temp[0], 2);
        1298  bit_reader.SkipBits(1);
        1299  char language[3];
        1300  for (int i = 0; i < 3; ++i) {
        1301  CHECK(bit_reader.ReadBits(5, &language[i]));
        1302  language[i] += 0x60;
        1303  }
        1304  code.assign(language, 3);
        1305  } else {
        1306  // Set up default language if it is not set.
        1307  const char kUndefinedLanguage[] = "und";
        1308  if (code.empty())
        1309  code = kUndefinedLanguage;
        1310  DCHECK_EQ(code.size(), 3u);
        1311 
        1312  // Lang format: bit(1) pad, unsigned int(5)[3] language.
        1313  uint16_t lang = 0;
        1314  for (int i = 0; i < 3; ++i)
        1315  lang |= (code[i] - 0x60) << ((2 - i) * 5);
        1316  RCHECK(buffer->ReadWriteUInt16(&lang));
        1317  }
        1318  return true;
        1319 }
        1320 
        1321 uint32_t Language::ComputeSize() const {
        1322  // ISO-639-2/T language code: unsigned int(5)[3] language (2 bytes).
        1323  return 2;
        1324 }
        1325 
        1326 ID3v2::ID3v2() {}
        1327 ID3v2::~ID3v2() {}
        1328 
        1329 FourCC ID3v2::BoxType() const { return FOURCC_ID32; }
        1330 
        1331 bool ID3v2::ReadWriteInternal(BoxBuffer* buffer) {
        1332  RCHECK(ReadWriteHeaderInternal(buffer) && language.ReadWrite(buffer) &&
        1333  buffer->ReadWriteVector(&id3v2_data, buffer->Reading()
        1334  ? buffer->BytesLeft()
        1335  : id3v2_data.size()));
        1336  return true;
        1337 }
        1338 
        1339 size_t ID3v2::ComputeSizeInternal() {
        1340  // Skip ID3v2 box generation if there is no id3 data.
        1341  return id3v2_data.size() == 0
        1342  ? 0
        1343  : HeaderSize() + language.ComputeSize() + id3v2_data.size();
        1344 }
        1345 
        1346 Metadata::Metadata() {}
        1347 Metadata::~Metadata() {}
        1348 
        1349 FourCC Metadata::BoxType() const {
        1350  return FOURCC_meta;
        1351 }
        1352 
        1353 bool Metadata::ReadWriteInternal(BoxBuffer* buffer) {
        1354  RCHECK(ReadWriteHeaderInternal(buffer) &&
        1355  buffer->PrepareChildren() &&
        1356  buffer->ReadWriteChild(&handler) &&
        1357  buffer->TryReadWriteChild(&id3v2));
        1358  return true;
        1359 }
        1360 
        1361 size_t Metadata::ComputeSizeInternal() {
        1362  size_t id3v2_size = id3v2.ComputeSize();
        1363  // Skip metadata box generation if there is no metadata box.
        1364  return id3v2_size == 0 ? 0
        1365  : HeaderSize() + handler.ComputeSize() + id3v2_size;
        1366 }
        1367 
        1368 CodecConfiguration::CodecConfiguration() : box_type(FOURCC_NULL) {}
        1369 CodecConfiguration::~CodecConfiguration() {}
        1370 
        1372  // CodecConfiguration box should be parsed according to format recovered in
        1373  // VideoSampleEntry. |box_type| is determined dynamically there.
        1374  return box_type;
        1375 }
        1376 
        1377 bool CodecConfiguration::ReadWriteInternal(BoxBuffer* buffer) {
        1378  DCHECK_NE(box_type, FOURCC_NULL);
        1379  RCHECK(ReadWriteHeaderInternal(buffer));
        1380 
        1381  // VPCodecConfiguration box inherits from FullBox instead of Box. The extra 4
        1382  // bytes are handled here.
        1383  if (box_type == FOURCC_vpcC) {
        1384  // Only version 1 box is supported.
        1385  uint8_t vpcc_version = 1;
        1386  uint32_t version_flags = vpcc_version << 24;
        1387  RCHECK(buffer->ReadWriteUInt32(&version_flags));
        1388  vpcc_version = version_flags >> 24;
        1389  RCHECK(vpcc_version == 1);
        1390  }
        1391 
        1392  if (buffer->Reading()) {
        1393  RCHECK(buffer->ReadWriteVector(&data, buffer->BytesLeft()));
        1394  } else {
        1395  RCHECK(buffer->ReadWriteVector(&data, data.size()));
        1396  }
        1397  return true;
        1398 }
        1399 
        1400 size_t CodecConfiguration::ComputeSizeInternal() {
        1401  if (data.empty())
        1402  return 0;
        1403  DCHECK_NE(box_type, FOURCC_NULL);
        1404  return HeaderSize() + (box_type == FOURCC_vpcC ? 4 : 0) + data.size();
        1405 }
        1406 
        1407 PixelAspectRatio::PixelAspectRatio() : h_spacing(0), v_spacing(0) {}
        1408 PixelAspectRatio::~PixelAspectRatio() {}
        1409 FourCC PixelAspectRatio::BoxType() const { return FOURCC_pasp; }
        1410 
        1411 bool PixelAspectRatio::ReadWriteInternal(BoxBuffer* buffer) {
        1412  RCHECK(ReadWriteHeaderInternal(buffer) &&
        1413  buffer->ReadWriteUInt32(&h_spacing) &&
        1414  buffer->ReadWriteUInt32(&v_spacing));
        1415  return true;
        1416 }
        1417 
        1418 size_t PixelAspectRatio::ComputeSizeInternal() {
        1419  // This box is optional. Skip it if it is not initialized.
        1420  if (h_spacing == 0 && v_spacing == 0)
        1421  return 0;
        1422  // Both values must be positive.
        1423  DCHECK(h_spacing != 0 && v_spacing != 0);
        1424  return HeaderSize() + sizeof(h_spacing) + sizeof(v_spacing);
        1425 }
        1426 
        1427 VideoSampleEntry::VideoSampleEntry()
        1428  : format(FOURCC_NULL), data_reference_index(1), width(0), height(0) {}
        1429 
        1430 VideoSampleEntry::~VideoSampleEntry() {}
        1432  if (format == FOURCC_NULL) {
        1433  LOG(ERROR) << "VideoSampleEntry should be parsed according to the "
        1434  << "handler type recovered in its Media ancestor.";
        1435  }
        1436  return format;
        1437 }
        1438 
        1439 bool VideoSampleEntry::ReadWriteInternal(BoxBuffer* buffer) {
        1440  std::vector<uint8_t> compressor_name;
        1441  if (buffer->Reading()) {
        1442  DCHECK(buffer->reader());
        1443  format = buffer->reader()->type();
        1444  } else {
        1445  RCHECK(ReadWriteHeaderInternal(buffer));
        1446 
        1447  const FourCC actual_format = GetActualFormat();
        1448  switch (actual_format) {
        1449  case FOURCC_avc1:
        1450  case FOURCC_avc3:
        1451  compressor_name.assign(
        1452  kAvcCompressorName,
        1453  kAvcCompressorName + arraysize(kAvcCompressorName));
        1454  break;
        1455  case FOURCC_hev1:
        1456  case FOURCC_hvc1:
        1457  compressor_name.assign(
        1458  kHevcCompressorName,
        1459  kHevcCompressorName + arraysize(kHevcCompressorName));
        1460  break;
        1461  case FOURCC_vp08:
        1462  case FOURCC_vp09:
        1463  case FOURCC_vp10:
        1464  compressor_name.assign(
        1465  kVpcCompressorName,
        1466  kVpcCompressorName + arraysize(kVpcCompressorName));
        1467  break;
        1468  default:
        1469  LOG(ERROR) << FourCCToString(actual_format) << " is not supported.";
        1470  return false;
        1471  }
        1472  compressor_name.resize(kCompressorNameSize);
        1473  }
        1474 
        1475  uint32_t video_resolution = kVideoResolution;
        1476  uint16_t video_frame_count = kVideoFrameCount;
        1477  uint16_t video_depth = kVideoDepth;
        1478  int16_t predefined = -1;
        1479  RCHECK(buffer->IgnoreBytes(6) && // reserved.
        1480  buffer->ReadWriteUInt16(&data_reference_index) &&
        1481  buffer->IgnoreBytes(16) && // predefined 0.
        1482  buffer->ReadWriteUInt16(&width) &&
        1483  buffer->ReadWriteUInt16(&height) &&
        1484  buffer->ReadWriteUInt32(&video_resolution) &&
        1485  buffer->ReadWriteUInt32(&video_resolution) &&
        1486  buffer->IgnoreBytes(4) && // reserved.
        1487  buffer->ReadWriteUInt16(&video_frame_count) &&
        1488  buffer->ReadWriteVector(&compressor_name, kCompressorNameSize) &&
        1489  buffer->ReadWriteUInt16(&video_depth) &&
        1490  buffer->ReadWriteInt16(&predefined));
        1491 
        1492  RCHECK(buffer->PrepareChildren());
        1493 
        1494  // This has to happen before reading codec configuration box as the actual
        1495  // format is read from sinf.format.format, which is needed to parse the codec
        1496  // configuration box.
        1497  if (format == FOURCC_encv && buffer->Reading()) {
        1498  // Continue scanning until a supported protection scheme is found, or
        1499  // until we run out of protection schemes.
        1500  while (!IsProtectionSchemeSupported(sinf.type.type))
        1501  RCHECK(buffer->ReadWriteChild(&sinf));
        1502  }
        1503 
        1504  const FourCC actual_format = GetActualFormat();
        1505  if (buffer->Reading()) {
        1506  codec_configuration.box_type = GetCodecConfigurationBoxType(actual_format);
        1507  } else {
        1508  DCHECK_EQ(codec_configuration.box_type,
        1509  GetCodecConfigurationBoxType(actual_format));
        1510  }
        1511  if (codec_configuration.box_type == FOURCC_NULL)
        1512  return false;
        1513 
        1514  RCHECK(buffer->ReadWriteChild(&codec_configuration));
        1515  RCHECK(buffer->TryReadWriteChild(&pixel_aspect));
        1516 
        1517  // Somehow Edge does not support having sinf box before codec_configuration,
        1518  // box, so just do it in the end of VideoSampleEntry. See
        1519  // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12658991/
        1520  if (format == FOURCC_encv && !buffer->Reading()) {
        1521  DCHECK(IsProtectionSchemeSupported(sinf.type.type));
        1522  RCHECK(buffer->ReadWriteChild(&sinf));
        1523  }
        1524  return true;
        1525 }
        1526 
        1527 size_t VideoSampleEntry::ComputeSizeInternal() {
        1528  const FourCC actual_format = GetActualFormat();
        1529  if (actual_format == FOURCC_NULL)
        1530  return 0;
        1531  codec_configuration.box_type = GetCodecConfigurationBoxType(actual_format);
        1532  DCHECK_NE(codec_configuration.box_type, FOURCC_NULL);
        1533  return HeaderSize() + sizeof(data_reference_index) + sizeof(width) +
        1534  sizeof(height) + sizeof(kVideoResolution) * 2 +
        1535  sizeof(kVideoFrameCount) + sizeof(kVideoDepth) +
        1536  pixel_aspect.ComputeSize() + sinf.ComputeSize() +
        1537  codec_configuration.ComputeSize() + kCompressorNameSize + 6 + 4 + 16 +
        1538  2; // 6 + 4 bytes reserved, 16 + 2 bytes predefined.
        1539 }
        1540 
        1541 FourCC VideoSampleEntry::GetCodecConfigurationBoxType(FourCC format) const {
        1542  switch (format) {
        1543  case FOURCC_avc1:
        1544  case FOURCC_avc3:
        1545  return FOURCC_avcC;
        1546  case FOURCC_hev1:
        1547  case FOURCC_hvc1:
        1548  return FOURCC_hvcC;
        1549  case FOURCC_vp08:
        1550  case FOURCC_vp09:
        1551  case FOURCC_vp10:
        1552  return FOURCC_vpcC;
        1553  default:
        1554  LOG(ERROR) << FourCCToString(format) << " is not supported.";
        1555  return FOURCC_NULL;
        1556  }
        1557 }
        1558 
        1559 ElementaryStreamDescriptor::ElementaryStreamDescriptor() {}
        1560 ElementaryStreamDescriptor::~ElementaryStreamDescriptor() {}
        1561 FourCC ElementaryStreamDescriptor::BoxType() const { return FOURCC_esds; }
        1562 
        1563 bool ElementaryStreamDescriptor::ReadWriteInternal(BoxBuffer* buffer) {
        1564  RCHECK(ReadWriteHeaderInternal(buffer));
        1565  if (buffer->Reading()) {
        1566  std::vector<uint8_t> data;
        1567  RCHECK(buffer->ReadWriteVector(&data, buffer->BytesLeft()));
        1568  RCHECK(es_descriptor.Parse(data));
        1569  if (es_descriptor.IsAAC()) {
        1570  RCHECK(aac_audio_specific_config.Parse(
        1571  es_descriptor.decoder_specific_info()));
        1572  }
        1573  } else {
        1574  DCHECK(buffer->writer());
        1575  es_descriptor.Write(buffer->writer());
        1576  }
        1577  return true;
        1578 }
        1579 
        1580 size_t ElementaryStreamDescriptor::ComputeSizeInternal() {
        1581  // This box is optional. Skip it if not initialized.
        1582  if (es_descriptor.object_type() == ObjectType::kForbidden)
        1583  return 0;
        1584  return HeaderSize() + es_descriptor.ComputeSize();
        1585 }
        1586 
        1587 DTSSpecific::DTSSpecific()
        1588  : sampling_frequency(0),
        1589  max_bitrate(0),
        1590  avg_bitrate(0),
        1591  pcm_sample_depth(0) {}
        1592 DTSSpecific::~DTSSpecific() {}
        1593 FourCC DTSSpecific::BoxType() const { return FOURCC_ddts; }
        1594 
        1595 bool DTSSpecific::ReadWriteInternal(BoxBuffer* buffer) {
        1596  RCHECK(ReadWriteHeaderInternal(buffer) &&
        1597  buffer->ReadWriteUInt32(&sampling_frequency) &&
        1598  buffer->ReadWriteUInt32(&max_bitrate) &&
        1599  buffer->ReadWriteUInt32(&avg_bitrate) &&
        1600  buffer->ReadWriteUInt8(&pcm_sample_depth));
        1601 
        1602  if (buffer->Reading()) {
        1603  RCHECK(buffer->ReadWriteVector(&extra_data, buffer->BytesLeft()));
        1604  } else {
        1605  if (extra_data.empty()) {
        1606  extra_data.assign(kDdtsExtraData,
        1607  kDdtsExtraData + sizeof(kDdtsExtraData));
        1608  }
        1609  RCHECK(buffer->ReadWriteVector(&extra_data, extra_data.size()));
        1610  }
        1611  return true;
        1612 }
        1613 
        1614 size_t DTSSpecific::ComputeSizeInternal() {
        1615  // This box is optional. Skip it if not initialized.
        1616  if (sampling_frequency == 0)
        1617  return 0;
        1618  return HeaderSize() + sizeof(sampling_frequency) + sizeof(max_bitrate) +
        1619  sizeof(avg_bitrate) + sizeof(pcm_sample_depth) +
        1620  sizeof(kDdtsExtraData);
        1621 }
        1622 
        1623 AC3Specific::AC3Specific() {}
        1624 AC3Specific::~AC3Specific() {}
        1625 
        1626 FourCC AC3Specific::BoxType() const { return FOURCC_dac3; }
        1627 
        1628 bool AC3Specific::ReadWriteInternal(BoxBuffer* buffer) {
        1629  RCHECK(ReadWriteHeaderInternal(buffer) &&
        1630  buffer->ReadWriteVector(
        1631  &data, buffer->Reading() ? buffer->BytesLeft() : data.size()));
        1632  return true;
        1633 }
        1634 
        1635 size_t AC3Specific::ComputeSizeInternal() {
        1636  // This box is optional. Skip it if not initialized.
        1637  if (data.empty())
        1638  return 0;
        1639  return HeaderSize() + data.size();
        1640 }
        1641 
        1642 EC3Specific::EC3Specific() {}
        1643 EC3Specific::~EC3Specific() {}
        1644 
        1645 FourCC EC3Specific::BoxType() const { return FOURCC_dec3; }
        1646 
        1647 bool EC3Specific::ReadWriteInternal(BoxBuffer* buffer) {
        1648  RCHECK(ReadWriteHeaderInternal(buffer));
        1649  size_t size = buffer->Reading() ? buffer->BytesLeft() : data.size();
        1650  RCHECK(buffer->ReadWriteVector(&data, size));
        1651  return true;
        1652 }
        1653 
        1654 size_t EC3Specific::ComputeSizeInternal() {
        1655  // This box is optional. Skip it if not initialized.
        1656  if (data.empty())
        1657  return 0;
        1658  return HeaderSize() + data.size();
        1659 }
        1660 
        1661 OpusSpecific::OpusSpecific() : preskip(0) {}
        1662 OpusSpecific::~OpusSpecific() {}
        1663 
        1664 FourCC OpusSpecific::BoxType() const { return FOURCC_dOps; }
        1665 
        1666 bool OpusSpecific::ReadWriteInternal(BoxBuffer* buffer) {
        1667  RCHECK(ReadWriteHeaderInternal(buffer));
        1668  if (buffer->Reading()) {
        1669  std::vector<uint8_t> data;
        1670  const int kMinOpusSpecificBoxDataSize = 11;
        1671  RCHECK(buffer->BytesLeft() >= kMinOpusSpecificBoxDataSize);
        1672  RCHECK(buffer->ReadWriteVector(&data, buffer->BytesLeft()));
        1673  preskip = data[2] + (data[3] << 8);
        1674 
        1675  // https://tools.ietf.org/html/draft-ietf-codec-oggopus-06#section-5
        1677  writer.AppendInt(FOURCC_Opus);
        1678  writer.AppendInt(FOURCC_Head);
        1679  // The version must always be 1.
        1680  const uint8_t kOpusIdentificationHeaderVersion = 1;
        1681  data[0] = kOpusIdentificationHeaderVersion;
        1682  writer.AppendVector(data);
        1683  writer.SwapBuffer(&opus_identification_header);
        1684  } else {
        1685  // https://tools.ietf.org/html/draft-ietf-codec-oggopus-06#section-5
        1686  // The first 8 bytes is "magic signature".
        1687  const size_t kOpusMagicSignatureSize = 8u;
        1688  DCHECK_GT(opus_identification_header.size(), kOpusMagicSignatureSize);
        1689  // https://www.opus-codec.org/docs/opus_in_isobmff.html
        1690  // The version field shall be set to 0.
        1691  const uint8_t kOpusSpecificBoxVersion = 0;
        1692  buffer->writer()->AppendInt(kOpusSpecificBoxVersion);
        1693  buffer->writer()->AppendArray(
        1694  &opus_identification_header[kOpusMagicSignatureSize + 1],
        1695  opus_identification_header.size() - kOpusMagicSignatureSize - 1);
        1696  }
        1697  return true;
        1698 }
        1699 
        1700 size_t OpusSpecific::ComputeSizeInternal() {
        1701  // This box is optional. Skip it if not initialized.
        1702  if (opus_identification_header.empty())
        1703  return 0;
        1704  // https://tools.ietf.org/html/draft-ietf-codec-oggopus-06#section-5
        1705  // The first 8 bytes is "magic signature".
        1706  const size_t kOpusMagicSignatureSize = 8u;
        1707  DCHECK_GT(opus_identification_header.size(), kOpusMagicSignatureSize);
        1708  return HeaderSize() + opus_identification_header.size() -
        1709  kOpusMagicSignatureSize;
        1710 }
        1711 
        1712 FlacSpecific::FlacSpecific() {}
        1713 FlacSpecific::~FlacSpecific() {}
        1714 
        1715 FourCC FlacSpecific::BoxType() const {
        1716  return FOURCC_dfLa;
        1717 }
        1718 
        1719 bool FlacSpecific::ReadWriteInternal(BoxBuffer* buffer) {
        1720  RCHECK(ReadWriteHeaderInternal(buffer));
        1721  size_t size = buffer->Reading() ? buffer->BytesLeft() : data.size();
        1722  RCHECK(buffer->ReadWriteVector(&data, size));
        1723  return true;
        1724 }
        1725 
        1726 size_t FlacSpecific::ComputeSizeInternal() {
        1727  // This box is optional. Skip it if not initialized.
        1728  if (data.empty())
        1729  return 0;
        1730  return HeaderSize() + data.size();
        1731 }
        1732 
        1733 AudioSampleEntry::AudioSampleEntry()
        1734  : format(FOURCC_NULL),
        1735  data_reference_index(1),
        1736  channelcount(2),
        1737  samplesize(16),
        1738  samplerate(0) {}
        1739 
        1740 AudioSampleEntry::~AudioSampleEntry() {}
        1741 
        1743  if (format == FOURCC_NULL) {
        1744  LOG(ERROR) << "AudioSampleEntry should be parsed according to the "
        1745  << "handler type recovered in its Media ancestor.";
        1746  }
        1747  return format;
        1748 }
        1749 
        1750 bool AudioSampleEntry::ReadWriteInternal(BoxBuffer* buffer) {
        1751  if (buffer->Reading()) {
        1752  DCHECK(buffer->reader());
        1753  format = buffer->reader()->type();
        1754  } else {
        1755  RCHECK(ReadWriteHeaderInternal(buffer));
        1756  }
        1757 
        1758  // Convert from integer to 16.16 fixed point for writing.
        1759  samplerate <<= 16;
        1760  RCHECK(buffer->IgnoreBytes(6) && // reserved.
        1761  buffer->ReadWriteUInt16(&data_reference_index) &&
        1762  buffer->IgnoreBytes(8) && // reserved.
        1763  buffer->ReadWriteUInt16(&channelcount) &&
        1764  buffer->ReadWriteUInt16(&samplesize) &&
        1765  buffer->IgnoreBytes(4) && // predefined.
        1766  buffer->ReadWriteUInt32(&samplerate));
        1767  // Convert from 16.16 fixed point to integer.
        1768  samplerate >>= 16;
        1769 
        1770  RCHECK(buffer->PrepareChildren());
        1771 
        1772  RCHECK(buffer->TryReadWriteChild(&esds));
        1773  RCHECK(buffer->TryReadWriteChild(&ddts));
        1774  RCHECK(buffer->TryReadWriteChild(&dac3));
        1775  RCHECK(buffer->TryReadWriteChild(&dec3));
        1776  RCHECK(buffer->TryReadWriteChild(&dops));
        1777  RCHECK(buffer->TryReadWriteChild(&dfla));
        1778 
        1779  // Somehow Edge does not support having sinf box before codec_configuration,
        1780  // box, so just do it in the end of AudioSampleEntry. See
        1781  // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12658991/
        1782  if (format == FOURCC_enca) {
        1783  if (buffer->Reading()) {
        1784  // Continue scanning until a supported protection scheme is found, or
        1785  // until we run out of protection schemes.
        1786  while (!IsProtectionSchemeSupported(sinf.type.type))
        1787  RCHECK(buffer->ReadWriteChild(&sinf));
        1788  } else {
        1789  DCHECK(IsProtectionSchemeSupported(sinf.type.type));
        1790  RCHECK(buffer->ReadWriteChild(&sinf));
        1791  }
        1792  }
        1793  return true;
        1794 }
        1795 
        1796 size_t AudioSampleEntry::ComputeSizeInternal() {
        1797  if (GetActualFormat() == FOURCC_NULL)
        1798  return 0;
        1799  return HeaderSize() + sizeof(data_reference_index) + sizeof(channelcount) +
        1800  sizeof(samplesize) + sizeof(samplerate) + sinf.ComputeSize() +
        1801  esds.ComputeSize() + ddts.ComputeSize() + dac3.ComputeSize() +
        1802  dec3.ComputeSize() + dops.ComputeSize() + dfla.ComputeSize() +
        1803  // Reserved and predefined bytes.
        1804  6 + 8 + // 6 + 8 bytes reserved.
        1805  4; // 4 bytes predefined.
        1806 }
        1807 
        1808 WebVTTConfigurationBox::WebVTTConfigurationBox() {}
        1809 WebVTTConfigurationBox::~WebVTTConfigurationBox() {}
        1810 
        1812  return FOURCC_vttC;
        1813 }
        1814 
        1815 bool WebVTTConfigurationBox::ReadWriteInternal(BoxBuffer* buffer) {
        1816  RCHECK(ReadWriteHeaderInternal(buffer));
        1817  return buffer->ReadWriteString(
        1818  &config,
        1819  buffer->Reading() ? buffer->BytesLeft() : config.size());
        1820 }
        1821 
        1822 size_t WebVTTConfigurationBox::ComputeSizeInternal() {
        1823  return HeaderSize() + config.size();
        1824 }
        1825 
        1826 WebVTTSourceLabelBox::WebVTTSourceLabelBox() {}
        1827 WebVTTSourceLabelBox::~WebVTTSourceLabelBox() {}
        1828 
        1830  return FOURCC_vlab;
        1831 }
        1832 
        1833 bool WebVTTSourceLabelBox::ReadWriteInternal(BoxBuffer* buffer) {
        1834  RCHECK(ReadWriteHeaderInternal(buffer));
        1835  return buffer->ReadWriteString(&source_label, buffer->Reading()
        1836  ? buffer->BytesLeft()
        1837  : source_label.size());
        1838 }
        1839 
        1840 size_t WebVTTSourceLabelBox::ComputeSizeInternal() {
        1841  if (source_label.empty())
        1842  return 0;
        1843  return HeaderSize() + source_label.size();
        1844 }
        1845 
        1846 TextSampleEntry::TextSampleEntry() : format(FOURCC_NULL) {}
        1847 TextSampleEntry::~TextSampleEntry() {}
        1848 
        1850  if (format == FOURCC_NULL) {
        1851  LOG(ERROR) << "TextSampleEntry should be parsed according to the "
        1852  << "handler type recovered in its Media ancestor.";
        1853  }
        1854  return format;
        1855 }
        1856 
        1857 bool TextSampleEntry::ReadWriteInternal(BoxBuffer* buffer) {
        1858  if (buffer->Reading()) {
        1859  DCHECK(buffer->reader());
        1860  format = buffer->reader()->type();
        1861  } else {
        1862  RCHECK(ReadWriteHeaderInternal(buffer));
        1863  }
        1864  RCHECK(buffer->IgnoreBytes(6) && // reserved for SampleEntry.
        1865  buffer->ReadWriteUInt16(&data_reference_index));
        1866 
        1867  if (format == FOURCC_wvtt) {
        1868  // TODO(rkuroiwa): Handle the optional MPEG4BitRateBox.
        1869  RCHECK(buffer->PrepareChildren() &&
        1870  buffer->ReadWriteChild(&config) &&
        1871  buffer->ReadWriteChild(&label));
        1872  }
        1873  return true;
        1874 }
        1875 
        1876 size_t TextSampleEntry::ComputeSizeInternal() {
        1877  // 6 for the (anonymous) reserved bytes for SampleEntry class.
        1878  return HeaderSize() + 6 + sizeof(data_reference_index) +
        1879  config.ComputeSize() + label.ComputeSize();
        1880 }
        1881 
        1882 MediaHeader::MediaHeader()
        1883  : creation_time(0), modification_time(0), timescale(0), duration(0) {}
        1884 MediaHeader::~MediaHeader() {}
        1885 FourCC MediaHeader::BoxType() const { return FOURCC_mdhd; }
        1886 
        1887 bool MediaHeader::ReadWriteInternal(BoxBuffer* buffer) {
        1888  RCHECK(ReadWriteHeaderInternal(buffer));
        1889 
        1890  uint8_t num_bytes = (version == 1) ? sizeof(uint64_t) : sizeof(uint32_t);
        1891  RCHECK(buffer->ReadWriteUInt64NBytes(&creation_time, num_bytes) &&
        1892  buffer->ReadWriteUInt64NBytes(&modification_time, num_bytes) &&
        1893  buffer->ReadWriteUInt32(&timescale) &&
        1894  buffer->ReadWriteUInt64NBytes(&duration, num_bytes) &&
        1895  language.ReadWrite(buffer) &&
        1896  buffer->IgnoreBytes(2)); // predefined.
        1897  return true;
        1898 }
        1899 
        1900 size_t MediaHeader::ComputeSizeInternal() {
        1901  version = IsFitIn32Bits(creation_time, modification_time, duration) ? 0 : 1;
        1902  return HeaderSize() + sizeof(timescale) +
        1903  sizeof(uint32_t) * (1 + version) * 3 + language.ComputeSize() +
        1904  2; // 2 bytes predefined.
        1905 }
        1906 
        1907 VideoMediaHeader::VideoMediaHeader()
        1908  : graphicsmode(0), opcolor_red(0), opcolor_green(0), opcolor_blue(0) {
        1909  const uint32_t kVideoMediaHeaderFlags = 1;
        1910  flags = kVideoMediaHeaderFlags;
        1911 }
        1912 VideoMediaHeader::~VideoMediaHeader() {}
        1913 FourCC VideoMediaHeader::BoxType() const { return FOURCC_vmhd; }
        1914 bool VideoMediaHeader::ReadWriteInternal(BoxBuffer* buffer) {
        1915  RCHECK(ReadWriteHeaderInternal(buffer) &&
        1916  buffer->ReadWriteUInt16(&graphicsmode) &&
        1917  buffer->ReadWriteUInt16(&opcolor_red) &&
        1918  buffer->ReadWriteUInt16(&opcolor_green) &&
        1919  buffer->ReadWriteUInt16(&opcolor_blue));
        1920  return true;
        1921 }
        1922 
        1923 size_t VideoMediaHeader::ComputeSizeInternal() {
        1924  return HeaderSize() + sizeof(graphicsmode) + sizeof(opcolor_red) +
        1925  sizeof(opcolor_green) + sizeof(opcolor_blue);
        1926 }
        1927 
        1928 SoundMediaHeader::SoundMediaHeader() : balance(0) {}
        1929 SoundMediaHeader::~SoundMediaHeader() {}
        1930 FourCC SoundMediaHeader::BoxType() const { return FOURCC_smhd; }
        1931 bool SoundMediaHeader::ReadWriteInternal(BoxBuffer* buffer) {
        1932  RCHECK(ReadWriteHeaderInternal(buffer) &&
        1933  buffer->ReadWriteUInt16(&balance) &&
        1934  buffer->IgnoreBytes(2)); // reserved.
        1935  return true;
        1936 }
        1937 
        1938 size_t SoundMediaHeader::ComputeSizeInternal() {
        1939  return HeaderSize() + sizeof(balance) + sizeof(uint16_t);
        1940 }
        1941 
        1942 SubtitleMediaHeader::SubtitleMediaHeader() {}
        1943 SubtitleMediaHeader::~SubtitleMediaHeader() {}
        1944 
        1945 FourCC SubtitleMediaHeader::BoxType() const { return FOURCC_sthd; }
        1946 
        1947 bool SubtitleMediaHeader::ReadWriteInternal(BoxBuffer* buffer) {
        1948  return ReadWriteHeaderInternal(buffer);
        1949 }
        1950 
        1951 size_t SubtitleMediaHeader::ComputeSizeInternal() {
        1952  return HeaderSize();
        1953 }
        1954 
        1955 DataEntryUrl::DataEntryUrl() {
        1956  const uint32_t kDataEntryUrlFlags = 1;
        1957  flags = kDataEntryUrlFlags;
        1958 }
        1959 DataEntryUrl::~DataEntryUrl() {}
        1960 FourCC DataEntryUrl::BoxType() const { return FOURCC_url; }
        1961 bool DataEntryUrl::ReadWriteInternal(BoxBuffer* buffer) {
        1962  RCHECK(ReadWriteHeaderInternal(buffer));
        1963  if (buffer->Reading()) {
        1964  RCHECK(buffer->ReadWriteVector(&location, buffer->BytesLeft()));
        1965  } else {
        1966  RCHECK(buffer->ReadWriteVector(&location, location.size()));
        1967  }
        1968  return true;
        1969 }
        1970 
        1971 size_t DataEntryUrl::ComputeSizeInternal() {
        1972  return HeaderSize() + location.size();
        1973 }
        1974 
        1975 DataReference::DataReference() {
        1976  // Default 1 entry.
        1977  data_entry.resize(1);
        1978 }
        1979 DataReference::~DataReference() {}
        1980 FourCC DataReference::BoxType() const { return FOURCC_dref; }
        1981 bool DataReference::ReadWriteInternal(BoxBuffer* buffer) {
        1982  uint32_t entry_count = static_cast<uint32_t>(data_entry.size());
        1983  RCHECK(ReadWriteHeaderInternal(buffer) &&
        1984  buffer->ReadWriteUInt32(&entry_count));
        1985  data_entry.resize(entry_count);
        1986  RCHECK(buffer->PrepareChildren());
        1987  for (uint32_t i = 0; i < entry_count; ++i)
        1988  RCHECK(buffer->ReadWriteChild(&data_entry[i]));
        1989  return true;
        1990 }
        1991 
        1992 size_t DataReference::ComputeSizeInternal() {
        1993  uint32_t count = static_cast<uint32_t>(data_entry.size());
        1994  size_t box_size = HeaderSize() + sizeof(count);
        1995  for (uint32_t i = 0; i < count; ++i)
        1996  box_size += data_entry[i].ComputeSize();
        1997  return box_size;
        1998 }
        1999 
        2000 DataInformation::DataInformation() {}
        2001 DataInformation::~DataInformation() {}
        2002 FourCC DataInformation::BoxType() const { return FOURCC_dinf; }
        2003 
        2004 bool DataInformation::ReadWriteInternal(BoxBuffer* buffer) {
        2005  return ReadWriteHeaderInternal(buffer) &&
        2006  buffer->PrepareChildren() &&
        2007  buffer->ReadWriteChild(&dref);
        2008 }
        2009 
        2010 size_t DataInformation::ComputeSizeInternal() {
        2011  return HeaderSize() + dref.ComputeSize();
        2012 }
        2013 
        2014 MediaInformation::MediaInformation() {}
        2015 MediaInformation::~MediaInformation() {}
        2016 FourCC MediaInformation::BoxType() const { return FOURCC_minf; }
        2017 
        2018 bool MediaInformation::ReadWriteInternal(BoxBuffer* buffer) {
        2019  RCHECK(ReadWriteHeaderInternal(buffer) &&
        2020  buffer->PrepareChildren() &&
        2021  buffer->ReadWriteChild(&dinf) &&
        2022  buffer->ReadWriteChild(&sample_table));
        2023  switch (sample_table.description.type) {
        2024  case kVideo:
        2025  RCHECK(buffer->ReadWriteChild(&vmhd));
        2026  break;
        2027  case kAudio:
        2028  RCHECK(buffer->ReadWriteChild(&smhd));
        2029  break;
        2030  case kText:
        2031  RCHECK(buffer->TryReadWriteChild(&sthd));
        2032  break;
        2033  default:
        2034  NOTIMPLEMENTED();
        2035  }
        2036  // Hint is not supported for now.
        2037  return true;
        2038 }
        2039 
        2040 size_t MediaInformation::ComputeSizeInternal() {
        2041  size_t box_size =
        2042  HeaderSize() + dinf.ComputeSize() + sample_table.ComputeSize();
        2043  switch (sample_table.description.type) {
        2044  case kVideo:
        2045  box_size += vmhd.ComputeSize();
        2046  break;
        2047  case kAudio:
        2048  box_size += smhd.ComputeSize();
        2049  break;
        2050  case kText:
        2051  box_size += sthd.ComputeSize();
        2052  break;
        2053  default:
        2054  NOTIMPLEMENTED();
        2055  }
        2056  return box_size;
        2057 }
        2058 
        2059 Media::Media() {}
        2060 Media::~Media() {}
        2061 FourCC Media::BoxType() const { return FOURCC_mdia; }
        2062 
        2063 bool Media::ReadWriteInternal(BoxBuffer* buffer) {
        2064  RCHECK(ReadWriteHeaderInternal(buffer) &&
        2065  buffer->PrepareChildren() &&
        2066  buffer->ReadWriteChild(&header));
        2067  if (buffer->Reading()) {
        2068  RCHECK(buffer->ReadWriteChild(&handler));
        2069  // Maddeningly, the HandlerReference box specifies how to parse the
        2070  // SampleDescription box, making the latter the only box (of those that we
        2071  // support) which cannot be parsed correctly on its own (or even with
        2072  // information from its strict ancestor tree). We thus copy the handler type
        2073  // to the sample description box *before* parsing it to provide this
        2074  // information while parsing.
        2075  information.sample_table.description.type =
        2076  FourCCToTrackType(handler.handler_type);
        2077  } else {
        2078  handler.handler_type =
        2079  TrackTypeToFourCC(information.sample_table.description.type);
        2080  RCHECK(handler.handler_type != FOURCC_NULL);
        2081  RCHECK(buffer->ReadWriteChild(&handler));
        2082  }
        2083  RCHECK(buffer->ReadWriteChild(&information));
        2084  return true;
        2085 }
        2086 
        2087 size_t Media::ComputeSizeInternal() {
        2088  handler.handler_type =
        2089  TrackTypeToFourCC(information.sample_table.description.type);
        2090  return HeaderSize() + header.ComputeSize() + handler.ComputeSize() +
        2091  information.ComputeSize();
        2092 }
        2093 
        2094 Track::Track() {}
        2095 Track::~Track() {}
        2096 FourCC Track::BoxType() const { return FOURCC_trak; }
        2097 
        2098 bool Track::ReadWriteInternal(BoxBuffer* buffer) {
        2099  RCHECK(ReadWriteHeaderInternal(buffer) &&
        2100  buffer->PrepareChildren() &&
        2101  buffer->ReadWriteChild(&header) &&
        2102  buffer->ReadWriteChild(&media) &&
        2103  buffer->TryReadWriteChild(&edit) &&
        2104  buffer->TryReadWriteChild(&sample_encryption));
        2105  return true;
        2106 }
        2107 
        2108 size_t Track::ComputeSizeInternal() {
        2109  return HeaderSize() + header.ComputeSize() + media.ComputeSize() +
        2110  edit.ComputeSize();
        2111 }
        2112 
        2113 MovieExtendsHeader::MovieExtendsHeader() : fragment_duration(0) {}
        2114 MovieExtendsHeader::~MovieExtendsHeader() {}
        2115 FourCC MovieExtendsHeader::BoxType() const { return FOURCC_mehd; }
        2116 
        2117 bool MovieExtendsHeader::ReadWriteInternal(BoxBuffer* buffer) {
        2118  RCHECK(ReadWriteHeaderInternal(buffer));
        2119  size_t num_bytes = (version == 1) ? sizeof(uint64_t) : sizeof(uint32_t);
        2120  RCHECK(buffer->ReadWriteUInt64NBytes(&fragment_duration, num_bytes));
        2121  return true;
        2122 }
        2123 
        2124 size_t MovieExtendsHeader::ComputeSizeInternal() {
        2125  // This box is optional. Skip it if it is not used.
        2126  if (fragment_duration == 0)
        2127  return 0;
        2128  version = IsFitIn32Bits(fragment_duration) ? 0 : 1;
        2129  return HeaderSize() + sizeof(uint32_t) * (1 + version);
        2130 }
        2131 
        2132 TrackExtends::TrackExtends()
        2133  : track_id(0),
        2134  default_sample_description_index(0),
        2135  default_sample_duration(0),
        2136  default_sample_size(0),
        2137  default_sample_flags(0) {}
        2138 TrackExtends::~TrackExtends() {}
        2139 FourCC TrackExtends::BoxType() const { return FOURCC_trex; }
        2140 
        2141 bool TrackExtends::ReadWriteInternal(BoxBuffer* buffer) {
        2142  RCHECK(ReadWriteHeaderInternal(buffer) &&
        2143  buffer->ReadWriteUInt32(&track_id) &&
        2144  buffer->ReadWriteUInt32(&default_sample_description_index) &&
        2145  buffer->ReadWriteUInt32(&default_sample_duration) &&
        2146  buffer->ReadWriteUInt32(&default_sample_size) &&
        2147  buffer->ReadWriteUInt32(&default_sample_flags));
        2148  return true;
        2149 }
        2150 
        2151 size_t TrackExtends::ComputeSizeInternal() {
        2152  return HeaderSize() + sizeof(track_id) +
        2153  sizeof(default_sample_description_index) +
        2154  sizeof(default_sample_duration) + sizeof(default_sample_size) +
        2155  sizeof(default_sample_flags);
        2156 }
        2157 
        2158 MovieExtends::MovieExtends() {}
        2159 MovieExtends::~MovieExtends() {}
        2160 FourCC MovieExtends::BoxType() const { return FOURCC_mvex; }
        2161 
        2162 bool MovieExtends::ReadWriteInternal(BoxBuffer* buffer) {
        2163  RCHECK(ReadWriteHeaderInternal(buffer) &&
        2164  buffer->PrepareChildren() &&
        2165  buffer->TryReadWriteChild(&header));
        2166  if (buffer->Reading()) {
        2167  DCHECK(buffer->reader());
        2168  RCHECK(buffer->reader()->ReadChildren(&tracks));
        2169  } else {
        2170  for (uint32_t i = 0; i < tracks.size(); ++i)
        2171  RCHECK(buffer->ReadWriteChild(&tracks[i]));
        2172  }
        2173  return true;
        2174 }
        2175 
        2176 size_t MovieExtends::ComputeSizeInternal() {
        2177  // This box is optional. Skip it if it does not contain any track.
        2178  if (tracks.size() == 0)
        2179  return 0;
        2180  size_t box_size = HeaderSize() + header.ComputeSize();
        2181  for (uint32_t i = 0; i < tracks.size(); ++i)
        2182  box_size += tracks[i].ComputeSize();
        2183  return box_size;
        2184 }
        2185 
        2186 Movie::Movie() {}
        2187 Movie::~Movie() {}
        2188 FourCC Movie::BoxType() const { return FOURCC_moov; }
        2189 
        2190 bool Movie::ReadWriteInternal(BoxBuffer* buffer) {
        2191  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->PrepareChildren() &&
        2192  buffer->ReadWriteChild(&header));
        2193  if (buffer->Reading()) {
        2194  BoxReader* reader = buffer->reader();
        2195  DCHECK(reader);
        2196  RCHECK(reader->ReadChildren(&tracks) && reader->TryReadChild(&extends) &&
        2197  reader->TryReadChildren(&pssh));
        2198  } else {
        2199  // The 'meta' box is not well formed in the video captured by Android's
        2200  // default camera app: spec indicates that it is a FullBox but it is written
        2201  // as a Box. This results in the box failed to be parsed. See
        2202  // https://github.com/google/shaka-packager/issues/319 for details.
        2203  // We do not care the content of metadata box in the source content, so just
        2204  // skip reading the box.
        2205  RCHECK(buffer->TryReadWriteChild(&metadata));
        2206  for (uint32_t i = 0; i < tracks.size(); ++i)
        2207  RCHECK(buffer->ReadWriteChild(&tracks[i]));
        2208  RCHECK(buffer->TryReadWriteChild(&extends));
        2209  for (uint32_t i = 0; i < pssh.size(); ++i)
        2210  RCHECK(buffer->ReadWriteChild(&pssh[i]));
        2211  }
        2212  return true;
        2213 }
        2214 
        2215 size_t Movie::ComputeSizeInternal() {
        2216  size_t box_size = HeaderSize() + header.ComputeSize() +
        2217  metadata.ComputeSize() + extends.ComputeSize();
        2218  for (uint32_t i = 0; i < tracks.size(); ++i)
        2219  box_size += tracks[i].ComputeSize();
        2220  for (uint32_t i = 0; i < pssh.size(); ++i)
        2221  box_size += pssh[i].ComputeSize();
        2222  return box_size;
        2223 }
        2224 
        2225 TrackFragmentDecodeTime::TrackFragmentDecodeTime() : decode_time(0) {}
        2226 TrackFragmentDecodeTime::~TrackFragmentDecodeTime() {}
        2227 FourCC TrackFragmentDecodeTime::BoxType() const { return FOURCC_tfdt; }
        2228 
        2229 bool TrackFragmentDecodeTime::ReadWriteInternal(BoxBuffer* buffer) {
        2230  RCHECK(ReadWriteHeaderInternal(buffer));
        2231  size_t num_bytes = (version == 1) ? sizeof(uint64_t) : sizeof(uint32_t);
        2232  RCHECK(buffer->ReadWriteUInt64NBytes(&decode_time, num_bytes));
        2233  return true;
        2234 }
        2235 
        2236 size_t TrackFragmentDecodeTime::ComputeSizeInternal() {
        2237  version = IsFitIn32Bits(decode_time) ? 0 : 1;
        2238  return HeaderSize() + sizeof(uint32_t) * (1 + version);
        2239 }
        2240 
        2241 MovieFragmentHeader::MovieFragmentHeader() : sequence_number(0) {}
        2242 MovieFragmentHeader::~MovieFragmentHeader() {}
        2243 FourCC MovieFragmentHeader::BoxType() const { return FOURCC_mfhd; }
        2244 
        2245 bool MovieFragmentHeader::ReadWriteInternal(BoxBuffer* buffer) {
        2246  return ReadWriteHeaderInternal(buffer) &&
        2247  buffer->ReadWriteUInt32(&sequence_number);
        2248 }
        2249 
        2250 size_t MovieFragmentHeader::ComputeSizeInternal() {
        2251  return HeaderSize() + sizeof(sequence_number);
        2252 }
        2253 
        2254 TrackFragmentHeader::TrackFragmentHeader()
        2255  : track_id(0),
        2256  sample_description_index(0),
        2257  default_sample_duration(0),
        2258  default_sample_size(0),
        2259  default_sample_flags(0) {}
        2260 
        2261 TrackFragmentHeader::~TrackFragmentHeader() {}
        2262 FourCC TrackFragmentHeader::BoxType() const { return FOURCC_tfhd; }
        2263 
        2264 bool TrackFragmentHeader::ReadWriteInternal(BoxBuffer* buffer) {
        2265  RCHECK(ReadWriteHeaderInternal(buffer) &&
        2266  buffer->ReadWriteUInt32(&track_id));
        2267 
        2268  if (flags & kBaseDataOffsetPresentMask) {
        2269  // MSE requires 'default-base-is-moof' to be set and
        2270  // 'base-data-offset-present' not to be set. We omit these checks as some
        2271  // valid files in the wild don't follow these rules, though they use moof as
        2272  // base.
        2273  uint64_t base_data_offset;
        2274  RCHECK(buffer->ReadWriteUInt64(&base_data_offset));
        2275  DLOG(WARNING) << "base-data-offset-present is not expected. Assumes "
        2276  "default-base-is-moof.";
        2277  }
        2278 
        2279  if (flags & kSampleDescriptionIndexPresentMask) {
        2280  RCHECK(buffer->ReadWriteUInt32(&sample_description_index));
        2281  } else if (buffer->Reading()) {
        2282  sample_description_index = 0;
        2283  }
        2284 
        2285  if (flags & kDefaultSampleDurationPresentMask) {
        2286  RCHECK(buffer->ReadWriteUInt32(&default_sample_duration));
        2287  } else if (buffer->Reading()) {
        2288  default_sample_duration = 0;
        2289  }
        2290 
        2291  if (flags & kDefaultSampleSizePresentMask) {
        2292  RCHECK(buffer->ReadWriteUInt32(&default_sample_size));
        2293  } else if (buffer->Reading()) {
        2294  default_sample_size = 0;
        2295  }
        2296 
        2297  if (flags & kDefaultSampleFlagsPresentMask)
        2298  RCHECK(buffer->ReadWriteUInt32(&default_sample_flags));
        2299  return true;
        2300 }
        2301 
        2302 size_t TrackFragmentHeader::ComputeSizeInternal() {
        2303  size_t box_size = HeaderSize() + sizeof(track_id);
        2304  if (flags & kSampleDescriptionIndexPresentMask)
        2305  box_size += sizeof(sample_description_index);
        2306  if (flags & kDefaultSampleDurationPresentMask)
        2307  box_size += sizeof(default_sample_duration);
        2308  if (flags & kDefaultSampleSizePresentMask)
        2309  box_size += sizeof(default_sample_size);
        2310  if (flags & kDefaultSampleFlagsPresentMask)
        2311  box_size += sizeof(default_sample_flags);
        2312  return box_size;
        2313 }
        2314 
        2315 TrackFragmentRun::TrackFragmentRun() : sample_count(0), data_offset(0) {}
        2316 TrackFragmentRun::~TrackFragmentRun() {}
        2317 FourCC TrackFragmentRun::BoxType() const { return FOURCC_trun; }
        2318 
        2319 bool TrackFragmentRun::ReadWriteInternal(BoxBuffer* buffer) {
        2320  if (!buffer->Reading()) {
        2321  // Determine whether version 0 or version 1 should be used.
        2322  // Use version 0 if possible, use version 1 if there is a negative
        2323  // sample_offset value.
        2324  version = 0;
        2325  if (flags & kSampleCompTimeOffsetsPresentMask) {
        2326  for (uint32_t i = 0; i < sample_count; ++i) {
        2327  if (sample_composition_time_offsets[i] < 0) {
        2328  version = 1;
        2329  break;
        2330  }
        2331  }
        2332  }
        2333  }
        2334 
        2335  RCHECK(ReadWriteHeaderInternal(buffer) &&
        2336  buffer->ReadWriteUInt32(&sample_count));
        2337 
        2338  bool data_offset_present = (flags & kDataOffsetPresentMask) != 0;
        2339  bool first_sample_flags_present = (flags & kFirstSampleFlagsPresentMask) != 0;
        2340  bool sample_duration_present = (flags & kSampleDurationPresentMask) != 0;
        2341  bool sample_size_present = (flags & kSampleSizePresentMask) != 0;
        2342  bool sample_flags_present = (flags & kSampleFlagsPresentMask) != 0;
        2343  bool sample_composition_time_offsets_present =
        2344  (flags & kSampleCompTimeOffsetsPresentMask) != 0;
        2345 
        2346  if (data_offset_present) {
        2347  RCHECK(buffer->ReadWriteUInt32(&data_offset));
        2348  } else {
        2349  // NOTE: If the data-offset is not present, then the data for this run
        2350  // starts immediately after the data of the previous run, or at the
        2351  // base-data-offset defined by the track fragment header if this is the
        2352  // first run in a track fragment. If the data-offset is present, it is
        2353  // relative to the base-data-offset established in the track fragment
        2354  // header.
        2355  NOTIMPLEMENTED();
        2356  }
        2357 
        2358  uint32_t first_sample_flags(0);
        2359 
        2360  if (buffer->Reading()) {
        2361  if (first_sample_flags_present)
        2362  RCHECK(buffer->ReadWriteUInt32(&first_sample_flags));
        2363 
        2364  if (sample_duration_present)
        2365  sample_durations.resize(sample_count);
        2366  if (sample_size_present)
        2367  sample_sizes.resize(sample_count);
        2368  if (sample_flags_present)
        2369  sample_flags.resize(sample_count);
        2370  if (sample_composition_time_offsets_present)
        2371  sample_composition_time_offsets.resize(sample_count);
        2372  } else {
        2373  if (first_sample_flags_present) {
        2374  first_sample_flags = sample_flags[0];
        2375  DCHECK(sample_flags.size() == 1);
        2376  RCHECK(buffer->ReadWriteUInt32(&first_sample_flags));
        2377  }
        2378 
        2379  if (sample_duration_present)
        2380  DCHECK(sample_durations.size() == sample_count);
        2381  if (sample_size_present)
        2382  DCHECK(sample_sizes.size() == sample_count);
        2383  if (sample_flags_present)
        2384  DCHECK(sample_flags.size() == sample_count);
        2385  if (sample_composition_time_offsets_present)
        2386  DCHECK(sample_composition_time_offsets.size() == sample_count);
        2387  }
        2388 
        2389  for (uint32_t i = 0; i < sample_count; ++i) {
        2390  if (sample_duration_present)
        2391  RCHECK(buffer->ReadWriteUInt32(&sample_durations[i]));
        2392  if (sample_size_present)
        2393  RCHECK(buffer->ReadWriteUInt32(&sample_sizes[i]));
        2394  if (sample_flags_present)
        2395  RCHECK(buffer->ReadWriteUInt32(&sample_flags[i]));
        2396 
        2397  if (sample_composition_time_offsets_present) {
        2398  if (version == 0) {
        2399  uint32_t sample_offset = sample_composition_time_offsets[i];
        2400  RCHECK(buffer->ReadWriteUInt32(&sample_offset));
        2401  sample_composition_time_offsets[i] = sample_offset;
        2402  } else {
        2403  int32_t sample_offset = sample_composition_time_offsets[i];
        2404  RCHECK(buffer->ReadWriteInt32(&sample_offset));
        2405  sample_composition_time_offsets[i] = sample_offset;
        2406  }
        2407  }
        2408  }
        2409 
        2410  if (buffer->Reading()) {
        2411  if (first_sample_flags_present) {
        2412  if (sample_flags.size() == 0) {
        2413  sample_flags.push_back(first_sample_flags);
        2414  } else {
        2415  sample_flags[0] = first_sample_flags;
        2416  }
        2417  }
        2418  }
        2419  return true;
        2420 }
        2421 
        2422 size_t TrackFragmentRun::ComputeSizeInternal() {
        2423  size_t box_size = HeaderSize() + sizeof(sample_count);
        2424  if (flags & kDataOffsetPresentMask)
        2425  box_size += sizeof(data_offset);
        2426  if (flags & kFirstSampleFlagsPresentMask)
        2427  box_size += sizeof(uint32_t);
        2428  uint32_t fields = (flags & kSampleDurationPresentMask ? 1 : 0) +
        2429  (flags & kSampleSizePresentMask ? 1 : 0) +
        2430  (flags & kSampleFlagsPresentMask ? 1 : 0) +
        2431  (flags & kSampleCompTimeOffsetsPresentMask ? 1 : 0);
        2432  box_size += fields * sizeof(uint32_t) * sample_count;
        2433  return box_size;
        2434 }
        2435 
        2436 TrackFragment::TrackFragment() : decode_time_absent(false) {}
        2437 TrackFragment::~TrackFragment() {}
        2438 FourCC TrackFragment::BoxType() const { return FOURCC_traf; }
        2439 
        2440 bool TrackFragment::ReadWriteInternal(BoxBuffer* buffer) {
        2441  RCHECK(ReadWriteHeaderInternal(buffer) &&
        2442  buffer->PrepareChildren() &&
        2443  buffer->ReadWriteChild(&header));
        2444  if (buffer->Reading()) {
        2445  DCHECK(buffer->reader());
        2446  decode_time_absent = !buffer->reader()->ChildExist(&decode_time);
        2447  if (!decode_time_absent)
        2448  RCHECK(buffer->ReadWriteChild(&decode_time));
        2449  RCHECK(buffer->reader()->TryReadChildren(&runs) &&
        2450  buffer->reader()->TryReadChildren(&sample_group_descriptions) &&
        2451  buffer->reader()->TryReadChildren(&sample_to_groups));
        2452  } else {
        2453  if (!decode_time_absent)
        2454  RCHECK(buffer->ReadWriteChild(&decode_time));
        2455  for (uint32_t i = 0; i < runs.size(); ++i)
        2456  RCHECK(buffer->ReadWriteChild(&runs[i]));
        2457  for (uint32_t i = 0; i < sample_to_groups.size(); ++i)
        2458  RCHECK(buffer->ReadWriteChild(&sample_to_groups[i]));
        2459  for (uint32_t i = 0; i < sample_group_descriptions.size(); ++i)
        2460  RCHECK(buffer->ReadWriteChild(&sample_group_descriptions[i]));
        2461  }
        2462  return buffer->TryReadWriteChild(&auxiliary_size) &&
        2463  buffer->TryReadWriteChild(&auxiliary_offset) &&
        2464  buffer->TryReadWriteChild(&sample_encryption);
        2465 }
        2466 
        2467 size_t TrackFragment::ComputeSizeInternal() {
        2468  size_t box_size = HeaderSize() + header.ComputeSize() +
        2469  decode_time.ComputeSize() + auxiliary_size.ComputeSize() +
        2470  auxiliary_offset.ComputeSize() +
        2471  sample_encryption.ComputeSize();
        2472  for (uint32_t i = 0; i < runs.size(); ++i)
        2473  box_size += runs[i].ComputeSize();
        2474  for (uint32_t i = 0; i < sample_group_descriptions.size(); ++i)
        2475  box_size += sample_group_descriptions[i].ComputeSize();
        2476  for (uint32_t i = 0; i < sample_to_groups.size(); ++i)
        2477  box_size += sample_to_groups[i].ComputeSize();
        2478  return box_size;
        2479 }
        2480 
        2481 MovieFragment::MovieFragment() {}
        2482 MovieFragment::~MovieFragment() {}
        2483 FourCC MovieFragment::BoxType() const { return FOURCC_moof; }
        2484 
        2485 bool MovieFragment::ReadWriteInternal(BoxBuffer* buffer) {
        2486  RCHECK(ReadWriteHeaderInternal(buffer) &&
        2487  buffer->PrepareChildren() &&
        2488  buffer->ReadWriteChild(&header));
        2489  if (buffer->Reading()) {
        2490  BoxReader* reader = buffer->reader();
        2491  DCHECK(reader);
        2492  RCHECK(reader->ReadChildren(&tracks) &&
        2493  reader->TryReadChildren(&pssh));
        2494  } else {
        2495  for (uint32_t i = 0; i < tracks.size(); ++i)
        2496  RCHECK(buffer->ReadWriteChild(&tracks[i]));
        2497  for (uint32_t i = 0; i < pssh.size(); ++i)
        2498  RCHECK(buffer->ReadWriteChild(&pssh[i]));
        2499  }
        2500  return true;
        2501 }
        2502 
        2503 size_t MovieFragment::ComputeSizeInternal() {
        2504  size_t box_size = HeaderSize() + header.ComputeSize();
        2505  for (uint32_t i = 0; i < tracks.size(); ++i)
        2506  box_size += tracks[i].ComputeSize();
        2507  for (uint32_t i = 0; i < pssh.size(); ++i)
        2508  box_size += pssh[i].ComputeSize();
        2509  return box_size;
        2510 }
        2511 
        2512 SegmentIndex::SegmentIndex()
        2513  : reference_id(0),
        2514  timescale(0),
        2515  earliest_presentation_time(0),
        2516  first_offset(0) {}
        2517 SegmentIndex::~SegmentIndex() {}
        2518 FourCC SegmentIndex::BoxType() const { return FOURCC_sidx; }
        2519 
        2520 bool SegmentIndex::ReadWriteInternal(BoxBuffer* buffer) {
        2521  RCHECK(ReadWriteHeaderInternal(buffer) &&
        2522  buffer->ReadWriteUInt32(&reference_id) &&
        2523  buffer->ReadWriteUInt32(&timescale));
        2524 
        2525  size_t num_bytes = (version == 1) ? sizeof(uint64_t) : sizeof(uint32_t);
        2526  RCHECK(
        2527  buffer->ReadWriteUInt64NBytes(&earliest_presentation_time, num_bytes) &&
        2528  buffer->ReadWriteUInt64NBytes(&first_offset, num_bytes));
        2529 
        2530  uint16_t reference_count = static_cast<uint16_t>(references.size());
        2531  RCHECK(buffer->IgnoreBytes(2) && // reserved.
        2532  buffer->ReadWriteUInt16(&reference_count));
        2533  references.resize(reference_count);
        2534 
        2535  uint32_t reference_type_size;
        2536  uint32_t sap;
        2537  for (uint32_t i = 0; i < reference_count; ++i) {
        2538  if (!buffer->Reading()) {
        2539  reference_type_size = references[i].referenced_size;
        2540  if (references[i].reference_type)
        2541  reference_type_size |= (1 << 31);
        2542  sap = (references[i].sap_type << 28) | references[i].sap_delta_time;
        2543  if (references[i].starts_with_sap)
        2544  sap |= (1 << 31);
        2545  }
        2546  RCHECK(buffer->ReadWriteUInt32(&reference_type_size) &&
        2547  buffer->ReadWriteUInt32(&references[i].subsegment_duration) &&
        2548  buffer->ReadWriteUInt32(&sap));
        2549  if (buffer->Reading()) {
        2550  references[i].reference_type = (reference_type_size >> 31) ? true : false;
        2551  references[i].referenced_size = reference_type_size & ~(1 << 31);
        2552  references[i].starts_with_sap = (sap >> 31) ? true : false;
        2553  references[i].sap_type =
        2554  static_cast<SegmentReference::SAPType>((sap >> 28) & 0x07);
        2555  references[i].sap_delta_time = sap & ~(0xF << 28);
        2556  }
        2557  }
        2558  return true;
        2559 }
        2560 
        2561 size_t SegmentIndex::ComputeSizeInternal() {
        2562  version = IsFitIn32Bits(earliest_presentation_time, first_offset) ? 0 : 1;
        2563  return HeaderSize() + sizeof(reference_id) + sizeof(timescale) +
        2564  sizeof(uint32_t) * (1 + version) * 2 + 2 * sizeof(uint16_t) +
        2565  3 * sizeof(uint32_t) * references.size();
        2566 }
        2567 
        2568 MediaData::MediaData() : data_size(0) {}
        2569 MediaData::~MediaData() {}
        2570 FourCC MediaData::BoxType() const { return FOURCC_mdat; }
        2571 
        2572 bool MediaData::ReadWriteInternal(BoxBuffer* buffer) {
        2573  NOTIMPLEMENTED() << "Actual data is parsed and written separately.";
        2574  return false;
        2575 }
        2576 
        2577 size_t MediaData::ComputeSizeInternal() {
        2578  return HeaderSize() + data_size;
        2579 }
        2580 
        2581 CueSourceIDBox::CueSourceIDBox() : source_id(kCueSourceIdNotSet) {}
        2582 CueSourceIDBox::~CueSourceIDBox() {}
        2583 
        2584 FourCC CueSourceIDBox::BoxType() const { return FOURCC_vsid; }
        2585 
        2586 bool CueSourceIDBox::ReadWriteInternal(BoxBuffer* buffer) {
        2587  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->ReadWriteInt32(&source_id));
        2588  return true;
        2589 }
        2590 
        2591 size_t CueSourceIDBox::ComputeSizeInternal() {
        2592  if (source_id == kCueSourceIdNotSet)
        2593  return 0;
        2594  return HeaderSize() + sizeof(source_id);
        2595 }
        2596 
        2597 CueTimeBox::CueTimeBox() {}
        2598 CueTimeBox::~CueTimeBox() {}
        2599 
        2600 FourCC CueTimeBox::BoxType() const {
        2601  return FOURCC_ctim;
        2602 }
        2603 
        2604 bool CueTimeBox::ReadWriteInternal(BoxBuffer* buffer) {
        2605  RCHECK(ReadWriteHeaderInternal(buffer));
        2606  return buffer->ReadWriteString(
        2607  &cue_current_time,
        2608  buffer->Reading() ? buffer->BytesLeft() : cue_current_time.size());
        2609 }
        2610 
        2611 size_t CueTimeBox::ComputeSizeInternal() {
        2612  if (cue_current_time.empty())
        2613  return 0;
        2614  return HeaderSize() + cue_current_time.size();
        2615 }
        2616 
        2617 CueIDBox::CueIDBox() {}
        2618 CueIDBox::~CueIDBox() {}
        2619 
        2620 FourCC CueIDBox::BoxType() const {
        2621  return FOURCC_iden;
        2622 }
        2623 
        2624 bool CueIDBox::ReadWriteInternal(BoxBuffer* buffer) {
        2625  RCHECK(ReadWriteHeaderInternal(buffer));
        2626  return buffer->ReadWriteString(
        2627  &cue_id, buffer->Reading() ? buffer->BytesLeft() : cue_id.size());
        2628 }
        2629 
        2630 size_t CueIDBox::ComputeSizeInternal() {
        2631  if (cue_id.empty())
        2632  return 0;
        2633  return HeaderSize() + cue_id.size();
        2634 }
        2635 
        2636 CueSettingsBox::CueSettingsBox() {}
        2637 CueSettingsBox::~CueSettingsBox() {}
        2638 
        2639 FourCC CueSettingsBox::BoxType() const {
        2640  return FOURCC_sttg;
        2641 }
        2642 
        2643 bool CueSettingsBox::ReadWriteInternal(BoxBuffer* buffer) {
        2644  RCHECK(ReadWriteHeaderInternal(buffer));
        2645  return buffer->ReadWriteString(
        2646  &settings, buffer->Reading() ? buffer->BytesLeft() : settings.size());
        2647 }
        2648 
        2649 size_t CueSettingsBox::ComputeSizeInternal() {
        2650  if (settings.empty())
        2651  return 0;
        2652  return HeaderSize() + settings.size();
        2653 }
        2654 
        2655 CuePayloadBox::CuePayloadBox() {}
        2656 CuePayloadBox::~CuePayloadBox() {}
        2657 
        2658 FourCC CuePayloadBox::BoxType() const {
        2659  return FOURCC_payl;
        2660 }
        2661 
        2662 bool CuePayloadBox::ReadWriteInternal(BoxBuffer* buffer) {
        2663  RCHECK(ReadWriteHeaderInternal(buffer));
        2664  return buffer->ReadWriteString(
        2665  &cue_text, buffer->Reading() ? buffer->BytesLeft() : cue_text.size());
        2666 }
        2667 
        2668 size_t CuePayloadBox::ComputeSizeInternal() {
        2669  return HeaderSize() + cue_text.size();
        2670 }
        2671 
        2672 VTTEmptyCueBox::VTTEmptyCueBox() {}
        2673 VTTEmptyCueBox::~VTTEmptyCueBox() {}
        2674 
        2675 FourCC VTTEmptyCueBox::BoxType() const {
        2676  return FOURCC_vtte;
        2677 }
        2678 
        2679 bool VTTEmptyCueBox::ReadWriteInternal(BoxBuffer* buffer) {
        2680  return ReadWriteHeaderInternal(buffer);
        2681 }
        2682 
        2683 size_t VTTEmptyCueBox::ComputeSizeInternal() {
        2684  return HeaderSize();
        2685 }
        2686 
        2687 VTTAdditionalTextBox::VTTAdditionalTextBox() {}
        2688 VTTAdditionalTextBox::~VTTAdditionalTextBox() {}
        2689 
        2691  return FOURCC_vtta;
        2692 }
        2693 
        2694 bool VTTAdditionalTextBox::ReadWriteInternal(BoxBuffer* buffer) {
        2695  RCHECK(ReadWriteHeaderInternal(buffer));
        2696  return buffer->ReadWriteString(
        2697  &cue_additional_text,
        2698  buffer->Reading() ? buffer->BytesLeft() : cue_additional_text.size());
        2699 }
        2700 
        2701 size_t VTTAdditionalTextBox::ComputeSizeInternal() {
        2702  return HeaderSize() + cue_additional_text.size();
        2703 }
        2704 
        2705 VTTCueBox::VTTCueBox() {}
        2706 VTTCueBox::~VTTCueBox() {}
        2707 
        2708 FourCC VTTCueBox::BoxType() const {
        2709  return FOURCC_vttc;
        2710 }
        2711 
        2712 bool VTTCueBox::ReadWriteInternal(BoxBuffer* buffer) {
        2713  RCHECK(ReadWriteHeaderInternal(buffer) &&
        2714  buffer->PrepareChildren() &&
        2715  buffer->TryReadWriteChild(&cue_source_id) &&
        2716  buffer->TryReadWriteChild(&cue_id) &&
        2717  buffer->TryReadWriteChild(&cue_time) &&
        2718  buffer->TryReadWriteChild(&cue_settings) &&
        2719  buffer->ReadWriteChild(&cue_payload));
        2720  return true;
        2721 }
        2722 
        2723 size_t VTTCueBox::ComputeSizeInternal() {
        2724  return HeaderSize() + cue_source_id.ComputeSize() + cue_id.ComputeSize() +
        2725  cue_time.ComputeSize() + cue_settings.ComputeSize() +
        2726  cue_payload.ComputeSize();
        2727 }
        2728 
        2729 } // namespace mp4
        2730 } // namespace media
        2731 } // namespace shaka
        FourCC BoxType() const override
        - - +
        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 #include "packager/media/formats/mp4/box_definitions.h"
        6 
        7 #include <limits>
        8 
        9 #include "packager/base/logging.h"
        10 #include "packager/media/base/bit_reader.h"
        11 #include "packager/media/base/macros.h"
        12 #include "packager/media/base/rcheck.h"
        13 #include "packager/media/formats/mp4/box_buffer.h"
        14 
        15 namespace {
        16 const uint32_t kFourCCSize = 4;
        17 
        18 // Key Id size as defined in CENC spec.
        19 const uint32_t kCencKeyIdSize = 16;
        20 
        21 // 9 uint32_t in big endian formatted array.
        22 const uint8_t kUnityMatrix[] = {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        23  0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
        24  0, 0, 0, 0, 0, 0, 0, 0, 0x40, 0, 0, 0};
        25 
        26 // Default entries for HandlerReference box.
        27 const char kVideoHandlerName[] = "VideoHandler";
        28 const char kAudioHandlerName[] = "SoundHandler";
        29 const char kTextHandlerName[] = "TextHandler";
        30 
        31 // Default values for VideoSampleEntry box.
        32 const uint32_t kVideoResolution = 0x00480000; // 72 dpi.
        33 const uint16_t kVideoFrameCount = 1;
        34 const uint16_t kVideoDepth = 0x0018;
        35 
        36 const uint32_t kCompressorNameSize = 32u;
        37 const char kAvcCompressorName[] = "\012AVC Coding";
        38 const char kHevcCompressorName[] = "\013HEVC Coding";
        39 const char kVpcCompressorName[] = "\012VPC Coding";
        40 
        41 // According to ISO/IEC FDIS 23001-7: CENC spec, IV should be either
        42 // 64-bit (8-byte) or 128-bit (16-byte).
        43 // |per_sample_iv_size| of 0 means constant_iv is used.
        44 bool IsIvSizeValid(uint8_t per_sample_iv_size) {
        45  return per_sample_iv_size == 0 || per_sample_iv_size == 8 ||
        46  per_sample_iv_size == 16;
        47 }
        48 
        49 // Default values to construct the following fields in ddts box. Values are set
        50 // according to FFMPEG.
        51 // bit(2) FrameDuration; // 3 = 4096
        52 // bit(5) StreamConstruction; // 18
        53 // bit(1) CoreLFEPresent; // 0 = none
        54 // bit(6) CoreLayout; // 31 = ignore core layout
        55 // bit(14) CoreSize; // 0
        56 // bit(1) StereoDownmix // 0 = none
        57 // bit(3) RepresentationType; // 4
        58 // bit(16) ChannelLayout; // 0xf = 5.1 channel layout.
        59 // bit(1) MultiAssetFlag // 0 = single asset
        60 // bit(1) LBRDurationMod // 0 = ignore
        61 // bit(1) ReservedBoxPresent // 0 = none
        62 // bit(5) Reserved // 0
        63 const uint8_t kDdtsExtraData[] = {0xe4, 0x7c, 0, 4, 0, 0x0f, 0};
        64 
        65 // Utility functions to check if the 64bit integers can fit in 32bit integer.
        66 bool IsFitIn32Bits(uint64_t a) {
        67  return a <= std::numeric_limits<uint32_t>::max();
        68 }
        69 
        70 bool IsFitIn32Bits(int64_t a) {
        71  return a <= std::numeric_limits<int32_t>::max() &&
        72  a >= std::numeric_limits<int32_t>::min();
        73 }
        74 
        75 template <typename T1, typename T2>
        76 bool IsFitIn32Bits(T1 a1, T2 a2) {
        77  return IsFitIn32Bits(a1) && IsFitIn32Bits(a2);
        78 }
        79 
        80 template <typename T1, typename T2, typename T3>
        81 bool IsFitIn32Bits(T1 a1, T2 a2, T3 a3) {
        82  return IsFitIn32Bits(a1) && IsFitIn32Bits(a2) && IsFitIn32Bits(a3);
        83 }
        84 
        85 } // namespace
        86 
        87 namespace shaka {
        88 namespace media {
        89 namespace mp4 {
        90 
        91 namespace {
        92 
        93 TrackType FourCCToTrackType(FourCC fourcc) {
        94  switch (fourcc) {
        95  case FOURCC_vide:
        96  return kVideo;
        97  case FOURCC_soun:
        98  return kAudio;
        99  case FOURCC_text:
        100  return kText;
        101  default:
        102  return kInvalid;
        103  }
        104 }
        105 
        106 FourCC TrackTypeToFourCC(TrackType track_type) {
        107  switch (track_type) {
        108  case kVideo:
        109  return FOURCC_vide;
        110  case kAudio:
        111  return FOURCC_soun;
        112  case kText:
        113  return FOURCC_text;
        114  default:
        115  return FOURCC_NULL;
        116  }
        117 }
        118 
        119 bool IsProtectionSchemeSupported(FourCC scheme) {
        120  return scheme == FOURCC_cenc || scheme == FOURCC_cens ||
        121  scheme == FOURCC_cbc1 || scheme == FOURCC_cbcs;
        122 }
        123 
        124 } // namespace
        125 
        126 FileType::FileType() = default;
        127 FileType::~FileType() = default;
        128 
        129 FourCC FileType::BoxType() const {
        130  return FOURCC_ftyp;
        131 }
        132 
        133 bool FileType::ReadWriteInternal(BoxBuffer* buffer) {
        134  RCHECK(ReadWriteHeaderInternal(buffer) &&
        135  buffer->ReadWriteFourCC(&major_brand) &&
        136  buffer->ReadWriteUInt32(&minor_version));
        137  size_t num_brands;
        138  if (buffer->Reading()) {
        139  RCHECK(buffer->BytesLeft() % sizeof(FourCC) == 0);
        140  num_brands = buffer->BytesLeft() / sizeof(FourCC);
        141  compatible_brands.resize(num_brands);
        142  } else {
        143  num_brands = compatible_brands.size();
        144  }
        145  for (size_t i = 0; i < num_brands; ++i)
        146  RCHECK(buffer->ReadWriteFourCC(&compatible_brands[i]));
        147  return true;
        148 }
        149 
        150 size_t FileType::ComputeSizeInternal() {
        151  return HeaderSize() + kFourCCSize + sizeof(minor_version) +
        152  kFourCCSize * compatible_brands.size();
        153 }
        154 
        155 FourCC SegmentType::BoxType() const {
        156  return FOURCC_styp;
        157 }
        158 
        159 ProtectionSystemSpecificHeader::ProtectionSystemSpecificHeader() = default;
        160 ProtectionSystemSpecificHeader::~ProtectionSystemSpecificHeader() = default;
        161 
        163  return FOURCC_pssh;
        164 }
        165 
        166 bool ProtectionSystemSpecificHeader::ReadWriteInternal(BoxBuffer* buffer) {
        167  if (buffer->Reading()) {
        168  BoxReader* reader = buffer->reader();
        169  DCHECK(reader);
        170  raw_box.assign(reader->data(), reader->data() + reader->size());
        171  } else {
        172  DCHECK(!raw_box.empty());
        173  buffer->writer()->AppendVector(raw_box);
        174  }
        175 
        176  return true;
        177 }
        178 
        179 size_t ProtectionSystemSpecificHeader::ComputeSizeInternal() {
        180  return raw_box.size();
        181 }
        182 
        183 SampleAuxiliaryInformationOffset::SampleAuxiliaryInformationOffset() = default;
        184 SampleAuxiliaryInformationOffset::~SampleAuxiliaryInformationOffset() = default;
        185 
        187  return FOURCC_saio;
        188 }
        189 
        190 bool SampleAuxiliaryInformationOffset::ReadWriteInternal(BoxBuffer* buffer) {
        191  RCHECK(ReadWriteHeaderInternal(buffer));
        192  if (flags & 1)
        193  RCHECK(buffer->IgnoreBytes(8)); // aux_info_type and parameter.
        194 
        195  uint32_t count = static_cast<uint32_t>(offsets.size());
        196  RCHECK(buffer->ReadWriteUInt32(&count));
        197  offsets.resize(count);
        198 
        199  size_t num_bytes = (version == 1) ? sizeof(uint64_t) : sizeof(uint32_t);
        200  for (uint32_t i = 0; i < count; ++i)
        201  RCHECK(buffer->ReadWriteUInt64NBytes(&offsets[i], num_bytes));
        202  return true;
        203 }
        204 
        205 size_t SampleAuxiliaryInformationOffset::ComputeSizeInternal() {
        206  // This box is optional. Skip it if it is empty.
        207  if (offsets.size() == 0)
        208  return 0;
        209  size_t num_bytes = (version == 1) ? sizeof(uint64_t) : sizeof(uint32_t);
        210  return HeaderSize() + sizeof(uint32_t) + num_bytes * offsets.size();
        211 }
        212 
        213 SampleAuxiliaryInformationSize::SampleAuxiliaryInformationSize() = default;
        214 SampleAuxiliaryInformationSize::~SampleAuxiliaryInformationSize() = default;
        215 
        217  return FOURCC_saiz;
        218 }
        219 
        220 bool SampleAuxiliaryInformationSize::ReadWriteInternal(BoxBuffer* buffer) {
        221  RCHECK(ReadWriteHeaderInternal(buffer));
        222  if (flags & 1)
        223  RCHECK(buffer->IgnoreBytes(8));
        224 
        225  RCHECK(buffer->ReadWriteUInt8(&default_sample_info_size) &&
        226  buffer->ReadWriteUInt32(&sample_count));
        227  if (default_sample_info_size == 0)
        228  RCHECK(buffer->ReadWriteVector(&sample_info_sizes, sample_count));
        229  return true;
        230 }
        231 
        232 size_t SampleAuxiliaryInformationSize::ComputeSizeInternal() {
        233  // This box is optional. Skip it if it is empty.
        234  if (sample_count == 0)
        235  return 0;
        236  return HeaderSize() + sizeof(default_sample_info_size) +
        237  sizeof(sample_count) +
        238  (default_sample_info_size == 0 ? sample_info_sizes.size() : 0);
        239 }
        240 
        241 bool SampleEncryptionEntry::ReadWrite(uint8_t iv_size,
        242  bool has_subsamples,
        243  BoxBuffer* buffer) {
        244  DCHECK(IsIvSizeValid(iv_size));
        245  DCHECK(buffer);
        246 
        247  RCHECK(buffer->ReadWriteVector(&initialization_vector, iv_size));
        248 
        249  if (!has_subsamples) {
        250  subsamples.clear();
        251  return true;
        252  }
        253 
        254  uint16_t subsample_count = static_cast<uint16_t>(subsamples.size());
        255  RCHECK(buffer->ReadWriteUInt16(&subsample_count));
        256  RCHECK(subsample_count > 0);
        257  subsamples.resize(subsample_count);
        258  for (auto& subsample : subsamples) {
        259  RCHECK(buffer->ReadWriteUInt16(&subsample.clear_bytes) &&
        260  buffer->ReadWriteUInt32(&subsample.cipher_bytes));
        261  }
        262  return true;
        263 }
        264 
        266  bool has_subsamples,
        267  BufferReader* reader) {
        268  DCHECK(IsIvSizeValid(iv_size));
        269  DCHECK(reader);
        270 
        271  initialization_vector.resize(iv_size);
        272  RCHECK(reader->ReadToVector(&initialization_vector, iv_size));
        273 
        274  if (!has_subsamples) {
        275  subsamples.clear();
        276  return true;
        277  }
        278 
        279  uint16_t subsample_count;
        280  RCHECK(reader->Read2(&subsample_count));
        281  RCHECK(subsample_count > 0);
        282  subsamples.resize(subsample_count);
        283  for (auto& subsample : subsamples) {
        284  RCHECK(reader->Read2(&subsample.clear_bytes) &&
        285  reader->Read4(&subsample.cipher_bytes));
        286  }
        287  return true;
        288 }
        289 
        291  const uint32_t subsample_entry_size = sizeof(uint16_t) + sizeof(uint32_t);
        292  const uint16_t subsample_count = static_cast<uint16_t>(subsamples.size());
        293  return static_cast<uint32_t>(
        294  initialization_vector.size() +
        295  (subsample_count > 0
        296  ? (sizeof(subsample_count) + subsample_entry_size * subsample_count)
        297  : 0));
        298 }
        299 
        301  uint32_t size = 0;
        302  for (uint32_t i = 0; i < subsamples.size(); ++i)
        303  size += subsamples[i].clear_bytes + subsamples[i].cipher_bytes;
        304  return size;
        305 }
        306 
        307 SampleEncryption::SampleEncryption() = default;
        308 SampleEncryption::~SampleEncryption() = default;
        309 
        311  return FOURCC_senc;
        312 }
        313 
        314 bool SampleEncryption::ReadWriteInternal(BoxBuffer* buffer) {
        315  RCHECK(ReadWriteHeaderInternal(buffer));
        316 
        317  // If we don't know |iv_size|, store sample encryption data to parse later
        318  // after we know iv_size.
        319  if (buffer->Reading() && iv_size == SampleEncryption::kInvalidIvSize) {
        320  RCHECK(
        321  buffer->ReadWriteVector(&sample_encryption_data, buffer->BytesLeft()));
        322  return true;
        323  }
        324 
        325  if (!IsIvSizeValid(iv_size)) {
        326  LOG(ERROR)
        327  << "IV_size can only be 8 or 16 or 0 for constant iv, but seeing "
        328  << iv_size;
        329  return false;
        330  }
        331 
        332  uint32_t sample_count =
        333  static_cast<uint32_t>(sample_encryption_entries.size());
        334  RCHECK(buffer->ReadWriteUInt32(&sample_count));
        335 
        336  sample_encryption_entries.resize(sample_count);
        337  for (auto& sample_encryption_entry : sample_encryption_entries) {
        338  RCHECK(sample_encryption_entry.ReadWrite(
        339  iv_size, (flags & kUseSubsampleEncryption) != 0, buffer) != 0);
        340  }
        341  return true;
        342 }
        343 
        344 size_t SampleEncryption::ComputeSizeInternal() {
        345  const uint32_t sample_count =
        346  static_cast<uint32_t>(sample_encryption_entries.size());
        347  if (sample_count == 0) {
        348  // Sample encryption box is optional. Skip it if it is empty.
        349  return 0;
        350  }
        351 
        352  DCHECK(IsIvSizeValid(iv_size));
        353  size_t box_size = HeaderSize() + sizeof(sample_count);
        354  if (flags & kUseSubsampleEncryption) {
        355  for (const SampleEncryptionEntry& sample_encryption_entry :
        356  sample_encryption_entries) {
        357  box_size += sample_encryption_entry.ComputeSize();
        358  }
        359  } else {
        360  box_size += sample_count * iv_size;
        361  }
        362  return box_size;
        363 }
        364 
        366  uint8_t iv_size,
        367  std::vector<SampleEncryptionEntry>* sample_encryption_entries) const {
        368  DCHECK(IsIvSizeValid(iv_size));
        369 
        370  BufferReader reader(sample_encryption_data.data(),
        371  sample_encryption_data.size());
        372  uint32_t sample_count = 0;
        373  RCHECK(reader.Read4(&sample_count));
        374 
        375  sample_encryption_entries->resize(sample_count);
        376  for (auto& sample_encryption_entry : *sample_encryption_entries) {
        377  RCHECK(sample_encryption_entry.ParseFromBuffer(
        378  iv_size, (flags & kUseSubsampleEncryption) != 0, &reader) != 0);
        379  }
        380  return true;
        381 }
        382 
        383 OriginalFormat::OriginalFormat() = default;
        384 OriginalFormat::~OriginalFormat() = default;
        385 
        386 FourCC OriginalFormat::BoxType() const {
        387  return FOURCC_frma;
        388 }
        389 
        390 bool OriginalFormat::ReadWriteInternal(BoxBuffer* buffer) {
        391  return ReadWriteHeaderInternal(buffer) && buffer->ReadWriteFourCC(&format);
        392 }
        393 
        394 size_t OriginalFormat::ComputeSizeInternal() {
        395  return HeaderSize() + kFourCCSize;
        396 }
        397 
        398 SchemeType::SchemeType() = default;
        399 SchemeType::~SchemeType() = default;
        400 
        401 FourCC SchemeType::BoxType() const {
        402  return FOURCC_schm;
        403 }
        404 
        405 bool SchemeType::ReadWriteInternal(BoxBuffer* buffer) {
        406  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->ReadWriteFourCC(&type) &&
        407  buffer->ReadWriteUInt32(&version));
        408  return true;
        409 }
        410 
        411 size_t SchemeType::ComputeSizeInternal() {
        412  return HeaderSize() + kFourCCSize + sizeof(version);
        413 }
        414 
        415 TrackEncryption::TrackEncryption() = default;
        416 TrackEncryption::~TrackEncryption() = default;
        417 
        418 FourCC TrackEncryption::BoxType() const {
        419  return FOURCC_tenc;
        420 }
        421 
        422 bool TrackEncryption::ReadWriteInternal(BoxBuffer* buffer) {
        423  if (!buffer->Reading()) {
        424  if (default_kid.size() != kCencKeyIdSize) {
        425  LOG(WARNING) << "CENC defines key id length of " << kCencKeyIdSize
        426  << " bytes; got " << default_kid.size()
        427  << ". Resized accordingly.";
        428  default_kid.resize(kCencKeyIdSize);
        429  }
        430  RCHECK(default_crypt_byte_block < 16 && default_skip_byte_block < 16);
        431  if (default_crypt_byte_block != 0 && default_skip_byte_block != 0) {
        432  // Version 1 box is needed for pattern-based encryption.
        433  version = 1;
        434  }
        435  }
        436 
        437  RCHECK(ReadWriteHeaderInternal(buffer) &&
        438  buffer->IgnoreBytes(1)); // reserved.
        439 
        440  uint8_t pattern = default_crypt_byte_block << 4 | default_skip_byte_block;
        441  RCHECK(buffer->ReadWriteUInt8(&pattern));
        442  default_crypt_byte_block = pattern >> 4;
        443  default_skip_byte_block = pattern & 0x0F;
        444 
        445  RCHECK(buffer->ReadWriteUInt8(&default_is_protected) &&
        446  buffer->ReadWriteUInt8(&default_per_sample_iv_size) &&
        447  buffer->ReadWriteVector(&default_kid, kCencKeyIdSize));
        448 
        449  if (default_is_protected == 1) {
        450  if (default_per_sample_iv_size == 0) { // For constant iv.
        451  uint8_t default_constant_iv_size =
        452  static_cast<uint8_t>(default_constant_iv.size());
        453  RCHECK(buffer->ReadWriteUInt8(&default_constant_iv_size));
        454  RCHECK(default_constant_iv_size == 8 || default_constant_iv_size == 16);
        455  RCHECK(buffer->ReadWriteVector(&default_constant_iv,
        456  default_constant_iv_size));
        457  } else {
        458  RCHECK(default_per_sample_iv_size == 8 ||
        459  default_per_sample_iv_size == 16);
        460  RCHECK(default_constant_iv.empty());
        461  }
        462  } else {
        463  // Expect |default_is_protected| to be 0, i.e. not protected. Other values
        464  // of |default_is_protected| is not supported.
        465  RCHECK(default_is_protected == 0);
        466  RCHECK(default_per_sample_iv_size == 0);
        467  RCHECK(default_constant_iv.empty());
        468  }
        469  return true;
        470 }
        471 
        472 size_t TrackEncryption::ComputeSizeInternal() {
        473  return HeaderSize() + sizeof(uint32_t) + kCencKeyIdSize +
        474  (default_constant_iv.empty()
        475  ? 0
        476  : (sizeof(uint8_t) + default_constant_iv.size()));
        477 }
        478 
        479 SchemeInfo::SchemeInfo() = default;
        480 SchemeInfo::~SchemeInfo() = default;
        481 
        482 FourCC SchemeInfo::BoxType() const {
        483  return FOURCC_schi;
        484 }
        485 
        486 bool SchemeInfo::ReadWriteInternal(BoxBuffer* buffer) {
        487  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->PrepareChildren() &&
        488  buffer->ReadWriteChild(&track_encryption));
        489  return true;
        490 }
        491 
        492 size_t SchemeInfo::ComputeSizeInternal() {
        493  return HeaderSize() + track_encryption.ComputeSize();
        494 }
        495 
        496 ProtectionSchemeInfo::ProtectionSchemeInfo() = default;
        497 ProtectionSchemeInfo::~ProtectionSchemeInfo() = default;
        498 
        500  return FOURCC_sinf;
        501 }
        502 
        503 bool ProtectionSchemeInfo::ReadWriteInternal(BoxBuffer* buffer) {
        504  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->PrepareChildren() &&
        505  buffer->ReadWriteChild(&format) && buffer->ReadWriteChild(&type));
        506  if (IsProtectionSchemeSupported(type.type)) {
        507  RCHECK(buffer->ReadWriteChild(&info));
        508  } else {
        509  DLOG(WARNING) << "Ignore unsupported protection scheme: "
        510  << FourCCToString(type.type);
        511  }
        512  // Other protection schemes are silently ignored. Since the protection scheme
        513  // type can't be determined until this box is opened, we return 'true' for
        514  // non-CENC protection scheme types. It is the parent box's responsibility to
        515  // ensure that this scheme type is a supported one.
        516  return true;
        517 }
        518 
        519 size_t ProtectionSchemeInfo::ComputeSizeInternal() {
        520  // Skip sinf box if it is not initialized.
        521  if (format.format == FOURCC_NULL)
        522  return 0;
        523  return HeaderSize() + format.ComputeSize() + type.ComputeSize() +
        524  info.ComputeSize();
        525 }
        526 
        527 MovieHeader::MovieHeader() = default;
        528 MovieHeader::~MovieHeader() = default;
        529 
        530 FourCC MovieHeader::BoxType() const {
        531  return FOURCC_mvhd;
        532 }
        533 
        534 bool MovieHeader::ReadWriteInternal(BoxBuffer* buffer) {
        535  RCHECK(ReadWriteHeaderInternal(buffer));
        536 
        537  size_t num_bytes = (version == 1) ? sizeof(uint64_t) : sizeof(uint32_t);
        538  RCHECK(buffer->ReadWriteUInt64NBytes(&creation_time, num_bytes) &&
        539  buffer->ReadWriteUInt64NBytes(&modification_time, num_bytes) &&
        540  buffer->ReadWriteUInt32(&timescale) &&
        541  buffer->ReadWriteUInt64NBytes(&duration, num_bytes));
        542 
        543  std::vector<uint8_t> matrix(kUnityMatrix,
        544  kUnityMatrix + arraysize(kUnityMatrix));
        545  RCHECK(buffer->ReadWriteInt32(&rate) && buffer->ReadWriteInt16(&volume) &&
        546  buffer->IgnoreBytes(10) && // reserved
        547  buffer->ReadWriteVector(&matrix, matrix.size()) &&
        548  buffer->IgnoreBytes(24) && // predefined zero
        549  buffer->ReadWriteUInt32(&next_track_id));
        550  return true;
        551 }
        552 
        553 size_t MovieHeader::ComputeSizeInternal() {
        554  version = IsFitIn32Bits(creation_time, modification_time, duration) ? 0 : 1;
        555  return HeaderSize() + sizeof(uint32_t) * (1 + version) * 3 +
        556  sizeof(timescale) + sizeof(rate) + sizeof(volume) +
        557  sizeof(next_track_id) + sizeof(kUnityMatrix) + 10 +
        558  24; // 10 bytes reserved, 24 bytes predefined.
        559 }
        560 
        561 TrackHeader::TrackHeader() {
        562  flags = kTrackEnabled | kTrackInMovie | kTrackInPreview;
        563 }
        564 
        565 TrackHeader::~TrackHeader() = default;
        566 
        567 FourCC TrackHeader::BoxType() const {
        568  return FOURCC_tkhd;
        569 }
        570 
        571 bool TrackHeader::ReadWriteInternal(BoxBuffer* buffer) {
        572  RCHECK(ReadWriteHeaderInternal(buffer));
        573 
        574  size_t num_bytes = (version == 1) ? sizeof(uint64_t) : sizeof(uint32_t);
        575  RCHECK(buffer->ReadWriteUInt64NBytes(&creation_time, num_bytes) &&
        576  buffer->ReadWriteUInt64NBytes(&modification_time, num_bytes) &&
        577  buffer->ReadWriteUInt32(&track_id) &&
        578  buffer->IgnoreBytes(4) && // reserved
        579  buffer->ReadWriteUInt64NBytes(&duration, num_bytes));
        580 
        581  if (!buffer->Reading()) {
        582  // Set default value for volume, if track is audio, 0x100 else 0.
        583  if (volume == -1)
        584  volume = (width != 0 && height != 0) ? 0 : 0x100;
        585  }
        586  std::vector<uint8_t> matrix(kUnityMatrix,
        587  kUnityMatrix + arraysize(kUnityMatrix));
        588  RCHECK(buffer->IgnoreBytes(8) && // reserved
        589  buffer->ReadWriteInt16(&layer) &&
        590  buffer->ReadWriteInt16(&alternate_group) &&
        591  buffer->ReadWriteInt16(&volume) &&
        592  buffer->IgnoreBytes(2) && // reserved
        593  buffer->ReadWriteVector(&matrix, matrix.size()) &&
        594  buffer->ReadWriteUInt32(&width) && buffer->ReadWriteUInt32(&height));
        595  return true;
        596 }
        597 
        598 size_t TrackHeader::ComputeSizeInternal() {
        599  version = IsFitIn32Bits(creation_time, modification_time, duration) ? 0 : 1;
        600  return HeaderSize() + sizeof(track_id) +
        601  sizeof(uint32_t) * (1 + version) * 3 + sizeof(layer) +
        602  sizeof(alternate_group) + sizeof(volume) + sizeof(width) +
        603  sizeof(height) + sizeof(kUnityMatrix) + 14; // 14 bytes reserved.
        604 }
        605 
        606 SampleDescription::SampleDescription() = default;
        607 SampleDescription::~SampleDescription() = default;
        608 
        610  return FOURCC_stsd;
        611 }
        612 
        613 bool SampleDescription::ReadWriteInternal(BoxBuffer* buffer) {
        614  uint32_t count = 0;
        615  switch (type) {
        616  case kVideo:
        617  count = static_cast<uint32_t>(video_entries.size());
        618  break;
        619  case kAudio:
        620  count = static_cast<uint32_t>(audio_entries.size());
        621  break;
        622  case kText:
        623  count = static_cast<uint32_t>(text_entries.size());
        624  break;
        625  default:
        626  NOTIMPLEMENTED() << "SampleDecryption type " << type
        627  << " is not handled. Skipping.";
        628  }
        629  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->ReadWriteUInt32(&count));
        630 
        631  if (buffer->Reading()) {
        632  BoxReader* reader = buffer->reader();
        633  DCHECK(reader);
        634  video_entries.clear();
        635  audio_entries.clear();
        636  // Note: this value is preset before scanning begins. See comments in the
        637  // Parse(Media*) function.
        638  if (type == kVideo) {
        639  RCHECK(reader->ReadAllChildren(&video_entries));
        640  RCHECK(video_entries.size() == count);
        641  } else if (type == kAudio) {
        642  RCHECK(reader->ReadAllChildren(&audio_entries));
        643  RCHECK(audio_entries.size() == count);
        644  } else if (type == kText) {
        645  RCHECK(reader->ReadAllChildren(&text_entries));
        646  RCHECK(text_entries.size() == count);
        647  }
        648  } else {
        649  DCHECK_LT(0u, count);
        650  if (type == kVideo) {
        651  for (uint32_t i = 0; i < count; ++i)
        652  RCHECK(buffer->ReadWriteChild(&video_entries[i]));
        653  } else if (type == kAudio) {
        654  for (uint32_t i = 0; i < count; ++i)
        655  RCHECK(buffer->ReadWriteChild(&audio_entries[i]));
        656  } else if (type == kText) {
        657  for (uint32_t i = 0; i < count; ++i)
        658  RCHECK(buffer->ReadWriteChild(&text_entries[i]));
        659  } else {
        660  NOTIMPLEMENTED();
        661  }
        662  }
        663  return true;
        664 }
        665 
        666 size_t SampleDescription::ComputeSizeInternal() {
        667  size_t box_size = HeaderSize() + sizeof(uint32_t);
        668  if (type == kVideo) {
        669  for (uint32_t i = 0; i < video_entries.size(); ++i)
        670  box_size += video_entries[i].ComputeSize();
        671  } else if (type == kAudio) {
        672  for (uint32_t i = 0; i < audio_entries.size(); ++i)
        673  box_size += audio_entries[i].ComputeSize();
        674  } else if (type == kText) {
        675  for (uint32_t i = 0; i < text_entries.size(); ++i)
        676  box_size += text_entries[i].ComputeSize();
        677  }
        678  return box_size;
        679 }
        680 
        681 DecodingTimeToSample::DecodingTimeToSample() = default;
        682 DecodingTimeToSample::~DecodingTimeToSample() = default;
        683 
        685  return FOURCC_stts;
        686 }
        687 
        688 bool DecodingTimeToSample::ReadWriteInternal(BoxBuffer* buffer) {
        689  uint32_t count = static_cast<uint32_t>(decoding_time.size());
        690  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->ReadWriteUInt32(&count));
        691 
        692  decoding_time.resize(count);
        693  for (uint32_t i = 0; i < count; ++i) {
        694  RCHECK(buffer->ReadWriteUInt32(&decoding_time[i].sample_count) &&
        695  buffer->ReadWriteUInt32(&decoding_time[i].sample_delta));
        696  }
        697  return true;
        698 }
        699 
        700 size_t DecodingTimeToSample::ComputeSizeInternal() {
        701  return HeaderSize() + sizeof(uint32_t) +
        702  sizeof(DecodingTime) * decoding_time.size();
        703 }
        704 
        705 CompositionTimeToSample::CompositionTimeToSample() = default;
        706 CompositionTimeToSample::~CompositionTimeToSample() = default;
        707 
        709  return FOURCC_ctts;
        710 }
        711 
        712 bool CompositionTimeToSample::ReadWriteInternal(BoxBuffer* buffer) {
        713  uint32_t count = static_cast<uint32_t>(composition_offset.size());
        714  if (!buffer->Reading()) {
        715  // Determine whether version 0 or version 1 should be used.
        716  // Use version 0 if possible, use version 1 if there is a negative
        717  // sample_offset value.
        718  version = 0;
        719  for (uint32_t i = 0; i < count; ++i) {
        720  if (composition_offset[i].sample_offset < 0) {
        721  version = 1;
        722  break;
        723  }
        724  }
        725  }
        726 
        727  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->ReadWriteUInt32(&count));
        728 
        729  composition_offset.resize(count);
        730  for (uint32_t i = 0; i < count; ++i) {
        731  RCHECK(buffer->ReadWriteUInt32(&composition_offset[i].sample_count));
        732 
        733  if (version == 0) {
        734  uint32_t sample_offset = composition_offset[i].sample_offset;
        735  RCHECK(buffer->ReadWriteUInt32(&sample_offset));
        736  composition_offset[i].sample_offset = sample_offset;
        737  } else {
        738  int32_t sample_offset = composition_offset[i].sample_offset;
        739  RCHECK(buffer->ReadWriteInt32(&sample_offset));
        740  composition_offset[i].sample_offset = sample_offset;
        741  }
        742  }
        743  return true;
        744 }
        745 
        746 size_t CompositionTimeToSample::ComputeSizeInternal() {
        747  // This box is optional. Skip it if it is empty.
        748  if (composition_offset.empty())
        749  return 0;
        750  // Structure CompositionOffset contains |sample_offset| (uint32_t) and
        751  // |sample_offset| (int64_t). The actual size of |sample_offset| is
        752  // 4 bytes (uint32_t for version 0 and int32_t for version 1).
        753  const size_t kCompositionOffsetSize = sizeof(uint32_t) * 2;
        754  return HeaderSize() + sizeof(uint32_t) +
        755  kCompositionOffsetSize * composition_offset.size();
        756 }
        757 
        758 SampleToChunk::SampleToChunk() = default;
        759 SampleToChunk::~SampleToChunk() = default;
        760 
        761 FourCC SampleToChunk::BoxType() const {
        762  return FOURCC_stsc;
        763 }
        764 
        765 bool SampleToChunk::ReadWriteInternal(BoxBuffer* buffer) {
        766  uint32_t count = static_cast<uint32_t>(chunk_info.size());
        767  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->ReadWriteUInt32(&count));
        768 
        769  chunk_info.resize(count);
        770  for (uint32_t i = 0; i < count; ++i) {
        771  RCHECK(buffer->ReadWriteUInt32(&chunk_info[i].first_chunk) &&
        772  buffer->ReadWriteUInt32(&chunk_info[i].samples_per_chunk) &&
        773  buffer->ReadWriteUInt32(&chunk_info[i].sample_description_index));
        774  // first_chunk values are always increasing.
        775  RCHECK(i == 0 ? chunk_info[i].first_chunk == 1
        776  : chunk_info[i].first_chunk > chunk_info[i - 1].first_chunk);
        777  }
        778  return true;
        779 }
        780 
        781 size_t SampleToChunk::ComputeSizeInternal() {
        782  return HeaderSize() + sizeof(uint32_t) +
        783  sizeof(ChunkInfo) * chunk_info.size();
        784 }
        785 
        786 SampleSize::SampleSize() = default;
        787 SampleSize::~SampleSize() = default;
        788 
        789 FourCC SampleSize::BoxType() const {
        790  return FOURCC_stsz;
        791 }
        792 
        793 bool SampleSize::ReadWriteInternal(BoxBuffer* buffer) {
        794  RCHECK(ReadWriteHeaderInternal(buffer) &&
        795  buffer->ReadWriteUInt32(&sample_size) &&
        796  buffer->ReadWriteUInt32(&sample_count));
        797 
        798  if (sample_size == 0) {
        799  if (buffer->Reading())
        800  sizes.resize(sample_count);
        801  else
        802  DCHECK(sample_count == sizes.size());
        803  for (uint32_t i = 0; i < sample_count; ++i)
        804  RCHECK(buffer->ReadWriteUInt32(&sizes[i]));
        805  }
        806  return true;
        807 }
        808 
        809 size_t SampleSize::ComputeSizeInternal() {
        810  return HeaderSize() + sizeof(sample_size) + sizeof(sample_count) +
        811  (sample_size == 0 ? sizeof(uint32_t) * sizes.size() : 0);
        812 }
        813 
        814 CompactSampleSize::CompactSampleSize() = default;
        815 CompactSampleSize::~CompactSampleSize() = default;
        816 
        818  return FOURCC_stz2;
        819 }
        820 
        821 bool CompactSampleSize::ReadWriteInternal(BoxBuffer* buffer) {
        822  uint32_t sample_count = static_cast<uint32_t>(sizes.size());
        823  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->IgnoreBytes(3) &&
        824  buffer->ReadWriteUInt8(&field_size) &&
        825  buffer->ReadWriteUInt32(&sample_count));
        826 
        827  // Reserve one more entry if field size is 4 bits.
        828  sizes.resize(sample_count + (field_size == 4 ? 1 : 0), 0);
        829  switch (field_size) {
        830  case 4:
        831  for (uint32_t i = 0; i < sample_count; i += 2) {
        832  if (buffer->Reading()) {
        833  uint8_t size = 0;
        834  RCHECK(buffer->ReadWriteUInt8(&size));
        835  sizes[i] = size >> 4;
        836  sizes[i + 1] = size & 0x0F;
        837  } else {
        838  DCHECK_LT(sizes[i], 16u);
        839  DCHECK_LT(sizes[i + 1], 16u);
        840  uint8_t size = (sizes[i] << 4) | sizes[i + 1];
        841  RCHECK(buffer->ReadWriteUInt8(&size));
        842  }
        843  }
        844  break;
        845  case 8:
        846  for (uint32_t i = 0; i < sample_count; ++i) {
        847  uint8_t size = sizes[i];
        848  RCHECK(buffer->ReadWriteUInt8(&size));
        849  sizes[i] = size;
        850  }
        851  break;
        852  case 16:
        853  for (uint32_t i = 0; i < sample_count; ++i) {
        854  uint16_t size = sizes[i];
        855  RCHECK(buffer->ReadWriteUInt16(&size));
        856  sizes[i] = size;
        857  }
        858  break;
        859  default:
        860  RCHECK(false);
        861  }
        862  sizes.resize(sample_count);
        863  return true;
        864 }
        865 
        866 size_t CompactSampleSize::ComputeSizeInternal() {
        867  return HeaderSize() + sizeof(uint32_t) + sizeof(uint32_t) +
        868  (field_size * sizes.size() + 7) / 8;
        869 }
        870 
        871 ChunkOffset::ChunkOffset() = default;
        872 ChunkOffset::~ChunkOffset() = default;
        873 
        874 FourCC ChunkOffset::BoxType() const {
        875  return FOURCC_stco;
        876 }
        877 
        878 bool ChunkOffset::ReadWriteInternal(BoxBuffer* buffer) {
        879  uint32_t count = static_cast<uint32_t>(offsets.size());
        880  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->ReadWriteUInt32(&count));
        881 
        882  offsets.resize(count);
        883  for (uint32_t i = 0; i < count; ++i)
        884  RCHECK(buffer->ReadWriteUInt64NBytes(&offsets[i], sizeof(uint32_t)));
        885  return true;
        886 }
        887 
        888 size_t ChunkOffset::ComputeSizeInternal() {
        889  return HeaderSize() + sizeof(uint32_t) + sizeof(uint32_t) * offsets.size();
        890 }
        891 
        892 ChunkLargeOffset::ChunkLargeOffset() = default;
        893 ChunkLargeOffset::~ChunkLargeOffset() = default;
        894 
        896  return FOURCC_co64;
        897 }
        898 
        899 bool ChunkLargeOffset::ReadWriteInternal(BoxBuffer* buffer) {
        900  uint32_t count = static_cast<uint32_t>(offsets.size());
        901 
        902  if (!buffer->Reading()) {
        903  // Switch to ChunkOffset box if it is able to fit in 32 bits offset.
        904  if (count == 0 || IsFitIn32Bits(offsets[count - 1])) {
        905  ChunkOffset stco;
        906  stco.offsets.swap(offsets);
        907  DCHECK(buffer->writer());
        908  stco.Write(buffer->writer());
        909  stco.offsets.swap(offsets);
        910  return true;
        911  }
        912  }
        913 
        914  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->ReadWriteUInt32(&count));
        915 
        916  offsets.resize(count);
        917  for (uint32_t i = 0; i < count; ++i)
        918  RCHECK(buffer->ReadWriteUInt64(&offsets[i]));
        919  return true;
        920 }
        921 
        922 size_t ChunkLargeOffset::ComputeSizeInternal() {
        923  uint32_t count = static_cast<uint32_t>(offsets.size());
        924  int use_large_offset =
        925  (count > 0 && !IsFitIn32Bits(offsets[count - 1])) ? 1 : 0;
        926  return HeaderSize() + sizeof(count) +
        927  sizeof(uint32_t) * (1 + use_large_offset) * offsets.size();
        928 }
        929 
        930 SyncSample::SyncSample() = default;
        931 SyncSample::~SyncSample() = default;
        932 
        933 FourCC SyncSample::BoxType() const {
        934  return FOURCC_stss;
        935 }
        936 
        937 bool SyncSample::ReadWriteInternal(BoxBuffer* buffer) {
        938  uint32_t count = static_cast<uint32_t>(sample_number.size());
        939  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->ReadWriteUInt32(&count));
        940 
        941  sample_number.resize(count);
        942  for (uint32_t i = 0; i < count; ++i)
        943  RCHECK(buffer->ReadWriteUInt32(&sample_number[i]));
        944  return true;
        945 }
        946 
        947 size_t SyncSample::ComputeSizeInternal() {
        948  // Sync sample box is optional. Skip it if it is empty.
        949  if (sample_number.empty())
        950  return 0;
        951  return HeaderSize() + sizeof(uint32_t) +
        952  sizeof(uint32_t) * sample_number.size();
        953 }
        954 
        955 bool CencSampleEncryptionInfoEntry::ReadWrite(BoxBuffer* buffer) {
        956  if (!buffer->Reading()) {
        957  if (key_id.size() != kCencKeyIdSize) {
        958  LOG(WARNING) << "CENC defines key id length of " << kCencKeyIdSize
        959  << " bytes; got " << key_id.size()
        960  << ". Resized accordingly.";
        961  key_id.resize(kCencKeyIdSize);
        962  }
        963  RCHECK(crypt_byte_block < 16 && skip_byte_block < 16);
        964  }
        965 
        966  RCHECK(buffer->IgnoreBytes(1)); // reserved.
        967 
        968  uint8_t pattern = crypt_byte_block << 4 | skip_byte_block;
        969  RCHECK(buffer->ReadWriteUInt8(&pattern));
        970  crypt_byte_block = pattern >> 4;
        971  skip_byte_block = pattern & 0x0F;
        972 
        973  RCHECK(buffer->ReadWriteUInt8(&is_protected) &&
        974  buffer->ReadWriteUInt8(&per_sample_iv_size) &&
        975  buffer->ReadWriteVector(&key_id, kCencKeyIdSize));
        976 
        977  if (is_protected == 1) {
        978  if (per_sample_iv_size == 0) { // For constant iv.
        979  uint8_t constant_iv_size = static_cast<uint8_t>(constant_iv.size());
        980  RCHECK(buffer->ReadWriteUInt8(&constant_iv_size));
        981  RCHECK(constant_iv_size == 8 || constant_iv_size == 16);
        982  RCHECK(buffer->ReadWriteVector(&constant_iv, constant_iv_size));
        983  } else {
        984  RCHECK(per_sample_iv_size == 8 || per_sample_iv_size == 16);
        985  DCHECK(constant_iv.empty());
        986  }
        987  } else {
        988  // Expect |is_protected| to be 0, i.e. not protected. Other values of
        989  // |is_protected| is not supported.
        990  RCHECK(is_protected == 0);
        991  RCHECK(per_sample_iv_size == 0);
        992  }
        993  return true;
        994 }
        995 
        996 uint32_t CencSampleEncryptionInfoEntry::ComputeSize() const {
        997  return static_cast<uint32_t>(
        998  sizeof(uint32_t) + kCencKeyIdSize +
        999  (constant_iv.empty() ? 0 : (sizeof(uint8_t) + constant_iv.size())));
        1000 }
        1001 
        1002 bool AudioRollRecoveryEntry::ReadWrite(BoxBuffer* buffer) {
        1003  RCHECK(buffer->ReadWriteInt16(&roll_distance));
        1004  return true;
        1005 }
        1006 
        1007 uint32_t AudioRollRecoveryEntry::ComputeSize() const {
        1008  return sizeof(roll_distance);
        1009 }
        1010 
        1011 SampleGroupDescription::SampleGroupDescription() = default;
        1012 SampleGroupDescription::~SampleGroupDescription() = default;
        1013 
        1015  return FOURCC_sgpd;
        1016 }
        1017 
        1018 bool SampleGroupDescription::ReadWriteInternal(BoxBuffer* buffer) {
        1019  RCHECK(ReadWriteHeaderInternal(buffer) &&
        1020  buffer->ReadWriteUInt32(&grouping_type));
        1021 
        1022  switch (grouping_type) {
        1023  case FOURCC_seig:
        1024  return ReadWriteEntries(buffer, &cenc_sample_encryption_info_entries);
        1025  case FOURCC_roll:
        1026  return ReadWriteEntries(buffer, &audio_roll_recovery_entries);
        1027  default:
        1028  DCHECK(buffer->Reading());
        1029  DLOG(WARNING) << "Ignore unsupported sample group: "
        1030  << FourCCToString(static_cast<FourCC>(grouping_type));
        1031  return true;
        1032  }
        1033 }
        1034 
        1035 template <typename T>
        1036 bool SampleGroupDescription::ReadWriteEntries(BoxBuffer* buffer,
        1037  std::vector<T>* entries) {
        1038  uint32_t default_length = 0;
        1039  if (!buffer->Reading()) {
        1040  DCHECK(!entries->empty());
        1041  default_length = (*entries)[0].ComputeSize();
        1042  DCHECK_NE(default_length, 0u);
        1043  }
        1044  if (version == 1)
        1045  RCHECK(buffer->ReadWriteUInt32(&default_length));
        1046  if (version >= 2) {
        1047  NOTIMPLEMENTED() << "Unsupported SampleGroupDescriptionBox 'sgpd' version "
        1048  << static_cast<int>(version);
        1049  return false;
        1050  }
        1051 
        1052  uint32_t count = static_cast<uint32_t>(entries->size());
        1053  RCHECK(buffer->ReadWriteUInt32(&count));
        1054  RCHECK(count != 0);
        1055  entries->resize(count);
        1056 
        1057  for (T& entry : *entries) {
        1058  if (version == 1) {
        1059  uint32_t description_length = default_length;
        1060  if (buffer->Reading() && default_length == 0)
        1061  RCHECK(buffer->ReadWriteUInt32(&description_length));
        1062  RCHECK(entry.ReadWrite(buffer));
        1063  RCHECK(entry.ComputeSize() == description_length);
        1064  } else {
        1065  RCHECK(entry.ReadWrite(buffer));
        1066  }
        1067  }
        1068  return true;
        1069 }
        1070 
        1071 size_t SampleGroupDescription::ComputeSizeInternal() {
        1072  // Version 0 is obsoleted, so always generate version 1 box.
        1073  version = 1;
        1074  size_t entries_size = 0;
        1075  switch (grouping_type) {
        1076  case FOURCC_seig:
        1077  for (const auto& entry : cenc_sample_encryption_info_entries)
        1078  entries_size += entry.ComputeSize();
        1079  break;
        1080  case FOURCC_roll:
        1081  for (const auto& entry : audio_roll_recovery_entries)
        1082  entries_size += entry.ComputeSize();
        1083  break;
        1084  }
        1085  // This box is optional. Skip it if it is not used.
        1086  if (entries_size == 0)
        1087  return 0;
        1088  return HeaderSize() + sizeof(grouping_type) +
        1089  (version == 1 ? sizeof(uint32_t) : 0) + sizeof(uint32_t) +
        1090  entries_size;
        1091 }
        1092 
        1093 SampleToGroup::SampleToGroup() = default;
        1094 SampleToGroup::~SampleToGroup() = default;
        1095 
        1096 FourCC SampleToGroup::BoxType() const {
        1097  return FOURCC_sbgp;
        1098 }
        1099 
        1100 bool SampleToGroup::ReadWriteInternal(BoxBuffer* buffer) {
        1101  RCHECK(ReadWriteHeaderInternal(buffer) &&
        1102  buffer->ReadWriteUInt32(&grouping_type));
        1103  if (version == 1)
        1104  RCHECK(buffer->ReadWriteUInt32(&grouping_type_parameter));
        1105 
        1106  if (grouping_type != FOURCC_seig && grouping_type != FOURCC_roll) {
        1107  DCHECK(buffer->Reading());
        1108  DLOG(WARNING) << "Ignore unsupported sample group: "
        1109  << FourCCToString(static_cast<FourCC>(grouping_type));
        1110  return true;
        1111  }
        1112 
        1113  uint32_t count = static_cast<uint32_t>(entries.size());
        1114  RCHECK(buffer->ReadWriteUInt32(&count));
        1115  entries.resize(count);
        1116  for (uint32_t i = 0; i < count; ++i) {
        1117  RCHECK(buffer->ReadWriteUInt32(&entries[i].sample_count) &&
        1118  buffer->ReadWriteUInt32(&entries[i].group_description_index));
        1119  }
        1120  return true;
        1121 }
        1122 
        1123 size_t SampleToGroup::ComputeSizeInternal() {
        1124  // This box is optional. Skip it if it is not used.
        1125  if (entries.empty())
        1126  return 0;
        1127  return HeaderSize() + sizeof(grouping_type) +
        1128  (version == 1 ? sizeof(grouping_type_parameter) : 0) +
        1129  sizeof(uint32_t) + entries.size() * sizeof(entries[0]);
        1130 }
        1131 
        1132 SampleTable::SampleTable() = default;
        1133 SampleTable::~SampleTable() = default;
        1134 
        1135 FourCC SampleTable::BoxType() const {
        1136  return FOURCC_stbl;
        1137 }
        1138 
        1139 bool SampleTable::ReadWriteInternal(BoxBuffer* buffer) {
        1140  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->PrepareChildren() &&
        1141  buffer->ReadWriteChild(&description) &&
        1142  buffer->ReadWriteChild(&decoding_time_to_sample) &&
        1143  buffer->TryReadWriteChild(&composition_time_to_sample) &&
        1144  buffer->ReadWriteChild(&sample_to_chunk));
        1145 
        1146  if (buffer->Reading()) {
        1147  BoxReader* reader = buffer->reader();
        1148  DCHECK(reader);
        1149 
        1150  // Either SampleSize or CompactSampleSize must present.
        1151  if (reader->ChildExist(&sample_size)) {
        1152  RCHECK(reader->ReadChild(&sample_size));
        1153  } else {
        1154  CompactSampleSize compact_sample_size;
        1155  RCHECK(reader->ReadChild(&compact_sample_size));
        1156  sample_size.sample_size = 0;
        1157  sample_size.sample_count =
        1158  static_cast<uint32_t>(compact_sample_size.sizes.size());
        1159  sample_size.sizes.swap(compact_sample_size.sizes);
        1160  }
        1161 
        1162  // Either ChunkOffset or ChunkLargeOffset must present.
        1163  if (reader->ChildExist(&chunk_large_offset)) {
        1164  RCHECK(reader->ReadChild(&chunk_large_offset));
        1165  } else {
        1166  ChunkOffset chunk_offset;
        1167  RCHECK(reader->ReadChild(&chunk_offset));
        1168  chunk_large_offset.offsets.swap(chunk_offset.offsets);
        1169  }
        1170  } else {
        1171  RCHECK(buffer->ReadWriteChild(&sample_size) &&
        1172  buffer->ReadWriteChild(&chunk_large_offset));
        1173  }
        1174  RCHECK(buffer->TryReadWriteChild(&sync_sample));
        1175  if (buffer->Reading()) {
        1176  RCHECK(buffer->reader()->TryReadChildren(&sample_group_descriptions) &&
        1177  buffer->reader()->TryReadChildren(&sample_to_groups));
        1178  } else {
        1179  for (auto& sample_group_description : sample_group_descriptions)
        1180  RCHECK(buffer->ReadWriteChild(&sample_group_description));
        1181  for (auto& sample_to_group : sample_to_groups)
        1182  RCHECK(buffer->ReadWriteChild(&sample_to_group));
        1183  }
        1184  return true;
        1185 }
        1186 
        1187 size_t SampleTable::ComputeSizeInternal() {
        1188  size_t box_size = HeaderSize() + description.ComputeSize() +
        1189  decoding_time_to_sample.ComputeSize() +
        1190  composition_time_to_sample.ComputeSize() +
        1191  sample_to_chunk.ComputeSize() + sample_size.ComputeSize() +
        1192  chunk_large_offset.ComputeSize() +
        1193  sync_sample.ComputeSize();
        1194  for (auto& sample_group_description : sample_group_descriptions)
        1195  box_size += sample_group_description.ComputeSize();
        1196  for (auto& sample_to_group : sample_to_groups)
        1197  box_size += sample_to_group.ComputeSize();
        1198  return box_size;
        1199 }
        1200 
        1201 EditList::EditList() = default;
        1202 EditList::~EditList() = default;
        1203 
        1204 FourCC EditList::BoxType() const {
        1205  return FOURCC_elst;
        1206 }
        1207 
        1208 bool EditList::ReadWriteInternal(BoxBuffer* buffer) {
        1209  uint32_t count = static_cast<uint32_t>(edits.size());
        1210  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->ReadWriteUInt32(&count));
        1211  edits.resize(count);
        1212 
        1213  size_t num_bytes = (version == 1) ? sizeof(uint64_t) : sizeof(uint32_t);
        1214  for (uint32_t i = 0; i < count; ++i) {
        1215  RCHECK(
        1216  buffer->ReadWriteUInt64NBytes(&edits[i].segment_duration, num_bytes) &&
        1217  buffer->ReadWriteInt64NBytes(&edits[i].media_time, num_bytes) &&
        1218  buffer->ReadWriteInt16(&edits[i].media_rate_integer) &&
        1219  buffer->ReadWriteInt16(&edits[i].media_rate_fraction));
        1220  }
        1221  return true;
        1222 }
        1223 
        1224 size_t EditList::ComputeSizeInternal() {
        1225  // EditList box is optional. Skip it if it is empty.
        1226  if (edits.empty())
        1227  return 0;
        1228 
        1229  version = 0;
        1230  for (uint32_t i = 0; i < edits.size(); ++i) {
        1231  if (!IsFitIn32Bits(edits[i].segment_duration, edits[i].media_time)) {
        1232  version = 1;
        1233  break;
        1234  }
        1235  }
        1236  return HeaderSize() + sizeof(uint32_t) +
        1237  (sizeof(uint32_t) * (1 + version) * 2 + sizeof(int16_t) * 2) *
        1238  edits.size();
        1239 }
        1240 
        1241 Edit::Edit() = default;
        1242 Edit::~Edit() = default;
        1243 
        1244 FourCC Edit::BoxType() const {
        1245  return FOURCC_edts;
        1246 }
        1247 
        1248 bool Edit::ReadWriteInternal(BoxBuffer* buffer) {
        1249  return ReadWriteHeaderInternal(buffer) && buffer->PrepareChildren() &&
        1250  buffer->ReadWriteChild(&list);
        1251 }
        1252 
        1253 size_t Edit::ComputeSizeInternal() {
        1254  // Edit box is optional. Skip it if it is empty.
        1255  if (list.edits.empty())
        1256  return 0;
        1257  return HeaderSize() + list.ComputeSize();
        1258 }
        1259 
        1260 HandlerReference::HandlerReference() = default;
        1261 HandlerReference::~HandlerReference() = default;
        1262 
        1264  return FOURCC_hdlr;
        1265 }
        1266 
        1267 bool HandlerReference::ReadWriteInternal(BoxBuffer* buffer) {
        1268  std::vector<uint8_t> handler_name;
        1269  if (!buffer->Reading()) {
        1270  switch (handler_type) {
        1271  case FOURCC_vide:
        1272  handler_name.assign(kVideoHandlerName,
        1273  kVideoHandlerName + arraysize(kVideoHandlerName));
        1274  break;
        1275  case FOURCC_soun:
        1276  handler_name.assign(kAudioHandlerName,
        1277  kAudioHandlerName + arraysize(kAudioHandlerName));
        1278  break;
        1279  case FOURCC_text:
        1280  handler_name.assign(kTextHandlerName,
        1281  kTextHandlerName + arraysize(kTextHandlerName));
        1282  break;
        1283  case FOURCC_ID32:
        1284  break;
        1285  default:
        1286  NOTIMPLEMENTED();
        1287  return false;
        1288  }
        1289  }
        1290  RCHECK(ReadWriteHeaderInternal(buffer) &&
        1291  buffer->IgnoreBytes(4) && // predefined.
        1292  buffer->ReadWriteFourCC(&handler_type));
        1293  if (!buffer->Reading()) {
        1294  RCHECK(buffer->IgnoreBytes(12) && // reserved.
        1295  buffer->ReadWriteVector(&handler_name, handler_name.size()));
        1296  }
        1297  return true;
        1298 }
        1299 
        1300 size_t HandlerReference::ComputeSizeInternal() {
        1301  size_t box_size = HeaderSize() + kFourCCSize + 16; // 16 bytes Reserved
        1302  switch (handler_type) {
        1303  case FOURCC_vide:
        1304  box_size += sizeof(kVideoHandlerName);
        1305  break;
        1306  case FOURCC_soun:
        1307  box_size += sizeof(kAudioHandlerName);
        1308  break;
        1309  case FOURCC_text:
        1310  box_size += sizeof(kTextHandlerName);
        1311  break;
        1312  case FOURCC_ID32:
        1313  break;
        1314  default:
        1315  NOTIMPLEMENTED();
        1316  }
        1317  return box_size;
        1318 }
        1319 
        1320 bool Language::ReadWrite(BoxBuffer* buffer) {
        1321  if (buffer->Reading()) {
        1322  // Read language codes into temp first then use BitReader to read the
        1323  // values. ISO-639-2/T language code: unsigned int(5)[3] language (2 bytes).
        1324  std::vector<uint8_t> temp;
        1325  RCHECK(buffer->ReadWriteVector(&temp, 2));
        1326 
        1327  BitReader bit_reader(&temp[0], 2);
        1328  bit_reader.SkipBits(1);
        1329  char language[3];
        1330  for (int i = 0; i < 3; ++i) {
        1331  CHECK(bit_reader.ReadBits(5, &language[i]));
        1332  language[i] += 0x60;
        1333  }
        1334  code.assign(language, 3);
        1335  } else {
        1336  // Set up default language if it is not set.
        1337  const char kUndefinedLanguage[] = "und";
        1338  if (code.empty())
        1339  code = kUndefinedLanguage;
        1340  DCHECK_EQ(code.size(), 3u);
        1341 
        1342  // Lang format: bit(1) pad, unsigned int(5)[3] language.
        1343  uint16_t lang = 0;
        1344  for (int i = 0; i < 3; ++i)
        1345  lang |= (code[i] - 0x60) << ((2 - i) * 5);
        1346  RCHECK(buffer->ReadWriteUInt16(&lang));
        1347  }
        1348  return true;
        1349 }
        1350 
        1351 uint32_t Language::ComputeSize() const {
        1352  // ISO-639-2/T language code: unsigned int(5)[3] language (2 bytes).
        1353  return 2;
        1354 }
        1355 
        1356 ID3v2::ID3v2() = default;
        1357 ID3v2::~ID3v2() = default;
        1358 
        1359 FourCC ID3v2::BoxType() const {
        1360  return FOURCC_ID32;
        1361 }
        1362 
        1363 bool ID3v2::ReadWriteInternal(BoxBuffer* buffer) {
        1364  RCHECK(ReadWriteHeaderInternal(buffer) && language.ReadWrite(buffer) &&
        1365  buffer->ReadWriteVector(&id3v2_data, buffer->Reading()
        1366  ? buffer->BytesLeft()
        1367  : id3v2_data.size()));
        1368  return true;
        1369 }
        1370 
        1371 size_t ID3v2::ComputeSizeInternal() {
        1372  // Skip ID3v2 box generation if there is no id3 data.
        1373  return id3v2_data.size() == 0
        1374  ? 0
        1375  : HeaderSize() + language.ComputeSize() + id3v2_data.size();
        1376 }
        1377 
        1378 Metadata::Metadata() = default;
        1379 Metadata::~Metadata() = default;
        1380 
        1381 FourCC Metadata::BoxType() const {
        1382  return FOURCC_meta;
        1383 }
        1384 
        1385 bool Metadata::ReadWriteInternal(BoxBuffer* buffer) {
        1386  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->PrepareChildren() &&
        1387  buffer->ReadWriteChild(&handler) && buffer->TryReadWriteChild(&id3v2));
        1388  return true;
        1389 }
        1390 
        1391 size_t Metadata::ComputeSizeInternal() {
        1392  size_t id3v2_size = id3v2.ComputeSize();
        1393  // Skip metadata box generation if there is no metadata box.
        1394  return id3v2_size == 0 ? 0
        1395  : HeaderSize() + handler.ComputeSize() + id3v2_size;
        1396 }
        1397 
        1398 CodecConfiguration::CodecConfiguration() = default;
        1399 CodecConfiguration::~CodecConfiguration() = default;
        1400 
        1402  // CodecConfiguration box should be parsed according to format recovered in
        1403  // VideoSampleEntry. |box_type| is determined dynamically there.
        1404  return box_type;
        1405 }
        1406 
        1407 bool CodecConfiguration::ReadWriteInternal(BoxBuffer* buffer) {
        1408  DCHECK_NE(box_type, FOURCC_NULL);
        1409  RCHECK(ReadWriteHeaderInternal(buffer));
        1410 
        1411  // VPCodecConfiguration box inherits from FullBox instead of Box. The extra 4
        1412  // bytes are handled here.
        1413  if (box_type == FOURCC_vpcC) {
        1414  // Only version 1 box is supported.
        1415  uint8_t vpcc_version = 1;
        1416  uint32_t version_flags = vpcc_version << 24;
        1417  RCHECK(buffer->ReadWriteUInt32(&version_flags));
        1418  vpcc_version = version_flags >> 24;
        1419  RCHECK(vpcc_version == 1);
        1420  }
        1421 
        1422  if (buffer->Reading()) {
        1423  RCHECK(buffer->ReadWriteVector(&data, buffer->BytesLeft()));
        1424  } else {
        1425  RCHECK(buffer->ReadWriteVector(&data, data.size()));
        1426  }
        1427  return true;
        1428 }
        1429 
        1430 size_t CodecConfiguration::ComputeSizeInternal() {
        1431  if (data.empty())
        1432  return 0;
        1433  DCHECK_NE(box_type, FOURCC_NULL);
        1434  return HeaderSize() + (box_type == FOURCC_vpcC ? 4 : 0) + data.size();
        1435 }
        1436 
        1437 PixelAspectRatio::PixelAspectRatio() = default;
        1438 PixelAspectRatio::~PixelAspectRatio() = default;
        1439 
        1441  return FOURCC_pasp;
        1442 }
        1443 
        1444 bool PixelAspectRatio::ReadWriteInternal(BoxBuffer* buffer) {
        1445  RCHECK(ReadWriteHeaderInternal(buffer) &&
        1446  buffer->ReadWriteUInt32(&h_spacing) &&
        1447  buffer->ReadWriteUInt32(&v_spacing));
        1448  return true;
        1449 }
        1450 
        1451 size_t PixelAspectRatio::ComputeSizeInternal() {
        1452  // This box is optional. Skip it if it is not initialized.
        1453  if (h_spacing == 0 && v_spacing == 0)
        1454  return 0;
        1455  // Both values must be positive.
        1456  DCHECK(h_spacing != 0 && v_spacing != 0);
        1457  return HeaderSize() + sizeof(h_spacing) + sizeof(v_spacing);
        1458 }
        1459 
        1460 VideoSampleEntry::VideoSampleEntry() = default;
        1461 VideoSampleEntry::~VideoSampleEntry() = default;
        1462 
        1464  if (format == FOURCC_NULL) {
        1465  LOG(ERROR) << "VideoSampleEntry should be parsed according to the "
        1466  << "handler type recovered in its Media ancestor.";
        1467  }
        1468  return format;
        1469 }
        1470 
        1471 bool VideoSampleEntry::ReadWriteInternal(BoxBuffer* buffer) {
        1472  std::vector<uint8_t> compressor_name;
        1473  if (buffer->Reading()) {
        1474  DCHECK(buffer->reader());
        1475  format = buffer->reader()->type();
        1476  } else {
        1477  RCHECK(ReadWriteHeaderInternal(buffer));
        1478 
        1479  const FourCC actual_format = GetActualFormat();
        1480  switch (actual_format) {
        1481  case FOURCC_avc1:
        1482  case FOURCC_avc3:
        1483  compressor_name.assign(
        1484  kAvcCompressorName,
        1485  kAvcCompressorName + arraysize(kAvcCompressorName));
        1486  break;
        1487  case FOURCC_hev1:
        1488  case FOURCC_hvc1:
        1489  compressor_name.assign(
        1490  kHevcCompressorName,
        1491  kHevcCompressorName + arraysize(kHevcCompressorName));
        1492  break;
        1493  case FOURCC_vp08:
        1494  case FOURCC_vp09:
        1495  case FOURCC_vp10:
        1496  compressor_name.assign(
        1497  kVpcCompressorName,
        1498  kVpcCompressorName + arraysize(kVpcCompressorName));
        1499  break;
        1500  default:
        1501  LOG(ERROR) << FourCCToString(actual_format) << " is not supported.";
        1502  return false;
        1503  }
        1504  compressor_name.resize(kCompressorNameSize);
        1505  }
        1506 
        1507  uint32_t video_resolution = kVideoResolution;
        1508  uint16_t video_frame_count = kVideoFrameCount;
        1509  uint16_t video_depth = kVideoDepth;
        1510  int16_t predefined = -1;
        1511  RCHECK(buffer->IgnoreBytes(6) && // reserved.
        1512  buffer->ReadWriteUInt16(&data_reference_index) &&
        1513  buffer->IgnoreBytes(16) && // predefined 0.
        1514  buffer->ReadWriteUInt16(&width) && buffer->ReadWriteUInt16(&height) &&
        1515  buffer->ReadWriteUInt32(&video_resolution) &&
        1516  buffer->ReadWriteUInt32(&video_resolution) &&
        1517  buffer->IgnoreBytes(4) && // reserved.
        1518  buffer->ReadWriteUInt16(&video_frame_count) &&
        1519  buffer->ReadWriteVector(&compressor_name, kCompressorNameSize) &&
        1520  buffer->ReadWriteUInt16(&video_depth) &&
        1521  buffer->ReadWriteInt16(&predefined));
        1522 
        1523  RCHECK(buffer->PrepareChildren());
        1524 
        1525  // This has to happen before reading codec configuration box as the actual
        1526  // format is read from sinf.format.format, which is needed to parse the codec
        1527  // configuration box.
        1528  if (format == FOURCC_encv && buffer->Reading()) {
        1529  // Continue scanning until a supported protection scheme is found, or
        1530  // until we run out of protection schemes.
        1531  while (!IsProtectionSchemeSupported(sinf.type.type))
        1532  RCHECK(buffer->ReadWriteChild(&sinf));
        1533  }
        1534 
        1535  const FourCC actual_format = GetActualFormat();
        1536  if (buffer->Reading()) {
        1537  codec_configuration.box_type = GetCodecConfigurationBoxType(actual_format);
        1538  } else {
        1539  DCHECK_EQ(codec_configuration.box_type,
        1540  GetCodecConfigurationBoxType(actual_format));
        1541  }
        1542  if (codec_configuration.box_type == FOURCC_NULL)
        1543  return false;
        1544 
        1545  RCHECK(buffer->ReadWriteChild(&codec_configuration));
        1546  RCHECK(buffer->TryReadWriteChild(&pixel_aspect));
        1547 
        1548  // Somehow Edge does not support having sinf box before codec_configuration,
        1549  // box, so just do it in the end of VideoSampleEntry. See
        1550  // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12658991/
        1551  if (format == FOURCC_encv && !buffer->Reading()) {
        1552  DCHECK(IsProtectionSchemeSupported(sinf.type.type));
        1553  RCHECK(buffer->ReadWriteChild(&sinf));
        1554  }
        1555  return true;
        1556 }
        1557 
        1558 size_t VideoSampleEntry::ComputeSizeInternal() {
        1559  const FourCC actual_format = GetActualFormat();
        1560  if (actual_format == FOURCC_NULL)
        1561  return 0;
        1562  codec_configuration.box_type = GetCodecConfigurationBoxType(actual_format);
        1563  DCHECK_NE(codec_configuration.box_type, FOURCC_NULL);
        1564  return HeaderSize() + sizeof(data_reference_index) + sizeof(width) +
        1565  sizeof(height) + sizeof(kVideoResolution) * 2 +
        1566  sizeof(kVideoFrameCount) + sizeof(kVideoDepth) +
        1567  pixel_aspect.ComputeSize() + sinf.ComputeSize() +
        1568  codec_configuration.ComputeSize() + kCompressorNameSize + 6 + 4 + 16 +
        1569  2; // 6 + 4 bytes reserved, 16 + 2 bytes predefined.
        1570 }
        1571 
        1572 FourCC VideoSampleEntry::GetCodecConfigurationBoxType(FourCC format) const {
        1573  switch (format) {
        1574  case FOURCC_avc1:
        1575  case FOURCC_avc3:
        1576  return FOURCC_avcC;
        1577  case FOURCC_hev1:
        1578  case FOURCC_hvc1:
        1579  return FOURCC_hvcC;
        1580  case FOURCC_vp08:
        1581  case FOURCC_vp09:
        1582  case FOURCC_vp10:
        1583  return FOURCC_vpcC;
        1584  default:
        1585  LOG(ERROR) << FourCCToString(format) << " is not supported.";
        1586  return FOURCC_NULL;
        1587  }
        1588 }
        1589 
        1590 ElementaryStreamDescriptor::ElementaryStreamDescriptor() = default;
        1591 ElementaryStreamDescriptor::~ElementaryStreamDescriptor() = default;
        1592 
        1594  return FOURCC_esds;
        1595 }
        1596 
        1597 bool ElementaryStreamDescriptor::ReadWriteInternal(BoxBuffer* buffer) {
        1598  RCHECK(ReadWriteHeaderInternal(buffer));
        1599  if (buffer->Reading()) {
        1600  std::vector<uint8_t> data;
        1601  RCHECK(buffer->ReadWriteVector(&data, buffer->BytesLeft()));
        1602  RCHECK(es_descriptor.Parse(data));
        1603  if (es_descriptor.IsAAC()) {
        1604  RCHECK(aac_audio_specific_config.Parse(
        1605  es_descriptor.decoder_specific_info()));
        1606  }
        1607  } else {
        1608  DCHECK(buffer->writer());
        1609  es_descriptor.Write(buffer->writer());
        1610  }
        1611  return true;
        1612 }
        1613 
        1614 size_t ElementaryStreamDescriptor::ComputeSizeInternal() {
        1615  // This box is optional. Skip it if not initialized.
        1616  if (es_descriptor.object_type() == ObjectType::kForbidden)
        1617  return 0;
        1618  return HeaderSize() + es_descriptor.ComputeSize();
        1619 }
        1620 
        1621 DTSSpecific::DTSSpecific() = default;
        1622 DTSSpecific::~DTSSpecific() = default;
        1623 ;
        1624 
        1625 FourCC DTSSpecific::BoxType() const {
        1626  return FOURCC_ddts;
        1627 }
        1628 
        1629 bool DTSSpecific::ReadWriteInternal(BoxBuffer* buffer) {
        1630  RCHECK(ReadWriteHeaderInternal(buffer) &&
        1631  buffer->ReadWriteUInt32(&sampling_frequency) &&
        1632  buffer->ReadWriteUInt32(&max_bitrate) &&
        1633  buffer->ReadWriteUInt32(&avg_bitrate) &&
        1634  buffer->ReadWriteUInt8(&pcm_sample_depth));
        1635 
        1636  if (buffer->Reading()) {
        1637  RCHECK(buffer->ReadWriteVector(&extra_data, buffer->BytesLeft()));
        1638  } else {
        1639  if (extra_data.empty()) {
        1640  extra_data.assign(kDdtsExtraData,
        1641  kDdtsExtraData + sizeof(kDdtsExtraData));
        1642  }
        1643  RCHECK(buffer->ReadWriteVector(&extra_data, extra_data.size()));
        1644  }
        1645  return true;
        1646 }
        1647 
        1648 size_t DTSSpecific::ComputeSizeInternal() {
        1649  // This box is optional. Skip it if not initialized.
        1650  if (sampling_frequency == 0)
        1651  return 0;
        1652  return HeaderSize() + sizeof(sampling_frequency) + sizeof(max_bitrate) +
        1653  sizeof(avg_bitrate) + sizeof(pcm_sample_depth) +
        1654  sizeof(kDdtsExtraData);
        1655 }
        1656 
        1657 AC3Specific::AC3Specific() = default;
        1658 AC3Specific::~AC3Specific() = default;
        1659 
        1660 FourCC AC3Specific::BoxType() const {
        1661  return FOURCC_dac3;
        1662 }
        1663 
        1664 bool AC3Specific::ReadWriteInternal(BoxBuffer* buffer) {
        1665  RCHECK(ReadWriteHeaderInternal(buffer) &&
        1666  buffer->ReadWriteVector(
        1667  &data, buffer->Reading() ? buffer->BytesLeft() : data.size()));
        1668  return true;
        1669 }
        1670 
        1671 size_t AC3Specific::ComputeSizeInternal() {
        1672  // This box is optional. Skip it if not initialized.
        1673  if (data.empty())
        1674  return 0;
        1675  return HeaderSize() + data.size();
        1676 }
        1677 
        1678 EC3Specific::EC3Specific() = default;
        1679 EC3Specific::~EC3Specific() = default;
        1680 
        1681 FourCC EC3Specific::BoxType() const {
        1682  return FOURCC_dec3;
        1683 }
        1684 
        1685 bool EC3Specific::ReadWriteInternal(BoxBuffer* buffer) {
        1686  RCHECK(ReadWriteHeaderInternal(buffer));
        1687  size_t size = buffer->Reading() ? buffer->BytesLeft() : data.size();
        1688  RCHECK(buffer->ReadWriteVector(&data, size));
        1689  return true;
        1690 }
        1691 
        1692 size_t EC3Specific::ComputeSizeInternal() {
        1693  // This box is optional. Skip it if not initialized.
        1694  if (data.empty())
        1695  return 0;
        1696  return HeaderSize() + data.size();
        1697 }
        1698 
        1699 OpusSpecific::OpusSpecific() = default;
        1700 OpusSpecific::~OpusSpecific() = default;
        1701 
        1702 FourCC OpusSpecific::BoxType() const {
        1703  return FOURCC_dOps;
        1704 }
        1705 
        1706 bool OpusSpecific::ReadWriteInternal(BoxBuffer* buffer) {
        1707  RCHECK(ReadWriteHeaderInternal(buffer));
        1708  if (buffer->Reading()) {
        1709  std::vector<uint8_t> data;
        1710  const int kMinOpusSpecificBoxDataSize = 11;
        1711  RCHECK(buffer->BytesLeft() >= kMinOpusSpecificBoxDataSize);
        1712  RCHECK(buffer->ReadWriteVector(&data, buffer->BytesLeft()));
        1713  preskip = data[2] + (data[3] << 8);
        1714 
        1715  // https://tools.ietf.org/html/draft-ietf-codec-oggopus-06#section-5
        1716  BufferWriter writer;
        1717  writer.AppendInt(FOURCC_Opus);
        1718  writer.AppendInt(FOURCC_Head);
        1719  // The version must always be 1.
        1720  const uint8_t kOpusIdentificationHeaderVersion = 1;
        1721  data[0] = kOpusIdentificationHeaderVersion;
        1722  writer.AppendVector(data);
        1723  writer.SwapBuffer(&opus_identification_header);
        1724  } else {
        1725  // https://tools.ietf.org/html/draft-ietf-codec-oggopus-06#section-5
        1726  // The first 8 bytes is "magic signature".
        1727  const size_t kOpusMagicSignatureSize = 8u;
        1728  DCHECK_GT(opus_identification_header.size(), kOpusMagicSignatureSize);
        1729  // https://www.opus-codec.org/docs/opus_in_isobmff.html
        1730  // The version field shall be set to 0.
        1731  const uint8_t kOpusSpecificBoxVersion = 0;
        1732  buffer->writer()->AppendInt(kOpusSpecificBoxVersion);
        1733  buffer->writer()->AppendArray(
        1734  &opus_identification_header[kOpusMagicSignatureSize + 1],
        1735  opus_identification_header.size() - kOpusMagicSignatureSize - 1);
        1736  }
        1737  return true;
        1738 }
        1739 
        1740 size_t OpusSpecific::ComputeSizeInternal() {
        1741  // This box is optional. Skip it if not initialized.
        1742  if (opus_identification_header.empty())
        1743  return 0;
        1744  // https://tools.ietf.org/html/draft-ietf-codec-oggopus-06#section-5
        1745  // The first 8 bytes is "magic signature".
        1746  const size_t kOpusMagicSignatureSize = 8u;
        1747  DCHECK_GT(opus_identification_header.size(), kOpusMagicSignatureSize);
        1748  return HeaderSize() + opus_identification_header.size() -
        1749  kOpusMagicSignatureSize;
        1750 }
        1751 
        1752 FlacSpecific::FlacSpecific() = default;
        1753 FlacSpecific::~FlacSpecific() = default;
        1754 
        1755 FourCC FlacSpecific::BoxType() const {
        1756  return FOURCC_dfLa;
        1757 }
        1758 
        1759 bool FlacSpecific::ReadWriteInternal(BoxBuffer* buffer) {
        1760  RCHECK(ReadWriteHeaderInternal(buffer));
        1761  size_t size = buffer->Reading() ? buffer->BytesLeft() : data.size();
        1762  RCHECK(buffer->ReadWriteVector(&data, size));
        1763  return true;
        1764 }
        1765 
        1766 size_t FlacSpecific::ComputeSizeInternal() {
        1767  // This box is optional. Skip it if not initialized.
        1768  if (data.empty())
        1769  return 0;
        1770  return HeaderSize() + data.size();
        1771 }
        1772 
        1773 AudioSampleEntry::AudioSampleEntry() = default;
        1774 AudioSampleEntry::~AudioSampleEntry() = default;
        1775 
        1777  if (format == FOURCC_NULL) {
        1778  LOG(ERROR) << "AudioSampleEntry should be parsed according to the "
        1779  << "handler type recovered in its Media ancestor.";
        1780  }
        1781  return format;
        1782 }
        1783 
        1784 bool AudioSampleEntry::ReadWriteInternal(BoxBuffer* buffer) {
        1785  if (buffer->Reading()) {
        1786  DCHECK(buffer->reader());
        1787  format = buffer->reader()->type();
        1788  } else {
        1789  RCHECK(ReadWriteHeaderInternal(buffer));
        1790  }
        1791 
        1792  // Convert from integer to 16.16 fixed point for writing.
        1793  samplerate <<= 16;
        1794  RCHECK(buffer->IgnoreBytes(6) && // reserved.
        1795  buffer->ReadWriteUInt16(&data_reference_index) &&
        1796  buffer->IgnoreBytes(8) && // reserved.
        1797  buffer->ReadWriteUInt16(&channelcount) &&
        1798  buffer->ReadWriteUInt16(&samplesize) &&
        1799  buffer->IgnoreBytes(4) && // predefined.
        1800  buffer->ReadWriteUInt32(&samplerate));
        1801  // Convert from 16.16 fixed point to integer.
        1802  samplerate >>= 16;
        1803 
        1804  RCHECK(buffer->PrepareChildren());
        1805 
        1806  RCHECK(buffer->TryReadWriteChild(&esds));
        1807  RCHECK(buffer->TryReadWriteChild(&ddts));
        1808  RCHECK(buffer->TryReadWriteChild(&dac3));
        1809  RCHECK(buffer->TryReadWriteChild(&dec3));
        1810  RCHECK(buffer->TryReadWriteChild(&dops));
        1811  RCHECK(buffer->TryReadWriteChild(&dfla));
        1812 
        1813  // Somehow Edge does not support having sinf box before codec_configuration,
        1814  // box, so just do it in the end of AudioSampleEntry. See
        1815  // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12658991/
        1816  if (format == FOURCC_enca) {
        1817  if (buffer->Reading()) {
        1818  // Continue scanning until a supported protection scheme is found, or
        1819  // until we run out of protection schemes.
        1820  while (!IsProtectionSchemeSupported(sinf.type.type))
        1821  RCHECK(buffer->ReadWriteChild(&sinf));
        1822  } else {
        1823  DCHECK(IsProtectionSchemeSupported(sinf.type.type));
        1824  RCHECK(buffer->ReadWriteChild(&sinf));
        1825  }
        1826  }
        1827  return true;
        1828 }
        1829 
        1830 size_t AudioSampleEntry::ComputeSizeInternal() {
        1831  if (GetActualFormat() == FOURCC_NULL)
        1832  return 0;
        1833  return HeaderSize() + sizeof(data_reference_index) + sizeof(channelcount) +
        1834  sizeof(samplesize) + sizeof(samplerate) + sinf.ComputeSize() +
        1835  esds.ComputeSize() + ddts.ComputeSize() + dac3.ComputeSize() +
        1836  dec3.ComputeSize() + dops.ComputeSize() + dfla.ComputeSize() +
        1837  // Reserved and predefined bytes.
        1838  6 + 8 + // 6 + 8 bytes reserved.
        1839  4; // 4 bytes predefined.
        1840 }
        1841 
        1842 WebVTTConfigurationBox::WebVTTConfigurationBox() = default;
        1843 WebVTTConfigurationBox::~WebVTTConfigurationBox() = default;
        1844 
        1846  return FOURCC_vttC;
        1847 }
        1848 
        1849 bool WebVTTConfigurationBox::ReadWriteInternal(BoxBuffer* buffer) {
        1850  RCHECK(ReadWriteHeaderInternal(buffer));
        1851  return buffer->ReadWriteString(
        1852  &config, buffer->Reading() ? buffer->BytesLeft() : config.size());
        1853 }
        1854 
        1855 size_t WebVTTConfigurationBox::ComputeSizeInternal() {
        1856  return HeaderSize() + config.size();
        1857 }
        1858 
        1859 WebVTTSourceLabelBox::WebVTTSourceLabelBox() = default;
        1860 WebVTTSourceLabelBox::~WebVTTSourceLabelBox() = default;
        1861 
        1863  return FOURCC_vlab;
        1864 }
        1865 
        1866 bool WebVTTSourceLabelBox::ReadWriteInternal(BoxBuffer* buffer) {
        1867  RCHECK(ReadWriteHeaderInternal(buffer));
        1868  return buffer->ReadWriteString(&source_label, buffer->Reading()
        1869  ? buffer->BytesLeft()
        1870  : source_label.size());
        1871 }
        1872 
        1873 size_t WebVTTSourceLabelBox::ComputeSizeInternal() {
        1874  if (source_label.empty())
        1875  return 0;
        1876  return HeaderSize() + source_label.size();
        1877 }
        1878 
        1879 TextSampleEntry::TextSampleEntry() = default;
        1880 TextSampleEntry::~TextSampleEntry() = default;
        1881 
        1883  if (format == FOURCC_NULL) {
        1884  LOG(ERROR) << "TextSampleEntry should be parsed according to the "
        1885  << "handler type recovered in its Media ancestor.";
        1886  }
        1887  return format;
        1888 }
        1889 
        1890 bool TextSampleEntry::ReadWriteInternal(BoxBuffer* buffer) {
        1891  if (buffer->Reading()) {
        1892  DCHECK(buffer->reader());
        1893  format = buffer->reader()->type();
        1894  } else {
        1895  RCHECK(ReadWriteHeaderInternal(buffer));
        1896  }
        1897  RCHECK(buffer->IgnoreBytes(6) && // reserved for SampleEntry.
        1898  buffer->ReadWriteUInt16(&data_reference_index));
        1899 
        1900  if (format == FOURCC_wvtt) {
        1901  // TODO(rkuroiwa): Handle the optional MPEG4BitRateBox.
        1902  RCHECK(buffer->PrepareChildren() && buffer->ReadWriteChild(&config) &&
        1903  buffer->ReadWriteChild(&label));
        1904  }
        1905  return true;
        1906 }
        1907 
        1908 size_t TextSampleEntry::ComputeSizeInternal() {
        1909  // 6 for the (anonymous) reserved bytes for SampleEntry class.
        1910  return HeaderSize() + 6 + sizeof(data_reference_index) +
        1911  config.ComputeSize() + label.ComputeSize();
        1912 }
        1913 
        1914 MediaHeader::MediaHeader() = default;
        1915 MediaHeader::~MediaHeader() = default;
        1916 
        1917 FourCC MediaHeader::BoxType() const {
        1918  return FOURCC_mdhd;
        1919 }
        1920 
        1921 bool MediaHeader::ReadWriteInternal(BoxBuffer* buffer) {
        1922  RCHECK(ReadWriteHeaderInternal(buffer));
        1923 
        1924  uint8_t num_bytes = (version == 1) ? sizeof(uint64_t) : sizeof(uint32_t);
        1925  RCHECK(buffer->ReadWriteUInt64NBytes(&creation_time, num_bytes) &&
        1926  buffer->ReadWriteUInt64NBytes(&modification_time, num_bytes) &&
        1927  buffer->ReadWriteUInt32(&timescale) &&
        1928  buffer->ReadWriteUInt64NBytes(&duration, num_bytes) &&
        1929  language.ReadWrite(buffer) &&
        1930  // predefined.
        1931  buffer->IgnoreBytes(2));
        1932  return true;
        1933 }
        1934 
        1935 size_t MediaHeader::ComputeSizeInternal() {
        1936  version = IsFitIn32Bits(creation_time, modification_time, duration) ? 0 : 1;
        1937  return HeaderSize() + sizeof(timescale) +
        1938  sizeof(uint32_t) * (1 + version) * 3 + language.ComputeSize() +
        1939  2; // 2 bytes predefined.
        1940 }
        1941 
        1942 VideoMediaHeader::VideoMediaHeader() {
        1943  const uint32_t kVideoMediaHeaderFlags = 1;
        1944  flags = kVideoMediaHeaderFlags;
        1945 }
        1946 
        1947 VideoMediaHeader::~VideoMediaHeader() = default;
        1948 
        1950  return FOURCC_vmhd;
        1951 }
        1952 bool VideoMediaHeader::ReadWriteInternal(BoxBuffer* buffer) {
        1953  RCHECK(ReadWriteHeaderInternal(buffer) &&
        1954  buffer->ReadWriteUInt16(&graphicsmode) &&
        1955  buffer->ReadWriteUInt16(&opcolor_red) &&
        1956  buffer->ReadWriteUInt16(&opcolor_green) &&
        1957  buffer->ReadWriteUInt16(&opcolor_blue));
        1958  return true;
        1959 }
        1960 
        1961 size_t VideoMediaHeader::ComputeSizeInternal() {
        1962  return HeaderSize() + sizeof(graphicsmode) + sizeof(opcolor_red) +
        1963  sizeof(opcolor_green) + sizeof(opcolor_blue);
        1964 }
        1965 
        1966 SoundMediaHeader::SoundMediaHeader() = default;
        1967 SoundMediaHeader::~SoundMediaHeader() = default;
        1968 
        1970  return FOURCC_smhd;
        1971 }
        1972 
        1973 bool SoundMediaHeader::ReadWriteInternal(BoxBuffer* buffer) {
        1974  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->ReadWriteUInt16(&balance) &&
        1975  buffer->IgnoreBytes(2)); // reserved.
        1976  return true;
        1977 }
        1978 
        1979 size_t SoundMediaHeader::ComputeSizeInternal() {
        1980  return HeaderSize() + sizeof(balance) + sizeof(uint16_t);
        1981 }
        1982 
        1983 SubtitleMediaHeader::SubtitleMediaHeader() = default;
        1984 SubtitleMediaHeader::~SubtitleMediaHeader() = default;
        1985 
        1987  return FOURCC_sthd;
        1988 }
        1989 
        1990 bool SubtitleMediaHeader::ReadWriteInternal(BoxBuffer* buffer) {
        1991  return ReadWriteHeaderInternal(buffer);
        1992 }
        1993 
        1994 size_t SubtitleMediaHeader::ComputeSizeInternal() {
        1995  return HeaderSize();
        1996 }
        1997 
        1998 DataEntryUrl::DataEntryUrl() {
        1999  const uint32_t kDataEntryUrlFlags = 1;
        2000  flags = kDataEntryUrlFlags;
        2001 }
        2002 
        2003 DataEntryUrl::~DataEntryUrl() = default;
        2004 
        2005 FourCC DataEntryUrl::BoxType() const {
        2006  return FOURCC_url;
        2007 }
        2008 bool DataEntryUrl::ReadWriteInternal(BoxBuffer* buffer) {
        2009  RCHECK(ReadWriteHeaderInternal(buffer));
        2010  if (buffer->Reading()) {
        2011  RCHECK(buffer->ReadWriteVector(&location, buffer->BytesLeft()));
        2012  } else {
        2013  RCHECK(buffer->ReadWriteVector(&location, location.size()));
        2014  }
        2015  return true;
        2016 }
        2017 
        2018 size_t DataEntryUrl::ComputeSizeInternal() {
        2019  return HeaderSize() + location.size();
        2020 }
        2021 
        2022 DataReference::DataReference() = default;
        2023 DataReference::~DataReference() = default;
        2024 
        2025 FourCC DataReference::BoxType() const {
        2026  return FOURCC_dref;
        2027 }
        2028 bool DataReference::ReadWriteInternal(BoxBuffer* buffer) {
        2029  uint32_t entry_count = static_cast<uint32_t>(data_entry.size());
        2030  RCHECK(ReadWriteHeaderInternal(buffer) &&
        2031  buffer->ReadWriteUInt32(&entry_count));
        2032  data_entry.resize(entry_count);
        2033  RCHECK(buffer->PrepareChildren());
        2034  for (uint32_t i = 0; i < entry_count; ++i)
        2035  RCHECK(buffer->ReadWriteChild(&data_entry[i]));
        2036  return true;
        2037 }
        2038 
        2039 size_t DataReference::ComputeSizeInternal() {
        2040  uint32_t count = static_cast<uint32_t>(data_entry.size());
        2041  size_t box_size = HeaderSize() + sizeof(count);
        2042  for (uint32_t i = 0; i < count; ++i)
        2043  box_size += data_entry[i].ComputeSize();
        2044  return box_size;
        2045 }
        2046 
        2047 DataInformation::DataInformation() = default;
        2048 DataInformation::~DataInformation() = default;
        2049 
        2051  return FOURCC_dinf;
        2052 }
        2053 
        2054 bool DataInformation::ReadWriteInternal(BoxBuffer* buffer) {
        2055  return ReadWriteHeaderInternal(buffer) && buffer->PrepareChildren() &&
        2056  buffer->ReadWriteChild(&dref);
        2057 }
        2058 
        2059 size_t DataInformation::ComputeSizeInternal() {
        2060  return HeaderSize() + dref.ComputeSize();
        2061 }
        2062 
        2063 MediaInformation::MediaInformation() = default;
        2064 MediaInformation::~MediaInformation() = default;
        2065 
        2067  return FOURCC_minf;
        2068 }
        2069 
        2070 bool MediaInformation::ReadWriteInternal(BoxBuffer* buffer) {
        2071  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->PrepareChildren() &&
        2072  buffer->ReadWriteChild(&dinf) &&
        2073  buffer->ReadWriteChild(&sample_table));
        2074  switch (sample_table.description.type) {
        2075  case kVideo:
        2076  RCHECK(buffer->ReadWriteChild(&vmhd));
        2077  break;
        2078  case kAudio:
        2079  RCHECK(buffer->ReadWriteChild(&smhd));
        2080  break;
        2081  case kText:
        2082  RCHECK(buffer->TryReadWriteChild(&sthd));
        2083  break;
        2084  default:
        2085  NOTIMPLEMENTED();
        2086  }
        2087  // Hint is not supported for now.
        2088  return true;
        2089 }
        2090 
        2091 size_t MediaInformation::ComputeSizeInternal() {
        2092  size_t box_size =
        2093  HeaderSize() + dinf.ComputeSize() + sample_table.ComputeSize();
        2094  switch (sample_table.description.type) {
        2095  case kVideo:
        2096  box_size += vmhd.ComputeSize();
        2097  break;
        2098  case kAudio:
        2099  box_size += smhd.ComputeSize();
        2100  break;
        2101  case kText:
        2102  box_size += sthd.ComputeSize();
        2103  break;
        2104  default:
        2105  NOTIMPLEMENTED();
        2106  }
        2107  return box_size;
        2108 }
        2109 
        2110 Media::Media() = default;
        2111 Media::~Media() = default;
        2112 
        2113 FourCC Media::BoxType() const {
        2114  return FOURCC_mdia;
        2115 }
        2116 
        2117 bool Media::ReadWriteInternal(BoxBuffer* buffer) {
        2118  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->PrepareChildren() &&
        2119  buffer->ReadWriteChild(&header));
        2120  if (buffer->Reading()) {
        2121  RCHECK(buffer->ReadWriteChild(&handler));
        2122  // Maddeningly, the HandlerReference box specifies how to parse the
        2123  // SampleDescription box, making the latter the only box (of those that we
        2124  // support) which cannot be parsed correctly on its own (or even with
        2125  // information from its strict ancestor tree). We thus copy the handler type
        2126  // to the sample description box *before* parsing it to provide this
        2127  // information while parsing.
        2128  information.sample_table.description.type =
        2129  FourCCToTrackType(handler.handler_type);
        2130  } else {
        2131  handler.handler_type =
        2132  TrackTypeToFourCC(information.sample_table.description.type);
        2133  RCHECK(handler.handler_type != FOURCC_NULL);
        2134  RCHECK(buffer->ReadWriteChild(&handler));
        2135  }
        2136  RCHECK(buffer->ReadWriteChild(&information));
        2137  return true;
        2138 }
        2139 
        2140 size_t Media::ComputeSizeInternal() {
        2141  handler.handler_type =
        2142  TrackTypeToFourCC(information.sample_table.description.type);
        2143  return HeaderSize() + header.ComputeSize() + handler.ComputeSize() +
        2144  information.ComputeSize();
        2145 }
        2146 
        2147 Track::Track() = default;
        2148 Track::~Track() = default;
        2149 
        2150 FourCC Track::BoxType() const {
        2151  return FOURCC_trak;
        2152 }
        2153 
        2154 bool Track::ReadWriteInternal(BoxBuffer* buffer) {
        2155  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->PrepareChildren() &&
        2156  buffer->ReadWriteChild(&header) && buffer->ReadWriteChild(&media) &&
        2157  buffer->TryReadWriteChild(&edit) &&
        2158  buffer->TryReadWriteChild(&sample_encryption));
        2159  return true;
        2160 }
        2161 
        2162 size_t Track::ComputeSizeInternal() {
        2163  return HeaderSize() + header.ComputeSize() + media.ComputeSize() +
        2164  edit.ComputeSize();
        2165 }
        2166 
        2167 MovieExtendsHeader::MovieExtendsHeader() = default;
        2168 MovieExtendsHeader::~MovieExtendsHeader() = default;
        2169 
        2171  return FOURCC_mehd;
        2172 }
        2173 
        2174 bool MovieExtendsHeader::ReadWriteInternal(BoxBuffer* buffer) {
        2175  RCHECK(ReadWriteHeaderInternal(buffer));
        2176  size_t num_bytes = (version == 1) ? sizeof(uint64_t) : sizeof(uint32_t);
        2177  RCHECK(buffer->ReadWriteUInt64NBytes(&fragment_duration, num_bytes));
        2178  return true;
        2179 }
        2180 
        2181 size_t MovieExtendsHeader::ComputeSizeInternal() {
        2182  // This box is optional. Skip it if it is not used.
        2183  if (fragment_duration == 0)
        2184  return 0;
        2185  version = IsFitIn32Bits(fragment_duration) ? 0 : 1;
        2186  return HeaderSize() + sizeof(uint32_t) * (1 + version);
        2187 }
        2188 
        2189 TrackExtends::TrackExtends() = default;
        2190 TrackExtends::~TrackExtends() = default;
        2191 
        2192 FourCC TrackExtends::BoxType() const {
        2193  return FOURCC_trex;
        2194 }
        2195 
        2196 bool TrackExtends::ReadWriteInternal(BoxBuffer* buffer) {
        2197  RCHECK(ReadWriteHeaderInternal(buffer) &&
        2198  buffer->ReadWriteUInt32(&track_id) &&
        2199  buffer->ReadWriteUInt32(&default_sample_description_index) &&
        2200  buffer->ReadWriteUInt32(&default_sample_duration) &&
        2201  buffer->ReadWriteUInt32(&default_sample_size) &&
        2202  buffer->ReadWriteUInt32(&default_sample_flags));
        2203  return true;
        2204 }
        2205 
        2206 size_t TrackExtends::ComputeSizeInternal() {
        2207  return HeaderSize() + sizeof(track_id) +
        2208  sizeof(default_sample_description_index) +
        2209  sizeof(default_sample_duration) + sizeof(default_sample_size) +
        2210  sizeof(default_sample_flags);
        2211 }
        2212 
        2213 MovieExtends::MovieExtends() = default;
        2214 MovieExtends::~MovieExtends() = default;
        2215 
        2216 FourCC MovieExtends::BoxType() const {
        2217  return FOURCC_mvex;
        2218 }
        2219 
        2220 bool MovieExtends::ReadWriteInternal(BoxBuffer* buffer) {
        2221  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->PrepareChildren() &&
        2222  buffer->TryReadWriteChild(&header));
        2223  if (buffer->Reading()) {
        2224  DCHECK(buffer->reader());
        2225  RCHECK(buffer->reader()->ReadChildren(&tracks));
        2226  } else {
        2227  for (uint32_t i = 0; i < tracks.size(); ++i)
        2228  RCHECK(buffer->ReadWriteChild(&tracks[i]));
        2229  }
        2230  return true;
        2231 }
        2232 
        2233 size_t MovieExtends::ComputeSizeInternal() {
        2234  // This box is optional. Skip it if it does not contain any track.
        2235  if (tracks.size() == 0)
        2236  return 0;
        2237  size_t box_size = HeaderSize() + header.ComputeSize();
        2238  for (uint32_t i = 0; i < tracks.size(); ++i)
        2239  box_size += tracks[i].ComputeSize();
        2240  return box_size;
        2241 }
        2242 
        2243 Movie::Movie() = default;
        2244 Movie::~Movie() = default;
        2245 
        2246 FourCC Movie::BoxType() const {
        2247  return FOURCC_moov;
        2248 }
        2249 
        2250 bool Movie::ReadWriteInternal(BoxBuffer* buffer) {
        2251  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->PrepareChildren() &&
        2252  buffer->ReadWriteChild(&header));
        2253  if (buffer->Reading()) {
        2254  BoxReader* reader = buffer->reader();
        2255  DCHECK(reader);
        2256  RCHECK(reader->ReadChildren(&tracks) && reader->TryReadChild(&extends) &&
        2257  reader->TryReadChildren(&pssh));
        2258  } else {
        2259  // The 'meta' box is not well formed in the video captured by Android's
        2260  // default camera app: spec indicates that it is a FullBox but it is written
        2261  // as a Box. This results in the box failed to be parsed. See
        2262  // https://github.com/google/shaka-packager/issues/319 for details.
        2263  // We do not care the content of metadata box in the source content, so just
        2264  // skip reading the box.
        2265  RCHECK(buffer->TryReadWriteChild(&metadata));
        2266  for (uint32_t i = 0; i < tracks.size(); ++i)
        2267  RCHECK(buffer->ReadWriteChild(&tracks[i]));
        2268  RCHECK(buffer->TryReadWriteChild(&extends));
        2269  for (uint32_t i = 0; i < pssh.size(); ++i)
        2270  RCHECK(buffer->ReadWriteChild(&pssh[i]));
        2271  }
        2272  return true;
        2273 }
        2274 
        2275 size_t Movie::ComputeSizeInternal() {
        2276  size_t box_size = HeaderSize() + header.ComputeSize() +
        2277  metadata.ComputeSize() + extends.ComputeSize();
        2278  for (uint32_t i = 0; i < tracks.size(); ++i)
        2279  box_size += tracks[i].ComputeSize();
        2280  for (uint32_t i = 0; i < pssh.size(); ++i)
        2281  box_size += pssh[i].ComputeSize();
        2282  return box_size;
        2283 }
        2284 
        2285 TrackFragmentDecodeTime::TrackFragmentDecodeTime() = default;
        2286 TrackFragmentDecodeTime::~TrackFragmentDecodeTime() = default;
        2287 
        2289  return FOURCC_tfdt;
        2290 }
        2291 
        2292 bool TrackFragmentDecodeTime::ReadWriteInternal(BoxBuffer* buffer) {
        2293  RCHECK(ReadWriteHeaderInternal(buffer));
        2294  size_t num_bytes = (version == 1) ? sizeof(uint64_t) : sizeof(uint32_t);
        2295  RCHECK(buffer->ReadWriteUInt64NBytes(&decode_time, num_bytes));
        2296  return true;
        2297 }
        2298 
        2299 size_t TrackFragmentDecodeTime::ComputeSizeInternal() {
        2300  version = IsFitIn32Bits(decode_time) ? 0 : 1;
        2301  return HeaderSize() + sizeof(uint32_t) * (1 + version);
        2302 }
        2303 
        2304 MovieFragmentHeader::MovieFragmentHeader() = default;
        2305 MovieFragmentHeader::~MovieFragmentHeader() = default;
        2306 
        2308  return FOURCC_mfhd;
        2309 }
        2310 
        2311 bool MovieFragmentHeader::ReadWriteInternal(BoxBuffer* buffer) {
        2312  return ReadWriteHeaderInternal(buffer) &&
        2313  buffer->ReadWriteUInt32(&sequence_number);
        2314 }
        2315 
        2316 size_t MovieFragmentHeader::ComputeSizeInternal() {
        2317  return HeaderSize() + sizeof(sequence_number);
        2318 }
        2319 
        2320 TrackFragmentHeader::TrackFragmentHeader() = default;
        2321 TrackFragmentHeader::~TrackFragmentHeader() = default;
        2322 
        2324  return FOURCC_tfhd;
        2325 }
        2326 
        2327 bool TrackFragmentHeader::ReadWriteInternal(BoxBuffer* buffer) {
        2328  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->ReadWriteUInt32(&track_id));
        2329 
        2330  if (flags & kBaseDataOffsetPresentMask) {
        2331  // MSE requires 'default-base-is-moof' to be set and
        2332  // 'base-data-offset-present' not to be set. We omit these checks as some
        2333  // valid files in the wild don't follow these rules, though they use moof as
        2334  // base.
        2335  uint64_t base_data_offset;
        2336  RCHECK(buffer->ReadWriteUInt64(&base_data_offset));
        2337  DLOG(WARNING) << "base-data-offset-present is not expected. Assumes "
        2338  "default-base-is-moof.";
        2339  }
        2340 
        2341  if (flags & kSampleDescriptionIndexPresentMask) {
        2342  RCHECK(buffer->ReadWriteUInt32(&sample_description_index));
        2343  } else if (buffer->Reading()) {
        2344  sample_description_index = 0;
        2345  }
        2346 
        2347  if (flags & kDefaultSampleDurationPresentMask) {
        2348  RCHECK(buffer->ReadWriteUInt32(&default_sample_duration));
        2349  } else if (buffer->Reading()) {
        2350  default_sample_duration = 0;
        2351  }
        2352 
        2353  if (flags & kDefaultSampleSizePresentMask) {
        2354  RCHECK(buffer->ReadWriteUInt32(&default_sample_size));
        2355  } else if (buffer->Reading()) {
        2356  default_sample_size = 0;
        2357  }
        2358 
        2359  if (flags & kDefaultSampleFlagsPresentMask)
        2360  RCHECK(buffer->ReadWriteUInt32(&default_sample_flags));
        2361  return true;
        2362 }
        2363 
        2364 size_t TrackFragmentHeader::ComputeSizeInternal() {
        2365  size_t box_size = HeaderSize() + sizeof(track_id);
        2366  if (flags & kSampleDescriptionIndexPresentMask)
        2367  box_size += sizeof(sample_description_index);
        2368  if (flags & kDefaultSampleDurationPresentMask)
        2369  box_size += sizeof(default_sample_duration);
        2370  if (flags & kDefaultSampleSizePresentMask)
        2371  box_size += sizeof(default_sample_size);
        2372  if (flags & kDefaultSampleFlagsPresentMask)
        2373  box_size += sizeof(default_sample_flags);
        2374  return box_size;
        2375 }
        2376 
        2377 TrackFragmentRun::TrackFragmentRun() = default;
        2378 TrackFragmentRun::~TrackFragmentRun() = default;
        2379 
        2381  return FOURCC_trun;
        2382 }
        2383 
        2384 bool TrackFragmentRun::ReadWriteInternal(BoxBuffer* buffer) {
        2385  if (!buffer->Reading()) {
        2386  // Determine whether version 0 or version 1 should be used.
        2387  // Use version 0 if possible, use version 1 if there is a negative
        2388  // sample_offset value.
        2389  version = 0;
        2390  if (flags & kSampleCompTimeOffsetsPresentMask) {
        2391  for (uint32_t i = 0; i < sample_count; ++i) {
        2392  if (sample_composition_time_offsets[i] < 0) {
        2393  version = 1;
        2394  break;
        2395  }
        2396  }
        2397  }
        2398  }
        2399 
        2400  RCHECK(ReadWriteHeaderInternal(buffer) &&
        2401  buffer->ReadWriteUInt32(&sample_count));
        2402 
        2403  bool data_offset_present = (flags & kDataOffsetPresentMask) != 0;
        2404  bool first_sample_flags_present = (flags & kFirstSampleFlagsPresentMask) != 0;
        2405  bool sample_duration_present = (flags & kSampleDurationPresentMask) != 0;
        2406  bool sample_size_present = (flags & kSampleSizePresentMask) != 0;
        2407  bool sample_flags_present = (flags & kSampleFlagsPresentMask) != 0;
        2408  bool sample_composition_time_offsets_present =
        2409  (flags & kSampleCompTimeOffsetsPresentMask) != 0;
        2410 
        2411  if (data_offset_present) {
        2412  RCHECK(buffer->ReadWriteUInt32(&data_offset));
        2413  } else {
        2414  // NOTE: If the data-offset is not present, then the data for this run
        2415  // starts immediately after the data of the previous run, or at the
        2416  // base-data-offset defined by the track fragment header if this is the
        2417  // first run in a track fragment. If the data-offset is present, it is
        2418  // relative to the base-data-offset established in the track fragment
        2419  // header.
        2420  NOTIMPLEMENTED();
        2421  }
        2422 
        2423  uint32_t first_sample_flags(0);
        2424 
        2425  if (buffer->Reading()) {
        2426  if (first_sample_flags_present)
        2427  RCHECK(buffer->ReadWriteUInt32(&first_sample_flags));
        2428 
        2429  if (sample_duration_present)
        2430  sample_durations.resize(sample_count);
        2431  if (sample_size_present)
        2432  sample_sizes.resize(sample_count);
        2433  if (sample_flags_present)
        2434  sample_flags.resize(sample_count);
        2435  if (sample_composition_time_offsets_present)
        2436  sample_composition_time_offsets.resize(sample_count);
        2437  } else {
        2438  if (first_sample_flags_present) {
        2439  first_sample_flags = sample_flags[0];
        2440  DCHECK(sample_flags.size() == 1);
        2441  RCHECK(buffer->ReadWriteUInt32(&first_sample_flags));
        2442  }
        2443 
        2444  if (sample_duration_present)
        2445  DCHECK(sample_durations.size() == sample_count);
        2446  if (sample_size_present)
        2447  DCHECK(sample_sizes.size() == sample_count);
        2448  if (sample_flags_present)
        2449  DCHECK(sample_flags.size() == sample_count);
        2450  if (sample_composition_time_offsets_present)
        2451  DCHECK(sample_composition_time_offsets.size() == sample_count);
        2452  }
        2453 
        2454  for (uint32_t i = 0; i < sample_count; ++i) {
        2455  if (sample_duration_present)
        2456  RCHECK(buffer->ReadWriteUInt32(&sample_durations[i]));
        2457  if (sample_size_present)
        2458  RCHECK(buffer->ReadWriteUInt32(&sample_sizes[i]));
        2459  if (sample_flags_present)
        2460  RCHECK(buffer->ReadWriteUInt32(&sample_flags[i]));
        2461 
        2462  if (sample_composition_time_offsets_present) {
        2463  if (version == 0) {
        2464  uint32_t sample_offset = sample_composition_time_offsets[i];
        2465  RCHECK(buffer->ReadWriteUInt32(&sample_offset));
        2466  sample_composition_time_offsets[i] = sample_offset;
        2467  } else {
        2468  int32_t sample_offset = sample_composition_time_offsets[i];
        2469  RCHECK(buffer->ReadWriteInt32(&sample_offset));
        2470  sample_composition_time_offsets[i] = sample_offset;
        2471  }
        2472  }
        2473  }
        2474 
        2475  if (buffer->Reading()) {
        2476  if (first_sample_flags_present) {
        2477  if (sample_flags.size() == 0) {
        2478  sample_flags.push_back(first_sample_flags);
        2479  } else {
        2480  sample_flags[0] = first_sample_flags;
        2481  }
        2482  }
        2483  }
        2484  return true;
        2485 }
        2486 
        2487 size_t TrackFragmentRun::ComputeSizeInternal() {
        2488  size_t box_size = HeaderSize() + sizeof(sample_count);
        2489  if (flags & kDataOffsetPresentMask)
        2490  box_size += sizeof(data_offset);
        2491  if (flags & kFirstSampleFlagsPresentMask)
        2492  box_size += sizeof(uint32_t);
        2493  uint32_t fields = (flags & kSampleDurationPresentMask ? 1 : 0) +
        2494  (flags & kSampleSizePresentMask ? 1 : 0) +
        2495  (flags & kSampleFlagsPresentMask ? 1 : 0) +
        2496  (flags & kSampleCompTimeOffsetsPresentMask ? 1 : 0);
        2497  box_size += fields * sizeof(uint32_t) * sample_count;
        2498  return box_size;
        2499 }
        2500 
        2501 TrackFragment::TrackFragment() = default;
        2502 TrackFragment::~TrackFragment() = default;
        2503 
        2504 FourCC TrackFragment::BoxType() const {
        2505  return FOURCC_traf;
        2506 }
        2507 
        2508 bool TrackFragment::ReadWriteInternal(BoxBuffer* buffer) {
        2509  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->PrepareChildren() &&
        2510  buffer->ReadWriteChild(&header));
        2511  if (buffer->Reading()) {
        2512  DCHECK(buffer->reader());
        2513  decode_time_absent = !buffer->reader()->ChildExist(&decode_time);
        2514  if (!decode_time_absent)
        2515  RCHECK(buffer->ReadWriteChild(&decode_time));
        2516  RCHECK(buffer->reader()->TryReadChildren(&runs) &&
        2517  buffer->reader()->TryReadChildren(&sample_group_descriptions) &&
        2518  buffer->reader()->TryReadChildren(&sample_to_groups));
        2519  } else {
        2520  if (!decode_time_absent)
        2521  RCHECK(buffer->ReadWriteChild(&decode_time));
        2522  for (uint32_t i = 0; i < runs.size(); ++i)
        2523  RCHECK(buffer->ReadWriteChild(&runs[i]));
        2524  for (uint32_t i = 0; i < sample_to_groups.size(); ++i)
        2525  RCHECK(buffer->ReadWriteChild(&sample_to_groups[i]));
        2526  for (uint32_t i = 0; i < sample_group_descriptions.size(); ++i)
        2527  RCHECK(buffer->ReadWriteChild(&sample_group_descriptions[i]));
        2528  }
        2529  return buffer->TryReadWriteChild(&auxiliary_size) &&
        2530  buffer->TryReadWriteChild(&auxiliary_offset) &&
        2531  buffer->TryReadWriteChild(&sample_encryption);
        2532 }
        2533 
        2534 size_t TrackFragment::ComputeSizeInternal() {
        2535  size_t box_size = HeaderSize() + header.ComputeSize() +
        2536  decode_time.ComputeSize() + auxiliary_size.ComputeSize() +
        2537  auxiliary_offset.ComputeSize() +
        2538  sample_encryption.ComputeSize();
        2539  for (uint32_t i = 0; i < runs.size(); ++i)
        2540  box_size += runs[i].ComputeSize();
        2541  for (uint32_t i = 0; i < sample_group_descriptions.size(); ++i)
        2542  box_size += sample_group_descriptions[i].ComputeSize();
        2543  for (uint32_t i = 0; i < sample_to_groups.size(); ++i)
        2544  box_size += sample_to_groups[i].ComputeSize();
        2545  return box_size;
        2546 }
        2547 
        2548 MovieFragment::MovieFragment() = default;
        2549 MovieFragment::~MovieFragment() = default;
        2550 
        2551 FourCC MovieFragment::BoxType() const {
        2552  return FOURCC_moof;
        2553 }
        2554 
        2555 bool MovieFragment::ReadWriteInternal(BoxBuffer* buffer) {
        2556  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->PrepareChildren() &&
        2557  buffer->ReadWriteChild(&header));
        2558  if (buffer->Reading()) {
        2559  BoxReader* reader = buffer->reader();
        2560  DCHECK(reader);
        2561  RCHECK(reader->ReadChildren(&tracks) && reader->TryReadChildren(&pssh));
        2562  } else {
        2563  for (uint32_t i = 0; i < tracks.size(); ++i)
        2564  RCHECK(buffer->ReadWriteChild(&tracks[i]));
        2565  for (uint32_t i = 0; i < pssh.size(); ++i)
        2566  RCHECK(buffer->ReadWriteChild(&pssh[i]));
        2567  }
        2568  return true;
        2569 }
        2570 
        2571 size_t MovieFragment::ComputeSizeInternal() {
        2572  size_t box_size = HeaderSize() + header.ComputeSize();
        2573  for (uint32_t i = 0; i < tracks.size(); ++i)
        2574  box_size += tracks[i].ComputeSize();
        2575  for (uint32_t i = 0; i < pssh.size(); ++i)
        2576  box_size += pssh[i].ComputeSize();
        2577  return box_size;
        2578 }
        2579 
        2580 SegmentIndex::SegmentIndex() = default;
        2581 SegmentIndex::~SegmentIndex() = default;
        2582 
        2583 FourCC SegmentIndex::BoxType() const {
        2584  return FOURCC_sidx;
        2585 }
        2586 
        2587 bool SegmentIndex::ReadWriteInternal(BoxBuffer* buffer) {
        2588  RCHECK(ReadWriteHeaderInternal(buffer) &&
        2589  buffer->ReadWriteUInt32(&reference_id) &&
        2590  buffer->ReadWriteUInt32(&timescale));
        2591 
        2592  size_t num_bytes = (version == 1) ? sizeof(uint64_t) : sizeof(uint32_t);
        2593  RCHECK(
        2594  buffer->ReadWriteUInt64NBytes(&earliest_presentation_time, num_bytes) &&
        2595  buffer->ReadWriteUInt64NBytes(&first_offset, num_bytes));
        2596 
        2597  uint16_t reference_count = static_cast<uint16_t>(references.size());
        2598  RCHECK(buffer->IgnoreBytes(2) && // reserved.
        2599  buffer->ReadWriteUInt16(&reference_count));
        2600  references.resize(reference_count);
        2601 
        2602  uint32_t reference_type_size;
        2603  uint32_t sap;
        2604  for (uint32_t i = 0; i < reference_count; ++i) {
        2605  if (!buffer->Reading()) {
        2606  reference_type_size = references[i].referenced_size;
        2607  if (references[i].reference_type)
        2608  reference_type_size |= (1 << 31);
        2609  sap = (references[i].sap_type << 28) | references[i].sap_delta_time;
        2610  if (references[i].starts_with_sap)
        2611  sap |= (1 << 31);
        2612  }
        2613  RCHECK(buffer->ReadWriteUInt32(&reference_type_size) &&
        2614  buffer->ReadWriteUInt32(&references[i].subsegment_duration) &&
        2615  buffer->ReadWriteUInt32(&sap));
        2616  if (buffer->Reading()) {
        2617  references[i].reference_type = (reference_type_size >> 31) ? true : false;
        2618  references[i].referenced_size = reference_type_size & ~(1 << 31);
        2619  references[i].starts_with_sap = (sap >> 31) ? true : false;
        2620  references[i].sap_type =
        2621  static_cast<SegmentReference::SAPType>((sap >> 28) & 0x07);
        2622  references[i].sap_delta_time = sap & ~(0xF << 28);
        2623  }
        2624  }
        2625  return true;
        2626 }
        2627 
        2628 size_t SegmentIndex::ComputeSizeInternal() {
        2629  version = IsFitIn32Bits(earliest_presentation_time, first_offset) ? 0 : 1;
        2630  return HeaderSize() + sizeof(reference_id) + sizeof(timescale) +
        2631  sizeof(uint32_t) * (1 + version) * 2 + 2 * sizeof(uint16_t) +
        2632  3 * sizeof(uint32_t) * references.size();
        2633 }
        2634 
        2635 MediaData::MediaData() = default;
        2636 MediaData::~MediaData() = default;
        2637 
        2638 FourCC MediaData::BoxType() const {
        2639  return FOURCC_mdat;
        2640 }
        2641 
        2642 bool MediaData::ReadWriteInternal(BoxBuffer* buffer) {
        2643  NOTIMPLEMENTED() << "Actual data is parsed and written separately.";
        2644  return false;
        2645 }
        2646 
        2647 size_t MediaData::ComputeSizeInternal() {
        2648  return HeaderSize() + data_size;
        2649 }
        2650 
        2651 CueSourceIDBox::CueSourceIDBox() = default;
        2652 CueSourceIDBox::~CueSourceIDBox() = default;
        2653 
        2654 FourCC CueSourceIDBox::BoxType() const {
        2655  return FOURCC_vsid;
        2656 }
        2657 
        2658 bool CueSourceIDBox::ReadWriteInternal(BoxBuffer* buffer) {
        2659  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->ReadWriteInt32(&source_id));
        2660  return true;
        2661 }
        2662 
        2663 size_t CueSourceIDBox::ComputeSizeInternal() {
        2664  if (source_id == kCueSourceIdNotSet)
        2665  return 0;
        2666  return HeaderSize() + sizeof(source_id);
        2667 }
        2668 
        2669 CueTimeBox::CueTimeBox() = default;
        2670 CueTimeBox::~CueTimeBox() = default;
        2671 
        2672 FourCC CueTimeBox::BoxType() const {
        2673  return FOURCC_ctim;
        2674 }
        2675 
        2676 bool CueTimeBox::ReadWriteInternal(BoxBuffer* buffer) {
        2677  RCHECK(ReadWriteHeaderInternal(buffer));
        2678  return buffer->ReadWriteString(
        2679  &cue_current_time,
        2680  buffer->Reading() ? buffer->BytesLeft() : cue_current_time.size());
        2681 }
        2682 
        2683 size_t CueTimeBox::ComputeSizeInternal() {
        2684  if (cue_current_time.empty())
        2685  return 0;
        2686  return HeaderSize() + cue_current_time.size();
        2687 }
        2688 
        2689 CueIDBox::CueIDBox() = default;
        2690 CueIDBox::~CueIDBox() = default;
        2691 
        2692 FourCC CueIDBox::BoxType() const {
        2693  return FOURCC_iden;
        2694 }
        2695 
        2696 bool CueIDBox::ReadWriteInternal(BoxBuffer* buffer) {
        2697  RCHECK(ReadWriteHeaderInternal(buffer));
        2698  return buffer->ReadWriteString(
        2699  &cue_id, buffer->Reading() ? buffer->BytesLeft() : cue_id.size());
        2700 }
        2701 
        2702 size_t CueIDBox::ComputeSizeInternal() {
        2703  if (cue_id.empty())
        2704  return 0;
        2705  return HeaderSize() + cue_id.size();
        2706 }
        2707 
        2708 CueSettingsBox::CueSettingsBox() = default;
        2709 CueSettingsBox::~CueSettingsBox() = default;
        2710 
        2711 FourCC CueSettingsBox::BoxType() const {
        2712  return FOURCC_sttg;
        2713 }
        2714 
        2715 bool CueSettingsBox::ReadWriteInternal(BoxBuffer* buffer) {
        2716  RCHECK(ReadWriteHeaderInternal(buffer));
        2717  return buffer->ReadWriteString(
        2718  &settings, buffer->Reading() ? buffer->BytesLeft() : settings.size());
        2719 }
        2720 
        2721 size_t CueSettingsBox::ComputeSizeInternal() {
        2722  if (settings.empty())
        2723  return 0;
        2724  return HeaderSize() + settings.size();
        2725 }
        2726 
        2727 CuePayloadBox::CuePayloadBox() = default;
        2728 CuePayloadBox::~CuePayloadBox() = default;
        2729 
        2730 FourCC CuePayloadBox::BoxType() const {
        2731  return FOURCC_payl;
        2732 }
        2733 
        2734 bool CuePayloadBox::ReadWriteInternal(BoxBuffer* buffer) {
        2735  RCHECK(ReadWriteHeaderInternal(buffer));
        2736  return buffer->ReadWriteString(
        2737  &cue_text, buffer->Reading() ? buffer->BytesLeft() : cue_text.size());
        2738 }
        2739 
        2740 size_t CuePayloadBox::ComputeSizeInternal() {
        2741  return HeaderSize() + cue_text.size();
        2742 }
        2743 
        2744 VTTEmptyCueBox::VTTEmptyCueBox() = default;
        2745 VTTEmptyCueBox::~VTTEmptyCueBox() = default;
        2746 
        2747 FourCC VTTEmptyCueBox::BoxType() const {
        2748  return FOURCC_vtte;
        2749 }
        2750 
        2751 bool VTTEmptyCueBox::ReadWriteInternal(BoxBuffer* buffer) {
        2752  return ReadWriteHeaderInternal(buffer);
        2753 }
        2754 
        2755 size_t VTTEmptyCueBox::ComputeSizeInternal() {
        2756  return HeaderSize();
        2757 }
        2758 
        2759 VTTAdditionalTextBox::VTTAdditionalTextBox() = default;
        2760 VTTAdditionalTextBox::~VTTAdditionalTextBox() = default;
        2761 
        2763  return FOURCC_vtta;
        2764 }
        2765 
        2766 bool VTTAdditionalTextBox::ReadWriteInternal(BoxBuffer* buffer) {
        2767  RCHECK(ReadWriteHeaderInternal(buffer));
        2768  return buffer->ReadWriteString(
        2769  &cue_additional_text,
        2770  buffer->Reading() ? buffer->BytesLeft() : cue_additional_text.size());
        2771 }
        2772 
        2773 size_t VTTAdditionalTextBox::ComputeSizeInternal() {
        2774  return HeaderSize() + cue_additional_text.size();
        2775 }
        2776 
        2777 VTTCueBox::VTTCueBox() = default;
        2778 VTTCueBox::~VTTCueBox() = default;
        2779 
        2780 FourCC VTTCueBox::BoxType() const {
        2781  return FOURCC_vttc;
        2782 }
        2783 
        2784 bool VTTCueBox::ReadWriteInternal(BoxBuffer* buffer) {
        2785  RCHECK(ReadWriteHeaderInternal(buffer) && buffer->PrepareChildren() &&
        2786  buffer->TryReadWriteChild(&cue_source_id) &&
        2787  buffer->TryReadWriteChild(&cue_id) &&
        2788  buffer->TryReadWriteChild(&cue_time) &&
        2789  buffer->TryReadWriteChild(&cue_settings) &&
        2790  buffer->ReadWriteChild(&cue_payload));
        2791  return true;
        2792 }
        2793 
        2794 size_t VTTCueBox::ComputeSizeInternal() {
        2795  return HeaderSize() + cue_source_id.ComputeSize() + cue_id.ComputeSize() +
        2796  cue_time.ComputeSize() + cue_settings.ComputeSize() +
        2797  cue_payload.ComputeSize();
        2798 }
        2799 
        2800 } // namespace mp4
        2801 } // namespace media
        2802 } // namespace shaka
        FourCC BoxType() const override
        + + - -
        FourCC BoxType() const override
        - - -
        FourCC BoxType() const override
        -
        FourCC BoxType() const override
        - - -
        bool ParseFromBuffer(uint8_t iv_size, bool has_subsamples, BufferReader *reader)
        - - -
        FourCC BoxType() const override
        -
        FourCC BoxType() const override
        - - -
        FourCC BoxType() const override
        + +
        FourCC BoxType() const override
        + + +
        FourCC BoxType() const override
        +
        FourCC BoxType() const override
        + + +
        bool ParseFromBuffer(uint8_t iv_size, bool has_subsamples, BufferReader *reader)
        + + +
        FourCC BoxType() const override
        +
        FourCC BoxType() const override
        + + +
        FourCC BoxType() const override
        A class to read bit streams.
        Definition: bit_reader.h:17
        -
        FourCC BoxType() const override
        - -
        FourCC BoxType() const override
        +
        FourCC BoxType() const override
        + +
        FourCC BoxType() const override
        bool TryReadChildren(std::vector< T > *children) WARN_UNUSED_RESULT
        Definition: box_reader.h:134
        - +
        bool TryReadWriteChild(Box *box)
        Definition: box_buffer.h:177
        - - -
        FourCC BoxType() const override
        + + +
        FourCC BoxType() const override
        bool ReadAllChildren(std::vector< T > *children) WARN_UNUSED_RESULT
        Definition: box_reader.h:157
        -
        FourCC BoxType() const override
        - +
        FourCC BoxType() const override
        + - -
        FourCC BoxType() const override
        -
        FourCC BoxType() const override
        - + +
        FourCC BoxType() const override
        +
        FourCC BoxType() const override
        +
        size_t BytesLeft() const
        Definition: box_buffer.h:62
        -
        FourCC BoxType() const override
        - - -
        FourCC BoxType() const override
        - -
        FourCC BoxType() const override
        +
        FourCC BoxType() const override
        + + +
        FourCC BoxType() const override
        + +
        virtual bool ReadWriteHeaderInternal(BoxBuffer *buffer)
        Definition: box.cc:61
        +
        FourCC BoxType() const override
        All the methods that are virtual are virtual for mocking.
        -
        FourCC BoxType() const override
        - - -
        bool ParseFromSampleEncryptionData(uint8_t iv_size, std::vector< SampleEncryptionEntry > *sample_encryption_entries) const
        +
        FourCC BoxType() const override
        + + +
        bool ParseFromSampleEncryptionData(uint8_t iv_size, std::vector< SampleEncryptionEntry > *sample_encryption_entries) const
        -
        FourCC BoxType() const override
        - - -
        bool ReadWrite(uint8_t iv_size, bool has_subsamples, BoxBuffer *buffer)
        - -
        FourCC BoxType() const override
        -
        FourCC BoxType() const override
        - - -
        FourCC BoxType() const override
        +
        FourCC BoxType() const override
        + + +
        uint32_t ComputeSize()
        Definition: box.cc:50
        +
        bool ReadWrite(uint8_t iv_size, bool has_subsamples, BoxBuffer *buffer)
        + +
        FourCC BoxType() const override
        +
        FourCC BoxType() const override
        + + +
        FourCC BoxType() const override
        bool ReadChildren(std::vector< T > *children) WARN_UNUSED_RESULT
        Definition: box_reader.h:128
        -
        FourCC BoxType() const override
        - - - -
        FourCC BoxType() const override
        - -
        FourCC BoxType() const override
        +
        FourCC BoxType() const override
        + + + +
        FourCC BoxType() const override
        +
        uint32_t box_size()
        Definition: box.h:55
        + +
        FourCC BoxType() const override
        BufferWriter * writer()
        Definition: box_buffer.h:200
        -
        FourCC BoxType() const override
        -
        FourCC BoxType() const override
        - +
        FourCC BoxType() const override
        +
        FourCC BoxType() const override
        +
        bool IgnoreBytes(size_t num_bytes)
        Definition: box_buffer.h:189
        - +
        Class for reading MP4 boxes.
        Definition: box_reader.h:25
        bool ReadWriteString(std::string *str, size_t size)
        Definition: box_buffer.h:139
        -
        FourCC BoxType() const override
        +
        FourCC BoxType() const override
        bool ReadChild(Box *child) WARN_UNUSED_RESULT
        Definition: box_reader.cc:90
        -
        FourCC BoxType() const override
        - -
        FourCC BoxType() const override
        - - +
        virtual uint32_t HeaderSize() const
        Definition: box.cc:55
        +
        FourCC BoxType() const override
        + +
        FourCC BoxType() const override
        + +
        bool ReadWriteUInt64NBytes(uint64_t *v, size_t num_bytes)
        Definition: box_buffer.h:117
        -
        FourCC BoxType() const override
        -
        FourCC BoxType() const override
        - - +
        FourCC BoxType() const override
        +
        FourCC BoxType() const override
        + + -
        FourCC BoxType() const override
        - - - -
        FourCC BoxType() const override
        -
        FourCC BoxType() const override
        +
        FourCC BoxType() const override
        + + + +
        FourCC BoxType() const override
        +
        FourCC BoxType() const override
        void Write(BufferWriter *writer)
        Definition: box.cc:25
        -
        FourCC BoxType() const override
        -
        FourCC BoxType() const override
        +
        FourCC BoxType() const override
        +
        FourCC BoxType() const override
        bool TryReadChild(Box *child) WARN_UNUSED_RESULT
        Definition: box_reader.cc:106
        -
        FourCC BoxType() const override
        -
        FourCC BoxType() const override
        +
        FourCC BoxType() const override
        +
        FourCC BoxType() const override
        bool ChildExist(Box *child) WARN_UNUSED_RESULT
        Definition: box_reader.cc:102
        bool ReadWriteChild(Box *box)
        Definition: box_buffer.h:166
        diff --git a/docs/dd/df2/webm_2multi__segment__segmenter_8h_source.html b/docs/dd/df2/webm_2multi__segment__segmenter_8h_source.html index 8534a41103..23beea8ab8 100644 --- a/docs/dd/df2/webm_2multi__segment__segmenter_8h_source.html +++ b/docs/dd/df2/webm_2multi__segment__segmenter_8h_source.html @@ -77,7 +77,7 @@ $(function() {
        diff --git a/docs/dd/df3/classshaka_1_1media_1_1PsshGenerator-members.html b/docs/dd/df3/classshaka_1_1media_1_1PsshGenerator-members.html index d045a3780b..e6fc36368e 100644 --- a/docs/dd/df3/classshaka_1_1media_1_1PsshGenerator-members.html +++ b/docs/dd/df3/classshaka_1_1media_1_1PsshGenerator-members.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/dd/df5/structshaka_1_1media_1_1mp4_1_1TrackFragmentRun.html b/docs/dd/df5/structshaka_1_1media_1_1mp4_1_1TrackFragmentRun.html index e80415d99c..4ae902d70c 100644 --- a/docs/dd/df5/structshaka_1_1media_1_1mp4_1_1TrackFragmentRun.html +++ b/docs/dd/df5/structshaka_1_1media_1_1mp4_1_1TrackFragmentRun.html @@ -118,10 +118,10 @@ Public Member Functions

        Public Attributes

        -uint32_t sample_count +uint32_t sample_count = 0u   -uint32_t data_offset +uint32_t data_offset = 0u   std::vector< uint32_t > sample_flags @@ -137,10 +137,10 @@ std::vector< int64_t >    - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

        @@ -151,7 +151,7 @@ Additional Inherited Members

        Detailed Description

        -

        Definition at line 706 of file box_definitions.h.

        +

        Definition at line 711 of file box_definitions.h.

        Member Function Documentation

        ◆ BoxType()

        @@ -179,7 +179,7 @@ Additional Inherited Members

        Implements shaka::media::mp4::Box.

        -

        Definition at line 2317 of file box_definitions.cc.

        +

        Definition at line 2380 of file box_definitions.cc.

        @@ -190,7 +190,7 @@ Additional Inherited Members diff --git a/docs/dd/df6/structshaka_1_1media_1_1mp4_1_1Metadata.html b/docs/dd/df6/structshaka_1_1media_1_1mp4_1_1Metadata.html index 40e62c3edd..63dc6368f3 100644 --- a/docs/dd/df6/structshaka_1_1media_1_1mp4_1_1Metadata.html +++ b/docs/dd/df6/structshaka_1_1media_1_1mp4_1_1Metadata.html @@ -110,10 +110,10 @@ Public Attributes   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

        Implements shaka::media::mp4::Box.

        -

        Definition at line 1349 of file box_definitions.cc.

        +

        Definition at line 1381 of file box_definitions.cc.

        @@ -163,7 +163,7 @@ Additional Inherited Members diff --git a/docs/dd/df9/classshaka_1_1media_1_1PlayReadyPsshGenerator-members.html b/docs/dd/df9/classshaka_1_1media_1_1PlayReadyPsshGenerator-members.html index 9d1ad5b609..668e441610 100644 --- a/docs/dd/df9/classshaka_1_1media_1_1PlayReadyPsshGenerator-members.html +++ b/docs/dd/df9/classshaka_1_1media_1_1PlayReadyPsshGenerator-members.html @@ -79,7 +79,7 @@ $(function() {

        @@ -152,7 +152,7 @@ Additional Inherited Members

        diff --git a/docs/dd/dfd/structshaka_1_1AdCueGeneratorParams.html b/docs/dd/dfd/structshaka_1_1AdCueGeneratorParams.html index c431ac6377..385e074e8d 100644 --- a/docs/dd/dfd/structshaka_1_1AdCueGeneratorParams.html +++ b/docs/dd/dfd/structshaka_1_1AdCueGeneratorParams.html @@ -92,7 +92,7 @@ std::vector< C diff --git a/docs/de/d00/ac3__header_8h_source.html b/docs/de/d00/ac3__header_8h_source.html index 58c8bea488..3c55a9bd70 100644 --- a/docs/de/d00/ac3__header_8h_source.html +++ b/docs/de/d00/ac3__header_8h_source.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/de/d03/text__padder_8cc_source.html b/docs/de/d03/text__padder_8cc_source.html index 49032097fd..0ec0812a3f 100644 --- a/docs/de/d03/text__padder_8cc_source.html +++ b/docs/de/d03/text__padder_8cc_source.html @@ -66,17 +66,17 @@ $(function() {
        text_padder.cc
        -
        1 // Copyright 2018 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #include "packager/media/formats/webvtt/text_padder.h"
        8 
        9 #include <algorithm>
        10 
        11 #include "packager/status_macros.h"
        12 
        13 namespace shaka {
        14 namespace media {
        15 namespace {
        16 const uint64_t kStreamIndex = 0;
        17 } // namespace
        18 
        19 TextPadder::TextPadder(int64_t duration_ms) : duration_ms_(duration_ms) {}
        20 
        21 Status TextPadder::InitializeInternal() {
        22  return Status::OK;
        23 }
        24 
        25 Status TextPadder::Process(std::unique_ptr<StreamData> data) {
        26  DCHECK_EQ(data->stream_index, kStreamIndex);
        27  const bool is_text_sample =
        28  data->stream_data_type == StreamDataType::kTextSample;
        29  return is_text_sample ? OnTextSample(std::move(data))
        30  : Dispatch(std::move(data));
        31 }
        32 
        33 Status TextPadder::OnFlushRequest(size_t index) {
        34  if (duration_ms_ > max_end_time_ms_) {
        35  std::shared_ptr<TextSample> filler = std::make_shared<TextSample>();
        36  filler->SetTime(max_end_time_ms_, duration_ms_);
        37  RETURN_IF_ERROR(
        38  MediaHandler::DispatchTextSample(kStreamIndex, std::move(filler)));
        39  }
        40 
        41  return FlushDownstream(index);
        42 }
        43 
        44 Status TextPadder::OnTextSample(std::unique_ptr<StreamData> data) {
        45  const TextSample& sample = *data->text_sample;
        46 
        47  // Check if there will be a gap between samples if we just dispatch this
        48  // sample right away. If there will be one, create an empty sample that will
        49  // fill in that gap.
        50  if (sample.start_time() > max_end_time_ms_) {
        51  std::shared_ptr<TextSample> filler = std::make_shared<TextSample>();
        52  filler->SetTime(max_end_time_ms_, sample.start_time());
        53  RETURN_IF_ERROR(
        54  MediaHandler::DispatchTextSample(kStreamIndex, std::move(filler)));
        55  }
        56 
        57  max_end_time_ms_ = std::max(max_end_time_ms_, sample.EndTime());
        58  return Dispatch(std::move(data));
        59 }
        60 } // namespace media
        61 } // namespace shaka
        Status Dispatch(std::unique_ptr< StreamData > stream_data) const
        +
        1 // Copyright 2018 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #include "packager/media/formats/webvtt/text_padder.h"
        8 
        9 #include <algorithm>
        10 
        11 #include "packager/status_macros.h"
        12 
        13 namespace shaka {
        14 namespace media {
        15 namespace {
        16 const uint64_t kStreamIndex = 0;
        17 } // namespace
        18 
        19 TextPadder::TextPadder(int64_t duration_ms) : duration_ms_(duration_ms) {}
        20 
        21 Status TextPadder::InitializeInternal() {
        22  return Status::OK;
        23 }
        24 
        25 Status TextPadder::Process(std::unique_ptr<StreamData> data) {
        26  DCHECK_EQ(data->stream_index, kStreamIndex);
        27  const bool is_text_sample =
        28  data->stream_data_type == StreamDataType::kTextSample;
        29  return is_text_sample ? OnTextSample(std::move(data))
        30  : Dispatch(std::move(data));
        31 }
        32 
        33 Status TextPadder::OnFlushRequest(size_t index) {
        34  if (duration_ms_ > max_end_time_ms_) {
        35  std::shared_ptr<TextSample> filler = std::make_shared<TextSample>();
        36  filler->SetTime(max_end_time_ms_, duration_ms_);
        37  RETURN_IF_ERROR(
        38  MediaHandler::DispatchTextSample(kStreamIndex, std::move(filler)));
        39  }
        40 
        41  return FlushDownstream(index);
        42 }
        43 
        44 Status TextPadder::OnTextSample(std::unique_ptr<StreamData> data) {
        45  const TextSample& sample = *data->text_sample;
        46 
        47  // Check if there will be a gap between samples if we just dispatch this
        48  // sample right away. If there will be one, create an empty sample that will
        49  // fill in that gap.
        50  if (sample.start_time() > max_end_time_ms_) {
        51  std::shared_ptr<TextSample> filler = std::make_shared<TextSample>();
        52  filler->SetTime(max_end_time_ms_, sample.start_time());
        53  RETURN_IF_ERROR(
        54  MediaHandler::DispatchTextSample(kStreamIndex, std::move(filler)));
        55  }
        56 
        57  max_end_time_ms_ = std::max(max_end_time_ms_, sample.EndTime());
        58  return Dispatch(std::move(data));
        59 }
        60 } // namespace media
        61 } // namespace shaka
        Status Dispatch(std::unique_ptr< StreamData > stream_data) const
        All the methods that are virtual are virtual for mocking.
        TextPadder(int64_t duration_ms)
        Create a new text padder that will ensure the stream&#39;s duration is.
        Definition: text_padder.cc:19
        -
        Status DispatchTextSample(size_t stream_index, std::shared_ptr< const TextSample > text_sample) const
        Dispatch the text sample to downstream handlers.
        -
        Status FlushDownstream(size_t output_stream_index)
        Flush the downstream connected at the specified output stream index.
        +
        Status DispatchTextSample(size_t stream_index, std::shared_ptr< const TextSample > text_sample) const
        Dispatch the text sample to downstream handlers.
        +
        Status FlushDownstream(size_t output_stream_index)
        Flush the downstream connected at the specified output stream index.
        diff --git a/docs/de/d0e/widevine__pssh__generator_8h_source.html b/docs/de/d0e/widevine__pssh__generator_8h_source.html index 1bd35a6c8e..d5b6468f0d 100644 --- a/docs/de/d0e/widevine__pssh__generator_8h_source.html +++ b/docs/de/d0e/widevine__pssh__generator_8h_source.html @@ -73,7 +73,7 @@ $(function() {
        diff --git a/docs/de/d0f/local__file_8h_source.html b/docs/de/d0f/local__file_8h_source.html index e24bd6a5a3..4fffa44528 100644 --- a/docs/de/d0f/local__file_8h_source.html +++ b/docs/de/d0f/local__file_8h_source.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/de/d12/container__names_8h_source.html b/docs/de/d12/container__names_8h_source.html index fc78edc4fb..b3fe603c10 100644 --- a/docs/de/d12/container__names_8h_source.html +++ b/docs/de/d12/container__names_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/de/d13/ts__writer_8cc_source.html b/docs/de/d13/ts__writer_8cc_source.html index 07922ba684..3c7077a6c3 100644 --- a/docs/de/d13/ts__writer_8cc_source.html +++ b/docs/de/d13/ts__writer_8cc_source.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/de/d16/classshaka_1_1media_1_1TextTrackConfig-members.html b/docs/de/d16/classshaka_1_1media_1_1TextTrackConfig-members.html index 02d0b2e0ae..5059ae252f 100644 --- a/docs/de/d16/classshaka_1_1media_1_1TextTrackConfig-members.html +++ b/docs/de/d16/classshaka_1_1media_1_1TextTrackConfig-members.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/de/d17/cluster__builder_8cc_source.html b/docs/de/d17/cluster__builder_8cc_source.html index 4951f228e4..e5932a25af 100644 --- a/docs/de/d17/cluster__builder_8cc_source.html +++ b/docs/de/d17/cluster__builder_8cc_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/de/d1a/classshaka_1_1media_1_1wvm_1_1WvmMediaParser-members.html b/docs/de/d1a/classshaka_1_1media_1_1wvm_1_1WvmMediaParser-members.html index e694fd0cb8..fbffe38a99 100644 --- a/docs/de/d1a/classshaka_1_1media_1_1wvm_1_1WvmMediaParser-members.html +++ b/docs/de/d1a/classshaka_1_1media_1_1wvm_1_1WvmMediaParser-members.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/de/d1a/structshaka_1_1media_1_1mp4_1_1KeyFrameInfo-members.html b/docs/de/d1a/structshaka_1_1media_1_1mp4_1_1KeyFrameInfo-members.html index 8683f291a3..a53d9890a5 100644 --- a/docs/de/d1a/structshaka_1_1media_1_1mp4_1_1KeyFrameInfo-members.html +++ b/docs/de/d1a/structshaka_1_1media_1_1mp4_1_1KeyFrameInfo-members.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/de/d1e/mp4_2single__segment__segmenter_8cc_source.html b/docs/de/d1e/mp4_2single__segment__segmenter_8cc_source.html index d373a92dd9..b2f7cfc42f 100644 --- a/docs/de/d1e/mp4_2single__segment__segmenter_8cc_source.html +++ b/docs/de/d1e/mp4_2single__segment__segmenter_8cc_source.html @@ -69,7 +69,7 @@ $(function() {
        1 // Copyright 2014 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #include "packager/media/formats/mp4/single_segment_segmenter.h"
        8 
        9 #include <algorithm>
        10 
        11 #include "packager/file/file.h"
        12 #include "packager/file/file_util.h"
        13 #include "packager/media/base/buffer_writer.h"
        14 #include "packager/media/base/muxer_options.h"
        15 #include "packager/media/event/progress_listener.h"
        16 #include "packager/media/formats/mp4/box_definitions.h"
        17 #include "packager/media/formats/mp4/key_frame_info.h"
        18 
        19 namespace shaka {
        20 namespace media {
        21 namespace mp4 {
        22 
        23 SingleSegmentSegmenter::SingleSegmentSegmenter(const MuxerOptions& options,
        24  std::unique_ptr<FileType> ftyp,
        25  std::unique_ptr<Movie> moov)
        26  : Segmenter(options, std::move(ftyp), std::move(moov)) {}
        27 
        28 SingleSegmentSegmenter::~SingleSegmentSegmenter() {
        29  if (temp_file_)
        30  temp_file_.release()->Close();
        31  if (!temp_file_name_.empty()) {
        32  if (!File::Delete(temp_file_name_.c_str()))
        33  LOG(ERROR) << "Unable to delete temporary file " << temp_file_name_;
        34  }
        35 }
        36 
        37 bool SingleSegmentSegmenter::GetInitRange(size_t* offset, size_t* size) {
        38  // In Finalize, ftyp and moov gets written first so offset must be 0.
        39  *offset = 0;
        40  *size = ftyp()->ComputeSize() + moov()->ComputeSize();
        41  return true;
        42 }
        43 
        44 bool SingleSegmentSegmenter::GetIndexRange(size_t* offset, size_t* size) {
        45  // Index range is right after init range so the offset must be the size of
        46  // ftyp and moov.
        47  *offset = ftyp()->ComputeSize() + moov()->ComputeSize();
        48  *size = vod_sidx_->ComputeSize();
        49  return true;
        50 }
        51 
        52 std::vector<Range> SingleSegmentSegmenter::GetSegmentRanges() {
        53  std::vector<Range> ranges;
        54  uint64_t next_offset =
        55  ftyp()->ComputeSize() + moov()->ComputeSize() + vod_sidx_->ComputeSize() +
        56  vod_sidx_->first_offset;
        57  for (const SegmentReference& segment_reference : vod_sidx_->references) {
        58  Range r;
        59  r.start = next_offset;
        60  // Ranges are inclusive, so -1 to the size.
        61  r.end = r.start + segment_reference.referenced_size - 1;
        62  next_offset = r.end + 1;
        63  ranges.push_back(r);
        64  }
        65  return ranges;
        66 }
        67 
        68 Status SingleSegmentSegmenter::DoInitialize() {
        69  // Single segment segmentation involves two stages:
        70  // Stage 1: Create media subsegments from media samples
        71  // Stage 2: Update media header (moov) which involves copying of media
        72  // subsegments
        73  // Assumes stage 2 takes similar amount of time as stage 1. The previous
        74  // progress_target was set for stage 1. Times two to account for stage 2.
        75  set_progress_target(progress_target() * 2);
        76 
        77  if (!TempFilePath(options().temp_dir, &temp_file_name_))
        78  return Status(error::FILE_FAILURE, "Unable to create temporary file.");
        79  temp_file_.reset(File::Open(temp_file_name_.c_str(), "w"));
        80  return temp_file_
        81  ? Status::OK
        82  : Status(error::FILE_FAILURE,
        83  "Cannot open file to write " + temp_file_name_);
        84 }
        85 
        86 Status SingleSegmentSegmenter::DoFinalize() {
        87  DCHECK(temp_file_);
        88  DCHECK(ftyp());
        89  DCHECK(moov());
        90  DCHECK(vod_sidx_);
        91 
        92  // Close the temp file to prepare for reading later.
        93  if (!temp_file_.release()->Close()) {
        94  return Status(
        95  error::FILE_FAILURE,
        96  "Cannot close the temp file " + temp_file_name_ +
        97  ", possibly file permission issue or running out of disk space.");
        98  }
        99 
        100  std::unique_ptr<File, FileCloser> file(
        101  File::Open(options().output_file_name.c_str(), "w"));
        102  if (file == NULL) {
        103  return Status(error::FILE_FAILURE,
        104  "Cannot open file to write " + options().output_file_name);
        105  }
        106 
        107  LOG(INFO) << "Update media header (moov) and rewrite the file to '"
        108  << options().output_file_name << "'.";
        109 
        110  // Write ftyp, moov and sidx to output file.
        111  std::unique_ptr<BufferWriter> buffer(new BufferWriter());
        112  ftyp()->Write(buffer.get());
        113  moov()->Write(buffer.get());
        114  vod_sidx_->Write(buffer.get());
        115  Status status = buffer->WriteToFile(file.get());
        116  if (!status.ok())
        117  return status;
        118 
        119  // Load the temp file and write to output file.
        120  std::unique_ptr<File, FileCloser> temp_file(
        121  File::Open(temp_file_name_.c_str(), "r"));
        122  if (temp_file == NULL) {
        123  return Status(error::FILE_FAILURE,
        124  "Cannot open file to read " + temp_file_name_);
        125  }
        126 
        127  // The target of 2nd stage of single segment segmentation.
        128  const uint64_t re_segment_progress_target = progress_target() * 0.5;
        129 
        130  const int kBufSize = 0x200000; // 2MB.
        131  std::unique_ptr<uint8_t[]> buf(new uint8_t[kBufSize]);
        132  while (true) {
        133  int64_t size = temp_file->Read(buf.get(), kBufSize);
        134  if (size == 0) {
        135  break;
        136  } else if (size < 0) {
        137  return Status(error::FILE_FAILURE,
        138  "Failed to read file " + temp_file_name_);
        139  }
        140  int64_t size_written = file->Write(buf.get(), size);
        141  if (size_written != size) {
        142  return Status(error::FILE_FAILURE,
        143  "Failed to write file " + options().output_file_name);
        144  }
        145  UpdateProgress(static_cast<double>(size) / temp_file->Size() *
        146  re_segment_progress_target);
        147  }
        148  if (!temp_file.release()->Close()) {
        149  return Status(error::FILE_FAILURE, "Cannot close the temp file " +
        150  temp_file_name_ + " after reading.");
        151  }
        152  if (!file.release()->Close()) {
        153  return Status(
        154  error::FILE_FAILURE,
        155  "Cannot close file " + options().output_file_name +
        156  ", possibly file permission issue or running out of disk space.");
        157  }
        158  SetComplete();
        159  return Status::OK;
        160 }
        161 
        162 Status SingleSegmentSegmenter::DoFinalizeSegment() {
        163  DCHECK(sidx());
        164  DCHECK(fragment_buffer());
        165  // sidx() contains pre-generated segment references with one reference per
        166  // fragment. In VOD, this segment is converted into a subsegment, i.e. one
        167  // reference, which contains all the fragments in sidx().
        168  std::vector<SegmentReference>& refs = sidx()->references;
        169  SegmentReference& vod_ref = refs[0];
        170  uint64_t first_sap_time =
        171  refs[0].sap_delta_time + refs[0].earliest_presentation_time;
        172  for (uint32_t i = 1; i < refs.size(); ++i) {
        173  vod_ref.referenced_size += refs[i].referenced_size;
        174  // NOTE: We calculate subsegment duration based on the total duration of
        175  // this subsegment instead of subtracting earliest_presentation_time as
        176  // indicated in the spec.
        177  vod_ref.subsegment_duration += refs[i].subsegment_duration;
        178  vod_ref.earliest_presentation_time = std::min(
        179  vod_ref.earliest_presentation_time, refs[i].earliest_presentation_time);
        180 
        181  if (vod_ref.sap_type == SegmentReference::TypeUnknown &&
        182  refs[i].sap_type != SegmentReference::TypeUnknown) {
        183  vod_ref.sap_type = refs[i].sap_type;
        184  first_sap_time =
        185  refs[i].sap_delta_time + refs[i].earliest_presentation_time;
        186  }
        187  }
        188  // Calculate sap delta time w.r.t. earliest_presentation_time.
        189  if (vod_ref.sap_type != SegmentReference::TypeUnknown) {
        190  vod_ref.sap_delta_time =
        191  first_sap_time - vod_ref.earliest_presentation_time;
        192  }
        193 
        194  // Create segment if it does not exist yet.
        195  if (vod_sidx_ == NULL) {
        196  vod_sidx_.reset(new SegmentIndex());
        197  vod_sidx_->reference_id = sidx()->reference_id;
        198  vod_sidx_->timescale = sidx()->timescale;
        199  vod_sidx_->earliest_presentation_time = vod_ref.earliest_presentation_time;
        200  }
        201  vod_sidx_->references.push_back(vod_ref);
        202 
        203  if (muxer_listener()) {
        204  for (const KeyFrameInfo& key_frame_info : key_frame_infos()) {
        205  // Unlike multisegment-segmenter, there is no (sub)segment header (styp,
        206  // sidx), so this is already the offset within the (sub)segment.
        207  muxer_listener()->OnKeyFrame(key_frame_info.timestamp,
        208  key_frame_info.start_byte_offset,
        209  key_frame_info.size);
        210  }
        211  }
        212  // Append fragment buffer to temp file.
        213  size_t segment_size = fragment_buffer()->Size();
        214  Status status = fragment_buffer()->WriteToFile(temp_file_.get());
        215  if (!status.ok()) return status;
        216 
        217  UpdateProgress(vod_ref.subsegment_duration);
        218  if (muxer_listener()) {
        219  muxer_listener()->OnSampleDurationReady(sample_duration());
        220  muxer_listener()->OnNewSegment(options().output_file_name,
        221  vod_ref.earliest_presentation_time,
        222  vod_ref.subsegment_duration, segment_size);
        223  }
        224  return Status::OK;
        225 }
        226 
        227 } // namespace mp4
        228 } // namespace media
        229 } // namespace shaka
        virtual void OnNewSegment(const std::string &segment_name, uint64_t start_time, uint64_t duration, uint64_t segment_file_size)=0
        static bool Delete(const char *file_name)
        Definition: file.cc:198
        virtual void OnSampleDurationReady(uint32_t sample_duration)=0
        - +
        virtual void OnKeyFrame(uint64_t timestamp, uint64_t start_byte_offset, uint64_t size)=0
        STL namespace.
        @@ -78,14 +78,14 @@ $(function() {
        Tracks key frame information.
        - +
        virtual bool Open()=0
        Internal open. Should not be used directly.
        void UpdateProgress(uint64_t progress)
        Update segmentation progress using ProgressListener.
        Definition: segmenter.cc:270
        diff --git a/docs/de/d22/aes__pattern__cryptor_8cc_source.html b/docs/de/d22/aes__pattern__cryptor_8cc_source.html index b9e47580bc..305c91497e 100644 --- a/docs/de/d22/aes__pattern__cryptor_8cc_source.html +++ b/docs/de/d22/aes__pattern__cryptor_8cc_source.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/de/d26/classshaka_1_1media_1_1Id3Tag.html b/docs/de/d26/classshaka_1_1media_1_1Id3Tag.html index d25c3549ff..e4b903f5fe 100644 --- a/docs/de/d26/classshaka_1_1media_1_1Id3Tag.html +++ b/docs/de/d26/classshaka_1_1media_1_1Id3Tag.html @@ -203,7 +203,7 @@ Public Member Functions diff --git a/docs/de/d27/es__parser__audio_8cc_source.html b/docs/de/d27/es__parser__audio_8cc_source.html index 3c46e9e03d..0060e327e0 100644 --- a/docs/de/d27/es__parser__audio_8cc_source.html +++ b/docs/de/d27/es__parser__audio_8cc_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/de/d29/structshaka_1_1media_1_1mp4_1_1TrackExtends.html b/docs/de/d29/structshaka_1_1media_1_1mp4_1_1TrackExtends.html index c715513f28..59dd8a046d 100644 --- a/docs/de/d29/structshaka_1_1media_1_1mp4_1_1TrackExtends.html +++ b/docs/de/d29/structshaka_1_1media_1_1mp4_1_1TrackExtends.html @@ -103,26 +103,26 @@ Public Member Functions

        Public Attributes

        -uint32_t track_id +uint32_t track_id = 0u   -uint32_t default_sample_description_index +uint32_t default_sample_description_index = 0u   -uint32_t default_sample_duration +uint32_t default_sample_duration = 0u   -uint32_t default_sample_size +uint32_t default_sample_size = 0u   -uint32_t default_sample_flags +uint32_t default_sample_flags = 0u   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

        @@ -133,7 +133,7 @@ Additional Inherited Members

        Detailed Description

        -

        Definition at line 637 of file box_definitions.h.

        +

        Definition at line 642 of file box_definitions.h.

        Member Function Documentation

        ◆ BoxType()

        @@ -161,7 +161,7 @@ Additional Inherited Members

        Implements shaka::media::mp4::Box.

        -

        Definition at line 2139 of file box_definitions.cc.

        +

        Definition at line 2192 of file box_definitions.cc.

        @@ -172,7 +172,7 @@ Additional Inherited Members diff --git a/docs/de/d33/classshaka_1_1media_1_1WebMTracksParser-members.html b/docs/de/d33/classshaka_1_1media_1_1WebMTracksParser-members.html index 7b7d10a356..cb809d9c9e 100644 --- a/docs/de/d33/classshaka_1_1media_1_1WebMTracksParser-members.html +++ b/docs/de/d33/classshaka_1_1media_1_1WebMTracksParser-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/docs/de/d33/structshaka_1_1media_1_1H265Pps.html b/docs/de/d33/structshaka_1_1media_1_1H265Pps.html index e627bba748..d62a41916a 100644 --- a/docs/de/d33/structshaka_1_1media_1_1H265Pps.html +++ b/docs/de/d33/structshaka_1_1media_1_1H265Pps.html @@ -200,7 +200,7 @@ bool chroma_qp_offset_list diff --git a/docs/de/d34/offset__byte__queue_8h_source.html b/docs/de/d34/offset__byte__queue_8h_source.html index 4b7d5c1967..29bebebdfa 100644 --- a/docs/de/d34/offset__byte__queue_8h_source.html +++ b/docs/de/d34/offset__byte__queue_8h_source.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/de/d39/id3__tag_8cc_source.html b/docs/de/d39/id3__tag_8cc_source.html index d7a8ae9f33..40e8b30b71 100644 --- a/docs/de/d39/id3__tag_8cc_source.html +++ b/docs/de/d39/id3__tag_8cc_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/de/d3c/h26x__byte__to__unit__stream__converter_8cc_source.html b/docs/de/d3c/h26x__byte__to__unit__stream__converter_8cc_source.html index 54ca081d6e..640c272fc8 100644 --- a/docs/de/d3c/h26x__byte__to__unit__stream__converter_8cc_source.html +++ b/docs/de/d3c/h26x__byte__to__unit__stream__converter_8cc_source.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/de/d3c/macros_8h_source.html b/docs/de/d3c/macros_8h_source.html index df0f7cc088..6d2f1962e0 100644 --- a/docs/de/d3c/macros_8h_source.html +++ b/docs/de/d3c/macros_8h_source.html @@ -69,7 +69,7 @@ $(function() {
        1 // Copyright 2016 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_BASE_MACROS_H_
        8 #define PACKAGER_MEDIA_BASE_MACROS_H_
        9 
        10 // The FALLTHROUGH_INTENDED macro can be used to annotate implicit fall-through
        11 // between switch labels:
        12 // switch (x) {
        13 // case 40:
        14 // case 41:
        15 // if (truth_is_out_there) {
        16 // ++x;
        17 // FALLTHROUGH_INTENDED; // Use instead of/along with annotations in
        18 // // comments.
        19 // } else {
        20 // return x;
        21 // }
        22 // case 42:
        23 // ...
        24 //
        25 // As shown in the example above, the FALLTHROUGH_INTENDED macro should be
        26 // followed by a semicolon. It is designed to mimic control-flow statements
        27 // like 'break;', so it can be placed in most places where 'break;' can, but
        28 // only if there are no statements on the execution path between it and the
        29 // next switch label.
        30 //
        31 // When compiled with clang in C++11 mode, the FALLTHROUGH_INTENDED macro is
        32 // expanded to [[clang::fallthrough]] attribute, which is analysed when
        33 // performing switch labels fall-through diagnostic ('-Wimplicit-fallthrough').
        34 // See clang documentation on language extensions for details:
        35 // http://clang.llvm.org/docs/AttributeReference.html#fallthrough-clang-fallthrough
        36 //
        37 // When used with unsupported compilers, the FALLTHROUGH_INTENDED macro has no
        38 // effect on diagnostics.
        39 //
        40 // In either case this macro has no effect on runtime behavior and performance
        41 // of code.
        42 #if defined(__clang__) && __cplusplus >= 201103L && defined(__has_warning)
        43 #if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
        44 #define FALLTHROUGH_INTENDED [[clang::fallthrough]] // NOLINT
        45 #endif
        46 #endif
        47 
        48 #ifndef FALLTHROUGH_INTENDED
        49 #define FALLTHROUGH_INTENDED \
        50  do { \
        51  } while (0)
        52 #endif
        53 
        54 #endif // PACKAGER_MEDIA_BASE_MACROS_H_
        diff --git a/docs/de/d3e/buffer__reader_8h_source.html b/docs/de/d3e/buffer__reader_8h_source.html index 3f17741e92..80eaa5c263 100644 --- a/docs/de/d3e/buffer__reader_8h_source.html +++ b/docs/de/d3e/buffer__reader_8h_source.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/de/d3e/classshaka_1_1media_1_1H264Parser-members.html b/docs/de/d3e/classshaka_1_1media_1_1H264Parser-members.html index a03ffa6517..a17013ef1b 100644 --- a/docs/de/d3e/classshaka_1_1media_1_1H264Parser-members.html +++ b/docs/de/d3e/classshaka_1_1media_1_1H264Parser-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/de/d43/classshaka_1_1media_1_1mp2t_1_1PesPacket-members.html b/docs/de/d43/classshaka_1_1media_1_1mp2t_1_1PesPacket-members.html index f30fec976c..1de7d9b6cf 100644 --- a/docs/de/d43/classshaka_1_1media_1_1mp2t_1_1PesPacket-members.html +++ b/docs/de/d43/classshaka_1_1media_1_1mp2t_1_1PesPacket-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/docs/de/d49/classshaka_1_1media_1_1DecryptConfig.html b/docs/de/d49/classshaka_1_1media_1_1DecryptConfig.html index 2927aa7dfa..93377bec4e 100644 --- a/docs/de/d49/classshaka_1_1media_1_1DecryptConfig.html +++ b/docs/de/d49/classshaka_1_1media_1_1DecryptConfig.html @@ -296,7 +296,7 @@ static const size_t  diff --git a/docs/de/d4a/muxer__listener__internal_8h_source.html b/docs/de/d4a/muxer__listener__internal_8h_source.html index 01752c08a3..593b8d1b3a 100644 --- a/docs/de/d4a/muxer__listener__internal_8h_source.html +++ b/docs/de/d4a/muxer__listener__internal_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/de/d52/classshaka_1_1Representation.html b/docs/de/d52/classshaka_1_1Representation.html index 1b4d7939d7..bc0c0e9b87 100644 --- a/docs/de/d52/classshaka_1_1Representation.html +++ b/docs/de/d52/classshaka_1_1Representation.html @@ -568,7 +568,7 @@ void set_media_info (c diff --git a/docs/de/d52/webvtt__output__handler_8cc_source.html b/docs/de/d52/webvtt__output__handler_8cc_source.html deleted file mode 100644 index 38f3d8ec63..0000000000 --- a/docs/de/d52/webvtt__output__handler_8cc_source.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - -Shaka Packager SDK: packager/media/formats/webvtt/webvtt_output_handler.cc Source File - - - - - - - - - -
        -
        - - - - - - -
        -
        Shaka Packager SDK -
        -
        -
        - - - - - - - - -
        -
        - - -
        - -
        - - -
        -
        -
        -
        webvtt_output_handler.cc
        -
        -
        -
        1 // Copyright 2017 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #include "packager/media/formats/webvtt/webvtt_output_handler.h"
        8 
        9 #include "packager/base/logging.h"
        10 #include "packager/file/file.h"
        11 #include "packager/media/base/muxer_util.h"
        12 #include "packager/media/formats/webvtt/webvtt_timestamp.h"
        13 
        14 namespace shaka {
        15 namespace media {
        16 namespace {
        17 double kMillisecondsToSeconds = 1000.0;
        18 } // namespace
        19 
        20 void WebVttOutputHandler::WriteCue(const std::string& id,
        21  uint64_t start_ms,
        22  uint64_t end_ms,
        23  const std::string& settings,
        24  const std::string& payload) {
        25  DCHECK_GT(payload.size(), 0u);
        26 
        27  // Build a block of text that makes up the cue so that we can use a loop to
        28  // write all the lines.
        29  const std::string start = MsToWebVttTimestamp(start_ms);
        30  const std::string end = MsToWebVttTimestamp(end_ms);
        31 
        32  // Ids are optional
        33  if (id.length()) {
        34  buffer_.append(id);
        35  buffer_.append("\n"); // end of id
        36  }
        37 
        38  buffer_.append(start);
        39  buffer_.append(" --> ");
        40  buffer_.append(end);
        41 
        42  // Settings are optional
        43  if (settings.length()) {
        44  buffer_.append(" ");
        45  buffer_.append(settings);
        46  }
        47  buffer_.append("\n"); // end of time & settings
        48 
        49  buffer_.append(payload);
        50  buffer_.append("\n"); // end of payload
        51  buffer_.append("\n"); // end of cue
        52 }
        53 
        54 Status WebVttOutputHandler::WriteSegmentToFile(const std::string& filename) {
        55  // Need blank line between "WEBVTT" and the first cue
        56  const std::string WEBVTT_HEADER = "WEBVTT\n\n";
        57 
        58  File* file = File::Open(filename.c_str(), "w");
        59 
        60  if (file == nullptr) {
        61  return Status(error::FILE_FAILURE, "Failed to open " + filename);
        62  }
        63 
        64  size_t written;
        65  written = file->Write(WEBVTT_HEADER.c_str(), WEBVTT_HEADER.size());
        66  if (written != WEBVTT_HEADER.size()) {
        67  return Status(error::FILE_FAILURE, "Failed to write webvtt header to file");
        68  }
        69 
        70  written = file->Write(buffer_.c_str(), buffer_.size());
        71  if (written != buffer_.size()) {
        72  return Status(error::FILE_FAILURE,
        73  "Failed to write webvtt cotnent to file");
        74  }
        75 
        76  // Since all the cues have been written to disk, there is no reason to hold
        77  // onto that information anymore.
        78  buffer_.clear();
        79 
        80  bool closed = file->Close();
        81  if (!closed) {
        82  return Status(error::FILE_FAILURE, "Failed to close " + filename);
        83  }
        84 
        85  return Status::OK;
        86 }
        87 
        88 Status WebVttOutputHandler::InitializeInternal() {
        89  return Status::OK;
        90 }
        91 
        92 Status WebVttOutputHandler::Process(std::unique_ptr<StreamData> stream_data) {
        93  switch (stream_data->stream_data_type) {
        94  case StreamDataType::kStreamInfo:
        95  return OnStreamInfo(*stream_data->stream_info);
        96  case StreamDataType::kSegmentInfo:
        97  return OnSegmentInfo(*stream_data->segment_info);
        98  case StreamDataType::kCueEvent:
        99  return OnCueEvent(*stream_data->cue_event);
        100  case StreamDataType::kTextSample:
        101  return OnTextSample(*stream_data->text_sample);
        102  default:
        103  return Status(error::INTERNAL_ERROR,
        104  "Invalid stream data type for this handler");
        105  }
        106 }
        107 
        108 Status WebVttOutputHandler::OnFlushRequest(size_t input_stream_index) {
        109  OnStreamEnd();
        110  return Status::OK;
        111 }
        112 
        113 WebVttSegmentedOutputHandler::WebVttSegmentedOutputHandler(
        114  const MuxerOptions& muxer_options,
        115  std::unique_ptr<MuxerListener> muxer_listener)
        116  : muxer_options_(muxer_options),
        117  muxer_listener_(std::move(muxer_listener)) {}
        118 
        119 Status WebVttSegmentedOutputHandler::OnStreamInfo(const StreamInfo& info) {
        120  muxer_listener_->OnMediaStart(muxer_options_, info, info.time_scale(),
        121  MuxerListener::kContainerText);
        122  return Status::OK;
        123 }
        124 
        125 Status WebVttSegmentedOutputHandler::OnSegmentInfo(const SegmentInfo& info) {
        126  total_duration_ms_ += info.duration;
        127 
        128  const std::string& segment_template = muxer_options_.segment_template;
        129  const uint32_t index = segment_index_++;
        130  const uint64_t start = info.start_timestamp;
        131  const uint64_t duration = info.duration;
        132  const uint32_t bandwidth = 0;
        133 
        134  // Write all the samples to the file.
        135  const std::string filename =
        136  GetSegmentName(segment_template, start, index, bandwidth);
        137 
        138  // Write everything to the file before telling the manifest so that the
        139  // file will exist on disk.
        140  Status write_status = WriteSegmentToFile(filename);
        141  if (!write_status.ok()) {
        142  return write_status;
        143  }
        144 
        145  // Update the manifest with our new file.
        146  const uint64_t size = File::GetFileSize(filename.c_str());
        147  muxer_listener_->OnNewSegment(filename, start, duration, size);
        148 
        149  return Status::OK;
        150 }
        151 
        152 Status WebVttSegmentedOutputHandler::OnCueEvent(const CueEvent& event) {
        153  double timestamp_seconds = event.time_in_seconds;
        154  double timestamp_ms = timestamp_seconds * kMillisecondsToSeconds;
        155  uint64_t timestamp = static_cast<uint64_t>(timestamp_ms);
        156  muxer_listener_->OnCueEvent(timestamp, event.cue_data);
        157  return Status::OK;
        158 }
        159 
        160 Status WebVttSegmentedOutputHandler::OnTextSample(const TextSample& sample) {
        161  const std::string& id = sample.id();
        162  const uint64_t start_ms = sample.start_time();
        163  const uint64_t end_ms = sample.EndTime();
        164  const std::string& settings = sample.settings();
        165  const std::string& payload = sample.payload();
        166 
        167  // Only write cues that have payloads. Cue without payloads won't present
        168  // any information to the user.
        169  if (payload.size()) {
        170  WriteCue(id, start_ms, end_ms, settings, payload);
        171  }
        172  return Status::OK;
        173 }
        174 
        175 Status WebVttSegmentedOutputHandler::OnStreamEnd() {
        176  const float duration_ms = static_cast<float>(total_duration_ms_);
        177  const float duration_seconds = duration_ms / 1000.0f;
        178 
        179  MuxerListener::MediaRanges empty_ranges;
        180  muxer_listener_->OnMediaEnd(empty_ranges, duration_seconds);
        181 
        182  return Status::OK;
        183 }
        184 
        185 } // namespace media
        186 } // namespace shaka
        STL namespace.
        -
        All the methods that are virtual are virtual for mocking.
        -
        static int64_t GetFileSize(const char *file_name)
        Definition: file.cc:207
        -
        virtual bool Open()=0
        Internal open. Should not be used directly.
        -
        - - - - diff --git a/docs/de/d53/classshaka_1_1media_1_1FakeInputMediaHandler-members.html b/docs/de/d53/classshaka_1_1media_1_1FakeInputMediaHandler-members.html index 971c7d5e67..6859d1ab86 100644 --- a/docs/de/d53/classshaka_1_1media_1_1FakeInputMediaHandler-members.html +++ b/docs/de/d53/classshaka_1_1media_1_1FakeInputMediaHandler-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/docs/de/d54/structshaka_1_1media_1_1mp4_1_1FlacSpecific.html b/docs/de/d54/structshaka_1_1media_1_1mp4_1_1FlacSpecific.html index 6e58871c82..f78f96c07e 100644 --- a/docs/de/d54/structshaka_1_1media_1_1mp4_1_1FlacSpecific.html +++ b/docs/de/d54/structshaka_1_1media_1_1mp4_1_1FlacSpecific.html @@ -107,10 +107,10 @@ std::vector< uint8_t >    - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

        @@ -121,7 +121,7 @@ Additional Inherited Members

        Detailed Description

        -

        Definition at line 336 of file box_definitions.h.

        +

        Definition at line 339 of file box_definitions.h.

        Member Function Documentation

        ◆ BoxType()

        @@ -149,7 +149,7 @@ Additional Inherited Members

        Implements shaka::media::mp4::Box.

        -

        Definition at line 1715 of file box_definitions.cc.

        +

        Definition at line 1755 of file box_definitions.cc.

        @@ -160,7 +160,7 @@ Additional Inherited Members diff --git a/docs/de/d55/structshaka_1_1media_1_1mp4_1_1Language-members.html b/docs/de/d55/structshaka_1_1media_1_1mp4_1_1Language-members.html index 9a1ba5cb09..7b95b4e323 100644 --- a/docs/de/d55/structshaka_1_1media_1_1mp4_1_1Language-members.html +++ b/docs/de/d55/structshaka_1_1media_1_1mp4_1_1Language-members.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/de/d5b/adts__header_8cc_source.html b/docs/de/d5b/adts__header_8cc_source.html index 08a23362ed..e7da11bd6e 100644 --- a/docs/de/d5b/adts__header_8cc_source.html +++ b/docs/de/d5b/adts__header_8cc_source.html @@ -86,7 +86,7 @@ $(function() { diff --git a/docs/de/d5c/mpd__flags_8h_source.html b/docs/de/d5c/mpd__flags_8h_source.html index 29051cf713..4d22a8a978 100644 --- a/docs/de/d5c/mpd__flags_8h_source.html +++ b/docs/de/d5c/mpd__flags_8h_source.html @@ -69,7 +69,7 @@ $(function() {
        1 // Copyright 2014 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 //
        7 // Defines Mpd flags.
        8 
        9 #ifndef APP_MPD_FLAGS_H_
        10 #define APP_MPD_FLAGS_H_
        11 
        12 #include <gflags/gflags.h>
        13 
        14 DECLARE_bool(generate_static_mpd);
        15 DECLARE_bool(output_media_info);
        16 DECLARE_string(mpd_output);
        17 DECLARE_string(base_urls);
        18 DECLARE_double(minimum_update_period);
        19 DECLARE_double(min_buffer_time);
        20 DECLARE_double(suggested_presentation_delay);
        21 DECLARE_string(utc_timings);
        22 DECLARE_bool(generate_dash_if_iop_compliant_mpd);
        23 DECLARE_bool(allow_approximate_segment_timeline);
        24 
        25 #endif // APP_MPD_FLAGS_H_
        diff --git a/docs/de/d60/classshaka_1_1media_1_1mp2t_1_1ProgramMapTableWriter-members.html b/docs/de/d60/classshaka_1_1media_1_1mp2t_1_1ProgramMapTableWriter-members.html index 68e31e344d..db60db42f0 100644 --- a/docs/de/d60/classshaka_1_1media_1_1mp2t_1_1ProgramMapTableWriter-members.html +++ b/docs/de/d60/classshaka_1_1media_1_1mp2t_1_1ProgramMapTableWriter-members.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/de/d64/classshaka_1_1media_1_1mp2t_1_1TsWriter.html b/docs/de/d64/classshaka_1_1media_1_1mp2t_1_1TsWriter.html index 3d9a393a58..dd965c5375 100644 --- a/docs/de/d64/classshaka_1_1media_1_1mp2t_1_1TsWriter.html +++ b/docs/de/d64/classshaka_1_1media_1_1mp2t_1_1TsWriter.html @@ -221,7 +221,7 @@ virtual void  diff --git a/docs/de/d6c/mock__media__playlist_8h_source.html b/docs/de/d6c/mock__media__playlist_8h_source.html index be951d9713..18560fc0f5 100644 --- a/docs/de/d6c/mock__media__playlist_8h_source.html +++ b/docs/de/d6c/mock__media__playlist_8h_source.html @@ -66,24 +66,24 @@ $(function() {
        mock_media_playlist.h
        -
        1 // Copyright 2016 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_HLS_BASE_MOCK_MEDIA_PLAYLIST_H_
        8 #define PACKAGER_HLS_BASE_MOCK_MEDIA_PLAYLIST_H_
        9 
        10 #include <gmock/gmock.h>
        11 
        12 #include "packager/hls/base/media_playlist.h"
        13 
        14 namespace shaka {
        15 namespace hls {
        16 
        18  public:
        19  // The actual parameters to MediaPlaylist() (parent) constructor doesn't
        20  // matter because the return value can be mocked.
        21  MockMediaPlaylist(const std::string& file_name,
        22  const std::string& name,
        23  const std::string& group_id);
        24  ~MockMediaPlaylist() override;
        25 
        26  MOCK_METHOD1(SetMediaInfo, bool(const MediaInfo& media_info));
        27  MOCK_METHOD5(AddSegment,
        28  void(const std::string& file_name,
        29  uint64_t start_time,
        30  uint64_t duration,
        31  uint64_t start_byte_offset,
        32  uint64_t size));
        33  MOCK_METHOD3(AddKeyFrame,
        34  void(uint64_t timestamp,
        35  uint64_t start_byte_offset,
        36  uint64_t size));
        37  MOCK_METHOD6(AddEncryptionInfo,
        38  void(EncryptionMethod method,
        39  const std::string& url,
        40  const std::string& key_id,
        41  const std::string& iv,
        42  const std::string& key_format,
        43  const std::string& key_format_versions));
        44  MOCK_METHOD0(AddPlacementOpportunity, void());
        45  MOCK_METHOD1(WriteToFile, bool(const std::string& file_path));
        46  MOCK_CONST_METHOD0(Bitrate, uint64_t());
        47  MOCK_CONST_METHOD0(GetLongestSegmentDuration, double());
        48  MOCK_METHOD1(SetTargetDuration, void(uint32_t target_duration));
        49  MOCK_CONST_METHOD0(GetNumChannels, int());
        50  MOCK_CONST_METHOD2(GetDisplayResolution,
        51  bool(uint32_t* width, uint32_t* height));
        52 };
        53 
        54 } // namespace hls
        55 } // namespace shaka
        56 
        57 #endif // PACKAGER_HLS_BASE_MOCK_MEDIA_PLAYLIST_H_
        virtual uint64_t Bitrate() const
        +
        1 // Copyright 2016 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_HLS_BASE_MOCK_MEDIA_PLAYLIST_H_
        8 #define PACKAGER_HLS_BASE_MOCK_MEDIA_PLAYLIST_H_
        9 
        10 #include <gmock/gmock.h>
        11 
        12 #include "packager/hls/base/media_playlist.h"
        13 
        14 namespace shaka {
        15 namespace hls {
        16 
        18  public:
        19  // The actual parameters to MediaPlaylist() (parent) constructor doesn't
        20  // matter because the return value can be mocked.
        21  MockMediaPlaylist(const std::string& file_name,
        22  const std::string& name,
        23  const std::string& group_id);
        24  ~MockMediaPlaylist() override;
        25 
        26  MOCK_METHOD1(SetMediaInfo, bool(const MediaInfo& media_info));
        27  MOCK_METHOD5(AddSegment,
        28  void(const std::string& file_name,
        29  uint64_t start_time,
        30  uint64_t duration,
        31  uint64_t start_byte_offset,
        32  uint64_t size));
        33  MOCK_METHOD3(AddKeyFrame,
        34  void(uint64_t timestamp,
        35  uint64_t start_byte_offset,
        36  uint64_t size));
        37  MOCK_METHOD6(AddEncryptionInfo,
        38  void(EncryptionMethod method,
        39  const std::string& url,
        40  const std::string& key_id,
        41  const std::string& iv,
        42  const std::string& key_format,
        43  const std::string& key_format_versions));
        44  MOCK_METHOD0(AddPlacementOpportunity, void());
        45  MOCK_METHOD1(WriteToFile, bool(const std::string& file_path));
        46  MOCK_CONST_METHOD0(Bitrate, uint64_t());
        47  MOCK_CONST_METHOD0(GetLongestSegmentDuration, double());
        48  MOCK_METHOD1(SetTargetDuration, void(uint32_t target_duration));
        49  MOCK_CONST_METHOD0(GetNumChannels, int());
        50  MOCK_CONST_METHOD2(GetDisplayResolution,
        51  bool(uint32_t* width, uint32_t* height));
        52 };
        53 
        54 } // namespace hls
        55 } // namespace shaka
        56 
        57 #endif // PACKAGER_HLS_BASE_MOCK_MEDIA_PLAYLIST_H_
        virtual uint64_t Bitrate() const
        -
        virtual void SetTargetDuration(uint32_t target_duration)
        +
        virtual void SetTargetDuration(uint32_t target_duration)
        All the methods that are virtual are virtual for mocking.
        -
        virtual bool SetMediaInfo(const MediaInfo &media_info)
        -
        virtual void AddKeyFrame(uint64_t timestamp, uint64_t start_byte_offset, uint64_t size)
        +
        virtual bool SetMediaInfo(const MediaInfo &media_info)
        +
        virtual void AddKeyFrame(uint64_t timestamp, uint64_t start_byte_offset, uint64_t size)
        Methods are virtual for mocking.
        -
        virtual void AddSegment(const std::string &file_name, uint64_t start_time, uint64_t duration, uint64_t start_byte_offset, uint64_t size)
        -
        virtual double GetLongestSegmentDuration() const
        -
        virtual void AddPlacementOpportunity()
        -
        virtual void AddEncryptionInfo(EncryptionMethod method, const std::string &url, const std::string &key_id, const std::string &iv, const std::string &key_format, const std::string &key_format_versions)
        -
        virtual bool GetDisplayResolution(uint32_t *width, uint32_t *height) const
        -
        virtual bool WriteToFile(const std::string &file_path)
        -
        virtual int GetNumChannels() const
        +
        virtual void AddSegment(const std::string &file_name, uint64_t start_time, uint64_t duration, uint64_t start_byte_offset, uint64_t size)
        +
        virtual double GetLongestSegmentDuration() const
        +
        virtual void AddPlacementOpportunity()
        +
        virtual void AddEncryptionInfo(EncryptionMethod method, const std::string &url, const std::string &key_id, const std::string &iv, const std::string &key_format, const std::string &key_format_versions)
        +
        virtual bool GetDisplayResolution(uint32_t *width, uint32_t *height) const
        +
        virtual bool WriteToFile(const std::string &file_path)
        +
        virtual int GetNumChannels() const
        diff --git a/docs/de/d6c/structshaka_1_1media_1_1mp4_1_1SampleToGroupEntry-members.html b/docs/de/d6c/structshaka_1_1media_1_1mp4_1_1SampleToGroupEntry-members.html index a676fdd9b1..0671593da2 100644 --- a/docs/de/d6c/structshaka_1_1media_1_1mp4_1_1SampleToGroupEntry-members.html +++ b/docs/de/d6c/structshaka_1_1media_1_1mp4_1_1SampleToGroupEntry-members.html @@ -77,7 +77,7 @@ $(function() {
        diff --git a/docs/de/d6e/classshaka_1_1media_1_1MockOutputMediaHandler-members.html b/docs/de/d6e/classshaka_1_1media_1_1MockOutputMediaHandler-members.html index 5215f290bf..5b20e83e9b 100644 --- a/docs/de/d6e/classshaka_1_1media_1_1MockOutputMediaHandler-members.html +++ b/docs/de/d6e/classshaka_1_1media_1_1MockOutputMediaHandler-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/docs/de/d6e/language__utils_8h_source.html b/docs/de/d6e/language__utils_8h_source.html index e5af3619cf..0b0a088871 100644 --- a/docs/de/d6e/language__utils_8h_source.html +++ b/docs/de/d6e/language__utils_8h_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/de/d70/http__key__fetcher_8cc_source.html b/docs/de/d70/http__key__fetcher_8cc_source.html index b1deebf9cf..2e1bf5e33d 100644 --- a/docs/de/d70/http__key__fetcher_8cc_source.html +++ b/docs/de/d70/http__key__fetcher_8cc_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/de/d76/proto__json__util_8h_source.html b/docs/de/d76/proto__json__util_8h_source.html index dfb1333620..5379b53241 100644 --- a/docs/de/d76/proto__json__util_8h_source.html +++ b/docs/de/d76/proto__json__util_8h_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/de/d77/webm__content__encodings__client_8cc_source.html b/docs/de/d77/webm__content__encodings__client_8cc_source.html index 300091a32a..7576141063 100644 --- a/docs/de/d77/webm__content__encodings__client_8cc_source.html +++ b/docs/de/d77/webm__content__encodings__client_8cc_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/de/d7b/mp4__media__parser_8h_source.html b/docs/de/d7b/mp4__media__parser_8h_source.html index 2c486b0041..7cda2fb74e 100644 --- a/docs/de/d7b/mp4__media__parser_8h_source.html +++ b/docs/de/d7b/mp4__media__parser_8h_source.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/de/d7e/classshaka_1_1media_1_1mp2t_1_1TsSectionPsi.html b/docs/de/d7e/classshaka_1_1media_1_1mp2t_1_1TsSectionPsi.html index 8d3ba99e7f..045bc0c434 100644 --- a/docs/de/d7e/classshaka_1_1media_1_1mp2t_1_1TsSectionPsi.html +++ b/docs/de/d7e/classshaka_1_1media_1_1mp2t_1_1TsSectionPsi.html @@ -123,7 +123,7 @@ Additional Inherited Members diff --git a/docs/de/d7f/unionshaka_1_1EncryptionParams_1_1EncryptedStreamAttributes_1_1OneOf-members.html b/docs/de/d7f/unionshaka_1_1EncryptionParams_1_1EncryptedStreamAttributes_1_1OneOf-members.html index 199a334aff..f779b1706b 100644 --- a/docs/de/d7f/unionshaka_1_1EncryptionParams_1_1EncryptedStreamAttributes_1_1OneOf-members.html +++ b/docs/de/d7f/unionshaka_1_1EncryptionParams_1_1EncryptedStreamAttributes_1_1OneOf-members.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/de/d83/box__definitions__comparison_8h_source.html b/docs/de/d83/box__definitions__comparison_8h_source.html index 1a72fef104..f2702b2003 100644 --- a/docs/de/d83/box__definitions__comparison_8h_source.html +++ b/docs/de/d83/box__definitions__comparison_8h_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/de/d85/classshaka_1_1media_1_1OriginHandler.html b/docs/de/d85/classshaka_1_1media_1_1OriginHandler.html index 5ab4f6389c..17aae4fc1f 100644 --- a/docs/de/d85/classshaka_1_1media_1_1OriginHandler.html +++ b/docs/de/d85/classshaka_1_1media_1_1OriginHandler.html @@ -175,7 +175,7 @@ const std::map< size_t, std::pair< std::shared_ptr< diff --git a/docs/de/d87/structshaka_1_1media_1_1wvm_1_1PrevSampleData-members.html b/docs/de/d87/structshaka_1_1media_1_1wvm_1_1PrevSampleData-members.html index c2711e119f..6904bf81fd 100644 --- a/docs/de/d87/structshaka_1_1media_1_1wvm_1_1PrevSampleData-members.html +++ b/docs/de/d87/structshaka_1_1media_1_1wvm_1_1PrevSampleData-members.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/de/d88/tag_8cc_source.html b/docs/de/d88/tag_8cc_source.html index 701cd65f8a..651bf20c7b 100644 --- a/docs/de/d88/tag_8cc_source.html +++ b/docs/de/d88/tag_8cc_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/de/d8d/structshaka_1_1media_1_1mp4_1_1MovieFragmentHeader-members.html b/docs/de/d8d/structshaka_1_1media_1_1mp4_1_1MovieFragmentHeader-members.html index cd0ca08c43..92cb6c0485 100644 --- a/docs/de/d8d/structshaka_1_1media_1_1mp4_1_1MovieFragmentHeader-members.html +++ b/docs/de/d8d/structshaka_1_1media_1_1mp4_1_1MovieFragmentHeader-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/de/d93/classshaka_1_1media_1_1VP8Parser-members.html b/docs/de/d93/classshaka_1_1media_1_1VP8Parser-members.html index f50b7d51be..d6c40ed855 100644 --- a/docs/de/d93/classshaka_1_1media_1_1VP8Parser-members.html +++ b/docs/de/d93/classshaka_1_1media_1_1VP8Parser-members.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/d4/dde/classshaka_1_1media_1_1WebVttSegmentedOutputHandler-members.html b/docs/de/da9/classshaka_1_1media_1_1WebVttTextOutputHandler-members.html similarity index 76% rename from docs/d4/dde/classshaka_1_1media_1_1WebVttSegmentedOutputHandler-members.html rename to docs/de/da9/classshaka_1_1media_1_1WebVttTextOutputHandler-members.html index 7b25be6026..6bb5090cd5 100644 --- a/docs/d4/dde/classshaka_1_1media_1_1WebVttSegmentedOutputHandler-members.html +++ b/docs/de/da9/classshaka_1_1media_1_1WebVttTextOutputHandler-members.html @@ -58,16 +58,16 @@ $(function() {
      -
      shaka::media::WebVttSegmentedOutputHandler Member List
      +
      shaka::media::WebVttTextOutputHandler Member List
      -

      This is the complete list of members for shaka::media::WebVttSegmentedOutputHandler, including all inherited members.

      +

      This is the complete list of members for shaka::media::WebVttTextOutputHandler, including all inherited members.

      @@ -88,16 +88,13 @@ $(function() { - - - - - - + + +
      AddHandler(std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandlerinline
      Dispatch(std::unique_ptr< StreamData > stream_data) constshaka::media::MediaHandlerprotected
      output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
      SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
      ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
      WebVttOutputHandler()=default (defined in shaka::media::WebVttOutputHandler)shaka::media::WebVttOutputHandler
      WebVttSegmentedOutputHandler(const MuxerOptions &muxer_options, std::unique_ptr< MuxerListener > muxer_listener) (defined in shaka::media::WebVttSegmentedOutputHandler)shaka::media::WebVttSegmentedOutputHandler
      WriteCue(const std::string &id, uint64_t start, uint64_t end, const std::string &settings, const std::string &payload) (defined in shaka::media::WebVttOutputHandler)shaka::media::WebVttOutputHandlerprotected
      WriteSegmentToFile(const std::string &filename) (defined in shaka::media::WebVttOutputHandler)shaka::media::WebVttOutputHandlerprotected
      ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
      ~WebVttOutputHandler()=default (defined in shaka::media::WebVttOutputHandler)shaka::media::WebVttOutputHandlervirtual
      WebVttTextOutputHandler(const MuxerOptions &muxer_options, std::unique_ptr< MuxerListener > muxer_listener) (defined in shaka::media::WebVttTextOutputHandler)shaka::media::WebVttTextOutputHandler
      ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
      ~WebVttTextOutputHandler()=default (defined in shaka::media::WebVttTextOutputHandler)shaka::media::WebVttTextOutputHandlervirtual
      diff --git a/docs/de/da9/structshaka_1_1Element.html b/docs/de/da9/structshaka_1_1Element.html index 18c72688e8..cb4c0161ea 100644 --- a/docs/de/da9/structshaka_1_1Element.html +++ b/docs/de/da9/structshaka_1_1Element.html @@ -95,7 +95,7 @@ std::vector< El diff --git a/docs/de/dab/es__parser__h26x_8cc_source.html b/docs/de/dab/es__parser__h26x_8cc_source.html index 1be2680ad2..baeb35621b 100644 --- a/docs/de/dab/es__parser__h26x_8cc_source.html +++ b/docs/de/dab/es__parser__h26x_8cc_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/de/dad/classshaka_1_1MemoryFile.html b/docs/de/dad/classshaka_1_1MemoryFile.html index 3ce1dc7445..84e8f6482b 100644 --- a/docs/de/dad/classshaka_1_1MemoryFile.html +++ b/docs/de/dad/classshaka_1_1MemoryFile.html @@ -481,7 +481,7 @@ bool  diff --git a/docs/de/dad/validate__flag_8cc_source.html b/docs/de/dad/validate__flag_8cc_source.html index e5037a9dc5..b8278abf26 100644 --- a/docs/de/dad/validate__flag_8cc_source.html +++ b/docs/de/dad/validate__flag_8cc_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/de/db2/classshaka_1_1media_1_1MockOutputMediaHandler.html b/docs/de/db2/classshaka_1_1media_1_1MockOutputMediaHandler.html index ac83532da7..aa90626ee6 100644 --- a/docs/de/db2/classshaka_1_1media_1_1MockOutputMediaHandler.html +++ b/docs/de/db2/classshaka_1_1media_1_1MockOutputMediaHandler.html @@ -159,7 +159,7 @@ const std::map< size_t, std::pair< std::shared_ptr<

      Detailed Description

      -

      Definition at line 166 of file media_handler_test_base.h.

      +

      Definition at line 165 of file media_handler_test_base.h.


      The documentation for this class was generated from the following files:
      • packager/media/base/media_handler_test_base.h
      • packager/media/base/media_handler_test_base.cc
      • @@ -167,7 +167,7 @@ const std::map< size_t, std::pair< std::shared_ptr< diff --git a/docs/de/db3/classshaka_1_1media_1_1TextTrackConfig.html b/docs/de/db3/classshaka_1_1media_1_1TextTrackConfig.html index 7c4b1fb17a..aaf328ec97 100644 --- a/docs/de/db3/classshaka_1_1media_1_1TextTrackConfig.html +++ b/docs/de/db3/classshaka_1_1media_1_1TextTrackConfig.html @@ -101,7 +101,7 @@ const std::string & id diff --git a/docs/de/db4/classshaka_1_1media_1_1H26xBitReader.html b/docs/de/db4/classshaka_1_1media_1_1H26xBitReader.html index 0dbb1b6043..93104f4779 100644 --- a/docs/de/db4/classshaka_1_1media_1_1H26xBitReader.html +++ b/docs/de/db4/classshaka_1_1media_1_1H26xBitReader.html @@ -110,7 +110,7 @@ size_t NumEmulationPrevent diff --git a/docs/de/db5/structshaka_1_1media_1_1MuxerListenerFactory_1_1StreamData.html b/docs/de/db5/structshaka_1_1media_1_1MuxerListenerFactory_1_1StreamData.html index 67f9769bee..c3ddbad2e8 100644 --- a/docs/de/db5/structshaka_1_1media_1_1MuxerListenerFactory_1_1StreamData.html +++ b/docs/de/db5/structshaka_1_1media_1_1MuxerListenerFactory_1_1StreamData.html @@ -100,7 +100,7 @@ std::string hls_iframe_pla diff --git a/docs/de/dbb/classshaka_1_1media_1_1MuxerListenerFactory.html b/docs/de/dbb/classshaka_1_1media_1_1MuxerListenerFactory.html index 599125a1f3..795d8efcec 100644 --- a/docs/de/dbb/classshaka_1_1media_1_1MuxerListenerFactory.html +++ b/docs/de/dbb/classshaka_1_1media_1_1MuxerListenerFactory.html @@ -172,7 +172,7 @@ std::unique_ptr< diff --git a/docs/de/dbf/udp__options_8h_source.html b/docs/de/dbf/udp__options_8h_source.html index 497650c380..54d98179e0 100644 --- a/docs/de/dbf/udp__options_8h_source.html +++ b/docs/de/dbf/udp__options_8h_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/de/dc1/demuxer_8h_source.html b/docs/de/dc1/demuxer_8h_source.html index b23df17a9d..a6704fd5bd 100644 --- a/docs/de/dc1/demuxer_8h_source.html +++ b/docs/de/dc1/demuxer_8h_source.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/de/dc2/adaptation__set_8cc_source.html b/docs/de/dc2/adaptation__set_8cc_source.html index a7ddaa6d54..cba4a9c392 100644 --- a/docs/de/dc2/adaptation__set_8cc_source.html +++ b/docs/de/dc2/adaptation__set_8cc_source.html @@ -97,7 +97,7 @@ $(function() { diff --git a/docs/de/dc2/classshaka_1_1media_1_1H265Parser.html b/docs/de/dc2/classshaka_1_1media_1_1H265Parser.html index c6c99c4d0d..5ba2dfc13d 100644 --- a/docs/de/dc2/classshaka_1_1media_1_1H265Parser.html +++ b/docs/de/dc2/classshaka_1_1media_1_1H265Parser.html @@ -242,7 +242,7 @@ Public Member Functions diff --git a/docs/de/dc9/structshaka_1_1media_1_1mp4_1_1DecodingTimeToSample-members.html b/docs/de/dc9/structshaka_1_1media_1_1mp4_1_1DecodingTimeToSample-members.html index 60bf13124d..5b61585498 100644 --- a/docs/de/dc9/structshaka_1_1media_1_1mp4_1_1DecodingTimeToSample-members.html +++ b/docs/de/dc9/structshaka_1_1media_1_1mp4_1_1DecodingTimeToSample-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/de/dcb/ts__segmenter_8h_source.html b/docs/de/dcb/ts__segmenter_8h_source.html index 5950c1ce57..71737b9dc1 100644 --- a/docs/de/dcb/ts__segmenter_8h_source.html +++ b/docs/de/dcb/ts__segmenter_8h_source.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/de/dcc/key__frame__info_8h_source.html b/docs/de/dcc/key__frame__info_8h_source.html index 7c066f0416..899da36a8a 100644 --- a/docs/de/dcc/key__frame__info_8h_source.html +++ b/docs/de/dcc/key__frame__info_8h_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/de/dcc/mock__mpd__notifier_8cc_source.html b/docs/de/dcc/mock__mpd__notifier_8cc_source.html index 67a7c78126..c37d0bd960 100644 --- a/docs/de/dcc/mock__mpd__notifier_8cc_source.html +++ b/docs/de/dcc/mock__mpd__notifier_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/de/dcf/file__closer_8h_source.html b/docs/de/dcf/file__closer_8h_source.html index bbe56b111e..72a352ab39 100644 --- a/docs/de/dcf/file__closer_8h_source.html +++ b/docs/de/dcf/file__closer_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/de/dd6/content__protection__element_8h_source.html b/docs/de/dd6/content__protection__element_8h_source.html index 2ad4010cf8..9a3e54ff94 100644 --- a/docs/de/dd6/content__protection__element_8h_source.html +++ b/docs/de/dd6/content__protection__element_8h_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/de/dd6/muxer__listener__test__helper_8cc_source.html b/docs/de/dd6/muxer__listener__test__helper_8cc_source.html index 1233d7a7e5..4751a40f2e 100644 --- a/docs/de/dd6/muxer__listener__test__helper_8cc_source.html +++ b/docs/de/dd6/muxer__listener__test__helper_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/de/ddd/classshaka_1_1media_1_1Muxer-members.html b/docs/de/ddd/classshaka_1_1media_1_1Muxer-members.html index 175cf4e164..2335ce94ce 100644 --- a/docs/de/ddd/classshaka_1_1media_1_1Muxer-members.html +++ b/docs/de/ddd/classshaka_1_1media_1_1Muxer-members.html @@ -90,7 +90,7 @@ $(function() { muxer_listener() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected next_output_stream_index() const (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected num_input_streams() const (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected - OnFlushRequest(size_t input_stream_index) overrideshaka::media::Muxerinlineprotectedvirtual + OnFlushRequest(size_t input_stream_index) overrideshaka::media::Muxerprotectedvirtual options() const (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected Process(std::unique_ptr< StreamData > stream_data) overrideshaka::media::Muxerprotectedvirtual @@ -106,7 +106,7 @@ $(function() { diff --git a/docs/de/dde/classshaka_1_1media_1_1mp2t_1_1TsSegmenter.html b/docs/de/dde/classshaka_1_1media_1_1mp2t_1_1TsSegmenter.html index 333392d09c..60dad78a35 100644 --- a/docs/de/dde/classshaka_1_1media_1_1mp2t_1_1TsSegmenter.html +++ b/docs/de/dde/classshaka_1_1media_1_1mp2t_1_1TsSegmenter.html @@ -255,7 +255,7 @@ void  diff --git a/docs/de/ddf/structshaka_1_1media_1_1mp4_1_1MediaData-members.html b/docs/de/ddf/structshaka_1_1media_1_1mp4_1_1MediaData-members.html index ca80414303..9da5fba5c3 100644 --- a/docs/de/ddf/structshaka_1_1media_1_1mp4_1_1MediaData-members.html +++ b/docs/de/ddf/structshaka_1_1media_1_1mp4_1_1MediaData-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/de/de0/classshaka_1_1media_1_1DecoderConfigurationRecord.html b/docs/de/de0/classshaka_1_1media_1_1DecoderConfigurationRecord.html index f202ac0c86..9b35689e9e 100644 --- a/docs/de/de0/classshaka_1_1media_1_1DecoderConfigurationRecord.html +++ b/docs/de/de0/classshaka_1_1media_1_1DecoderConfigurationRecord.html @@ -321,7 +321,7 @@ void  diff --git a/docs/de/de0/classshaka_1_1media_1_1mp4_1_1MP4Muxer-members.html b/docs/de/de0/classshaka_1_1media_1_1mp4_1_1MP4Muxer-members.html index 826ffb0e56..2dfbb62da7 100644 --- a/docs/de/de0/classshaka_1_1media_1_1mp4_1_1MP4Muxer-members.html +++ b/docs/de/de0/classshaka_1_1media_1_1mp4_1_1MP4Muxer-members.html @@ -91,7 +91,7 @@ $(function() { muxer_listener() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected next_output_stream_index() const (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected num_input_streams() const (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected - OnFlushRequest(size_t input_stream_index) overrideshaka::media::Muxerinlineprotectedvirtual + OnFlushRequest(size_t input_stream_index) overrideshaka::media::Muxerprotectedvirtual options() const (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected Process(std::unique_ptr< StreamData > stream_data) overrideshaka::media::Muxerprotectedvirtual @@ -108,7 +108,7 @@ $(function() { diff --git a/docs/de/de4/classshaka_1_1media_1_1AdCueGenerator.html b/docs/de/de4/classshaka_1_1media_1_1AdCueGenerator.html index 704e5abae6..a716df06f1 100644 --- a/docs/de/de4/classshaka_1_1media_1_1AdCueGenerator.html +++ b/docs/de/de4/classshaka_1_1media_1_1AdCueGenerator.html @@ -174,7 +174,7 @@ const std::map< size_t, std::pair< std::shared_ptr< diff --git a/docs/de/de4/structshaka_1_1media_1_1H264Pps.html b/docs/de/de4/structshaka_1_1media_1_1H264Pps.html index 407b7fb319..88f0135b7a 100644 --- a/docs/de/de4/structshaka_1_1media_1_1H264Pps.html +++ b/docs/de/de4/structshaka_1_1media_1_1H264Pps.html @@ -143,7 +143,7 @@ int second_chroma_qp_index diff --git a/docs/de/dea/classshaka_1_1media_1_1H26xByteToUnitStreamConverter.html b/docs/de/dea/classshaka_1_1media_1_1H26xByteToUnitStreamConverter.html index 3c00f15ed4..c4b4ac3174 100644 --- a/docs/de/dea/classshaka_1_1media_1_1H26xByteToUnitStreamConverter.html +++ b/docs/de/dea/classshaka_1_1media_1_1H26xByteToUnitStreamConverter.html @@ -269,7 +269,7 @@ void WarnIfNotMatch (i diff --git a/docs/de/deb/structshaka_1_1Cuepoint.html b/docs/de/deb/structshaka_1_1Cuepoint.html index e6f6dceb8d..e2de0ade04 100644 --- a/docs/de/deb/structshaka_1_1Cuepoint.html +++ b/docs/de/deb/structshaka_1_1Cuepoint.html @@ -90,7 +90,7 @@ double  diff --git a/docs/de/def/structshaka_1_1media_1_1mp4_1_1DecodingTimeToSample.html b/docs/de/def/structshaka_1_1media_1_1mp4_1_1DecodingTimeToSample.html index ce972fbe2d..d8b97dea23 100644 --- a/docs/de/def/structshaka_1_1media_1_1mp4_1_1DecodingTimeToSample.html +++ b/docs/de/def/structshaka_1_1media_1_1mp4_1_1DecodingTimeToSample.html @@ -107,10 +107,10 @@ std::vector<   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

        @@ -121,7 +121,7 @@ Additional Inherited Members

        Detailed Description

        -

        Definition at line 407 of file box_definitions.h.

        +

        Definition at line 418 of file box_definitions.h.

        Member Function Documentation

        ◆ BoxType()

        @@ -149,7 +149,7 @@ Additional Inherited Members

        Implements shaka::media::mp4::Box.

        -

        Definition at line 676 of file box_definitions.cc.

        +

        Definition at line 684 of file box_definitions.cc.

        @@ -160,7 +160,7 @@ Additional Inherited Members diff --git a/docs/de/df2/combined__muxer__listener_8h_source.html b/docs/de/df2/combined__muxer__listener_8h_source.html index 402712526d..a9daf10a78 100644 --- a/docs/de/df2/combined__muxer__listener_8h_source.html +++ b/docs/de/df2/combined__muxer__listener_8h_source.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/de/df6/classshaka_1_1media_1_1mp4_1_1TrackRunIterator.html b/docs/de/df6/classshaka_1_1media_1_1mp4_1_1TrackRunIterator.html index ff931914a4..a2b2612634 100644 --- a/docs/de/df6/classshaka_1_1media_1_1mp4_1_1TrackRunIterator.html +++ b/docs/de/df6/classshaka_1_1media_1_1mp4_1_1TrackRunIterator.html @@ -406,7 +406,7 @@ bool is_keyframe () co diff --git a/docs/de/dfa/muxer__listener_8h_source.html b/docs/de/dfa/muxer__listener_8h_source.html index 4035335ed2..f020e4635f 100644 --- a/docs/de/dfa/muxer__listener_8h_source.html +++ b/docs/de/dfa/muxer__listener_8h_source.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/de/dfa/structshaka_1_1media_1_1mp4_1_1OpusSpecific.html b/docs/de/dfa/structshaka_1_1media_1_1mp4_1_1OpusSpecific.html index 2f3ddaecc7..3d755e6e9e 100644 --- a/docs/de/dfa/structshaka_1_1media_1_1mp4_1_1OpusSpecific.html +++ b/docs/de/dfa/structshaka_1_1media_1_1mp4_1_1OpusSpecific.html @@ -104,7 +104,7 @@ Public Attributes std::vector< uint8_t > opus_identification_header   -uint16_t preskip +uint16_t preskip = 0u  

        @@ -115,7 +115,7 @@ Additional Inherited Members

        Detailed Description

        -

        Definition at line 325 of file box_definitions.h.

        +

        Definition at line 328 of file box_definitions.h.

        Member Function Documentation

        ◆ BoxType()

        @@ -143,7 +143,7 @@ Additional Inherited Members

        Implements shaka::media::mp4::Box.

        -

        Definition at line 1664 of file box_definitions.cc.

        +

        Definition at line 1702 of file box_definitions.cc.

        @@ -154,7 +154,7 @@ Additional Inherited Members diff --git a/docs/de/dfd/stream__info_8cc_source.html b/docs/de/dfd/stream__info_8cc_source.html index 9864075718..a479412568 100644 --- a/docs/de/dfd/stream__info_8cc_source.html +++ b/docs/de/dfd/stream__info_8cc_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/df/d00/playready__key__source_8h_source.html b/docs/df/d00/playready__key__source_8h_source.html index 16ee488fce..0ad1d373c2 100644 --- a/docs/df/d00/playready__key__source_8h_source.html +++ b/docs/df/d00/playready__key__source_8h_source.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/df/d05/vp__codec__configuration__record_8cc_source.html b/docs/df/d05/vp__codec__configuration__record_8cc_source.html index 04cf84cb3a..2aa8da93b9 100644 --- a/docs/df/d05/vp__codec__configuration__record_8cc_source.html +++ b/docs/df/d05/vp__codec__configuration__record_8cc_source.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/df/d0d/classshaka_1_1media_1_1BlockReader.html b/docs/df/d0d/classshaka_1_1media_1_1BlockReader.html index f1a89f189a..5dfc92f2a9 100644 --- a/docs/df/d0d/classshaka_1_1media_1_1BlockReader.html +++ b/docs/df/d0d/classshaka_1_1media_1_1BlockReader.html @@ -89,7 +89,7 @@ bool Next (std::vector diff --git a/docs/df/d11/playready__pssh__generator_8h_source.html b/docs/df/d11/playready__pssh__generator_8h_source.html index a061a664bd..8137f34df6 100644 --- a/docs/df/d11/playready__pssh__generator_8h_source.html +++ b/docs/df/d11/playready__pssh__generator_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/df/d1a/offset__byte__queue_8cc_source.html b/docs/df/d1a/offset__byte__queue_8cc_source.html index 508aa6ef05..7d875554cb 100644 --- a/docs/df/d1a/offset__byte__queue_8cc_source.html +++ b/docs/df/d1a/offset__byte__queue_8cc_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/df/d1c/classshaka_1_1media_1_1MediaSample-members.html b/docs/df/d1c/classshaka_1_1media_1_1MediaSample-members.html index 5e43b899e3..40e6498d82 100644 --- a/docs/df/d1c/classshaka_1_1media_1_1MediaSample-members.html +++ b/docs/df/d1c/classshaka_1_1media_1_1MediaSample-members.html @@ -103,7 +103,7 @@ $(function() { diff --git a/docs/df/d1c/composition__offset__iterator_8h_source.html b/docs/df/d1c/composition__offset__iterator_8h_source.html index 27dfbb103e..9a5046a64c 100644 --- a/docs/df/d1c/composition__offset__iterator_8h_source.html +++ b/docs/df/d1c/composition__offset__iterator_8h_source.html @@ -66,7 +66,7 @@ $(function() {
        composition_offset_iterator.h
        -
        1 // Copyright 2014 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_FORMATS_MP4_COMPOSITION_OFFSET_ITERATOR_H_
        8 #define PACKAGER_MEDIA_FORMATS_MP4_COMPOSITION_OFFSET_ITERATOR_H_
        9 
        10 #include <stdint.h>
        11 
        12 #include <vector>
        13 
        14 #include "packager/base/macros.h"
        15 #include "packager/media/formats/mp4/box_definitions.h"
        16 
        17 namespace shaka {
        18 namespace media {
        19 namespace mp4 {
        20 
        25  public:
        28  const CompositionTimeToSample& composition_time_to_sample);
        30 
        33  bool AdvanceSample();
        34 
        37  bool IsValid() const;
        38 
        40  int64_t sample_offset() const { return iterator_->sample_offset; }
        41 
        43  int64_t SampleOffset(uint32_t sample) const;
        44 
        46  uint32_t NumSamples() const;
        47 
        48  private:
        49  uint32_t sample_index_;
        50  const std::vector<CompositionOffset>& composition_offset_table_;
        51  std::vector<CompositionOffset>::const_iterator iterator_;
        52 
        53  DISALLOW_COPY_AND_ASSIGN(CompositionOffsetIterator);
        54 };
        55 
        56 } // namespace mp4
        57 } // namespace media
        58 } // namespace shaka
        59 
        60 #endif // PACKAGER_MEDIA_FORMATS_MP4_COMPOSITION_OFFSET_ITERATOR_H_
        +
        1 // Copyright 2014 Google Inc. All rights reserved.
        2 //
        3 // Use of this source code is governed by a BSD-style
        4 // license that can be found in the LICENSE file or at
        5 // https://developers.google.com/open-source/licenses/bsd
        6 
        7 #ifndef PACKAGER_MEDIA_FORMATS_MP4_COMPOSITION_OFFSET_ITERATOR_H_
        8 #define PACKAGER_MEDIA_FORMATS_MP4_COMPOSITION_OFFSET_ITERATOR_H_
        9 
        10 #include <stdint.h>
        11 
        12 #include <vector>
        13 
        14 #include "packager/base/macros.h"
        15 #include "packager/media/formats/mp4/box_definitions.h"
        16 
        17 namespace shaka {
        18 namespace media {
        19 namespace mp4 {
        20 
        25  public:
        28  const CompositionTimeToSample& composition_time_to_sample);
        30 
        33  bool AdvanceSample();
        34 
        37  bool IsValid() const;
        38 
        40  int64_t sample_offset() const { return iterator_->sample_offset; }
        41 
        43  int64_t SampleOffset(uint32_t sample) const;
        44 
        46  uint32_t NumSamples() const;
        47 
        48  private:
        49  uint32_t sample_index_;
        50  const std::vector<CompositionOffset>& composition_offset_table_;
        51  std::vector<CompositionOffset>::const_iterator iterator_;
        52 
        53  DISALLOW_COPY_AND_ASSIGN(CompositionOffsetIterator);
        54 };
        55 
        56 } // namespace mp4
        57 } // namespace media
        58 } // namespace shaka
        59 
        60 #endif // PACKAGER_MEDIA_FORMATS_MP4_COMPOSITION_OFFSET_ITERATOR_H_
        All the methods that are virtual are virtual for mocking.
        @@ -78,7 +78,7 @@ $(function() {
        diff --git a/docs/df/d1d/ac3__audio__util_8h_source.html b/docs/df/d1d/ac3__audio__util_8h_source.html index 4e5ac59fcb..3169ae7f01 100644 --- a/docs/df/d1d/ac3__audio__util_8h_source.html +++ b/docs/df/d1d/ac3__audio__util_8h_source.html @@ -70,7 +70,7 @@ $(function() {
        diff --git a/docs/df/d21/classshaka_1_1media_1_1SegmentTestBase_1_1ClusterParser-members.html b/docs/df/d21/classshaka_1_1media_1_1SegmentTestBase_1_1ClusterParser-members.html index 7b188c8541..7c4a1ce13c 100644 --- a/docs/df/d21/classshaka_1_1media_1_1SegmentTestBase_1_1ClusterParser-members.html +++ b/docs/df/d21/classshaka_1_1media_1_1SegmentTestBase_1_1ClusterParser-members.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/df/d22/structshaka_1_1WidevineSigner.html b/docs/df/d22/structshaka_1_1WidevineSigner.html index 1011279606..6002008810 100644 --- a/docs/df/d22/structshaka_1_1WidevineSigner.html +++ b/docs/df/d22/structshaka_1_1WidevineSigner.html @@ -141,7 +141,7 @@ struct { diff --git a/docs/df/d22/validate__flag_8h_source.html b/docs/df/d22/validate__flag_8h_source.html index 2d507165c5..f06b81b6e6 100644 --- a/docs/df/d22/validate__flag_8h_source.html +++ b/docs/df/d22/validate__flag_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/df/d2a/classshaka_1_1media_1_1mp4_1_1DecodingTimeIterator-members.html b/docs/df/d2a/classshaka_1_1media_1_1mp4_1_1DecodingTimeIterator-members.html index c1252d5205..10ab7242c6 100644 --- a/docs/df/d2a/classshaka_1_1media_1_1mp4_1_1DecodingTimeIterator-members.html +++ b/docs/df/d2a/classshaka_1_1media_1_1mp4_1_1DecodingTimeIterator-members.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/df/d2b/pssh__generator_8cc_source.html b/docs/df/d2b/pssh__generator_8cc_source.html index 8ff0c4ab5c..5954140343 100644 --- a/docs/df/d2b/pssh__generator_8cc_source.html +++ b/docs/df/d2b/pssh__generator_8cc_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/df/d2d/classshaka_1_1media_1_1AesCbcDecryptor.html b/docs/df/d2d/classshaka_1_1media_1_1AesCbcDecryptor.html index c35fd9967a..5bd03f5268 100644 --- a/docs/df/d2d/classshaka_1_1media_1_1AesCbcDecryptor.html +++ b/docs/df/d2d/classshaka_1_1media_1_1AesCbcDecryptor.html @@ -259,7 +259,7 @@ AES_KEY * mutable_aes_key< diff --git a/docs/df/d31/muxer__util_8cc_source.html b/docs/df/d31/muxer__util_8cc_source.html index 41d02f7fbc..f51a34a2a4 100644 --- a/docs/df/d31/muxer__util_8cc_source.html +++ b/docs/df/d31/muxer__util_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/df/d32/audio__stream__info_8h_source.html b/docs/df/d32/audio__stream__info_8h_source.html index b011e6ec15..ad91f7581f 100644 --- a/docs/df/d32/audio__stream__info_8h_source.html +++ b/docs/df/d32/audio__stream__info_8h_source.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/df/d33/classshaka_1_1AdaptationSet-members.html b/docs/df/d33/classshaka_1_1AdaptationSet-members.html index 1494fce2fd..541fb3396b 100644 --- a/docs/df/d33/classshaka_1_1AdaptationSet-members.html +++ b/docs/df/d33/classshaka_1_1AdaptationSet-members.html @@ -100,7 +100,7 @@ $(function() { diff --git a/docs/df/d38/structshaka_1_1media_1_1mp4_1_1ChunkInfo.html b/docs/df/d38/structshaka_1_1media_1_1mp4_1_1ChunkInfo.html index 4311dfaede..29cc9cfb94 100644 --- a/docs/df/d38/structshaka_1_1media_1_1mp4_1_1ChunkInfo.html +++ b/docs/df/d38/structshaka_1_1media_1_1mp4_1_1ChunkInfo.html @@ -84,14 +84,14 @@ uint32_t sample_descriptio

        Detailed Description

        -

        Definition at line 428 of file box_definitions.h.

        +

        Definition at line 439 of file box_definitions.h.


        The documentation for this struct was generated from the following file: diff --git a/docs/df/d38/structshaka_1_1media_1_1mp4_1_1MovieExtendsHeader-members.html b/docs/df/d38/structshaka_1_1media_1_1mp4_1_1MovieExtendsHeader-members.html index 227fca127d..09fdd5f09b 100644 --- a/docs/df/d38/structshaka_1_1media_1_1mp4_1_1MovieExtendsHeader-members.html +++ b/docs/df/d38/structshaka_1_1media_1_1mp4_1_1MovieExtendsHeader-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/df/d3c/classshaka_1_1media_1_1RequestSigner.html b/docs/df/d3c/classshaka_1_1media_1_1RequestSigner.html index 597a2f39fa..a39877434e 100644 --- a/docs/df/d3c/classshaka_1_1media_1_1RequestSigner.html +++ b/docs/df/d3c/classshaka_1_1media_1_1RequestSigner.html @@ -157,7 +157,7 @@ Protected Member Functions diff --git a/docs/df/d46/classshaka_1_1media_1_1Muxer.html b/docs/df/d46/classshaka_1_1media_1_1Muxer.html index ae4247a8f2..5863fd5190 100644 --- a/docs/df/d46/classshaka_1_1media_1_1Muxer.html +++ b/docs/df/d46/classshaka_1_1media_1_1Muxer.html @@ -214,7 +214,7 @@ const std::map< size_t, std::pair< std::shared_ptr< @@ -275,7 +275,7 @@ const std::map< size_t, std::pair< std::shared_ptr< Implements shaka::media::MediaHandler.

        -

        Definition at line 37 of file muxer.cc.

        +

        Definition at line 44 of file muxer.cc.

        @@ -335,7 +335,7 @@ const std::map< size_t, std::pair< std::shared_ptr< -

        Definition at line 28 of file muxer.cc.

        +

        Definition at line 35 of file muxer.cc.

        @@ -361,7 +361,7 @@ const std::map< size_t, std::pair< std::shared_ptr< -

        Definition at line 32 of file muxer.cc.

        +

        Definition at line 39 of file muxer.cc.

        @@ -372,7 +372,7 @@ const std::map< size_t, std::pair< std::shared_ptr< diff --git a/docs/df/d47/structshaka_1_1PlayReadyEncryptionParams.html b/docs/df/d47/structshaka_1_1PlayReadyEncryptionParams.html index 14e66d3ae0..8a3d55dbae 100644 --- a/docs/df/d47/structshaka_1_1PlayReadyEncryptionParams.html +++ b/docs/df/d47/structshaka_1_1PlayReadyEncryptionParams.html @@ -125,7 +125,7 @@ std::string  diff --git a/docs/df/d4e/classshaka_1_1IoCache.html b/docs/df/d4e/classshaka_1_1IoCache.html index 558497932b..6cf5c72851 100644 --- a/docs/df/d4e/classshaka_1_1IoCache.html +++ b/docs/df/d4e/classshaka_1_1IoCache.html @@ -281,7 +281,7 @@ void  diff --git a/docs/df/d51/classshaka_1_1media_1_1RsaPrivateKey-members.html b/docs/df/d51/classshaka_1_1media_1_1RsaPrivateKey-members.html index c22956f9d3..5034f482d3 100644 --- a/docs/df/d51/classshaka_1_1media_1_1RsaPrivateKey-members.html +++ b/docs/df/d51/classshaka_1_1media_1_1RsaPrivateKey-members.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/df/d5b/classshaka_1_1CallbackFile-members.html b/docs/df/d5b/classshaka_1_1CallbackFile-members.html index 2627a6b843..f95c85fdd1 100644 --- a/docs/df/d5b/classshaka_1_1CallbackFile-members.html +++ b/docs/df/d5b/classshaka_1_1CallbackFile-members.html @@ -97,7 +97,7 @@ $(function() { diff --git a/docs/df/d60/classshaka_1_1MockMpdBuilder.html b/docs/df/d60/classshaka_1_1MockMpdBuilder.html index 8f6ddeae68..3bc9807028 100644 --- a/docs/df/d60/classshaka_1_1MockMpdBuilder.html +++ b/docs/df/d60/classshaka_1_1MockMpdBuilder.html @@ -117,7 +117,7 @@ Additional Inherited Members diff --git a/docs/df/d60/structshaka_1_1media_1_1KeyFrameEvent-members.html b/docs/df/d60/structshaka_1_1media_1_1KeyFrameEvent-members.html index a51e3703a4..8f359ab954 100644 --- a/docs/df/d60/structshaka_1_1media_1_1KeyFrameEvent-members.html +++ b/docs/df/d60/structshaka_1_1media_1_1KeyFrameEvent-members.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/df/d62/ad__cue__generator_8cc_source.html b/docs/df/d62/ad__cue__generator_8cc_source.html index b6f7d68b52..137e57018d 100644 --- a/docs/df/d62/ad__cue__generator_8cc_source.html +++ b/docs/df/d62/ad__cue__generator_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/df/d63/structshaka_1_1media_1_1mp4_1_1AudioRollRecoveryEntry-members.html b/docs/df/d63/structshaka_1_1media_1_1mp4_1_1AudioRollRecoveryEntry-members.html index bfcb507114..c85d0cfddd 100644 --- a/docs/df/d63/structshaka_1_1media_1_1mp4_1_1AudioRollRecoveryEntry-members.html +++ b/docs/df/d63/structshaka_1_1media_1_1mp4_1_1AudioRollRecoveryEntry-members.html @@ -69,15 +69,13 @@ $(function() {

        This is the complete list of members for shaka::media::mp4::AudioRollRecoveryEntry, including all inherited members.

        - - - - - + + +
        AudioRollRecoveryEntry() (defined in shaka::media::mp4::AudioRollRecoveryEntry)shaka::media::mp4::AudioRollRecoveryEntry
        ComputeSize() const (defined in shaka::media::mp4::AudioRollRecoveryEntry)shaka::media::mp4::AudioRollRecoveryEntry
        ReadWrite(BoxBuffer *buffer) (defined in shaka::media::mp4::AudioRollRecoveryEntry)shaka::media::mp4::AudioRollRecoveryEntry
        roll_distance (defined in shaka::media::mp4::AudioRollRecoveryEntry)shaka::media::mp4::AudioRollRecoveryEntry
        ~AudioRollRecoveryEntry() (defined in shaka::media::mp4::AudioRollRecoveryEntry)shaka::media::mp4::AudioRollRecoveryEntry
        ComputeSize() const (defined in shaka::media::mp4::AudioRollRecoveryEntry)shaka::media::mp4::AudioRollRecoveryEntry
        ReadWrite(BoxBuffer *buffer) (defined in shaka::media::mp4::AudioRollRecoveryEntry)shaka::media::mp4::AudioRollRecoveryEntry
        roll_distance (defined in shaka::media::mp4::AudioRollRecoveryEntry)shaka::media::mp4::AudioRollRecoveryEntry
        diff --git a/docs/df/d66/classshaka_1_1media_1_1KeyFetcher.html b/docs/df/d66/classshaka_1_1media_1_1KeyFetcher.html index 3fdaa1db2c..a3fe3eaabb 100644 --- a/docs/df/d66/classshaka_1_1media_1_1KeyFetcher.html +++ b/docs/df/d66/classshaka_1_1media_1_1KeyFetcher.html @@ -154,7 +154,7 @@ Public Member Functions diff --git a/docs/df/d6a/classshaka_1_1MockMpdBuilder-members.html b/docs/df/d6a/classshaka_1_1MockMpdBuilder-members.html index 27c01a3359..0629a2ca5b 100644 --- a/docs/df/d6a/classshaka_1_1MockMpdBuilder-members.html +++ b/docs/df/d6a/classshaka_1_1MockMpdBuilder-members.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/df/d6a/structshaka_1_1media_1_1mp4_1_1OpusSpecific-members.html b/docs/df/d6a/structshaka_1_1media_1_1mp4_1_1OpusSpecific-members.html index 12ffbd421a..56d8aebdf3 100644 --- a/docs/df/d6a/structshaka_1_1media_1_1mp4_1_1OpusSpecific-members.html +++ b/docs/df/d6a/structshaka_1_1media_1_1mp4_1_1OpusSpecific-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/docs/df/d6d/structshaka_1_1media_1_1OnNewSegmentParameters.html b/docs/df/d6d/structshaka_1_1media_1_1OnNewSegmentParameters.html index 133d12cc7d..eede68886b 100644 --- a/docs/df/d6d/structshaka_1_1media_1_1OnNewSegmentParameters.html +++ b/docs/df/d6d/structshaka_1_1media_1_1OnNewSegmentParameters.html @@ -94,7 +94,7 @@ uint64_t segment_file_size diff --git a/docs/df/d7b/structshaka_1_1media_1_1mp4_1_1CompositionTimeToSample.html b/docs/df/d7b/structshaka_1_1media_1_1mp4_1_1CompositionTimeToSample.html index b5da1572be..7e10496818 100644 --- a/docs/df/d7b/structshaka_1_1media_1_1mp4_1_1CompositionTimeToSample.html +++ b/docs/df/d7b/structshaka_1_1media_1_1mp4_1_1CompositionTimeToSample.html @@ -107,10 +107,10 @@ std::vector<   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

        @@ -121,7 +121,7 @@ Additional Inherited Members

        Detailed Description

        -

        Definition at line 422 of file box_definitions.h.

        +

        Definition at line 433 of file box_definitions.h.

        Member Function Documentation

        ◆ BoxType()

        @@ -149,7 +149,7 @@ Additional Inherited Members

        Implements shaka::media::mp4::Box.

        -

        Definition at line 698 of file box_definitions.cc.

        +

        Definition at line 708 of file box_definitions.cc.

        @@ -160,7 +160,7 @@ Additional Inherited Members diff --git a/docs/df/d7b/structshaka_1_1media_1_1mp4_1_1TrackFragment.html b/docs/df/d7b/structshaka_1_1media_1_1mp4_1_1TrackFragment.html index 41781f5378..4353a75c85 100644 --- a/docs/df/d7b/structshaka_1_1media_1_1mp4_1_1TrackFragment.html +++ b/docs/df/d7b/structshaka_1_1media_1_1mp4_1_1TrackFragment.html @@ -107,7 +107,7 @@ Public Attributes std::vector< TrackFragmentRunruns   -bool decode_time_absent +bool decode_time_absent = false   TrackFragmentDecodeTime decode_time @@ -136,7 +136,7 @@ Additional Inherited Members

        Detailed Description

        -

        Definition at line 726 of file box_definitions.h.

        +

        Definition at line 731 of file box_definitions.h.

        Member Function Documentation

        ◆ BoxType()

        @@ -164,7 +164,7 @@ Additional Inherited Members

        Implements shaka::media::mp4::Box.

        -

        Definition at line 2438 of file box_definitions.cc.

        +

        Definition at line 2504 of file box_definitions.cc.

        @@ -175,7 +175,7 @@ Additional Inherited Members diff --git a/docs/df/d7d/webm__info__parser_8cc_source.html b/docs/df/d7d/webm__info__parser_8cc_source.html index 5eb4404a6a..e81be5fe06 100644 --- a/docs/df/d7d/webm__info__parser_8cc_source.html +++ b/docs/df/d7d/webm__info__parser_8cc_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/df/d81/raw__key__pssh__generator_8h_source.html b/docs/df/d81/raw__key__pssh__generator_8h_source.html index bc812855c8..7ad317bf44 100644 --- a/docs/df/d81/raw__key__pssh__generator_8h_source.html +++ b/docs/df/d81/raw__key__pssh__generator_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/df/d82/classshaka_1_1media_1_1DecoderConfigurationRecord-members.html b/docs/df/d82/classshaka_1_1media_1_1DecoderConfigurationRecord-members.html index 92459f2f3f..af3970d266 100644 --- a/docs/df/d82/classshaka_1_1media_1_1DecoderConfigurationRecord-members.html +++ b/docs/df/d82/classshaka_1_1media_1_1DecoderConfigurationRecord-members.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/df/d83/classshaka_1_1media_1_1TextPadder-members.html b/docs/df/d83/classshaka_1_1media_1_1TextPadder-members.html index 229c64be54..9b16c6564a 100644 --- a/docs/df/d83/classshaka_1_1media_1_1TextPadder-members.html +++ b/docs/df/d83/classshaka_1_1media_1_1TextPadder-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/docs/df/d87/classshaka_1_1media_1_1AesCryptor.html b/docs/df/d87/classshaka_1_1media_1_1AesCryptor.html index 58ba032142..d4ab33104b 100644 --- a/docs/df/d87/classshaka_1_1media_1_1AesCryptor.html +++ b/docs/df/d87/classshaka_1_1media_1_1AesCryptor.html @@ -415,7 +415,7 @@ AES_KEY * mutable_aes_key< diff --git a/docs/df/d8a/structshaka_1_1media_1_1mp4_1_1DataEntryUrl.html b/docs/df/d8a/structshaka_1_1media_1_1mp4_1_1DataEntryUrl.html index 1ed2dff969..deb0dc54fd 100644 --- a/docs/df/d8a/structshaka_1_1media_1_1mp4_1_1DataEntryUrl.html +++ b/docs/df/d8a/structshaka_1_1media_1_1mp4_1_1DataEntryUrl.html @@ -107,10 +107,10 @@ std::vector< uint8_t >    - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

        @@ -121,7 +121,7 @@ Additional Inherited Members

        Detailed Description

        -

        Definition at line 584 of file box_definitions.h.

        +

        Definition at line 589 of file box_definitions.h.

        Member Function Documentation

        ◆ BoxType()

        @@ -149,7 +149,7 @@ Additional Inherited Members

        Implements shaka::media::mp4::Box.

        -

        Definition at line 1960 of file box_definitions.cc.

        +

        Definition at line 2005 of file box_definitions.cc.

        @@ -160,7 +160,7 @@ Additional Inherited Members diff --git a/docs/df/d8a/vp9__parser_8h_source.html b/docs/df/d8a/vp9__parser_8h_source.html index 6d0f576a66..3323050921 100644 --- a/docs/df/d8a/vp9__parser_8h_source.html +++ b/docs/df/d8a/vp9__parser_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/df/d8a/vpx__parser_8h_source.html b/docs/df/d8a/vpx__parser_8h_source.html index 7cdca5b7a3..363177c18d 100644 --- a/docs/df/d8a/vpx__parser_8h_source.html +++ b/docs/df/d8a/vpx__parser_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/df/d8c/classshaka_1_1media_1_1mp4_1_1MultiSegmentSegmenter-members.html b/docs/df/d8c/classshaka_1_1media_1_1mp4_1_1MultiSegmentSegmenter-members.html index 69f71583f2..f6aee1a863 100644 --- a/docs/df/d8c/classshaka_1_1media_1_1mp4_1_1MultiSegmentSegmenter-members.html +++ b/docs/df/d8c/classshaka_1_1media_1_1mp4_1_1MultiSegmentSegmenter-members.html @@ -97,7 +97,7 @@ $(function() { diff --git a/docs/df/d8d/es__parser__h26x_8h_source.html b/docs/df/d8d/es__parser__h26x_8h_source.html index 3adab45bd0..1bc49562d8 100644 --- a/docs/df/d8d/es__parser__h26x_8h_source.html +++ b/docs/df/d8d/es__parser__h26x_8h_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/df/d94/classshaka_1_1RepresentationStateChangeListener.html b/docs/df/d94/classshaka_1_1RepresentationStateChangeListener.html index 2d604d8112..3d52eb146b 100644 --- a/docs/df/d94/classshaka_1_1RepresentationStateChangeListener.html +++ b/docs/df/d94/classshaka_1_1RepresentationStateChangeListener.html @@ -173,7 +173,7 @@ Public Member Functions diff --git a/docs/df/d96/xml__node_8cc_source.html b/docs/df/d96/xml__node_8cc_source.html index ff830a2757..569f010d9d 100644 --- a/docs/df/d96/xml__node_8cc_source.html +++ b/docs/df/d96/xml__node_8cc_source.html @@ -92,7 +92,7 @@ $(function() { diff --git a/docs/df/d9a/structshaka_1_1media_1_1mp4_1_1TrackFragmentDecodeTime.html b/docs/df/d9a/structshaka_1_1media_1_1mp4_1_1TrackFragmentDecodeTime.html index 3111847afe..859c9b44c5 100644 --- a/docs/df/d9a/structshaka_1_1media_1_1mp4_1_1TrackFragmentDecodeTime.html +++ b/docs/df/d9a/structshaka_1_1media_1_1mp4_1_1TrackFragmentDecodeTime.html @@ -103,14 +103,14 @@ Public Member Functions

        Public Attributes

        -uint64_t decode_time +uint64_t decode_time = 0u   - Public Attributes inherited from shaka::media::mp4::FullBox -uint8_t version +uint8_t version = 0   -uint32_t flags +uint32_t flags = 0  

        @@ -121,7 +121,7 @@ Additional Inherited Members

        Detailed Description

        -

        Definition at line 664 of file box_definitions.h.

        +

        Definition at line 669 of file box_definitions.h.

        Member Function Documentation

        ◆ BoxType()

        @@ -149,7 +149,7 @@ Additional Inherited Members

        Implements shaka::media::mp4::Box.

        -

        Definition at line 2227 of file box_definitions.cc.

        +

        Definition at line 2288 of file box_definitions.cc.

        @@ -160,7 +160,7 @@ Additional Inherited Members diff --git a/docs/df/d9e/classshaka_1_1xml_1_1RepresentationXmlNode.html b/docs/df/d9e/classshaka_1_1xml_1_1RepresentationXmlNode.html index 3d3efdcdcf..e994bc614f 100644 --- a/docs/df/d9e/classshaka_1_1xml_1_1RepresentationXmlNode.html +++ b/docs/df/d9e/classshaka_1_1xml_1_1RepresentationXmlNode.html @@ -296,7 +296,7 @@ Additional Inherited Members diff --git a/docs/df/da0/structshaka_1_1media_1_1mp4_1_1ChunkOffset-members.html b/docs/df/da0/structshaka_1_1media_1_1mp4_1_1ChunkOffset-members.html index eecb2f49f3..26316aebeb 100644 --- a/docs/df/da0/structshaka_1_1media_1_1mp4_1_1ChunkOffset-members.html +++ b/docs/df/da0/structshaka_1_1media_1_1mp4_1_1ChunkOffset-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/docs/df/da5/structshaka_1_1media_1_1mp4_1_1CueIDBox-members.html b/docs/df/da5/structshaka_1_1media_1_1mp4_1_1CueIDBox-members.html index 7b2a10ae31..9867553a4c 100644 --- a/docs/df/da5/structshaka_1_1media_1_1mp4_1_1CueIDBox-members.html +++ b/docs/df/da5/structshaka_1_1media_1_1mp4_1_1CueIDBox-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/df/dab/structshaka_1_1media_1_1EventInfo-members.html b/docs/df/dab/structshaka_1_1media_1_1EventInfo-members.html index 175deb1b15..b7213c5c6f 100644 --- a/docs/df/dab/structshaka_1_1media_1_1EventInfo-members.html +++ b/docs/df/dab/structshaka_1_1media_1_1EventInfo-members.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/df/dad/decrypt__config_8h_source.html b/docs/df/dad/decrypt__config_8h_source.html index cc33073b00..d7cf975794 100644 --- a/docs/df/dad/decrypt__config_8h_source.html +++ b/docs/df/dad/decrypt__config_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/df/dc0/classshaka_1_1media_1_1WebVttToMp4Handler-members.html b/docs/df/dc0/classshaka_1_1media_1_1WebVttToMp4Handler-members.html index 8fba7ceac1..1522c86485 100644 --- a/docs/df/dc0/classshaka_1_1media_1_1WebVttToMp4Handler-members.html +++ b/docs/df/dc0/classshaka_1_1media_1_1WebVttToMp4Handler-members.html @@ -85,18 +85,17 @@ $(function() { MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandler next_output_stream_index() const (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected num_input_streams() const (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected - OnFlushRequest(size_t input_stream_index) overrideshaka::media::WebVttToMp4Handlerprotectedvirtual + OnFlushRequest(size_t input_stream_index)shaka::media::MediaHandlerprotectedvirtual output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected - Process(std::unique_ptr< StreamData > stream_data) overrideshaka::media::WebVttToMp4Handlerprotectedvirtual - SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler - ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual - WebVttToMp4Handler()=default (defined in shaka::media::WebVttToMp4Handler)shaka::media::WebVttToMp4Handler - WriteCue(const std::string &id, const std::string &settings, const std::string &payload, BufferWriter *out) (defined in shaka::media::WebVttToMp4Handler)shaka::media::WebVttToMp4Handlerprotectedvirtual + SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler + ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual + WebVttToMp4Handler()=default (defined in shaka::media::WebVttToMp4Handler)shaka::media::WebVttToMp4Handler ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual + ~WebVttToMp4Handler() override=default (defined in shaka::media::WebVttToMp4Handler)shaka::media::WebVttToMp4Handlervirtual diff --git a/docs/df/dc7/avc__decoder__configuration__record_8h_source.html b/docs/df/dc7/avc__decoder__configuration__record_8h_source.html index e72cb52010..6d6626a457 100644 --- a/docs/df/dc7/avc__decoder__configuration__record_8h_source.html +++ b/docs/df/dc7/avc__decoder__configuration__record_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/df/dc9/classshaka_1_1media_1_1WebVttOutputHandler-members.html b/docs/df/dc9/classshaka_1_1media_1_1WebVttOutputHandler-members.html deleted file mode 100644 index 2922f6a0da..0000000000 --- a/docs/df/dc9/classshaka_1_1media_1_1WebVttOutputHandler-members.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - -Shaka Packager SDK: Member List - - - - - - - - - -
        -
        - - - - - - -
        -
        Shaka Packager SDK -
        -
        -
        - - - - - - - - -
        -
        - - -
        - -
        - - -
        -
        -
        -
        shaka::media::WebVttOutputHandler Member List
        -
        -
        - -

        This is the complete list of members for shaka::media::WebVttOutputHandler, including all inherited members.

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        AddHandler(std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandlerinline
        Dispatch(std::unique_ptr< StreamData > stream_data) constshaka::media::MediaHandlerprotected
        DispatchCueEvent(size_t stream_index, std::shared_ptr< const CueEvent > cue_event) constshaka::media::MediaHandlerinlineprotected
        DispatchMediaSample(size_t stream_index, std::shared_ptr< const MediaSample > media_sample) constshaka::media::MediaHandlerinlineprotected
        DispatchScte35Event(size_t stream_index, std::shared_ptr< const Scte35Event > scte35_event) constshaka::media::MediaHandlerinlineprotected
        DispatchSegmentInfo(size_t stream_index, std::shared_ptr< const SegmentInfo > segment_info) constshaka::media::MediaHandlerinlineprotected
        DispatchStreamInfo(size_t stream_index, std::shared_ptr< const StreamInfo > stream_info) constshaka::media::MediaHandlerinlineprotected
        DispatchTextSample(size_t stream_index, std::shared_ptr< const TextSample > text_sample) constshaka::media::MediaHandlerinlineprotected
        FlushAllDownstreams()shaka::media::MediaHandlerprotected
        FlushDownstream(size_t output_stream_index)shaka::media::MediaHandlerprotected
        Initialize()shaka::media::MediaHandler
        initialized() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
        IsConnected()shaka::media::MediaHandlerinline
        MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandler
        next_output_stream_index() const (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
        num_input_streams() const (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
        OnCueEvent(const CueEvent &event)=0 (defined in shaka::media::WebVttOutputHandler)shaka::media::WebVttOutputHandlerprotectedpure virtual
        OnSegmentInfo(const SegmentInfo &info)=0 (defined in shaka::media::WebVttOutputHandler)shaka::media::WebVttOutputHandlerprotectedpure virtual
        OnStreamEnd()=0 (defined in shaka::media::WebVttOutputHandler)shaka::media::WebVttOutputHandlerprotectedpure virtual
        OnStreamInfo(const StreamInfo &info)=0 (defined in shaka::media::WebVttOutputHandler)shaka::media::WebVttOutputHandlerprotectedpure virtual
        OnTextSample(const TextSample &sample)=0 (defined in shaka::media::WebVttOutputHandler)shaka::media::WebVttOutputHandlerprotectedpure virtual
        output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
        SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
        ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
        WebVttOutputHandler()=default (defined in shaka::media::WebVttOutputHandler)shaka::media::WebVttOutputHandler
        WriteCue(const std::string &id, uint64_t start, uint64_t end, const std::string &settings, const std::string &payload) (defined in shaka::media::WebVttOutputHandler)shaka::media::WebVttOutputHandlerprotected
        WriteSegmentToFile(const std::string &filename) (defined in shaka::media::WebVttOutputHandler)shaka::media::WebVttOutputHandlerprotected
        ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
        ~WebVttOutputHandler()=default (defined in shaka::media::WebVttOutputHandler)shaka::media::WebVttOutputHandlervirtual
        - - - - diff --git a/docs/df/dce/classshaka_1_1hls_1_1MockMediaPlaylist-members.html b/docs/df/dce/classshaka_1_1hls_1_1MockMediaPlaylist-members.html index e872293258..36f13ada46 100644 --- a/docs/df/dce/classshaka_1_1hls_1_1MockMediaPlaylist-members.html +++ b/docs/df/dce/classshaka_1_1hls_1_1MockMediaPlaylist-members.html @@ -109,7 +109,7 @@ $(function() { diff --git a/docs/df/dd2/mpd__utils_8h_source.html b/docs/df/dd2/mpd__utils_8h_source.html index f3d11718ec..365370fd9b 100644 --- a/docs/df/dd2/mpd__utils_8h_source.html +++ b/docs/df/dd2/mpd__utils_8h_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/df/dd2/structshaka_1_1media_1_1H264Pps-members.html b/docs/df/dd2/structshaka_1_1media_1_1H264Pps-members.html index e9ed5fbeea..98c251f540 100644 --- a/docs/df/dd2/structshaka_1_1media_1_1H264Pps-members.html +++ b/docs/df/dd2/structshaka_1_1media_1_1H264Pps-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/docs/df/ddc/structshaka_1_1MpdParams.html b/docs/df/ddc/structshaka_1_1MpdParams.html index e03447791a..cbbe4a30ba 100644 --- a/docs/df/ddc/structshaka_1_1MpdParams.html +++ b/docs/df/ddc/structshaka_1_1MpdParams.html @@ -293,7 +293,7 @@ Static Public Attributes diff --git a/docs/df/ddc/webm_2segmenter_8h_source.html b/docs/df/ddc/webm_2segmenter_8h_source.html index 9ce814347b..bf8e82e89d 100644 --- a/docs/df/ddc/webm_2segmenter_8h_source.html +++ b/docs/df/ddc/webm_2segmenter_8h_source.html @@ -93,7 +93,7 @@ $(function() { diff --git a/docs/df/dde/ts__section__psi_8cc_source.html b/docs/df/dde/ts__section__psi_8cc_source.html index 0d1e31f8b4..1eac21b8b4 100644 --- a/docs/df/dde/ts__section__psi_8cc_source.html +++ b/docs/df/dde/ts__section__psi_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/df/de2/structshaka_1_1media_1_1H264SEIRecoveryPoint.html b/docs/df/de2/structshaka_1_1media_1_1H264SEIRecoveryPoint.html index 47b7d4b011..41ff8361df 100644 --- a/docs/df/de2/structshaka_1_1media_1_1H264SEIRecoveryPoint.html +++ b/docs/df/de2/structshaka_1_1media_1_1H264SEIRecoveryPoint.html @@ -94,7 +94,7 @@ int changing_slice_group_i diff --git a/docs/df/de3/text__track__config_8cc_source.html b/docs/df/de3/text__track__config_8cc_source.html index 87768e2532..a8a4e64921 100644 --- a/docs/df/de3/text__track__config_8cc_source.html +++ b/docs/df/de3/text__track__config_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/df/de9/segment__info_8h_source.html b/docs/df/de9/segment__info_8h_source.html index 164e0e8705..02217639b5 100644 --- a/docs/df/de9/segment__info_8h_source.html +++ b/docs/df/de9/segment__info_8h_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/df/df1/structshaka_1_1ContentProtectionElement-members.html b/docs/df/df1/structshaka_1_1ContentProtectionElement-members.html index e86b3e7437..ab3f7721a1 100644 --- a/docs/df/df1/structshaka_1_1ContentProtectionElement-members.html +++ b/docs/df/df1/structshaka_1_1ContentProtectionElement-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/df/dfc/playready__key__encryption__flags_8cc_source.html b/docs/df/dfc/playready__key__encryption__flags_8cc_source.html index 995f160550..955f3692e4 100644 --- a/docs/df/dfc/playready__key__encryption__flags_8cc_source.html +++ b/docs/df/dfc/playready__key__encryption__flags_8cc_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/dir_1338cd99faf71b6cb1609e99e3340e45.html b/docs/dir_1338cd99faf71b6cb1609e99e3340e45.html index 9e766a5a22..1fde9356df 100644 --- a/docs/dir_1338cd99faf71b6cb1609e99e3340e45.html +++ b/docs/dir_1338cd99faf71b6cb1609e99e3340e45.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_35c1fdffcdd4ade6d7f948073ab165de.html b/docs/dir_35c1fdffcdd4ade6d7f948073ab165de.html index 0549232ec8..d1e197c704 100644 --- a/docs/dir_35c1fdffcdd4ade6d7f948073ab165de.html +++ b/docs/dir_35c1fdffcdd4ade6d7f948073ab165de.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_375ba2cfd8fd5b05c50b92d996b9d386.html b/docs/dir_375ba2cfd8fd5b05c50b92d996b9d386.html index b31cf8baf0..00232b55d6 100644 --- a/docs/dir_375ba2cfd8fd5b05c50b92d996b9d386.html +++ b/docs/dir_375ba2cfd8fd5b05c50b92d996b9d386.html @@ -73,7 +73,7 @@ Directories diff --git a/docs/dir_3f8eec2fc361645de4b1ec14c19fffc7.html b/docs/dir_3f8eec2fc361645de4b1ec14c19fffc7.html index 624d655732..faad15e44e 100644 --- a/docs/dir_3f8eec2fc361645de4b1ec14c19fffc7.html +++ b/docs/dir_3f8eec2fc361645de4b1ec14c19fffc7.html @@ -79,7 +79,7 @@ Directories diff --git a/docs/dir_48fdaa95ed78e499807eaa909d50b2cd.html b/docs/dir_48fdaa95ed78e499807eaa909d50b2cd.html index 5db6da3287..39812c4842 100644 --- a/docs/dir_48fdaa95ed78e499807eaa909d50b2cd.html +++ b/docs/dir_48fdaa95ed78e499807eaa909d50b2cd.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_51897ee7df8868b4f901d3ff10922ac3.html b/docs/dir_51897ee7df8868b4f901d3ff10922ac3.html index 4e74c777ef..3e89d0671e 100644 --- a/docs/dir_51897ee7df8868b4f901d3ff10922ac3.html +++ b/docs/dir_51897ee7df8868b4f901d3ff10922ac3.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_588b87f799233a7c3afc1168633bb252.html b/docs/dir_588b87f799233a7c3afc1168633bb252.html index f8dd549bb0..e3fdf3a9f6 100644 --- a/docs/dir_588b87f799233a7c3afc1168633bb252.html +++ b/docs/dir_588b87f799233a7c3afc1168633bb252.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_64597db6ac7a9160e951a4226a03f10e.html b/docs/dir_64597db6ac7a9160e951a4226a03f10e.html index 1ab3391028..0ccd223042 100644 --- a/docs/dir_64597db6ac7a9160e951a4226a03f10e.html +++ b/docs/dir_64597db6ac7a9160e951a4226a03f10e.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_65bafb41b3669ba481c8da543a696a08.html b/docs/dir_65bafb41b3669ba481c8da543a696a08.html index 815afccd25..99e8aa543e 100644 --- a/docs/dir_65bafb41b3669ba481c8da543a696a08.html +++ b/docs/dir_65bafb41b3669ba481c8da543a696a08.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_6fe4b0529cd3ec97045d3314254a0cce.html b/docs/dir_6fe4b0529cd3ec97045d3314254a0cce.html index 11ed6f2677..8d0fc0040d 100644 --- a/docs/dir_6fe4b0529cd3ec97045d3314254a0cce.html +++ b/docs/dir_6fe4b0529cd3ec97045d3314254a0cce.html @@ -73,7 +73,7 @@ Directories diff --git a/docs/dir_7053349436b45d276056de3c928a6fc6.html b/docs/dir_7053349436b45d276056de3c928a6fc6.html index f495146d04..c1b46fd4d3 100644 --- a/docs/dir_7053349436b45d276056de3c928a6fc6.html +++ b/docs/dir_7053349436b45d276056de3c928a6fc6.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_7fa7c3de4a91b9652697b9f1c2d38e70.html b/docs/dir_7fa7c3de4a91b9652697b9f1c2d38e70.html index a6da59f3c4..631c81e22d 100644 --- a/docs/dir_7fa7c3de4a91b9652697b9f1c2d38e70.html +++ b/docs/dir_7fa7c3de4a91b9652697b9f1c2d38e70.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_83c56f445d5c796bd14e4ebf939c29ad.html b/docs/dir_83c56f445d5c796bd14e4ebf939c29ad.html index c34aacc359..2737493849 100644 --- a/docs/dir_83c56f445d5c796bd14e4ebf939c29ad.html +++ b/docs/dir_83c56f445d5c796bd14e4ebf939c29ad.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_880f0837661bea0e588ff6a42c226fba.html b/docs/dir_880f0837661bea0e588ff6a42c226fba.html index 03329ebf8f..83b0363057 100644 --- a/docs/dir_880f0837661bea0e588ff6a42c226fba.html +++ b/docs/dir_880f0837661bea0e588ff6a42c226fba.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_89aadd87adc268d697d42604fc1bbfe1.html b/docs/dir_89aadd87adc268d697d42604fc1bbfe1.html index 0e6fbc7527..df9cbcb0cb 100644 --- a/docs/dir_89aadd87adc268d697d42604fc1bbfe1.html +++ b/docs/dir_89aadd87adc268d697d42604fc1bbfe1.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_933242dc2ed3ec7a82c146e98110781e.html b/docs/dir_933242dc2ed3ec7a82c146e98110781e.html index 9832dc975e..9749d411ee 100644 --- a/docs/dir_933242dc2ed3ec7a82c146e98110781e.html +++ b/docs/dir_933242dc2ed3ec7a82c146e98110781e.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_aa847bee70cdde822696c7e33a504139.html b/docs/dir_aa847bee70cdde822696c7e33a504139.html index 01a1868704..688d7df7f1 100644 --- a/docs/dir_aa847bee70cdde822696c7e33a504139.html +++ b/docs/dir_aa847bee70cdde822696c7e33a504139.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_ae142483ff91a68c468a97c037f98d4d.html b/docs/dir_ae142483ff91a68c468a97c037f98d4d.html index bfdaa90262..b03707a25a 100644 --- a/docs/dir_ae142483ff91a68c468a97c037f98d4d.html +++ b/docs/dir_ae142483ff91a68c468a97c037f98d4d.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_b23f8e22c8c095d1c8c0cb8f88104a00.html b/docs/dir_b23f8e22c8c095d1c8c0cb8f88104a00.html index 7f8b51b56c..095614f8b7 100644 --- a/docs/dir_b23f8e22c8c095d1c8c0cb8f88104a00.html +++ b/docs/dir_b23f8e22c8c095d1c8c0cb8f88104a00.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_b7f276137d53b05d7f6b34219adc0a31.html b/docs/dir_b7f276137d53b05d7f6b34219adc0a31.html index 392c21a2b2..c76a273d39 100644 --- a/docs/dir_b7f276137d53b05d7f6b34219adc0a31.html +++ b/docs/dir_b7f276137d53b05d7f6b34219adc0a31.html @@ -73,7 +73,7 @@ Directories diff --git a/docs/dir_b885194e7131202a9b4650a8967e838c.html b/docs/dir_b885194e7131202a9b4650a8967e838c.html index 3a609d8e28..14dde1e9c5 100644 --- a/docs/dir_b885194e7131202a9b4650a8967e838c.html +++ b/docs/dir_b885194e7131202a9b4650a8967e838c.html @@ -73,7 +73,7 @@ Directories diff --git a/docs/dir_b8a35a7f00287a46b0da66a108ec1239.html b/docs/dir_b8a35a7f00287a46b0da66a108ec1239.html index 68974c6163..0a4c4ddfe9 100644 --- a/docs/dir_b8a35a7f00287a46b0da66a108ec1239.html +++ b/docs/dir_b8a35a7f00287a46b0da66a108ec1239.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_bf7f1d16febc509cca62cff27fb88644.html b/docs/dir_bf7f1d16febc509cca62cff27fb88644.html index a83bc644f5..28efacfff3 100644 --- a/docs/dir_bf7f1d16febc509cca62cff27fb88644.html +++ b/docs/dir_bf7f1d16febc509cca62cff27fb88644.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_c41da90e13af52a77978e497cf9cac63.html b/docs/dir_c41da90e13af52a77978e497cf9cac63.html index fce860e203..bedb5e846b 100644 --- a/docs/dir_c41da90e13af52a77978e497cf9cac63.html +++ b/docs/dir_c41da90e13af52a77978e497cf9cac63.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_c727d19e3a8f99ea2539fb71bdb2ad10.html b/docs/dir_c727d19e3a8f99ea2539fb71bdb2ad10.html index 5861ddc1c8..847f5543a3 100644 --- a/docs/dir_c727d19e3a8f99ea2539fb71bdb2ad10.html +++ b/docs/dir_c727d19e3a8f99ea2539fb71bdb2ad10.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_d258fb6e36cbaad69b44b6c9489b2bbb.html b/docs/dir_d258fb6e36cbaad69b44b6c9489b2bbb.html index 9aaca94cd7..c5ccb851c1 100644 --- a/docs/dir_d258fb6e36cbaad69b44b6c9489b2bbb.html +++ b/docs/dir_d258fb6e36cbaad69b44b6c9489b2bbb.html @@ -73,7 +73,7 @@ Directories diff --git a/docs/dir_e329e4913ca1adf6e112c00fbb0d634f.html b/docs/dir_e329e4913ca1adf6e112c00fbb0d634f.html index f37ee0bcc5..777648190a 100644 --- a/docs/dir_e329e4913ca1adf6e112c00fbb0d634f.html +++ b/docs/dir_e329e4913ca1adf6e112c00fbb0d634f.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_e3bda0bde998a4d5063328245b9909be.html b/docs/dir_e3bda0bde998a4d5063328245b9909be.html index e76ccfb031..c89d7ec875 100644 --- a/docs/dir_e3bda0bde998a4d5063328245b9909be.html +++ b/docs/dir_e3bda0bde998a4d5063328245b9909be.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_f74090996960c752a82246b98a23aa62.html b/docs/dir_f74090996960c752a82246b98a23aa62.html index c44f29ddfb..0f5f6d3346 100644 --- a/docs/dir_f74090996960c752a82246b98a23aa62.html +++ b/docs/dir_f74090996960c752a82246b98a23aa62.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/dir_f99dae54fe7170f791f339b952d5067a.html b/docs/dir_f99dae54fe7170f791f339b952d5067a.html index 8636835b16..7df64b1711 100644 --- a/docs/dir_f99dae54fe7170f791f339b952d5067a.html +++ b/docs/dir_f99dae54fe7170f791f339b952d5067a.html @@ -75,7 +75,7 @@ Directories diff --git a/docs/dir_ffb529e2a1792bf603304ea6ff9bf092.html b/docs/dir_ffb529e2a1792bf603304ea6ff9bf092.html index 45e5586c55..28d34b1836 100644 --- a/docs/dir_ffb529e2a1792bf603304ea6ff9bf092.html +++ b/docs/dir_ffb529e2a1792bf603304ea6ff9bf092.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/files.html b/docs/files.html index 69f44be44d..1579d7830d 100644 --- a/docs/files.html +++ b/docs/files.html @@ -466,14 +466,16 @@ $(function() {  text_padder.h  text_readers.cc  text_readers.h - webvtt_output_handler.cc - webvtt_output_handler.h + webvtt_file_buffer.cc + webvtt_file_buffer.h  webvtt_parser.cc  webvtt_parser.h - webvtt_timestamp.cc - webvtt_timestamp.h - webvtt_to_mp4_handler.cc - webvtt_to_mp4_handler.h + webvtt_text_output_handler.cc + webvtt_text_output_handler.h + webvtt_timestamp.cc + webvtt_timestamp.h + webvtt_to_mp4_handler.cc + webvtt_to_mp4_handler.h   wvm  wvm_media_parser.cc  wvm_media_parser.h @@ -538,7 +540,7 @@ $(function() { diff --git a/docs/functions.html b/docs/functions.html index d82ac62f91..8780e5eed9 100644 --- a/docs/functions.html +++ b/docs/functions.html @@ -224,7 +224,7 @@ $(function() { diff --git a/docs/functions_0x7e.html b/docs/functions_0x7e.html index ce1f840fca..8b6f611f25 100644 --- a/docs/functions_0x7e.html +++ b/docs/functions_0x7e.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/functions_b.html b/docs/functions_b.html index 11229fe402..4fc018f966 100644 --- a/docs/functions_b.html +++ b/docs/functions_b.html @@ -199,7 +199,7 @@ $(function() { diff --git a/docs/functions_c.html b/docs/functions_c.html index e7f1208526..6fbea59006 100644 --- a/docs/functions_c.html +++ b/docs/functions_c.html @@ -230,7 +230,7 @@ $(function() { diff --git a/docs/functions_d.html b/docs/functions_d.html index a007672826..d76b25669b 100644 --- a/docs/functions_d.html +++ b/docs/functions_d.html @@ -147,7 +147,7 @@ $(function() { diff --git a/docs/functions_e.html b/docs/functions_e.html index edd741b9ea..f56235e895 100644 --- a/docs/functions_e.html +++ b/docs/functions_e.html @@ -86,7 +86,7 @@ $(function() { diff --git a/docs/functions_enum.html b/docs/functions_enum.html index a74fcb948f..542a9593aa 100644 --- a/docs/functions_enum.html +++ b/docs/functions_enum.html @@ -66,7 +66,7 @@ $(function() { diff --git a/docs/functions_eval.html b/docs/functions_eval.html index 90f34e960d..197b989d63 100644 --- a/docs/functions_eval.html +++ b/docs/functions_eval.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/functions_f.html b/docs/functions_f.html index 27315f0b97..a6794e9388 100644 --- a/docs/functions_f.html +++ b/docs/functions_f.html @@ -137,7 +137,7 @@ $(function() { diff --git a/docs/functions_func.html b/docs/functions_func.html index be29348466..bb8f504d01 100644 --- a/docs/functions_func.html +++ b/docs/functions_func.html @@ -218,7 +218,7 @@ $(function() { diff --git a/docs/functions_func_0x7e.html b/docs/functions_func_0x7e.html index a28dd1a1b5..605bd42135 100644 --- a/docs/functions_func_0x7e.html +++ b/docs/functions_func_0x7e.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/functions_func_b.html b/docs/functions_func_b.html index dae0551ec7..ef1219784f 100644 --- a/docs/functions_func_b.html +++ b/docs/functions_func_b.html @@ -186,7 +186,7 @@ $(function() { diff --git a/docs/functions_func_c.html b/docs/functions_func_c.html index 57f33ffd3c..f7c0fd8efc 100644 --- a/docs/functions_func_c.html +++ b/docs/functions_func_c.html @@ -206,7 +206,7 @@ $(function() { diff --git a/docs/functions_func_d.html b/docs/functions_func_d.html index 77cf3249f0..38b5f5b447 100644 --- a/docs/functions_func_d.html +++ b/docs/functions_func_d.html @@ -134,7 +134,7 @@ $(function() { diff --git a/docs/functions_func_e.html b/docs/functions_func_e.html index 0760bee676..e5026a4f39 100644 --- a/docs/functions_func_e.html +++ b/docs/functions_func_e.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/functions_func_f.html b/docs/functions_func_f.html index 5cfa9a9ff3..5da2345812 100644 --- a/docs/functions_func_f.html +++ b/docs/functions_func_f.html @@ -137,7 +137,7 @@ $(function() { diff --git a/docs/functions_func_g.html b/docs/functions_func_g.html index 30d5c4d4d4..5cdf0478eb 100644 --- a/docs/functions_func_g.html +++ b/docs/functions_func_g.html @@ -265,7 +265,7 @@ $(function() { diff --git a/docs/functions_func_h.html b/docs/functions_func_h.html index 93b710081a..778e6e2107 100644 --- a/docs/functions_func_h.html +++ b/docs/functions_func_h.html @@ -111,7 +111,7 @@ $(function() { diff --git a/docs/functions_func_i.html b/docs/functions_func_i.html index e80986e45f..9a28ebfe35 100644 --- a/docs/functions_func_i.html +++ b/docs/functions_func_i.html @@ -174,7 +174,7 @@ $(function() { diff --git a/docs/functions_func_l.html b/docs/functions_func_l.html index e1c9c9caae..8c3ecc1673 100644 --- a/docs/functions_func_l.html +++ b/docs/functions_func_l.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/functions_func_m.html b/docs/functions_func_m.html index 64d58023ab..64804f2a35 100644 --- a/docs/functions_func_m.html +++ b/docs/functions_func_m.html @@ -101,7 +101,7 @@ $(function() { diff --git a/docs/functions_func_n.html b/docs/functions_func_n.html index e34862833f..9e23be34a7 100644 --- a/docs/functions_func_n.html +++ b/docs/functions_func_n.html @@ -132,7 +132,7 @@ $(function() { diff --git a/docs/functions_func_o.html b/docs/functions_func_o.html index 1513a31685..54c0ec2a34 100644 --- a/docs/functions_func_o.html +++ b/docs/functions_func_o.html @@ -87,7 +87,6 @@ $(function() { , shaka::media::FakeMediaHandler , shaka::media::MediaHandler , shaka::media::Muxer -, shaka::media::WebVttToMp4Handler
      • OnKeyFrame() : shaka::media::CombinedMuxerListener @@ -141,7 +140,7 @@ $(function() {
      • Open() : shaka::CallbackFile -, shaka::File +, shaka::File , shaka::LocalFile , shaka::media::FileReader , shaka::media::MkvWriter @@ -165,7 +164,7 @@ $(function() { diff --git a/docs/functions_func_p.html b/docs/functions_func_p.html index 41e06b6622..8a943cb07f 100644 --- a/docs/functions_func_p.html +++ b/docs/functions_func_p.html @@ -151,7 +151,7 @@ $(function() { : shaka::media::mp4::BoxBuffer
      • Position() -: shaka::media::MkvWriter +: shaka::media::MkvWriter
      • Post() : shaka::media::HttpKeyFetcher @@ -166,10 +166,9 @@ $(function() { , shaka::media::FakeMediaHandler , shaka::media::MediaHandler , shaka::media::Muxer -, shaka::media::WebVttToMp4Handler
      • ProducerConsumerQueue() -: shaka::media::ProducerConsumerQueue< T > +: shaka::media::ProducerConsumerQueue< T >
      • PromoteAt() : shaka::media::SyncPointQueue @@ -188,7 +187,7 @@ $(function() { diff --git a/docs/functions_func_r.html b/docs/functions_func_r.html index 401345b836..a1cefc5b19 100644 --- a/docs/functions_func_r.html +++ b/docs/functions_func_r.html @@ -141,7 +141,7 @@ $(function() { diff --git a/docs/functions_func_s.html b/docs/functions_func_s.html index 7e2e5ff8b8..04d9a07977 100644 --- a/docs/functions_func_s.html +++ b/docs/functions_func_s.html @@ -102,6 +102,9 @@ $(function() {
      • segment_buffer() : shaka::media::PackedAudioSegmenter
      • +
      • set_allow_adjust_earliest_presentation_time() +: shaka::media::mp4::Fragmenter +
      • set_clock() : shaka::media::Muxer
      • @@ -260,7 +263,7 @@ $(function() { : shaka::media::NaluReader
      • Status() -: shaka::Status +: shaka::Status
      • Stop() : shaka::media::ProducerConsumerQueue< T > @@ -287,7 +290,7 @@ $(function() { diff --git a/docs/functions_func_t.html b/docs/functions_func_t.html index 11d531c5b5..f49858ed45 100644 --- a/docs/functions_func_t.html +++ b/docs/functions_func_t.html @@ -123,7 +123,7 @@ $(function() { diff --git a/docs/functions_func_u.html b/docs/functions_func_u.html index 0fbd1d3be9..d13c7223b8 100644 --- a/docs/functions_func_u.html +++ b/docs/functions_func_u.html @@ -88,7 +88,7 @@ $(function() { diff --git a/docs/functions_func_v.html b/docs/functions_func_v.html index 190718ecd6..b4e8594f9c 100644 --- a/docs/functions_func_v.html +++ b/docs/functions_func_v.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/functions_func_w.html b/docs/functions_func_w.html index c85cff6945..13be0e1cdf 100644 --- a/docs/functions_func_w.html +++ b/docs/functions_func_w.html @@ -138,7 +138,7 @@ $(function() { diff --git a/docs/functions_func_x.html b/docs/functions_func_x.html index a9e062ead8..92ee18624f 100644 --- a/docs/functions_func_x.html +++ b/docs/functions_func_x.html @@ -68,7 +68,7 @@ $(function() { diff --git a/docs/functions_g.html b/docs/functions_g.html index 3dab193564..bc686e3efd 100644 --- a/docs/functions_g.html +++ b/docs/functions_g.html @@ -283,7 +283,7 @@ $(function() { diff --git a/docs/functions_h.html b/docs/functions_h.html index c58a8e4b70..eae16b7e44 100644 --- a/docs/functions_h.html +++ b/docs/functions_h.html @@ -124,7 +124,7 @@ $(function() { diff --git a/docs/functions_i.html b/docs/functions_i.html index b07a93edf9..a43d536659 100644 --- a/docs/functions_i.html +++ b/docs/functions_i.html @@ -194,7 +194,7 @@ $(function() { diff --git a/docs/functions_k.html b/docs/functions_k.html index 08e6419320..efc34b211d 100644 --- a/docs/functions_k.html +++ b/docs/functions_k.html @@ -119,7 +119,7 @@ $(function() { diff --git a/docs/functions_l.html b/docs/functions_l.html index 4c1fbe1f15..2b59efadd4 100644 --- a/docs/functions_l.html +++ b/docs/functions_l.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/functions_m.html b/docs/functions_m.html index 3026fb77d3..b236f34faf 100644 --- a/docs/functions_m.html +++ b/docs/functions_m.html @@ -122,7 +122,7 @@ $(function() { diff --git a/docs/functions_n.html b/docs/functions_n.html index 5b396a571f..89d512fd96 100644 --- a/docs/functions_n.html +++ b/docs/functions_n.html @@ -135,7 +135,7 @@ $(function() { diff --git a/docs/functions_o.html b/docs/functions_o.html index 149b4a5131..edc3f8ed6c 100644 --- a/docs/functions_o.html +++ b/docs/functions_o.html @@ -87,7 +87,6 @@ $(function() { , shaka::media::FakeMediaHandler , shaka::media::MediaHandler , shaka::media::Muxer -, shaka::media::WebVttToMp4Handler
      • OnKeyFrame() : shaka::media::CombinedMuxerListener @@ -141,7 +140,7 @@ $(function() {
      • Open() : shaka::CallbackFile -, shaka::File +, shaka::File , shaka::LocalFile , shaka::media::FileReader , shaka::media::MkvWriter @@ -158,6 +157,9 @@ $(function() {
      • output : shaka::StreamDescriptor
      • +
      • output_file_index +: shaka::media::MuxerOptions +
      • output_file_name : shaka::media::MuxerOptions
      • @@ -177,7 +179,7 @@ $(function() { diff --git a/docs/functions_p.html b/docs/functions_p.html index 3eb6a9938d..df8772416c 100644 --- a/docs/functions_p.html +++ b/docs/functions_p.html @@ -179,7 +179,6 @@ $(function() { , shaka::media::FakeMediaHandler , shaka::media::MediaHandler , shaka::media::Muxer -, shaka::media::WebVttToMp4Handler
      • ProducerConsumerQueue() : shaka::media::ProducerConsumerQueue< T > @@ -207,7 +206,7 @@ $(function() { diff --git a/docs/functions_r.html b/docs/functions_r.html index cc9f01e4ec..26f598da67 100644 --- a/docs/functions_r.html +++ b/docs/functions_r.html @@ -144,7 +144,7 @@ $(function() { diff --git a/docs/functions_rela.html b/docs/functions_rela.html index cee08c126a..485482abe8 100644 --- a/docs/functions_rela.html +++ b/docs/functions_rela.html @@ -66,7 +66,7 @@ $(function() { diff --git a/docs/functions_s.html b/docs/functions_s.html index 3dae1b4c18..9186955531 100644 --- a/docs/functions_s.html +++ b/docs/functions_s.html @@ -115,6 +115,9 @@ $(function() { : shaka::media::MuxerOptions , shaka::StreamDescriptor
      • +
      • set_allow_adjust_earliest_presentation_time() +: shaka::media::mp4::Fragmenter +
      • set_clock() : shaka::media::Muxer
      • @@ -332,7 +335,7 @@ $(function() { diff --git a/docs/functions_t.html b/docs/functions_t.html index 6ff2f5d313..ba5b8f75c0 100644 --- a/docs/functions_t.html +++ b/docs/functions_t.html @@ -137,7 +137,7 @@ $(function() { diff --git a/docs/functions_type.html b/docs/functions_type.html index cc893aeee4..4f395a4637 100644 --- a/docs/functions_type.html +++ b/docs/functions_type.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/functions_u.html b/docs/functions_u.html index 7eface96ce..5c516cb4fd 100644 --- a/docs/functions_u.html +++ b/docs/functions_u.html @@ -91,7 +91,7 @@ $(function() { diff --git a/docs/functions_v.html b/docs/functions_v.html index 3d50a56de0..30a87c528b 100644 --- a/docs/functions_v.html +++ b/docs/functions_v.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/functions_vars.html b/docs/functions_vars.html index cb3036d588..c7d5ee6b47 100644 --- a/docs/functions_vars.html +++ b/docs/functions_vars.html @@ -288,6 +288,9 @@ $(function() {
      • output : shaka::StreamDescriptor
      • +
      • output_file_index +: shaka::media::MuxerOptions +
      • output_file_name : shaka::media::MuxerOptions
      • @@ -415,7 +418,7 @@ $(function() { diff --git a/docs/functions_w.html b/docs/functions_w.html index fbf586e3ad..2501ae24c6 100644 --- a/docs/functions_w.html +++ b/docs/functions_w.html @@ -141,7 +141,7 @@ $(function() { diff --git a/docs/functions_x.html b/docs/functions_x.html index 6b9796da70..0223bf1b75 100644 --- a/docs/functions_x.html +++ b/docs/functions_x.html @@ -68,7 +68,7 @@ $(function() { diff --git a/docs/hierarchy.html b/docs/hierarchy.html index 26e52ad013..a7b28461e3 100644 --- a/docs/hierarchy.html +++ b/docs/hierarchy.html @@ -188,232 +188,231 @@ $(function() {  Cshaka::DecryptionParamsDecryption parameters  Cshaka::media::DecryptorSourceDecryptorSource wraps KeySource and is responsible for decryptor management  Cshaka::media::wvm::DemuxStreamIdMediaSample - Cshaka::media::DisplayActionCompare - Cshaka::media::mp4::EditListEntry - Cshaka::Element - Cshaka::EncryptionParams::EncryptedStreamAttributesEncrypted stream information that is used to determine stream label - Cshaka::media::EncryptionConfig - Cshaka::media::EncryptionKey - Cshaka::EncryptionParamsEncryption parameters - Cshaka::media::ESDescriptor - Cshaka::media::mp2t::EsParser - Cshaka::media::mp2t::EsParserAudio - Cshaka::media::mp2t::EsParserH26x - Cshaka::media::mp2t::EsParserH264 - Cshaka::media::mp2t::EsParserH265 - Cshaka::media::EventInfo - Cshaka::FileDefine an abstract file interface - Cshaka::CallbackFile - Cshaka::LocalFileImplement LocalFile which deals with local storage - Cshaka::MemoryFile - Cshaka::ThreadedIoFileDeclaration of class which implements a thread-safe circular buffer - Cshaka::UdpFileImplements UdpFile, which receives UDP unicast and multicast streams - Cshaka::FileCloser - Cshaka::media::FileReaderClass to read character-by-character from a file - Cshaka::media::mp4::Fragmenter - Cshaka::media::H264DecRefPicMarking - Cshaka::media::H264ModificationOfPicNum - Cshaka::media::H264Parser - Cshaka::media::H264Pps - Cshaka::media::H264SEIMessage - Cshaka::media::H264SEIRecoveryPoint - Cshaka::media::H264SliceHeader - Cshaka::media::H264Sps - Cshaka::media::H264WeightingFactors - Cshaka::media::H265Parser - Cshaka::media::H265Pps - Cshaka::media::H265ReferencePictureListModifications - Cshaka::media::H265ReferencePictureSet - Cshaka::media::H265SliceHeader - Cshaka::media::H265Sps - Cshaka::media::H265VuiParameters - Cshaka::media::H26xBitReader - Cshaka::media::H26xByteToUnitStreamConverterA base class that is used to convert H.26x byte streams to NAL unit streams - Cshaka::media::H264ByteToUnitStreamConverter - Cshaka::media::H265ByteToUnitStreamConverter - Cshaka::hls::HlsEntry - Cshaka::hls::HlsNotifier - Cshaka::hls::SimpleHlsNotifierThis is thread safe - Cshaka::HlsParamsHLS related parameters - Cshaka::media::Id3Tag - CIMkvWriter - Cshaka::media::MkvWriterAn implementation of IMkvWriter using our File type - Cshaka::IoCacheDeclaration of class which implements a thread-safe circular buffer - Cshaka::media::JobManager - Cshaka::media::KeyFetcherBase class for fetching keys from the license service - Cshaka::media::HttpKeyFetcher - Cshaka::media::KeyFrameEvent - Cshaka::media::mp4::KeyFrameInfoTracks key frame information - Cshaka::RawKeyParams::KeyInfo - Cshaka::media::KeySourceKeySource is responsible for encryption key acquisition - Cshaka::media::PlayReadyKeySourceA key source that uses playready for encryption - Cshaka::media::RawKeySourceA key source that uses raw keys for encryption - Cshaka::media::WidevineKeySource - Cshaka::media::mp4::Language - Cshaka::media::LibcryptoThreadingConvenience class which initializes and terminates libcrypto threading - Cshaka::media::LineReader - Cshaka::media::H265SliceHeader::LongTermPicsInfo - Cshaka::hls::MasterPlaylist - Cshaka::media::MediaHandler - Cshaka::media::AdCueGeneratorAdCueGenerator converts out of band cuepoint markers into SCTE-35 events - Cshaka::media::ChunkingHandler - Cshaka::media::CueAlignmentHandler - Cshaka::media::EncryptionHandler - Cshaka::media::FakeInputMediaHandler - Cshaka::media::FakeMediaHandler - Cshaka::media::MockOutputMediaHandler - Cshaka::media::Muxer - Cshaka::media::mp2t::TsMuxer - Cshaka::media::mp4::MP4Muxer - Cshaka::media::PackedAudioWriter - Cshaka::media::webm::WebMMuxerImplements WebM Muxer - Cshaka::media::OriginHandler - Cshaka::media::Demuxer - Cshaka::media::WebVttParser - Cshaka::media::Replicator - Cshaka::media::TextChunker - Cshaka::media::TextPadder - Cshaka::media::TrickPlayHandler - Cshaka::media::WebVttOutputHandler - Cshaka::media::WebVttSegmentedOutputHandler - Cshaka::media::WebVttToMp4Handler - Cshaka::media::MediaParser - Cshaka::media::mp2t::Mp2tMediaParser - Cshaka::media::mp4::MP4MediaParser - Cshaka::media::WebMMediaParser - Cshaka::media::wvm::WvmMediaParser - Cshaka::hls::MediaPlaylistMethods are virtual for mocking - Cshaka::hls::MockMediaPlaylist - Cshaka::hls::MediaPlaylistFactory - Cshaka::media::MuxerListener::MediaRanges - Cshaka::media::MediaSampleClass to hold a media sample - Cshaka::Mp4OutputParamsMP4 (ISO-BMFF) output related parameters - Cshaka::MpdBuilderThis class generates DASH MPDs (Media Presentation Descriptions) - Cshaka::MockMpdBuilder - Cshaka::MpdNotifier - Cshaka::MockMpdNotifier - Cshaka::SimpleMpdNotifier - Cshaka::MpdNotifierFactory - Cshaka::MpdOptionsDefines Mpd Options - Cshaka::MpdParamsDASH MPD related parameters - Cshaka::MpdWriter - Cshaka::media::MuxerFactory - Cshaka::media::MuxerListener - Cshaka::media::CombinedMuxerListener - Cshaka::media::HlsNotifyMuxerListenerMuxerListener that uses HlsNotifier - Cshaka::media::MockMuxerListener - Cshaka::media::MpdNotifyMuxerListener - Cshaka::media::VodMediaInfoDumpMuxerListener - Cshaka::media::MuxerListenerFactory - Cshaka::media::MuxerOptionsThis structure contains the list of configuration options for Muxer - Cshaka::media::Nalu - Cshaka::media::NalUnitToByteStreamConverter - Cshaka::media::NaluReader - Cshaka::media::OffsetByteQueue - Cshaka::EncryptionParams::EncryptedStreamAttributes::OneOf - Cshaka::media::OnMediaEndParameters - Cshaka::media::OnNewSegmentParameters - Cshaka::Packager - Cshaka::PackagingParamsPackaging parameters - Cshaka::media::PackedAudioSegmenter - Cshaka::media::PeekingReader - Cshaka::Period - Cshaka::MockPeriod - Cshaka::media::mp2t::PesPacketClass that carries PES packet information - Cshaka::media::mp2t::PesPacketGenerator - Cshaka::PlayReadyEncryptionParams - Cshaka::media::wvm::PrevSampleData - Cshaka::media::ProducerConsumerQueue< T > - Cshaka::media::mp2t::ProgramMapTableWriterPuts PMT into TS packets and writes them to buffer - Cshaka::media::mp2t::AudioProgramMapTableWriterProgramMapTableWriter for video codecs - Cshaka::media::mp2t::VideoProgramMapTableWriterProgramMapTableWriter for video codecs - Cshaka::media::ProgressListenerThis class listens to progress updates events - Cshaka::media::ProtectionSystemSpecificInfo - Cshaka::media::PsshBoxBuilder - Cshaka::media::PsshGenerator - Cshaka::media::PlayReadyPsshGenerator - Cshaka::media::RawKeyPsshGenerator - Cshaka::media::WidevinePsshGenerator - Cshaka::media::Range - Cshaka::RawKeyParamsRaw key encryption/decryption parameters, i.e. with key parameters provided - Cshaka::Representation - Cshaka::MockRepresentation - Cshaka::RepresentationStateChangeListener - Cshaka::media::RequestSignerAbstract class used for signature generation - Cshaka::media::AesRequestSignerAesRequestSigner uses AES-CBC signing - Cshaka::media::RsaRequestSignerRsaRequestSigner uses RSA-PSS signing - Cshaka::media::RsaPrivateKeyRsa private key, used for message signing and decryption - Cshaka::media::RsaPublicKeyRsa public key, used for signature verification and encryption - Cshaka::media::mp4::SampleEncryptionEntry - Cshaka::media::mp4::SampleToGroupEntry - Cshaka::media::Scte35Event - Cshaka::media::SeekHead - Cshaka::media::mp4::Segmenter - Cshaka::media::mp4::MultiSegmentSegmenter - Cshaka::media::mp4::SingleSegmentSegmenter - Cshaka::media::webm::Segmenter - Cshaka::media::webm::MultiSegmentSegmenter - Cshaka::media::webm::SingleSegmentSegmenter - Cshaka::media::webm::TwoPassSingleSegmentSegmenter - Cshaka::media::SegmentEventInfo - Cshaka::SegmentInfo - Cshaka::media::SegmentInfo - Cshaka::media::mp4::SegmentReference - CSimpleThread - Cshaka::media::ClosureThread - Cshaka::media::Job - Cshaka::Status + Cshaka::media::mp4::EditListEntry + Cshaka::Element + Cshaka::EncryptionParams::EncryptedStreamAttributesEncrypted stream information that is used to determine stream label + Cshaka::media::EncryptionConfig + Cshaka::media::EncryptionKey + Cshaka::EncryptionParamsEncryption parameters + Cshaka::media::ESDescriptor + Cshaka::media::mp2t::EsParser + Cshaka::media::mp2t::EsParserAudio + Cshaka::media::mp2t::EsParserH26x + Cshaka::media::mp2t::EsParserH264 + Cshaka::media::mp2t::EsParserH265 + Cshaka::media::EventInfo + Cshaka::FileDefine an abstract file interface + Cshaka::CallbackFile + Cshaka::LocalFileImplement LocalFile which deals with local storage + Cshaka::MemoryFile + Cshaka::ThreadedIoFileDeclaration of class which implements a thread-safe circular buffer + Cshaka::UdpFileImplements UdpFile, which receives UDP unicast and multicast streams + Cshaka::FileCloser + Cshaka::media::FileReaderClass to read character-by-character from a file + Cshaka::media::mp4::Fragmenter + Cshaka::media::H264DecRefPicMarking + Cshaka::media::H264ModificationOfPicNum + Cshaka::media::H264Parser + Cshaka::media::H264Pps + Cshaka::media::H264SEIMessage + Cshaka::media::H264SEIRecoveryPoint + Cshaka::media::H264SliceHeader + Cshaka::media::H264Sps + Cshaka::media::H264WeightingFactors + Cshaka::media::H265Parser + Cshaka::media::H265Pps + Cshaka::media::H265ReferencePictureListModifications + Cshaka::media::H265ReferencePictureSet + Cshaka::media::H265SliceHeader + Cshaka::media::H265Sps + Cshaka::media::H265VuiParameters + Cshaka::media::H26xBitReader + Cshaka::media::H26xByteToUnitStreamConverterA base class that is used to convert H.26x byte streams to NAL unit streams + Cshaka::media::H264ByteToUnitStreamConverter + Cshaka::media::H265ByteToUnitStreamConverter + Cshaka::hls::HlsEntry + Cshaka::hls::HlsNotifier + Cshaka::hls::SimpleHlsNotifierThis is thread safe + Cshaka::HlsParamsHLS related parameters + Cshaka::media::Id3Tag + CIMkvWriter + Cshaka::media::MkvWriterAn implementation of IMkvWriter using our File type + Cshaka::IoCacheDeclaration of class which implements a thread-safe circular buffer + Cshaka::media::JobManager + Cshaka::media::KeyFetcherBase class for fetching keys from the license service + Cshaka::media::HttpKeyFetcher + Cshaka::media::KeyFrameEvent + Cshaka::media::mp4::KeyFrameInfoTracks key frame information + Cshaka::RawKeyParams::KeyInfo + Cshaka::media::KeySourceKeySource is responsible for encryption key acquisition + Cshaka::media::PlayReadyKeySourceA key source that uses playready for encryption + Cshaka::media::RawKeySourceA key source that uses raw keys for encryption + Cshaka::media::WidevineKeySource + Cshaka::media::mp4::Language + Cshaka::media::LibcryptoThreadingConvenience class which initializes and terminates libcrypto threading + Cshaka::media::LineReader + Cshaka::media::H265SliceHeader::LongTermPicsInfo + Cshaka::hls::MasterPlaylist + Cshaka::media::MediaHandler + Cshaka::media::AdCueGeneratorAdCueGenerator converts out of band cuepoint markers into SCTE-35 events + Cshaka::media::ChunkingHandler + Cshaka::media::CueAlignmentHandler + Cshaka::media::EncryptionHandler + Cshaka::media::FakeInputMediaHandler + Cshaka::media::FakeMediaHandler + Cshaka::media::MockOutputMediaHandler + Cshaka::media::Muxer + Cshaka::media::mp2t::TsMuxer + Cshaka::media::mp4::MP4Muxer + Cshaka::media::PackedAudioWriter + Cshaka::media::webm::WebMMuxerImplements WebM Muxer + Cshaka::media::OriginHandler + Cshaka::media::Demuxer + Cshaka::media::WebVttParser + Cshaka::media::Replicator + Cshaka::media::TextChunker + Cshaka::media::TextPadder + Cshaka::media::TrickPlayHandler + Cshaka::media::WebVttTextOutputHandler + Cshaka::media::WebVttToMp4Handler + Cshaka::media::MediaParser + Cshaka::media::mp2t::Mp2tMediaParser + Cshaka::media::mp4::MP4MediaParser + Cshaka::media::WebMMediaParser + Cshaka::media::wvm::WvmMediaParser + Cshaka::hls::MediaPlaylistMethods are virtual for mocking + Cshaka::hls::MockMediaPlaylist + Cshaka::hls::MediaPlaylistFactory + Cshaka::media::MuxerListener::MediaRanges + Cshaka::media::MediaSampleClass to hold a media sample + Cshaka::Mp4OutputParamsMP4 (ISO-BMFF) output related parameters + Cshaka::MpdBuilderThis class generates DASH MPDs (Media Presentation Descriptions) + Cshaka::MockMpdBuilder + Cshaka::MpdNotifier + Cshaka::MockMpdNotifier + Cshaka::SimpleMpdNotifier + Cshaka::MpdNotifierFactory + Cshaka::MpdOptionsDefines Mpd Options + Cshaka::MpdParamsDASH MPD related parameters + Cshaka::MpdWriter + Cshaka::media::MuxerFactory + Cshaka::media::MuxerListener + Cshaka::media::CombinedMuxerListener + Cshaka::media::HlsNotifyMuxerListenerMuxerListener that uses HlsNotifier + Cshaka::media::MockMuxerListener + Cshaka::media::MpdNotifyMuxerListener + Cshaka::media::VodMediaInfoDumpMuxerListener + Cshaka::media::MuxerListenerFactory + Cshaka::media::MuxerOptionsThis structure contains the list of configuration options for Muxer + Cshaka::media::Nalu + Cshaka::media::NalUnitToByteStreamConverter + Cshaka::media::NaluReader + Cshaka::media::OffsetByteQueue + Cshaka::EncryptionParams::EncryptedStreamAttributes::OneOf + Cshaka::media::OnMediaEndParameters + Cshaka::media::OnNewSegmentParameters + Cshaka::Packager + Cshaka::PackagingParamsPackaging parameters + Cshaka::media::PackedAudioSegmenter + Cshaka::media::PeekingReader + Cshaka::Period + Cshaka::MockPeriod + Cshaka::media::mp2t::PesPacketClass that carries PES packet information + Cshaka::media::mp2t::PesPacketGenerator + Cshaka::PlayReadyEncryptionParams + Cshaka::media::wvm::PrevSampleData + Cshaka::media::ProducerConsumerQueue< T > + Cshaka::media::mp2t::ProgramMapTableWriterPuts PMT into TS packets and writes them to buffer + Cshaka::media::mp2t::AudioProgramMapTableWriterProgramMapTableWriter for video codecs + Cshaka::media::mp2t::VideoProgramMapTableWriterProgramMapTableWriter for video codecs + Cshaka::media::ProgressListenerThis class listens to progress updates events + Cshaka::media::ProtectionSystemSpecificInfo + Cshaka::media::PsshBoxBuilder + Cshaka::media::PsshGenerator + Cshaka::media::PlayReadyPsshGenerator + Cshaka::media::RawKeyPsshGenerator + Cshaka::media::WidevinePsshGenerator + Cshaka::media::Range + Cshaka::RawKeyParamsRaw key encryption/decryption parameters, i.e. with key parameters provided + Cshaka::Representation + Cshaka::MockRepresentation + Cshaka::RepresentationStateChangeListener + Cshaka::media::RequestSignerAbstract class used for signature generation + Cshaka::media::AesRequestSignerAesRequestSigner uses AES-CBC signing + Cshaka::media::RsaRequestSignerRsaRequestSigner uses RSA-PSS signing + Cshaka::media::RsaPrivateKeyRsa private key, used for message signing and decryption + Cshaka::media::RsaPublicKeyRsa public key, used for signature verification and encryption + Cshaka::media::mp4::SampleEncryptionEntry + Cshaka::media::mp4::SampleToGroupEntry + Cshaka::media::Scte35Event + Cshaka::media::SeekHead + Cshaka::media::mp4::Segmenter + Cshaka::media::mp4::MultiSegmentSegmenter + Cshaka::media::mp4::SingleSegmentSegmenter + Cshaka::media::webm::Segmenter + Cshaka::media::webm::MultiSegmentSegmenter + Cshaka::media::webm::SingleSegmentSegmenter + Cshaka::media::webm::TwoPassSingleSegmentSegmenter + Cshaka::media::SegmentEventInfo + Cshaka::SegmentInfo + Cshaka::media::SegmentInfo + Cshaka::media::mp4::SegmentReference + CSimpleThread + Cshaka::media::ClosureThread + Cshaka::media::Job + Cshaka::Status + Cshaka::media::MuxerListenerFactory::StreamData  Cshaka::media::StreamData - Cshaka::media::MuxerListenerFactory::StreamData - Cshaka::StreamDescriptorDefines a single input/output stream - Cshaka::media::StreamInfoAbstract class holds stream information - Cshaka::media::AudioStreamInfoHolds audio stream information - Cshaka::media::TextStreamInfo - Cshaka::media::VideoStreamInfoHolds video stream information - Cshaka::media::SubsampleEntry - Cshaka::media::SyncPointQueueA synchronized queue for cue points - Cshaka::media::mp4::SyncSampleIterator - Cshaka::hls::Tag - CTest - Cshaka::media::MediaHandlerTestBase - Cshaka::media::MediaHandlerGraphTestBase - Cshaka::media::SegmentTestBase - Cshaka::TestParamsParameters used for testing - Cshaka::media::TextSample - Cshaka::media::TextTrack - Cshaka::media::TextTrackConfig - Cshaka::media::mp4::TrackRunIterator - Cshaka::media::TracksBuilder - Cshaka::media::mp2t::TsPacket - Cshaka::media::mp2t::TsSection - Cshaka::media::mp2t::TsSectionPes - Cshaka::media::mp2t::TsSectionPsi - Cshaka::media::mp2t::TsSectionPat - Cshaka::media::mp2t::TsSectionPmt - Cshaka::media::mp2t::TsSegmenter - Cshaka::media::mp2t::TsWriter - Cshaka::UdpOptionsOptions parsed from UDP url string of the form: udp://ip:port[?options] - Cshaka::MpdParams::UtcTimingUTCTimings. For dynamic MPD only - Cshaka::media::VideoSliceHeaderParser - Cshaka::media::H264VideoSliceHeaderParser - Cshaka::media::H265VideoSliceHeaderParser - Cshaka::media::mp2t::EsParserH26x::VideoSliceInfo - Cshaka::media::VideoStreamInfoParameters - Cshaka::media::VPCodecConfigurationRecordClass for parsing or writing VP codec configuration record - Cshaka::media::VPxFrameInfo - Cshaka::media::VPxParser - Cshaka::media::VP8Parser - Cshaka::media::VP9ParserClass to parse a vp9 bit stream - Cshaka::media::WebMListParser - Cshaka::media::WebMParserClient - Cshaka::media::SegmentTestBase::ClusterParser - Cshaka::media::WebMAudioClientHelper class used to parse an Audio element inside a TrackEntry element - Cshaka::media::WebMClusterParser - Cshaka::media::WebMContentEncodingsClientParser for WebM ContentEncodings element - Cshaka::media::WebMInfoParserParser for WebM Info element - Cshaka::media::WebMTracksParserParser for WebM Tracks element - Cshaka::media::WebMVideoClientHelper class used to parse a Video element inside a TrackEntry element - Cshaka::media::WebMWebVTTParser + Cshaka::StreamDescriptorDefines a single input/output stream + Cshaka::media::StreamInfoAbstract class holds stream information + Cshaka::media::AudioStreamInfoHolds audio stream information + Cshaka::media::TextStreamInfo + Cshaka::media::VideoStreamInfoHolds video stream information + Cshaka::media::SubsampleEntry + Cshaka::media::SyncPointQueueA synchronized queue for cue points + Cshaka::media::mp4::SyncSampleIterator + Cshaka::hls::Tag + CTest + Cshaka::media::MediaHandlerTestBase + Cshaka::media::MediaHandlerGraphTestBase + Cshaka::media::SegmentTestBase + Cshaka::TestParamsParameters used for testing + Cshaka::media::TextSample + Cshaka::media::TextTrack + Cshaka::media::TextTrackConfig + Cshaka::media::mp4::TrackRunIterator + Cshaka::media::TracksBuilder + Cshaka::media::mp2t::TsPacket + Cshaka::media::mp2t::TsSection + Cshaka::media::mp2t::TsSectionPes + Cshaka::media::mp2t::TsSectionPsi + Cshaka::media::mp2t::TsSectionPat + Cshaka::media::mp2t::TsSectionPmt + Cshaka::media::mp2t::TsSegmenter + Cshaka::media::mp2t::TsWriter + Cshaka::UdpOptionsOptions parsed from UDP url string of the form: udp://ip:port[?options] + Cshaka::MpdParams::UtcTimingUTCTimings. For dynamic MPD only + Cshaka::media::VideoSliceHeaderParser + Cshaka::media::H264VideoSliceHeaderParser + Cshaka::media::H265VideoSliceHeaderParser + Cshaka::media::mp2t::EsParserH26x::VideoSliceInfo + Cshaka::media::VideoStreamInfoParameters + Cshaka::media::VPCodecConfigurationRecordClass for parsing or writing VP codec configuration record + Cshaka::media::VPxFrameInfo + Cshaka::media::VPxParser + Cshaka::media::VP8Parser + Cshaka::media::VP9ParserClass to parse a vp9 bit stream + Cshaka::media::WebMListParser + Cshaka::media::WebMParserClient + Cshaka::media::SegmentTestBase::ClusterParser + Cshaka::media::WebMAudioClientHelper class used to parse an Audio element inside a TrackEntry element + Cshaka::media::WebMClusterParser + Cshaka::media::WebMContentEncodingsClientParser for WebM ContentEncodings element + Cshaka::media::WebMInfoParserParser for WebM Info element + Cshaka::media::WebMTracksParserParser for WebM Tracks element + Cshaka::media::WebMVideoClientHelper class used to parse a Video element inside a TrackEntry element + Cshaka::media::WebMWebVTTParser + Cshaka::media::WebVttFileBuffer  Cshaka::WidevineDecryptionParamsWidevine decryption parameters  Cshaka::WidevineEncryptionParamsWidevine encryption parameters  Cshaka::WidevineSignerSigner credential for Widevine license server @@ -427,7 +426,7 @@ $(function() { diff --git a/docs/index.html b/docs/index.html index 7f096c5271..296d8c8538 100644 --- a/docs/index.html +++ b/docs/index.html @@ -65,7 +65,7 @@ $(function() { diff --git a/docs/namespacemembers.html b/docs/namespacemembers.html index b8a04e4490..2630413272 100644 --- a/docs/namespacemembers.html +++ b/docs/namespacemembers.html @@ -114,7 +114,7 @@ $(function() { diff --git a/docs/namespacemembers_enum.html b/docs/namespacemembers_enum.html index 919434e06e..196ee34394 100644 --- a/docs/namespacemembers_enum.html +++ b/docs/namespacemembers_enum.html @@ -69,7 +69,7 @@ $(function() { diff --git a/docs/namespacemembers_func.html b/docs/namespacemembers_func.html index e591092d9b..776e40dcf1 100644 --- a/docs/namespacemembers_func.html +++ b/docs/namespacemembers_func.html @@ -108,7 +108,7 @@ $(function() { diff --git a/docs/namespaces.html b/docs/namespaces.html index 62009d994a..bea1a1a2e0 100644 --- a/docs/namespaces.html +++ b/docs/namespaces.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/search/all_11.js b/docs/search/all_11.js index 79f5b2b42d..703c5cfe3d 100644 --- a/docs/search/all_11.js +++ b/docs/search/all_11.js @@ -38,6 +38,7 @@ var searchData= ['segmentreference',['SegmentReference',['../dd/d9b/structshaka_1_1media_1_1mp4_1_1SegmentReference.html',1,'shaka::media::mp4']]], ['segmenttestbase',['SegmentTestBase',['../d2/dba/classshaka_1_1media_1_1SegmentTestBase.html',1,'shaka::media']]], ['segmenttype',['SegmentType',['../d3/dd0/structshaka_1_1media_1_1mp4_1_1SegmentType.html',1,'shaka::media::mp4']]], + ['set_5fallow_5fadjust_5fearliest_5fpresentation_5ftime',['set_allow_adjust_earliest_presentation_time',['../db/d95/classshaka_1_1media_1_1mp4_1_1Fragmenter.html#a4274081cba791a24187e0512764a4b0e',1,'shaka::media::mp4::Fragmenter']]], ['set_5fclock',['set_clock',['../df/d46/classshaka_1_1media_1_1Muxer.html#a3cc7feaee9a2c3a7d0569cb9c67c8c68',1,'shaka::media::Muxer']]], ['set_5fdts',['set_dts',['../d2/d93/classshaka_1_1media_1_1mp2t_1_1PesPacket.html#a9917d625989f0eaac93fec12fec8dca0',1,'shaka::media::mp2t::PesPacket']]], ['set_5fduration_5fseconds',['set_duration_seconds',['../d8/de1/classshaka_1_1Period.html#a5519676b3185c9902e98f5f3762d6d71',1,'shaka::Period']]], @@ -102,7 +103,7 @@ var searchData= ['stream_5fid',['stream_id',['../d2/d93/classshaka_1_1media_1_1mp2t_1_1PesPacket.html#a1a854ecaba22741115804eb7799c8b10',1,'shaka::media::mp2t::PesPacket']]], ['stream_5flabel_5ffunc',['stream_label_func',['../dc/da0/structshaka_1_1EncryptionParams.html#a7686a6aca6a7c3d077a5d7215c39fc51',1,'shaka::EncryptionParams']]], ['stream_5fselector',['stream_selector',['../d2/d7b/structshaka_1_1StreamDescriptor.html#a386c5e3717b5f982f72698abba09df2c',1,'shaka::StreamDescriptor']]], - ['streamdata',['StreamData',['../d0/d4c/structshaka_1_1media_1_1StreamData.html',1,'shaka::media::StreamData'],['../de/db5/structshaka_1_1media_1_1MuxerListenerFactory_1_1StreamData.html',1,'shaka::media::MuxerListenerFactory::StreamData']]], + ['streamdata',['StreamData',['../de/db5/structshaka_1_1media_1_1MuxerListenerFactory_1_1StreamData.html',1,'shaka::media::MuxerListenerFactory::StreamData'],['../d0/d4c/structshaka_1_1media_1_1StreamData.html',1,'shaka::media::StreamData']]], ['streamdescriptor',['StreamDescriptor',['../d2/d7b/structshaka_1_1StreamDescriptor.html',1,'shaka']]], ['streaminfo',['StreamInfo',['../d5/db1/classshaka_1_1media_1_1StreamInfo.html',1,'shaka::media']]], ['subsampleentry',['SubsampleEntry',['../d1/d34/structshaka_1_1media_1_1SubsampleEntry.html',1,'shaka::media']]], diff --git a/docs/search/all_15.js b/docs/search/all_15.js index 1136f96646..3e36084182 100644 --- a/docs/search/all_15.js +++ b/docs/search/all_15.js @@ -13,10 +13,10 @@ var searchData= ['webmvideoclient',['WebMVideoClient',['../d3/d67/classshaka_1_1media_1_1WebMVideoClient.html',1,'shaka::media']]], ['webmwebvttparser',['WebMWebVTTParser',['../d4/d59/classshaka_1_1media_1_1WebMWebVTTParser.html',1,'shaka::media']]], ['webvttconfigurationbox',['WebVTTConfigurationBox',['../d8/d20/structshaka_1_1media_1_1mp4_1_1WebVTTConfigurationBox.html',1,'shaka::media::mp4']]], - ['webvttoutputhandler',['WebVttOutputHandler',['../d6/d3f/classshaka_1_1media_1_1WebVttOutputHandler.html',1,'shaka::media']]], + ['webvttfilebuffer',['WebVttFileBuffer',['../d6/dda/classshaka_1_1media_1_1WebVttFileBuffer.html',1,'shaka::media']]], ['webvttparser',['WebVttParser',['../d9/d40/classshaka_1_1media_1_1WebVttParser.html',1,'shaka::media']]], - ['webvttsegmentedoutputhandler',['WebVttSegmentedOutputHandler',['../d6/dc1/classshaka_1_1media_1_1WebVttSegmentedOutputHandler.html',1,'shaka::media']]], ['webvttsourcelabelbox',['WebVTTSourceLabelBox',['../d4/d33/structshaka_1_1media_1_1mp4_1_1WebVTTSourceLabelBox.html',1,'shaka::media::mp4']]], + ['webvtttextoutputhandler',['WebVttTextOutputHandler',['../d6/d2a/classshaka_1_1media_1_1WebVttTextOutputHandler.html',1,'shaka::media']]], ['webvtttomp4handler',['WebVttToMp4Handler',['../d7/d53/classshaka_1_1media_1_1WebVttToMp4Handler.html',1,'shaka::media']]], ['widevinedecryptionparams',['WidevineDecryptionParams',['../d8/d48/structshaka_1_1WidevineDecryptionParams.html',1,'shaka']]], ['widevineencryptionparams',['WidevineEncryptionParams',['../d9/dd2/structshaka_1_1WidevineEncryptionParams.html',1,'shaka']]], diff --git a/docs/search/all_3.js b/docs/search/all_3.js index 6fc47cf48d..3208a2240a 100644 --- a/docs/search/all_3.js +++ b/docs/search/all_3.js @@ -28,7 +28,6 @@ var searchData= ['dispatchsegmentinfo',['DispatchSegmentInfo',['../da/dfd/classshaka_1_1media_1_1MediaHandler.html#a2acc1c84a61aee93229d493aa93308d5',1,'shaka::media::MediaHandler']]], ['dispatchstreaminfo',['DispatchStreamInfo',['../da/dfd/classshaka_1_1media_1_1MediaHandler.html#ad165375cd0a2074c5a740b42f847c499',1,'shaka::media::MediaHandler']]], ['dispatchtextsample',['DispatchTextSample',['../da/dfd/classshaka_1_1media_1_1MediaHandler.html#a9c44df529fead65c007ee27b84ebd32a',1,'shaka::media::MediaHandler']]], - ['displayactioncompare',['DisplayActionCompare',['../da/d17/classshaka_1_1media_1_1DisplayActionCompare.html',1,'shaka::media']]], ['drm_5flabel',['drm_label',['../d2/d7b/structshaka_1_1StreamDescriptor.html#a8f2a517450433cf69bbc87cef17d05cf',1,'shaka::StreamDescriptor']]], ['dts',['dts',['../d2/d93/classshaka_1_1media_1_1mp2t_1_1PesPacket.html#a02537ce70272a3e22426c46e4540ac64',1,'shaka::media::mp2t::PesPacket']]], ['dtsspecific',['DTSSpecific',['../dc/da0/structshaka_1_1media_1_1mp4_1_1DTSSpecific.html',1,'shaka::media::mp4']]], diff --git a/docs/search/all_e.js b/docs/search/all_e.js index 720b8501e9..807d0ba0e5 100644 --- a/docs/search/all_e.js +++ b/docs/search/all_e.js @@ -5,7 +5,7 @@ var searchData= ['onencryptioninfoready',['OnEncryptionInfoReady',['../d9/d68/classshaka_1_1media_1_1CombinedMuxerListener.html#a445b97bf06c20a44ae5d0fef926cbd9f',1,'shaka::media::CombinedMuxerListener::OnEncryptionInfoReady()'],['../d5/dfa/classshaka_1_1media_1_1HlsNotifyMuxerListener.html#a8be7a524212bdd401150aa6bcb374792',1,'shaka::media::HlsNotifyMuxerListener::OnEncryptionInfoReady()'],['../d9/da5/classshaka_1_1media_1_1MpdNotifyMuxerListener.html#a10071445982f736bb1e6e04133dd60cb',1,'shaka::media::MpdNotifyMuxerListener::OnEncryptionInfoReady()'],['../dd/d7a/classshaka_1_1media_1_1MuxerListener.html#ab521acca727bbe01aa15c751325c0001',1,'shaka::media::MuxerListener::OnEncryptionInfoReady()'],['../db/dd0/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener.html#a683882564ac762e2e94795964f8be4b8',1,'shaka::media::VodMediaInfoDumpMuxerListener::OnEncryptionInfoReady()']]], ['onencryptionstart',['OnEncryptionStart',['../d9/d68/classshaka_1_1media_1_1CombinedMuxerListener.html#a40a2b9e923b6a6e255ee5632bffc1134',1,'shaka::media::CombinedMuxerListener::OnEncryptionStart()'],['../d5/dfa/classshaka_1_1media_1_1HlsNotifyMuxerListener.html#a49b4187f39abe517768364f7ecb280f9',1,'shaka::media::HlsNotifyMuxerListener::OnEncryptionStart()'],['../d9/da5/classshaka_1_1media_1_1MpdNotifyMuxerListener.html#a56ccf04196458894f31d0db102153334',1,'shaka::media::MpdNotifyMuxerListener::OnEncryptionStart()'],['../dd/d7a/classshaka_1_1media_1_1MuxerListener.html#a897463091f0effa647a8e2822f48b2ee',1,'shaka::media::MuxerListener::OnEncryptionStart()'],['../db/dd0/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener.html#ae8f6f65fbab9f301be5bb35f5b8d1cbc',1,'shaka::media::VodMediaInfoDumpMuxerListener::OnEncryptionStart()']]], ['oneof',['OneOf',['../d0/d37/unionshaka_1_1EncryptionParams_1_1EncryptedStreamAttributes_1_1OneOf.html',1,'shaka::EncryptionParams::EncryptedStreamAttributes']]], - ['onflushrequest',['OnFlushRequest',['../da/dfd/classshaka_1_1media_1_1MediaHandler.html#a69a31b8ec1b85fd4790c7c2013c69a73',1,'shaka::media::MediaHandler::OnFlushRequest()'],['../d1/d36/classshaka_1_1media_1_1FakeMediaHandler.html#a3f82edd4474f20464224e881dd20fdb0',1,'shaka::media::FakeMediaHandler::OnFlushRequest()'],['../df/d46/classshaka_1_1media_1_1Muxer.html#a9f08c1385506636b800769480869e04f',1,'shaka::media::Muxer::OnFlushRequest()'],['../d4/d43/classshaka_1_1media_1_1ChunkingHandler.html#ab526bd53e4d49d7209f01d9b10b9ab52',1,'shaka::media::ChunkingHandler::OnFlushRequest()'],['../d7/d53/classshaka_1_1media_1_1WebVttToMp4Handler.html#a3292b9e5a054457207da6210e23a97a7',1,'shaka::media::WebVttToMp4Handler::OnFlushRequest()']]], + ['onflushrequest',['OnFlushRequest',['../da/dfd/classshaka_1_1media_1_1MediaHandler.html#a69a31b8ec1b85fd4790c7c2013c69a73',1,'shaka::media::MediaHandler::OnFlushRequest()'],['../d1/d36/classshaka_1_1media_1_1FakeMediaHandler.html#a3f82edd4474f20464224e881dd20fdb0',1,'shaka::media::FakeMediaHandler::OnFlushRequest()'],['../df/d46/classshaka_1_1media_1_1Muxer.html#a9f08c1385506636b800769480869e04f',1,'shaka::media::Muxer::OnFlushRequest()'],['../d4/d43/classshaka_1_1media_1_1ChunkingHandler.html#ab526bd53e4d49d7209f01d9b10b9ab52',1,'shaka::media::ChunkingHandler::OnFlushRequest()']]], ['onkeyframe',['OnKeyFrame',['../d9/d68/classshaka_1_1media_1_1CombinedMuxerListener.html#ab28f1444fb268c8e7e30c8b6392da3a2',1,'shaka::media::CombinedMuxerListener::OnKeyFrame()'],['../d5/dfa/classshaka_1_1media_1_1HlsNotifyMuxerListener.html#aca760c4bf4d878f4c30aee60489ac240',1,'shaka::media::HlsNotifyMuxerListener::OnKeyFrame()'],['../d9/da5/classshaka_1_1media_1_1MpdNotifyMuxerListener.html#abfa37764e205e161f4d67de7df6205c4',1,'shaka::media::MpdNotifyMuxerListener::OnKeyFrame()'],['../dd/d7a/classshaka_1_1media_1_1MuxerListener.html#a1276239a5fd8f86fd522b8c2b741904f',1,'shaka::media::MuxerListener::OnKeyFrame()'],['../db/dd0/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener.html#a3b563b65b2b2198b177d256fc0bc57e1',1,'shaka::media::VodMediaInfoDumpMuxerListener::OnKeyFrame()']]], ['onliststart',['OnListStart',['../d9/d87/classshaka_1_1media_1_1WebMContentEncodingsClient.html#a7b8b5447b3d573657f6dc029d2e6d8b7',1,'shaka::media::WebMContentEncodingsClient']]], ['onmediaend',['OnMediaEnd',['../d9/d68/classshaka_1_1media_1_1CombinedMuxerListener.html#aaf16580970d5e65d33c80cb9e8a57651',1,'shaka::media::CombinedMuxerListener::OnMediaEnd()'],['../d5/dfa/classshaka_1_1media_1_1HlsNotifyMuxerListener.html#aa2af080963ca02454786b8bb2ff6dd6d',1,'shaka::media::HlsNotifyMuxerListener::OnMediaEnd()'],['../dc/d73/classshaka_1_1media_1_1MockMuxerListener.html#a915fc76c19622d7e82aa74dd996edacd',1,'shaka::media::MockMuxerListener::OnMediaEnd()'],['../d9/da5/classshaka_1_1media_1_1MpdNotifyMuxerListener.html#aa42f5472d5450d897f036ff582a31612',1,'shaka::media::MpdNotifyMuxerListener::OnMediaEnd()'],['../dd/d7a/classshaka_1_1media_1_1MuxerListener.html#a11d4301cd53ab421f524bfa143eac21a',1,'shaka::media::MuxerListener::OnMediaEnd()'],['../db/dd0/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener.html#ab2ab9bc34256f8016f0e827097b97ca1',1,'shaka::media::VodMediaInfoDumpMuxerListener::OnMediaEnd()']]], @@ -24,6 +24,7 @@ var searchData= ['originalformat',['OriginalFormat',['../d5/d05/structshaka_1_1media_1_1mp4_1_1OriginalFormat.html',1,'shaka::media::mp4']]], ['originhandler',['OriginHandler',['../de/d85/classshaka_1_1media_1_1OriginHandler.html',1,'shaka::media']]], ['output',['output',['../d2/d7b/structshaka_1_1StreamDescriptor.html#a08ce812991297de47354b99cdaec5415',1,'shaka::StreamDescriptor']]], + ['output_5ffile_5findex',['output_file_index',['../d0/d27/structshaka_1_1media_1_1MuxerOptions.html#ae6f2196d3bc69a25bd9a7ce73ec4db69',1,'shaka::media::MuxerOptions']]], ['output_5ffile_5fname',['output_file_name',['../d0/d27/structshaka_1_1media_1_1MuxerOptions.html#a5397ee8759a663aea68261600e528d82',1,'shaka::media::MuxerOptions']]], ['output_5fformat',['output_format',['../d2/d7b/structshaka_1_1StreamDescriptor.html#a025d9a9a1612654da2b0c99fe81378db',1,'shaka::StreamDescriptor']]], ['output_5fmedia_5finfo',['output_media_info',['../d5/de3/structshaka_1_1PackagingParams.html#a9206160a0fb92a9e9ee27fd8e9725ea1',1,'shaka::PackagingParams']]], diff --git a/docs/search/all_f.js b/docs/search/all_f.js index 8dc1adb3a5..478ca2dd8e 100644 --- a/docs/search/all_f.js +++ b/docs/search/all_f.js @@ -43,7 +43,7 @@ var searchData= ['prevsampledata',['PrevSampleData',['../d2/d0f/structshaka_1_1media_1_1wvm_1_1PrevSampleData.html',1,'shaka::media::wvm']]], ['printerror',['PrintError',['../d8/daf/namespaceshaka.html#a54fadd9c7ef14b39cd0355a5c269c772',1,'shaka']]], ['printwarning',['PrintWarning',['../d8/daf/namespaceshaka.html#a42273d2ca4220d3de00a759a711e385e',1,'shaka']]], - ['process',['Process',['../da/dfd/classshaka_1_1media_1_1MediaHandler.html#acb614e9f43e1eb6f837801b15b78c0b4',1,'shaka::media::MediaHandler::Process()'],['../d1/d36/classshaka_1_1media_1_1FakeMediaHandler.html#af9fa42669591a52b8fa1a62d27ed93d6',1,'shaka::media::FakeMediaHandler::Process()'],['../df/d46/classshaka_1_1media_1_1Muxer.html#aec730b070245231a0887787005c06eee',1,'shaka::media::Muxer::Process()'],['../d4/d43/classshaka_1_1media_1_1ChunkingHandler.html#a44c30ffd7c283be2ba4347bda7848633',1,'shaka::media::ChunkingHandler::Process()'],['../d6/d4c/classshaka_1_1media_1_1EncryptionHandler.html#a7887e6060eb572036674ecb9a7e045c4',1,'shaka::media::EncryptionHandler::Process()'],['../dd/d17/classshaka_1_1media_1_1Demuxer.html#a869b21d13f02d4d5c0519f9eb35117cd',1,'shaka::media::Demuxer::Process()'],['../d7/d53/classshaka_1_1media_1_1WebVttToMp4Handler.html#a7e589ef1f6d4d29eb5fe4daacf65606f',1,'shaka::media::WebVttToMp4Handler::Process()']]], + ['process',['Process',['../da/dfd/classshaka_1_1media_1_1MediaHandler.html#acb614e9f43e1eb6f837801b15b78c0b4',1,'shaka::media::MediaHandler::Process()'],['../d1/d36/classshaka_1_1media_1_1FakeMediaHandler.html#af9fa42669591a52b8fa1a62d27ed93d6',1,'shaka::media::FakeMediaHandler::Process()'],['../df/d46/classshaka_1_1media_1_1Muxer.html#aec730b070245231a0887787005c06eee',1,'shaka::media::Muxer::Process()'],['../d4/d43/classshaka_1_1media_1_1ChunkingHandler.html#a44c30ffd7c283be2ba4347bda7848633',1,'shaka::media::ChunkingHandler::Process()'],['../d6/d4c/classshaka_1_1media_1_1EncryptionHandler.html#a7887e6060eb572036674ecb9a7e045c4',1,'shaka::media::EncryptionHandler::Process()'],['../dd/d17/classshaka_1_1media_1_1Demuxer.html#a869b21d13f02d4d5c0519f9eb35117cd',1,'shaka::media::Demuxer::Process()']]], ['producerconsumerqueue',['ProducerConsumerQueue',['../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html',1,'shaka::media::ProducerConsumerQueue< T >'],['../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html#ad7ccb149baa88e5f8356be18344d2baf',1,'shaka::media::ProducerConsumerQueue::ProducerConsumerQueue(size_t capacity)'],['../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html#a80ff75afdbbf7f567dcb57a755542ffc',1,'shaka::media::ProducerConsumerQueue::ProducerConsumerQueue(size_t capacity, size_t starting_pos)']]], ['program_5fidentifier',['program_identifier',['../df/d47/structshaka_1_1PlayReadyEncryptionParams.html#a8716552505d244227bf93c4878071f2d',1,'shaka::PlayReadyEncryptionParams']]], ['programmaptablewriter',['ProgramMapTableWriter',['../dc/d03/classshaka_1_1media_1_1mp2t_1_1ProgramMapTableWriter.html',1,'shaka::media::mp2t']]], diff --git a/docs/search/classes_10.js b/docs/search/classes_10.js index ad937ff843..37489b150f 100644 --- a/docs/search/classes_10.js +++ b/docs/search/classes_10.js @@ -28,7 +28,7 @@ var searchData= ['singlesegmentsegmenter',['SingleSegmentSegmenter',['../d3/da1/classshaka_1_1media_1_1webm_1_1SingleSegmentSegmenter.html',1,'shaka::media::webm::SingleSegmentSegmenter'],['../d0/dab/classshaka_1_1media_1_1mp4_1_1SingleSegmentSegmenter.html',1,'shaka::media::mp4::SingleSegmentSegmenter']]], ['soundmediaheader',['SoundMediaHeader',['../d7/d07/structshaka_1_1media_1_1mp4_1_1SoundMediaHeader.html',1,'shaka::media::mp4']]], ['status',['Status',['../d2/d20/classshaka_1_1Status.html',1,'shaka']]], - ['streamdata',['StreamData',['../d0/d4c/structshaka_1_1media_1_1StreamData.html',1,'shaka::media::StreamData'],['../de/db5/structshaka_1_1media_1_1MuxerListenerFactory_1_1StreamData.html',1,'shaka::media::MuxerListenerFactory::StreamData']]], + ['streamdata',['StreamData',['../de/db5/structshaka_1_1media_1_1MuxerListenerFactory_1_1StreamData.html',1,'shaka::media::MuxerListenerFactory::StreamData'],['../d0/d4c/structshaka_1_1media_1_1StreamData.html',1,'shaka::media::StreamData']]], ['streamdescriptor',['StreamDescriptor',['../d2/d7b/structshaka_1_1StreamDescriptor.html',1,'shaka']]], ['streaminfo',['StreamInfo',['../d5/db1/classshaka_1_1media_1_1StreamInfo.html',1,'shaka::media']]], ['subsampleentry',['SubsampleEntry',['../d1/d34/structshaka_1_1media_1_1SubsampleEntry.html',1,'shaka::media']]], diff --git a/docs/search/classes_14.js b/docs/search/classes_14.js index 2d496b5edc..6337badbd4 100644 --- a/docs/search/classes_14.js +++ b/docs/search/classes_14.js @@ -12,10 +12,10 @@ var searchData= ['webmvideoclient',['WebMVideoClient',['../d3/d67/classshaka_1_1media_1_1WebMVideoClient.html',1,'shaka::media']]], ['webmwebvttparser',['WebMWebVTTParser',['../d4/d59/classshaka_1_1media_1_1WebMWebVTTParser.html',1,'shaka::media']]], ['webvttconfigurationbox',['WebVTTConfigurationBox',['../d8/d20/structshaka_1_1media_1_1mp4_1_1WebVTTConfigurationBox.html',1,'shaka::media::mp4']]], - ['webvttoutputhandler',['WebVttOutputHandler',['../d6/d3f/classshaka_1_1media_1_1WebVttOutputHandler.html',1,'shaka::media']]], + ['webvttfilebuffer',['WebVttFileBuffer',['../d6/dda/classshaka_1_1media_1_1WebVttFileBuffer.html',1,'shaka::media']]], ['webvttparser',['WebVttParser',['../d9/d40/classshaka_1_1media_1_1WebVttParser.html',1,'shaka::media']]], - ['webvttsegmentedoutputhandler',['WebVttSegmentedOutputHandler',['../d6/dc1/classshaka_1_1media_1_1WebVttSegmentedOutputHandler.html',1,'shaka::media']]], ['webvttsourcelabelbox',['WebVTTSourceLabelBox',['../d4/d33/structshaka_1_1media_1_1mp4_1_1WebVTTSourceLabelBox.html',1,'shaka::media::mp4']]], + ['webvtttextoutputhandler',['WebVttTextOutputHandler',['../d6/d2a/classshaka_1_1media_1_1WebVttTextOutputHandler.html',1,'shaka::media']]], ['webvtttomp4handler',['WebVttToMp4Handler',['../d7/d53/classshaka_1_1media_1_1WebVttToMp4Handler.html',1,'shaka::media']]], ['widevinedecryptionparams',['WidevineDecryptionParams',['../d8/d48/structshaka_1_1WidevineDecryptionParams.html',1,'shaka']]], ['widevineencryptionparams',['WidevineEncryptionParams',['../d9/dd2/structshaka_1_1WidevineEncryptionParams.html',1,'shaka']]], diff --git a/docs/search/classes_3.js b/docs/search/classes_3.js index d508f47b2d..c2e3e6fe0d 100644 --- a/docs/search/classes_3.js +++ b/docs/search/classes_3.js @@ -12,6 +12,5 @@ var searchData= ['decryptorsource',['DecryptorSource',['../d7/d59/classshaka_1_1media_1_1DecryptorSource.html',1,'shaka::media']]], ['demuxer',['Demuxer',['../dd/d17/classshaka_1_1media_1_1Demuxer.html',1,'shaka::media']]], ['demuxstreamidmediasample',['DemuxStreamIdMediaSample',['../d1/da1/structshaka_1_1media_1_1wvm_1_1DemuxStreamIdMediaSample.html',1,'shaka::media::wvm']]], - ['displayactioncompare',['DisplayActionCompare',['../da/d17/classshaka_1_1media_1_1DisplayActionCompare.html',1,'shaka::media']]], ['dtsspecific',['DTSSpecific',['../dc/da0/structshaka_1_1media_1_1mp4_1_1DTSSpecific.html',1,'shaka::media::mp4']]] ]; diff --git a/docs/search/functions_c.js b/docs/search/functions_c.js index c802ae7d74..4275053478 100644 --- a/docs/search/functions_c.js +++ b/docs/search/functions_c.js @@ -3,7 +3,7 @@ var searchData= ['oncueevent',['OnCueEvent',['../d9/d68/classshaka_1_1media_1_1CombinedMuxerListener.html#afb865efad1302c0514f62498188f77d2',1,'shaka::media::CombinedMuxerListener::OnCueEvent()'],['../d5/dfa/classshaka_1_1media_1_1HlsNotifyMuxerListener.html#abd32dae454eafd6078caf3972701802d',1,'shaka::media::HlsNotifyMuxerListener::OnCueEvent()'],['../d9/da5/classshaka_1_1media_1_1MpdNotifyMuxerListener.html#ae8db9dc7865d136c3fc8b7b5ed86a23e',1,'shaka::media::MpdNotifyMuxerListener::OnCueEvent()'],['../dd/d7a/classshaka_1_1media_1_1MuxerListener.html#ab241c43b2de818758b340cba9cc7c9ae',1,'shaka::media::MuxerListener::OnCueEvent()'],['../db/dd0/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener.html#a6e6ff5abe8b04f46f740aa4049dfa163',1,'shaka::media::VodMediaInfoDumpMuxerListener::OnCueEvent()']]], ['onencryptioninfoready',['OnEncryptionInfoReady',['../d9/d68/classshaka_1_1media_1_1CombinedMuxerListener.html#a445b97bf06c20a44ae5d0fef926cbd9f',1,'shaka::media::CombinedMuxerListener::OnEncryptionInfoReady()'],['../d5/dfa/classshaka_1_1media_1_1HlsNotifyMuxerListener.html#a8be7a524212bdd401150aa6bcb374792',1,'shaka::media::HlsNotifyMuxerListener::OnEncryptionInfoReady()'],['../d9/da5/classshaka_1_1media_1_1MpdNotifyMuxerListener.html#a10071445982f736bb1e6e04133dd60cb',1,'shaka::media::MpdNotifyMuxerListener::OnEncryptionInfoReady()'],['../dd/d7a/classshaka_1_1media_1_1MuxerListener.html#ab521acca727bbe01aa15c751325c0001',1,'shaka::media::MuxerListener::OnEncryptionInfoReady()'],['../db/dd0/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener.html#a683882564ac762e2e94795964f8be4b8',1,'shaka::media::VodMediaInfoDumpMuxerListener::OnEncryptionInfoReady()']]], ['onencryptionstart',['OnEncryptionStart',['../d9/d68/classshaka_1_1media_1_1CombinedMuxerListener.html#a40a2b9e923b6a6e255ee5632bffc1134',1,'shaka::media::CombinedMuxerListener::OnEncryptionStart()'],['../d5/dfa/classshaka_1_1media_1_1HlsNotifyMuxerListener.html#a49b4187f39abe517768364f7ecb280f9',1,'shaka::media::HlsNotifyMuxerListener::OnEncryptionStart()'],['../d9/da5/classshaka_1_1media_1_1MpdNotifyMuxerListener.html#a56ccf04196458894f31d0db102153334',1,'shaka::media::MpdNotifyMuxerListener::OnEncryptionStart()'],['../dd/d7a/classshaka_1_1media_1_1MuxerListener.html#a897463091f0effa647a8e2822f48b2ee',1,'shaka::media::MuxerListener::OnEncryptionStart()'],['../db/dd0/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener.html#ae8f6f65fbab9f301be5bb35f5b8d1cbc',1,'shaka::media::VodMediaInfoDumpMuxerListener::OnEncryptionStart()']]], - ['onflushrequest',['OnFlushRequest',['../da/dfd/classshaka_1_1media_1_1MediaHandler.html#a69a31b8ec1b85fd4790c7c2013c69a73',1,'shaka::media::MediaHandler::OnFlushRequest()'],['../d1/d36/classshaka_1_1media_1_1FakeMediaHandler.html#a3f82edd4474f20464224e881dd20fdb0',1,'shaka::media::FakeMediaHandler::OnFlushRequest()'],['../df/d46/classshaka_1_1media_1_1Muxer.html#a9f08c1385506636b800769480869e04f',1,'shaka::media::Muxer::OnFlushRequest()'],['../d4/d43/classshaka_1_1media_1_1ChunkingHandler.html#ab526bd53e4d49d7209f01d9b10b9ab52',1,'shaka::media::ChunkingHandler::OnFlushRequest()'],['../d7/d53/classshaka_1_1media_1_1WebVttToMp4Handler.html#a3292b9e5a054457207da6210e23a97a7',1,'shaka::media::WebVttToMp4Handler::OnFlushRequest()']]], + ['onflushrequest',['OnFlushRequest',['../da/dfd/classshaka_1_1media_1_1MediaHandler.html#a69a31b8ec1b85fd4790c7c2013c69a73',1,'shaka::media::MediaHandler::OnFlushRequest()'],['../d1/d36/classshaka_1_1media_1_1FakeMediaHandler.html#a3f82edd4474f20464224e881dd20fdb0',1,'shaka::media::FakeMediaHandler::OnFlushRequest()'],['../df/d46/classshaka_1_1media_1_1Muxer.html#a9f08c1385506636b800769480869e04f',1,'shaka::media::Muxer::OnFlushRequest()'],['../d4/d43/classshaka_1_1media_1_1ChunkingHandler.html#ab526bd53e4d49d7209f01d9b10b9ab52',1,'shaka::media::ChunkingHandler::OnFlushRequest()']]], ['onkeyframe',['OnKeyFrame',['../d9/d68/classshaka_1_1media_1_1CombinedMuxerListener.html#ab28f1444fb268c8e7e30c8b6392da3a2',1,'shaka::media::CombinedMuxerListener::OnKeyFrame()'],['../d5/dfa/classshaka_1_1media_1_1HlsNotifyMuxerListener.html#aca760c4bf4d878f4c30aee60489ac240',1,'shaka::media::HlsNotifyMuxerListener::OnKeyFrame()'],['../d9/da5/classshaka_1_1media_1_1MpdNotifyMuxerListener.html#abfa37764e205e161f4d67de7df6205c4',1,'shaka::media::MpdNotifyMuxerListener::OnKeyFrame()'],['../dd/d7a/classshaka_1_1media_1_1MuxerListener.html#a1276239a5fd8f86fd522b8c2b741904f',1,'shaka::media::MuxerListener::OnKeyFrame()'],['../db/dd0/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener.html#a3b563b65b2b2198b177d256fc0bc57e1',1,'shaka::media::VodMediaInfoDumpMuxerListener::OnKeyFrame()']]], ['onliststart',['OnListStart',['../d9/d87/classshaka_1_1media_1_1WebMContentEncodingsClient.html#a7b8b5447b3d573657f6dc029d2e6d8b7',1,'shaka::media::WebMContentEncodingsClient']]], ['onmediaend',['OnMediaEnd',['../d9/d68/classshaka_1_1media_1_1CombinedMuxerListener.html#aaf16580970d5e65d33c80cb9e8a57651',1,'shaka::media::CombinedMuxerListener::OnMediaEnd()'],['../d5/dfa/classshaka_1_1media_1_1HlsNotifyMuxerListener.html#aa2af080963ca02454786b8bb2ff6dd6d',1,'shaka::media::HlsNotifyMuxerListener::OnMediaEnd()'],['../dc/d73/classshaka_1_1media_1_1MockMuxerListener.html#a915fc76c19622d7e82aa74dd996edacd',1,'shaka::media::MockMuxerListener::OnMediaEnd()'],['../d9/da5/classshaka_1_1media_1_1MpdNotifyMuxerListener.html#aa42f5472d5450d897f036ff582a31612',1,'shaka::media::MpdNotifyMuxerListener::OnMediaEnd()'],['../dd/d7a/classshaka_1_1media_1_1MuxerListener.html#a11d4301cd53ab421f524bfa143eac21a',1,'shaka::media::MuxerListener::OnMediaEnd()'],['../db/dd0/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener.html#ab2ab9bc34256f8016f0e827097b97ca1',1,'shaka::media::VodMediaInfoDumpMuxerListener::OnMediaEnd()']]], diff --git a/docs/search/functions_d.js b/docs/search/functions_d.js index bccc30890f..5f77239ce6 100644 --- a/docs/search/functions_d.js +++ b/docs/search/functions_d.js @@ -29,7 +29,7 @@ var searchData= ['preparechildren',['PrepareChildren',['../d1/da1/classshaka_1_1media_1_1mp4_1_1BoxBuffer.html#a29158ec9769dafbdcf1192abf9a2aa2a',1,'shaka::media::mp4::BoxBuffer']]], ['printerror',['PrintError',['../d8/daf/namespaceshaka.html#a54fadd9c7ef14b39cd0355a5c269c772',1,'shaka']]], ['printwarning',['PrintWarning',['../d8/daf/namespaceshaka.html#a42273d2ca4220d3de00a759a711e385e',1,'shaka']]], - ['process',['Process',['../da/dfd/classshaka_1_1media_1_1MediaHandler.html#acb614e9f43e1eb6f837801b15b78c0b4',1,'shaka::media::MediaHandler::Process()'],['../d1/d36/classshaka_1_1media_1_1FakeMediaHandler.html#af9fa42669591a52b8fa1a62d27ed93d6',1,'shaka::media::FakeMediaHandler::Process()'],['../df/d46/classshaka_1_1media_1_1Muxer.html#aec730b070245231a0887787005c06eee',1,'shaka::media::Muxer::Process()'],['../d4/d43/classshaka_1_1media_1_1ChunkingHandler.html#a44c30ffd7c283be2ba4347bda7848633',1,'shaka::media::ChunkingHandler::Process()'],['../d6/d4c/classshaka_1_1media_1_1EncryptionHandler.html#a7887e6060eb572036674ecb9a7e045c4',1,'shaka::media::EncryptionHandler::Process()'],['../dd/d17/classshaka_1_1media_1_1Demuxer.html#a869b21d13f02d4d5c0519f9eb35117cd',1,'shaka::media::Demuxer::Process()'],['../d7/d53/classshaka_1_1media_1_1WebVttToMp4Handler.html#a7e589ef1f6d4d29eb5fe4daacf65606f',1,'shaka::media::WebVttToMp4Handler::Process()']]], + ['process',['Process',['../da/dfd/classshaka_1_1media_1_1MediaHandler.html#acb614e9f43e1eb6f837801b15b78c0b4',1,'shaka::media::MediaHandler::Process()'],['../d1/d36/classshaka_1_1media_1_1FakeMediaHandler.html#af9fa42669591a52b8fa1a62d27ed93d6',1,'shaka::media::FakeMediaHandler::Process()'],['../df/d46/classshaka_1_1media_1_1Muxer.html#aec730b070245231a0887787005c06eee',1,'shaka::media::Muxer::Process()'],['../d4/d43/classshaka_1_1media_1_1ChunkingHandler.html#a44c30ffd7c283be2ba4347bda7848633',1,'shaka::media::ChunkingHandler::Process()'],['../d6/d4c/classshaka_1_1media_1_1EncryptionHandler.html#a7887e6060eb572036674ecb9a7e045c4',1,'shaka::media::EncryptionHandler::Process()'],['../dd/d17/classshaka_1_1media_1_1Demuxer.html#a869b21d13f02d4d5c0519f9eb35117cd',1,'shaka::media::Demuxer::Process()']]], ['producerconsumerqueue',['ProducerConsumerQueue',['../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html#ad7ccb149baa88e5f8356be18344d2baf',1,'shaka::media::ProducerConsumerQueue::ProducerConsumerQueue(size_t capacity)'],['../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html#a80ff75afdbbf7f567dcb57a755542ffc',1,'shaka::media::ProducerConsumerQueue::ProducerConsumerQueue(size_t capacity, size_t starting_pos)']]], ['promoteat',['PromoteAt',['../d0/dea/classshaka_1_1media_1_1SyncPointQueue.html#a17af2cb9949f40ee8aa06cfdd55b2c16',1,'shaka::media::SyncPointQueue']]], ['pts',['pts',['../d2/d93/classshaka_1_1media_1_1mp2t_1_1PesPacket.html#aab384f93421d95631f70ec4850f93a5b',1,'shaka::media::mp2t::PesPacket']]], diff --git a/docs/search/functions_f.js b/docs/search/functions_f.js index 9b0232e833..800811f2b1 100644 --- a/docs/search/functions_f.js +++ b/docs/search/functions_f.js @@ -12,6 +12,7 @@ var searchData= ['seek',['Seek',['../dd/d40/classshaka_1_1CallbackFile.html#a7c9039e25fcc468a7ec2cdfa8394ffc2',1,'shaka::CallbackFile::Seek()'],['../d3/d73/classshaka_1_1File.html#a486bda715b58b1a1863fbfc8d48da62a',1,'shaka::File::Seek()'],['../d7/dbd/classshaka_1_1LocalFile.html#a082cd6d64c8f04acff251cdafb66b203',1,'shaka::LocalFile::Seek()'],['../de/dad/classshaka_1_1MemoryFile.html#a0e3bffa9859fdcb7c28c20a15e2d3e98',1,'shaka::MemoryFile::Seek()'],['../dd/d0c/classshaka_1_1ThreadedIoFile.html#a9b95550cf6342f970645c086a2ed58c2',1,'shaka::ThreadedIoFile::Seek()'],['../d4/dcb/classshaka_1_1UdpFile.html#a33d10d2f1558a35aaba192f7746bb23f',1,'shaka::UdpFile::Seek()']]], ['seekable',['Seekable',['../d1/d0a/classshaka_1_1media_1_1MkvWriter.html#a8d0429e7922752db3f01d43e6340465a',1,'shaka::media::MkvWriter']]], ['segment_5fbuffer',['segment_buffer',['../d9/d66/classshaka_1_1media_1_1PackedAudioSegmenter.html#a345a5117da1d4a34061f7293fdffd16d',1,'shaka::media::PackedAudioSegmenter']]], + ['set_5fallow_5fadjust_5fearliest_5fpresentation_5ftime',['set_allow_adjust_earliest_presentation_time',['../db/d95/classshaka_1_1media_1_1mp4_1_1Fragmenter.html#a4274081cba791a24187e0512764a4b0e',1,'shaka::media::mp4::Fragmenter']]], ['set_5fclock',['set_clock',['../df/d46/classshaka_1_1media_1_1Muxer.html#a3cc7feaee9a2c3a7d0569cb9c67c8c68',1,'shaka::media::Muxer']]], ['set_5fdts',['set_dts',['../d2/d93/classshaka_1_1media_1_1mp2t_1_1PesPacket.html#a9917d625989f0eaac93fec12fec8dca0',1,'shaka::media::mp2t::PesPacket']]], ['set_5fduration_5fseconds',['set_duration_seconds',['../d8/de1/classshaka_1_1Period.html#a5519676b3185c9902e98f5f3762d6d71',1,'shaka::Period']]], diff --git a/docs/search/variables_b.js b/docs/search/variables_b.js index 08a1796be4..2ddba26da0 100644 --- a/docs/search/variables_b.js +++ b/docs/search/variables_b.js @@ -1,6 +1,7 @@ var searchData= [ ['output',['output',['../d2/d7b/structshaka_1_1StreamDescriptor.html#a08ce812991297de47354b99cdaec5415',1,'shaka::StreamDescriptor']]], + ['output_5ffile_5findex',['output_file_index',['../d0/d27/structshaka_1_1media_1_1MuxerOptions.html#ae6f2196d3bc69a25bd9a7ce73ec4db69',1,'shaka::media::MuxerOptions']]], ['output_5ffile_5fname',['output_file_name',['../d0/d27/structshaka_1_1media_1_1MuxerOptions.html#a5397ee8759a663aea68261600e528d82',1,'shaka::media::MuxerOptions']]], ['output_5fformat',['output_format',['../d2/d7b/structshaka_1_1StreamDescriptor.html#a025d9a9a1612654da2b0c99fe81378db',1,'shaka::StreamDescriptor']]], ['output_5fmedia_5finfo',['output_media_info',['../d5/de3/structshaka_1_1PackagingParams.html#a9206160a0fb92a9e9ee27fd8e9725ea1',1,'shaka::PackagingParams']]] diff --git a/html/_images/plantuml-2b4e7ead076336273a38a8dd3c2a8047700aa621.png b/html/_images/plantuml-2b4e7ead076336273a38a8dd3c2a8047700aa621.png index 04b80ca418..45c0016c88 100644 Binary files a/html/_images/plantuml-2b4e7ead076336273a38a8dd3c2a8047700aa621.png and b/html/_images/plantuml-2b4e7ead076336273a38a8dd3c2a8047700aa621.png differ diff --git a/html/_images/plantuml-5e2d47ce65c3aa9490c00263dd49c9ce72abe2c8.png b/html/_images/plantuml-5e2d47ce65c3aa9490c00263dd49c9ce72abe2c8.png index c0608386e0..bea63223a9 100644 Binary files a/html/_images/plantuml-5e2d47ce65c3aa9490c00263dd49c9ce72abe2c8.png and b/html/_images/plantuml-5e2d47ce65c3aa9490c00263dd49c9ce72abe2c8.png differ diff --git a/html/_images/plantuml-62cab1b32d19a8bba05a432164fc35f0fd34ba1b.png b/html/_images/plantuml-62cab1b32d19a8bba05a432164fc35f0fd34ba1b.png index 92b06ba1aa..a3a3bdec4c 100644 Binary files a/html/_images/plantuml-62cab1b32d19a8bba05a432164fc35f0fd34ba1b.png and b/html/_images/plantuml-62cab1b32d19a8bba05a432164fc35f0fd34ba1b.png differ diff --git a/html/_images/plantuml-71609151dc28fa4de722df6081e727525bbd8c2a.png b/html/_images/plantuml-71609151dc28fa4de722df6081e727525bbd8c2a.png index 4079e36cd0..8d3875c244 100644 Binary files a/html/_images/plantuml-71609151dc28fa4de722df6081e727525bbd8c2a.png and b/html/_images/plantuml-71609151dc28fa4de722df6081e727525bbd8c2a.png differ diff --git a/html/_images/plantuml-cc4af54b1729e5f327a3d00f038006dfe901ee55.png b/html/_images/plantuml-cc4af54b1729e5f327a3d00f038006dfe901ee55.png index 92cefa8590..5cbc2caee6 100644 Binary files a/html/_images/plantuml-cc4af54b1729e5f327a3d00f038006dfe901ee55.png and b/html/_images/plantuml-cc4af54b1729e5f327a3d00f038006dfe901ee55.png differ diff --git a/html/_images/plantuml-d388f7ab1eb3f4d70c57feb299c189351a097db9.png b/html/_images/plantuml-d388f7ab1eb3f4d70c57feb299c189351a097db9.png index d7dc801fec..d2bc5d6b44 100644 Binary files a/html/_images/plantuml-d388f7ab1eb3f4d70c57feb299c189351a097db9.png and b/html/_images/plantuml-d388f7ab1eb3f4d70c57feb299c189351a097db9.png differ diff --git a/html/_images/plantuml-edc9d35f3b0f3e20a550695f8a0bdb29a752d238.png b/html/_images/plantuml-edc9d35f3b0f3e20a550695f8a0bdb29a752d238.png index 29a4e326ad..5e12decc27 100644 Binary files a/html/_images/plantuml-edc9d35f3b0f3e20a550695f8a0bdb29a752d238.png and b/html/_images/plantuml-edc9d35f3b0f3e20a550695f8a0bdb29a752d238.png differ diff --git a/html/_sources/tutorials/live.rst.txt b/html/_sources/tutorials/live.rst.txt index 9d6b5050dc..8cbb563f42 100644 --- a/html/_sources/tutorials/live.rst.txt +++ b/html/_sources/tutorials/live.rst.txt @@ -33,7 +33,8 @@ Here are some examples. 'in=udp://225.1.1.8:8002?interface=172.29.46.122,stream=video,init_segment=h264_480p_init.mp4,segment_template=h264_480p_$Number$.m4s,playlist_name=h264_480p.m3u8' \ 'in=udp://225.1.1.8:8003?interface=172.29.46.122,stream=video,init_segment=h264_720p_init.mp4,segment_template=h264_720p_$Number$.m4s,playlist_name=h264_720p.m3u8' \ 'in=udp://225.1.1.8:8004?interface=172.29.46.122,stream=video,init_segment=h264_1080p_init.mp4,segment_template=h264_1080p_$Number$.m4s,playlist_name=h264_1080p.m3u8' \ - --hls_master_playlist_output h264_master.m3u8 + --hls_master_playlist_output h264_master.m3u8 \ + --hls_playlist_type LIVE .. note:: diff --git a/html/searchindex.js b/html/searchindex.js index 760ac910ba..c3dac53f6a 100644 --- a/html/searchindex.js +++ b/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["build_instructions","design","design_back","docker_instructions","documentation","index","library","library_details","options/chunking_options","options/dash_options","options/drm_stream_descriptors","options/general_encryption_options","options/hls_options","options/hls_stream_descriptors","options/mp4_output_options","options/playready_encryption_options","options/raw_key_encryption_options","options/segment_template_formatting","options/stream_descriptors","options/udp_file_options","options/widevine_encryption_options","tutorials/basic_usage","tutorials/dash","tutorials/dash_hls_example","tutorials/drm","tutorials/encoding","tutorials/fairplay","tutorials/ffmpeg_piping","tutorials/hls","tutorials/live","tutorials/playready","tutorials/raw_key","tutorials/tutorials","tutorials/widevine"],envversion:52,filenames:["build_instructions.md","design.rst","design_back.rst","docker_instructions.md","documentation.rst","index.rst","library.rst","library_details.rst","options/chunking_options.rst","options/dash_options.rst","options/drm_stream_descriptors.rst","options/general_encryption_options.rst","options/hls_options.rst","options/hls_stream_descriptors.rst","options/mp4_output_options.rst","options/playready_encryption_options.rst","options/raw_key_encryption_options.rst","options/segment_template_formatting.rst","options/stream_descriptors.rst","options/udp_file_options.rst","options/widevine_encryption_options.rst","tutorials/basic_usage.rst","tutorials/dash.rst","tutorials/dash_hls_example.rst","tutorials/drm.rst","tutorials/encoding.rst","tutorials/fairplay.rst","tutorials/ffmpeg_piping.rst","tutorials/hls.rst","tutorials/live.rst","tutorials/playready.rst","tutorials/raw_key.rst","tutorials/tutorials.rst","tutorials/widevine.rst"],objects:{"":{"shaka::ChunkingParams":[7,0,1,"_CPPv2N5shaka14ChunkingParamsE"],"shaka::ChunkingParams::segment_duration_in_seconds":[7,1,1,"_CPPv2N5shaka14ChunkingParams27segment_duration_in_secondsE"],"shaka::ChunkingParams::segment_sap_aligned":[7,1,1,"_CPPv2N5shaka14ChunkingParams19segment_sap_alignedE"],"shaka::ChunkingParams::subsegment_duration_in_seconds":[7,1,1,"_CPPv2N5shaka14ChunkingParams30subsegment_duration_in_secondsE"],"shaka::ChunkingParams::subsegment_sap_aligned":[7,1,1,"_CPPv2N5shaka14ChunkingParams22subsegment_sap_alignedE"],"shaka::DecryptionParams":[7,0,1,"_CPPv2N5shaka16DecryptionParamsE"],"shaka::DecryptionParams::key_provider":[7,1,1,"_CPPv2N5shaka16DecryptionParams12key_providerE"],"shaka::EncryptionParams":[7,0,1,"_CPPv2N5shaka16EncryptionParamsE"],"shaka::EncryptionParams::EncryptedStreamAttributes":[7,0,1,"_CPPv2N5shaka16EncryptionParams25EncryptedStreamAttributesE"],"shaka::EncryptionParams::clear_lead_in_seconds":[7,1,1,"_CPPv2N5shaka16EncryptionParams21clear_lead_in_secondsE"],"shaka::EncryptionParams::generate_common_pssh":[7,1,1,"_CPPv2N5shaka16EncryptionParams20generate_common_psshE"],"shaka::EncryptionParams::generate_playready_pssh":[7,1,1,"_CPPv2N5shaka16EncryptionParams23generate_playready_psshE"],"shaka::EncryptionParams::generate_widevine_pssh":[7,1,1,"_CPPv2N5shaka16EncryptionParams22generate_widevine_psshE"],"shaka::EncryptionParams::kNoKeyRotation":[7,1,1,"_CPPv2N5shaka16EncryptionParams14kNoKeyRotationE"],"shaka::EncryptionParams::kProtectionSchemeCenc":[7,1,1,"_CPPv2N5shaka16EncryptionParams21kProtectionSchemeCencE"],"shaka::EncryptionParams::key_provider":[7,1,1,"_CPPv2N5shaka16EncryptionParams12key_providerE"],"shaka::EncryptionParams::stream_label_func":[7,1,1,"_CPPv2N5shaka16EncryptionParams17stream_label_funcE"],"shaka::EncryptionParams::vp9_subsample_encryption":[7,1,1,"_CPPv2N5shaka16EncryptionParams24vp9_subsample_encryptionE"],"shaka::HlsParams":[7,0,1,"_CPPv2N5shaka9HlsParamsE"],"shaka::HlsParams::base_url":[7,1,1,"_CPPv2N5shaka9HlsParams8base_urlE"],"shaka::HlsParams::default_language":[7,1,1,"_CPPv2N5shaka9HlsParams16default_languageE"],"shaka::HlsParams::key_uri":[7,1,1,"_CPPv2N5shaka9HlsParams7key_uriE"],"shaka::HlsParams::master_playlist_output":[7,1,1,"_CPPv2N5shaka9HlsParams22master_playlist_outputE"],"shaka::HlsParams::playlist_type":[7,1,1,"_CPPv2N5shaka9HlsParams13playlist_typeE"],"shaka::HlsParams::preserved_segments_outside_live_window":[7,1,1,"_CPPv2N5shaka9HlsParams38preserved_segments_outside_live_windowE"],"shaka::HlsParams::time_shift_buffer_depth":[7,1,1,"_CPPv2N5shaka9HlsParams23time_shift_buffer_depthE"],"shaka::HlsPlaylistType":[7,2,1,"_CPPv2N5shaka15HlsPlaylistTypeE"],"shaka::KeyProvider":[7,2,1,"_CPPv2N5shaka11KeyProviderE"],"shaka::Mp4OutputParams":[7,0,1,"_CPPv2N5shaka15Mp4OutputParamsE"],"shaka::Mp4OutputParams::kNoSidxBoxInSegment":[7,1,1,"_CPPv2N5shaka15Mp4OutputParams19kNoSidxBoxInSegmentE"],"shaka::Mp4OutputParams::use_decoding_timestamp_in_timeline":[7,1,1,"_CPPv2N5shaka15Mp4OutputParams34use_decoding_timestamp_in_timelineE"],"shaka::MpdParams":[7,0,1,"_CPPv2N5shaka9MpdParamsE"],"shaka::MpdParams::UtcTiming":[7,0,1,"_CPPv2N5shaka9MpdParams9UtcTimingE"],"shaka::MpdParams::allow_approximate_segment_timeline":[7,1,1,"_CPPv2N5shaka9MpdParams34allow_approximate_segment_timelineE"],"shaka::MpdParams::base_urls":[7,1,1,"_CPPv2N5shaka9MpdParams9base_urlsE"],"shaka::MpdParams::default_language":[7,1,1,"_CPPv2N5shaka9MpdParams16default_languageE"],"shaka::MpdParams::generate_dash_if_iop_compliant_mpd":[7,1,1,"_CPPv2N5shaka9MpdParams34generate_dash_if_iop_compliant_mpdE"],"shaka::MpdParams::generate_static_live_mpd":[7,1,1,"_CPPv2N5shaka9MpdParams24generate_static_live_mpdE"],"shaka::MpdParams::kSuggestedPresentationDelayNotSet":[7,1,1,"_CPPv2N5shaka9MpdParams33kSuggestedPresentationDelayNotSetE"],"shaka::MpdParams::min_buffer_time":[7,1,1,"_CPPv2N5shaka9MpdParams15min_buffer_timeE"],"shaka::MpdParams::minimum_update_period":[7,1,1,"_CPPv2N5shaka9MpdParams21minimum_update_periodE"],"shaka::MpdParams::mpd_output":[7,1,1,"_CPPv2N5shaka9MpdParams10mpd_outputE"],"shaka::MpdParams::preserved_segments_outside_live_window":[7,1,1,"_CPPv2N5shaka9MpdParams38preserved_segments_outside_live_windowE"],"shaka::MpdParams::time_shift_buffer_depth":[7,1,1,"_CPPv2N5shaka9MpdParams23time_shift_buffer_depthE"],"shaka::Packager":[6,0,1,"_CPPv2N5shaka8PackagerE"],"shaka::Packager::Cancel":[6,3,1,"_CPPv2N5shaka8Packager6CancelEv"],"shaka::Packager::DefaultStreamLabelFunction":[6,3,1,"_CPPv2N5shaka8Packager26DefaultStreamLabelFunctionEiiiRKN16EncryptionParams25EncryptedStreamAttributesE"],"shaka::Packager::GetLibraryVersion":[6,3,1,"_CPPv2N5shaka8Packager17GetLibraryVersionEv"],"shaka::Packager::Initialize":[6,3,1,"_CPPv2N5shaka8Packager10InitializeERK15PackagingParamsRKNSt6vectorI16StreamDescriptorEE"],"shaka::Packager::Run":[6,3,1,"_CPPv2N5shaka8Packager3RunEv"],"shaka::PackagingParams":[7,0,1,"_CPPv2N5shaka15PackagingParamsE"],"shaka::PackagingParams::ad_cue_generator_params":[7,1,1,"_CPPv2N5shaka15PackagingParams23ad_cue_generator_paramsE"],"shaka::PackagingParams::buffer_callback_params":[7,1,1,"_CPPv2N5shaka15PackagingParams22buffer_callback_paramsE"],"shaka::PackagingParams::chunking_params":[7,1,1,"_CPPv2N5shaka15PackagingParams15chunking_paramsE"],"shaka::PackagingParams::encryption_params":[7,1,1,"_CPPv2N5shaka15PackagingParams17encryption_paramsE"],"shaka::PackagingParams::hls_params":[7,1,1,"_CPPv2N5shaka15PackagingParams10hls_paramsE"],"shaka::PackagingParams::mp4_output_params":[7,1,1,"_CPPv2N5shaka15PackagingParams17mp4_output_paramsE"],"shaka::PackagingParams::mpd_params":[7,1,1,"_CPPv2N5shaka15PackagingParams10mpd_paramsE"],"shaka::PackagingParams::output_media_info":[7,1,1,"_CPPv2N5shaka15PackagingParams17output_media_infoE"],"shaka::PackagingParams::temp_dir":[7,1,1,"_CPPv2N5shaka15PackagingParams8temp_dirE"],"shaka::PlayReadyEncryptionParams":[7,0,1,"_CPPv2N5shaka25PlayReadyEncryptionParamsE"],"shaka::PlayReadyEncryptionParams::ca_file":[7,1,1,"_CPPv2N5shaka25PlayReadyEncryptionParams7ca_fileE"],"shaka::PlayReadyEncryptionParams::client_cert_file":[7,1,1,"_CPPv2N5shaka25PlayReadyEncryptionParams16client_cert_fileE"],"shaka::PlayReadyEncryptionParams::client_cert_private_key_file":[7,1,1,"_CPPv2N5shaka25PlayReadyEncryptionParams28client_cert_private_key_fileE"],"shaka::PlayReadyEncryptionParams::client_cert_private_key_password":[7,1,1,"_CPPv2N5shaka25PlayReadyEncryptionParams32client_cert_private_key_passwordE"],"shaka::PlayReadyEncryptionParams::key_server_url":[7,1,1,"_CPPv2N5shaka25PlayReadyEncryptionParams14key_server_urlE"],"shaka::PlayReadyEncryptionParams::program_identifier":[7,1,1,"_CPPv2N5shaka25PlayReadyEncryptionParams18program_identifierE"],"shaka::Status":[7,0,1,"_CPPv2N5shaka6StatusE"],"shaka::Status::Status":[7,3,1,"_CPPv2N5shaka6Status6StatusEv"],"shaka::Status::ToString":[7,3,1,"_CPPv2NK5shaka6Status8ToStringEv"],"shaka::Status::Update":[7,3,1,"_CPPv2N5shaka6Status6UpdateE6Status"],"shaka::StreamDescriptor":[7,0,1,"_CPPv2N5shaka16StreamDescriptorE"],"shaka::StreamDescriptor::bandwidth":[7,1,1,"_CPPv2N5shaka16StreamDescriptor9bandwidthE"],"shaka::StreamDescriptor::drm_label":[7,1,1,"_CPPv2N5shaka16StreamDescriptor9drm_labelE"],"shaka::StreamDescriptor::hls_group_id":[7,1,1,"_CPPv2N5shaka16StreamDescriptor12hls_group_idE"],"shaka::StreamDescriptor::hls_iframe_playlist_name":[7,1,1,"_CPPv2N5shaka16StreamDescriptor24hls_iframe_playlist_nameE"],"shaka::StreamDescriptor::hls_name":[7,1,1,"_CPPv2N5shaka16StreamDescriptor8hls_nameE"],"shaka::StreamDescriptor::hls_playlist_name":[7,1,1,"_CPPv2N5shaka16StreamDescriptor17hls_playlist_nameE"],"shaka::StreamDescriptor::input":[7,1,1,"_CPPv2N5shaka16StreamDescriptor5inputE"],"shaka::StreamDescriptor::language":[7,1,1,"_CPPv2N5shaka16StreamDescriptor8languageE"],"shaka::StreamDescriptor::output":[7,1,1,"_CPPv2N5shaka16StreamDescriptor6outputE"],"shaka::StreamDescriptor::output_format":[7,1,1,"_CPPv2N5shaka16StreamDescriptor13output_formatE"],"shaka::StreamDescriptor::segment_template":[7,1,1,"_CPPv2N5shaka16StreamDescriptor16segment_templateE"],"shaka::StreamDescriptor::skip_encryption":[7,1,1,"_CPPv2N5shaka16StreamDescriptor15skip_encryptionE"],"shaka::StreamDescriptor::stream_selector":[7,1,1,"_CPPv2N5shaka16StreamDescriptor15stream_selectorE"],"shaka::StreamDescriptor::trick_play_factor":[7,1,1,"_CPPv2N5shaka16StreamDescriptor17trick_play_factorE"],"shaka::WidevineDecryptionParams":[7,0,1,"_CPPv2N5shaka24WidevineDecryptionParamsE"],"shaka::WidevineDecryptionParams::key_server_url":[7,1,1,"_CPPv2N5shaka24WidevineDecryptionParams14key_server_urlE"],"shaka::WidevineDecryptionParams::signer":[7,1,1,"_CPPv2N5shaka24WidevineDecryptionParams6signerE"],"shaka::WidevineEncryptionParams":[7,0,1,"_CPPv2N5shaka24WidevineEncryptionParamsE"],"shaka::WidevineEncryptionParams::content_id":[7,1,1,"_CPPv2N5shaka24WidevineEncryptionParams10content_idE"],"shaka::WidevineEncryptionParams::enable_entitlement_license":[7,1,1,"_CPPv2N5shaka24WidevineEncryptionParams26enable_entitlement_licenseE"],"shaka::WidevineEncryptionParams::group_id":[7,1,1,"_CPPv2N5shaka24WidevineEncryptionParams8group_idE"],"shaka::WidevineEncryptionParams::key_server_url":[7,1,1,"_CPPv2N5shaka24WidevineEncryptionParams14key_server_urlE"],"shaka::WidevineEncryptionParams::policy":[7,1,1,"_CPPv2N5shaka24WidevineEncryptionParams6policyE"],"shaka::WidevineEncryptionParams::signer":[7,1,1,"_CPPv2N5shaka24WidevineEncryptionParams6signerE"],"shaka::WidevineSigner":[7,0,1,"_CPPv2N5shaka14WidevineSignerE"],"shaka::WidevineSigner::SigningKeyType":[7,2,1,"_CPPv2N5shaka14WidevineSigner14SigningKeyTypeE"],"shaka::WidevineSigner::iv":[7,1,1,"_CPPv2N5shaka14WidevineSigner2ivE"],"shaka::WidevineSigner::kAes":[7,4,1,"_CPPv2N5shaka14WidevineSigner4kAesE"],"shaka::WidevineSigner::kNone":[7,4,1,"_CPPv2N5shaka14WidevineSigner5kNoneE"],"shaka::WidevineSigner::kRsa":[7,4,1,"_CPPv2N5shaka14WidevineSigner4kRsaE"],"shaka::WidevineSigner::key":[7,1,1,"_CPPv2N5shaka14WidevineSigner3keyE"],"shaka::WidevineSigner::signer_name":[7,1,1,"_CPPv2N5shaka14WidevineSigner11signer_nameE"],"shaka::WidevineSigner::signing_key_type":[7,1,1,"_CPPv2N5shaka14WidevineSigner16signing_key_typeE"],"shaka::error::ALREADY_EXISTS":[7,4,1,"_CPPv2N5shaka5error14ALREADY_EXISTSE"],"shaka::error::CANCELLED":[7,4,1,"_CPPv2N5shaka5error9CANCELLEDE"],"shaka::error::CHUNKING_ERROR":[7,4,1,"_CPPv2N5shaka5error14CHUNKING_ERRORE"],"shaka::error::Code":[7,2,1,"_CPPv2N5shaka5error4CodeE"],"shaka::error::ENCRYPTION_FAILURE":[7,4,1,"_CPPv2N5shaka5error18ENCRYPTION_FAILUREE"],"shaka::error::END_OF_STREAM":[7,4,1,"_CPPv2N5shaka5error13END_OF_STREAME"],"shaka::error::FILE_FAILURE":[7,4,1,"_CPPv2N5shaka5error12FILE_FAILUREE"],"shaka::error::FRAGMENT_FINALIZED":[7,4,1,"_CPPv2N5shaka5error18FRAGMENT_FINALIZEDE"],"shaka::error::HTTP_FAILURE":[7,4,1,"_CPPv2N5shaka5error12HTTP_FAILUREE"],"shaka::error::INTERNAL_ERROR":[7,4,1,"_CPPv2N5shaka5error14INTERNAL_ERRORE"],"shaka::error::INVALID_ARGUMENT":[7,4,1,"_CPPv2N5shaka5error16INVALID_ARGUMENTE"],"shaka::error::MUXER_FAILURE":[7,4,1,"_CPPv2N5shaka5error13MUXER_FAILUREE"],"shaka::error::NOT_FOUND":[7,4,1,"_CPPv2N5shaka5error9NOT_FOUNDE"],"shaka::error::OK":[7,4,1,"_CPPv2N5shaka5error2OKE"],"shaka::error::PARSER_FAILURE":[7,4,1,"_CPPv2N5shaka5error14PARSER_FAILUREE"],"shaka::error::SERVER_ERROR":[7,4,1,"_CPPv2N5shaka5error12SERVER_ERRORE"],"shaka::error::STOPPED":[7,4,1,"_CPPv2N5shaka5error7STOPPEDE"],"shaka::error::TIME_OUT":[7,4,1,"_CPPv2N5shaka5error8TIME_OUTE"],"shaka::error::TRICK_PLAY_ERROR":[7,4,1,"_CPPv2N5shaka5error16TRICK_PLAY_ERRORE"],"shaka::error::UNIMPLEMENTED":[7,4,1,"_CPPv2N5shaka5error13UNIMPLEMENTEDE"],"shaka::error::UNKNOWN":[7,4,1,"_CPPv2N5shaka5error7UNKNOWNE"],"shaka::kEvent":[7,4,1,"_CPPv2N5shaka6kEventE"],"shaka::kLive":[7,4,1,"_CPPv2N5shaka5kLiveE"],"shaka::kNone":[7,4,1,"_CPPv2N5shaka5kNoneE"],"shaka::kPlayReady":[7,4,1,"_CPPv2N5shaka10kPlayReadyE"],"shaka::kRawKey":[7,4,1,"_CPPv2N5shaka7kRawKeyE"],"shaka::kVod":[7,4,1,"_CPPv2N5shaka4kVodE"],"shaka::kWidevine":[7,4,1,"_CPPv2N5shaka9kWidevineE"]}},objnames:{"0":["cpp","class","C++ class"],"1":["cpp","member","C++ member"],"2":["cpp","type","C++ type"],"3":["cpp","function","C++ function"],"4":["cpp","enumerator","C++ enumerator"]},objtypes:{"0":"cpp:class","1":"cpp:member","2":"cpp:type","3":"cpp:function","4":"cpp:enumerator"},terms:{"000000407073736800000000edef8ba979d64acea3c827dcd51d21ed000000201a0d7769646576696e655f74657374220f7465737420636f6e74656e74206964":[26,31],"0x63656e63":7,"1000k":25,"1080p":25,"1500k":25,"1ae8ccd0e7985cc0b6203a55855a1034afc252980e970ca90e5202689f947ab9":33,"3000k":25,"300k":25,"360p":25,"480p":25,"4cb5326355e1559d60b46167740e04624d0d2f51":0,"4d001e":21,"500k":25,"6000k":25,"600k":25,"65k":27,"69eaa802a6763af979e8d1940fb88392":[26,31],"6d76f25cb17f5e16b8eaef6bbf582d8":[26,31],"720p":25,"7465737420636f6e74656e74206964":[26,31,33],"break":28,"byte":[4,16,26,27,31],"case":[4,7,10,17,18,22,26,27,28,29,31,33],"class":[6,7],"const":[6,7],"default":[0,3,4,6,7,8,9,10,11,12,13,14,16,17,18,19,20,22,26,27,28,29,31,33],"enum":7,"export":0,"function":[6,7],"int":[6,7],"long":0,"public":[6,7],"return":[6,7],"short":28,"static":[4,6,7,9,22,27],"switch":[0,25],"true":7,"try":[0,7],"void":[6,7],AES:[4,7,20,33],AND:29,For:[4,7,9,10,12,18,22,26,27,28,29,31,33],HLS:[5,7,21,22,23,25,26,29,31,32,33],IDs:[4,20,33],Its:[4,18],NOT:0,Not:[17,22,25,28,29],One:[4,16,26,31],The:[0,3,4,6,7,9,12,13,16,17,18,20,21,22,23,25,26,27,28,29,31,33],Then:3,There:[0,4,18,27,33],These:[4,18],Use:[0,6,7],Used:[4,13,18,28],Using:4,YES:[4,7,12,28],_x64:0,a4631a153a443df9eed0593043db7519:[26,31],aac:[21,25,28],abba271e8bcf552bbd2e86a434a9a5d9:[26,31],about:0,abov:[0,4,7,9,12,17,22,23,27,28,29],absent:[26,31],absolut:[4,7,15],accept:0,access:[0,3,4,7,8,9,12,17,22,28,29],accommod:[4,7,9,12,22,28],accord:[17,22,28,29],accur:[4,7,9,22],achiev:25,acodec:27,acquisit:7,across:[4,18,25],actual:[4,7,8],ad_cue_generator_param:7,adapt:[22,25,28],adcuegeneratorparam:7,add:0,added:[4,7,9,22],adding:0,addit:[4,17,18,20,22,28,29,33],addr:[19,29],address:[19,29],adjust:27,admin:0,administr:0,advanc:0,aes_signing_iv:[4,20,33],aes_signing_kei:[4,20,33],affect:[0,4,18],after:[0,7,27,29],agre:0,ahead:0,aka:0,align:[17,22,25,28,29],all:[0,4,7,9,22,26,29,31],allow:[0,4,7,9,12,19,22,25,26,28,29,31],allow_approximate_segment_timelin:[4,7,9,22],alreadi:0,already_exist:7,also:[0,21,27,28],alt:25,altern:28,alwai:[4,7,9,22,27],among:[4,18],analysi:32,ani:[0,4,7,9,18,22],anoth:[0,4,6,21,27,33],api:[6,7],app:0,appear:0,appl:[4,7,12,28],appli:[4,10,16,18,21,22,26,27,31,33],applic:[3,17,22,28,29],appropri:[0,6],apt:0,arbitrari:[4,16,26,31],architectur:5,archlinux:0,arg:0,argument:0,assign:7,associ:[6,7,33],assum:[0,3,27],assur:7,attribut:[4,7,12,13,17,18,22,28,29],audio:[3,4,6,7,9,10,12,13,16,18,21,22,23,25,26,27,28,29,31,33],audio_:29,audio_init:29,aur:0,authent:7,author:[4,7,15],auto:25,automat:[4,7,9,12,22,28,29],autoupd:0,avail:[0,3,4,18,22,28,29],avc1:21,avfound:27,avoid:29,back:29,band:7,bandwidth:[4,7,17,18,22,28,29],base:[4,7,11,12,13,17,18,22,26,28,29,31,33],base_url:[4,7,9,22],baselin:25,baseurl:[4,7,9,22],bashrc:0,basic:[5,32],been:[0,6],befor:[4,25],begin:[4,7,8,27],being:[17,22,28,29],belong:7,below:[0,4,13,18,22,26,28,31,33],bin:0,binari:[0,4],bit:[0,4,7,18],bitrat:[4,18,22],blob:0,block:[6,27],bmff:7,bool:7,both:[7,17,22,27,28,29,33],boundari:25,box:[4,7,14,16,20,33],branch:0,buffer:[4,7,9,12,14,22,28],buffer_callback_param:7,buffercallbackparam:7,bufsiz:25,bug:[4,7,14],build:4,built:4,bundl:0,bzip2:0,ca_fil:[4,7,15],call:[0,6],callback:7,can:[0,3,4,6,7,16,18,21,22,25,26,27,28,29,31,33],cancel:[6,7],cannot:[4,7,27],capabl:21,captur:32,care:29,carefulli:27,carri:27,categori:0,cb541084c99731aef4fff74500c12ead:[26,31],cbc1:[4,7,11,26,31,33],cbc:[4,7,11,26,31,33],cen:[4,7,11,26,31,33],cenc:[4,7,11,26,31,33],cert:[4,7,15],certif:[4,7,15],chang:[0,25],charact:[17,22,28,29],check:0,choos:[4,7,9,12,22,28],chosen:0,chromium:[0,4,7,14],chunk:[7,28],chunking_error:7,chunking_param:7,chunkingparam:7,clang:0,clear:[4,7,11,26,31,33],clear_lead:[4,11,26,31,33],clear_lead_in_second:7,client:[4,7,15,28],client_cert_fil:[4,7,15],client_cert_private_key_fil:[4,7,15],client_cert_private_key_password:[4,7,15],clone:0,close:[4,7,9,22],cmd:0,code:[5,6,7],codec:21,codec_str:21,column:25,com:[0,4,5,7,12,14,26,28,31,33],combin:7,comma:[4,9,22],comma_separated_url:[4,9,22],command:[0,3,4,16,21,22,23,26,28,29,31,32],commit:0,common:[0,4,7,9,16,20,22,25,26,31,33],commun:[0,28],compat:0,complet:[0,4,6,7,9,22,29,30],complex:21,compliant:7,concaten:[4,16,26,31],concatenated_pssh:[26,31],concept:27,condit:[25,29],config:[0,26,31,33],configur:[0,3,7],consid:[4,6,7,9,20,22,33],consist:[4,18],constexpr:7,construct:[7,17,22,28,29],contain:[4,6,7,17,18,20,21,22,25,27,28,29,33],container:3,content:[4,7,9,12,18,20,21,22,26,28,29,31,33],content_id:[4,7,20,33],context:0,contin:7,continu:0,contrari:0,control:0,conveni:7,copi:[0,25,27],correct:[4,7,9,12,22,28],correctli:0,correspond:[17,22,28,29],could:7,cover:[22,28],crbug:[4,7,14],creat:[0,4,7,13,18,22,23,26,28,31,33],credenti:[7,24],crendenti:33,crypto:7,crypto_period_dur:[4,20,33],cuepoint:7,curl:0,current:[0,7],custom:[0,4,7,10,18,26,31,33],cygwin:0,d58ce954203b7c9a9a9d467f59839249:33,dash:[5,7,18,21,23,25,26,28,29,31,32,33],data:[4,5,7,9,22,28,32],debug:0,decod:[4,7,14],decrypt:[5,7,16,20,26,31,33],decryptionparam:7,default_languag:[4,7,9,12,22,28],defaultstreamlabelfunct:6,defin:[4,7,9,10,12,17,18,20,22,26,28,29,31,33],definit:[4,7,9,17,22,28,29],delai:[4,7,9,22],demand:[7,22,29],dep:0,depend:[3,7],depict:27,depot:0,deriv:[4,7,10,18,26,31,33],describ:[4,17,22,27,28,29],descript:[4,9,22],descriptor:[6,9,16,22],design:5,detail:[0,4,7,29,33],detect:7,determin:[4,6,7,16,26,31],develop:[0,33],devic:27,diagram:5,differ:[3,4,7,9,18,22,25,26,28,29,31],digit:[4,16,26,31],directli:[0,7,29,33],directori:[0,7],disabl:[0,4,7,11,26,31,33],disallow:[19,29],docker:4,document:[0,6,22,28],doe:[4,25],don:0,done:[0,29],doubl:7,download:[0,28],doxygen:7,doxygenstruct:7,drag:0,drm:[5,7,16,20,22,28,32],drm_label:[4,7,10,16,18,26,31,33],drop:0,dump:21,dump_stream_info:[4,21],durat:[4,7,8,9,12,21,22,28],dynam:[4,7,9,22],each:[4,7,14,17,22,28,29],easier:25,edit:0,edu:0,effect:[4,7,18],either:[0,4,16,17,20,22,26,28,29,31,33],element:[4,7,9,22],elementari:28,empti:[4,7,16,26,31],enabl:[0,4,7,8,9,11,14,15,16,19,20,22,26,29,31,33],enable_entitlement_licens:7,enable_playready_encrypt:[4,7,15],enable_raw_key_decrypt:[4,16,26,31],enable_raw_key_encrypt:[4,7,16,26,31],enable_widevine_decrypt:[4,20,33],enable_widevine_encrypt:[4,7,20,33],enclos:[17,22,28,29],encod:[4,22,26,28,31,32,33],encount:7,encrypt:[5,6,7,10,12,14,18,21,22,28],encryptedstreamattribut:[6,7],encryption_failur:7,encryption_param:7,encryptionparam:[6,7],end:[0,4,7,13,18,28],end_of_stream:7,eng:21,english:[22,23,28,29],enough:7,ensur:29,entitl:7,entri:[4,7,9,22],environ:0,error:[0,6,7],error_cod:7,error_messag:7,escap:[17,22,28,29],essenti:0,estim:[4,7,18],etc:[4,7,10,13,16,18,21,26,28,31,33],even:[0,17,22,28,29],event:[4,12,28],everi:29,exactli:[4,7,8],exampl:[0,3,19,24,32],except:[0,4,7,9,12,22,28],exclus:[4,20,33],exe:0,exist:0,expect:7,explicitli:[0,3],explor:0,ext:[4,7,12,13,18,28],extend:28,extens:[4,18],extra:29,extract:[0,21],f3c5e0361e6654b28f8049c778b23946:[26,31],f7e48edb:0,fail:6,failur:6,fals:[4,7,14,21],faster:25,fetch:[4,7,33],ffmpeg:[5,25,29,32],file:[0,3,4,7,9,12,13,15,17,18,20,22,23,27,28,32,33],file_failur:7,file_path:[4,9,12,22,28],find:[0,7],findutil:0,first:[0,4,7,12,28],five:[22,23,28],fix:0,flag:[0,4,7,8,9,12,16,22,26,28,31],flow:[5,29],folder:[0,3],follow:[17,22,28,29],forc:[4,7,8],form:[4,13,16,18,19,26,28,29,31],format:[4,7,12,15,16,18,21,25,26,31],found:21,four:25,fragment:[4,7,8,14,22],fragment_dur:[4,8,14],fragment_fin:7,fragment_sap_align:[4,8],frame:[4,6,7,13,18,20,25,28,33],from:[0,4,6,7,10,18,19,21,26,27,28,29,31,33],front:0,full:[0,3,22,28],further:[4,7,9,22],gcc:0,gclient:0,gener:[7,9,14,16,18,22,27],generate_common_pssh:7,generate_dash_if_iop_compliant_mpd:7,generate_playready_pssh:7,generate_static_live_mpd:7,generate_static_mpd:[4,9,22],generate_widevine_pssh:7,get:[5,32],getcontentkei:33,getlibraryvers:6,git:0,github:[0,5,26,31],goo:[4,7,20,33],googl:[0,3,5,26,31],googlesourc:0,googletest:0,gop:25,gpg:0,group:[4,7,12,13,18,19,20,22,28,29,33],group_id:[4,7,20,33],gtest_filt:0,guarante:[4,7,9,12,22,28],gyp_crosscompil:0,gyp_defin:0,gyp_gener:0,h264:[21,22,23,26,27,28,29,31,33],h264_1080p:[22,23,26,28,29,31,33],h264_1080p_:29,h264_1080p_ifram:[22,23,28],h264_1080p_init:29,h264_360p:[22,23,26,28,29,31,33],h264_360p_:29,h264_360p_ifram:[22,23,28],h264_360p_init:29,h264_480p:[22,23,26,28,29,31,33],h264_480p_:29,h264_480p_ifram:[22,23,28],h264_480p_init:29,h264_720p:[22,23,26,28,29,31,33],h264_720p_:29,h264_720p_ifram:[22,23,28],h264_720p_init:29,h264_baseline_360p_600:[22,23,25,26,28,31,33],h264_high_1080p_6000:[22,23,26,28,31,33],h264_main_1080p_6000:[22,25,28],h264_main_480p_1000:[22,23,25,26,28,31,33],h264_main_720p_3000:[22,23,25,26,28,31,33],h264_master:[22,23,28,29,33],hand:33,handler:5,has:[0,4,6,7,18,27],hasn:0,have:[0,3,4,7,9,12,22,25,28,33],height:21,help:32,here:[0,3,6,19,21,25,26,27,29,31,33],hex:[4,15,16,20,26,31,33],hidden:0,high:22,higher:[4,6,20,33],histori:0,hls_base_url:[4,12,28],hls_group_id:[4,7,13,18,22,23,28,29],hls_iframe_playlist_nam:7,hls_key_uri:[4,12,28],hls_master_playlist_output:[4,12,13,18,22,23,28,29,33],hls_name:[4,7,13,18,22,23,28,29],hls_param:7,hls_playlist_nam:7,hls_playlist_typ:[4,12,28],hlsparam:7,hlsplaylisttyp:7,hook:0,host:3,host_media_path:3,how:[0,4,7,9,20,22,26,27,31,33],howev:29,http:[0,4,5,7,14,20,22,26,28,31,33],http_failur:7,human:7,iOS:[0,28],ident:[4,7,12,28],identifi:[4,7,15,20,33],iec:[17,22,28,29],ieee:[17,22,28,29],ifram:28,iframe_playlist_nam:[4,13,18,22,23,28],ignor:[4,7,9,12,22,28],imag:0,immedi:[4,9,22],implement:[6,17,22,28,29],impli:[4,8],implicit:[4,16,26,31],improv:0,inc:28,includ:[0,4,7,10,14,18,20,26,31,33],include_common_pssh:[4,20,33],increas:27,index:[0,5,7],indic:[4,7,9,16,22,26,31],inf:[4,18],info:[4,6,16,26,31],inform:[7,21],ingor:7,init:[7,22,28],init_seg:[4,18,22,27,28,29],initi:[4,6,7,18,27],input:[3,4,6,7,18,21,29],input_text:[22,28],inspect:21,instead:[0,4,7,9,14,22],instruct:4,integ:[17,22,28,29],integr:[0,4],inter:25,interest:4,interfac:[19,29],intermedi:7,intern:[0,6,25],internal_error:7,invalid:7,invalid_argu:7,io_block_s:27,iop:7,is_encrypt:21,iso:[7,17,22,28,29],issu:[17,22,28,29],its:[0,3,4,7,20,28,33],itself:[0,4,18],kae:7,keep:7,kei:[0,7,10,12,15,18,20,24,28,32,33],kevent:7,key_id:[4,7,16,26,31],key_info_str:[4,16,26,31],key_provid:7,key_server_url:[4,7,20,33],key_uri:7,keyint:25,keyint_min:25,keypair:7,keyprovid:7,keyserv:0,klive:7,knokeyrot:7,knone:7,knosidxboxinseg:7,know:[0,33],known:28,kplayreadi:7,kprotectionschemecenc:7,krawkei:7,krsa:7,ksuggestedpresentationdelaynotset:7,kvod:7,kwidevin:7,label:[4,6,7,10,16,18,26,31,33],lag:25,lang:[4,18],languag:[4,7,9,12,18,21,22,28],larg:27,larger:[4,7,8,17,22,28,29],last:[4,7,9,22],latenc:[4,7,9,12,22,28],later:[0,27],latest:3,lead:[4,7,11,26,31,33],least:0,less:[4,7,9,22,25],let:25,level:[0,6,25],lib:0,librari:[0,4,5],libtinfo:0,libvpx:25,libx264:25,licens:[4,7,20,33],like:[0,4,16,21,26,31],limit:0,line:[4,16,26,31],lion:27,list:[3,4,6,7,12,19,28,29],live:[4,5,7,9,12,22,28,32],live_cam:27,live_cam_audio:27,live_cam_audio_:27,live_cam_video:27,live_cam_video_:27,load:28,local:0,locat:29,look:21,loop:29,love:0,luck:0,m3u8:[4,7,13,18,22,23,28,29,33],m3u:28,m4s:[22,27,28,29],mac:27,machin:[0,3,27],macosx:0,made:[4,10,18,26,31,33],mai:[0,3,4,7,8,9,12,17,22,28,29],main:[0,4,7,9,22,25,28],make:[0,25],makepkg:0,manifest:[4,7,9,18,22,23,28,29],manifest_output_path:22,manual:0,map:3,master:[0,4,7,12,26,28,31],master_playlist_output:7,master_playlist_output_path:28,match:[4,16,17,22,26,28,29,31],materi:28,max:[4,6,20,33],max_hd_pixel:[4,6,20,33],max_sd_pixel:[4,6,20,33],max_uhd1_pixel:[4,6,20,33],maxrat:25,mean:7,meant:33,mechan:0,media:[3,4,5,7,9,12,13,14,18,22,26,27,28,29,31,32,33],media_info:7,mediainfo:7,member:7,mention:0,menu:0,merg:7,messag:[0,7],metadata:[4,7,18,28],mfc:0,microsecond:[19,29],might:0,min:25,min_buffer_tim:[4,7,9,22],minimum:[17,22,28,29],minimum_update_period:[4,7,9,22],minrat:25,mit:0,mkdir:0,mkfifo:27,mode:[4,7,18],modifi:0,monitor:27,more:[0,4,16,21,25,26,31],most:[0,4,7,9,12,22,28],mp4:[3,6,7,18,21,22,23,25,26,27,28,29,31,33],mp4_include_pssh_in_stream:[4,14],mp4_output_param:7,mp4_unittest:0,mp4_use_decoding_timestamp_in_timelin:[4,14],mp4a:21,mp4mediaparsertest:0,mp4outputparam:7,mpd:[3,4,7,9,14,22,23,26,27,28,29,31,33],mpd_output:[3,4,7,9,22,23,26,27,28,29,31,33],mpd_param:7,mpdparam:7,mpeg:28,mpegt:27,msysgit:0,multibir:25,multicast:[3,19,29],multipl:[4,18,25],must:[0,4,7,12,16,25,26,28,29,31],muxer:[4,7,14],muxer_failur:7,nalu_length_s:21,name:[0,4,7,9,13,18,20,22,28,29,33],ncurs:0,ncurses5:0,necessari:[0,7,27],necessarili:7,need:[0,3,4,7,9,12,22,25,27,28,33],net:3,network:[3,7,25],new_statu:7,newer:0,ninja:0,non:[0,4,7,20,33],not_found:7,note:[3,4,6,7,9,10,18,22,26,28,31,33],novp9_subsample_encrypt:[4,11,26,31,33],now:29,num_channel:21,num_seg:[4,9,12,22,28],num_subsegments_per_sidx:[4,14],number:[4,7,14,17,18,22,27,28,29],object:7,often:[4,7,9,20,22,33],old:29,omit:[4,7,9,12,22,28],one:[4,7,9,21,22,26,28,31],onli:[0,4,7,9,13,14,16,17,18,19,22,25,26,27,28,29,31,33],open:0,open_gop:25,oper:[3,4],optim:[4,7,9,22],option:[0,3,5,7,10,13,18,21,27],opu:25,order:29,org:0,origin:[0,7,25,29],other:[7,22,26,27,28,29,31,33],otherwis:[4,6,7,8,14,20,33],out:[0,4,7,18,21,33],output:[0,3,6,7,9,12,18,21,22,23,26,27,28,29,31,33],output_audio:6,output_format:[4,7,18],output_media_info:7,output_text:22,output_video:6,outsid:[4,7,9,12,17,22,28,29],over:22,overal:28,overall_statu:7,overrid:[0,4,7,18],own:4,pacakg:0,pack:[4,7,14],packag:[9,15,21,22,23,25,26,28,29,31,32,33],packaging_param:6,packagingparam:[6,7],packet:[19,29],pacman:0,pad:[17,22,28,29],page:[0,4,5],pair:[4,9,22],panel:0,parallel:25,param:7,paramet:[4,6,7,8,9,12,17,18,22,27,28,29],parser_failur:7,part:28,particular:0,pass:[4,25],password:[4,7,15],past:0,path:[0,4,7,12,15,18,20,28,33],pattern:[4,11,18,26,31,33],pem:[4,7,15],per:[4,6,7,14,17,20,22,28,29,33],period:7,permit:[17,22,28,29],pgp:0,pipe1:27,pipe:[4,5,18,29,32],pipelin:[4,6,7,9,12,22,28],pixel:[4,6,20,33],pixel_aspect_ratio:21,pkc:[4,20,33],plai:[4,7,18,28],plan:7,platform:0,player:[4,7,9,12,22,26,28,31,33],playlist:[4,7,12,13,18,22,23,28,29],playlist_nam:[4,13,18,22,23,28,29],playlist_typ:7,playout:7,playreadi:[7,24,32],playready_kei:[4,15],playready_key_id:[4,15],playready_server_url:[4,15],playreadyencryptionparam:7,pleas:[0,4,17,22,28,29,33],point:[4,7,8],polici:[4,7,20,33],port:[19,29],posit:7,potenti:[28,29],powershel:0,pre:[4,25],prebuilt:4,predefin:[4,16,26,31],prefix:[4,7,12,28],presenc:[4,7,18],present:[4,7,9,14,17,22,28,29],preserv:7,preserved_segments_outside_live_window:[4,7,9,12,22,28,29],primari:0,print:[17,22,28,29],printf:[17,22,28,29],privat:[4,7,15,20,33],privileg:0,probabl:0,product:33,profil:[4,7,9,22,25],program:[4,7,15],program_identifi:[4,7,15],project:7,propag:[4,7,18],properli:0,protect:[4,7,11,26,31,33],protection_schem:[4,11,26,31,33],protocol:[27,28,29],protocol_whitelist:27,prototyp:[17,22,28,29],provid:[0,4,7,10,16,17,18,20,22,26,28,29,31,33],pssh:[4,7,14,16,20,33],pull:[0,3],push_back:6,put:0,python2:0,python:0,qualiti:22,quicktim:28,race:29,random:[4,16,26,31],rang:[4,7,14],rate:[4,7,9,18,22,25,28],raw:[7,10,18,24,32,33],rawkeydecryptionparam:7,rawkeyencryptionparam:7,rawkeyparam:7,reach:33,read:[4,27],readabl:7,rebas:0,receiv:[7,19,29],recent:[4,7,9,12,22,28],recommend:25,recud:27,recv:0,redirect:27,ref:25,refer:[21,26,27,31,33],referenc:29,refresh:[4,7,9,22],regardless:[4,7,9,22],regular:[4,18],rel:[4,13,18,28],relat:[7,22,28],releas:[0,3,4],release_x64:0,remain:0,remov:[4,7,9,12,22,28,29],renam:29,rendit:[4,7,12,28],replac:[0,17,22,28,29],repo:0,repositori:[0,5],represent:[4,7,9,18,22],representationid:[17,22,28,29],request:[0,4,8,15,20,33],requir:[4,7,9,18,20,22,33],resembl:28,resolut:[4,7,10,18,25,26,31,33],result:[17,22,25,28,29],reus:[19,29],revis:0,rfc:[17,22,28,29],right:[4,7,20,29,33],role:[4,7,9,22],root:[0,4,7,14],rotat:[4,7,20,33],rsa:[4,7,20,33],rsa_signing_key_path:[4,20,33],run:[0,6],runhook:0,s8rihr:[4,7,20,33],safari:28,sai:25,same:[0,4,7,9,17,18,22,25,28,29],sampl:[4,6,7,9,18,22],sample_bit:21,sampling_frequ:21,save:0,saved_sdp_fil:27,scale:25,scenecut:25,scheme:[4,7,11,26,31,33],scheme_id_uri:[4,9,22],scheme_id_uri_value_pair:[4,9,22],schemeiduri:[4,9,22],script:[0,26,31],sdk:[0,4],sdp_file:27,search:5,sec:[4,7,18],second:[0,4,7,8,9,11,12,20,21,22,25,26,28,31,33],secur:0,see:[0,4,6,7,13,18,20,22,28,29,33],segment:[4,7,8,9,12,14,18,27],segment_dur:[4,7,8,14],segment_duration_in_second:7,segment_sap_align:[4,7,8],segment_templ:[4,7,9,18,22,27,28,29],segmenttempl:[4,7,9,22],segmenttimelin:[4,7,9,17,22,28,29],select:[0,28],selector:7,self:7,sensit:[4,10,17,18,22,26,28,29,31,33],sent:[19,29],separ:[0,4,9,22],sequenc:[17,22,28,29],seri:[22,28],serial:29,serv:[4,7,9,12,22,25,28,29],server:[4,7,15,20,29,33],server_error:7,session:28,set:[0,4,7,8,10,12,13,14,18,19,25,26,28,29,31,33],setup:[0,6,26,31,33],sever:4,shaka:[9,21,22,25,26,28,29,31,33],shaka_packag:0,shall:[17,22,28,29],shell:0,shift:[4,7,9,12,22,28],shorter:[17,22,28,29],should:[0,4,6,7,8,10,13,16,18,20,26,27,28,29,31,33],sidx:[4,7,14],sign:[4,7,20,33],signer:[4,7,20,33],signer_nam:7,signing_key_typ:7,signingkeytyp:7,similar:[0,26,29,31],similarili:27,simpl:21,sinc:[4,7,9,22],singl:[4,7,14,17,18,22,23,28,29],single_seg:[4,8],size:25,size_t:7,skip_encrypt:[4,7,10,18,26,31,33],small:28,smaller:25,smoother:25,socket:[19,27,29],softwar:28,some:[0,29],some_cont:21,someth:[4,13,18,28,33],somewher:0,sourc:[0,4,5,7,18,19,29],space:0,specif:[0,3,7,12,19,29],specifi:[4,7,8,9,10,11,13,16,18,19,20,22,26,27,28,29,31,33],speed:[25,27],split:[4,18],src:0,ssm:[19,29],stage:[4,7,9,12,22,28],stai:[4,7,9,12,22,28],start:[0,27,28],statu:[6,7],std:[6,7],step:29,still:[4,7,9,12,22,28],stop:7,store:[3,4,7,20,33],strang:0,stream:[3,6,7,8,9,14,16,21,22,23,25,27,29],stream_0:[4,13,18,28],stream_1:[4,13,18,28],stream_2:[4,13,18,28],stream_attribut:[6,7],stream_descriptor:[4,6,18,22,26,28,31,33],stream_info:6,stream_label_func:7,stream_loop:27,stream_selector:[4,6,7,18],streamdescriptor:[6,7],streamingkeydeliveri:[4,7,12,28],strict:25,string:[4,6,7,15,16,17,20,22,26,28,29,31,33],struct:7,studio:0,sub:[0,28],subsampl:[4,7,11,26,31,33],subseg:[4,7,8,14],subsegment_dur:7,subsegment_duration_in_second:7,subsegment_sap_align:7,substitu:[17,22,28,29],substitut:[17,22,28,29],success:[0,6,7],sudo:0,suffix:[7,17,22,28,29],suggested_presentation_delai:[4,9,22],suitabl:7,support:[0,4,7,19,27],switchabl:25,sync:[0,29],synopsi:[5,24,32],sysroot:0,system:[3,4,7,20,26,31,33],tabl:[17,22,28,29],tag:[3,4,7,9,12,17,18,22,28,29],tahr:0,taken:29,tar:0,target_arch:0,task:21,techniqu:22,tell:[0,27],temp_dir:7,templat:[4,7,9,18],temporari:7,test:[0,4,16,24,27],text:[4,7,9,12,18,22,28,33],than:[4,6,7,8,9,17,20,22,28,29,33],thei:[4,7,9,12,22,28],them:33,thi:[0,3,4,7,8,9,12,14,16,17,18,19,20,22,25,27,28,29,33],though:0,thread:[6,27],three:[0,4],threshold:6,thu:27,tile:25,time:[0,4,7,9,12,17,22,28,29],time_out:7,time_scal:21,time_shift_buffer_depth:[4,7,9,12,22,28],timelin:[4,7,9,14,22],timeout:[19,29],timestamp:[4,7,14],too:27,tool:[0,3,4,25,26,31],toolchain:0,top:[0,6],tostr:7,tpf:[4,18],track:[4,6,7,9,20,22,25,28,33],transcod:[4,25,27],transmit:27,transmux:[4,32],transport:28,tree:[0,26,31],trick:[4,7,18],trick_play_error:7,trick_play_factor:[4,7,18,21],truncat:[17,22,28,29],trusti:0,tune:27,tutori:[5,21,22,28,33],two:[7,27,33],type:[4,7,10,12,18,21,26,28,31,33],typic:[4,7,10,18,26,29,31,33],uat:33,udp:[3,4,18,27],uhd1:[4,6,7,10,18,20,26,31,33],uhd2:[4,6,7,10,18,20,26,31,33],uint32_t:7,uint8_t:7,unbound:28,under:[4,7,9,22,29],unimpl:7,uniqu:[4,20,33],univers:0,unknown:7,unlik:0,unmanag:0,unsign:[17,22,28,29],unspecifi:[4,13,18,28],unsupport:29,until:[6,27],unzip:0,updat:[7,29],upload:29,uri:[4,7,12,28],url:[4,7,9,12,15,17,20,22,28,29,33],usag:[5,32],use:[0,4,7,9,22,25,27,29,33],use_decoding_timestamp_in_timelin:7,used:[0,4,7,9,12,14,16,17,21,22,25,27,28,29,33],useful:7,user:[0,4,7,18,20,33],uses:[0,7,22,26,28,31,33],using:[0,4,7,12,20,26,27,28,31,33],usr:0,usual:[4,7,13,18,25,28],utc_tim:[4,9,22],utctim:[4,7,9,22],valid:7,valu:[4,7,9,10,12,17,18,22,26,27,28,29,31,33],variabl:0,varieti:28,variou:[4,7,9,12,22,28],vcodec:27,vector:[6,7],verifi:0,version:[0,3,6,17,22,28,29],via:0,video:[3,4,6,7,10,13,18,20,21,22,23,25,26,27,28,29,31,33],virtual:3,visual:0,vod:[4,12,22,28],vp9:[4,7,11,22,26,27,31,33],vp9_1080p_3000:25,vp9_360p_300:25,vp9_480p_500:25,vp9_720p_1500:25,vp9_subsample_encrypt:[4,7,11,26,31,33],vtt:[22,28],wai:[0,4,7,22,26,31],want:[0,3,17,22,25,28,29],warn:0,webcam:27,webm:[4,18,25,27],webmcam:27,well:[22,23,28],what:7,whatev:0,when:[0,4,7,14,20,25,27,29,33],wherev:0,whether:[0,6,7],which:[0,4,7,10,16,18,20,22,25,26,27,28,29,31,33],widevin:[7,24,26,31,32],widevine_test:[26,31,33],widevinedecryptionparam:7,widevineencryptionparam:7,widevinesign:7,width:[17,21,22,28,29],win:0,window:[4,7,9,12,22,28],within:[17,22,28,29],without:[0,22,28,29],work:[0,22,28],workaround:[4,7,14],would:0,write:27,www:0,x264opt:25,x64:0,xcodebuild:0,xml:[0,7],yet:0,you:[0,3,4,17,22,27,28,29,33],your:[3,4],yum:0,zero:[4,7,9,12,17,18,20,22,28,29,33],zerolat:27,zshrc:0,zypper:0},titles:["Build Instructions","Design","Design","Using Docker","Packager Documentation","Welcome to Shaka Packager\u2019s documentation!","Shaka Packager Library","Shaka Packager Library (Continued)","Chunking options","DASH options","DRM related Stream descriptor fields","General encryption options","HLS options","HLS specific stream descriptor fields","MP4 output options","PlayReady encryption options","Raw key encryption options","Segment template formatting","Stream descriptors","UDP file options","Widevine encryption options","Basic Usage","DASH","<no title>","DRM","Media Encoding","Raw key","FFmpeg piping","HLS","Live","PlayReady","Raw key","Tutorials","Widevine"],titleterms:{HLS:[2,4,12,13,18,28],Using:3,agreement:0,analysi:21,arch:0,architectur:[1,2],arm:0,artifact:0,basic:21,bitrat:25,box:[26,31],build:0,camera:27,captur:27,checkout:0,chunk:[4,8],chunkinghandl:2,code:0,command:[25,27],compil:0,contain:3,content:25,continu:7,contribut:0,credenti:33,cross:0,dash:[2,4,9,22,27],data:[1,2,27],debian:0,decrypt:4,demand:2,demux:2,depend:0,depot_tool:0,descriptor:[4,10,13,18,26,28,31,33],design:[1,2],diagram:[1,2],distro:0,docker:3,dockerhub:3,document:[4,5],drm:[4,10,18,24,26,31,33],encod:[25,27],encrypt:[4,11,15,16,20,26,31,33],event:2,exampl:[22,26,27,28,29,31,33],fedora:0,ffmpeg:27,field:[4,10,13,18,26,28,31,33],file:[19,21,29],flow:[1,2],format:[17,22,28,29],from:3,gener:[2,4,11,25,26,31,33],get:[0,3,4,21],guidelin:25,h264:25,handler:[1,2],help:21,host:0,how:25,identifi:[17,22,28,29],indic:5,input:27,instal:0,instruct:0,kei:[4,16,26,31],librari:[6,7],licens:0,linux:0,live:[2,29],mac:0,manifest:2,media:[1,2,21,25],mp4:[4,14],multi:[2,25],note:0,opensus:0,option:[4,8,9,11,12,14,15,16,19,20,22,26,28,29,31,33],other:0,output:[4,14],packag:[0,3,4,5,6,7,27],pipe:27,playreadi:[4,15,30],pssh:[26,31],raw:[4,16,26,31],relat:[4,10,18,26,31,33],requir:0,rtp:27,run:3,sampl:25,segment:[2,17,22,28,29],shaka:[0,3,4,5,6,7],should:25,singl:2,specif:[4,13,18,28],stream:[4,10,13,18,26,28,31,33],support:[17,22,28,29],synopsi:[4,22,26,28,31,33],system:0,tabl:5,templat:[17,22,28,29],test:[26,31,33],thi:[26,31],tip:0,transmux:21,trick:0,troubleshoot:0,tutori:[26,31,32],ubuntu:0,udp:[19,29],updat:0,usag:21,used:[26,31],util:[26,31],vector:[26,31],vp9:25,welcom:5,widevin:[4,20,33],window:0,xcode:0,your:0}}) \ No newline at end of file +Search.setIndex({docnames:["build_instructions","design","design_back","docker_instructions","documentation","index","library","library_details","options/chunking_options","options/dash_options","options/drm_stream_descriptors","options/general_encryption_options","options/hls_options","options/hls_stream_descriptors","options/mp4_output_options","options/playready_encryption_options","options/raw_key_encryption_options","options/segment_template_formatting","options/stream_descriptors","options/udp_file_options","options/widevine_encryption_options","tutorials/basic_usage","tutorials/dash","tutorials/dash_hls_example","tutorials/drm","tutorials/encoding","tutorials/fairplay","tutorials/ffmpeg_piping","tutorials/hls","tutorials/live","tutorials/playready","tutorials/raw_key","tutorials/tutorials","tutorials/widevine"],envversion:52,filenames:["build_instructions.md","design.rst","design_back.rst","docker_instructions.md","documentation.rst","index.rst","library.rst","library_details.rst","options/chunking_options.rst","options/dash_options.rst","options/drm_stream_descriptors.rst","options/general_encryption_options.rst","options/hls_options.rst","options/hls_stream_descriptors.rst","options/mp4_output_options.rst","options/playready_encryption_options.rst","options/raw_key_encryption_options.rst","options/segment_template_formatting.rst","options/stream_descriptors.rst","options/udp_file_options.rst","options/widevine_encryption_options.rst","tutorials/basic_usage.rst","tutorials/dash.rst","tutorials/dash_hls_example.rst","tutorials/drm.rst","tutorials/encoding.rst","tutorials/fairplay.rst","tutorials/ffmpeg_piping.rst","tutorials/hls.rst","tutorials/live.rst","tutorials/playready.rst","tutorials/raw_key.rst","tutorials/tutorials.rst","tutorials/widevine.rst"],objects:{"":{"shaka::ChunkingParams":[7,0,1,"_CPPv2N5shaka14ChunkingParamsE"],"shaka::ChunkingParams::segment_duration_in_seconds":[7,1,1,"_CPPv2N5shaka14ChunkingParams27segment_duration_in_secondsE"],"shaka::ChunkingParams::segment_sap_aligned":[7,1,1,"_CPPv2N5shaka14ChunkingParams19segment_sap_alignedE"],"shaka::ChunkingParams::subsegment_duration_in_seconds":[7,1,1,"_CPPv2N5shaka14ChunkingParams30subsegment_duration_in_secondsE"],"shaka::ChunkingParams::subsegment_sap_aligned":[7,1,1,"_CPPv2N5shaka14ChunkingParams22subsegment_sap_alignedE"],"shaka::DecryptionParams":[7,0,1,"_CPPv2N5shaka16DecryptionParamsE"],"shaka::DecryptionParams::key_provider":[7,1,1,"_CPPv2N5shaka16DecryptionParams12key_providerE"],"shaka::EncryptionParams":[7,0,1,"_CPPv2N5shaka16EncryptionParamsE"],"shaka::EncryptionParams::EncryptedStreamAttributes":[7,0,1,"_CPPv2N5shaka16EncryptionParams25EncryptedStreamAttributesE"],"shaka::EncryptionParams::clear_lead_in_seconds":[7,1,1,"_CPPv2N5shaka16EncryptionParams21clear_lead_in_secondsE"],"shaka::EncryptionParams::generate_common_pssh":[7,1,1,"_CPPv2N5shaka16EncryptionParams20generate_common_psshE"],"shaka::EncryptionParams::generate_playready_pssh":[7,1,1,"_CPPv2N5shaka16EncryptionParams23generate_playready_psshE"],"shaka::EncryptionParams::generate_widevine_pssh":[7,1,1,"_CPPv2N5shaka16EncryptionParams22generate_widevine_psshE"],"shaka::EncryptionParams::kNoKeyRotation":[7,1,1,"_CPPv2N5shaka16EncryptionParams14kNoKeyRotationE"],"shaka::EncryptionParams::kProtectionSchemeCenc":[7,1,1,"_CPPv2N5shaka16EncryptionParams21kProtectionSchemeCencE"],"shaka::EncryptionParams::key_provider":[7,1,1,"_CPPv2N5shaka16EncryptionParams12key_providerE"],"shaka::EncryptionParams::stream_label_func":[7,1,1,"_CPPv2N5shaka16EncryptionParams17stream_label_funcE"],"shaka::EncryptionParams::vp9_subsample_encryption":[7,1,1,"_CPPv2N5shaka16EncryptionParams24vp9_subsample_encryptionE"],"shaka::HlsParams":[7,0,1,"_CPPv2N5shaka9HlsParamsE"],"shaka::HlsParams::base_url":[7,1,1,"_CPPv2N5shaka9HlsParams8base_urlE"],"shaka::HlsParams::default_language":[7,1,1,"_CPPv2N5shaka9HlsParams16default_languageE"],"shaka::HlsParams::key_uri":[7,1,1,"_CPPv2N5shaka9HlsParams7key_uriE"],"shaka::HlsParams::master_playlist_output":[7,1,1,"_CPPv2N5shaka9HlsParams22master_playlist_outputE"],"shaka::HlsParams::playlist_type":[7,1,1,"_CPPv2N5shaka9HlsParams13playlist_typeE"],"shaka::HlsParams::preserved_segments_outside_live_window":[7,1,1,"_CPPv2N5shaka9HlsParams38preserved_segments_outside_live_windowE"],"shaka::HlsParams::time_shift_buffer_depth":[7,1,1,"_CPPv2N5shaka9HlsParams23time_shift_buffer_depthE"],"shaka::HlsPlaylistType":[7,2,1,"_CPPv2N5shaka15HlsPlaylistTypeE"],"shaka::KeyProvider":[7,2,1,"_CPPv2N5shaka11KeyProviderE"],"shaka::Mp4OutputParams":[7,0,1,"_CPPv2N5shaka15Mp4OutputParamsE"],"shaka::Mp4OutputParams::kNoSidxBoxInSegment":[7,1,1,"_CPPv2N5shaka15Mp4OutputParams19kNoSidxBoxInSegmentE"],"shaka::Mp4OutputParams::use_decoding_timestamp_in_timeline":[7,1,1,"_CPPv2N5shaka15Mp4OutputParams34use_decoding_timestamp_in_timelineE"],"shaka::MpdParams":[7,0,1,"_CPPv2N5shaka9MpdParamsE"],"shaka::MpdParams::UtcTiming":[7,0,1,"_CPPv2N5shaka9MpdParams9UtcTimingE"],"shaka::MpdParams::allow_approximate_segment_timeline":[7,1,1,"_CPPv2N5shaka9MpdParams34allow_approximate_segment_timelineE"],"shaka::MpdParams::base_urls":[7,1,1,"_CPPv2N5shaka9MpdParams9base_urlsE"],"shaka::MpdParams::default_language":[7,1,1,"_CPPv2N5shaka9MpdParams16default_languageE"],"shaka::MpdParams::generate_dash_if_iop_compliant_mpd":[7,1,1,"_CPPv2N5shaka9MpdParams34generate_dash_if_iop_compliant_mpdE"],"shaka::MpdParams::generate_static_live_mpd":[7,1,1,"_CPPv2N5shaka9MpdParams24generate_static_live_mpdE"],"shaka::MpdParams::kSuggestedPresentationDelayNotSet":[7,1,1,"_CPPv2N5shaka9MpdParams33kSuggestedPresentationDelayNotSetE"],"shaka::MpdParams::min_buffer_time":[7,1,1,"_CPPv2N5shaka9MpdParams15min_buffer_timeE"],"shaka::MpdParams::minimum_update_period":[7,1,1,"_CPPv2N5shaka9MpdParams21minimum_update_periodE"],"shaka::MpdParams::mpd_output":[7,1,1,"_CPPv2N5shaka9MpdParams10mpd_outputE"],"shaka::MpdParams::preserved_segments_outside_live_window":[7,1,1,"_CPPv2N5shaka9MpdParams38preserved_segments_outside_live_windowE"],"shaka::MpdParams::time_shift_buffer_depth":[7,1,1,"_CPPv2N5shaka9MpdParams23time_shift_buffer_depthE"],"shaka::Packager":[6,0,1,"_CPPv2N5shaka8PackagerE"],"shaka::Packager::Cancel":[6,3,1,"_CPPv2N5shaka8Packager6CancelEv"],"shaka::Packager::DefaultStreamLabelFunction":[6,3,1,"_CPPv2N5shaka8Packager26DefaultStreamLabelFunctionEiiiRKN16EncryptionParams25EncryptedStreamAttributesE"],"shaka::Packager::GetLibraryVersion":[6,3,1,"_CPPv2N5shaka8Packager17GetLibraryVersionEv"],"shaka::Packager::Initialize":[6,3,1,"_CPPv2N5shaka8Packager10InitializeERK15PackagingParamsRKNSt6vectorI16StreamDescriptorEE"],"shaka::Packager::Run":[6,3,1,"_CPPv2N5shaka8Packager3RunEv"],"shaka::PackagingParams":[7,0,1,"_CPPv2N5shaka15PackagingParamsE"],"shaka::PackagingParams::ad_cue_generator_params":[7,1,1,"_CPPv2N5shaka15PackagingParams23ad_cue_generator_paramsE"],"shaka::PackagingParams::buffer_callback_params":[7,1,1,"_CPPv2N5shaka15PackagingParams22buffer_callback_paramsE"],"shaka::PackagingParams::chunking_params":[7,1,1,"_CPPv2N5shaka15PackagingParams15chunking_paramsE"],"shaka::PackagingParams::encryption_params":[7,1,1,"_CPPv2N5shaka15PackagingParams17encryption_paramsE"],"shaka::PackagingParams::hls_params":[7,1,1,"_CPPv2N5shaka15PackagingParams10hls_paramsE"],"shaka::PackagingParams::mp4_output_params":[7,1,1,"_CPPv2N5shaka15PackagingParams17mp4_output_paramsE"],"shaka::PackagingParams::mpd_params":[7,1,1,"_CPPv2N5shaka15PackagingParams10mpd_paramsE"],"shaka::PackagingParams::output_media_info":[7,1,1,"_CPPv2N5shaka15PackagingParams17output_media_infoE"],"shaka::PackagingParams::temp_dir":[7,1,1,"_CPPv2N5shaka15PackagingParams8temp_dirE"],"shaka::PlayReadyEncryptionParams":[7,0,1,"_CPPv2N5shaka25PlayReadyEncryptionParamsE"],"shaka::PlayReadyEncryptionParams::ca_file":[7,1,1,"_CPPv2N5shaka25PlayReadyEncryptionParams7ca_fileE"],"shaka::PlayReadyEncryptionParams::client_cert_file":[7,1,1,"_CPPv2N5shaka25PlayReadyEncryptionParams16client_cert_fileE"],"shaka::PlayReadyEncryptionParams::client_cert_private_key_file":[7,1,1,"_CPPv2N5shaka25PlayReadyEncryptionParams28client_cert_private_key_fileE"],"shaka::PlayReadyEncryptionParams::client_cert_private_key_password":[7,1,1,"_CPPv2N5shaka25PlayReadyEncryptionParams32client_cert_private_key_passwordE"],"shaka::PlayReadyEncryptionParams::key_server_url":[7,1,1,"_CPPv2N5shaka25PlayReadyEncryptionParams14key_server_urlE"],"shaka::PlayReadyEncryptionParams::program_identifier":[7,1,1,"_CPPv2N5shaka25PlayReadyEncryptionParams18program_identifierE"],"shaka::Status":[7,0,1,"_CPPv2N5shaka6StatusE"],"shaka::Status::Status":[7,3,1,"_CPPv2N5shaka6Status6StatusEv"],"shaka::Status::ToString":[7,3,1,"_CPPv2NK5shaka6Status8ToStringEv"],"shaka::Status::Update":[7,3,1,"_CPPv2N5shaka6Status6UpdateE6Status"],"shaka::StreamDescriptor":[7,0,1,"_CPPv2N5shaka16StreamDescriptorE"],"shaka::StreamDescriptor::bandwidth":[7,1,1,"_CPPv2N5shaka16StreamDescriptor9bandwidthE"],"shaka::StreamDescriptor::drm_label":[7,1,1,"_CPPv2N5shaka16StreamDescriptor9drm_labelE"],"shaka::StreamDescriptor::hls_group_id":[7,1,1,"_CPPv2N5shaka16StreamDescriptor12hls_group_idE"],"shaka::StreamDescriptor::hls_iframe_playlist_name":[7,1,1,"_CPPv2N5shaka16StreamDescriptor24hls_iframe_playlist_nameE"],"shaka::StreamDescriptor::hls_name":[7,1,1,"_CPPv2N5shaka16StreamDescriptor8hls_nameE"],"shaka::StreamDescriptor::hls_playlist_name":[7,1,1,"_CPPv2N5shaka16StreamDescriptor17hls_playlist_nameE"],"shaka::StreamDescriptor::input":[7,1,1,"_CPPv2N5shaka16StreamDescriptor5inputE"],"shaka::StreamDescriptor::language":[7,1,1,"_CPPv2N5shaka16StreamDescriptor8languageE"],"shaka::StreamDescriptor::output":[7,1,1,"_CPPv2N5shaka16StreamDescriptor6outputE"],"shaka::StreamDescriptor::output_format":[7,1,1,"_CPPv2N5shaka16StreamDescriptor13output_formatE"],"shaka::StreamDescriptor::segment_template":[7,1,1,"_CPPv2N5shaka16StreamDescriptor16segment_templateE"],"shaka::StreamDescriptor::skip_encryption":[7,1,1,"_CPPv2N5shaka16StreamDescriptor15skip_encryptionE"],"shaka::StreamDescriptor::stream_selector":[7,1,1,"_CPPv2N5shaka16StreamDescriptor15stream_selectorE"],"shaka::StreamDescriptor::trick_play_factor":[7,1,1,"_CPPv2N5shaka16StreamDescriptor17trick_play_factorE"],"shaka::WidevineDecryptionParams":[7,0,1,"_CPPv2N5shaka24WidevineDecryptionParamsE"],"shaka::WidevineDecryptionParams::key_server_url":[7,1,1,"_CPPv2N5shaka24WidevineDecryptionParams14key_server_urlE"],"shaka::WidevineDecryptionParams::signer":[7,1,1,"_CPPv2N5shaka24WidevineDecryptionParams6signerE"],"shaka::WidevineEncryptionParams":[7,0,1,"_CPPv2N5shaka24WidevineEncryptionParamsE"],"shaka::WidevineEncryptionParams::content_id":[7,1,1,"_CPPv2N5shaka24WidevineEncryptionParams10content_idE"],"shaka::WidevineEncryptionParams::enable_entitlement_license":[7,1,1,"_CPPv2N5shaka24WidevineEncryptionParams26enable_entitlement_licenseE"],"shaka::WidevineEncryptionParams::group_id":[7,1,1,"_CPPv2N5shaka24WidevineEncryptionParams8group_idE"],"shaka::WidevineEncryptionParams::key_server_url":[7,1,1,"_CPPv2N5shaka24WidevineEncryptionParams14key_server_urlE"],"shaka::WidevineEncryptionParams::policy":[7,1,1,"_CPPv2N5shaka24WidevineEncryptionParams6policyE"],"shaka::WidevineEncryptionParams::signer":[7,1,1,"_CPPv2N5shaka24WidevineEncryptionParams6signerE"],"shaka::WidevineSigner":[7,0,1,"_CPPv2N5shaka14WidevineSignerE"],"shaka::WidevineSigner::SigningKeyType":[7,2,1,"_CPPv2N5shaka14WidevineSigner14SigningKeyTypeE"],"shaka::WidevineSigner::iv":[7,1,1,"_CPPv2N5shaka14WidevineSigner2ivE"],"shaka::WidevineSigner::kAes":[7,4,1,"_CPPv2N5shaka14WidevineSigner4kAesE"],"shaka::WidevineSigner::kNone":[7,4,1,"_CPPv2N5shaka14WidevineSigner5kNoneE"],"shaka::WidevineSigner::kRsa":[7,4,1,"_CPPv2N5shaka14WidevineSigner4kRsaE"],"shaka::WidevineSigner::key":[7,1,1,"_CPPv2N5shaka14WidevineSigner3keyE"],"shaka::WidevineSigner::signer_name":[7,1,1,"_CPPv2N5shaka14WidevineSigner11signer_nameE"],"shaka::WidevineSigner::signing_key_type":[7,1,1,"_CPPv2N5shaka14WidevineSigner16signing_key_typeE"],"shaka::error::ALREADY_EXISTS":[7,4,1,"_CPPv2N5shaka5error14ALREADY_EXISTSE"],"shaka::error::CANCELLED":[7,4,1,"_CPPv2N5shaka5error9CANCELLEDE"],"shaka::error::CHUNKING_ERROR":[7,4,1,"_CPPv2N5shaka5error14CHUNKING_ERRORE"],"shaka::error::Code":[7,2,1,"_CPPv2N5shaka5error4CodeE"],"shaka::error::ENCRYPTION_FAILURE":[7,4,1,"_CPPv2N5shaka5error18ENCRYPTION_FAILUREE"],"shaka::error::END_OF_STREAM":[7,4,1,"_CPPv2N5shaka5error13END_OF_STREAME"],"shaka::error::FILE_FAILURE":[7,4,1,"_CPPv2N5shaka5error12FILE_FAILUREE"],"shaka::error::FRAGMENT_FINALIZED":[7,4,1,"_CPPv2N5shaka5error18FRAGMENT_FINALIZEDE"],"shaka::error::HTTP_FAILURE":[7,4,1,"_CPPv2N5shaka5error12HTTP_FAILUREE"],"shaka::error::INTERNAL_ERROR":[7,4,1,"_CPPv2N5shaka5error14INTERNAL_ERRORE"],"shaka::error::INVALID_ARGUMENT":[7,4,1,"_CPPv2N5shaka5error16INVALID_ARGUMENTE"],"shaka::error::MUXER_FAILURE":[7,4,1,"_CPPv2N5shaka5error13MUXER_FAILUREE"],"shaka::error::NOT_FOUND":[7,4,1,"_CPPv2N5shaka5error9NOT_FOUNDE"],"shaka::error::OK":[7,4,1,"_CPPv2N5shaka5error2OKE"],"shaka::error::PARSER_FAILURE":[7,4,1,"_CPPv2N5shaka5error14PARSER_FAILUREE"],"shaka::error::SERVER_ERROR":[7,4,1,"_CPPv2N5shaka5error12SERVER_ERRORE"],"shaka::error::STOPPED":[7,4,1,"_CPPv2N5shaka5error7STOPPEDE"],"shaka::error::TIME_OUT":[7,4,1,"_CPPv2N5shaka5error8TIME_OUTE"],"shaka::error::TRICK_PLAY_ERROR":[7,4,1,"_CPPv2N5shaka5error16TRICK_PLAY_ERRORE"],"shaka::error::UNIMPLEMENTED":[7,4,1,"_CPPv2N5shaka5error13UNIMPLEMENTEDE"],"shaka::error::UNKNOWN":[7,4,1,"_CPPv2N5shaka5error7UNKNOWNE"],"shaka::kEvent":[7,4,1,"_CPPv2N5shaka6kEventE"],"shaka::kLive":[7,4,1,"_CPPv2N5shaka5kLiveE"],"shaka::kNone":[7,4,1,"_CPPv2N5shaka5kNoneE"],"shaka::kPlayReady":[7,4,1,"_CPPv2N5shaka10kPlayReadyE"],"shaka::kRawKey":[7,4,1,"_CPPv2N5shaka7kRawKeyE"],"shaka::kVod":[7,4,1,"_CPPv2N5shaka4kVodE"],"shaka::kWidevine":[7,4,1,"_CPPv2N5shaka9kWidevineE"]}},objnames:{"0":["cpp","class","C++ class"],"1":["cpp","member","C++ member"],"2":["cpp","type","C++ type"],"3":["cpp","function","C++ function"],"4":["cpp","enumerator","C++ enumerator"]},objtypes:{"0":"cpp:class","1":"cpp:member","2":"cpp:type","3":"cpp:function","4":"cpp:enumerator"},terms:{"000000407073736800000000edef8ba979d64acea3c827dcd51d21ed000000201a0d7769646576696e655f74657374220f7465737420636f6e74656e74206964":[26,31],"0x63656e63":7,"1000k":25,"1080p":25,"1500k":25,"1ae8ccd0e7985cc0b6203a55855a1034afc252980e970ca90e5202689f947ab9":33,"3000k":25,"300k":25,"360p":25,"480p":25,"4cb5326355e1559d60b46167740e04624d0d2f51":0,"4d001e":21,"500k":25,"6000k":25,"600k":25,"65k":27,"69eaa802a6763af979e8d1940fb88392":[26,31],"6d76f25cb17f5e16b8eaef6bbf582d8":[26,31],"720p":25,"7465737420636f6e74656e74206964":[26,31,33],"break":28,"byte":[4,16,26,27,31],"case":[4,7,10,17,18,22,26,27,28,29,31,33],"class":[6,7],"const":[6,7],"default":[0,3,4,6,7,8,9,10,11,12,13,14,16,17,18,19,20,22,26,27,28,29,31,33],"enum":7,"export":0,"function":[6,7],"int":[6,7],"long":0,"public":[6,7],"return":[6,7],"short":28,"static":[4,6,7,9,22,27],"switch":[0,25],"true":7,"try":[0,7],"void":[6,7],AES:[4,7,20,33],AND:29,For:[4,7,9,10,12,18,22,26,27,28,29,31,33],HLS:[5,7,21,22,23,25,26,29,31,32,33],IDs:[4,20,33],Its:[4,18],NOT:0,Not:[17,22,25,28,29],One:[4,16,26,31],The:[0,3,4,6,7,9,12,13,16,17,18,20,21,22,23,25,26,27,28,29,31,33],Then:3,There:[0,4,18,27,33],These:[4,18],Use:[0,6,7],Used:[4,13,18,28],Using:4,YES:[4,7,12,28],_x64:0,a4631a153a443df9eed0593043db7519:[26,31],aac:[21,25,28],abba271e8bcf552bbd2e86a434a9a5d9:[26,31],about:0,abov:[0,4,7,9,12,17,22,23,27,28,29],absent:[26,31],absolut:[4,7,15],accept:0,access:[0,3,4,7,8,9,12,17,22,28,29],accommod:[4,7,9,12,22,28],accord:[17,22,28,29],accur:[4,7,9,22],achiev:25,acodec:27,acquisit:7,across:[4,18,25],actual:[4,7,8],ad_cue_generator_param:7,adapt:[22,25,28],adcuegeneratorparam:7,add:0,added:[4,7,9,22],adding:0,addit:[4,17,18,20,22,28,29,33],addr:[19,29],address:[19,29],adjust:27,admin:0,administr:0,advanc:0,aes_signing_iv:[4,20,33],aes_signing_kei:[4,20,33],affect:[0,4,18],after:[0,7,27,29],agre:0,ahead:0,aka:0,align:[17,22,25,28,29],all:[0,4,7,9,22,26,29,31],allow:[0,4,7,9,12,19,22,25,26,28,29,31],allow_approximate_segment_timelin:[4,7,9,22],alreadi:0,already_exist:7,also:[0,21,27,28],alt:25,altern:28,alwai:[4,7,9,22,27],among:[4,18],analysi:32,ani:[0,4,7,9,18,22],anoth:[0,4,6,21,27,33],api:[6,7],app:0,appear:0,appl:[4,7,12,28],appli:[4,10,16,18,21,22,26,27,31,33],applic:[3,17,22,28,29],appropri:[0,6],apt:0,arbitrari:[4,16,26,31],architectur:5,archlinux:0,arg:0,argument:0,assign:7,associ:[6,7,33],assum:[0,3,27],assur:7,attribut:[4,7,12,13,17,18,22,28,29],audio:[3,4,6,7,9,10,12,13,16,18,21,22,23,25,26,27,28,29,31,33],audio_:29,audio_init:29,aur:0,authent:7,author:[4,7,15],auto:25,automat:[4,7,9,12,22,28,29],autoupd:0,avail:[0,3,4,18,22,28,29],avc1:21,avfound:27,avoid:29,back:29,band:7,bandwidth:[4,7,17,18,22,28,29],base:[4,7,11,12,13,17,18,22,26,28,29,31,33],base_url:[4,7,9,22],baselin:25,baseurl:[4,7,9,22],bashrc:0,basic:[5,32],been:[0,6],befor:[4,25],begin:[4,7,8,27],being:[17,22,28,29],belong:7,below:[0,4,13,18,22,26,28,31,33],bin:0,binari:[0,4],bit:[0,4,7,18],bitrat:[4,18,22],blob:0,block:[6,27],bmff:7,bool:7,both:[7,17,22,27,28,29,33],boundari:25,box:[4,7,14,16,20,33],branch:0,buffer:[4,7,9,12,14,22,28],buffer_callback_param:7,buffercallbackparam:7,bufsiz:25,bug:[4,7,14],build:4,built:4,bundl:0,bzip2:0,ca_fil:[4,7,15],call:[0,6],callback:7,can:[0,3,4,6,7,16,18,21,22,25,26,27,28,29,31,33],cancel:[6,7],cannot:[4,7,27],capabl:21,captur:32,care:29,carefulli:27,carri:27,categori:0,cb541084c99731aef4fff74500c12ead:[26,31],cbc1:[4,7,11,26,31,33],cbc:[4,7,11,26,31,33],cen:[4,7,11,26,31,33],cenc:[4,7,11,26,31,33],cert:[4,7,15],certif:[4,7,15],chang:[0,25],charact:[17,22,28,29],check:0,choos:[4,7,9,12,22,28],chosen:0,chromium:[0,4,7,14],chunk:[7,28],chunking_error:7,chunking_param:7,chunkingparam:7,clang:0,clear:[4,7,11,26,31,33],clear_lead:[4,11,26,31,33],clear_lead_in_second:7,client:[4,7,15,28],client_cert_fil:[4,7,15],client_cert_private_key_fil:[4,7,15],client_cert_private_key_password:[4,7,15],clone:0,close:[4,7,9,22],cmd:0,code:[5,6,7],codec:21,codec_str:21,column:25,com:[0,4,5,7,12,14,26,28,31,33],combin:7,comma:[4,9,22],comma_separated_url:[4,9,22],command:[0,3,4,16,21,22,23,26,28,29,31,32],commit:0,common:[0,4,7,9,16,20,22,25,26,31,33],commun:[0,28],compat:0,complet:[0,4,6,7,9,22,29,30],complex:21,compliant:7,concaten:[4,16,26,31],concatenated_pssh:[26,31],concept:27,condit:[25,29],config:[0,26,31,33],configur:[0,3,7],consid:[4,6,7,9,20,22,33],consist:[4,18],constexpr:7,construct:[7,17,22,28,29],contain:[4,6,7,17,18,20,21,22,25,27,28,29,33],container:3,content:[4,7,9,12,18,20,21,22,26,28,29,31,33],content_id:[4,7,20,33],context:0,contin:7,continu:0,contrari:0,control:0,conveni:7,copi:[0,25,27],correct:[4,7,9,12,22,28],correctli:0,correspond:[17,22,28,29],could:7,cover:[22,28],crbug:[4,7,14],creat:[0,4,7,13,18,22,23,26,28,31,33],credenti:[7,24],crendenti:33,crypto:7,crypto_period_dur:[4,20,33],cuepoint:7,curl:0,current:[0,7],custom:[0,4,7,10,18,26,31,33],cygwin:0,d58ce954203b7c9a9a9d467f59839249:33,dash:[5,7,18,21,23,25,26,28,29,31,32,33],data:[4,5,7,9,22,28,32],debug:0,decod:[4,7,14],decrypt:[5,7,16,20,26,31,33],decryptionparam:7,default_languag:[4,7,9,12,22,28],defaultstreamlabelfunct:6,defin:[4,7,9,10,12,17,18,20,22,26,28,29,31,33],definit:[4,7,9,17,22,28,29],delai:[4,7,9,22],demand:[7,22,29],dep:0,depend:[3,7],depict:27,depot:0,deriv:[4,7,10,18,26,31,33],describ:[4,17,22,27,28,29],descript:[4,9,22],descriptor:[6,9,16,22],design:5,detail:[0,4,7,29,33],detect:7,determin:[4,6,7,16,26,31],develop:[0,33],devic:27,diagram:5,differ:[3,4,7,9,18,22,25,26,28,29,31],digit:[4,16,26,31],directli:[0,7,29,33],directori:[0,7],disabl:[0,4,7,11,26,31,33],disallow:[19,29],docker:4,document:[0,6,22,28],doe:[4,25],don:0,done:[0,29],doubl:7,download:[0,28],doxygen:7,doxygenstruct:7,drag:0,drm:[5,7,16,20,22,28,32],drm_label:[4,7,10,16,18,26,31,33],drop:0,dump:21,dump_stream_info:[4,21],durat:[4,7,8,9,12,21,22,28],dynam:[4,7,9,22],each:[4,7,14,17,22,28,29],easier:25,edit:0,edu:0,effect:[4,7,18],either:[0,4,16,17,20,22,26,28,29,31,33],element:[4,7,9,22],elementari:28,empti:[4,7,16,26,31],enabl:[0,4,7,8,9,11,14,15,16,19,20,22,26,29,31,33],enable_entitlement_licens:7,enable_playready_encrypt:[4,7,15],enable_raw_key_decrypt:[4,16,26,31],enable_raw_key_encrypt:[4,7,16,26,31],enable_widevine_decrypt:[4,20,33],enable_widevine_encrypt:[4,7,20,33],enclos:[17,22,28,29],encod:[4,22,26,28,31,32,33],encount:7,encrypt:[5,6,7,10,12,14,18,21,22,28],encryptedstreamattribut:[6,7],encryption_failur:7,encryption_param:7,encryptionparam:[6,7],end:[0,4,7,13,18,28],end_of_stream:7,eng:21,english:[22,23,28,29],enough:7,ensur:29,entitl:7,entri:[4,7,9,22],environ:0,error:[0,6,7],error_cod:7,error_messag:7,escap:[17,22,28,29],essenti:0,estim:[4,7,18],etc:[4,7,10,13,16,18,21,26,28,31,33],even:[0,17,22,28,29],event:[4,12,28],everi:29,exactli:[4,7,8],exampl:[0,3,19,24,32],except:[0,4,7,9,12,22,28],exclus:[4,20,33],exe:0,exist:0,expect:7,explicitli:[0,3],explor:0,ext:[4,7,12,13,18,28],extend:28,extens:[4,18],extra:29,extract:[0,21],f3c5e0361e6654b28f8049c778b23946:[26,31],f7e48edb:0,fail:6,failur:6,fals:[4,7,14,21],faster:25,fetch:[4,7,33],ffmpeg:[5,25,29,32],file:[0,3,4,7,9,12,13,15,17,18,20,22,23,27,28,32,33],file_failur:7,file_path:[4,9,12,22,28],find:[0,7],findutil:0,first:[0,4,7,12,28],five:[22,23,28],fix:0,flag:[0,4,7,8,9,12,16,22,26,28,31],flow:[5,29],folder:[0,3],follow:[17,22,28,29],forc:[4,7,8],form:[4,13,16,18,19,26,28,29,31],format:[4,7,12,15,16,18,21,25,26,31],found:21,four:25,fragment:[4,7,8,14,22],fragment_dur:[4,8,14],fragment_fin:7,fragment_sap_align:[4,8],frame:[4,6,7,13,18,20,25,28,33],from:[0,4,6,7,10,18,19,21,26,27,28,29,31,33],front:0,full:[0,3,22,28],further:[4,7,9,22],gcc:0,gclient:0,gener:[7,9,14,16,18,22,27],generate_common_pssh:7,generate_dash_if_iop_compliant_mpd:7,generate_playready_pssh:7,generate_static_live_mpd:7,generate_static_mpd:[4,9,22],generate_widevine_pssh:7,get:[5,32],getcontentkei:33,getlibraryvers:6,git:0,github:[0,5,26,31],goo:[4,7,20,33],googl:[0,3,5,26,31],googlesourc:0,googletest:0,gop:25,gpg:0,group:[4,7,12,13,18,19,20,22,28,29,33],group_id:[4,7,20,33],gtest_filt:0,guarante:[4,7,9,12,22,28],gyp_crosscompil:0,gyp_defin:0,gyp_gener:0,h264:[21,22,23,26,27,28,29,31,33],h264_1080p:[22,23,26,28,29,31,33],h264_1080p_:29,h264_1080p_ifram:[22,23,28],h264_1080p_init:29,h264_360p:[22,23,26,28,29,31,33],h264_360p_:29,h264_360p_ifram:[22,23,28],h264_360p_init:29,h264_480p:[22,23,26,28,29,31,33],h264_480p_:29,h264_480p_ifram:[22,23,28],h264_480p_init:29,h264_720p:[22,23,26,28,29,31,33],h264_720p_:29,h264_720p_ifram:[22,23,28],h264_720p_init:29,h264_baseline_360p_600:[22,23,25,26,28,31,33],h264_high_1080p_6000:[22,23,26,28,31,33],h264_main_1080p_6000:[22,25,28],h264_main_480p_1000:[22,23,25,26,28,31,33],h264_main_720p_3000:[22,23,25,26,28,31,33],h264_master:[22,23,28,29,33],hand:33,handler:5,has:[0,4,6,7,18,27],hasn:0,have:[0,3,4,7,9,12,22,25,28,33],height:21,help:32,here:[0,3,6,19,21,25,26,27,29,31,33],hex:[4,15,16,20,26,31,33],hidden:0,high:22,higher:[4,6,20,33],histori:0,hls_base_url:[4,12,28],hls_group_id:[4,7,13,18,22,23,28,29],hls_iframe_playlist_nam:7,hls_key_uri:[4,12,28],hls_master_playlist_output:[4,12,13,18,22,23,28,29,33],hls_name:[4,7,13,18,22,23,28,29],hls_param:7,hls_playlist_nam:7,hls_playlist_typ:[4,12,28,29],hlsparam:7,hlsplaylisttyp:7,hook:0,host:3,host_media_path:3,how:[0,4,7,9,20,22,26,27,31,33],howev:29,http:[0,4,5,7,14,20,22,26,28,31,33],http_failur:7,human:7,iOS:[0,28],ident:[4,7,12,28],identifi:[4,7,15,20,33],iec:[17,22,28,29],ieee:[17,22,28,29],ifram:28,iframe_playlist_nam:[4,13,18,22,23,28],ignor:[4,7,9,12,22,28],imag:0,immedi:[4,9,22],implement:[6,17,22,28,29],impli:[4,8],implicit:[4,16,26,31],improv:0,inc:28,includ:[0,4,7,10,14,18,20,26,31,33],include_common_pssh:[4,20,33],increas:27,index:[0,5,7],indic:[4,7,9,16,22,26,31],inf:[4,18],info:[4,6,16,26,31],inform:[7,21],ingor:7,init:[7,22,28],init_seg:[4,18,22,27,28,29],initi:[4,6,7,18,27],input:[3,4,6,7,18,21,29],input_text:[22,28],inspect:21,instead:[0,4,7,9,14,22],instruct:4,integ:[17,22,28,29],integr:[0,4],inter:25,interest:4,interfac:[19,29],intermedi:7,intern:[0,6,25],internal_error:7,invalid:7,invalid_argu:7,io_block_s:27,iop:7,is_encrypt:21,iso:[7,17,22,28,29],issu:[17,22,28,29],its:[0,3,4,7,20,28,33],itself:[0,4,18],kae:7,keep:7,kei:[0,7,10,12,15,18,20,24,28,32,33],kevent:7,key_id:[4,7,16,26,31],key_info_str:[4,16,26,31],key_provid:7,key_server_url:[4,7,20,33],key_uri:7,keyint:25,keyint_min:25,keypair:7,keyprovid:7,keyserv:0,klive:7,knokeyrot:7,knone:7,knosidxboxinseg:7,know:[0,33],known:28,kplayreadi:7,kprotectionschemecenc:7,krawkei:7,krsa:7,ksuggestedpresentationdelaynotset:7,kvod:7,kwidevin:7,label:[4,6,7,10,16,18,26,31,33],lag:25,lang:[4,18],languag:[4,7,9,12,18,21,22,28],larg:27,larger:[4,7,8,17,22,28,29],last:[4,7,9,22],latenc:[4,7,9,12,22,28],later:[0,27],latest:3,lead:[4,7,11,26,31,33],least:0,less:[4,7,9,22,25],let:25,level:[0,6,25],lib:0,librari:[0,4,5],libtinfo:0,libvpx:25,libx264:25,licens:[4,7,20,33],like:[0,4,16,21,26,31],limit:0,line:[4,16,26,31],lion:27,list:[3,4,6,7,12,19,28,29],live:[4,5,7,9,12,22,28,32],live_cam:27,live_cam_audio:27,live_cam_audio_:27,live_cam_video:27,live_cam_video_:27,load:28,local:0,locat:29,look:21,loop:29,love:0,luck:0,m3u8:[4,7,13,18,22,23,28,29,33],m3u:28,m4s:[22,27,28,29],mac:27,machin:[0,3,27],macosx:0,made:[4,10,18,26,31,33],mai:[0,3,4,7,8,9,12,17,22,28,29],main:[0,4,7,9,22,25,28],make:[0,25],makepkg:0,manifest:[4,7,9,18,22,23,28,29],manifest_output_path:22,manual:0,map:3,master:[0,4,7,12,26,28,31],master_playlist_output:7,master_playlist_output_path:28,match:[4,16,17,22,26,28,29,31],materi:28,max:[4,6,20,33],max_hd_pixel:[4,6,20,33],max_sd_pixel:[4,6,20,33],max_uhd1_pixel:[4,6,20,33],maxrat:25,mean:7,meant:33,mechan:0,media:[3,4,5,7,9,12,13,14,18,22,26,27,28,29,31,32,33],media_info:7,mediainfo:7,member:7,mention:0,menu:0,merg:7,messag:[0,7],metadata:[4,7,18,28],mfc:0,microsecond:[19,29],might:0,min:25,min_buffer_tim:[4,7,9,22],minimum:[17,22,28,29],minimum_update_period:[4,7,9,22],minrat:25,mit:0,mkdir:0,mkfifo:27,mode:[4,7,18],modifi:0,monitor:27,more:[0,4,16,21,25,26,31],most:[0,4,7,9,12,22,28],mp4:[3,6,7,18,21,22,23,25,26,27,28,29,31,33],mp4_include_pssh_in_stream:[4,14],mp4_output_param:7,mp4_unittest:0,mp4_use_decoding_timestamp_in_timelin:[4,14],mp4a:21,mp4mediaparsertest:0,mp4outputparam:7,mpd:[3,4,7,9,14,22,23,26,27,28,29,31,33],mpd_output:[3,4,7,9,22,23,26,27,28,29,31,33],mpd_param:7,mpdparam:7,mpeg:28,mpegt:27,msysgit:0,multibir:25,multicast:[3,19,29],multipl:[4,18,25],must:[0,4,7,12,16,25,26,28,29,31],muxer:[4,7,14],muxer_failur:7,nalu_length_s:21,name:[0,4,7,9,13,18,20,22,28,29,33],ncurs:0,ncurses5:0,necessari:[0,7,27],necessarili:7,need:[0,3,4,7,9,12,22,25,27,28,33],net:3,network:[3,7,25],new_statu:7,newer:0,ninja:0,non:[0,4,7,20,33],not_found:7,note:[3,4,6,7,9,10,18,22,26,28,31,33],novp9_subsample_encrypt:[4,11,26,31,33],now:29,num_channel:21,num_seg:[4,9,12,22,28],num_subsegments_per_sidx:[4,14],number:[4,7,14,17,18,22,27,28,29],object:7,often:[4,7,9,20,22,33],old:29,omit:[4,7,9,12,22,28],one:[4,7,9,21,22,26,28,31],onli:[0,4,7,9,13,14,16,17,18,19,22,25,26,27,28,29,31,33],open:0,open_gop:25,oper:[3,4],optim:[4,7,9,22],option:[0,3,5,7,10,13,18,21,27],opu:25,order:29,org:0,origin:[0,7,25,29],other:[7,22,26,27,28,29,31,33],otherwis:[4,6,7,8,14,20,33],out:[0,4,7,18,21,33],output:[0,3,6,7,9,12,18,21,22,23,26,27,28,29,31,33],output_audio:6,output_format:[4,7,18],output_media_info:7,output_text:22,output_video:6,outsid:[4,7,9,12,17,22,28,29],over:22,overal:28,overall_statu:7,overrid:[0,4,7,18],own:4,pacakg:0,pack:[4,7,14],packag:[9,15,21,22,23,25,26,28,29,31,32,33],packaging_param:6,packagingparam:[6,7],packet:[19,29],pacman:0,pad:[17,22,28,29],page:[0,4,5],pair:[4,9,22],panel:0,parallel:25,param:7,paramet:[4,6,7,8,9,12,17,18,22,27,28,29],parser_failur:7,part:28,particular:0,pass:[4,25],password:[4,7,15],past:0,path:[0,4,7,12,15,18,20,28,33],pattern:[4,11,18,26,31,33],pem:[4,7,15],per:[4,6,7,14,17,20,22,28,29,33],period:7,permit:[17,22,28,29],pgp:0,pipe1:27,pipe:[4,5,18,29,32],pipelin:[4,6,7,9,12,22,28],pixel:[4,6,20,33],pixel_aspect_ratio:21,pkc:[4,20,33],plai:[4,7,18,28],plan:7,platform:0,player:[4,7,9,12,22,26,28,31,33],playlist:[4,7,12,13,18,22,23,28,29],playlist_nam:[4,13,18,22,23,28,29],playlist_typ:7,playout:7,playreadi:[7,24,32],playready_kei:[4,15],playready_key_id:[4,15],playready_server_url:[4,15],playreadyencryptionparam:7,pleas:[0,4,17,22,28,29,33],point:[4,7,8],polici:[4,7,20,33],port:[19,29],posit:7,potenti:[28,29],powershel:0,pre:[4,25],prebuilt:4,predefin:[4,16,26,31],prefix:[4,7,12,28],presenc:[4,7,18],present:[4,7,9,14,17,22,28,29],preserv:7,preserved_segments_outside_live_window:[4,7,9,12,22,28,29],primari:0,print:[17,22,28,29],printf:[17,22,28,29],privat:[4,7,15,20,33],privileg:0,probabl:0,product:33,profil:[4,7,9,22,25],program:[4,7,15],program_identifi:[4,7,15],project:7,propag:[4,7,18],properli:0,protect:[4,7,11,26,31,33],protection_schem:[4,11,26,31,33],protocol:[27,28,29],protocol_whitelist:27,prototyp:[17,22,28,29],provid:[0,4,7,10,16,17,18,20,22,26,28,29,31,33],pssh:[4,7,14,16,20,33],pull:[0,3],push_back:6,put:0,python2:0,python:0,qualiti:22,quicktim:28,race:29,random:[4,16,26,31],rang:[4,7,14],rate:[4,7,9,18,22,25,28],raw:[7,10,18,24,32,33],rawkeydecryptionparam:7,rawkeyencryptionparam:7,rawkeyparam:7,reach:33,read:[4,27],readabl:7,rebas:0,receiv:[7,19,29],recent:[4,7,9,12,22,28],recommend:25,recud:27,recv:0,redirect:27,ref:25,refer:[21,26,27,31,33],referenc:29,refresh:[4,7,9,22],regardless:[4,7,9,22],regular:[4,18],rel:[4,13,18,28],relat:[7,22,28],releas:[0,3,4],release_x64:0,remain:0,remov:[4,7,9,12,22,28,29],renam:29,rendit:[4,7,12,28],replac:[0,17,22,28,29],repo:0,repositori:[0,5],represent:[4,7,9,18,22],representationid:[17,22,28,29],request:[0,4,8,15,20,33],requir:[4,7,9,18,20,22,33],resembl:28,resolut:[4,7,10,18,25,26,31,33],result:[17,22,25,28,29],reus:[19,29],revis:0,rfc:[17,22,28,29],right:[4,7,20,29,33],role:[4,7,9,22],root:[0,4,7,14],rotat:[4,7,20,33],rsa:[4,7,20,33],rsa_signing_key_path:[4,20,33],run:[0,6],runhook:0,s8rihr:[4,7,20,33],safari:28,sai:25,same:[0,4,7,9,17,18,22,25,28,29],sampl:[4,6,7,9,18,22],sample_bit:21,sampling_frequ:21,save:0,saved_sdp_fil:27,scale:25,scenecut:25,scheme:[4,7,11,26,31,33],scheme_id_uri:[4,9,22],scheme_id_uri_value_pair:[4,9,22],schemeiduri:[4,9,22],script:[0,26,31],sdk:[0,4],sdp_file:27,search:5,sec:[4,7,18],second:[0,4,7,8,9,11,12,20,21,22,25,26,28,31,33],secur:0,see:[0,4,6,7,13,18,20,22,28,29,33],segment:[4,7,8,9,12,14,18,27],segment_dur:[4,7,8,14],segment_duration_in_second:7,segment_sap_align:[4,7,8],segment_templ:[4,7,9,18,22,27,28,29],segmenttempl:[4,7,9,22],segmenttimelin:[4,7,9,17,22,28,29],select:[0,28],selector:7,self:7,sensit:[4,10,17,18,22,26,28,29,31,33],sent:[19,29],separ:[0,4,9,22],sequenc:[17,22,28,29],seri:[22,28],serial:29,serv:[4,7,9,12,22,25,28,29],server:[4,7,15,20,29,33],server_error:7,session:28,set:[0,4,7,8,10,12,13,14,18,19,25,26,28,29,31,33],setup:[0,6,26,31,33],sever:4,shaka:[9,21,22,25,26,28,29,31,33],shaka_packag:0,shall:[17,22,28,29],shell:0,shift:[4,7,9,12,22,28],shorter:[17,22,28,29],should:[0,4,6,7,8,10,13,16,18,20,26,27,28,29,31,33],sidx:[4,7,14],sign:[4,7,20,33],signer:[4,7,20,33],signer_nam:7,signing_key_typ:7,signingkeytyp:7,similar:[0,26,29,31],similarili:27,simpl:21,sinc:[4,7,9,22],singl:[4,7,14,17,18,22,23,28,29],single_seg:[4,8],size:25,size_t:7,skip_encrypt:[4,7,10,18,26,31,33],small:28,smaller:25,smoother:25,socket:[19,27,29],softwar:28,some:[0,29],some_cont:21,someth:[4,13,18,28,33],somewher:0,sourc:[0,4,5,7,18,19,29],space:0,specif:[0,3,7,12,19,29],specifi:[4,7,8,9,10,11,13,16,18,19,20,22,26,27,28,29,31,33],speed:[25,27],split:[4,18],src:0,ssm:[19,29],stage:[4,7,9,12,22,28],stai:[4,7,9,12,22,28],start:[0,27,28],statu:[6,7],std:[6,7],step:29,still:[4,7,9,12,22,28],stop:7,store:[3,4,7,20,33],strang:0,stream:[3,6,7,8,9,14,16,21,22,23,25,27,29],stream_0:[4,13,18,28],stream_1:[4,13,18,28],stream_2:[4,13,18,28],stream_attribut:[6,7],stream_descriptor:[4,6,18,22,26,28,31,33],stream_info:6,stream_label_func:7,stream_loop:27,stream_selector:[4,6,7,18],streamdescriptor:[6,7],streamingkeydeliveri:[4,7,12,28],strict:25,string:[4,6,7,15,16,17,20,22,26,28,29,31,33],struct:7,studio:0,sub:[0,28],subsampl:[4,7,11,26,31,33],subseg:[4,7,8,14],subsegment_dur:7,subsegment_duration_in_second:7,subsegment_sap_align:7,substitu:[17,22,28,29],substitut:[17,22,28,29],success:[0,6,7],sudo:0,suffix:[7,17,22,28,29],suggested_presentation_delai:[4,9,22],suitabl:7,support:[0,4,7,19,27],switchabl:25,sync:[0,29],synopsi:[5,24,32],sysroot:0,system:[3,4,7,20,26,31,33],tabl:[17,22,28,29],tag:[3,4,7,9,12,17,18,22,28,29],tahr:0,taken:29,tar:0,target_arch:0,task:21,techniqu:22,tell:[0,27],temp_dir:7,templat:[4,7,9,18],temporari:7,test:[0,4,16,24,27],text:[4,7,9,12,18,22,28,33],than:[4,6,7,8,9,17,20,22,28,29,33],thei:[4,7,9,12,22,28],them:33,thi:[0,3,4,7,8,9,12,14,16,17,18,19,20,22,25,27,28,29,33],though:0,thread:[6,27],three:[0,4],threshold:6,thu:27,tile:25,time:[0,4,7,9,12,17,22,28,29],time_out:7,time_scal:21,time_shift_buffer_depth:[4,7,9,12,22,28],timelin:[4,7,9,14,22],timeout:[19,29],timestamp:[4,7,14],too:27,tool:[0,3,4,25,26,31],toolchain:0,top:[0,6],tostr:7,tpf:[4,18],track:[4,6,7,9,20,22,25,28,33],transcod:[4,25,27],transmit:27,transmux:[4,32],transport:28,tree:[0,26,31],trick:[4,7,18],trick_play_error:7,trick_play_factor:[4,7,18,21],truncat:[17,22,28,29],trusti:0,tune:27,tutori:[5,21,22,28,33],two:[7,27,33],type:[4,7,10,12,18,21,26,28,31,33],typic:[4,7,10,18,26,29,31,33],uat:33,udp:[3,4,18,27],uhd1:[4,6,7,10,18,20,26,31,33],uhd2:[4,6,7,10,18,20,26,31,33],uint32_t:7,uint8_t:7,unbound:28,under:[4,7,9,22,29],unimpl:7,uniqu:[4,20,33],univers:0,unknown:7,unlik:0,unmanag:0,unsign:[17,22,28,29],unspecifi:[4,13,18,28],unsupport:29,until:[6,27],unzip:0,updat:[7,29],upload:29,uri:[4,7,12,28],url:[4,7,9,12,15,17,20,22,28,29,33],usag:[5,32],use:[0,4,7,9,22,25,27,29,33],use_decoding_timestamp_in_timelin:7,used:[0,4,7,9,12,14,16,17,21,22,25,27,28,29,33],useful:7,user:[0,4,7,18,20,33],uses:[0,7,22,26,28,31,33],using:[0,4,7,12,20,26,27,28,31,33],usr:0,usual:[4,7,13,18,25,28],utc_tim:[4,9,22],utctim:[4,7,9,22],valid:7,valu:[4,7,9,10,12,17,18,22,26,27,28,29,31,33],variabl:0,varieti:28,variou:[4,7,9,12,22,28],vcodec:27,vector:[6,7],verifi:0,version:[0,3,6,17,22,28,29],via:0,video:[3,4,6,7,10,13,18,20,21,22,23,25,26,27,28,29,31,33],virtual:3,visual:0,vod:[4,12,22,28],vp9:[4,7,11,22,26,27,31,33],vp9_1080p_3000:25,vp9_360p_300:25,vp9_480p_500:25,vp9_720p_1500:25,vp9_subsample_encrypt:[4,7,11,26,31,33],vtt:[22,28],wai:[0,4,7,22,26,31],want:[0,3,17,22,25,28,29],warn:0,webcam:27,webm:[4,18,25,27],webmcam:27,well:[22,23,28],what:7,whatev:0,when:[0,4,7,14,20,25,27,29,33],wherev:0,whether:[0,6,7],which:[0,4,7,10,16,18,20,22,25,26,27,28,29,31,33],widevin:[7,24,26,31,32],widevine_test:[26,31,33],widevinedecryptionparam:7,widevineencryptionparam:7,widevinesign:7,width:[17,21,22,28,29],win:0,window:[4,7,9,12,22,28],within:[17,22,28,29],without:[0,22,28,29],work:[0,22,28],workaround:[4,7,14],would:0,write:27,www:0,x264opt:25,x64:0,xcodebuild:0,xml:[0,7],yet:0,you:[0,3,4,17,22,27,28,29,33],your:[3,4],yum:0,zero:[4,7,9,12,17,18,20,22,28,29,33],zerolat:27,zshrc:0,zypper:0},titles:["Build Instructions","Design","Design","Using Docker","Packager Documentation","Welcome to Shaka Packager\u2019s documentation!","Shaka Packager Library","Shaka Packager Library (Continued)","Chunking options","DASH options","DRM related Stream descriptor fields","General encryption options","HLS options","HLS specific stream descriptor fields","MP4 output options","PlayReady encryption options","Raw key encryption options","Segment template formatting","Stream descriptors","UDP file options","Widevine encryption options","Basic Usage","DASH","<no title>","DRM","Media Encoding","Raw key","FFmpeg piping","HLS","Live","PlayReady","Raw key","Tutorials","Widevine"],titleterms:{HLS:[2,4,12,13,18,28],Using:3,agreement:0,analysi:21,arch:0,architectur:[1,2],arm:0,artifact:0,basic:21,bitrat:25,box:[26,31],build:0,camera:27,captur:27,checkout:0,chunk:[4,8],chunkinghandl:2,code:0,command:[25,27],compil:0,contain:3,content:25,continu:7,contribut:0,credenti:33,cross:0,dash:[2,4,9,22,27],data:[1,2,27],debian:0,decrypt:4,demand:2,demux:2,depend:0,depot_tool:0,descriptor:[4,10,13,18,26,28,31,33],design:[1,2],diagram:[1,2],distro:0,docker:3,dockerhub:3,document:[4,5],drm:[4,10,18,24,26,31,33],encod:[25,27],encrypt:[4,11,15,16,20,26,31,33],event:2,exampl:[22,26,27,28,29,31,33],fedora:0,ffmpeg:27,field:[4,10,13,18,26,28,31,33],file:[19,21,29],flow:[1,2],format:[17,22,28,29],from:3,gener:[2,4,11,25,26,31,33],get:[0,3,4,21],guidelin:25,h264:25,handler:[1,2],help:21,host:0,how:25,identifi:[17,22,28,29],indic:5,input:27,instal:0,instruct:0,kei:[4,16,26,31],librari:[6,7],licens:0,linux:0,live:[2,29],mac:0,manifest:2,media:[1,2,21,25],mp4:[4,14],multi:[2,25],note:0,opensus:0,option:[4,8,9,11,12,14,15,16,19,20,22,26,28,29,31,33],other:0,output:[4,14],packag:[0,3,4,5,6,7,27],pipe:27,playreadi:[4,15,30],pssh:[26,31],raw:[4,16,26,31],relat:[4,10,18,26,31,33],requir:0,rtp:27,run:3,sampl:25,segment:[2,17,22,28,29],shaka:[0,3,4,5,6,7],should:25,singl:2,specif:[4,13,18,28],stream:[4,10,13,18,26,28,31,33],support:[17,22,28,29],synopsi:[4,22,26,28,31,33],system:0,tabl:5,templat:[17,22,28,29],test:[26,31,33],thi:[26,31],tip:0,transmux:21,trick:0,troubleshoot:0,tutori:[26,31,32],ubuntu:0,udp:[19,29],updat:0,usag:21,used:[26,31],util:[26,31],vector:[26,31],vp9:25,welcom:5,widevin:[4,20,33],window:0,xcode:0,your:0}}) \ No newline at end of file diff --git a/html/tutorials/live.html b/html/tutorials/live.html index b705933642..f98702077b 100644 --- a/html/tutorials/live.html +++ b/html/tutorials/live.html @@ -119,7 +119,8 @@ See FF 'in=udp://225.1.1.8:8002?interface=172.29.46.122,stream=video,init_segment=h264_480p_init.mp4,segment_template=h264_480p_$Number$.m4s,playlist_name=h264_480p.m3u8' \ 'in=udp://225.1.1.8:8003?interface=172.29.46.122,stream=video,init_segment=h264_720p_init.mp4,segment_template=h264_720p_$Number$.m4s,playlist_name=h264_720p.m3u8' \ 'in=udp://225.1.1.8:8004?interface=172.29.46.122,stream=video,init_segment=h264_1080p_init.mp4,segment_template=h264_1080p_$Number$.m4s,playlist_name=h264_1080p.m3u8' \ - --hls_master_playlist_output h264_master.m3u8 + --hls_master_playlist_output h264_master.m3u8 \ + --hls_playlist_type LIVE