diff --git a/docs/annotated.html b/docs/annotated.html index a29c6ca9c6..6e7a4559dd 100644 --- a/docs/annotated.html +++ b/docs/annotated.html @@ -212,163 +212,162 @@ $(function() {  CPrevSampleData  CWvmMediaParser  CAACAudioSpecificConfig - CAdCueGeneratorAdCueGenerator converts out of band cuepoint markers into SCTE-35 events - CAesCbcDecryptorClass which implements AES-CBC (Cipher block chaining) decryption - CAesCbcEncryptor - CAesCryptor - CAesCtrEncryptor - CAesEncryptor - CAesPatternCryptorImplements pattern-based encryption/decryption - CAesRequestSignerAesRequestSigner uses AES-CBC signing - CAudioStreamInfoHolds audio stream information - CAudioTimestampHelper - CAVCDecoderConfigurationRecordClass for parsing AVC decoder configuration record - CBitReaderA class to read bit streams - CBitWriter - CBlockReader - CBufferReader - CBufferWriter - CByteQueue - CChunkingHandler - CClosureThread - CCluster - CClusterBuilder - CCombinedMuxerListener - CContentEncoding - CCueAlignmentHandler - CCueEvent - CCueEventInfo - CDecoderConfigurationRecord - CDecryptConfig - CDecryptorSourceDecryptorSource wraps KeySource and is responsible for decryptor management - CDemuxer - 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 + CAesCbcDecryptorClass which implements AES-CBC (Cipher block chaining) decryption + CAesCbcEncryptor + CAesCryptor + CAesCtrEncryptor + CAesEncryptor + CAesPatternCryptorImplements pattern-based encryption/decryption + CAesRequestSignerAesRequestSigner uses AES-CBC signing + CAudioStreamInfoHolds audio stream information + CAudioTimestampHelper + CAVCDecoderConfigurationRecordClass for parsing AVC decoder configuration record + CBitReaderA class to read bit streams + CBitWriter + CBlockReader + CBufferReader + CBufferWriter + CByteQueue + CChunkingHandler + CClosureThread + CCluster + CClusterBuilder + CCombinedMuxerListener + CContentEncoding + CCueAlignmentHandler + CCueEvent + CCueEventInfo + CDecoderConfigurationRecord + CDecryptConfig + CDecryptorSourceDecryptorSource wraps KeySource and is responsible for decryptor management + CDemuxer + 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 @@ -431,7 +430,7 @@ $(function() { diff --git a/docs/classes.html b/docs/classes.html index 34e511036d..6031a8d98f 100644 --- a/docs/classes.html +++ b/docs/classes.html @@ -65,16 +65,15 @@ $(function() {
a | b | c | d | e | f | h | i | j | k | l | m | n | o | p | r | s | t | u | v | w | x
- - + - - + - - - + + + @@ -166,13 +165,14 @@ $(function() { +
  a  
-
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  
+
Demuxer (shaka::media)   KeySource (shaka::media)   PesPacket (shaka::media::mp2t)   TextStreamInfo (shaka::media)   
DemuxStreamIdMediaSample (shaka::media::wvm)   
  l  
PesPacketGenerator (shaka::media::mp2t)   TextTrack (shaka::media)   
Ac3Header (shaka::media::mp2t)   DTSSpecific (shaka::media::mp4)   PixelAspectRatio (shaka::media::mp4)   TextTrackConfig (shaka::media)   
AC3Specific (shaka::media::mp4)   
  e  
+
AACAudioSpecificConfig (shaka::media)   DTSSpecific (shaka::media::mp4)   PixelAspectRatio (shaka::media::mp4)   TextTrackConfig (shaka::media)   
Ac3Header (shaka::media::mp2t)   
  e  
Language (shaka::media::mp4)   PlayReadyEncryptionParams (shaka)   ThreadedIoFile (shaka)   
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)   
AC3Specific (shaka::media::mp4)   LibcryptoThreading (shaka::media)   PlayReadyKeySource (shaka::media)   Track (shaka::media::mp4)   
AdaptationSet (shaka)   EC3Specific (shaka::media::mp4)   LineReader (shaka::media)   PlayReadyPsshGenerator (shaka::media)   TrackEncryption (shaka::media::mp4)   
AdaptationSetXmlNode (shaka::xml)   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)   
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)   
DecryptorSource (shaka::media)   RawKeyParams::KeyInfo (shaka)   Period (shaka)   TextSampleEntry (shaka::media::mp4)   
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 5a4c206e2e..f1f567a5f4 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 498f99eb1f..a14e00bfbd 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 281350d1f5..6ece149d4a 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 9f3d79168a..55cb938f2f 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 2a78a1e098..0cf6455507 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 00c27bf1d2..d15cb2532e 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 75c5b5f4eb..496ff14b61 100644 --- a/docs/d0/d0e/muxer__options_8h_source.html +++ b/docs/d0/d0e/muxer__options_8h_source.html @@ -78,7 +78,7 @@ $(function() { 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 1c3dea5683..d7367409d5 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 2bce86e2ec..a9d60370c2 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 8ed99cf96f..ca302aa367 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 e8ac4c6290..c2eb3adfa9 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 899b910430..bed672963c 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 8da6745363..d521d980ec 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 8157348136..9584d6a689 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 48458523ff..90e0fe80f1 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 98c1b9df4a..c536d43f64 100644 --- a/docs/d0/d27/structshaka_1_1media_1_1MuxerOptions.html +++ b/docs/d0/d27/structshaka_1_1media_1_1MuxerOptions.html @@ -174,7 +174,7 @@ std::string  diff --git a/docs/d0/d2b/representation_8h_source.html b/docs/d0/d2b/representation_8h_source.html index 75f11cfc33..68e888db85 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 9ef1cb18a8..4d31d4e10b 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 f0ba909d9d..cc1c571292 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 1158b1249b..070fb9b080 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 7e97b7c063..52ad197840 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 eaa0fb85b7..c9621aab2e 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 079200fe3e..01cabf96a1 100644 --- a/docs/d0/d3a/hls__notify__muxer__listener_8cc_source.html +++ b/docs/d0/d3a/hls__notify__muxer__listener_8cc_source.html @@ -68,7 +68,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/media/event/hls_notify_muxer_listener.h"
8 
9 #include <memory>
10 #include "packager/base/logging.h"
11 #include "packager/hls/base/hls_notifier.h"
12 #include "packager/media/base/muxer_options.h"
13 #include "packager/media/base/protection_system_specific_info.h"
14 #include "packager/media/event/muxer_listener_internal.h"
15 
16 namespace shaka {
17 namespace media {
18 
20  const std::string& playlist_name,
21  bool iframes_only,
22  const std::string& ext_x_media_name,
23  const std::string& ext_x_media_group_id,
24  hls::HlsNotifier* hls_notifier)
25  : playlist_name_(playlist_name),
26  iframes_only_(iframes_only),
27  ext_x_media_name_(ext_x_media_name),
28  ext_x_media_group_id_(ext_x_media_group_id),
29  hls_notifier_(hls_notifier) {
30  DCHECK(hls_notifier);
31 }
32 
33 HlsNotifyMuxerListener::~HlsNotifyMuxerListener() {}
34 
35 // These methods work together to notify that the media is encrypted.
36 // If OnEncryptionInfoReady() is called before the media has been started, then
37 // the information is stored and handled when OnEncryptionStart() is called.
38 // If OnEncryptionStart() is called before the media has been started then
39 // OnMediaStart() is responsible for notifying that the segments are encrypted
40 // right away i.e. call OnEncryptionStart().
42  bool is_initial_encryption_info,
43  FourCC protection_scheme,
44  const std::vector<uint8_t>& key_id,
45  const std::vector<uint8_t>& iv,
46  const std::vector<ProtectionSystemSpecificInfo>& key_system_infos) {
47  if (!stream_id_) {
48  next_key_id_ = key_id;
49  next_iv_ = iv;
50  next_key_system_infos_ = key_system_infos;
51  protection_scheme_ = protection_scheme;
52  return;
53  }
54  for (const ProtectionSystemSpecificInfo& info : key_system_infos) {
55  const bool result = hls_notifier_->NotifyEncryptionUpdate(
56  stream_id_.value(), key_id, info.system_id, iv, info.psshs);
57  LOG_IF(WARNING, !result) << "Failed to add encryption info.";
58  }
59 }
60 
62  if (!stream_id_) {
63  must_notify_encryption_start_ = true;
64  return;
65  }
66  if (next_key_id_.empty()) {
67  DCHECK(next_iv_.empty());
68  DCHECK(next_key_system_infos_.empty());
69  return;
70  }
71 
72  for (const ProtectionSystemSpecificInfo& info : next_key_system_infos_) {
73  const bool result = hls_notifier_->NotifyEncryptionUpdate(
74  stream_id_.value(), next_key_id_, info.system_id, next_iv_, info.psshs);
75  LOG_IF(WARNING, !result) << "Failed to add encryption info";
76  }
77  next_key_id_.clear();
78  next_iv_.clear();
79  next_key_system_infos_.clear();
80  must_notify_encryption_start_ = false;
81 }
82 
84  const StreamInfo& stream_info,
85  uint32_t time_scale,
86  ContainerType container_type) {
87  std::unique_ptr<MediaInfo> media_info(new MediaInfo);
88  if (!internal::GenerateMediaInfo(muxer_options, stream_info, time_scale,
89  container_type, media_info.get())) {
90  LOG(ERROR) << "Failed to generate MediaInfo from input.";
91  return;
92  }
93  if (protection_scheme_ != FOURCC_NULL) {
94  internal::SetContentProtectionFields(protection_scheme_, next_key_id_,
95  next_key_system_infos_,
96  media_info.get());
97  }
98 
99  // The content may be splitted into multiple files, but their MediaInfo
100  // should be compatible.
101  if (media_info_ &&
102  !internal::IsMediaInfoCompatible(*media_info, *media_info_)) {
103  LOG(WARNING) << "Incompatible MediaInfo " << media_info->ShortDebugString()
104  << " vs " << media_info_->ShortDebugString()
105  << ". The result manifest may not be playable.";
106  }
107  media_info_ = std::move(media_info);
108 
109  if (!media_info_->has_segment_template()) {
110  return;
111  }
112 
113  if (!NotifyNewStream())
114  return;
115  DCHECK(stream_id_);
116 
117  if (must_notify_encryption_start_) {
119  }
120 }
121 
122 void HlsNotifyMuxerListener::OnSampleDurationReady(uint32_t sample_duration) {}
123 
125  float duration_seconds) {
126  DCHECK(media_info_);
127  // TODO(kqyang): Should we just Flush here to avoid calling Flush explicitly?
128  // Don't flush the notifier here. Flushing here would write all the playlists
129  // before all Media Playlists are read. Which could cause problems
130  // setting the correct EXT-X-TARGETDURATION.
131  if (media_info_->has_segment_template()) {
132  return;
133  }
134  if (media_ranges.init_range) {
135  shaka::Range* init_range = media_info_->mutable_init_range();
136  init_range->set_begin(media_ranges.init_range.value().start);
137  init_range->set_end(media_ranges.init_range.value().end);
138  }
139  if (media_ranges.index_range) {
140  shaka::Range* index_range = media_info_->mutable_index_range();
141  index_range->set_begin(media_ranges.index_range.value().start);
142  index_range->set_end(media_ranges.index_range.value().end);
143  }
144 
145  if (!stream_id_) {
146  if (!NotifyNewStream())
147  return;
148  DCHECK(stream_id_);
149  } else {
150  // HLS is not interested in MediaInfo update.
151  }
152 
153  // TODO(rkuroiwa); Keep track of which (sub)segments are encrypted so that the
154  // notification is sent right before the enecrypted (sub)segments.
155  if (must_notify_encryption_start_) {
157  }
158 
159  if (!media_ranges.subsegment_ranges.empty()) {
160  const std::vector<Range>& subsegment_ranges =
161  media_ranges.subsegment_ranges;
162  const size_t num_subsegments = subsegment_ranges.size();
163  size_t subsegment_index = 0;
164  for (const auto& event_info : event_info_) {
165  switch (event_info.type) {
166  case EventInfoType::kSegment:
167  if (subsegment_index < num_subsegments) {
168  const Range& range = subsegment_ranges[subsegment_index];
169  hls_notifier_->NotifyNewSegment(
170  stream_id_.value(), media_info_->media_file_name(),
171  event_info.segment_info.start_time,
172  event_info.segment_info.duration, range.start,
173  range.end + 1 - range.start);
174  }
175  ++subsegment_index;
176  break;
177  case EventInfoType::kKeyFrame:
178  if (subsegment_index < num_subsegments) {
179  const uint64_t segment_start_offset =
180  subsegment_ranges[subsegment_index].start;
181  hls_notifier_->NotifyKeyFrame(
182  stream_id_.value(), event_info.key_frame.timestamp,
183  segment_start_offset +
184  event_info.key_frame.start_offset_in_segment,
185  event_info.key_frame.size);
186  }
187  break;
188  case EventInfoType::kCue:
189  hls_notifier_->NotifyCueEvent(stream_id_.value(),
190  event_info.cue_event_info.timestamp);
191  break;
192  }
193  }
194  if (subsegment_index != num_subsegments) {
195  LOG(WARNING) << "Number of subsegment ranges (" << num_subsegments
196  << ") does not match the number of subsegments notified to "
197  "OnNewSegment() ("
198  << event_info_.size() << ").";
199  }
200  }
201  event_info_.clear();
202 }
203 
204 void HlsNotifyMuxerListener::OnNewSegment(const std::string& file_name,
205  uint64_t start_time,
206  uint64_t duration,
207  uint64_t segment_file_size) {
208  if (!media_info_->has_segment_template()) {
209  EventInfo event_info;
210  event_info.type = EventInfoType::kSegment;
211  event_info.segment_info = {start_time, duration, segment_file_size};
212  event_info_.push_back(event_info);
213  } else {
214  // For multisegment, it always starts from the beginning of the file.
215  const size_t kStartingByteOffset = 0u;
216  const bool result = hls_notifier_->NotifyNewSegment(
217  stream_id_.value(), file_name, start_time, duration,
218  kStartingByteOffset, segment_file_size);
219  LOG_IF(WARNING, !result) << "Failed to add new segment.";
220  }
221 }
222 
223 void HlsNotifyMuxerListener::OnKeyFrame(uint64_t timestamp,
224  uint64_t start_byte_offset,
225  uint64_t size) {
226  if (!iframes_only_)
227  return;
228  if (!media_info_->has_segment_template()) {
229  EventInfo event_info;
230  event_info.type = EventInfoType::kKeyFrame;
231  event_info.key_frame = {timestamp, start_byte_offset, size};
232  event_info_.push_back(event_info);
233  } else {
234  const bool result = hls_notifier_->NotifyKeyFrame(
235  stream_id_.value(), timestamp, start_byte_offset, size);
236  LOG_IF(WARNING, !result) << "Failed to add new segment.";
237  }
238 }
239 
240 void HlsNotifyMuxerListener::OnCueEvent(uint64_t timestamp,
241  const std::string& cue_data) {
242  // Not using |cue_data| at this moment.
243  if (!media_info_->has_segment_template()) {
244  EventInfo event_info;
245  event_info.type = EventInfoType::kCue;
246  event_info.cue_event_info = {timestamp};
247  event_info_.push_back(event_info);
248  } else {
249  hls_notifier_->NotifyCueEvent(stream_id_.value(), timestamp);
250  }
251 }
252 
253 bool HlsNotifyMuxerListener::NotifyNewStream() {
254  DCHECK(media_info_);
255 
256  uint32_t stream_id;
257  const bool result = hls_notifier_->NotifyNewStream(
258  *media_info_, playlist_name_, ext_x_media_name_, ext_x_media_group_id_,
259  &stream_id);
260  if (!result) {
261  LOG(WARNING) << "Failed to notify new stream for VOD.";
262  return false;
263  }
264  stream_id_ = stream_id;
265  return true;
266 }
267 
268 } // namespace media
269 } // namespace shaka
void OnMediaStart(const MuxerOptions &muxer_options, const StreamInfo &stream_info, uint32_t time_scale, ContainerType container_type) override
base::Optional< Range > init_range
Range of the initialization section of a segment.
-
Abstract class holds stream information.
Definition: stream_info.h:59
+
Abstract class holds stream information.
Definition: stream_info.h:61
void OnKeyFrame(uint64_t timestamp, uint64_t start_byte_offset, uint64_t size)
void OnEncryptionInfoReady(bool is_initial_encryption_info, FourCC protection_scheme, const std::vector< uint8_t > &key_id, const std::vector< uint8_t > &iv, const std::vector< ProtectionSystemSpecificInfo > &key_system_info) override
base::Optional< Range > index_range
Range of the index section of a segment.
@@ -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 0b8806972b..d730888771 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 1d393856c1..53e7a24444 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 @@ -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 b8e5bd0332..f28db7791c 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 8574547204..80870632b8 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 a8a8a27f50..e6c9d19dab 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 21b7fb7162..d5997213cc 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 736e353d22..0b2f815df5 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 ec0396b679..da2288ff4f 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 @@ -67,7 +67,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/event/vod_media_info_dump_muxer_listener.h"
8 
9 #include <google/protobuf/text_format.h>
10 
11 #include <cmath>
12 
13 #include "packager/base/logging.h"
14 #include "packager/file/file.h"
15 #include "packager/media/base/muxer_options.h"
16 #include "packager/media/base/protection_system_specific_info.h"
17 #include "packager/media/base/stream_info.h"
18 #include "packager/media/event/muxer_listener_internal.h"
19 #include "packager/mpd/base/media_info.pb.h"
20 
21 namespace shaka {
22 namespace media {
23 
24 VodMediaInfoDumpMuxerListener::VodMediaInfoDumpMuxerListener(
25  const std::string& output_file_path)
26  : output_file_name_(output_file_path) {}
27 
28 VodMediaInfoDumpMuxerListener::~VodMediaInfoDumpMuxerListener() {}
29 
31  bool is_initial_encryption_info,
32  FourCC protection_scheme,
33  const std::vector<uint8_t>& default_key_id,
34  const std::vector<uint8_t>& iv,
35  const std::vector<ProtectionSystemSpecificInfo>& key_system_info) {
36  LOG_IF(WARNING, !is_initial_encryption_info)
37  << "Updating (non initial) encryption info is not supported by "
38  "this module.";
39  protection_scheme_ = protection_scheme;
40  default_key_id_ = default_key_id;
41  key_system_info_ = key_system_info;
42  is_encrypted_ = true;
43 }
44 
46  const MuxerOptions& muxer_options,
47  const StreamInfo& stream_info,
48  uint32_t time_scale,
49  ContainerType container_type) {
50  DCHECK(muxer_options.segment_template.empty());
51  media_info_.reset(new MediaInfo());
52  if (!internal::GenerateMediaInfo(muxer_options,
53  stream_info,
54  time_scale,
55  container_type,
56  media_info_.get())) {
57  LOG(ERROR) << "Failed to generate MediaInfo from input.";
58  return;
59  }
60 
61  if (is_encrypted_) {
62  internal::SetContentProtectionFields(protection_scheme_, default_key_id_,
63  key_system_info_, media_info_.get());
64  }
65 }
66 
68 
70  uint32_t sample_duration) {
71  // Assume one VideoInfo.
72  if (media_info_->has_video_info()) {
73  media_info_->mutable_video_info()->set_frame_duration(sample_duration);
74  }
75 }
76 
78  float duration_seconds) {
79  DCHECK(media_info_);
80  if (!internal::SetVodInformation(media_ranges, duration_seconds,
81  media_info_.get())) {
82  LOG(ERROR) << "Failed to generate VOD information from input.";
83  return;
84  }
85  if (!media_info_->has_bandwidth())
86  media_info_->set_bandwidth(max_bitrate_);
87  WriteMediaInfoToFile(*media_info_, output_file_name_);
88 }
89 
90 void VodMediaInfoDumpMuxerListener::OnNewSegment(const std::string& file_name,
91  uint64_t start_time,
92  uint64_t duration,
93  uint64_t segment_file_size) {
94  const double segment_duration_seconds =
95  static_cast<double>(duration) / media_info_->reference_time_scale();
96 
97  const int kBitsInByte = 8;
98  const uint64_t bitrate =
99  ceil(kBitsInByte * segment_file_size / segment_duration_seconds);
100  max_bitrate_ = std::max(max_bitrate_, bitrate);
101 }
102 
104  uint64_t start_byte_offset,
105  uint64_t size) {}
106 
108  const std::string& cue_data) {
109  NOTIMPLEMENTED();
110 }
111 
112 // static
114  const MediaInfo& media_info,
115  const std::string& output_file_path) {
116  std::string output_string;
117  if (!google::protobuf::TextFormat::PrintToString(media_info,
118  &output_string)) {
119  LOG(ERROR) << "Failed to serialize MediaInfo to string.";
120  return false;
121  }
122 
123  File* file = File::Open(output_file_path.c_str(), "w");
124  if (!file) {
125  LOG(ERROR) << "Failed to open " << output_file_path;
126  return false;
127  }
128  if (file->Write(output_string.data(), output_string.size()) <= 0) {
129  LOG(ERROR) << "Failed to write MediaInfo to file.";
130  file->Close();
131  return false;
132  }
133  if (!file->Close()) {
134  LOG(ERROR) << "Failed to close " << output_file_path;
135  return false;
136  }
137  return true;
138 }
139 
140 } // namespace media
141 } // namespace shaka
virtual int64_t Write(const void *buffer, uint64_t length)=0
-
Abstract class holds stream information.
Definition: stream_info.h:59
+
Abstract class holds stream information.
Definition: stream_info.h:61
void OnSampleDurationReady(uint32_t sample_duration) override
Define an abstract file interface.
Definition: file.h:26
void OnNewSegment(const std::string &file_name, uint64_t start_time, uint64_t duration, uint64_t segment_file_size) override
@@ -87,7 +87,7 @@ $(function() {
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 f765f6de49..98f0fa9b3e 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 8c401697f9..f135558cf7 100644 --- a/docs/d0/d4c/structshaka_1_1media_1_1StreamData.html +++ b/docs/d0/d4c/structshaka_1_1media_1_1StreamData.html @@ -128,7 +128,7 @@ std::shared_ptr< const diff --git a/docs/d0/d4d/classshaka_1_1media_1_1AudioTimestampHelper.html b/docs/d0/d4d/classshaka_1_1media_1_1AudioTimestampHelper.html index 24c66cb82d..6bf5075a27 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 eb19515142..3ed15f0678 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 f5c3b2a652..9444ab7b88 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 @@ -71,44 +71,45 @@ $(function() { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AddHandler(std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandlerinline
Cancel()shaka::media::Muxer
clock() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected
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
InitializeInternal() overrideshaka::media::Muxerinlineprotectedvirtual
IsConnected()shaka::media::MediaHandlerinline
MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandler
Muxer(const MuxerOptions &options) (defined in shaka::media::Muxer)shaka::media::Muxerexplicit
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::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
progress_listener() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected
set_clock(base::Clock *clock)shaka::media::Muxerinline
SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
SetMuxerListener(std::unique_ptr< MuxerListener > muxer_listener)shaka::media::Muxer
SetProgressListener(std::unique_ptr< ProgressListener > progress_listener)shaka::media::Muxer
streams() const (defined in shaka::media::Muxer)shaka::media::Muxerinline
TsMuxer(const MuxerOptions &muxer_options) (defined in shaka::media::mp2t::TsMuxer)shaka::media::mp2t::TsMuxerexplicit
ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
~Muxer() (defined in shaka::media::Muxer)shaka::media::Muxervirtual
~TsMuxer() override (defined in shaka::media::mp2t::TsMuxer)shaka::media::mp2t::TsMuxer
Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
clock() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected
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
InitializeInternal() overrideshaka::media::Muxerinlineprotectedvirtual
IsConnected()shaka::media::MediaHandlerinline
MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandler
Muxer(const MuxerOptions &options) (defined in shaka::media::Muxer)shaka::media::Muxerexplicit
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::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
progress_listener() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected
set_clock(base::Clock *clock)shaka::media::Muxerinline
SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
SetMuxerListener(std::unique_ptr< MuxerListener > muxer_listener)shaka::media::Muxer
SetProgressListener(std::unique_ptr< ProgressListener > progress_listener)shaka::media::Muxer
streams() const (defined in shaka::media::Muxer)shaka::media::Muxerinline
TsMuxer(const MuxerOptions &muxer_options) (defined in shaka::media::mp2t::TsMuxer)shaka::media::mp2t::TsMuxerexplicit
ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
~Muxer() (defined in shaka::media::Muxer)shaka::media::Muxervirtual
~TsMuxer() override (defined in shaka::media::mp2t::TsMuxer)shaka::media::mp2t::TsMuxer
diff --git a/docs/d0/d59/classshaka_1_1media_1_1Job.html b/docs/d0/d59/classshaka_1_1media_1_1Job.html index 95436c2c8e..4f95af451c 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 4da43dc95f..df505a4bed 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 3eaf0ae5d2..c67cd31739 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 ca075ac953..a6eb9f1535 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 @@ -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 f61407b700..7bf5410500 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 @@ -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 94f4a7160d..6d84da2e72 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 a9d30c2b5e..3506b7ec4f 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 4ea68d61fd..72aa61872f 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 62b414eb01..8194774a93 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 @@ -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 5da30ae1db..22cfaec169 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 b9bb041f47..9644f6d991 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 e6b81de138..367f4d2ca2 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 5682b3787c..1c5052c979 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 abb57e360b..20a4985fdd 100644 --- a/docs/d0/da8/classshaka_1_1media_1_1PackedAudioWriter-members.html +++ b/docs/d0/da8/classshaka_1_1media_1_1PackedAudioWriter-members.html @@ -71,45 +71,46 @@ $(function() { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AddHandler(std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandlerinline
Cancel()shaka::media::Muxer
clock() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected
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
InitializeInternal() overrideshaka::media::Muxerinlineprotectedvirtual
IsConnected()shaka::media::MediaHandlerinline
MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandler
Muxer(const MuxerOptions &options) (defined in shaka::media::Muxer)shaka::media::Muxerexplicit
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::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
PackedAudioWriterTest (defined in shaka::media::PackedAudioWriter)shaka::media::PackedAudioWriterfriend
Process(std::unique_ptr< StreamData > stream_data) overrideshaka::media::Muxerprotectedvirtual
progress_listener() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected
set_clock(base::Clock *clock)shaka::media::Muxerinline
SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
SetMuxerListener(std::unique_ptr< MuxerListener > muxer_listener)shaka::media::Muxer
SetProgressListener(std::unique_ptr< ProgressListener > progress_listener)shaka::media::Muxer
streams() const (defined in shaka::media::Muxer)shaka::media::Muxerinline
ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
~Muxer() (defined in shaka::media::Muxer)shaka::media::Muxervirtual
~PackedAudioWriter() override (defined in shaka::media::PackedAudioWriter)shaka::media::PackedAudioWriter
Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
clock() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected
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
InitializeInternal() overrideshaka::media::Muxerinlineprotectedvirtual
IsConnected()shaka::media::MediaHandlerinline
MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandler
Muxer(const MuxerOptions &options) (defined in shaka::media::Muxer)shaka::media::Muxerexplicit
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::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
PackedAudioWriterTest (defined in shaka::media::PackedAudioWriter)shaka::media::PackedAudioWriterfriend
Process(std::unique_ptr< StreamData > stream_data) overrideshaka::media::Muxerprotectedvirtual
progress_listener() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected
set_clock(base::Clock *clock)shaka::media::Muxerinline
SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
SetMuxerListener(std::unique_ptr< MuxerListener > muxer_listener)shaka::media::Muxer
SetProgressListener(std::unique_ptr< ProgressListener > progress_listener)shaka::media::Muxer
streams() const (defined in shaka::media::Muxer)shaka::media::Muxerinline
ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
~Muxer() (defined in shaka::media::Muxer)shaka::media::Muxervirtual
~PackedAudioWriter() override (defined in shaka::media::PackedAudioWriter)shaka::media::PackedAudioWriter
diff --git a/docs/d0/da8/structshaka_1_1HlsParams.html b/docs/d0/da8/structshaka_1_1HlsParams.html index 986bfa1c7d..079f3affe6 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 64b59d90f1..3e51e6ecbb 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 dfbad42f2c..1fd1fef117 100644 --- a/docs/d0/dac/classshaka_1_1media_1_1EncryptionHandler-members.html +++ b/docs/d0/dac/classshaka_1_1media_1_1EncryptionHandler-members.html @@ -70,35 +70,36 @@ $(function() {

This is the complete list of members for shaka::media::EncryptionHandler, 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
EncryptionHandler(const EncryptionParams &encryption_params, KeySource *key_source) (defined in shaka::media::EncryptionHandler)shaka::media::EncryptionHandler
EncryptionHandlerTest (defined in shaka::media::EncryptionHandler)shaka::media::EncryptionHandlerfriend
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
InitializeInternal() overrideshaka::media::EncryptionHandlerprotectedvirtual
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
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::EncryptionHandlerprotectedvirtual
SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
~EncryptionHandler() override (defined in shaka::media::EncryptionHandler)shaka::media::EncryptionHandler
~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
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
EncryptionHandler(const EncryptionParams &encryption_params, KeySource *key_source) (defined in shaka::media::EncryptionHandler)shaka::media::EncryptionHandler
EncryptionHandlerTest (defined in shaka::media::EncryptionHandler)shaka::media::EncryptionHandlerfriend
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
InitializeInternal() overrideshaka::media::EncryptionHandlerprotectedvirtual
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
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::EncryptionHandlerprotectedvirtual
SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
~EncryptionHandler() override (defined in shaka::media::EncryptionHandler)shaka::media::EncryptionHandler
~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
diff --git a/docs/d0/dae/file__util_8h_source.html b/docs/d0/dae/file__util_8h_source.html index 4f4afab99b..2973c0b505 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 2aa7a64b00..699bb9689a 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 7071f275e3..2f121085f7 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 359ed8df89..8c5d02f197 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 db4e968376..0b881bce4c 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 bd1a704250..678d37b6ae 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 6e511825ee..44d9696511 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 3d7a04284b..2d965db8f5 100644 --- a/docs/d0/dc0/structshaka_1_1media_1_1SegmentInfo.html +++ b/docs/d0/dc0/structshaka_1_1media_1_1SegmentInfo.html @@ -97,7 +97,7 @@ std::shared_ptr< 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 06a125803a..9a0354a338 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 da9edec7f5..6ad6a495eb 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 2200593e7b..5cd1b825e0 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 e8638bfb74..7cd29872d4 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 @@ -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 be6c7f144f..5f66d6f276 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 3f6eafcbdd..a1e99a5690 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 06b539852e..d025f480d8 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 ba45c953e9..c6ff07e00b 100644 --- a/docs/d0/dee/segmenter__test__base_8h_source.html +++ b/docs/d0/dee/segmenter__test__base_8h_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 #ifndef PACKAGER_MEDIA_FORMATS_WEBM_SEGMENTER_TEST_UTILS_H_
8 #define PACKAGER_MEDIA_FORMATS_WEBM_SEGMENTER_TEST_UTILS_H_
9 
10 #include <gtest/gtest.h>
11 
12 #include "packager/file/file_closer.h"
13 #include "packager/file/file_test_util.h"
14 #include "packager/file/memory_file.h"
15 #include "packager/media/base/media_sample.h"
16 #include "packager/media/base/muxer_options.h"
17 #include "packager/media/base/stream_info.h"
18 #include "packager/media/base/video_stream_info.h"
19 #include "packager/media/formats/webm/mkv_writer.h"
20 #include "packager/media/formats/webm/segmenter.h"
21 #include "packager/media/formats/webm/webm_parser.h"
22 #include "packager/status.h"
23 #include "packager/status_test_util.h"
24 
25 namespace shaka {
26 namespace media {
27 
28 class SegmentTestBase : public ::testing::Test {
29  public:
30  enum KeyFrameFlag {
31  kKeyFrame,
32  kNotKeyFrame,
33  };
34  enum SideDataFlag {
35  kGenerateSideData,
36  kNoSideData,
37  };
38 
39  protected:
41 
42  void SetUp() override;
43  void TearDown() override;
44 
46  template <typename S>
48  const MuxerOptions& options,
49  const StreamInfo& info,
50  std::unique_ptr<webm::Segmenter>* result) const {
51  std::unique_ptr<S> segmenter(new S(options));
52 
53  ASSERT_OK(segmenter->Initialize(info, nullptr /* progress_listener */,
54  nullptr /* muxer_listener */));
55  *result = std::move(segmenter);
56  }
57 
59  std::shared_ptr<MediaSample> CreateSample(KeyFrameFlag key_frame_flag,
60  uint64_t duration,
61  SideDataFlag side_data_flag);
65  VideoStreamInfo* CreateVideoStreamInfo(uint32_t time_scale) const;
66 
68  std::string OutputFileName() const;
70  std::string TemplateFileName(int number) const;
71 
72  protected:
73  // A helper class used to determine the number of clusters and frames for a
74  // given WebM file.
75  class ClusterParser : private WebMParserClient {
76  public:
77  ClusterParser();
78  ~ClusterParser() override;
79 
80  // Make sure to use ASSERT_NO_FATAL_FAILURE.
81  void PopulateFromCluster(const std::string& file_name);
82  void PopulateFromSegment(const std::string& file_name);
83 
84  size_t GetFrameCountForCluster(size_t cluster_index) const;
85  int64_t GetFrameTimecode(size_t cluster_index, size_t frame_index) const;
86 
87  size_t cluster_count() const;
88 
89  private:
90  // WebMParserClient overrides.
91  WebMParserClient* OnListStart(int id) override;
92  bool OnListEnd(int id) override;
93  bool OnUInt(int id, int64_t val) override;
94  bool OnFloat(int id, double val) override;
95  bool OnBinary(int id, const uint8_t* data, int size) override;
96  bool OnString(int id, const std::string& str) override;
97 
98  private:
99  int64_t cluster_timecode_ = -1;
100  // frame_timecodes_[cluster_index][frame_index].
101  std::vector<std::vector<int64_t>> frame_timecodes_;
102  bool in_cluster_ = false;
103  };
104 
105  protected:
106  void set_cur_timestamp(uint64_t timestamp) { cur_timestamp_ = timestamp; }
107 
108  std::string output_file_name_;
109  std::string segment_template_;
110  uint64_t cur_timestamp_;
111  bool single_segment_;
112 };
113 
114 } // namespace media
115 } // namespace shaka
116 
117 #endif // PACKAGER_MEDIA_FORMATS_WEBM_SEGMENTER_TEST_UTILS_H_
-
Abstract class holds stream information.
Definition: stream_info.h:59
+
Abstract class holds stream information.
Definition: stream_info.h:61
VideoStreamInfo * CreateVideoStreamInfo(uint32_t time_scale) const
Creates a video stream info object for testing.
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
@@ -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 87d92699b5..0dfb95cc4c 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 78ce7dac4a..da48f49a5b 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 28d0be49a8..0570e15e44 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 4b07ff5cf8..4114f5a7e0 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 5b5b696d8e..cf38dd7af6 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 bcf615f8cf..2643143529 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 bc8eed64fb..84e6be5bed 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 4e6b8961c1..0bfc839582 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 d45e7e829c..1b535c73f4 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 c878ab5174..5e48be401b 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 9198375a15..d0143aedc5 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 0e40de1745..a1d1106aaf 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 024eab1d14..7990c77018 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 28db51ec12..f34362a51a 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 e99bc15ff3..5f5be2b0cb 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 aef40eb04c..1459b86b02 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 5137c93554..e72e296f27 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 12c7c1b545..65ceafaa5a 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 c5e7d49769..da1b86d958 100644 --- a/docs/d1/d25/classshaka_1_1media_1_1MediaHandlerTestBase-members.html +++ b/docs/d1/d25/classshaka_1_1media_1_1MediaHandlerTestBase-members.html @@ -76,7 +76,7 @@ $(function() { GetMediaSample(int64_t timestamp, int64_t duration, bool is_keyframe, const uint8_t *data, size_t data_length) const (defined in shaka::media::MediaHandlerTestBase)shaka::media::MediaHandlerTestBaseprotected GetSegmentInfo(int64_t start_timestamp, int64_t duration, bool is_subsegment) const (defined in shaka::media::MediaHandlerTestBase)shaka::media::MediaHandlerTestBaseprotected GetTextSample(const std::string &id, int64_t start, int64_t end, const std::string &payload) const (defined in shaka::media::MediaHandlerTestBase)shaka::media::MediaHandlerTestBaseprotected - GetTextStreamInfo() const (defined in shaka::media::MediaHandlerTestBase)shaka::media::MediaHandlerTestBaseprotected + GetTextStreamInfo(uint32_t timescale) const (defined in shaka::media::MediaHandlerTestBase)shaka::media::MediaHandlerTestBaseprotected GetVideoStreamInfo(uint32_t time_scale) const (defined in shaka::media::MediaHandlerTestBase)shaka::media::MediaHandlerTestBaseprotected GetVideoStreamInfo(uint32_t time_scale, uint32_t width, uint64_t height) const (defined in shaka::media::MediaHandlerTestBase)shaka::media::MediaHandlerTestBaseprotected GetVideoStreamInfo(uint32_t time_scale, Codec codec) const (defined in shaka::media::MediaHandlerTestBase)shaka::media::MediaHandlerTestBaseprotected @@ -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 2173bed149..ce7d560bf1 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 0216af4879..1154485f19 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 705cdf38de..149fbe2288 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 10118481a0..a6468238f4 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 afe7dc8ae0..c9eb79aebf 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 f6bb00bc82..fb001dd88d 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 66c4cb1400..a1acc790a9 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 bc15b43f3c..3d1a42f63a 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 cf3c3ececb..69620a8945 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 49b23b418a..a582a878bb 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 bf80ad8f80..8cb20fbca7 100644 --- a/docs/d1/d36/classshaka_1_1media_1_1FakeMediaHandler.html +++ b/docs/d1/d36/classshaka_1_1media_1_1FakeMediaHandler.html @@ -172,10 +172,17 @@ Protected Attributes std::vector< std::unique_ptr< StreamData > > stream_data_vector_   + + + + +

+Additional Inherited Members

- Static Public Member Functions inherited from shaka::media::MediaHandler
+static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list)
 

Detailed Description

-

Definition at line 178 of file media_handler_test_base.h.

+

Definition at line 275 of file media_handler_test_base.h.

Member Function Documentation

◆ InitializeInternal()

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

-

Definition at line 97 of file media_handler_test_base.cc.

+

Definition at line 155 of file media_handler_test_base.cc.

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

-

Definition at line 101 of file media_handler_test_base.cc.

+

Definition at line 159 of file media_handler_test_base.cc.

@@ -245,7 +252,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 bc046370d8..1135ef7037 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 88eab2e200..43ad9709e2 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 48919982bf..bba671712e 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 @@ -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 f60e664f9b..549b17da45 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 7ab3498b11..56e3f960d9 100644 --- a/docs/d1/d41/structshaka_1_1media_1_1Scte35Event.html +++ b/docs/d1/d41/structshaka_1_1media_1_1Scte35Event.html @@ -97,7 +97,7 @@ std::string cue_data 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 b60b5b5223..351f13c584 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 00693a8e25..7624d3a705 100644 --- a/docs/d1/d45/decoding__time__iterator_8cc_source.html +++ b/docs/d1/d45/decoding__time__iterator_8cc_source.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/d1/d48/text__track__config_8h_source.html b/docs/d1/d48/text__track__config_8h_source.html index cc97229f69..392fda478a 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 7df7e0405d..4159cc5b95 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 a9be375aed..000f3c2976 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 df49c598ff..f0a2c1e69b 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 928d5ad4af..ee12b26e25 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 @@ -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 8a8b61e83b..92b20044b8 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 14b0858825..f3c50af3b6 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 6535244e0d..25546cf043 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 f95529ad9e..1aefe4cb36 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 33207970fe..508b767855 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 bf1bbfb461..c10ac7e321 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 ca6dfb499b..58a51b2ca8 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 d83c1602d5..42181036d7 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 ceabe44c10..35ac9cb82f 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 638593c13f..bbdddc11f3 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 92152b8577..910a1613c5 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 0caef278b6..044443361d 100644 --- a/docs/d1/d87/classshaka_1_1hls_1_1MasterPlaylist.html +++ b/docs/d1/d87/classshaka_1_1hls_1_1MasterPlaylist.html @@ -117,7 +117,7 @@ Public Member Functions -

Definition at line 371 of file master_playlist.cc.

+

Definition at line 381 of file master_playlist.cc.

@@ -170,7 +170,7 @@ Public Member Functions
Returns
true if the playlist is updated successfully or there is no difference since the last write, false otherwise.
-

Definition at line 376 of file master_playlist.cc.

+

Definition at line 386 of file master_playlist.cc.

@@ -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 810fa8d5cf..adbef5419c 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 4bee5c0331..bcf036bc16 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 9c80ae3508..c63842e657 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 b58b6a8430..a2d8020e9d 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 e8dc10fb1b..fcdb04b0a5 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 cc3c8f392f..3de890a759 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 2391a35b5d..d539e1637d 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 584935e0cd..71ce83b933 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 d4e15d3ae9..86a0eafef3 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 f9e06db9dd..26d79a27fd 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 d6477a3e89..486e8bba0e 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 f77efa13cd..936f56c817 100644 --- a/docs/d1/dad/classshaka_1_1media_1_1Demuxer-members.html +++ b/docs/d1/dad/classshaka_1_1media_1_1Demuxer-members.html @@ -71,41 +71,42 @@ $(function() { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AddHandler(std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandlerinline
Cancel() overrideshaka::media::Demuxervirtual
container_name()shaka::media::Demuxerinline
Demuxer(const std::string &file_name)shaka::media::Demuxerexplicit
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
InitializeInternal() overrideshaka::media::Demuxerinlineprotectedvirtual
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
OnFlushRequest(size_t input_stream_index)shaka::media::MediaHandlerprotectedvirtual
OriginHandler()=default (defined in shaka::media::OriginHandler)shaka::media::OriginHandler
output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
Process(std::unique_ptr< StreamData > stream_data) overrideshaka::media::Demuxerinlineprotectedvirtual
Run() overrideshaka::media::Demuxervirtual
set_dump_stream_info(bool dump_stream_info) (defined in shaka::media::Demuxer)shaka::media::Demuxerinline
SetHandler(const std::string &stream_label, std::shared_ptr< MediaHandler > handler)shaka::media::Demuxer
shaka::media::OriginHandler::SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
SetKeySource(std::unique_ptr< KeySource > key_source)shaka::media::Demuxer
SetLanguageOverride(const std::string &stream_label, const std::string &language_override)shaka::media::Demuxer
ValidateOutputStreamIndex(size_t stream_index) const overrideshaka::media::Demuxerinlineprotectedvirtual
~Demuxer() (defined in shaka::media::Demuxer)shaka::media::Demuxer
~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
container_name()shaka::media::Demuxerinline
Demuxer(const std::string &file_name)shaka::media::Demuxerexplicit
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
InitializeInternal() overrideshaka::media::Demuxerinlineprotectedvirtual
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
OnFlushRequest(size_t input_stream_index)shaka::media::MediaHandlerprotectedvirtual
OriginHandler()=default (defined in shaka::media::OriginHandler)shaka::media::OriginHandler
output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
Process(std::unique_ptr< StreamData > stream_data) overrideshaka::media::Demuxerinlineprotectedvirtual
Run() overrideshaka::media::Demuxervirtual
set_dump_stream_info(bool dump_stream_info) (defined in shaka::media::Demuxer)shaka::media::Demuxerinline
SetHandler(const std::string &stream_label, std::shared_ptr< MediaHandler > handler)shaka::media::Demuxer
shaka::media::OriginHandler::SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
SetKeySource(std::unique_ptr< KeySource > key_source)shaka::media::Demuxer
SetLanguageOverride(const std::string &stream_label, const std::string &language_override)shaka::media::Demuxer
ValidateOutputStreamIndex(size_t stream_index) const overrideshaka::media::Demuxerinlineprotectedvirtual
~Demuxer() (defined in shaka::media::Demuxer)shaka::media::Demuxer
~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
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 0aef44a113..5677851d97 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 @@ -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 87f43a5284..e8eb810d0d 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 59703c70ed..097f1a20f1 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 4d970914f4..3a0bc6c3a1 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 4e0718922c..b2abeef308 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 c761dbef5b..085ab20fee 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 973ded215f..0ed49a9d32 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 014e998437..171bb98464 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 d8c71e530e..213abbb919 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 3aa7d6f165..cc8ea52a84 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 09d68016a2..6d3a621b8c 100644 --- a/docs/d1/de2/composition__offset__iterator_8cc_source.html +++ b/docs/d1/de2/composition__offset__iterator_8cc_source.html @@ -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 68b63d1735..6d7e6bce91 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 779c7d1892..77c3e511c0 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 50ace7fe7a..431654ad59 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 c0482d30ed..fc7996df4e 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 156b1680ef..1a21a30489 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 55e5c2eb5d..6940fb0b86 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 @@ -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 0927534dd7..d8d3fd2d62 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 0b7b7d5f70..ca62a62608 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 e5adb9998b..bcb247af8d 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 5c0ba4378f..4737ad9dd1 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 a7feae5c12..1b83d2f352 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 b1588b8c26..8282edd002 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 63a8223f86..863fa3dccc 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 bfca5af681..815543bd07 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 8874366124..ce963e845d 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 d9fe36e6e8..c5df63e333 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 4954386082..2ba94c1310 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 2b99026333..a04baa766b 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 2261dfbad9..81cea16215 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 7109387f7f..e53a9cfe61 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 2bdafd9068..050f0293d9 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 1e40b7759e..48cbd76fd0 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 bf1c586ea1..e385e5e21e 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 6c882dcf58..6f1f3eb0fb 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 e2d717453a..96719af6e6 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 cc423169e0..1458f4ef1b 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 09fa812374..2908887b55 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 71bdf71d9e..efb5594756 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 4cc6936f59..ede2efab30 100644 --- a/docs/d2/d3c/muxer__factory_8cc_source.html +++ b/docs/d2/d3c/muxer__factory_8cc_source.html @@ -82,7 +82,7 @@ $(function() { 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 f1f09b5ac1..d5270efddc 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 b66d0178e1..673984aa77 100644 --- a/docs/d2/d42/webvtt__to__mp4__handler_8h_source.html +++ b/docs/d2/d42/webvtt__to__mp4__handler_8h_source.html @@ -66,7 +66,7 @@ $(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 // 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_
+
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.
@@ -74,7 +74,7 @@ $(function() {
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 b82a1ff2a5..1db0fed2af 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 d8917a9be6..29b6ce153b 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 cad110a0be..e9589e6dc7 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 f7fe9b2377..497efdc4f5 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 4bc16b6506..1c00db134b 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 f87f093eab..721d0797ef 100644 --- a/docs/d2/d57/master__playlist_8h_source.html +++ b/docs/d2/d57/master__playlist_8h_source.html @@ -68,12 +68,12 @@ $(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_HLS_BASE_MASTER_PLAYLIST_H_
8 #define PACKAGER_HLS_BASE_MASTER_PLAYLIST_H_
9 
10 #include <list>
11 #include <string>
12 
13 namespace shaka {
14 namespace hls {
15 
16 class MediaPlaylist;
17 
21  public:
25  MasterPlaylist(const std::string& file_name,
26  const std::string& default_language);
27  virtual ~MasterPlaylist();
28 
38  virtual bool WriteMasterPlaylist(const std::string& base_url,
39  const std::string& output_dir,
40  const std::list<MediaPlaylist*>& playlists);
41 
42  private:
43  MasterPlaylist(const MasterPlaylist&) = delete;
44  MasterPlaylist& operator=(const MasterPlaylist&) = delete;
45 
46  std::string written_playlist_;
47  const std::string file_name_;
48  const std::string default_language_;
49 };
50 
51 } // namespace hls
52 } // namespace shaka
53 
54 #endif // PACKAGER_HLS_BASE_MASTER_PLAYLIST_H_
All the methods that are virtual are virtual for mocking.
-
virtual bool WriteMasterPlaylist(const std::string &base_url, const std::string &output_dir, const std::list< MediaPlaylist *> &playlists)
-
MasterPlaylist(const std::string &file_name, const std::string &default_language)
+
virtual bool WriteMasterPlaylist(const std::string &base_url, const std::string &output_dir, const std::list< MediaPlaylist *> &playlists)
+
MasterPlaylist(const std::string &file_name, const std::string &default_language)
diff --git a/docs/d2/d59/structshaka_1_1media_1_1H264SliceHeader.html b/docs/d2/d59/structshaka_1_1media_1_1H264SliceHeader.html index 581752da48..4f2ec70add 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 2bef7bf900..9f0cb350eb 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 8f1af15a5a..707836550c 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 124bcb764b..060c5fd8c6 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 e299a19b94..f3ebc8d28b 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 b71743f70d..b4c6d03064 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 2fcdcb30d2..ca86b2fe2d 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 5dbe975233..4a9d603549 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 @@ -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 c809635e7e..5f31721569 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 527666459a..e363b3d86e 100644 --- a/docs/d2/d7b/simple__mpd__notifier_8cc_source.html +++ b/docs/d2/d7b/simple__mpd__notifier_8cc_source.html @@ -76,7 +76,7 @@ $(function() {
All the methods that are virtual are virtual for mocking.
virtual Representation * CopyRepresentation(const Representation &representation)
bool NotifyCueEvent(uint32_t container_id, uint64_t timestamp) override
-
void AddContentProtectionElements(const MediaInfo &media_info, Representation *parent)
Definition: mpd_utils.cc:369
+
void AddContentProtectionElements(const MediaInfo &media_info, Representation *parent)
Definition: mpd_utils.cc:380
virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
std::string Uint8VectorToBase64(const std::vector< uint8_t > &input)
Converts uint8 vector into base64 encoded string.
@@ -94,7 +94,7 @@ $(function() { diff --git a/docs/d2/d7b/structshaka_1_1StreamDescriptor.html b/docs/d2/d7b/structshaka_1_1StreamDescriptor.html index 35bbab418a..f4dc09635d 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 ee9858c35f..bda41d9040 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 2eebb31d2a..15cf47c6eb 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 @@ -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 eab5989734..207e113289 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 875307ff40..289e99a761 100644 --- a/docs/d2/d8a/hls__notify__muxer__listener_8h_source.html +++ b/docs/d2/d8a/hls__notify__muxer__listener_8h_source.html @@ -66,7 +66,7 @@ $(function() {
hls_notify_muxer_listener.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_EVENT_HLS_NOTIFY_MUXER_LISTENER_H_
8 #define PACKAGER_MEDIA_EVENT_HLS_NOTIFY_MUXER_LISTENER_H_
9 
10 #include <memory>
11 #include <string>
12 
13 #include "packager/base/optional.h"
14 #include "packager/media/event/event_info.h"
15 #include "packager/media/event/muxer_listener.h"
16 #include "packager/mpd/base/media_info.pb.h"
17 
18 namespace shaka {
19 
20 namespace hls {
21 class HlsNotifier;
22 } // namespace hls
23 
24 namespace media {
25 
28  public:
39  HlsNotifyMuxerListener(const std::string& playlist_name,
40  bool iframes_only,
41  const std::string& ext_x_media_name,
42  const std::string& ext_x_media_group_id,
43  hls::HlsNotifier* hls_notifier);
44  ~HlsNotifyMuxerListener() override;
45 
48  void OnEncryptionInfoReady(bool is_initial_encryption_info,
49  FourCC protection_scheme,
50  const std::vector<uint8_t>& key_id,
51  const std::vector<uint8_t>& iv,
52  const std::vector<ProtectionSystemSpecificInfo>&
53  key_system_info) override;
54  void OnEncryptionStart() override;
55  void OnMediaStart(const MuxerOptions& muxer_options,
56  const StreamInfo& stream_info,
57  uint32_t time_scale,
58  ContainerType container_type) override;
59  void OnSampleDurationReady(uint32_t sample_duration) override;
60  void OnMediaEnd(const MediaRanges& media_ranges,
61  float duration_seconds) override;
62  void OnNewSegment(const std::string& file_name,
63  uint64_t start_time,
64  uint64_t duration,
65  uint64_t segment_file_size) override;
66  void OnKeyFrame(uint64_t timestamp,
67  uint64_t start_byte_offset,
68  uint64_t size);
69  void OnCueEvent(uint64_t timestamp, const std::string& cue_data) override;
71 
72  private:
74  HlsNotifyMuxerListener& operator=(const HlsNotifyMuxerListener&) = delete;
75 
76  bool NotifyNewStream();
77 
78  const std::string playlist_name_;
79  const bool iframes_only_;
80  const std::string ext_x_media_name_;
81  const std::string ext_x_media_group_id_;
82  hls::HlsNotifier* const hls_notifier_;
83  base::Optional<uint32_t> stream_id_;
84 
85  bool must_notify_encryption_start_ = false;
86  // Cached encryption info before OnMediaStart() is called.
87  std::vector<uint8_t> next_key_id_;
88  std::vector<uint8_t> next_iv_;
89  std::vector<ProtectionSystemSpecificInfo> next_key_system_infos_;
90  FourCC protection_scheme_ = FOURCC_NULL;
91 
92  // MediaInfo passed to Notifier::OnNewStream(). Mainly for single segment
93  // playlists.
94  std::unique_ptr<MediaInfo> media_info_;
95  // Even information for delayed function calls (NotifyNewSegment and
96  // NotifyCueEvent) after NotifyNewStream is called in OnMediaEnd. Only needed
97  // for on-demand as the functions are called immediately in live mode.
98  std::vector<EventInfo> event_info_;
99 };
100 
101 } // namespace media
102 } // namespace shaka
103 #endif // PACKAGER_MEDIA_EVENT_HLS_NOTIFY_MUXER_LISTENER_H_
Abstract class holds stream information.
Definition: stream_info.h:59
+
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_EVENT_HLS_NOTIFY_MUXER_LISTENER_H_
8 #define PACKAGER_MEDIA_EVENT_HLS_NOTIFY_MUXER_LISTENER_H_
9 
10 #include <memory>
11 #include <string>
12 
13 #include "packager/base/optional.h"
14 #include "packager/media/event/event_info.h"
15 #include "packager/media/event/muxer_listener.h"
16 #include "packager/mpd/base/media_info.pb.h"
17 
18 namespace shaka {
19 
20 namespace hls {
21 class HlsNotifier;
22 } // namespace hls
23 
24 namespace media {
25 
28  public:
39  HlsNotifyMuxerListener(const std::string& playlist_name,
40  bool iframes_only,
41  const std::string& ext_x_media_name,
42  const std::string& ext_x_media_group_id,
43  hls::HlsNotifier* hls_notifier);
44  ~HlsNotifyMuxerListener() override;
45 
48  void OnEncryptionInfoReady(bool is_initial_encryption_info,
49  FourCC protection_scheme,
50  const std::vector<uint8_t>& key_id,
51  const std::vector<uint8_t>& iv,
52  const std::vector<ProtectionSystemSpecificInfo>&
53  key_system_info) override;
54  void OnEncryptionStart() override;
55  void OnMediaStart(const MuxerOptions& muxer_options,
56  const StreamInfo& stream_info,
57  uint32_t time_scale,
58  ContainerType container_type) override;
59  void OnSampleDurationReady(uint32_t sample_duration) override;
60  void OnMediaEnd(const MediaRanges& media_ranges,
61  float duration_seconds) override;
62  void OnNewSegment(const std::string& file_name,
63  uint64_t start_time,
64  uint64_t duration,
65  uint64_t segment_file_size) override;
66  void OnKeyFrame(uint64_t timestamp,
67  uint64_t start_byte_offset,
68  uint64_t size);
69  void OnCueEvent(uint64_t timestamp, const std::string& cue_data) override;
71 
72  private:
74  HlsNotifyMuxerListener& operator=(const HlsNotifyMuxerListener&) = delete;
75 
76  bool NotifyNewStream();
77 
78  const std::string playlist_name_;
79  const bool iframes_only_;
80  const std::string ext_x_media_name_;
81  const std::string ext_x_media_group_id_;
82  hls::HlsNotifier* const hls_notifier_;
83  base::Optional<uint32_t> stream_id_;
84 
85  bool must_notify_encryption_start_ = false;
86  // Cached encryption info before OnMediaStart() is called.
87  std::vector<uint8_t> next_key_id_;
88  std::vector<uint8_t> next_iv_;
89  std::vector<ProtectionSystemSpecificInfo> next_key_system_infos_;
90  FourCC protection_scheme_ = FOURCC_NULL;
91 
92  // MediaInfo passed to Notifier::OnNewStream(). Mainly for single segment
93  // playlists.
94  std::unique_ptr<MediaInfo> media_info_;
95  // Even information for delayed function calls (NotifyNewSegment and
96  // NotifyCueEvent) after NotifyNewStream is called in OnMediaEnd. Only needed
97  // for on-demand as the functions are called immediately in live mode.
98  std::vector<EventInfo> event_info_;
99 };
100 
101 } // namespace media
102 } // namespace shaka
103 #endif // PACKAGER_MEDIA_EVENT_HLS_NOTIFY_MUXER_LISTENER_H_
Abstract class holds stream information.
Definition: stream_info.h:61
MuxerListener that uses HlsNotifier.
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/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 0575e4b0c9..d38b1f4f06 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 c41061e10f..4c7fa711ac 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 4ec89b9fbe..21d26515ea 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 a8bbb4a7ee..273df8dff3 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 3347d4957e..4e221ccb07 100644 --- a/docs/d2/da0/classshaka_1_1media_1_1TrickPlayHandler-members.html +++ b/docs/d2/da0/classshaka_1_1media_1_1TrickPlayHandler-members.html @@ -70,30 +70,31 @@ $(function() {

This is the complete list of members for shaka::media::TrickPlayHandler, 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
output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
TrickPlayHandler(uint32_t factor) (defined in shaka::media::TrickPlayHandler)shaka::media::TrickPlayHandlerexplicit
ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
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
output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
TrickPlayHandler(uint32_t factor) (defined in shaka::media::TrickPlayHandler)shaka::media::TrickPlayHandlerexplicit
ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
diff --git a/docs/d2/da6/threaded__io__file_8h_source.html b/docs/d2/da6/threaded__io__file_8h_source.html index d2fae60c12..ce0c166c50 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 0bbd33299a..a5921818c2 100644 --- a/docs/d2/da8/mp4_2segmenter_8cc_source.html +++ b/docs/d2/da8/mp4_2segmenter_8cc_source.html @@ -96,7 +96,7 @@ $(function() { 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 717e819ddc..17bc6f0889 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 dfa22a49c6..b70e7c1dad 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 626c5bfa06..25fd0128d4 100644 --- a/docs/d2/dae/webm__muxer_8cc_source.html +++ b/docs/d2/dae/webm__muxer_8cc_source.html @@ -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 25f61b228a..75aede1618 100644 --- a/docs/d2/db1/master__playlist_8cc_source.html +++ b/docs/d2/db1/master__playlist_8cc_source.html @@ -66,14 +66,14 @@ $(function() {
master_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/master_playlist.h"
8 
9 #include <algorithm> // std::max
10 
11 #include <inttypes.h>
12 
13 #include "packager/base/files/file_path.h"
14 #include "packager/base/strings/string_number_conversions.h"
15 #include "packager/base/strings/string_util.h"
16 #include "packager/base/strings/stringprintf.h"
17 #include "packager/file/file.h"
18 #include "packager/hls/base/media_playlist.h"
19 #include "packager/hls/base/tag.h"
20 #include "packager/version/version.h"
21 
22 namespace shaka {
23 namespace hls {
24 namespace {
25 const char* kDefaultAudioGroupId = "default-audio-group";
26 const char* kDefaultSubtitleGroupId = "default-text-group";
27 const char* kUnexpectedGroupId = "unexpected-group";
28 
29 void AppendVersionString(std::string* content) {
30  const std::string version = GetPackagerVersion();
31  if (version.empty())
32  return;
33  base::StringAppendF(content, "## Generated with %s version %s\n",
34  GetPackagerProjectUrl().c_str(), version.c_str());
35 }
36 
37 struct Variant {
38  std::set<std::string> audio_codecs;
39  std::set<std::string> text_codecs;
40  const std::string* audio_group_id = nullptr;
41  const std::string* text_group_id = nullptr;
42  uint64_t audio_bitrate = 0;
43 };
44 
45 uint64_t MaxBitrate(const std::list<const MediaPlaylist*> playlists) {
46  uint64_t max = 0;
47  for (const auto& playlist : playlists) {
48  max = std::max(max, playlist->Bitrate());
49  }
50  return max;
51 }
52 
53 std::set<std::string> GetGroupCodecString(
54  const std::list<const MediaPlaylist*>& group) {
55  std::set<std::string> codecs;
56 
57  for (const MediaPlaylist* playlist : group) {
58  codecs.insert(playlist->codec());
59  }
60 
61  return codecs;
62 }
63 
64 std::list<Variant> AudioGroupsToVariants(
65  const std::map<std::string, std::list<const MediaPlaylist*>>& groups) {
66  std::list<Variant> variants;
67 
68  for (const auto& group : groups) {
69  Variant variant;
70  variant.audio_group_id = &group.first;
71  variant.audio_bitrate = MaxBitrate(group.second);
72  variant.audio_codecs = GetGroupCodecString(group.second);
73 
74  variants.push_back(variant);
75  }
76 
77  // Make sure we return at least one variant so create a null variant if there
78  // are no variants.
79  if (variants.empty()) {
80  variants.emplace_back();
81  }
82 
83  return variants;
84 }
85 
86 const char* GetGroupId(const MediaPlaylist& playlist) {
87  const std::string& group_id = playlist.group_id();
88 
89  if (!group_id.empty()) {
90  return group_id.c_str();
91  }
92 
93  switch (playlist.stream_type()) {
94  case MediaPlaylist::MediaPlaylistStreamType::kAudio:
95  return kDefaultAudioGroupId;
96 
97  case MediaPlaylist::MediaPlaylistStreamType::kSubtitle:
98  return kDefaultSubtitleGroupId;
99 
100  default:
101  return kUnexpectedGroupId;
102  }
103 }
104 
105 std::list<Variant> SubtitleGroupsToVariants(
106  const std::map<std::string, std::list<const MediaPlaylist*>>& groups) {
107  std::list<Variant> variants;
108 
109  for (const auto& group : groups) {
110  Variant variant;
111  variant.text_group_id = &group.first;
112  variant.text_codecs = GetGroupCodecString(group.second);
113 
114  variants.push_back(variant);
115  }
116 
117  // Make sure we return at least one variant so create a null variant if there
118  // are no variants.
119  if (variants.empty()) {
120  variants.emplace_back();
121  }
122 
123  return variants;
124 }
125 
126 std::list<Variant> BuildVariants(
127  const std::map<std::string, std::list<const MediaPlaylist*>>& audio_groups,
128  const std::map<std::string, std::list<const MediaPlaylist*>>&
129  subtitle_groups) {
130  std::list<Variant> audio_variants = AudioGroupsToVariants(audio_groups);
131  std::list<Variant> subtitle_variants =
132  SubtitleGroupsToVariants(subtitle_groups);
133 
134  DCHECK_GE(audio_variants.size(), 1u);
135  DCHECK_GE(subtitle_variants.size(), 1u);
136 
137  std::list<Variant> merged;
138 
139  for (const auto& audio_variant : audio_variants) {
140  for (const auto& subtitle_variant : subtitle_variants) {
141  Variant variant;
142  variant.audio_codecs = audio_variant.audio_codecs;
143  variant.text_codecs = subtitle_variant.text_codecs;
144  variant.audio_group_id = audio_variant.audio_group_id;
145  variant.text_group_id = subtitle_variant.text_group_id;
146  variant.audio_bitrate = audio_variant.audio_bitrate;
147 
148  merged.push_back(variant);
149  }
150  }
151 
152  DCHECK_GE(merged.size(), 1u);
153 
154  return merged;
155 }
156 
157 void BuildStreamInfTag(const MediaPlaylist& playlist,
158  const Variant& variant,
159  const std::string& base_url,
160  std::string* out) {
161  DCHECK(out);
162 
163  std::string tag_name;
164  switch (playlist.stream_type()) {
165  case MediaPlaylist::MediaPlaylistStreamType::kVideo:
166  tag_name = "#EXT-X-STREAM-INF";
167  break;
168  case MediaPlaylist::MediaPlaylistStreamType::kVideoIFramesOnly:
169  tag_name = "#EXT-X-I-FRAME-STREAM-INF";
170  break;
171  default:
172  NOTREACHED() << "Cannot build STREAM-INFO tag for type "
173  << static_cast<int>(playlist.stream_type());
174  break;
175  }
176  Tag tag(tag_name, out);
177 
178  const uint64_t bitrate = playlist.Bitrate() + variant.audio_bitrate;
179  tag.AddNumber("BANDWIDTH", bitrate);
180 
181  std::vector<std::string> all_codecs;
182  all_codecs.push_back(playlist.codec());
183  all_codecs.insert(all_codecs.end(), variant.audio_codecs.begin(),
184  variant.audio_codecs.end());
185  all_codecs.insert(all_codecs.end(), variant.text_codecs.begin(),
186  variant.text_codecs.end());
187  tag.AddQuotedString("CODECS", base::JoinString(all_codecs, ","));
188 
189  uint32_t width;
190  uint32_t height;
191  CHECK(playlist.GetDisplayResolution(&width, &height));
192  tag.AddNumberPair("RESOLUTION", width, 'x', height);
193 
194  if (variant.audio_group_id) {
195  tag.AddQuotedString("AUDIO", *variant.audio_group_id);
196  }
197 
198  if (variant.text_group_id) {
199  tag.AddQuotedString("SUBTITLES", *variant.text_group_id);
200  }
201 
202  if (playlist.stream_type() ==
203  MediaPlaylist::MediaPlaylistStreamType::kVideoIFramesOnly) {
204  tag.AddQuotedString("URI", base_url + playlist.file_name());
205  out->append("\n");
206  } else {
207  base::StringAppendF(out, "\n%s%s\n", base_url.c_str(),
208  playlist.file_name().c_str());
209  }
210 }
211 
212 // Need to pass in |group_id| as it may have changed to a new default when
213 // grouped with other playlists.
214 void BuildMediaTag(const MediaPlaylist& playlist,
215  const std::string& group_id,
216  bool is_default,
217  bool is_autoselect,
218  const std::string& base_url,
219  std::string* out) {
220  // Tag attribures should follow the order as defined in
221  // https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-3.5
222 
223  Tag tag("#EXT-X-MEDIA", out);
224 
225  // We should only be making media tags for audio and text.
226  switch (playlist.stream_type()) {
227  case MediaPlaylist::MediaPlaylistStreamType::kAudio:
228  tag.AddString("TYPE", "AUDIO");
229  break;
230 
231  case MediaPlaylist::MediaPlaylistStreamType::kSubtitle:
232  tag.AddString("TYPE", "SUBTITLES");
233  break;
234 
235  default:
236  NOTREACHED() << "Cannot build media tag for type "
237  << static_cast<int>(playlist.stream_type());
238  break;
239  }
240 
241  tag.AddQuotedString("URI", base_url + playlist.file_name());
242  tag.AddQuotedString("GROUP-ID", group_id);
243 
244  const std::string& language = playlist.language();
245  if (!language.empty()) {
246  tag.AddQuotedString("LANGUAGE", language);
247  }
248 
249  tag.AddQuotedString("NAME", playlist.name());
250 
251  if (is_default) {
252  tag.AddString("DEFAULT", "YES");
253  }
254 
255  if (is_autoselect) {
256  tag.AddString("AUTOSELECT", "YES");
257  }
258 
259  const MediaPlaylist::MediaPlaylistStreamType kAudio =
260  MediaPlaylist::MediaPlaylistStreamType::kAudio;
261  if (playlist.stream_type() == kAudio) {
262  std::string channel_string = std::to_string(playlist.GetNumChannels());
263  tag.AddQuotedString("CHANNELS", channel_string);
264  }
265 
266  out->append("\n");
267 }
268 
269 void BuildMediaTags(
270  const std::map<std::string, std::list<const MediaPlaylist*>>& groups,
271  const std::string& default_language,
272  const std::string& base_url,
273  std::string* out) {
274  for (const auto& group : groups) {
275  const std::string& group_id = group.first;
276  const auto& playlists = group.second;
277 
278  // Tracks the language of the playlist in this group.
279  // According to HLS spec: https://goo.gl/MiqjNd 4.3.4.1.1. Rendition Groups
280  // - A Group MUST NOT have more than one member with a DEFAULT attribute of
281  // YES.
282  // - Each EXT-X-MEDIA tag with an AUTOSELECT=YES attribute SHOULD have a
283  // combination of LANGUAGE[RFC5646], ASSOC-LANGUAGE, FORCED, and
284  // CHARACTERISTICS attributes that is distinct from those of other
285  // AUTOSELECT=YES members of its Group.
286  // We tag the first rendition encountered with a particular language with
287  // 'AUTOSELECT'; it is tagged with 'DEFAULT' too if the language matches
288  // |default_language_|.
289  std::set<std::string> languages;
290 
291  for (const auto& playlist : playlists) {
292  bool is_default = false;
293  bool is_autoselect = false;
294 
295  const std::string language = playlist->language();
296  if (languages.find(language) == languages.end()) {
297  is_default = !language.empty() && language == default_language;
298  is_autoselect = true;
299 
300  languages.insert(language);
301  }
302 
303  BuildMediaTag(*playlist, group_id, is_default, is_autoselect, base_url,
304  out);
305  }
306  }
307 }
308 
309 void AppendPlaylists(const std::string& default_language,
310  const std::string& base_url,
311  const std::list<MediaPlaylist*>& playlists,
312  std::string* content) {
313  std::map<std::string, std::list<const MediaPlaylist*>> audio_playlist_groups;
314  std::map<std::string, std::list<const MediaPlaylist*>>
315  subtitle_playlist_groups;
316  std::list<const MediaPlaylist*> video_playlists;
317  std::list<const MediaPlaylist*> iframe_playlists;
318  for (const MediaPlaylist* playlist : playlists) {
319  switch (playlist->stream_type()) {
320  case MediaPlaylist::MediaPlaylistStreamType::kAudio:
321  audio_playlist_groups[GetGroupId(*playlist)].push_back(playlist);
322  break;
323  case MediaPlaylist::MediaPlaylistStreamType::kVideo:
324  video_playlists.push_back(playlist);
325  break;
326  case MediaPlaylist::MediaPlaylistStreamType::kVideoIFramesOnly:
327  iframe_playlists.push_back(playlist);
328  break;
329  case MediaPlaylist::MediaPlaylistStreamType::kSubtitle:
330  subtitle_playlist_groups[GetGroupId(*playlist)].push_back(playlist);
331  break;
332  default:
333  NOTIMPLEMENTED() << static_cast<int>(playlist->stream_type())
334  << " not handled.";
335  }
336  }
337 
338  if (!audio_playlist_groups.empty()) {
339  content->append("\n");
340  BuildMediaTags(audio_playlist_groups, default_language, base_url, content);
341  }
342 
343  if (!subtitle_playlist_groups.empty()) {
344  content->append("\n");
345  BuildMediaTags(subtitle_playlist_groups, default_language, base_url,
346  content);
347  }
348 
349  std::list<Variant> variants =
350  BuildVariants(audio_playlist_groups, subtitle_playlist_groups);
351  for (const auto& variant : variants) {
352  if (video_playlists.empty())
353  break;
354  content->append("\n");
355  for (const auto& playlist : video_playlists) {
356  BuildStreamInfTag(*playlist, variant, base_url, content);
357  }
358  }
359 
360  if (!iframe_playlists.empty()) {
361  content->append("\n");
362  for (const auto& playlist : iframe_playlists) {
363  // I-Frame playlists do not have variant. Just use the default.
364  BuildStreamInfTag(*playlist, Variant(), base_url, content);
365  }
366  }
367 }
368 
369 } // namespace
370 
371 MasterPlaylist::MasterPlaylist(const std::string& file_name,
372  const std::string& default_language)
373  : file_name_(file_name), default_language_(default_language) {}
374 MasterPlaylist::~MasterPlaylist() {}
375 
377  const std::string& base_url,
378  const std::string& output_dir,
379  const std::list<MediaPlaylist*>& playlists) {
380  std::string content = "#EXTM3U\n";
381  AppendVersionString(&content);
382  AppendPlaylists(default_language_, base_url, playlists, &content);
383 
384  // Skip if the playlist is already written.
385  if (content == written_playlist_)
386  return true;
387 
388  std::string file_path =
389  base::FilePath::FromUTF8Unsafe(output_dir)
390  .Append(base::FilePath::FromUTF8Unsafe(file_name_))
391  .AsUTF8Unsafe();
392  if (!File::WriteFileAtomically(file_path.c_str(), content)) {
393  LOG(ERROR) << "Failed to write master playlist to: " << file_path;
394  return false;
395  }
396  written_playlist_ = content;
397  return true;
398 }
399 
400 } // namespace hls
401 } // namespace shaka
All the methods that are virtual are virtual for mocking.
+
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/master_playlist.h"
8 
9 #include <algorithm> // std::max
10 
11 #include <inttypes.h>
12 
13 #include "packager/base/files/file_path.h"
14 #include "packager/base/strings/string_number_conversions.h"
15 #include "packager/base/strings/string_util.h"
16 #include "packager/base/strings/stringprintf.h"
17 #include "packager/file/file.h"
18 #include "packager/hls/base/media_playlist.h"
19 #include "packager/hls/base/tag.h"
20 #include "packager/version/version.h"
21 
22 namespace shaka {
23 namespace hls {
24 namespace {
25 const char* kDefaultAudioGroupId = "default-audio-group";
26 const char* kDefaultSubtitleGroupId = "default-text-group";
27 const char* kUnexpectedGroupId = "unexpected-group";
28 
29 void AppendVersionString(std::string* content) {
30  const std::string version = GetPackagerVersion();
31  if (version.empty())
32  return;
33  base::StringAppendF(content, "## Generated with %s version %s\n",
34  GetPackagerProjectUrl().c_str(), version.c_str());
35 }
36 
37 struct Variant {
38  std::set<std::string> audio_codecs;
39  std::set<std::string> text_codecs;
40  const std::string* audio_group_id = nullptr;
41  const std::string* text_group_id = nullptr;
42  uint64_t audio_bitrate = 0;
43 };
44 
45 uint64_t MaxBitrate(const std::list<const MediaPlaylist*> playlists) {
46  uint64_t max = 0;
47  for (const auto& playlist : playlists) {
48  max = std::max(max, playlist->Bitrate());
49  }
50  return max;
51 }
52 
53 std::set<std::string> GetGroupCodecString(
54  const std::list<const MediaPlaylist*>& group) {
55  std::set<std::string> codecs;
56 
57  for (const MediaPlaylist* playlist : group) {
58  codecs.insert(playlist->codec());
59  }
60 
61  // To support some older players, we cannot include "wvtt" in the codec
62  // string. As per HLS guidelines, "wvtt" is optional. When it is included, it
63  // can cause playback errors on some Apple produces. Excluding it allows
64  // playback on all Apple products. See
65  // https://github.com/google/shaka-packager/issues/402 for all details.
66  auto wvtt = codecs.find("wvtt");
67  if (wvtt != codecs.end()) {
68  codecs.erase(wvtt);
69  }
70 
71  return codecs;
72 }
73 
74 std::list<Variant> AudioGroupsToVariants(
75  const std::map<std::string, std::list<const MediaPlaylist*>>& groups) {
76  std::list<Variant> variants;
77 
78  for (const auto& group : groups) {
79  Variant variant;
80  variant.audio_group_id = &group.first;
81  variant.audio_bitrate = MaxBitrate(group.second);
82  variant.audio_codecs = GetGroupCodecString(group.second);
83 
84  variants.push_back(variant);
85  }
86 
87  // Make sure we return at least one variant so create a null variant if there
88  // are no variants.
89  if (variants.empty()) {
90  variants.emplace_back();
91  }
92 
93  return variants;
94 }
95 
96 const char* GetGroupId(const MediaPlaylist& playlist) {
97  const std::string& group_id = playlist.group_id();
98 
99  if (!group_id.empty()) {
100  return group_id.c_str();
101  }
102 
103  switch (playlist.stream_type()) {
104  case MediaPlaylist::MediaPlaylistStreamType::kAudio:
105  return kDefaultAudioGroupId;
106 
107  case MediaPlaylist::MediaPlaylistStreamType::kSubtitle:
108  return kDefaultSubtitleGroupId;
109 
110  default:
111  return kUnexpectedGroupId;
112  }
113 }
114 
115 std::list<Variant> SubtitleGroupsToVariants(
116  const std::map<std::string, std::list<const MediaPlaylist*>>& groups) {
117  std::list<Variant> variants;
118 
119  for (const auto& group : groups) {
120  Variant variant;
121  variant.text_group_id = &group.first;
122  variant.text_codecs = GetGroupCodecString(group.second);
123 
124  variants.push_back(variant);
125  }
126 
127  // Make sure we return at least one variant so create a null variant if there
128  // are no variants.
129  if (variants.empty()) {
130  variants.emplace_back();
131  }
132 
133  return variants;
134 }
135 
136 std::list<Variant> BuildVariants(
137  const std::map<std::string, std::list<const MediaPlaylist*>>& audio_groups,
138  const std::map<std::string, std::list<const MediaPlaylist*>>&
139  subtitle_groups) {
140  std::list<Variant> audio_variants = AudioGroupsToVariants(audio_groups);
141  std::list<Variant> subtitle_variants =
142  SubtitleGroupsToVariants(subtitle_groups);
143 
144  DCHECK_GE(audio_variants.size(), 1u);
145  DCHECK_GE(subtitle_variants.size(), 1u);
146 
147  std::list<Variant> merged;
148 
149  for (const auto& audio_variant : audio_variants) {
150  for (const auto& subtitle_variant : subtitle_variants) {
151  Variant variant;
152  variant.audio_codecs = audio_variant.audio_codecs;
153  variant.text_codecs = subtitle_variant.text_codecs;
154  variant.audio_group_id = audio_variant.audio_group_id;
155  variant.text_group_id = subtitle_variant.text_group_id;
156  variant.audio_bitrate = audio_variant.audio_bitrate;
157 
158  merged.push_back(variant);
159  }
160  }
161 
162  DCHECK_GE(merged.size(), 1u);
163 
164  return merged;
165 }
166 
167 void BuildStreamInfTag(const MediaPlaylist& playlist,
168  const Variant& variant,
169  const std::string& base_url,
170  std::string* out) {
171  DCHECK(out);
172 
173  std::string tag_name;
174  switch (playlist.stream_type()) {
175  case MediaPlaylist::MediaPlaylistStreamType::kVideo:
176  tag_name = "#EXT-X-STREAM-INF";
177  break;
178  case MediaPlaylist::MediaPlaylistStreamType::kVideoIFramesOnly:
179  tag_name = "#EXT-X-I-FRAME-STREAM-INF";
180  break;
181  default:
182  NOTREACHED() << "Cannot build STREAM-INFO tag for type "
183  << static_cast<int>(playlist.stream_type());
184  break;
185  }
186  Tag tag(tag_name, out);
187 
188  const uint64_t bitrate = playlist.Bitrate() + variant.audio_bitrate;
189  tag.AddNumber("BANDWIDTH", bitrate);
190 
191  std::vector<std::string> all_codecs;
192  all_codecs.push_back(playlist.codec());
193  all_codecs.insert(all_codecs.end(), variant.audio_codecs.begin(),
194  variant.audio_codecs.end());
195  all_codecs.insert(all_codecs.end(), variant.text_codecs.begin(),
196  variant.text_codecs.end());
197  tag.AddQuotedString("CODECS", base::JoinString(all_codecs, ","));
198 
199  uint32_t width;
200  uint32_t height;
201  CHECK(playlist.GetDisplayResolution(&width, &height));
202  tag.AddNumberPair("RESOLUTION", width, 'x', height);
203 
204  if (variant.audio_group_id) {
205  tag.AddQuotedString("AUDIO", *variant.audio_group_id);
206  }
207 
208  if (variant.text_group_id) {
209  tag.AddQuotedString("SUBTITLES", *variant.text_group_id);
210  }
211 
212  if (playlist.stream_type() ==
213  MediaPlaylist::MediaPlaylistStreamType::kVideoIFramesOnly) {
214  tag.AddQuotedString("URI", base_url + playlist.file_name());
215  out->append("\n");
216  } else {
217  base::StringAppendF(out, "\n%s%s\n", base_url.c_str(),
218  playlist.file_name().c_str());
219  }
220 }
221 
222 // Need to pass in |group_id| as it may have changed to a new default when
223 // grouped with other playlists.
224 void BuildMediaTag(const MediaPlaylist& playlist,
225  const std::string& group_id,
226  bool is_default,
227  bool is_autoselect,
228  const std::string& base_url,
229  std::string* out) {
230  // Tag attribures should follow the order as defined in
231  // https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-3.5
232 
233  Tag tag("#EXT-X-MEDIA", out);
234 
235  // We should only be making media tags for audio and text.
236  switch (playlist.stream_type()) {
237  case MediaPlaylist::MediaPlaylistStreamType::kAudio:
238  tag.AddString("TYPE", "AUDIO");
239  break;
240 
241  case MediaPlaylist::MediaPlaylistStreamType::kSubtitle:
242  tag.AddString("TYPE", "SUBTITLES");
243  break;
244 
245  default:
246  NOTREACHED() << "Cannot build media tag for type "
247  << static_cast<int>(playlist.stream_type());
248  break;
249  }
250 
251  tag.AddQuotedString("URI", base_url + playlist.file_name());
252  tag.AddQuotedString("GROUP-ID", group_id);
253 
254  const std::string& language = playlist.language();
255  if (!language.empty()) {
256  tag.AddQuotedString("LANGUAGE", language);
257  }
258 
259  tag.AddQuotedString("NAME", playlist.name());
260 
261  if (is_default) {
262  tag.AddString("DEFAULT", "YES");
263  }
264 
265  if (is_autoselect) {
266  tag.AddString("AUTOSELECT", "YES");
267  }
268 
269  const MediaPlaylist::MediaPlaylistStreamType kAudio =
270  MediaPlaylist::MediaPlaylistStreamType::kAudio;
271  if (playlist.stream_type() == kAudio) {
272  std::string channel_string = std::to_string(playlist.GetNumChannels());
273  tag.AddQuotedString("CHANNELS", channel_string);
274  }
275 
276  out->append("\n");
277 }
278 
279 void BuildMediaTags(
280  const std::map<std::string, std::list<const MediaPlaylist*>>& groups,
281  const std::string& default_language,
282  const std::string& base_url,
283  std::string* out) {
284  for (const auto& group : groups) {
285  const std::string& group_id = group.first;
286  const auto& playlists = group.second;
287 
288  // Tracks the language of the playlist in this group.
289  // According to HLS spec: https://goo.gl/MiqjNd 4.3.4.1.1. Rendition Groups
290  // - A Group MUST NOT have more than one member with a DEFAULT attribute of
291  // YES.
292  // - Each EXT-X-MEDIA tag with an AUTOSELECT=YES attribute SHOULD have a
293  // combination of LANGUAGE[RFC5646], ASSOC-LANGUAGE, FORCED, and
294  // CHARACTERISTICS attributes that is distinct from those of other
295  // AUTOSELECT=YES members of its Group.
296  // We tag the first rendition encountered with a particular language with
297  // 'AUTOSELECT'; it is tagged with 'DEFAULT' too if the language matches
298  // |default_language_|.
299  std::set<std::string> languages;
300 
301  for (const auto& playlist : playlists) {
302  bool is_default = false;
303  bool is_autoselect = false;
304 
305  const std::string language = playlist->language();
306  if (languages.find(language) == languages.end()) {
307  is_default = !language.empty() && language == default_language;
308  is_autoselect = true;
309 
310  languages.insert(language);
311  }
312 
313  BuildMediaTag(*playlist, group_id, is_default, is_autoselect, base_url,
314  out);
315  }
316  }
317 }
318 
319 void AppendPlaylists(const std::string& default_language,
320  const std::string& base_url,
321  const std::list<MediaPlaylist*>& playlists,
322  std::string* content) {
323  std::map<std::string, std::list<const MediaPlaylist*>> audio_playlist_groups;
324  std::map<std::string, std::list<const MediaPlaylist*>>
325  subtitle_playlist_groups;
326  std::list<const MediaPlaylist*> video_playlists;
327  std::list<const MediaPlaylist*> iframe_playlists;
328  for (const MediaPlaylist* playlist : playlists) {
329  switch (playlist->stream_type()) {
330  case MediaPlaylist::MediaPlaylistStreamType::kAudio:
331  audio_playlist_groups[GetGroupId(*playlist)].push_back(playlist);
332  break;
333  case MediaPlaylist::MediaPlaylistStreamType::kVideo:
334  video_playlists.push_back(playlist);
335  break;
336  case MediaPlaylist::MediaPlaylistStreamType::kVideoIFramesOnly:
337  iframe_playlists.push_back(playlist);
338  break;
339  case MediaPlaylist::MediaPlaylistStreamType::kSubtitle:
340  subtitle_playlist_groups[GetGroupId(*playlist)].push_back(playlist);
341  break;
342  default:
343  NOTIMPLEMENTED() << static_cast<int>(playlist->stream_type())
344  << " not handled.";
345  }
346  }
347 
348  if (!audio_playlist_groups.empty()) {
349  content->append("\n");
350  BuildMediaTags(audio_playlist_groups, default_language, base_url, content);
351  }
352 
353  if (!subtitle_playlist_groups.empty()) {
354  content->append("\n");
355  BuildMediaTags(subtitle_playlist_groups, default_language, base_url,
356  content);
357  }
358 
359  std::list<Variant> variants =
360  BuildVariants(audio_playlist_groups, subtitle_playlist_groups);
361  for (const auto& variant : variants) {
362  if (video_playlists.empty())
363  break;
364  content->append("\n");
365  for (const auto& playlist : video_playlists) {
366  BuildStreamInfTag(*playlist, variant, base_url, content);
367  }
368  }
369 
370  if (!iframe_playlists.empty()) {
371  content->append("\n");
372  for (const auto& playlist : iframe_playlists) {
373  // I-Frame playlists do not have variant. Just use the default.
374  BuildStreamInfTag(*playlist, Variant(), base_url, content);
375  }
376  }
377 }
378 
379 } // namespace
380 
381 MasterPlaylist::MasterPlaylist(const std::string& file_name,
382  const std::string& default_language)
383  : file_name_(file_name), default_language_(default_language) {}
384 MasterPlaylist::~MasterPlaylist() {}
385 
387  const std::string& base_url,
388  const std::string& output_dir,
389  const std::list<MediaPlaylist*>& playlists) {
390  std::string content = "#EXTM3U\n";
391  AppendVersionString(&content);
392  AppendPlaylists(default_language_, base_url, playlists, &content);
393 
394  // Skip if the playlist is already written.
395  if (content == written_playlist_)
396  return true;
397 
398  std::string file_path =
399  base::FilePath::FromUTF8Unsafe(output_dir)
400  .Append(base::FilePath::FromUTF8Unsafe(file_name_))
401  .AsUTF8Unsafe();
402  if (!File::WriteFileAtomically(file_path.c_str(), content)) {
403  LOG(ERROR) << "Failed to write master playlist to: " << file_path;
404  return false;
405  }
406  written_playlist_ = content;
407  return true;
408 }
409 
410 } // namespace hls
411 } // namespace shaka
All the methods that are virtual are virtual for mocking.
static bool WriteFileAtomically(const char *file_name, const std::string &contents)
Definition: file.cc:262
-
virtual bool WriteMasterPlaylist(const std::string &base_url, const std::string &output_dir, const std::list< MediaPlaylist *> &playlists)
-
MasterPlaylist(const std::string &file_name, const std::string &default_language)
+
virtual bool WriteMasterPlaylist(const std::string &base_url, const std::string &output_dir, const std::list< MediaPlaylist *> &playlists)
+
MasterPlaylist(const std::string &file_name, const std::string &default_language)
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 2187e6cdb9..1f9e137b2b 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 2e76698bdc..0964b1d75b 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 22a978ed00..678bb7c089 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 9d313ea37f..2112f407fa 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 2f5035d764..12d4789bac 100644 --- a/docs/d2/dbb/classshaka_1_1media_1_1TextChunker-members.html +++ b/docs/d2/dbb/classshaka_1_1media_1_1TextChunker-members.html @@ -70,30 +70,31 @@ $(function() {

This is the complete list of members for shaka::media::TextChunker, 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
output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
TextChunker(int64_t segment_duration_ms) (defined in shaka::media::TextChunker)shaka::media::TextChunkerexplicit
ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
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
output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
TextChunker(double segment_duration_in_seconds) (defined in shaka::media::TextChunker)shaka::media::TextChunkerexplicit
ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
diff --git a/docs/d2/dbf/status__macros_8h_source.html b/docs/d2/dbf/status__macros_8h_source.html index 3d34261e82..664fe57566 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 40bf77c2ab..c342a7b842 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 6d3b0f63ed..2e07396e65 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 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
- +
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 TryMatchStreamDataType(const StreamDataType& actual,
70  const StreamDataType& expected,
71  ::testing::MatchResultListener* listener) {
72  if (actual != expected) {
73  std::string expected_as_string = StreamDataTypeToString(expected);
74  std::string actual_as_string = StreamDataTypeToString(actual);
75 
76  *listener << "which is " << actual_as_string << " (expected "
77  << expected_as_string << ")";
78  return false;
79  }
80 
81  return true;
82 }
83 
84 bool TryMatchStreamType(const StreamType& actual,
85  const StreamType& expected,
86  ::testing::MatchResultListener* listener) {
87  if (actual != expected) {
88  std::string expected_as_string = StreamTypeToString(expected);
89  std::string actual_as_string = StreamTypeToString(actual);
90 
91  *listener << "which is " << actual_as_string << " (expected "
92  << expected_as_string << ")";
93  return false;
94  }
95 
96  return true;
97 }
98 
99 std::string ToPrettyString(const std::string& str) {
100  std::string out;
101 
102  // Opening quotation.
103  out.push_back('"');
104 
105  for (char c : str) {
106  if (isspace(c)) {
107  // Make all white space characters spaces to avoid print issues in
108  // the terminal.
109  out.push_back(' ');
110  } else if (isalnum(c)) {
111  // If the character is alpha-numeric, then print it as is. Just using
112  // these characters, it should be enough to understand the string.
113  out.push_back(c);
114  } else {
115  // Replace all other characters with '.'. This is to avoid print issues
116  // (e.g. \n) or readability issues (e.g. ").
117  out.push_back('.');
118  }
119  }
120 
121  // Closing quotation.
122  out.push_back('"');
123 
124  return out;
125 }
126 
127 bool FakeInputMediaHandler::ValidateOutputStreamIndex(size_t index) const {
128  return true;
129 }
130 
131 Status FakeInputMediaHandler::InitializeInternal() {
132  return Status::OK;
133 }
134 
135 Status FakeInputMediaHandler::Process(std::unique_ptr<StreamData> stream_data) {
136  return Status(error::INTERNAL_ERROR,
137  "FakeInputMediaHandler should never be a downstream handler.");
138 }
139 
140 Status MockOutputMediaHandler::InitializeInternal() {
141  return Status::OK;
142 }
143 
144 Status MockOutputMediaHandler::Process(
145  std::unique_ptr<StreamData> stream_data) {
146  OnProcess(stream_data.get());
147  return Status::OK;
148 }
149 
150 Status MockOutputMediaHandler::OnFlushRequest(size_t index) {
151  OnFlush(index);
152  return Status::OK;
153 }
154 
156  return Status::OK;
157 }
158 
159 Status FakeMediaHandler::Process(std::unique_ptr<StreamData> stream_data) {
160  stream_data_vector_.push_back(std::move(stream_data));
161  return Status::OK;
162 }
163 
164 Status FakeMediaHandler::OnFlushRequest(size_t input_stream_index) {
165  return Status::OK;
166 }
167 
168 bool FakeMediaHandler::ValidateOutputStreamIndex(size_t stream_index) const {
169  return true;
170 }
171 
172 bool MediaHandlerTestBase::IsVideoCodec(Codec codec) const {
173  return codec >= kCodecVideo && codec < kCodecVideoMaxPlusOne;
174 }
175 
176 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo(
177  uint32_t time_scale) const {
178  return GetVideoStreamInfo(time_scale, kCodecVP9, kWidth, kHeight);
179 }
180 
181 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo(
182  uint32_t time_scale,
183  uint32_t width,
184  uint64_t height) const {
185  return GetVideoStreamInfo(time_scale, kCodecVP9, width, height);
186 }
187 
188 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo(
189  uint32_t time_scale,
190  Codec codec) const {
191  return GetVideoStreamInfo(time_scale, codec, kWidth, kHeight);
192 }
193 
194 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo(
195  uint32_t time_scale,
196  Codec codec,
197  uint32_t width,
198  uint64_t height) const {
199  return std::unique_ptr<VideoStreamInfo>(new VideoStreamInfo(
200  kTrackId, time_scale, kDuration, codec, H26xStreamFormat::kUnSpecified,
201  kCodecString, kCodecConfig, sizeof(kCodecConfig), width, height,
202  kPixelWidth, kPixelHeight, kTrickPlayFactor, kNaluLengthSize, kLanguage,
203  !kEncrypted));
204 }
205 
206 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetAudioStreamInfo(
207  uint32_t time_scale) const {
208  return GetAudioStreamInfo(time_scale, kCodecAAC);
209 }
210 
211 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetAudioStreamInfo(
212  uint32_t time_scale,
213  Codec codec) const {
214  return std::unique_ptr<AudioStreamInfo>(new AudioStreamInfo(
215  kTrackId, time_scale, kDuration, codec, kCodecString, kCodecConfig,
216  sizeof(kCodecConfig), kSampleBits, kNumChannels, kSamplingFrequency,
217  kSeekPrerollNs, kCodecDelayNs, kMaxBitrate, kAvgBitrate, kLanguage,
218  !kEncrypted));
219 }
220 
221 std::shared_ptr<MediaSample> MediaHandlerTestBase::GetMediaSample(
222  int64_t timestamp,
223  int64_t duration,
224  bool is_keyframe) const {
225  return GetMediaSample(timestamp, duration, is_keyframe, kData, sizeof(kData));
226 }
227 
228 std::shared_ptr<MediaSample> MediaHandlerTestBase::GetMediaSample(
229  int64_t timestamp,
230  int64_t duration,
231  bool is_keyframe,
232  const uint8_t* data,
233  size_t data_length) const {
234  std::shared_ptr<MediaSample> sample =
235  MediaSample::CopyFrom(data, data_length, nullptr, 0, is_keyframe);
236  sample->set_dts(timestamp);
237  sample->set_pts(timestamp);
238  sample->set_duration(duration);
239 
240  return sample;
241 }
242 
243 std::unique_ptr<SegmentInfo> MediaHandlerTestBase::GetSegmentInfo(
244  int64_t start_timestamp,
245  int64_t duration,
246  bool is_subsegment) const {
247  std::unique_ptr<SegmentInfo> info(new SegmentInfo);
248  info->start_timestamp = start_timestamp;
249  info->duration = duration;
250  info->is_subsegment = is_subsegment;
251 
252  return info;
253 }
254 
255 std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetTextStreamInfo(
256  uint32_t timescale) const {
257  // None of this information is actually used by the text out handler.
258  // The stream info is just needed to signal the start of the stream.
259  return std::unique_ptr<StreamInfo>(
260  new TextStreamInfo(0, timescale, 0, kUnknownCodec, "", "", 0, 0, ""));
261 }
262 
263 std::unique_ptr<TextSample> MediaHandlerTestBase::GetTextSample(
264  const std::string& id,
265  int64_t start,
266  int64_t end,
267  const std::string& payload) const {
268  std::unique_ptr<TextSample> sample(new TextSample);
269  sample->set_id(id);
270  sample->SetTime(start, end);
271  sample->AppendPayload(payload);
272 
273  return sample;
274 }
275 
276 std::unique_ptr<CueEvent> MediaHandlerTestBase::GetCueEvent(
277  double time_in_seconds) const {
278  std::unique_ptr<CueEvent> event(new CueEvent);
279  event->time_in_seconds = time_in_seconds;
280 
281  return event;
282 }
283 
284 Status MediaHandlerTestBase::SetUpAndInitializeGraph(
285  std::shared_ptr<MediaHandler> handler,
286  size_t input_count,
287  size_t output_count) {
288  DCHECK(handler);
289  DCHECK_EQ(nullptr, handler_);
290  DCHECK(inputs_.empty());
291  DCHECK(outputs_.empty());
292 
293  handler_ = std::move(handler);
294 
295  Status status;
296 
297  // Add and connect all the requested inputs.
298  for (size_t i = 0; i < input_count; i++) {
299  inputs_.emplace_back(new FakeInputMediaHandler);
300  }
301 
302  for (auto& input : inputs_) {
303  status.Update(input->AddHandler(handler_));
304  }
305 
306  if (!status.ok()) {
307  return status;
308  }
309 
310  // Add and connect all the requested outputs.
311  for (size_t i = 0; i < output_count; i++) {
312  outputs_.emplace_back(new testing::NiceMock<MockOutputMediaHandler>);
313  }
314 
315  for (auto& output : outputs_) {
316  status.Update(handler_->AddHandler(output));
317  }
318 
319  if (!status.ok()) {
320  return status;
321  }
322 
323  // Initialize the graph.
324  for (auto& input : inputs_) {
325  status.Update(input->Initialize());
326  }
327 
328  // In the case that there are no inputs, the start of the graph
329  // is at |handler_| so it needs to be initialized or else the graph
330  // won't be initialized.
331  if (inputs_.empty()) {
332  status.Update(handler_->Initialize());
333  }
334 
335  return status;
336 }
337 
338 FakeInputMediaHandler* MediaHandlerTestBase::Input(size_t index) {
339  DCHECK_LT(index, inputs_.size());
340  return inputs_[index].get();
341 }
342 
343 MockOutputMediaHandler* MediaHandlerTestBase::Output(size_t index) {
344  DCHECK_LT(index, outputs_.size());
345  return outputs_[index].get();
346 }
347 
348 MediaHandlerGraphTestBase::MediaHandlerGraphTestBase()
349  : next_handler_(new FakeMediaHandler),
350  some_handler_(new FakeMediaHandler) {}
351 
353  size_t num_inputs,
354  size_t num_outputs,
355  std::shared_ptr<MediaHandler> handler) {
356  // Input handler is not really used anywhere but just to satisfy one input
357  // one output restriction for the encryption handler.
358  auto input_handler = std::make_shared<FakeMediaHandler>();
359  for (size_t i = 0; i < num_inputs; ++i)
360  ASSERT_OK(input_handler->SetHandler(i, handler));
361  // All outputs are routed to |next_handler_|.
362  for (size_t i = 0; i < num_outputs; ++i)
363  ASSERT_OK(handler->SetHandler(i, next_handler_));
364 }
365 
366 const std::vector<std::unique_ptr<StreamData>>&
368  return next_handler_->stream_data_vector();
369 }
370 
372  next_handler_->clear_stream_data_vector();
373 }
374 
375 } // namespace media
376 } // 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 2394a972d9..8a35899431 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 0101379e6b..c50394b044 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 89d0b090a4..2910dd9268 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 84fbc075fe..2697539fea 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 a10bd3a457..327f533065 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 390851f8c7..035db5259c 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 c69f289a60..9122c872f7 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 d610eb6440..0de3014301 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 f32d6926c7..81978b1592 100644 --- a/docs/d2/dd8/classshaka_1_1media_1_1ChunkingHandler-members.html +++ b/docs/d2/dd8/classshaka_1_1media_1_1ChunkingHandler-members.html @@ -70,35 +70,36 @@ $(function() {

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

- - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + +
AddHandler(std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandlerinline
ChunkingHandler(const ChunkingParams &chunking_params) (defined in shaka::media::ChunkingHandler)shaka::media::ChunkingHandlerexplicit
ChunkingHandlerTest (defined in shaka::media::ChunkingHandler)shaka::media::ChunkingHandlerfriend
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
InitializeInternal() overrideshaka::media::ChunkingHandlerprotectedvirtual
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
OnFlushRequest(size_t input_stream_index) overrideshaka::media::ChunkingHandlerprotectedvirtual
output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
Process(std::unique_ptr< StreamData > stream_data) overrideshaka::media::ChunkingHandlerprotectedvirtual
SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
~ChunkingHandler() override=default (defined in shaka::media::ChunkingHandler)shaka::media::ChunkingHandler
~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
ChunkingHandler(const ChunkingParams &chunking_params) (defined in shaka::media::ChunkingHandler)shaka::media::ChunkingHandlerexplicit
ChunkingHandlerTest (defined in shaka::media::ChunkingHandler)shaka::media::ChunkingHandlerfriend
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
InitializeInternal() overrideshaka::media::ChunkingHandlerprotectedvirtual
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
OnFlushRequest(size_t input_stream_index) overrideshaka::media::ChunkingHandlerprotectedvirtual
output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
Process(std::unique_ptr< StreamData > stream_data) overrideshaka::media::ChunkingHandlerprotectedvirtual
SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
~ChunkingHandler() override=default (defined in shaka::media::ChunkingHandler)shaka::media::ChunkingHandler
~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
diff --git a/docs/d2/ddb/classshaka_1_1media_1_1WebMMediaParser.html b/docs/d2/ddb/classshaka_1_1media_1_1WebMMediaParser.html index f31fafdcd5..d6b20e8b01 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 49c1d48270..db872a7469 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 1299eb8b07..e063d83c0c 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 84548fbc05..2cfcaa30aa 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 3ce6121974..af78f61f22 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_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
+
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:940
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:959
+
static std::string GetLibraryVersion()
Definition: packager.cc:936
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 bcf0d9cb58..ee61c81e93 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 e9e34c1151..d60741a354 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 2148f4a8dc..28baa5974f 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 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
+
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 #include "packager/status_macros.h"
10 
11 namespace shaka {
12 namespace media {
13 
14 std::string StreamDataTypeToString(StreamDataType type) {
15  switch (type) {
16  case StreamDataType::kStreamInfo:
17  return "stream info";
18  case StreamDataType::kMediaSample:
19  return "media sample";
20  case StreamDataType::kTextSample:
21  return "text sample";
22  case StreamDataType::kSegmentInfo:
23  return "segment info";
24  case StreamDataType::kScte35Event:
25  return "scte35 event";
26  case StreamDataType::kCueEvent:
27  return "cue event";
28  case StreamDataType::kUnknown:
29  return "unknown";
30  }
31  return "unknown";
32 }
33 
34 Status MediaHandler::SetHandler(size_t output_stream_index,
35  std::shared_ptr<MediaHandler> handler) {
36  if (output_handlers_.find(output_stream_index) != output_handlers_.end()) {
37  return Status(error::ALREADY_EXISTS,
38  "The handler at the specified index already exists.");
39  }
40  output_handlers_[output_stream_index] =
41  std::make_pair(handler, handler->num_input_streams_++);
42  next_output_stream_index_ = output_stream_index + 1;
43  return Status::OK;
44 }
45 
47  if (initialized_)
48  return Status::OK;
49  Status status = InitializeInternal();
50  if (!status.ok())
51  return status;
52  for (auto& pair : output_handlers_) {
53  if (!ValidateOutputStreamIndex(pair.first))
54  return Status(error::INVALID_ARGUMENT, "Invalid output stream index");
55  status = pair.second.first->Initialize();
56  if (!status.ok())
57  return status;
58  }
59  initialized_ = true;
60  return Status::OK;
61 }
62 
63 Status MediaHandler::Chain(
64  std::initializer_list<std::shared_ptr<MediaHandler>> list) {
65  std::shared_ptr<MediaHandler> previous;
66 
67  for (auto& next : list) {
68  // Skip null entries.
69  if (!next) {
70  continue;
71  }
72 
73  if (previous) {
74  RETURN_IF_ERROR(previous->AddHandler(next));
75  }
76 
77  previous = std::move(next);
78  }
79 
80  return Status::OK;
81 }
82 
83 Status MediaHandler::OnFlushRequest(size_t input_stream_index) {
84  // The default implementation treats the output stream index to be identical
85  // to the input stream index, which is true for most handlers.
86  const size_t output_stream_index = input_stream_index;
87  return FlushDownstream(output_stream_index);
88 }
89 
90 bool MediaHandler::ValidateOutputStreamIndex(size_t stream_index) const {
91  return stream_index < num_input_streams_;
92 }
93 
94 Status MediaHandler::Dispatch(std::unique_ptr<StreamData> stream_data) const {
95  size_t output_stream_index = stream_data->stream_index;
96  auto handler_it = output_handlers_.find(output_stream_index);
97  if (handler_it == output_handlers_.end()) {
98  return Status(error::NOT_FOUND,
99  "No output handler exist at the specified index.");
100  }
101  stream_data->stream_index = handler_it->second.second;
102  return handler_it->second.first->Process(std::move(stream_data));
103 }
104 
105 Status MediaHandler::FlushDownstream(size_t output_stream_index) {
106  auto handler_it = output_handlers_.find(output_stream_index);
107  if (handler_it == output_handlers_.end()) {
108  return Status(error::NOT_FOUND,
109  "No output handler exist at the specified index.");
110  }
111  return handler_it->second.first->OnFlushRequest(handler_it->second.second);
112 }
113 
115  for (const auto& pair : output_handlers_) {
116  Status status = pair.second.first->OnFlushRequest(pair.second.second);
117  if (!status.ok()) {
118  return status;
119  }
120  }
121  return Status::OK;
122 }
123 } // namespace media
124 } // 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 51a267e04d..7c200d1de0 100644 --- a/docs/d2/de9/mock__muxer__listener_8h_source.html +++ b/docs/d2/de9/mock__muxer__listener_8h_source.html @@ -68,7 +68,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_EVENT_MOCK_MUXER_LISTENER_H_
8 #define PACKAGER_MEDIA_EVENT_MOCK_MUXER_LISTENER_H_
9 
10 #include <gmock/gmock.h>
11 
12 #include "packager/media/base/muxer_options.h"
13 #include "packager/media/base/protection_system_specific_info.h"
14 #include "packager/media/base/stream_info.h"
15 #include "packager/media/event/muxer_listener.h"
16 
17 namespace shaka {
18 namespace media {
19 
21  public:
23  ~MockMuxerListener() override;
24 
25  MOCK_METHOD5(
27  void(bool is_initial_encryption_info,
28  FourCC protection_scheme,
29  const std::vector<uint8_t>& key_id,
30  const std::vector<uint8_t>& iv,
31  const std::vector<ProtectionSystemSpecificInfo>& key_system_info));
32 
33  MOCK_METHOD0(OnEncryptionStart, void());
34 
35  MOCK_METHOD4(OnMediaStart,
36  void(const MuxerOptions& muxer_options,
37  const StreamInfo& stream_info,
38  uint32_t time_scale,
39  ContainerType container_type));
40 
41  MOCK_METHOD1(OnSampleDurationReady, void(uint32_t sample_duration));
42 
43  MOCK_METHOD9(OnMediaEndMock,
44  void(bool has_init_range,
45  uint64_t init_range_start,
46  uint64_t init_range_end,
47  bool has_index_range,
48  uint64_t index_range_start,
49  uint64_t index_range_end,
50  bool has_subsegment_ranges,
51  const std::vector<Range> subsegment_ranges,
52  float duration_seconds));
53 
54  // Windows 32 bit cannot mock MediaRanges because it has Optionals that use
55  // memory alignment of 8 bytes. The compiler fails if it is mocked.
56  void OnMediaEnd(const MediaRanges& range,
57  float duration_seconds) override;
58 
59  MOCK_METHOD4(OnNewSegment,
60  void(const std::string& segment_name,
61  uint64_t start_time,
62  uint64_t duration,
63  uint64_t segment_file_size));
64 
65  MOCK_METHOD3(OnKeyFrame,
66  void(uint64_t timestamp,
67  uint64_t start_byte_offset,
68  uint64_t size));
69 
70  MOCK_METHOD2(OnCueEvent,
71  void(uint64_t timestamp, const std::string& cue_data));
72 };
73 
74 } // namespace media
75 } // namespace shaka
76 
77 #endif // PACKAGER_MEDIA_EVENT_MOCK_MUXER_LISTENER_H_
virtual void OnNewSegment(const std::string &segment_name, uint64_t start_time, uint64_t duration, uint64_t segment_file_size)=0
virtual void OnEncryptionInfoReady(bool is_initial_encryption_info, FourCC protection_scheme, const std::vector< uint8_t > &key_id, const std::vector< uint8_t > &iv, const std::vector< ProtectionSystemSpecificInfo > &key_system_info)=0
-
Abstract class holds stream information.
Definition: stream_info.h:59
+
Abstract class holds stream information.
Definition: stream_info.h:61
virtual void OnSampleDurationReady(uint32_t sample_duration)=0
virtual void OnKeyFrame(uint64_t timestamp, uint64_t start_byte_offset, uint64_t size)=0
@@ -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 9527c8ed60..e7bfb3efee 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 371bc6b7dc..739cf80893 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 bcb0fbe6c8..5fa67bbcb4 100644 --- a/docs/d2/dee/pes__packet__generator_8cc_source.html +++ b/docs/d2/dee/pes__packet__generator_8cc_source.html @@ -66,7 +66,7 @@ $(function() {
pes_packet_generator.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/media/formats/mp2t/pes_packet_generator.h"
8 
9 #include <algorithm>
10 #include <cstring>
11 #include <memory>
12 
13 #include "packager/media/base/audio_stream_info.h"
14 #include "packager/media/base/buffer_writer.h"
15 #include "packager/media/base/media_sample.h"
16 #include "packager/media/base/video_stream_info.h"
17 #include "packager/media/codecs/aac_audio_specific_config.h"
18 #include "packager/media/codecs/nal_unit_to_byte_stream_converter.h"
19 #include "packager/media/codecs/nalu_reader.h"
20 #include "packager/media/formats/mp2t/pes_packet.h"
21 
22 namespace shaka {
23 namespace media {
24 namespace mp2t {
25 
26 namespace {
27 const uint8_t kVideoStreamId = 0xE0;
28 const uint8_t kAacAudioStreamId = 0xC0;
29 const uint8_t kAc3AudioStreamId = 0xBD; // AC3 uses private stream 1 id.
30 const double kTsTimescale = 90000.0;
31 } // namespace
32 
33 PesPacketGenerator::PesPacketGenerator() {}
34 PesPacketGenerator::~PesPacketGenerator() {}
35 
36 bool PesPacketGenerator::Initialize(const StreamInfo& stream_info) {
37  pes_packets_.clear();
38  stream_type_ = stream_info.stream_type();
39 
40  if (stream_type_ == kStreamVideo) {
41  const VideoStreamInfo& video_stream_info =
42  static_cast<const VideoStreamInfo&>(stream_info);
43  if (video_stream_info.codec() != Codec::kCodecH264) {
44  NOTIMPLEMENTED() << "Video codec " << video_stream_info.codec()
45  << " is not supported.";
46  return false;
47  }
48  timescale_scale_ = kTsTimescale / video_stream_info.time_scale();
49  converter_.reset(new NalUnitToByteStreamConverter());
50  return converter_->Initialize(video_stream_info.codec_config().data(),
51  video_stream_info.codec_config().size());
52  } else if (stream_type_ == kStreamAudio) {
53  const AudioStreamInfo& audio_stream_info =
54  static_cast<const AudioStreamInfo&>(stream_info);
55  timescale_scale_ = kTsTimescale / audio_stream_info.time_scale();
56  if (audio_stream_info.codec() == Codec::kCodecAAC) {
57  audio_stream_id_ = kAacAudioStreamId;
58  adts_converter_.reset(new AACAudioSpecificConfig());
59  return adts_converter_->Parse(audio_stream_info.codec_config());
60  } else if (audio_stream_info.codec() == Codec::kCodecAC3 ||
61  audio_stream_info.codec() == Codec::kCodecEAC3) {
62  audio_stream_id_ = kAc3AudioStreamId;
63  // No converter needed for AC3 and E-AC3.
64  return true;
65  }
66  NOTIMPLEMENTED() << "Audio codec " << audio_stream_info.codec()
67  << " is not supported yet.";
68  return false;
69  }
70 
71  NOTIMPLEMENTED() << "Stream type: " << stream_type_ << " not implemented.";
72  return false;
73 }
74 
76  if (!current_processing_pes_)
77  current_processing_pes_.reset(new PesPacket());
78 
79  current_processing_pes_->set_is_key_frame(sample.is_key_frame());
80  current_processing_pes_->set_pts(timescale_scale_ * sample.pts());
81  current_processing_pes_->set_dts(timescale_scale_ * sample.dts());
82  if (stream_type_ == kStreamVideo) {
83  DCHECK(converter_);
84  std::vector<SubsampleEntry> subsamples;
85  if (sample.decrypt_config())
86  subsamples = sample.decrypt_config()->subsamples();
87  const bool kEscapeEncryptedNalu = true;
88  std::vector<uint8_t> byte_stream;
89  if (!converter_->ConvertUnitToByteStreamWithSubsamples(
90  sample.data(), sample.data_size(), sample.is_key_frame(),
91  kEscapeEncryptedNalu, &byte_stream, &subsamples)) {
92  LOG(ERROR) << "Failed to convert sample to byte stream.";
93  return false;
94  }
95 
96  current_processing_pes_->mutable_data()->swap(byte_stream);
97  current_processing_pes_->set_stream_id(kVideoStreamId);
98  pes_packets_.push_back(std::move(current_processing_pes_));
99  return true;
100  }
101  DCHECK_EQ(stream_type_, kStreamAudio);
102 
103  std::vector<uint8_t> audio_frame(sample.data(),
104  sample.data() + sample.data_size());
105 
106  // AAC is carried in ADTS.
107  if (adts_converter_) {
108  // TODO(rkuroiwa): ConvertToADTS() makes another copy of audio_frame
109  // internally. Optimize copying in this function, possibly by adding a
110  // method on AACAudioSpecificConfig that takes {pointer, length} pair and
111  // returns a vector that has the ADTS header.
112  if (!adts_converter_->ConvertToADTS(&audio_frame))
113  return false;
114  }
115 
116  // TODO(rkuriowa): Put multiple samples in the PES packet to reduce # of PES
117  // packets.
118  current_processing_pes_->mutable_data()->swap(audio_frame);
119  current_processing_pes_->set_stream_id(audio_stream_id_);
120  pes_packets_.push_back(std::move(current_processing_pes_));
121  return true;
122 }
123 
125  return pes_packets_.size();
126 }
127 
128 std::unique_ptr<PesPacket> PesPacketGenerator::GetNextPesPacket() {
129  DCHECK(!pes_packets_.empty());
130  std::unique_ptr<PesPacket> pes = std::move(pes_packets_.front());
131  pes_packets_.pop_front();
132  return pes;
133 }
134 
136  return true;
137 }
138 
139 } // namespace mp2t
140 } // namespace media
141 } // namespace shaka
Abstract class holds stream information.
Definition: stream_info.h:59
+
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/media/formats/mp2t/pes_packet_generator.h"
8 
9 #include <algorithm>
10 #include <cstring>
11 #include <memory>
12 
13 #include "packager/media/base/audio_stream_info.h"
14 #include "packager/media/base/buffer_writer.h"
15 #include "packager/media/base/media_sample.h"
16 #include "packager/media/base/video_stream_info.h"
17 #include "packager/media/codecs/aac_audio_specific_config.h"
18 #include "packager/media/codecs/nal_unit_to_byte_stream_converter.h"
19 #include "packager/media/codecs/nalu_reader.h"
20 #include "packager/media/formats/mp2t/pes_packet.h"
21 
22 namespace shaka {
23 namespace media {
24 namespace mp2t {
25 
26 namespace {
27 const uint8_t kVideoStreamId = 0xE0;
28 const uint8_t kAacAudioStreamId = 0xC0;
29 const uint8_t kAc3AudioStreamId = 0xBD; // AC3 uses private stream 1 id.
30 const double kTsTimescale = 90000.0;
31 } // namespace
32 
33 PesPacketGenerator::PesPacketGenerator() {}
34 PesPacketGenerator::~PesPacketGenerator() {}
35 
36 bool PesPacketGenerator::Initialize(const StreamInfo& stream_info) {
37  pes_packets_.clear();
38  stream_type_ = stream_info.stream_type();
39 
40  if (stream_type_ == kStreamVideo) {
41  const VideoStreamInfo& video_stream_info =
42  static_cast<const VideoStreamInfo&>(stream_info);
43  if (video_stream_info.codec() != Codec::kCodecH264) {
44  NOTIMPLEMENTED() << "Video codec " << video_stream_info.codec()
45  << " is not supported.";
46  return false;
47  }
48  timescale_scale_ = kTsTimescale / video_stream_info.time_scale();
49  converter_.reset(new NalUnitToByteStreamConverter());
50  return converter_->Initialize(video_stream_info.codec_config().data(),
51  video_stream_info.codec_config().size());
52  } else if (stream_type_ == kStreamAudio) {
53  const AudioStreamInfo& audio_stream_info =
54  static_cast<const AudioStreamInfo&>(stream_info);
55  timescale_scale_ = kTsTimescale / audio_stream_info.time_scale();
56  if (audio_stream_info.codec() == Codec::kCodecAAC) {
57  audio_stream_id_ = kAacAudioStreamId;
58  adts_converter_.reset(new AACAudioSpecificConfig());
59  return adts_converter_->Parse(audio_stream_info.codec_config());
60  } else if (audio_stream_info.codec() == Codec::kCodecAC3 ||
61  audio_stream_info.codec() == Codec::kCodecEAC3) {
62  audio_stream_id_ = kAc3AudioStreamId;
63  // No converter needed for AC3 and E-AC3.
64  return true;
65  }
66  NOTIMPLEMENTED() << "Audio codec " << audio_stream_info.codec()
67  << " is not supported yet.";
68  return false;
69  }
70 
71  NOTIMPLEMENTED() << "Stream type: " << stream_type_ << " not implemented.";
72  return false;
73 }
74 
76  if (!current_processing_pes_)
77  current_processing_pes_.reset(new PesPacket());
78 
79  current_processing_pes_->set_is_key_frame(sample.is_key_frame());
80  current_processing_pes_->set_pts(timescale_scale_ * sample.pts());
81  current_processing_pes_->set_dts(timescale_scale_ * sample.dts());
82  if (stream_type_ == kStreamVideo) {
83  DCHECK(converter_);
84  std::vector<SubsampleEntry> subsamples;
85  if (sample.decrypt_config())
86  subsamples = sample.decrypt_config()->subsamples();
87  const bool kEscapeEncryptedNalu = true;
88  std::vector<uint8_t> byte_stream;
89  if (!converter_->ConvertUnitToByteStreamWithSubsamples(
90  sample.data(), sample.data_size(), sample.is_key_frame(),
91  kEscapeEncryptedNalu, &byte_stream, &subsamples)) {
92  LOG(ERROR) << "Failed to convert sample to byte stream.";
93  return false;
94  }
95 
96  current_processing_pes_->mutable_data()->swap(byte_stream);
97  current_processing_pes_->set_stream_id(kVideoStreamId);
98  pes_packets_.push_back(std::move(current_processing_pes_));
99  return true;
100  }
101  DCHECK_EQ(stream_type_, kStreamAudio);
102 
103  std::vector<uint8_t> audio_frame(sample.data(),
104  sample.data() + sample.data_size());
105 
106  // AAC is carried in ADTS.
107  if (adts_converter_) {
108  // TODO(rkuroiwa): ConvertToADTS() makes another copy of audio_frame
109  // internally. Optimize copying in this function, possibly by adding a
110  // method on AACAudioSpecificConfig that takes {pointer, length} pair and
111  // returns a vector that has the ADTS header.
112  if (!adts_converter_->ConvertToADTS(&audio_frame))
113  return false;
114  }
115 
116  // TODO(rkuriowa): Put multiple samples in the PES packet to reduce # of PES
117  // packets.
118  current_processing_pes_->mutable_data()->swap(audio_frame);
119  current_processing_pes_->set_stream_id(audio_stream_id_);
120  pes_packets_.push_back(std::move(current_processing_pes_));
121  return true;
122 }
123 
125  return pes_packets_.size();
126 }
127 
128 std::unique_ptr<PesPacket> PesPacketGenerator::GetNextPesPacket() {
129  DCHECK(!pes_packets_.empty());
130  std::unique_ptr<PesPacket> pes = std::move(pes_packets_.front());
131  pes_packets_.pop_front();
132  return pes;
133 }
134 
136  return true;
137 }
138 
139 } // namespace mp2t
140 } // namespace media
141 } // namespace shaka
Abstract class holds stream information.
Definition: stream_info.h:61
virtual bool PushSample(const MediaSample &sample)
virtual std::unique_ptr< PesPacket > GetNextPesPacket()
@@ -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 db0b3972b8..cc0c50b96d 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 de1d6a761a..6fd3e59cc8 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 b4c22eb314..1fdb8c5b6f 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 d90e2fdf9c..e03e859f0c 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 c98691136a..d2e2a817f0 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 4de66b72fa..0dbf0cd4f3 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 9f58510c19..d5d60e6c4a 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 8bb9dcfcde..e374db9dce 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 277ac5082d..5480d753ac 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 0deaf151d8..9a464aa69d 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 3072514e32..6c2dcf2049 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 1bd42ed385..d489c7f73e 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 1ac7a9fb00..8a1d897be0 100644 --- a/docs/d3/d19/io__cache_8h_source.html +++ b/docs/d3/d19/io__cache_8h_source.html @@ -67,20 +67,20 @@ $(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 PACKAGER_FILE_IO_CACHE_H_
8 #define PACKAGER_FILE_IO_CACHE_H_
9 
10 #include <stdint.h>
11 #include <vector>
12 #include "packager/base/macros.h"
13 #include "packager/base/synchronization/lock.h"
14 #include "packager/base/synchronization/waitable_event.h"
15 
16 namespace shaka {
17 
19 class IoCache {
20  public:
21  explicit IoCache(uint64_t cache_size);
22  ~IoCache();
23 
30  uint64_t Read(void* buffer, uint64_t size);
31 
39  uint64_t Write(const void* buffer, uint64_t size);
40 
42  void Clear();
43 
46  void Close();
47 
49  bool closed() { return closed_; }
50 
52  void Reopen();
53 
56  uint64_t BytesCached();
57 
60  uint64_t BytesFree();
61 
64 
65  private:
66  uint64_t BytesCachedInternal();
67  uint64_t BytesFreeInternal();
68 
69  const uint64_t cache_size_;
70  base::Lock lock_;
71  base::WaitableEvent read_event_;
72  base::WaitableEvent write_event_;
73  std::vector<uint8_t> circular_buffer_;
74  const uint8_t* end_ptr_;
75  uint8_t* r_ptr_;
76  uint8_t* w_ptr_;
77  bool closed_;
78 
79  DISALLOW_COPY_AND_ASSIGN(IoCache);
80 };
81 
82 } // namespace shaka
83 
84 #endif // PACKAGER_FILE_IO_CACHE_H
Declaration of class which implements a thread-safe circular buffer.
Definition: io_cache.h:19
-
void Reopen()
Reopens the cache. Any data still in the cache will be lost.
Definition: io_cache.cc:116
-
void Clear()
Empties the cache.
Definition: io_cache.cc:102
-
void Close()
Definition: io_cache.cc:109
+
void Reopen()
Reopens the cache. Any data still in the cache will be lost.
Definition: io_cache.cc:119
+
void Clear()
Empties the cache.
Definition: io_cache.cc:105
+
void Close()
Definition: io_cache.cc:112
All the methods that are virtual are virtual for mocking.
bool closed()
Definition: io_cache.h:49
uint64_t Write(const void *buffer, uint64_t size)
Definition: io_cache.cc:66
-
void WaitUntilEmptyOrClosed()
Waits until the cache is empty or has been closed.
Definition: io_cache.cc:145
+
void WaitUntilEmptyOrClosed()
Waits until the cache is empty or has been closed.
Definition: io_cache.cc:148
uint64_t Read(void *buffer, uint64_t size)
Definition: io_cache.cc:38
-
uint64_t BytesFree()
Definition: io_cache.cc:130
-
uint64_t BytesCached()
Definition: io_cache.cc:125
+
uint64_t BytesFree()
Definition: io_cache.cc:133
+
uint64_t BytesCached()
Definition: io_cache.cc:128
diff --git a/docs/d3/d1a/classshaka_1_1media_1_1Replicator.html b/docs/d3/d1a/classshaka_1_1media_1_1Replicator.html index 05a007a324..f3efb7a54d 100644 --- a/docs/d3/d1a/classshaka_1_1media_1_1Replicator.html +++ b/docs/d3/d1a/classshaka_1_1media_1_1Replicator.html @@ -97,6 +97,10 @@ Additional Inherited Members bool IsConnected ()  Validate if the handler is connected to its upstream handler.
  +- Static Public Member Functions inherited from shaka::media::MediaHandler + +static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list) +  - Protected Member Functions inherited from shaka::media::MediaHandler Status Dispatch (std::unique_ptr< StreamData > stream_data) const   @@ -156,7 +160,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 119f29e1df..7a3011530a 100644 --- a/docs/d3/d1e/classshaka_1_1media_1_1FakeInputMediaHandler.html +++ b/docs/d3/d1e/classshaka_1_1media_1_1FakeInputMediaHandler.html @@ -95,6 +95,10 @@ Additional Inherited Members bool IsConnected ()  Validate if the handler is connected to its upstream handler.
  +- Static Public Member Functions inherited from shaka::media::MediaHandler + +static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list) +  - Protected Member Functions inherited from shaka::media::MediaHandler virtual Status OnFlushRequest (size_t input_stream_index) @@ -149,7 +153,7 @@ const std::map< size_t, std::pair< std::shared_ptr<

Detailed Description

-

Definition at line 153 of file media_handler_test_base.h.

+

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

    Additional Inherited Members

    +- Static Public Member Functions inherited from shaka::media::MediaHandler + +static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list) +  - Protected Member Functions inherited from shaka::media::Muxer const MuxerOptionsoptions () const @@ -204,7 +208,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 49a937e857..7c38bbe3e5 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 a705e2763e..cf15326bda 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 @@ -124,6 +124,10 @@ bool 

    Additional Inherited Members

    +- Static Public Member Functions inherited from shaka::media::MediaHandler + +static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list) +  - Protected Member Functions inherited from shaka::media::Muxer const MuxerOptionsoptions () const @@ -208,7 +212,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 be0cbcfbf5..25456e6cf9 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 dbc059f257..39add5e5a9 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 1000638a3a..2dd3363be9 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 243e327355..171214fd0a 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 0510cb7cdd..9e9dc35ae2 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 9328a2c997..0dc1e96b65 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 ab5a7fdfca..c72348536f 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 56c5c56d51..a69b23a3e0 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 @@ -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 270550b550..a0fc5e995d 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 ff08561fe3..96b0fdec7e 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 737ac04dea..0a4a25f135 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 87212f4526..bd86a2a228 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 001796520b..1740179370 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 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.
    +
    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,
    80  std::shared_ptr<const StreamInfo> stream_info) {
    81  std::unique_ptr<StreamData> stream_data(new StreamData);
    82  stream_data->stream_index = stream_index;
    83  stream_data->stream_data_type = StreamDataType::kStreamInfo;
    84  stream_data->stream_info = std::move(stream_info);
    85  return stream_data;
    86  }
    87 
    88  static std::unique_ptr<StreamData> FromMediaSample(
    89  size_t stream_index,
    90  std::shared_ptr<const MediaSample> media_sample) {
    91  std::unique_ptr<StreamData> stream_data(new StreamData);
    92  stream_data->stream_index = stream_index;
    93  stream_data->stream_data_type = StreamDataType::kMediaSample;
    94  stream_data->media_sample = std::move(media_sample);
    95  return stream_data;
    96  }
    97 
    98  static std::unique_ptr<StreamData> FromTextSample(
    99  size_t stream_index,
    100  std::shared_ptr<const TextSample> text_sample) {
    101  std::unique_ptr<StreamData> stream_data(new StreamData);
    102  stream_data->stream_index = stream_index;
    103  stream_data->stream_data_type = StreamDataType::kTextSample;
    104  stream_data->text_sample = std::move(text_sample);
    105  return stream_data;
    106  }
    107 
    108  static std::unique_ptr<StreamData> FromSegmentInfo(
    109  size_t stream_index,
    110  std::shared_ptr<const SegmentInfo> segment_info) {
    111  std::unique_ptr<StreamData> stream_data(new StreamData);
    112  stream_data->stream_index = stream_index;
    113  stream_data->stream_data_type = StreamDataType::kSegmentInfo;
    114  stream_data->segment_info = std::move(segment_info);
    115  return stream_data;
    116  }
    117 
    118  static std::unique_ptr<StreamData> FromScte35Event(
    119  size_t stream_index,
    120  std::shared_ptr<const Scte35Event> scte35_event) {
    121  std::unique_ptr<StreamData> stream_data(new StreamData);
    122  stream_data->stream_index = stream_index;
    123  stream_data->stream_data_type = StreamDataType::kScte35Event;
    124  stream_data->scte35_event = std::move(scte35_event);
    125  return stream_data;
    126  }
    127 
    128  static std::unique_ptr<StreamData> FromCueEvent(
    129  size_t stream_index,
    130  std::shared_ptr<const CueEvent> cue_event) {
    131  std::unique_ptr<StreamData> stream_data(new StreamData);
    132  stream_data->stream_index = stream_index;
    133  stream_data->stream_data_type = StreamDataType::kCueEvent;
    134  stream_data->cue_event = std::move(cue_event);
    135  return stream_data;
    136  }
    137 };
    138 
    155  public:
    156  MediaHandler() = default;
    157  virtual ~MediaHandler() = default;
    158 
    160  Status SetHandler(size_t output_stream_index,
    161  std::shared_ptr<MediaHandler> handler);
    162 
    164  Status AddHandler(std::shared_ptr<MediaHandler> handler) {
    165  return SetHandler(next_output_stream_index_, handler);
    166  }
    167 
    170  Status Initialize();
    171 
    173  bool IsConnected() { return num_input_streams_ > 0; }
    174 
    175  static Status Chain(
    176  std::initializer_list<std::shared_ptr<MediaHandler>> list);
    177 
    178  protected:
    181  virtual Status InitializeInternal() = 0;
    182 
    187  virtual Status Process(std::unique_ptr<StreamData> stream_data) = 0;
    188 
    190  virtual Status OnFlushRequest(size_t input_stream_index);
    191 
    193  virtual bool ValidateOutputStreamIndex(size_t stream_index) const;
    194 
    197  Status Dispatch(std::unique_ptr<StreamData> stream_data) const;
    198 
    201  size_t stream_index,
    202  std::shared_ptr<const StreamInfo> stream_info) const {
    203  return Dispatch(
    204  StreamData::FromStreamInfo(stream_index, std::move(stream_info)));
    205  }
    206 
    209  size_t stream_index,
    210  std::shared_ptr<const MediaSample> media_sample) const {
    211  return Dispatch(
    212  StreamData::FromMediaSample(stream_index, std::move(media_sample)));
    213  }
    214 
    216  // DispatchTextSample should only be override for testing.
    218  size_t stream_index,
    219  std::shared_ptr<const TextSample> text_sample) const {
    220  return Dispatch(
    221  StreamData::FromTextSample(stream_index, std::move(text_sample)));
    222  }
    223 
    226  size_t stream_index,
    227  std::shared_ptr<const SegmentInfo> segment_info) const {
    228  return Dispatch(
    229  StreamData::FromSegmentInfo(stream_index, std::move(segment_info)));
    230  }
    231 
    234  size_t stream_index,
    235  std::shared_ptr<const Scte35Event> scte35_event) const {
    236  return Dispatch(
    237  StreamData::FromScte35Event(stream_index, std::move(scte35_event)));
    238  }
    239 
    241  Status DispatchCueEvent(size_t stream_index,
    242  std::shared_ptr<const CueEvent> cue_event) const {
    243  return Dispatch(
    244  StreamData::FromCueEvent(stream_index, std::move(cue_event)));
    245  }
    246 
    248  Status FlushDownstream(size_t output_stream_index);
    249 
    251  Status FlushAllDownstreams();
    252 
    253  bool initialized() { return initialized_; }
    254  size_t num_input_streams() const { return num_input_streams_; }
    255  size_t next_output_stream_index() const { return next_output_stream_index_; }
    256  const std::map<size_t, std::pair<std::shared_ptr<MediaHandler>, size_t>>&
    257  output_handlers() {
    258  return output_handlers_;
    259  }
    260 
    261  private:
    262  MediaHandler(const MediaHandler&) = delete;
    263  MediaHandler& operator=(const MediaHandler&) = delete;
    264 
    265  bool initialized_ = false;
    266  // Number of input streams.
    267  size_t num_input_streams_ = 0;
    268  // The next available output stream index, used by AddHandler.
    269  size_t next_output_stream_index_ = 0;
    270  // output stream index -> {output handler, output handler input stream index}
    271  // map.
    272  std::map<size_t, std::pair<std::shared_ptr<MediaHandler>, size_t>>
    273  output_handlers_;
    274 };
    275 
    276 } // namespace media
    277 } // namespace shaka
    278 
    279 #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.
    + +
    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 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 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 7ecd97c8d4..ac85c35ffc 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 1773666ba1..b22ca5a2e5 100644 --- a/docs/d3/d9a/classshaka_1_1media_1_1MediaHandlerGraphTestBase.html +++ b/docs/d3/d9a/classshaka_1_1media_1_1MediaHandlerGraphTestBase.html @@ -126,9 +126,9 @@ std::shared_ptr< std::unique_ptr< SegmentInfoGetSegmentInfo (int64_t start_timestamp, int64_t duration, bool is_subsegment) const   - -std::unique_ptr< StreamInfoGetTextStreamInfo () const -  + +std::unique_ptr< StreamInfoGetTextStreamInfo (uint32_t timescale) const +  std::unique_ptr< TextSampleGetTextSample (const std::string &id, int64_t start, int64_t end, const std::string &payload) const   @@ -147,7 +147,7 @@ std::unique_ptr<

    Detailed Description

    -

    Definition at line 266 of file media_handler_test_base.h.

    +

    Definition at line 363 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 311 of file media_handler_test_base.cc.

    +

    Definition at line 367 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 287 of file media_handler_test_base.h.

    +

    Definition at line 384 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 284 of file media_handler_test_base.h.

    +

    Definition at line 381 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 4844b4ea65..2dfdee36bc 100644 --- a/docs/d3/d9c/encryption__handler_8cc_source.html +++ b/docs/d3/d9c/encryption__handler_8cc_source.html @@ -67,7 +67,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/media/crypto/encryption_handler.h"
    8 
    9 #include <stddef.h>
    10 #include <stdint.h>
    11 
    12 #include <algorithm>
    13 #include <limits>
    14 
    15 #include "packager/media/base/aes_encryptor.h"
    16 #include "packager/media/base/aes_pattern_cryptor.h"
    17 #include "packager/media/base/audio_stream_info.h"
    18 #include "packager/media/base/key_source.h"
    19 #include "packager/media/base/media_sample.h"
    20 #include "packager/media/base/video_stream_info.h"
    21 #include "packager/media/codecs/video_slice_header_parser.h"
    22 #include "packager/media/codecs/vp8_parser.h"
    23 #include "packager/media/codecs/vp9_parser.h"
    24 #include "packager/media/crypto/sample_aes_ec3_cryptor.h"
    25 
    26 namespace shaka {
    27 namespace media {
    28 
    29 namespace {
    30 const size_t kCencBlockSize = 16u;
    31 
    32 // The encryption handler only supports a single output.
    33 const size_t kStreamIndex = 0;
    34 
    35 // The default KID for key rotation is all 0s.
    36 const uint8_t kKeyRotationDefaultKeyId[] = {
    37  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    38 };
    39 
    40 // Adds one or more subsamples to |*decrypt_config|. This may add more than one
    41 // if one of the values overflows the integer in the subsample.
    42 void AddSubsample(uint64_t clear_bytes,
    43  uint64_t cipher_bytes,
    44  DecryptConfig* decrypt_config) {
    45  CHECK_LT(cipher_bytes, std::numeric_limits<uint32_t>::max());
    46  const uint64_t kUInt16Max = std::numeric_limits<uint16_t>::max();
    47  while (clear_bytes > kUInt16Max) {
    48  decrypt_config->AddSubsample(kUInt16Max, 0);
    49  clear_bytes -= kUInt16Max;
    50  }
    51 
    52  if (clear_bytes > 0 || cipher_bytes > 0)
    53  decrypt_config->AddSubsample(clear_bytes, cipher_bytes);
    54 }
    55 
    56 uint8_t GetNaluLengthSize(const StreamInfo& stream_info) {
    57  if (stream_info.stream_type() != kStreamVideo)
    58  return 0;
    59 
    60  const VideoStreamInfo& video_stream_info =
    61  static_cast<const VideoStreamInfo&>(stream_info);
    62  return video_stream_info.nalu_length_size();
    63 }
    64 
    65 std::string GetStreamLabelForEncryption(
    66  const StreamInfo& stream_info,
    67  const std::function<std::string(
    68  const EncryptionParams::EncryptedStreamAttributes& stream_attributes)>&
    69  stream_label_func) {
    70  EncryptionParams::EncryptedStreamAttributes stream_attributes;
    71  if (stream_info.stream_type() == kStreamAudio) {
    72  stream_attributes.stream_type =
    73  EncryptionParams::EncryptedStreamAttributes::kAudio;
    74  } else if (stream_info.stream_type() == kStreamVideo) {
    75  const VideoStreamInfo& video_stream_info =
    76  static_cast<const VideoStreamInfo&>(stream_info);
    77  stream_attributes.stream_type =
    78  EncryptionParams::EncryptedStreamAttributes::kVideo;
    79  stream_attributes.oneof.video.width = video_stream_info.width();
    80  stream_attributes.oneof.video.height = video_stream_info.height();
    81  }
    82  return stream_label_func(stream_attributes);
    83 }
    84 } // namespace
    85 
    86 EncryptionHandler::EncryptionHandler(const EncryptionParams& encryption_params,
    87  KeySource* key_source)
    88  : encryption_params_(encryption_params),
    89  protection_scheme_(
    90  static_cast<FourCC>(encryption_params.protection_scheme)),
    91  key_source_(key_source) {}
    92 
    93 EncryptionHandler::~EncryptionHandler() {}
    94 
    96  if (!encryption_params_.stream_label_func) {
    97  return Status(error::INVALID_ARGUMENT, "Stream label function not set.");
    98  }
    99  if (num_input_streams() != 1 || next_output_stream_index() != 1) {
    100  return Status(error::INVALID_ARGUMENT,
    101  "Expects exactly one input and output.");
    102  }
    103  return Status::OK;
    104 }
    105 
    106 Status EncryptionHandler::Process(std::unique_ptr<StreamData> stream_data) {
    107  switch (stream_data->stream_data_type) {
    108  case StreamDataType::kStreamInfo:
    109  return ProcessStreamInfo(*stream_data->stream_info);
    110  case StreamDataType::kSegmentInfo: {
    111  std::shared_ptr<SegmentInfo> segment_info(new SegmentInfo(
    112  *stream_data->segment_info));
    113 
    114  segment_info->is_encrypted = remaining_clear_lead_ <= 0;
    115 
    116  const bool key_rotation_enabled = crypto_period_duration_ != 0;
    117  if (key_rotation_enabled)
    118  segment_info->key_rotation_encryption_config = encryption_config_;
    119  if (!segment_info->is_subsegment) {
    120  if (key_rotation_enabled)
    121  check_new_crypto_period_ = true;
    122  if (remaining_clear_lead_ > 0)
    123  remaining_clear_lead_ -= segment_info->duration;
    124  }
    125 
    126  return DispatchSegmentInfo(kStreamIndex, segment_info);
    127  }
    128  case StreamDataType::kMediaSample:
    129  return ProcessMediaSample(std::move(stream_data->media_sample));
    130  default:
    131  VLOG(3) << "Stream data type "
    132  << static_cast<int>(stream_data->stream_data_type) << " ignored.";
    133  return Dispatch(std::move(stream_data));
    134  }
    135 }
    136 
    137 Status EncryptionHandler::ProcessStreamInfo(const StreamInfo& clear_info) {
    138  if (clear_info.is_encrypted()) {
    139  return Status(error::INVALID_ARGUMENT,
    140  "Input stream is already encrypted.");
    141  }
    142 
    143  DCHECK_NE(kStreamUnknown, clear_info.stream_type());
    144  DCHECK_NE(kStreamText, clear_info.stream_type());
    145  std::shared_ptr<StreamInfo> stream_info = clear_info.Clone();
    146 
    147  remaining_clear_lead_ =
    148  encryption_params_.clear_lead_in_seconds * stream_info->time_scale();
    149  crypto_period_duration_ =
    150  encryption_params_.crypto_period_duration_in_seconds *
    151  stream_info->time_scale();
    152  codec_ = stream_info->codec();
    153  nalu_length_size_ = GetNaluLengthSize(*stream_info);
    154  stream_label_ = GetStreamLabelForEncryption(
    155  *stream_info, encryption_params_.stream_label_func);
    156  switch (codec_) {
    157  case kCodecVP9:
    158  if (encryption_params_.vp9_subsample_encryption)
    159  vpx_parser_.reset(new VP9Parser);
    160  break;
    161  case kCodecH264:
    162  header_parser_.reset(new H264VideoSliceHeaderParser);
    163  break;
    164  case kCodecH265:
    165  header_parser_.reset(new H265VideoSliceHeaderParser);
    166  break;
    167  default:
    168  // Other codecs should have nalu length size == 0.
    169  if (nalu_length_size_ > 0) {
    170  LOG(WARNING) << "Unknown video codec '" << codec_ << "'";
    171  return Status(error::ENCRYPTION_FAILURE, "Unknown video codec.");
    172  }
    173  }
    174  if (header_parser_) {
    175  CHECK_NE(nalu_length_size_, 0u) << "AnnexB stream is not supported yet";
    176  if (!header_parser_->Initialize(stream_info->codec_config())) {
    177  return Status(error::ENCRYPTION_FAILURE,
    178  "Fail to read SPS and PPS data.");
    179  }
    180  }
    181 
    182  Status status = SetupProtectionPattern(stream_info->stream_type());
    183  if (!status.ok())
    184  return status;
    185 
    186  EncryptionKey encryption_key;
    187  const bool key_rotation_enabled = crypto_period_duration_ != 0;
    188  if (key_rotation_enabled) {
    189  check_new_crypto_period_ = true;
    190  // Setup dummy key id and key to signal encryption for key rotation.
    191  encryption_key.key_id.assign(
    192  kKeyRotationDefaultKeyId,
    193  kKeyRotationDefaultKeyId + sizeof(kKeyRotationDefaultKeyId));
    194  // The key is not really used to encrypt any data. It is there just for
    195  // convenience.
    196  encryption_key.key = encryption_key.key_id;
    197  } else {
    198  status = key_source_->GetKey(stream_label_, &encryption_key);
    199  if (!status.ok())
    200  return status;
    201  }
    202  if (!CreateEncryptor(encryption_key))
    203  return Status(error::ENCRYPTION_FAILURE, "Failed to create encryptor");
    204 
    205  stream_info->set_is_encrypted(true);
    206  stream_info->set_has_clear_lead(encryption_params_.clear_lead_in_seconds > 0);
    207  stream_info->set_encryption_config(*encryption_config_);
    208 
    209  return DispatchStreamInfo(kStreamIndex, stream_info);
    210 }
    211 
    212 Status EncryptionHandler::ProcessMediaSample(
    213  std::shared_ptr<const MediaSample> clear_sample) {
    214  DCHECK(clear_sample);
    215 
    216  // We need to parse the frame (which also updates the vpx parser) even if the
    217  // frame is not encrypted as the next (encrypted) frame may be dependent on
    218  // this clear frame.
    219  std::vector<VPxFrameInfo> vpx_frames;
    220  if (vpx_parser_ && !vpx_parser_->Parse(clear_sample->data(),
    221  clear_sample->data_size(),
    222  &vpx_frames)) {
    223  return Status(error::ENCRYPTION_FAILURE, "Failed to parse vpx frame.");
    224  }
    225 
    226  // Need to setup the encryptor for new segments even if this segment does not
    227  // need to be encrypted, so we can signal encryption metadata earlier to
    228  // allows clients to prefetch the keys.
    229  if (check_new_crypto_period_) {
    230  const int64_t current_crypto_period_index =
    231  clear_sample->dts() / crypto_period_duration_;
    232  if (current_crypto_period_index != prev_crypto_period_index_) {
    233  EncryptionKey encryption_key;
    234  Status status = key_source_->GetCryptoPeriodKey(
    235  current_crypto_period_index, stream_label_, &encryption_key);
    236  if (!status.ok())
    237  return status;
    238  if (!CreateEncryptor(encryption_key))
    239  return Status(error::ENCRYPTION_FAILURE, "Failed to create encryptor");
    240  prev_crypto_period_index_ = current_crypto_period_index;
    241  }
    242  check_new_crypto_period_ = false;
    243  }
    244 
    245  // Since there is no encryption needed right now, send the clear copy
    246  // downstream so we can save the costs of copying it.
    247  if (remaining_clear_lead_ > 0) {
    248  return DispatchMediaSample(kStreamIndex, std::move(clear_sample));
    249  }
    250 
    251  std::unique_ptr<DecryptConfig> decrypt_config(new DecryptConfig(
    252  encryption_config_->key_id,
    253  encryptor_->iv(),
    254  std::vector<SubsampleEntry>(),
    255  protection_scheme_,
    256  crypt_byte_block_,
    257  skip_byte_block_));
    258 
    259  // Now that we know that this sample must be encrypted, make a copy of
    260  // the sample first so that all the encryption operations can be done
    261  // in-place.
    262  std::shared_ptr<MediaSample> cipher_sample(clear_sample->Clone());
    263  // |cipher_sample| above still contains the old clear sample data. We will
    264  // use |cipher_sample_data| to hold cipher sample data then transfer it to
    265  // |cipher_sample| after encryption.
    266  std::shared_ptr<uint8_t> cipher_sample_data(
    267  new uint8_t[clear_sample->data_size()], std::default_delete<uint8_t[]>());
    268 
    269  if (vpx_parser_) {
    270  if (!EncryptVpxFrame(vpx_frames, clear_sample->data(),
    271  clear_sample->data_size(),
    272  &cipher_sample_data.get()[0], decrypt_config.get())) {
    273  return Status(error::ENCRYPTION_FAILURE, "Failed to encrypt VPX frame.");
    274  }
    275  DCHECK_EQ(decrypt_config->GetTotalSizeOfSubsamples(),
    276  clear_sample->data_size());
    277  } else if (header_parser_) {
    278  if (!EncryptNalFrame(clear_sample->data(), clear_sample->data_size(),
    279  &cipher_sample_data.get()[0], decrypt_config.get())) {
    280  return Status(error::ENCRYPTION_FAILURE, "Failed to encrypt NAL frame.");
    281  }
    282  DCHECK_EQ(decrypt_config->GetTotalSizeOfSubsamples(),
    283  clear_sample->data_size());
    284  } else {
    285  memcpy(&cipher_sample_data.get()[0], clear_sample->data(),
    286  std::min(clear_sample->data_size(), leading_clear_bytes_size_));
    287  if (clear_sample->data_size() > leading_clear_bytes_size_) {
    288  // The residual block is left unecrypted (copied without encryption). No
    289  // need to do special handling here.
    290  EncryptBytes(clear_sample->data() + leading_clear_bytes_size_,
    291  clear_sample->data_size() - leading_clear_bytes_size_,
    292  &cipher_sample_data.get()[leading_clear_bytes_size_]);
    293  }
    294  }
    295 
    296  cipher_sample->TransferData(std::move(cipher_sample_data),
    297  clear_sample->data_size());
    298  // Finish initializing the sample before sending it downstream. We must
    299  // wait until now to finish the initialization as we will lose access to
    300  // |decrypt_config| once we set it.
    301  cipher_sample->set_is_encrypted(true);
    302  cipher_sample->set_decrypt_config(std::move(decrypt_config));
    303 
    304  encryptor_->UpdateIv();
    305 
    306  return DispatchMediaSample(kStreamIndex, std::move(cipher_sample));
    307 }
    308 
    309 Status EncryptionHandler::SetupProtectionPattern(StreamType stream_type) {
    310  switch (protection_scheme_) {
    311  case kAppleSampleAesProtectionScheme: {
    312  const size_t kH264LeadingClearBytesSize = 32u;
    313  const size_t kSmallNalUnitSize = 32u + 16u;
    314  const size_t kAudioLeadingClearBytesSize = 16u;
    315  switch (codec_) {
    316  case kCodecH264:
    317  // Apple Sample AES uses 1:9 pattern for video.
    318  crypt_byte_block_ = 1u;
    319  skip_byte_block_ = 9u;
    320  leading_clear_bytes_size_ = kH264LeadingClearBytesSize;
    321  min_protected_data_size_ = kSmallNalUnitSize + 1u;
    322  break;
    323  case kCodecAAC:
    324  FALLTHROUGH_INTENDED;
    325  case kCodecAC3:
    326  FALLTHROUGH_INTENDED;
    327  case kCodecEAC3:
    328  // Audio is whole sample encrypted. We could not use a
    329  // crypto_byte_block_ of 1 here as if there is one crypto block
    330  // remaining, it need not be encrypted for video but it needs to be
    331  // encrypted for audio.
    332  crypt_byte_block_ = 0u;
    333  skip_byte_block_ = 0u;
    334  // E-AC3 encryption is handled by SampleAesEc3Cryptor, which also
    335  // manages leading clear bytes.
    336  leading_clear_bytes_size_ =
    337  codec_ == kCodecEAC3 ? 0 : kAudioLeadingClearBytesSize;
    338  min_protected_data_size_ = leading_clear_bytes_size_ + 15u;
    339  break;
    340  default:
    341  return Status(
    342  error::ENCRYPTION_FAILURE,
    343  "Only AAC/AC3/EAC3 and H264 are supported in Sample AES.");
    344  }
    345  break;
    346  }
    347  case FOURCC_cbcs:
    348  FALLTHROUGH_INTENDED;
    349  case FOURCC_cens:
    350  if (stream_type == kStreamVideo) {
    351  // Use 1:9 pattern for video.
    352  crypt_byte_block_ = 1u;
    353  skip_byte_block_ = 9u;
    354  } else {
    355  // Tracks other than video are protected using whole-block full-sample
    356  // encryption, which is essentially a pattern of 1:0. Note that this may
    357  // not be the same as the non-pattern based encryption counterparts,
    358  // e.g. in 'cens' for full sample encryption, the whole sample is
    359  // encrypted up to the last 16-byte boundary, see 23001-7:2016(E) 9.7;
    360  // while in 'cenc' for full sample encryption, the last partial 16-byte
    361  // block is also encrypted, see 23001-7:2016(E) 9.4.2. Another
    362  // difference is the use of constant iv.
    363  crypt_byte_block_ = 1u;
    364  skip_byte_block_ = 0u;
    365  }
    366  break;
    367  default:
    368  // Not using pattern encryption.
    369  crypt_byte_block_ = 0u;
    370  skip_byte_block_ = 0u;
    371  break;
    372  }
    373  return Status::OK;
    374 }
    375 
    376 bool EncryptionHandler::CreateEncryptor(const EncryptionKey& encryption_key) {
    377  std::unique_ptr<AesCryptor> encryptor;
    378  switch (protection_scheme_) {
    379  case FOURCC_cenc:
    380  encryptor.reset(new AesCtrEncryptor);
    381  break;
    382  case FOURCC_cbc1:
    383  encryptor.reset(new AesCbcEncryptor(kNoPadding));
    384  break;
    385  case FOURCC_cens:
    386  encryptor.reset(new AesPatternCryptor(
    387  crypt_byte_block_, skip_byte_block_,
    389  AesCryptor::kDontUseConstantIv,
    390  std::unique_ptr<AesCryptor>(new AesCtrEncryptor())));
    391  break;
    392  case FOURCC_cbcs:
    393  encryptor.reset(new AesPatternCryptor(
    394  crypt_byte_block_, skip_byte_block_,
    396  AesCryptor::kUseConstantIv,
    397  std::unique_ptr<AesCryptor>(new AesCbcEncryptor(kNoPadding))));
    398  break;
    399  case kAppleSampleAesProtectionScheme:
    400  if (crypt_byte_block_ == 0 && skip_byte_block_ == 0) {
    401  if (codec_ == kCodecEAC3) {
    402  encryptor.reset(new SampleAesEc3Cryptor(
    403  std::unique_ptr<AesCryptor>(new AesCbcEncryptor(kNoPadding))));
    404  } else {
    405  encryptor.reset(
    406  new AesCbcEncryptor(kNoPadding, AesCryptor::kUseConstantIv));
    407  }
    408  } else {
    409  encryptor.reset(new AesPatternCryptor(
    410  crypt_byte_block_, skip_byte_block_,
    412  AesCryptor::kUseConstantIv,
    413  std::unique_ptr<AesCryptor>(new AesCbcEncryptor(kNoPadding))));
    414  }
    415  break;
    416  default:
    417  LOG(ERROR) << "Unsupported protection scheme.";
    418  return false;
    419  }
    420 
    421  std::vector<uint8_t> iv = encryption_key.iv;
    422  if (iv.empty()) {
    423  if (!AesCryptor::GenerateRandomIv(protection_scheme_, &iv)) {
    424  LOG(ERROR) << "Failed to generate random iv.";
    425  return false;
    426  }
    427  }
    428  const bool initialized =
    429  encryptor->InitializeWithIv(encryption_key.key, iv);
    430  encryptor_ = std::move(encryptor);
    431 
    432  encryption_config_.reset(new EncryptionConfig);
    433  encryption_config_->protection_scheme = protection_scheme_;
    434  encryption_config_->crypt_byte_block = crypt_byte_block_;
    435  encryption_config_->skip_byte_block = skip_byte_block_;
    436  if (encryptor_->use_constant_iv()) {
    437  encryption_config_->per_sample_iv_size = 0;
    438  encryption_config_->constant_iv = iv;
    439  } else {
    440  encryption_config_->per_sample_iv_size = static_cast<uint8_t>(iv.size());
    441  }
    442  encryption_config_->key_id = encryption_key.key_id;
    443  encryption_config_->key_system_info = encryption_key.key_system_info;
    444  return initialized;
    445 }
    446 
    447 bool EncryptionHandler::EncryptVpxFrame(
    448  const std::vector<VPxFrameInfo>& vpx_frames,
    449  const uint8_t* source,
    450  size_t source_size,
    451  uint8_t* dest,
    452  DecryptConfig* decrypt_config) {
    453  const uint8_t* data = source;
    454  for (const VPxFrameInfo& frame : vpx_frames) {
    455  uint16_t clear_bytes =
    456  static_cast<uint16_t>(frame.uncompressed_header_size);
    457  uint32_t cipher_bytes = static_cast<uint32_t>(
    458  frame.frame_size - frame.uncompressed_header_size);
    459 
    460  // "VP Codec ISO Media File Format Binding" document requires that the
    461  // encrypted bytes of each frame within the superframe must be block
    462  // aligned so that the counter state can be computed for each frame
    463  // within the superframe.
    464  // ISO/IEC 23001-7:2016 10.2 'cbc1' 10.3 'cens'
    465  // The BytesOfProtectedData size SHALL be a multiple of 16 bytes to
    466  // avoid partial blocks in Subsamples.
    467  // For consistency, apply block alignment to all frames.
    468  const uint16_t misalign_bytes = cipher_bytes % kCencBlockSize;
    469  clear_bytes += misalign_bytes;
    470  cipher_bytes -= misalign_bytes;
    471 
    472  decrypt_config->AddSubsample(clear_bytes, cipher_bytes);
    473  memcpy(dest, data, clear_bytes);
    474  if (cipher_bytes > 0)
    475  EncryptBytes(data + clear_bytes, cipher_bytes, dest + clear_bytes);
    476  data += frame.frame_size;
    477  dest += frame.frame_size;
    478  }
    479  // Add subsample for the superframe index if exists.
    480  const bool is_superframe = vpx_frames.size() > 1;
    481  if (is_superframe) {
    482  size_t index_size = source + source_size - data;
    483  DCHECK_LE(index_size, 2 + vpx_frames.size() * 4);
    484  DCHECK_GE(index_size, 2 + vpx_frames.size() * 1);
    485  uint16_t clear_bytes = static_cast<uint16_t>(index_size);
    486  uint32_t cipher_bytes = 0;
    487  decrypt_config->AddSubsample(clear_bytes, cipher_bytes);
    488  memcpy(dest, data, clear_bytes);
    489  }
    490  return true;
    491 }
    492 
    493 bool EncryptionHandler::EncryptNalFrame(const uint8_t* source,
    494  size_t source_size,
    495  uint8_t* dest,
    496  DecryptConfig* decrypt_config) {
    497  DCHECK_NE(nalu_length_size_, 0u);
    498  DCHECK(header_parser_);
    499  const Nalu::CodecType nalu_type =
    500  (codec_ == kCodecH265) ? Nalu::kH265 : Nalu::kH264;
    501  NaluReader reader(nalu_type, nalu_length_size_, source, source_size);
    502 
    503  // Store the current length of clear data. This is used to squash
    504  // multiple unencrypted NAL units into fewer subsample entries.
    505  uint64_t accumulated_clear_bytes = 0;
    506 
    507  Nalu nalu;
    508  NaluReader::Result result;
    509  while ((result = reader.Advance(&nalu)) == NaluReader::kOk) {
    510  const uint64_t nalu_total_size = nalu.header_size() + nalu.payload_size();
    511  if (nalu.is_video_slice() && nalu_total_size >= min_protected_data_size_) {
    512  uint64_t current_clear_bytes = leading_clear_bytes_size_;
    513  if (current_clear_bytes == 0) {
    514  // For video-slice NAL units, encrypt the video slice. This skips
    515  // the frame header.
    516  const int64_t video_slice_header_size =
    517  header_parser_->GetHeaderSize(nalu);
    518  if (video_slice_header_size < 0) {
    519  LOG(ERROR) << "Failed to read slice header.";
    520  return false;
    521  }
    522  current_clear_bytes = nalu.header_size() + video_slice_header_size;
    523  }
    524  uint64_t cipher_bytes = nalu_total_size - current_clear_bytes;
    525 
    526  // ISO/IEC 23001-7:2016 10.2 'cbc1' 10.3 'cens'
    527  // The BytesOfProtectedData size SHALL be a multiple of 16 bytes to
    528  // avoid partial blocks in Subsamples.
    529  // CMAF requires 'cenc' scheme BytesOfProtectedData SHALL be a multiple
    530  // of 16 bytes; while 'cbcs' scheme BytesOfProtectedData SHALL start on
    531  // the first byte of video data following the slice header.
    532  if (protection_scheme_ == FOURCC_cbc1 ||
    533  protection_scheme_ == FOURCC_cens ||
    534  protection_scheme_ == FOURCC_cenc) {
    535  const uint16_t misalign_bytes = cipher_bytes % kCencBlockSize;
    536  current_clear_bytes += misalign_bytes;
    537  cipher_bytes -= misalign_bytes;
    538  }
    539 
    540  accumulated_clear_bytes += nalu_length_size_ + current_clear_bytes;
    541  AddSubsample(accumulated_clear_bytes, cipher_bytes, decrypt_config);
    542  memcpy(dest, source, accumulated_clear_bytes);
    543  source += accumulated_clear_bytes;
    544  dest += accumulated_clear_bytes;
    545  accumulated_clear_bytes = 0;
    546 
    547  DCHECK_EQ(nalu.data() + current_clear_bytes, source);
    548  EncryptBytes(source, cipher_bytes, dest);
    549  source += cipher_bytes;
    550  dest += cipher_bytes;
    551  } else {
    552  // For non-video-slice or small NAL units, don't encrypt.
    553  accumulated_clear_bytes += nalu_length_size_ + nalu_total_size;
    554  }
    555  }
    556  if (result != NaluReader::kEOStream) {
    557  LOG(ERROR) << "Failed to parse NAL units.";
    558  return false;
    559  }
    560  AddSubsample(accumulated_clear_bytes, 0, decrypt_config);
    561  memcpy(dest, source, accumulated_clear_bytes);
    562  return true;
    563 }
    564 
    565 void EncryptionHandler::EncryptBytes(const uint8_t* source,
    566  size_t source_size,
    567  uint8_t* dest) {
    568  DCHECK(source);
    569  DCHECK(dest);
    570  DCHECK(encryptor_);
    571  CHECK(encryptor_->Crypt(source, source_size, dest));
    572 }
    573 
    574 void EncryptionHandler::InjectVpxParserForTesting(
    575  std::unique_ptr<VPxParser> vpx_parser) {
    576  vpx_parser_ = std::move(vpx_parser);
    577 }
    578 
    579 void EncryptionHandler::InjectVideoSliceHeaderParserForTesting(
    580  std::unique_ptr<VideoSliceHeaderParser> header_parser) {
    581  header_parser_ = std::move(header_parser);
    582 }
    583 
    584 } // namespace media
    585 } // namespace shaka
    -
    Abstract class holds stream information.
    Definition: stream_info.h:59
    +
    Abstract class holds stream information.
    Definition: stream_info.h:61
    bool is_video_slice() const
    Slice data partition NALs are not considered as slice NALs.
    Definition: nalu_reader.h:117
    virtual std::unique_ptr< StreamInfo > Clone() const =0
    @@ -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 1d1418c385..4fcff2e26f 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 62ca6e4e83..7c155918b1 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 6cd41a1055..c579beb6a3 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 @@ -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 5bf23e715e..5fe2e9872f 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 5553427c00..e9eb2a8dcc 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 @@ -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 0623e30a0b..f5dcedf935 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 b89a551f9d..109685ccff 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() { 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 f7224899d8..2790ff78a5 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 @@ -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 ee6f53c708..d0f8d2cbcd 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 9f5d382d7f..d8485a9994 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 661f963249..dc6ad2a267 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 5d6c38ec22..d68271b737 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 @@ -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 64bf139800..f3b62d6cbc 100644 --- a/docs/d3/dc0/structshaka_1_1DecryptionParams-members.html +++ b/docs/d3/dc0/structshaka_1_1DecryptionParams-members.html @@ -75,7 +75,7 @@ $(function() { 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 43f70e5165..cf5d2c794c 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 7721cc8587..e7e77ff295 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 38a2de2672..b1f7fcc159 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 @@ -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 deleted file mode 100644 index 8e0fb1ca40..0000000000 --- a/docs/d3/dd7/ad__cue__generator_8h_source.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - -Shaka Packager SDK: packager/media/ad_cue_generator/ad_cue_generator.h Source File - - - - - - - - - -
    -
    - - - - - - -
    -
    Shaka Packager SDK -
    -
    -
    - - - - - - - - -
    -
    - - -
    - -
    - - -
    -
    -
    -
    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.
    -
    AdCueGenerator converts out of band cuepoint markers into SCTE-35 events.
    -
    - - - - diff --git a/docs/d3/dd7/id3__tag_8h_source.html b/docs/d3/dd7/id3__tag_8h_source.html index 1646a9f9bc..8da8510144 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 0cb7cad9f5..d0e6226d46 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 5102036175..14b8811b88 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 30fb4119ab..4a15508b58 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 6bf9a5d75c..1d1a8ccf74 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 601111863f..a2d7f2adfe 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 35a3ec7c20..813224a20b 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 81ff1fe9b8..cb2ec09f03 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 4250b073e6..d4734ca2a5 100644 --- a/docs/d3/deb/packed__audio__writer_8cc_source.html +++ b/docs/d3/deb/packed__audio__writer_8cc_source.html @@ -87,7 +87,7 @@ $(function() { diff --git a/docs/d3/df1/box__reader_8cc_source.html b/docs/d3/df1/box__reader_8cc_source.html index e6084d4405..1da7263226 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 ed8e742863..6f4aab776e 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 1ba882cc9a..d322bac6dd 100644 --- a/docs/d3/dfb/classshaka_1_1media_1_1CueAlignmentHandler-members.html +++ b/docs/d3/dfb/classshaka_1_1media_1_1CueAlignmentHandler-members.html @@ -70,31 +70,32 @@ $(function() {

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

    - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + +
    AddHandler(std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandlerinline
    CueAlignmentHandler(SyncPointQueue *sync_points) (defined in shaka::media::CueAlignmentHandler)shaka::media::CueAlignmentHandlerexplicit
    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
    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
    ~CueAlignmentHandler()=default (defined in shaka::media::CueAlignmentHandler)shaka::media::CueAlignmentHandler
    ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
    Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
    CueAlignmentHandler(SyncPointQueue *sync_points) (defined in shaka::media::CueAlignmentHandler)shaka::media::CueAlignmentHandlerexplicit
    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
    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
    ~CueAlignmentHandler()=default (defined in shaka::media::CueAlignmentHandler)shaka::media::CueAlignmentHandler
    ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
    diff --git a/docs/d3/dfe/classshaka_1_1media_1_1AesPatternCryptor.html b/docs/d3/dfe/classshaka_1_1media_1_1AesPatternCryptor.html index 69e1620b1f..328ce1192b 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 a1e206e2cd..6469cc79d9 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 20d4931458..f75ba687fd 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 ca551fb9b2..52983709de 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 14eeb9542b..f5fc29dbcd 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 9519fa0ec3..8ce36acb7d 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 ea9ffdf960..5921579955 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 @@ -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 f01e284773..63a4127f57 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 5dcd3b6d95..57d7220d57 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 c521933ef1..7ae8e69a09 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 23eb00c0ab..f767c9005b 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 fe933095a9..c86db7787c 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 @@ -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 54a1a9ab18..786ef6a31d 100644 --- a/docs/d4/d37/io__cache_8cc_source.html +++ b/docs/d4/d37/io__cache_8cc_source.html @@ -66,20 +66,20 @@ $(function() {
    io_cache.cc
    -
    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/file/io_cache.h"
    8 
    9 #include <string.h>
    10 
    11 #include <algorithm>
    12 
    13 #include "packager/base/logging.h"
    14 
    15 namespace shaka {
    16 
    17 using base::AutoLock;
    18 using base::AutoUnlock;
    19 
    20 IoCache::IoCache(uint64_t cache_size)
    21  : cache_size_(cache_size),
    22  read_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
    23  base::WaitableEvent::InitialState::NOT_SIGNALED),
    24  write_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
    25  base::WaitableEvent::InitialState::NOT_SIGNALED),
    26  // Make the buffer one byte larger than the cache so that when the
    27  // condition r_ptr == w_ptr is unambiguous (buffer empty).
    28  circular_buffer_(cache_size + 1),
    29  end_ptr_(&circular_buffer_[0] + cache_size + 1),
    30  r_ptr_(circular_buffer_.data()),
    31  w_ptr_(circular_buffer_.data()),
    32  closed_(false) {}
    33 
    34 IoCache::~IoCache() {
    35  Close();
    36 }
    37 
    38 uint64_t IoCache::Read(void* buffer, uint64_t size) {
    39  DCHECK(buffer);
    40 
    41  AutoLock lock(lock_);
    42  while (!closed_ && (BytesCachedInternal() == 0)) {
    43  AutoUnlock unlock(lock_);
    44  write_event_.Wait();
    45  }
    46 
    47  size = std::min(size, BytesCachedInternal());
    48  uint64_t first_chunk_size(
    49  std::min(size, static_cast<uint64_t>(end_ptr_ - r_ptr_)));
    50  memcpy(buffer, r_ptr_, first_chunk_size);
    51  r_ptr_ += first_chunk_size;
    52  DCHECK_GE(end_ptr_, r_ptr_);
    53  if (r_ptr_ == end_ptr_)
    54  r_ptr_ = &circular_buffer_[0];
    55  uint64_t second_chunk_size(size - first_chunk_size);
    56  if (second_chunk_size) {
    57  memcpy(static_cast<uint8_t*>(buffer) + first_chunk_size, r_ptr_,
    58  second_chunk_size);
    59  r_ptr_ += second_chunk_size;
    60  DCHECK_GT(end_ptr_, r_ptr_);
    61  }
    62  read_event_.Signal();
    63  return size;
    64 }
    65 
    66 uint64_t IoCache::Write(const void* buffer, uint64_t size) {
    67  DCHECK(buffer);
    68 
    69  const uint8_t* r_ptr(static_cast<const uint8_t*>(buffer));
    70  uint64_t bytes_left(size);
    71  while (bytes_left) {
    72  AutoLock lock(lock_);
    73  while (!closed_ && (BytesFreeInternal() == 0)) {
    74  AutoUnlock unlock(lock_);
    75  read_event_.Wait();
    76  }
    77  if (closed_)
    78  return 0;
    79 
    80  uint64_t write_size(std::min(bytes_left, BytesFreeInternal()));
    81  uint64_t first_chunk_size(
    82  std::min(write_size, static_cast<uint64_t>(end_ptr_ - w_ptr_)));
    83  memcpy(w_ptr_, r_ptr, first_chunk_size);
    84  w_ptr_ += first_chunk_size;
    85  DCHECK_GE(end_ptr_, w_ptr_);
    86  if (w_ptr_ == end_ptr_)
    87  w_ptr_ = &circular_buffer_[0];
    88  r_ptr += first_chunk_size;
    89  uint64_t second_chunk_size(write_size - first_chunk_size);
    90  if (second_chunk_size) {
    91  memcpy(w_ptr_, r_ptr, second_chunk_size);
    92  w_ptr_ += second_chunk_size;
    93  DCHECK_GT(end_ptr_, w_ptr_);
    94  r_ptr += second_chunk_size;
    95  }
    96  bytes_left -= write_size;
    97  write_event_.Signal();
    98  }
    99  return size;
    100 }
    101 
    103  AutoLock lock(lock_);
    104  r_ptr_ = w_ptr_ = circular_buffer_.data();
    105  // Let any writers know that there is room in the cache.
    106  read_event_.Signal();
    107 }
    108 
    110  AutoLock lock(lock_);
    111  closed_ = true;
    112  read_event_.Signal();
    113  write_event_.Signal();
    114 }
    115 
    117  AutoLock lock(lock_);
    118  CHECK(closed_);
    119  r_ptr_ = w_ptr_ = circular_buffer_.data();
    120  closed_ = false;
    121  read_event_.Reset();
    122  write_event_.Reset();
    123 }
    124 
    126  AutoLock lock(lock_);
    127  return BytesCachedInternal();
    128 }
    129 
    130 uint64_t IoCache::BytesFree() {
    131  AutoLock lock(lock_);
    132  return BytesFreeInternal();
    133 }
    134 
    135 uint64_t IoCache::BytesCachedInternal() {
    136  return (r_ptr_ <= w_ptr_)
    137  ? w_ptr_ - r_ptr_
    138  : (end_ptr_ - r_ptr_) + (w_ptr_ - circular_buffer_.data());
    139 }
    140 
    141 uint64_t IoCache::BytesFreeInternal() {
    142  return cache_size_ - BytesCachedInternal();
    143 }
    144 
    146  AutoLock lock(lock_);
    147  while (!closed_ && BytesCachedInternal()) {
    148  AutoUnlock unlock(lock_);
    149  read_event_.Wait();
    150  }
    151 }
    152 
    153 } // namespace shaka
    void Reopen()
    Reopens the cache. Any data still in the cache will be lost.
    Definition: io_cache.cc:116
    -
    void Clear()
    Empties the cache.
    Definition: io_cache.cc:102
    -
    void Close()
    Definition: io_cache.cc:109
    +
    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/file/io_cache.h"
    8 
    9 #include <string.h>
    10 
    11 #include <algorithm>
    12 
    13 #include "packager/base/logging.h"
    14 
    15 namespace shaka {
    16 
    17 using base::AutoLock;
    18 using base::AutoUnlock;
    19 
    20 IoCache::IoCache(uint64_t cache_size)
    21  : cache_size_(cache_size),
    22  read_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
    23  base::WaitableEvent::InitialState::NOT_SIGNALED),
    24  write_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
    25  base::WaitableEvent::InitialState::NOT_SIGNALED),
    26  // Make the buffer one byte larger than the cache so that when the
    27  // condition r_ptr == w_ptr is unambiguous (buffer empty).
    28  circular_buffer_(cache_size + 1),
    29  end_ptr_(&circular_buffer_[0] + cache_size + 1),
    30  r_ptr_(circular_buffer_.data()),
    31  w_ptr_(circular_buffer_.data()),
    32  closed_(false) {}
    33 
    34 IoCache::~IoCache() {
    35  Close();
    36 }
    37 
    38 uint64_t IoCache::Read(void* buffer, uint64_t size) {
    39  DCHECK(buffer);
    40 
    41  AutoLock lock(lock_);
    42  while (!closed_ && (BytesCachedInternal() == 0)) {
    43  AutoUnlock unlock(lock_);
    44  write_event_.Wait();
    45  }
    46 
    47  size = std::min(size, BytesCachedInternal());
    48  uint64_t first_chunk_size(
    49  std::min(size, static_cast<uint64_t>(end_ptr_ - r_ptr_)));
    50  memcpy(buffer, r_ptr_, first_chunk_size);
    51  r_ptr_ += first_chunk_size;
    52  DCHECK_GE(end_ptr_, r_ptr_);
    53  if (r_ptr_ == end_ptr_)
    54  r_ptr_ = &circular_buffer_[0];
    55  uint64_t second_chunk_size(size - first_chunk_size);
    56  if (second_chunk_size) {
    57  memcpy(static_cast<uint8_t*>(buffer) + first_chunk_size, r_ptr_,
    58  second_chunk_size);
    59  r_ptr_ += second_chunk_size;
    60  DCHECK_GT(end_ptr_, r_ptr_);
    61  }
    62  read_event_.Signal();
    63  return size;
    64 }
    65 
    66 uint64_t IoCache::Write(const void* buffer, uint64_t size) {
    67  DCHECK(buffer);
    68 
    69  const uint8_t* r_ptr(static_cast<const uint8_t*>(buffer));
    70  uint64_t bytes_left(size);
    71  while (bytes_left) {
    72  AutoLock lock(lock_);
    73  while (!closed_ && (BytesFreeInternal() == 0)) {
    74  AutoUnlock unlock(lock_);
    75  VLOG(1) << "Circular buffer is full, which can happen if data arrives "
    76  "faster than being consumed by packager. Ignore if it is not "
    77  "live packaging. Otherwise, try increasing --io_cache_size.";
    78  read_event_.Wait();
    79  }
    80  if (closed_)
    81  return 0;
    82 
    83  uint64_t write_size(std::min(bytes_left, BytesFreeInternal()));
    84  uint64_t first_chunk_size(
    85  std::min(write_size, static_cast<uint64_t>(end_ptr_ - w_ptr_)));
    86  memcpy(w_ptr_, r_ptr, first_chunk_size);
    87  w_ptr_ += first_chunk_size;
    88  DCHECK_GE(end_ptr_, w_ptr_);
    89  if (w_ptr_ == end_ptr_)
    90  w_ptr_ = &circular_buffer_[0];
    91  r_ptr += first_chunk_size;
    92  uint64_t second_chunk_size(write_size - first_chunk_size);
    93  if (second_chunk_size) {
    94  memcpy(w_ptr_, r_ptr, second_chunk_size);
    95  w_ptr_ += second_chunk_size;
    96  DCHECK_GT(end_ptr_, w_ptr_);
    97  r_ptr += second_chunk_size;
    98  }
    99  bytes_left -= write_size;
    100  write_event_.Signal();
    101  }
    102  return size;
    103 }
    104 
    106  AutoLock lock(lock_);
    107  r_ptr_ = w_ptr_ = circular_buffer_.data();
    108  // Let any writers know that there is room in the cache.
    109  read_event_.Signal();
    110 }
    111 
    113  AutoLock lock(lock_);
    114  closed_ = true;
    115  read_event_.Signal();
    116  write_event_.Signal();
    117 }
    118 
    120  AutoLock lock(lock_);
    121  CHECK(closed_);
    122  r_ptr_ = w_ptr_ = circular_buffer_.data();
    123  closed_ = false;
    124  read_event_.Reset();
    125  write_event_.Reset();
    126 }
    127 
    129  AutoLock lock(lock_);
    130  return BytesCachedInternal();
    131 }
    132 
    133 uint64_t IoCache::BytesFree() {
    134  AutoLock lock(lock_);
    135  return BytesFreeInternal();
    136 }
    137 
    138 uint64_t IoCache::BytesCachedInternal() {
    139  return (r_ptr_ <= w_ptr_)
    140  ? w_ptr_ - r_ptr_
    141  : (end_ptr_ - r_ptr_) + (w_ptr_ - circular_buffer_.data());
    142 }
    143 
    144 uint64_t IoCache::BytesFreeInternal() {
    145  return cache_size_ - BytesCachedInternal();
    146 }
    147 
    149  AutoLock lock(lock_);
    150  while (!closed_ && BytesCachedInternal()) {
    151  AutoUnlock unlock(lock_);
    152  read_event_.Wait();
    153  }
    154 }
    155 
    156 } // namespace shaka
    void Reopen()
    Reopens the cache. Any data still in the cache will be lost.
    Definition: io_cache.cc:119
    +
    void Clear()
    Empties the cache.
    Definition: io_cache.cc:105
    +
    void Close()
    Definition: io_cache.cc:112
    All the methods that are virtual are virtual for mocking.
    uint64_t Write(const void *buffer, uint64_t size)
    Definition: io_cache.cc:66
    -
    void WaitUntilEmptyOrClosed()
    Waits until the cache is empty or has been closed.
    Definition: io_cache.cc:145
    +
    void WaitUntilEmptyOrClosed()
    Waits until the cache is empty or has been closed.
    Definition: io_cache.cc:148
    uint64_t Read(void *buffer, uint64_t size)
    Definition: io_cache.cc:38
    -
    uint64_t BytesFree()
    Definition: io_cache.cc:130
    +
    uint64_t BytesFree()
    Definition: io_cache.cc:133
    -
    uint64_t BytesCached()
    Definition: io_cache.cc:125
    +
    uint64_t BytesCached()
    Definition: io_cache.cc:128
    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 12dbbbb3f2..0c77417f2e 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 37c02ff410..0967e38c44 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 4c0be4cda4..727d64a560 100644 --- a/docs/d4/d43/classshaka_1_1media_1_1ChunkingHandler.html +++ b/docs/d4/d43/classshaka_1_1media_1_1ChunkingHandler.html @@ -171,6 +171,13 @@ Friends class ChunkingHandlerTest   + + + + +

    +Additional Inherited Members

    - Static Public Member Functions inherited from shaka::media::MediaHandler
    +static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list)
     

    Detailed Description

    ChunkingHandler splits the samples into segments / subsegments based on the specified chunking params. This handler is a one-in one-out handler. There can be multiple chunking handler running in different threads or even different processes, we use the "consistent chunking algorithm" to make sure the chunks in different streams are aligned without explicit communcating with each other - which is not efficient and often difficult.

    @@ -250,7 +257,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 b759407dc6..8ce3ad1f99 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 1adb431201..f3d56c6e14 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 acd98f2da3..c20fba3ec8 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 3a4dfa3554..b5e867c5d0 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 1a0303c029..81bdfeb310 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 2fa91945c7..42596017a7 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 256cde946f..3b179efe17 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 f429e0a321..e1e1a1470b 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 330b1bd0e4..13c3920b62 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 e84d3708cd..9304a68015 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 aa3f0e5986..e4edcbd02c 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 897f53be89..73f9e6878e 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 @@ -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 2c8dfc9b03..3da18b769e 100644 --- a/docs/d4/d9b/classshaka_1_1media_1_1MediaHandlerTestBase.html +++ b/docs/d4/d9b/classshaka_1_1media_1_1MediaHandlerTestBase.html @@ -111,9 +111,9 @@ std::shared_ptr< std::unique_ptr< SegmentInfoGetSegmentInfo (int64_t start_timestamp, int64_t duration, bool is_subsegment) const   - -std::unique_ptr< StreamInfoGetTextStreamInfo () const -  + +std::unique_ptr< StreamInfoGetTextStreamInfo (uint32_t timescale) const +  std::unique_ptr< TextSampleGetTextSample (const std::string &id, int64_t start, int64_t end, const std::string &payload) const   @@ -132,7 +132,7 @@ std::unique_ptr<

    Detailed Description

    -

    Definition at line 194 of file media_handler_test_base.h.

    +

    Definition at line 291 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 c83156c58a..8cc5490445 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 1a1a083ff0..1e6ac6cf97 100644 --- a/docs/d4/da7/segmenter__test__base_8cc_source.html +++ b/docs/d4/da7/segmenter__test__base_8cc_source.html @@ -85,7 +85,7 @@ $(function() { 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 d51a9c52b2..22bc67521b 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 @@ -237,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 3f8b4c0a69..f5faecc8c5 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 3b3d43e4ea..90d7bc37fa 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 0b8dc27cdc..c3b3eb9c85 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 c4164c2f2d..d83a05c7bc 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 @@ -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 719d390cfd..bfaeadd8a1 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 e545223827..15d3c0f0cc 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 4b9e3e292f..c2e2e35e69 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 3c5e61f04e..57a34fbbe3 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 d890bd642a..684a2e807f 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 e9f7acef8c..a6831aeb43 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 @@ -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 29785f1fcc..c432533f18 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 af5bc9c2f6..f6e93af367 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 4d241ef4a2..88aba0d171 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 eb05ff7815..a9f65447c4 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 98e2d506c1..4020796403 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 @@ -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 42e8ecea74..aca74d63a5 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 @@ -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 3cfadc8f9f..1e0f17ce7c 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 eb1fc06dc1..499f0d3f8b 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 4363ab3340..7b94b386a7 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 @@ -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 674be7038b..f6078fa21a 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 @@ -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 3117fdf53e..75ef685d75 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 @@ -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 594b97d682..3462192c6e 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 9f8ad43068..7f3817c788 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 4373be5433..8b17ac8dfd 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 @@ -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 94a94020f0..b40fe30b40 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 2eb804e55d..725195ef91 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 bb7e0c0284..6f48271101 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 d50790b580..a2dcd0e4de 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 4445a573cf..887407c844 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 8b6fc76b0e..c1920f2d8b 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 5a9940c551..0a25345d20 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 5bd33b6c5d..dddaa7acb0 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 aa0b3e42c3..6b452bdadc 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 d9c5e6106f..bbebc0c034 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 e33b046dd4..5a46bd53a1 100644 --- a/docs/d5/d3e/classshaka_1_1media_1_1TextChunker.html +++ b/docs/d5/d3e/classshaka_1_1media_1_1TextChunker.html @@ -81,9 +81,9 @@ Inheritance diagram for shaka::media::TextChunker: - - + + @@ -102,6 +102,10 @@ bool  + + + @@ -156,7 +160,7 @@ const std::map< size_t, std::pair< std::shared_ptr<

      Detailed Description

      -

      Definition at line 17 of file text_chunker.h.

      +

      Definition at line 21 of file text_chunker.h.


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

      Public Member Functions

      TextChunker (int64_t segment_duration_ms)
       
      TextChunker (double segment_duration_in_seconds)
       
      - Public Member Functions inherited from shaka::media::MediaHandler
      Status SetHandler (size_t output_stream_index, std::shared_ptr< MediaHandler > handler)

      Additional Inherited Members

      - Static Public Member Functions inherited from shaka::media::MediaHandler
      +static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list)
       
      - Protected Member Functions inherited from shaka::media::MediaHandler
      virtual bool ValidateOutputStreamIndex (size_t stream_index) const
      diff --git a/docs/d5/d4b/packed__audio__writer_8h_source.html b/docs/d5/d4b/packed__audio__writer_8h_source.html index e87ed36943..e908386dd0 100644 --- a/docs/d5/d4b/packed__audio__writer_8h_source.html +++ b/docs/d5/d4b/packed__audio__writer_8h_source.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/d5/d4d/box_8cc_source.html b/docs/d5/d4d/box_8cc_source.html index 64fe24a772..7a86819d9d 100644 --- a/docs/d5/d4d/box_8cc_source.html +++ b/docs/d5/d4d/box_8cc_source.html @@ -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 fdb032494b..d601ab5992 100644 --- a/docs/d5/d51/packed__audio__segmenter_8cc_source.html +++ b/docs/d5/d51/packed__audio__segmenter_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_segmenter.h"
      8 
      9 #include <memory>
      10 
      11 #include "packager/media/base/id3_tag.h"
      12 #include "packager/media/base/media_sample.h"
      13 #include "packager/media/codecs/aac_audio_specific_config.h"
      14 #include "packager/media/codecs/hls_audio_util.h"
      15 #include "packager/status_macros.h"
      16 
      17 namespace shaka {
      18 namespace media {
      19 namespace {
      20 std::string TimestampToString(uint64_t timestamp) {
      21  BufferWriter buffer;
      22  buffer.AppendInt(timestamp);
      23  return std::string(buffer.Buffer(), buffer.Buffer() + buffer.Size());
      24 }
      25 } // namespace
      26 
      27 PackedAudioSegmenter::PackedAudioSegmenter() = default;
      28 PackedAudioSegmenter::~PackedAudioSegmenter() = default;
      29 
      31  const StreamType stream_type = stream_info.stream_type();
      32  if (stream_type != StreamType::kStreamAudio) {
      33  LOG(ERROR) << "PackedAudioSegmenter cannot handle stream type "
      34  << stream_type;
      35  return Status(error::MUXER_FAILURE, "Unsupported stream type.");
      36  }
      37 
      38  codec_ = stream_info.codec();
      39  audio_codec_config_ = stream_info.codec_config();
      40  timescale_scale_ = kPackedAudioTimescale / stream_info.time_scale();
      41 
      42  if (codec_ == kCodecAAC) {
      43  adts_converter_ = CreateAdtsConverter();
      44  if (!adts_converter_->Parse(audio_codec_config_)) {
      45  return Status(error::MUXER_FAILURE, "Invalid audio codec configuration.");
      46  }
      47  }
      48 
      49  return Status::OK;
      50 }
      51 
      53  if (sample.is_encrypted() && audio_setup_information_.empty())
      54  RETURN_IF_ERROR(EncryptionAudioSetup(sample));
      55 
      56  if (start_of_new_segment_) {
      57  StartNewSegment(sample);
      58  start_of_new_segment_ = false;
      59  }
      60 
      61  if (adts_converter_) {
      62  std::vector<uint8_t> audio_frame(sample.data(),
      63  sample.data() + sample.data_size());
      64  if (!adts_converter_->ConvertToADTS(&audio_frame))
      65  return Status(error::MUXER_FAILURE, "Failed to convert to ADTS.");
      66  segment_buffer_.AppendArray(audio_frame.data(), audio_frame.size());
      67  } else {
      68  segment_buffer_.AppendArray(sample.data(), sample.data_size());
      69  }
      70  return Status::OK;
      71 }
      72 
      74  start_of_new_segment_ = true;
      75  return Status::OK;
      76 }
      77 
      79  return timescale_scale_;
      80 }
      81 
      82 std::unique_ptr<AACAudioSpecificConfig>
      83 PackedAudioSegmenter::CreateAdtsConverter() {
      84  return std::unique_ptr<AACAudioSpecificConfig>(new AACAudioSpecificConfig);
      85 }
      86 
      87 std::unique_ptr<Id3Tag> PackedAudioSegmenter::CreateId3Tag() {
      88  return std::unique_ptr<Id3Tag>(new Id3Tag);
      89 }
      90 
      91 Status PackedAudioSegmenter::EncryptionAudioSetup(const MediaSample& sample) {
      92  // For codecs other than AC3, audio setup data is the audio codec
      93  // configuration data.
      94  const uint8_t* audio_setup_data = audio_codec_config_.data();
      95  size_t audio_setup_data_size = audio_codec_config_.size();
      96  if (codec_ == kCodecAC3) {
      97  // https://goo.gl/N7Tvqi MPEG-2 Stream Encryption Format for HTTP Live
      98  // Streaming 2.3.2.2 AC-3 Setup: For AC-3, the setup_data in the
      99  // audio_setup_information is the first 10 bytes of the audio data (the
      100  // syncframe()).
      101  const size_t kSetupDataSize = 10u;
      102  if (sample.data_size() < kSetupDataSize) {
      103  LOG(ERROR) << "Sample is too small for AC3: " << sample.data_size();
      104  return Status(error::MUXER_FAILURE, "Sample is too small for AC3.");
      105  }
      106  audio_setup_data = sample.data();
      107  audio_setup_data_size = kSetupDataSize;
      108  }
      109 
      110  BufferWriter buffer;
      111  if (!WriteAudioSetupInformation(codec_, audio_setup_data,
      112  audio_setup_data_size, &buffer)) {
      113  return Status(error::MUXER_FAILURE,
      114  "Failed to write audio setup information.");
      115  }
      116  audio_setup_information_.assign(buffer.Buffer(),
      117  buffer.Buffer() + buffer.Size());
      118  return Status::OK;
      119 }
      120 
      121 void PackedAudioSegmenter::StartNewSegment(const MediaSample& sample) {
      122  segment_buffer_.Clear();
      123 
      124  // Use a unique_ptr so it can be mocked for testing.
      125  std::unique_ptr<Id3Tag> id3_tag = CreateId3Tag();
      126  id3_tag->AddPrivateFrame(kTimestampOwnerIdentifier,
      127  TimestampToString(sample.pts() * timescale_scale_));
      128  if (!audio_setup_information_.empty()) {
      129  id3_tag->AddPrivateFrame(kAudioDescriptionOwnerIdentifier,
      130  audio_setup_information_);
      131  }
      132  CHECK(id3_tag->WriteToBuffer(&segment_buffer_));
      133 }
      134 
      135 } // namespace media
      136 } // namespace shaka
      -
      Abstract class holds stream information.
      Definition: stream_info.h:59
      +
      Abstract class holds stream information.
      Definition: stream_info.h:61
      const uint8_t * Buffer() const
      Definition: buffer_writer.h:61
      All the methods that are virtual are virtual for mocking.
      @@ -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 4485fa8a84..308578fba9 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 a15b76466e..52721f4ad3 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 6088d237de..1bbdb5596c 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 9a82a671ef..b8c1e16958 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 696420d072..8fe67c5dc8 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 087a6db842..4d91b9ef75 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 70904e19af..92e5109262 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 a782237308..8685cfe13b 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 14f79113bd..92d053b5f9 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 8f8605985c..955b338b7a 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 059c0f0c10..de50d22f7c 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 112a9660d9..972065cab6 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 74cac85249..f55622e2d0 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 cee028b909..3693c21a4a 100644 --- a/docs/d5/d76/classshaka_1_1hls_1_1HlsEntry.html +++ b/docs/d5/d76/classshaka_1_1hls_1_1HlsEntry.html @@ -98,7 +98,7 @@ Protected Member Functions

      Detailed Description

      -

      Definition at line 24 of file media_playlist.h.

      +

      Definition at line 25 of file media_playlist.h.


      The documentation for this class was generated from the following files:
      • packager/hls/base/media_playlist.h
      • packager/hls/base/media_playlist.cc
      • @@ -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 5c0fc00566..aa71908832 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 5f43fe5da9..ed045943e2 100644 --- a/docs/d5/d7b/box__definitions_8h_source.html +++ b/docs/d5/d7b/box__definitions_8h_source.html @@ -162,7 +162,7 @@ $(function() { 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 9aad2ef0b0..308a353ed5 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 @@ -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 ffd104f8cf..0a465b9216 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 68c372a957..d1be8eb54c 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 @@ -88,7 +88,7 @@ int64_t sample_offset< 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 49535fe67d..a109f87fc9 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 fad556cce8..52361ebdf5 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 bda75c050c..72e05ed677 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 ed4ddad3ef..c12e91e543 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 a2edf23bb1..6a3c65bcd3 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 df6268380f..b39bab1b50 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 9aaa76a605..a39c83b75a 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 edc6e12a58..7ff3c41700 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 cb7b85af0b..186a623ebf 100644 --- a/docs/d5/db1/classshaka_1_1media_1_1StreamInfo.html +++ b/docs/d5/db1/classshaka_1_1media_1_1StreamInfo.html @@ -158,7 +158,7 @@ void set_encryption_config

        Detailed Description

        Abstract class holds stream information.

        -

        Definition at line 59 of file stream_info.h.

        +

        Definition at line 61 of file stream_info.h.

        Member Function Documentation

        ◆ Clone()

        @@ -242,7 +242,7 @@ void set_encryption_config

        Reimplemented in shaka::media::VideoStreamInfo, and shaka::media::AudioStreamInfo.

        -

        Definition at line 37 of file stream_info.cc.

        +

        Definition at line 58 of file stream_info.cc.

        @@ -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 48e3ddd17b..9770ed7b89 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 ace2510f75..9650f06cb7 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 14bb221ac0..3f1558fb01 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 989cb69a2d..2f15dcf5f4 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 f219da0b27..24e6cb656e 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 @@ -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 389c281686..705d9dcf70 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 029d6f1b7c..1e108515c5 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 532a013374..4595663abb 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 index f05b82e450..fa5adb2bab 100644 --- a/docs/d5/ddb/webvtt__text__output__handler_8cc_source.html +++ b/docs/d5/ddb/webvtt__text__output__handler_8cc_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d5/de0/bit__reader_8cc_source.html b/docs/d5/de0/bit__reader_8cc_source.html index 098d7e6146..27c9b3a985 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 00f8c5d504..f85b571e16 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 e02e3910d8..c6dcd0ead0 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 cf82b42ac6..3c02d38625 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 cf84453d4d..1b31280c39 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 af54b2bd5b..9b69c8c531 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 f77be91dd1..8d22bf8df8 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 3c58dc96f9..11dd64064a 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 d41958e282..ea34238a19 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 d1866023b9..5655e4d628 100644 --- a/docs/d5/df2/media__playlist_8cc_source.html +++ b/docs/d5/df2/media__playlist_8cc_source.html @@ -66,35 +66,38 @@ $(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  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
        +
        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  bandwidth_estimator_(BandwidthEstimator::kUseAllBlocks) {}
        335 
        336 MediaPlaylist::~MediaPlaylist() {}
        337 
        339  MediaPlaylistStreamType stream_type) {
        340  stream_type_ = stream_type;
        341 }
        342 
        343 void MediaPlaylist::SetCodecForTesting(const std::string& codec) {
        344  codec_ = codec;
        345 }
        346 
        348  language_ = language;
        349 }
        350 
        351 bool MediaPlaylist::SetMediaInfo(const MediaInfo& media_info) {
        352  const uint32_t time_scale = GetTimeScale(media_info);
        353  if (time_scale == 0) {
        354  LOG(ERROR) << "MediaInfo does not contain a valid timescale.";
        355  return false;
        356  }
        357 
        358  if (media_info.has_video_info()) {
        359  stream_type_ = MediaPlaylistStreamType::kVideo;
        360  codec_ = media_info.video_info().codec();
        361  } else if (media_info.has_audio_info()) {
        362  stream_type_ = MediaPlaylistStreamType::kAudio;
        363  codec_ = media_info.audio_info().codec();
        364  } else {
        365  stream_type_ = MediaPlaylistStreamType::kSubtitle;
        366  codec_ = media_info.text_info().codec();
        367  }
        368 
        369  time_scale_ = time_scale;
        370  media_info_ = media_info;
        371  language_ = GetLanguage(media_info);
        372  use_byte_range_ = !media_info_.has_segment_template_url();
        373  return true;
        374 }
        375 
        376 void MediaPlaylist::AddSegment(const std::string& file_name,
        377  uint64_t start_time,
        378  uint64_t duration,
        379  uint64_t start_byte_offset,
        380  uint64_t size) {
        381  if (stream_type_ == MediaPlaylistStreamType::kVideoIFramesOnly) {
        382  if (key_frames_.empty())
        383  return;
        384 
        385  AdjustLastSegmentInfoEntryDuration(key_frames_.front().timestamp);
        386 
        387  for (auto iter = key_frames_.begin(); iter != key_frames_.end(); ++iter) {
        388  // Last entry duration may be adjusted later when the next iframe becomes
        389  // available.
        390  const uint64_t next_timestamp = std::next(iter) == key_frames_.end()
        391  ? (start_time + duration)
        392  : std::next(iter)->timestamp;
        393  AddSegmentInfoEntry(file_name, iter->timestamp,
        394  next_timestamp - iter->timestamp,
        395  iter->start_byte_offset, iter->size);
        396  }
        397  key_frames_.clear();
        398  return;
        399  }
        400  return AddSegmentInfoEntry(file_name, start_time, duration, start_byte_offset,
        401  size);
        402 }
        403 
        404 void MediaPlaylist::AddKeyFrame(uint64_t timestamp,
        405  uint64_t start_byte_offset,
        406  uint64_t size) {
        407  if (stream_type_ != MediaPlaylistStreamType::kVideoIFramesOnly) {
        408  if (stream_type_ != MediaPlaylistStreamType::kVideo) {
        409  LOG(WARNING)
        410  << "I-Frames Only playlist applies to video renditions only.";
        411  return;
        412  }
        413  stream_type_ = MediaPlaylistStreamType::kVideoIFramesOnly;
        414  use_byte_range_ = true;
        415  }
        416  key_frames_.push_back({timestamp, start_byte_offset, size});
        417 }
        418 
        419 void MediaPlaylist::AddEncryptionInfo(MediaPlaylist::EncryptionMethod method,
        420  const std::string& url,
        421  const std::string& key_id,
        422  const std::string& iv,
        423  const std::string& key_format,
        424  const std::string& key_format_versions) {
        425  if (!inserted_discontinuity_tag_) {
        426  // Insert discontinuity tag only for the first EXT-X-KEY, only if there
        427  // are non-encrypted media segments.
        428  if (!entries_.empty())
        429  entries_.emplace_back(new DiscontinuityEntry());
        430  inserted_discontinuity_tag_ = true;
        431  }
        432  entries_.emplace_back(new EncryptionInfoEntry(
        433  method, url, key_id, iv, key_format, key_format_versions));
        434 }
        435 
        437  entries_.emplace_back(new PlacementOpportunityEntry());
        438 }
        439 
        440 bool MediaPlaylist::WriteToFile(const std::string& file_path) {
        441  if (!target_duration_set_) {
        443  }
        444 
        445  std::string content = CreatePlaylistHeader(
        446  media_info_, target_duration_, hls_params_.playlist_type, stream_type_,
        447  media_sequence_number_, discontinuity_sequence_number_);
        448 
        449  for (const auto& entry : entries_)
        450  base::StringAppendF(&content, "%s\n", entry->ToString().c_str());
        451 
        452  if (hls_params_.playlist_type == HlsPlaylistType::kVod) {
        453  content += "#EXT-X-ENDLIST\n";
        454  }
        455 
        456  if (!File::WriteFileAtomically(file_path.c_str(), content)) {
        457  LOG(ERROR) << "Failed to write playlist to: " << file_path;
        458  return false;
        459  }
        460  return true;
        461 }
        462 
        463 uint64_t MediaPlaylist::Bitrate() const {
        464  if (media_info_.has_bandwidth())
        465  return media_info_.bandwidth();
        466  return bandwidth_estimator_.Max();
        467 }
        468 
        470  return longest_segment_duration_;
        471 }
        472 
        473 void MediaPlaylist::SetTargetDuration(uint32_t target_duration) {
        474  if (target_duration_set_) {
        475  if (target_duration_ == target_duration)
        476  return;
        477  VLOG(1) << "Updating target duration from " << target_duration << " to "
        478  << target_duration_;
        479  }
        480  target_duration_ = target_duration;
        481  target_duration_set_ = true;
        482 }
        483 
        485  return media_info_.audio_info().num_channels();
        486 }
        487 
        489  uint32_t* height) const {
        490  DCHECK(width);
        491  DCHECK(height);
        492  if (media_info_.has_video_info()) {
        493  const double pixel_aspect_ratio =
        494  media_info_.video_info().pixel_height() > 0
        495  ? static_cast<double>(media_info_.video_info().pixel_width()) /
        496  media_info_.video_info().pixel_height()
        497  : 1.0;
        498  *width = static_cast<uint32_t>(media_info_.video_info().width() *
        499  pixel_aspect_ratio);
        500  *height = media_info_.video_info().height();
        501  return true;
        502  }
        503  return false;
        504 }
        505 
        506 void MediaPlaylist::AddSegmentInfoEntry(const std::string& segment_file_name,
        507  uint64_t start_time,
        508  uint64_t duration,
        509  uint64_t start_byte_offset,
        510  uint64_t size) {
        511  if (time_scale_ == 0) {
        512  LOG(WARNING) << "Timescale is not set and the duration for " << duration
        513  << " cannot be calculated. The output will be wrong.";
        514 
        515  entries_.emplace_back(new SegmentInfoEntry(
        516  segment_file_name, 0.0, 0.0, use_byte_range_, start_byte_offset, size,
        517  previous_segment_end_offset_));
        518  return;
        519  }
        520 
        521  const double start_time_seconds =
        522  static_cast<double>(start_time) / time_scale_;
        523  const double segment_duration_seconds =
        524  static_cast<double>(duration) / time_scale_;
        525  longest_segment_duration_ =
        526  std::max(longest_segment_duration_, segment_duration_seconds);
        527  bandwidth_estimator_.AddBlock(size, segment_duration_seconds);
        528 
        529  entries_.emplace_back(new SegmentInfoEntry(
        530  segment_file_name, start_time_seconds, segment_duration_seconds,
        531  use_byte_range_, start_byte_offset, size, previous_segment_end_offset_));
        532  previous_segment_end_offset_ = start_byte_offset + size - 1;
        533  SlideWindow();
        534 }
        535 
        536 void MediaPlaylist::AdjustLastSegmentInfoEntryDuration(
        537  uint64_t next_timestamp) {
        538  if (time_scale_ == 0)
        539  return;
        540 
        541  const double next_timestamp_seconds =
        542  static_cast<double>(next_timestamp) / time_scale_;
        543 
        544  for (auto iter = entries_.rbegin(); iter != entries_.rend(); ++iter) {
        545  if (iter->get()->type() == HlsEntry::EntryType::kExtInf) {
        546  SegmentInfoEntry* segment_info =
        547  reinterpret_cast<SegmentInfoEntry*>(iter->get());
        548 
        549  const double segment_duration_seconds =
        550  next_timestamp_seconds - segment_info->start_time();
        551  segment_info->set_duration(segment_duration_seconds);
        552  longest_segment_duration_ =
        553  std::max(longest_segment_duration_, segment_duration_seconds);
        554  break;
        555  }
        556  }
        557 }
        558 
        559 void MediaPlaylist::SlideWindow() {
        560  DCHECK(!entries_.empty());
        561  if (hls_params_.time_shift_buffer_depth <= 0.0 ||
        562  hls_params_.playlist_type != HlsPlaylistType::kLive) {
        563  return;
        564  }
        565  DCHECK_GT(time_scale_, 0u);
        566 
        567  // The start time of the latest segment is considered the current_play_time,
        568  // and this should guarantee that the latest segment will stay in the list.
        569  const double current_play_time = LatestSegmentStartTime(entries_);
        570  if (current_play_time <= hls_params_.time_shift_buffer_depth)
        571  return;
        572 
        573  const double timeshift_limit =
        574  current_play_time - hls_params_.time_shift_buffer_depth;
        575 
        576  // Temporary list to hold the EXT-X-KEYs. For example, this allows us to
        577  // remove <3> without removing <1> and <2> below (<1> and <2> are moved to the
        578  // temporary list and added back later).
        579  // #EXT-X-KEY <1>
        580  // #EXT-X-KEY <2>
        581  // #EXTINF <3>
        582  // #EXTINF <4>
        583  std::list<std::unique_ptr<HlsEntry>> ext_x_keys;
        584  // Consecutive key entries are either fully removed or not removed at all.
        585  // Keep track of entry types so we know if it is consecutive key entries.
        586  HlsEntry::EntryType prev_entry_type = HlsEntry::EntryType::kExtInf;
        587 
        588  std::list<std::unique_ptr<HlsEntry>>::iterator last = entries_.begin();
        589  for (; last != entries_.end(); ++last) {
        590  HlsEntry::EntryType entry_type = last->get()->type();
        591  if (entry_type == HlsEntry::EntryType::kExtKey) {
        592  if (prev_entry_type != HlsEntry::EntryType::kExtKey)
        593  ext_x_keys.clear();
        594  ext_x_keys.push_back(std::move(*last));
        595  } else if (entry_type == HlsEntry::EntryType::kExtDiscontinuity) {
        596  ++discontinuity_sequence_number_;
        597  } else {
        598  DCHECK_EQ(entry_type, HlsEntry::EntryType::kExtInf);
        599  const SegmentInfoEntry& segment_info =
        600  *reinterpret_cast<SegmentInfoEntry*>(last->get());
        601  const double last_segment_end_time =
        602  segment_info.start_time() + segment_info.duration();
        603  if (timeshift_limit < last_segment_end_time)
        604  break;
        605  RemoveOldSegment(segment_info.start_time());
        606  media_sequence_number_++;
        607  }
        608  prev_entry_type = entry_type;
        609  }
        610  entries_.erase(entries_.begin(), last);
        611  // Add key entries back.
        612  entries_.insert(entries_.begin(), std::make_move_iterator(ext_x_keys.begin()),
        613  std::make_move_iterator(ext_x_keys.end()));
        614 }
        615 
        616 void MediaPlaylist::RemoveOldSegment(uint64_t start_time) {
        617  if (hls_params_.preserved_segments_outside_live_window == 0)
        618  return;
        619  if (stream_type_ == MediaPlaylistStreamType::kVideoIFramesOnly)
        620  return;
        621 
        622  segments_to_be_removed_.push_back(
        623  media::GetSegmentName(media_info_.segment_template(), start_time,
        624  media_sequence_number_, media_info_.bandwidth()));
        625  while (segments_to_be_removed_.size() >
        627  VLOG(2) << "Deleting " << segments_to_be_removed_.front();
        628  File::Delete(segments_to_be_removed_.front().c_str());
        629  segments_to_be_removed_.pop_front();
        630  }
        631 }
        632 
        633 } // namespace hls
        634 } // 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
        +
        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)
        +
        virtual bool SetMediaInfo(const MediaInfo &media_info)
        +
        virtual void AddKeyFrame(uint64_t timestamp, uint64_t start_byte_offset, uint64_t size)
        +
        void AddBlock(uint64_t size, double duration)
        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 f14e263d84..b170370981 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 23949a93c5..51ba08da6e 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 f0f3895616..26afd00d1a 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 e9cff3dbf9..424ad7fb7d 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 45a38b6cca..4e05e7da13 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 bd882053e8..a15ee4c9b5 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 befb7bbad0..8ecdea401f 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 4db9e5c686..e93b9a2167 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 7135dc5237..adc1f9e774 100644 --- a/docs/d6/d16/text__stream__info_8cc_source.html +++ b/docs/d6/d16/text__stream__info_8cc_source.html @@ -66,7 +66,7 @@ $(function() {
        text_stream_info.cc
        -
        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/base/text_stream_info.h"
        8 
        9 namespace shaka {
        10 namespace media {
        11 
        12 TextStreamInfo::TextStreamInfo(int track_id, uint32_t time_scale,
        13  uint64_t duration,
        14  Codec codec,
        15  const std::string& codec_string,
        16  const std::string& codec_config, uint16_t width,
        17  uint16_t height, const std::string& language)
        18  : StreamInfo(kStreamText, track_id, time_scale, duration, codec,
        19  codec_string,
        20  reinterpret_cast<const uint8_t*>(codec_config.data()),
        21  codec_config.size(), language, false),
        22  width_(width),
        23  height_(height) {}
        24 
        25 TextStreamInfo::~TextStreamInfo() {}
        26 
        28  return true;
        29 }
        30 
        31 std::unique_ptr<StreamInfo> TextStreamInfo::Clone() const {
        32  return std::unique_ptr<StreamInfo>(new TextStreamInfo(*this));
        33 }
        34 
        35 } // namespace media
        36 } // namespace shaka
        Abstract class holds stream information.
        Definition: stream_info.h:59
        +
        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/base/text_stream_info.h"
        8 
        9 namespace shaka {
        10 namespace media {
        11 
        12 TextStreamInfo::TextStreamInfo(int track_id, uint32_t time_scale,
        13  uint64_t duration,
        14  Codec codec,
        15  const std::string& codec_string,
        16  const std::string& codec_config, uint16_t width,
        17  uint16_t height, const std::string& language)
        18  : StreamInfo(kStreamText, track_id, time_scale, duration, codec,
        19  codec_string,
        20  reinterpret_cast<const uint8_t*>(codec_config.data()),
        21  codec_config.size(), language, false),
        22  width_(width),
        23  height_(height) {}
        24 
        25 TextStreamInfo::~TextStreamInfo() {}
        26 
        28  return true;
        29 }
        30 
        31 std::unique_ptr<StreamInfo> TextStreamInfo::Clone() const {
        32  return std::unique_ptr<StreamInfo>(new TextStreamInfo(*this));
        33 }
        34 
        35 } // namespace media
        36 } // namespace shaka
        Abstract class holds stream information.
        Definition: stream_info.h:61
        All the methods that are virtual are virtual for mocking.
        TextStreamInfo(int track_id, uint32_t time_scale, uint64_t duration, Codec codec, const std::string &codec_string, const std::string &codec_config, uint16_t width, uint16_t height, const std::string &language)
        bool IsValidConfig() const override
        @@ -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 03c6648d52..1490956cd5 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 f03b99fc62..da6eade966 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 @@ -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 c56f66a687..052c074899 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 f534d3a469..21e0e8a3f9 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 is_encrypted diff --git a/docs/d6/d2a/classshaka_1_1media_1_1WebVttTextOutputHandler.html b/docs/d6/d2a/classshaka_1_1media_1_1WebVttTextOutputHandler.html index 1af1435319..d162290292 100644 --- a/docs/d6/d2a/classshaka_1_1media_1_1WebVttTextOutputHandler.html +++ b/docs/d6/d2a/classshaka_1_1media_1_1WebVttTextOutputHandler.html @@ -102,6 +102,10 @@ bool 

        Additional Inherited Members

        +- Static Public Member Functions inherited from shaka::media::MediaHandler + +static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list) +  - Protected Member Functions inherited from shaka::media::MediaHandler virtual bool ValidateOutputStreamIndex (size_t stream_index) const @@ -164,7 +168,7 @@ const std::map< size_t, std::pair< std::shared_ptr< diff --git a/docs/d6/d2c/ts__stream__type_8h_source.html b/docs/d6/d2c/ts__stream__type_8h_source.html index eb23f3f6f7..5bc0198f27 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 aafb4f5162..e2eb96bb88 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 6c2ea5ba14..502fd028a6 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() { diff --git a/docs/d6/d35/webm__content__encodings_8cc_source.html b/docs/d6/d35/webm__content__encodings_8cc_source.html index cde7e1f39f..0ea5074366 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 f83fd3f43f..a174672507 100644 --- a/docs/d6/d37/combined__muxer__listener_8cc_source.html +++ b/docs/d6/d37/combined__muxer__listener_8cc_source.html @@ -66,7 +66,7 @@ $(function() {
        combined_muxer_listener.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/event/combined_muxer_listener.h"
        8 
        9 namespace shaka {
        10 namespace media {
        11 
        12 void CombinedMuxerListener::AddListener(
        13  std::unique_ptr<MuxerListener> listener) {
        14  muxer_listeners_.push_back(std::move(listener));
        15 }
        16 
        18  bool is_initial_encryption_info,
        19  FourCC protection_scheme,
        20  const std::vector<uint8_t>& key_id,
        21  const std::vector<uint8_t>& iv,
        22  const std::vector<ProtectionSystemSpecificInfo>& key_system_info) {
        23  for (auto& listener : muxer_listeners_) {
        24  listener->OnEncryptionInfoReady(is_initial_encryption_info,
        25  protection_scheme, key_id, iv,
        26  key_system_info);
        27  }
        28 }
        29 
        31  for (auto& listener : muxer_listeners_) {
        32  listener->OnEncryptionStart();
        33  }
        34 }
        35 
        37  const StreamInfo& stream_info,
        38  uint32_t time_scale,
        39  ContainerType container_type) {
        40  for (auto& listener : muxer_listeners_) {
        41  listener->OnMediaStart(muxer_options, stream_info, time_scale,
        42  container_type);
        43  }
        44 }
        45 
        46 void CombinedMuxerListener::OnSampleDurationReady(uint32_t sample_duration) {
        47  for (auto& listener : muxer_listeners_) {
        48  listener->OnSampleDurationReady(sample_duration);
        49  }
        50 }
        51 
        53  float duration_seconds) {
        54  for (auto& listener : muxer_listeners_) {
        55  listener->OnMediaEnd(media_ranges, duration_seconds);
        56  }
        57 }
        58 
        59 void CombinedMuxerListener::OnNewSegment(const std::string& file_name,
        60  uint64_t start_time,
        61  uint64_t duration,
        62  uint64_t segment_file_size) {
        63  for (auto& listener : muxer_listeners_) {
        64  listener->OnNewSegment(file_name, start_time, duration, segment_file_size);
        65  }
        66 }
        67 
        68 void CombinedMuxerListener::OnKeyFrame(uint64_t timestamp,
        69  uint64_t start_byte_offset,
        70  uint64_t size) {
        71  for (auto& listener : muxer_listeners_) {
        72  listener->OnKeyFrame(timestamp, start_byte_offset, size);
        73  }
        74 }
        75 
        76 void CombinedMuxerListener::OnCueEvent(uint64_t timestamp,
        77  const std::string& cue_data) {
        78  for (auto& listener : muxer_listeners_) {
        79  listener->OnCueEvent(timestamp, cue_data);
        80  }
        81 }
        82 
        83 } // namespace media
        84 } // namespace shaka
        Abstract class holds stream information.
        Definition: stream_info.h:59
        +
        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/event/combined_muxer_listener.h"
        8 
        9 namespace shaka {
        10 namespace media {
        11 
        12 void CombinedMuxerListener::AddListener(
        13  std::unique_ptr<MuxerListener> listener) {
        14  muxer_listeners_.push_back(std::move(listener));
        15 }
        16 
        18  bool is_initial_encryption_info,
        19  FourCC protection_scheme,
        20  const std::vector<uint8_t>& key_id,
        21  const std::vector<uint8_t>& iv,
        22  const std::vector<ProtectionSystemSpecificInfo>& key_system_info) {
        23  for (auto& listener : muxer_listeners_) {
        24  listener->OnEncryptionInfoReady(is_initial_encryption_info,
        25  protection_scheme, key_id, iv,
        26  key_system_info);
        27  }
        28 }
        29 
        31  for (auto& listener : muxer_listeners_) {
        32  listener->OnEncryptionStart();
        33  }
        34 }
        35 
        37  const StreamInfo& stream_info,
        38  uint32_t time_scale,
        39  ContainerType container_type) {
        40  for (auto& listener : muxer_listeners_) {
        41  listener->OnMediaStart(muxer_options, stream_info, time_scale,
        42  container_type);
        43  }
        44 }
        45 
        46 void CombinedMuxerListener::OnSampleDurationReady(uint32_t sample_duration) {
        47  for (auto& listener : muxer_listeners_) {
        48  listener->OnSampleDurationReady(sample_duration);
        49  }
        50 }
        51 
        53  float duration_seconds) {
        54  for (auto& listener : muxer_listeners_) {
        55  listener->OnMediaEnd(media_ranges, duration_seconds);
        56  }
        57 }
        58 
        59 void CombinedMuxerListener::OnNewSegment(const std::string& file_name,
        60  uint64_t start_time,
        61  uint64_t duration,
        62  uint64_t segment_file_size) {
        63  for (auto& listener : muxer_listeners_) {
        64  listener->OnNewSegment(file_name, start_time, duration, segment_file_size);
        65  }
        66 }
        67 
        68 void CombinedMuxerListener::OnKeyFrame(uint64_t timestamp,
        69  uint64_t start_byte_offset,
        70  uint64_t size) {
        71  for (auto& listener : muxer_listeners_) {
        72  listener->OnKeyFrame(timestamp, start_byte_offset, size);
        73  }
        74 }
        75 
        76 void CombinedMuxerListener::OnCueEvent(uint64_t timestamp,
        77  const std::string& cue_data) {
        78  for (auto& listener : muxer_listeners_) {
        79  listener->OnCueEvent(timestamp, cue_data);
        80  }
        81 }
        82 
        83 } // namespace media
        84 } // namespace shaka
        Abstract class holds stream information.
        Definition: stream_info.h:61
        void OnEncryptionInfoReady(bool is_initial_encryption_info, FourCC protection_scheme, const std::vector< uint8_t > &key_id, const std::vector< uint8_t > &iv, const std::vector< ProtectionSystemSpecificInfo > &key_system_info) override
        All the methods that are virtual are virtual for mocking.
        @@ -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 b7bafebd93..de451b191f 100644 --- a/docs/d6/d3b/chunk__info__iterator_8cc_source.html +++ b/docs/d6/d3b/chunk__info__iterator_8cc_source.html @@ -76,7 +76,7 @@ $(function() {
        diff --git a/docs/d6/d3e/pssh__generator__util_8h_source.html b/docs/d6/d3e/pssh__generator__util_8h_source.html index f82a164720..f7d029dc6d 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/d46/structshaka_1_1media_1_1CueEventInfo.html b/docs/d6/d46/structshaka_1_1media_1_1CueEventInfo.html index 001113b230..bcce89c7c9 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 7a231db426..82776f2767 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 27f2083a8e..e741a6fe8a 100644 --- a/docs/d6/d48/classshaka_1_1media_1_1PackedAudioWriter.html +++ b/docs/d6/d48/classshaka_1_1media_1_1PackedAudioWriter.html @@ -128,6 +128,10 @@ class PackedAudioWriterTes + + + @@ -212,7 +216,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 ca2fd300aa..c443948707 100644 --- a/docs/d6/d4c/classshaka_1_1media_1_1EncryptionHandler.html +++ b/docs/d6/d4c/classshaka_1_1media_1_1EncryptionHandler.html @@ -169,6 +169,13 @@ Friends +

        Additional Inherited Members

        - Static Public Member Functions inherited from shaka::media::MediaHandler
        +static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list)
         
        - Protected Member Functions inherited from shaka::media::Muxer
        const MuxerOptionsoptions () const
        class EncryptionHandlerTest
         
        + + + +

        +Additional Inherited Members

        - Static Public Member Functions inherited from shaka::media::MediaHandler
        +static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list)
         

        Detailed Description

        @@ -242,7 +249,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 c93e55c906..85ea4f41e7 100644 --- a/docs/d6/d4e/webm_2multi__segment__segmenter_8cc_source.html +++ b/docs/d6/d4e/webm_2multi__segment__segmenter_8cc_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/d6/d55/aes__cryptor_8cc_source.html b/docs/d6/d55/aes__cryptor_8cc_source.html index 49df50ef3e..81c1cda906 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/d57/classshaka_1_1media_1_1AVCDecoderConfigurationRecord.html b/docs/d6/d57/classshaka_1_1media_1_1AVCDecoderConfigurationRecord.html index 28c1fabefc..2d4cd38cfb 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 8aadb69f47..55015ef029 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 0cd03a9cd7..f10c1baad4 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 62959e3081..d813356cc8 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 44303b819b..0b8740aaf7 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 7370c21c00..edbb91b370 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 5ded0b9dfd..2d5c6201b2 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 d1d2a40f5c..a9583d635a 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 7fd3bf9347..469ab8bdbc 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 b3361b26b9..2bf41f3283 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 c0131fff29..735aed0ace 100644 --- a/docs/d6/d74/classshaka_1_1UdpOptions-members.html +++ b/docs/d6/d74/classshaka_1_1UdpOptions-members.html @@ -70,18 +70,19 @@ $(function() {

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

        - - - - - - - - + + + + + + + + +
        address() const (defined in shaka::UdpOptions)shaka::UdpOptionsinline
        interface_address() const (defined in shaka::UdpOptions)shaka::UdpOptionsinline
        is_source_specific_multicast() const (defined in shaka::UdpOptions)shaka::UdpOptionsinline
        ParseFromString(base::StringPiece udp_url)shaka::UdpOptionsstatic
        port() const (defined in shaka::UdpOptions)shaka::UdpOptionsinline
        reuse() const (defined in shaka::UdpOptions)shaka::UdpOptionsinline
        source_address() const (defined in shaka::UdpOptions)shaka::UdpOptionsinline
        timeout_us() const (defined in shaka::UdpOptions)shaka::UdpOptionsinline
        ~UdpOptions()=default (defined in shaka::UdpOptions)shaka::UdpOptions
        buffer_size() const (defined in shaka::UdpOptions)shaka::UdpOptionsinline
        interface_address() const (defined in shaka::UdpOptions)shaka::UdpOptionsinline
        is_source_specific_multicast() const (defined in shaka::UdpOptions)shaka::UdpOptionsinline
        ParseFromString(base::StringPiece udp_url)shaka::UdpOptionsstatic
        port() const (defined in shaka::UdpOptions)shaka::UdpOptionsinline
        reuse() const (defined in shaka::UdpOptions)shaka::UdpOptionsinline
        source_address() const (defined in shaka::UdpOptions)shaka::UdpOptionsinline
        timeout_us() const (defined in shaka::UdpOptions)shaka::UdpOptionsinline
        ~UdpOptions()=default (defined in shaka::UdpOptions)shaka::UdpOptions
        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 a75c7f46fc..0c6e4bf950 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 @@ -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 01a7db2fa6..efe9691c3f 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 64473fc631..84cf9c326e 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 1abfe87257..2548636201 100644 --- a/docs/d6/d86/bandwidth__estimator_8cc_source.html +++ b/docs/d6/d86/bandwidth__estimator_8cc_source.html @@ -66,14 +66,14 @@ $(function() {
        bandwidth_estimator.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/mpd/base/bandwidth_estimator.h"
        8 
        9 #include <cmath>
        10 
        11 #include "packager/base/logging.h"
        12 
        13 namespace shaka {
        14 
        15 BandwidthEstimator::BandwidthEstimator(size_t num_blocks)
        16  : sliding_queue_(num_blocks) {}
        17 BandwidthEstimator::~BandwidthEstimator() {}
        18 
        19 void BandwidthEstimator::AddBlock(uint64_t size, double duration) {
        20  DCHECK_GT(duration, 0.0);
        21  DCHECK_GT(size, 0u);
        22 
        23  const int kBitsInByte = 8;
        24  const double bits_per_second_reciprocal = duration / (kBitsInByte * size);
        25  sliding_queue_.Add(bits_per_second_reciprocal);
        26 }
        27 
        28 uint64_t BandwidthEstimator::Estimate() const {
        29  return sliding_queue_.size() == 0
        30  ? 0
        31  : static_cast<uint64_t>(
        32  ceil(sliding_queue_.size() / sliding_queue_.sum()));
        33 }
        34 
        35 uint64_t BandwidthEstimator::Max() const {
        36  // The first element has minimum "bits per second reciprocal", thus the
        37  // reverse is maximum "bits per second".
        38  return sliding_queue_.size() == 0
        39  ? 0
        40  : static_cast<uint64_t>(ceil(1 / sliding_queue_.min()));
        41 }
        42 
        43 BandwidthEstimator::SlidingQueue::SlidingQueue(size_t window_size)
        44  : window_size_(window_size) {}
        45 
        46 void BandwidthEstimator::SlidingQueue::Add(double value) {
        47  // Remove elements if needed to form a monotonic non-decreasing sequence.
        48  while (!min_.empty() && min_.back() > value)
        49  min_.pop_back();
        50  min_.push_back(value);
        51 
        52  if (window_size_ == kUseAllBlocks) {
        53  size_++;
        54  sum_ += value;
        55  min_.resize(1); // Keep only the minimum one.
        56  return;
        57  }
        58 
        59  window_.push_back(value);
        60  sum_ += value;
        61 
        62  if (window_.size() <= window_size_) {
        63  size_++;
        64  return;
        65  }
        66 
        67  if (min_.front() == window_.front())
        68  min_.pop_front();
        69 
        70  sum_ -= window_.front();
        71  window_.pop_front();
        72 }
        73 
        74 } // 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/mpd/base/bandwidth_estimator.h"
        8 
        9 #include <cmath>
        10 
        11 #include "packager/base/logging.h"
        12 
        13 namespace shaka {
        14 
        15 BandwidthEstimator::BandwidthEstimator(size_t num_blocks)
        16  : sliding_queue_(num_blocks) {}
        17 BandwidthEstimator::~BandwidthEstimator() {}
        18 
        19 void BandwidthEstimator::AddBlock(uint64_t size, double duration) {
        20  if (size == 0 || duration == 0) {
        21  LOG(WARNING) << "Ignore block with size=" << size
        22  << ", duration=" << duration;
        23  return;
        24  }
        25  const int kBitsInByte = 8;
        26  const double bits_per_second_reciprocal = duration / (kBitsInByte * size);
        27  sliding_queue_.Add(bits_per_second_reciprocal);
        28 }
        29 
        30 uint64_t BandwidthEstimator::Estimate() const {
        31  return sliding_queue_.size() == 0
        32  ? 0
        33  : static_cast<uint64_t>(
        34  ceil(sliding_queue_.size() / sliding_queue_.sum()));
        35 }
        36 
        37 uint64_t BandwidthEstimator::Max() const {
        38  // The first element has minimum "bits per second reciprocal", thus the
        39  // reverse is maximum "bits per second".
        40  return sliding_queue_.size() == 0
        41  ? 0
        42  : static_cast<uint64_t>(ceil(1 / sliding_queue_.min()));
        43 }
        44 
        45 BandwidthEstimator::SlidingQueue::SlidingQueue(size_t window_size)
        46  : window_size_(window_size) {}
        47 
        48 void BandwidthEstimator::SlidingQueue::Add(double value) {
        49  // Remove elements if needed to form a monotonic non-decreasing sequence.
        50  while (!min_.empty() && min_.back() > value)
        51  min_.pop_back();
        52  min_.push_back(value);
        53 
        54  if (window_size_ == kUseAllBlocks) {
        55  size_++;
        56  sum_ += value;
        57  min_.resize(1); // Keep only the minimum one.
        58  return;
        59  }
        60 
        61  window_.push_back(value);
        62  sum_ += value;
        63 
        64  if (window_.size() <= window_size_) {
        65  size_++;
        66  return;
        67  }
        68 
        69  if (min_.front() == window_.front())
        70  min_.pop_front();
        71 
        72  sum_ -= window_.front();
        73  window_.pop_front();
        74 }
        75 
        76 } // namespace shaka
        All the methods that are virtual are virtual for mocking.
        void AddBlock(uint64_t size, double duration)
        - - + +
        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 e65b32df7b..f616f3bc30 100644 --- a/docs/d6/d8a/classshaka_1_1media_1_1FakeMediaHandler-members.html +++ b/docs/d6/d8a/classshaka_1_1media_1_1FakeMediaHandler-members.html @@ -70,35 +70,36 @@ $(function() {

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

        - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + +
        AddHandler(std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandlerinline
        clear_stream_data_vector() (defined in shaka::media::FakeMediaHandler)shaka::media::FakeMediaHandlerinline
        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
        InitializeInternal() overrideshaka::media::FakeMediaHandlerprotectedvirtual
        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
        OnFlushRequest(size_t input_stream_index) overrideshaka::media::FakeMediaHandlerprotectedvirtual
        output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
        Process(std::unique_ptr< StreamData > stream_data) overrideshaka::media::FakeMediaHandlerprotectedvirtual
        SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
        stream_data_vector() const (defined in shaka::media::FakeMediaHandler)shaka::media::FakeMediaHandlerinline
        stream_data_vector_ (defined in shaka::media::FakeMediaHandler)shaka::media::FakeMediaHandlerprotected
        ValidateOutputStreamIndex(size_t stream_index) const overrideshaka::media::FakeMediaHandlerprotectedvirtual
        ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
        Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
        clear_stream_data_vector() (defined in shaka::media::FakeMediaHandler)shaka::media::FakeMediaHandlerinline
        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
        InitializeInternal() overrideshaka::media::FakeMediaHandlerprotectedvirtual
        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
        OnFlushRequest(size_t input_stream_index) overrideshaka::media::FakeMediaHandlerprotectedvirtual
        output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
        Process(std::unique_ptr< StreamData > stream_data) overrideshaka::media::FakeMediaHandlerprotectedvirtual
        SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
        stream_data_vector() const (defined in shaka::media::FakeMediaHandler)shaka::media::FakeMediaHandlerinline
        stream_data_vector_ (defined in shaka::media::FakeMediaHandler)shaka::media::FakeMediaHandlerprotected
        ValidateOutputStreamIndex(size_t stream_index) const overrideshaka::media::FakeMediaHandlerprotectedvirtual
        ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
        diff --git a/docs/d6/d8a/vp9__parser_8cc_source.html b/docs/d6/d8a/vp9__parser_8cc_source.html index cb732875d6..afb9a2925e 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 c45176729e..92cfc6992d 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 11f3a62356..fbcc2ede95 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 61fc16f03f..aedf8826d1 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 a9cdbf1fa2..6c900fa9c2 100644 --- a/docs/d6/d9f/webvtt__to__mp4__handler_8cc_source.html +++ b/docs/d6/d9f/webvtt__to__mp4__handler_8cc_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/d6/da0/ts__section__pat_8h_source.html b/docs/d6/da0/ts__section__pat_8h_source.html index 848b0366ba..4bd2930f47 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 83a1f925f8..ebc93ba906 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 a901aab4ac..a6b97ab9a0 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 db4cd8e442..3664e50304 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 fb7c289a32..6498b21c93 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 5f493354d1..050fb574a7 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 @@ -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 45897b9558..49051cb1ae 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 808a235cd5..f0f31d24ef 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 9ad3879d6e..179e2505fe 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 934cb8863f..4daf710662 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 75bbd7f241..c2d6d4ef2f 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 77f5e82af8..d8166507b9 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/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 1b5c0ec53f..1a7d01b1ee 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 56c174f9d8..e3f39dbb2d 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 2e502df3e4..cb4d3f8e45 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 6d7d813581..ab09c5149d 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 @@ -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 e7e576c272..574f6f2d21 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 e9690bad0e..6ce8b2cdf8 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 375616ff0a..4dad1a2bda 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 024353084c..62ace706a4 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/d6/dda/classshaka_1_1media_1_1WebVttFileBuffer.html b/docs/d6/dda/classshaka_1_1media_1_1WebVttFileBuffer.html index f40c730c1b..57dc5e5e2b 100644 --- a/docs/d6/dda/classshaka_1_1media_1_1WebVttFileBuffer.html +++ b/docs/d6/dda/classshaka_1_1media_1_1WebVttFileBuffer.html @@ -95,7 +95,7 @@ size_t sample_count () 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 3ddddff2c3..f419b3116a 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 d84842a7c7..c3db9e03cc 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 80881ff6f0..98490ed354 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 364ab301b3..994e6b4dd2 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 3155b236db..c0cadd56f9 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 beb083573b..478173ab43 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 3a5fe08baa..fbb65af821 100644 --- a/docs/d6/de9/ts__segmenter_8cc_source.html +++ b/docs/d6/de9/ts__segmenter_8cc_source.html @@ -68,7 +68,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/media/formats/mp2t/ts_segmenter.h"
        8 
        9 #include <memory>
        10 
        11 #include "packager/media/base/audio_stream_info.h"
        12 #include "packager/media/base/muxer_util.h"
        13 #include "packager/media/base/video_stream_info.h"
        14 #include "packager/media/event/muxer_listener.h"
        15 #include "packager/media/formats/mp2t/pes_packet.h"
        16 #include "packager/media/formats/mp2t/program_map_table_writer.h"
        17 #include "packager/status.h"
        18 
        19 namespace shaka {
        20 namespace media {
        21 namespace mp2t {
        22 
        23 namespace {
        24 const double kTsTimescale = 90000;
        25 
        26 bool IsAudioCodec(Codec codec) {
        27  return codec >= kCodecAudio && codec < kCodecAudioMaxPlusOne;
        28 }
        29 
        30 bool IsVideoCodec(Codec codec) {
        31  return codec >= kCodecVideo && codec < kCodecVideoMaxPlusOne;
        32 }
        33 
        34 } // namespace
        35 
        37  : muxer_options_(options),
        38  listener_(listener),
        39  pes_packet_generator_(new PesPacketGenerator()) {}
        40 TsSegmenter::~TsSegmenter() {}
        41 
        43  if (muxer_options_.segment_template.empty())
        44  return Status(error::MUXER_FAILURE, "Segment template not specified.");
        45  if (!pes_packet_generator_->Initialize(stream_info)) {
        46  return Status(error::MUXER_FAILURE,
        47  "Failed to initialize PesPacketGenerator.");
        48  }
        49 
        50  const StreamType stream_type = stream_info.stream_type();
        51  if (stream_type != StreamType::kStreamVideo &&
        52  stream_type != StreamType::kStreamAudio) {
        53  LOG(ERROR) << "TsWriter cannot handle stream type " << stream_type
        54  << " yet.";
        55  return Status(error::MUXER_FAILURE, "Unsupported stream type.");
        56  }
        57 
        58  codec_ = stream_info.codec();
        59  if (stream_type == StreamType::kStreamAudio)
        60  audio_codec_config_ = stream_info.codec_config();
        61 
        62  timescale_scale_ = kTsTimescale / stream_info.time_scale();
        63  return Status::OK;
        64 }
        65 
        67  return Status::OK;
        68 }
        69 
        71  if (!ts_writer_) {
        72  std::unique_ptr<ProgramMapTableWriter> pmt_writer;
        73  if (codec_ == kCodecAC3) {
        74  // https://goo.gl/N7Tvqi MPEG-2 Stream Encryption Format for HTTP Live
        75  // Streaming 2.3.2.2 AC-3 Setup: For AC-3, the setup_data in the
        76  // audio_setup_information is the first 10 bytes of the audio data (the
        77  // syncframe()).
        78  // For unencrypted AC3, the setup_data is not used, so what is in there
        79  // does not matter.
        80  const size_t kSetupDataSize = 10u;
        81  if (sample.data_size() < kSetupDataSize) {
        82  LOG(ERROR) << "Sample is too small for AC3: " << sample.data_size();
        83  return Status(error::MUXER_FAILURE, "Sample is too small for AC3.");
        84  }
        85  const std::vector<uint8_t> setup_data(sample.data(),
        86  sample.data() + kSetupDataSize);
        87  pmt_writer.reset(new AudioProgramMapTableWriter(codec_, setup_data));
        88  } else if (IsAudioCodec(codec_)) {
        89  pmt_writer.reset(
        90  new AudioProgramMapTableWriter(codec_, audio_codec_config_));
        91  } else {
        92  DCHECK(IsVideoCodec(codec_));
        93  pmt_writer.reset(new VideoProgramMapTableWriter(codec_));
        94  }
        95  ts_writer_.reset(new TsWriter(std::move(pmt_writer)));
        96  }
        97 
        98  if (sample.is_encrypted())
        99  ts_writer_->SignalEncrypted();
        100 
        101  if (!ts_writer_file_opened_ && !sample.is_key_frame())
        102  LOG(WARNING) << "A segment will start with a non key frame.";
        103 
        104  if (!pes_packet_generator_->PushSample(sample)) {
        105  return Status(error::MUXER_FAILURE,
        106  "Failed to add sample to PesPacketGenerator.");
        107  }
        108  return WritePesPacketsToFile();
        109 }
        110 
        111 void TsSegmenter::InjectTsWriterForTesting(std::unique_ptr<TsWriter> writer) {
        112  ts_writer_ = std::move(writer);
        113 }
        114 
        116  std::unique_ptr<PesPacketGenerator> generator) {
        117  pes_packet_generator_ = std::move(generator);
        118 }
        119 
        121  ts_writer_file_opened_ = value;
        122 }
        123 
        124 Status TsSegmenter::OpenNewSegmentIfClosed(uint32_t next_pts) {
        125  if (ts_writer_file_opened_)
        126  return Status::OK;
        127  const std::string segment_name =
        128  GetSegmentName(muxer_options_.segment_template, next_pts,
        129  segment_number_++, muxer_options_.bandwidth);
        130  if (!ts_writer_->NewSegment(segment_name))
        131  return Status(error::MUXER_FAILURE, "Failed to initilize TsPacketWriter.");
        132  current_segment_path_ = segment_name;
        133  ts_writer_file_opened_ = true;
        134  return Status::OK;
        135 }
        136 
        137 Status TsSegmenter::WritePesPacketsToFile() {
        138  while (pes_packet_generator_->NumberOfReadyPesPackets() > 0u) {
        139  std::unique_ptr<PesPacket> pes_packet =
        140  pes_packet_generator_->GetNextPesPacket();
        141 
        142  Status status = OpenNewSegmentIfClosed(pes_packet->pts());
        143  if (!status.ok())
        144  return status;
        145 
        146  if (listener_ && IsVideoCodec(codec_) && pes_packet->is_key_frame()) {
        147  base::Optional<uint64_t> start_pos = ts_writer_->GetFilePosition();
        148 
        149  const int64_t timestamp = pes_packet->pts();
        150  if (!ts_writer_->AddPesPacket(std::move(pes_packet)))
        151  return Status(error::MUXER_FAILURE, "Failed to add PES packet.");
        152 
        153  base::Optional<uint64_t> end_pos = ts_writer_->GetFilePosition();
        154  if (!start_pos || !end_pos) {
        155  return Status(error::MUXER_FAILURE,
        156  "Failed to get file position in WritePesPacketsToFile.");
        157  }
        158  listener_->OnKeyFrame(timestamp, *start_pos, *end_pos - *start_pos);
        159  } else {
        160  if (!ts_writer_->AddPesPacket(std::move(pes_packet)))
        161  return Status(error::MUXER_FAILURE, "Failed to add PES packet.");
        162  }
        163  }
        164  return Status::OK;
        165 }
        166 
        167 Status TsSegmenter::FinalizeSegment(uint64_t start_timestamp,
        168  uint64_t duration) {
        169  if (!pes_packet_generator_->Flush()) {
        170  return Status(error::MUXER_FAILURE,
        171  "Failed to flush PesPacketGenerator.");
        172  }
        173  Status status = WritePesPacketsToFile();
        174  if (!status.ok())
        175  return status;
        176 
        177  // This method may be called from Finalize() so ts_writer_file_opened_ could
        178  // be false.
        179  if (ts_writer_file_opened_) {
        180  if (!ts_writer_->FinalizeSegment()) {
        181  return Status(error::MUXER_FAILURE, "Failed to finalize TsWriter.");
        182  }
        183  if (listener_) {
        184  const int64_t file_size =
        185  File::GetFileSize(current_segment_path_.c_str());
        186  listener_->OnNewSegment(current_segment_path_,
        187  start_timestamp * timescale_scale_,
        188  duration * timescale_scale_, file_size);
        189  }
        190  ts_writer_file_opened_ = false;
        191  }
        192  current_segment_path_.clear();
        193  return Status::OK;
        194 }
        195 
        196 } // namespace mp2t
        197 } // namespace media
        198 } // namespace shaka
        virtual void OnNewSegment(const std::string &segment_name, uint64_t start_time, uint64_t duration, uint64_t segment_file_size)=0
        -
        Abstract class holds stream information.
        Definition: stream_info.h:59
        +
        Abstract class holds stream information.
        Definition: stream_info.h:61
        virtual void OnKeyFrame(uint64_t timestamp, uint64_t start_byte_offset, uint64_t size)=0
        ProgramMapTableWriter for video codecs.
        @@ -92,7 +92,7 @@ $(function() {
        diff --git a/docs/d6/ded/ts__packet_8h_source.html b/docs/d6/ded/ts__packet_8h_source.html index a49e4dc3bd..8df4f4bc2b 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 904fb81c7c..745e10dc29 100644 --- a/docs/d6/def/sync__sample__iterator_8cc_source.html +++ b/docs/d6/def/sync__sample__iterator_8cc_source.html @@ -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 895d686a00..ecb2a07cac 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 1517cae468..931695aaf8 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 fcb02de68c..76ce4d3d70 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 079f7f6fd9..60dd438c6b 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 5e8206ffdc..39ffbc6b86 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 @@ -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 deleted file mode 100644 index 133a3f35e8..0000000000 --- a/docs/d7/d04/classshaka_1_1media_1_1AdCueGenerator-members.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - -Shaka Packager SDK: Member List - - - - - - - - - -
        -
        - - - - - - -
        -
        Shaka Packager SDK -
        -
        -
        - - - - - - - - -
        -
        - - -
        - -
        - - -
        -
        -
        -
        shaka::media::AdCueGenerator Member List
        -
        -
        - -

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

        - - - - - - - - - - - - - - - - - - - - - - - - -
        AdCueGenerator(const AdCueGeneratorParams &ad_cue_generator_params) (defined in shaka::media::AdCueGenerator)shaka::media::AdCueGeneratorexplicit
        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
        OnFlushRequest(size_t input_stream_index)shaka::media::MediaHandlerprotectedvirtual
        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
        ~AdCueGenerator() override (defined in shaka::media::AdCueGenerator)shaka::media::AdCueGenerator
        ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
        - - - - 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 54c8277101..33fad2866b 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 @@ -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 8b387d40e3..94ee2c0cdf 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 26a12e9a4e..3a1cca9975 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 972f15ffbf..146ceff87b 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 22c62bc773..00bd7d7e76 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 2ada330f78..193e1ded42 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 // Media handler for taking a single stream of text samples and inserting
        18 // segment info based on a fixed segment duration and on cue events. The
        19 // only time a segment's duration will not match the fixed segment duration
        20 // is when a cue event is seen.
        21 class TextChunker : public MediaHandler {
        22  public:
        23  explicit TextChunker(double segment_duration_in_seconds);
        24 
        25  private:
        26  TextChunker(const TextChunker&) = delete;
        27  TextChunker& operator=(const TextChunker&) = delete;
        28 
        29  Status InitializeInternal() override { return Status::OK; }
        30 
        31  Status Process(std::unique_ptr<StreamData> stream_data) override;
        32  Status OnFlushRequest(size_t input_stream_index) override;
        33 
        34  Status OnStreamInfo(std::shared_ptr<const StreamInfo> info);
        35  Status OnCueEvent(std::shared_ptr<const CueEvent> cue);
        36  Status OnTextSample(std::shared_ptr<const TextSample> sample);
        37 
        38  // This does two things that should always happen together:
        39  // 1. Dispatch all the samples and a segment info for the time range
        40  // segment_start_ to segment_start_ + duration
        41  // 2. Set the next segment to start at segment_start_ + duration and
        42  // remove all samples that don't last into that segment.
        43  Status DispatchSegment(int64_t duration);
        44 
        45  int64_t ScaleTime(double seconds) const;
        46 
        47  double segment_duration_in_seconds_;
        48 
        49  int64_t time_scale_ = -1; // Set in OnStreamInfo
        50 
        51  // Time values are in scaled units.
        52  int64_t segment_start_ = 0;
        53  int64_t segment_duration_ = -1; // Set in OnStreamInfo
        54 
        55  // All samples that make up the current segment. We must store the samples
        56  // until the segment ends because a cue event may end the segment sooner
        57  // than we expected.
        58  std::list<std::shared_ptr<const TextSample>> samples_in_current_segment_;
        59 };
        60 
        61 } // namespace media
        62 } // namespace shaka
        63 
        64 #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 13d865fd0f..1fddf36157 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 57f378f701..3c71fdbaf1 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 a3edf8c5bc..d7f35dffd2 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 c7be6c0915..42a7ed69da 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 358f38a045..0dce2a88d0 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 774929a30c..9fb971dcef 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 fe6b8bebc9..846824a7a7 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 703253ba68..fcd2941f66 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 581796545d..62d29f3b71 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 2e8c8e7751..fdda38de49 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 e77dba4537..2d140cbde3 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 @@ -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 c12c2e36e0..157d23f3dc 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 @@ -95,7 +95,7 @@ $(function() { 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 d872b95da0..ce26713644 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 5b41c569ee..9f91c796f9 100644 --- a/docs/d7/d53/classshaka_1_1media_1_1WebVttToMp4Handler.html +++ b/docs/d7/d53/classshaka_1_1media_1_1WebVttToMp4Handler.html @@ -95,6 +95,10 @@ Additional Inherited Members bool IsConnected ()  Validate if the handler is connected to its upstream handler.
          +- Static Public Member Functions inherited from shaka::media::MediaHandler + +static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list) +  - Protected Member Functions inherited from shaka::media::MediaHandler virtual Status OnFlushRequest (size_t input_stream_index) @@ -161,7 +165,7 @@ const std::map< size_t, std::pair< std::shared_ptr< 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 1da8e5cd89..3a10d15068 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 c23898baca..5236bdae90 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 78fd9b226e..bb814cc567 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 22dce98587..2bd055b22f 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 37a110d26f..0017a47a5d 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 ad5ef7a4d7..5e0af3c7b2 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 58468be00b..da11c9d73c 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 91b2da720a..d12e9384fe 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 1aa7f9e387..3d70045232 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 36a87e5574..7b0ecce6f6 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 598509d69f..79dd03486a 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 d06e56d9ed..883447feda 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 52e51cae7e..48035e0280 100644 --- a/docs/d7/d87/video__stream__info_8h_source.html +++ b/docs/d7/d87/video__stream__info_8h_source.html @@ -66,7 +66,7 @@ $(function() {
        video_stream_info.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_VIDEO_STREAM_INFO_H_
        8 #define PACKAGER_MEDIA_BASE_VIDEO_STREAM_INFO_H_
        9 
        10 #include "packager/media/base/stream_info.h"
        11 
        12 namespace shaka {
        13 namespace media {
        14 
        15 enum class H26xStreamFormat {
        16  kUnSpecified,
        17  kAnnexbByteStream,
        18  kNalUnitStreamWithParameterSetNalus,
        19  kNalUnitStreamWithoutParameterSetNalus,
        20 };
        21 
        23 class VideoStreamInfo : public StreamInfo {
        24  public:
        25  VideoStreamInfo() = default;
        26 
        30  VideoStreamInfo(int track_id,
        31  uint32_t time_scale,
        32  uint64_t duration,
        33  Codec codec,
        34  H26xStreamFormat h26x_stream_format,
        35  const std::string& codec_string,
        36  const uint8_t* codec_config,
        37  size_t codec_config_size,
        38  uint16_t width,
        39  uint16_t height,
        40  uint32_t pixel_width,
        41  uint32_t pixel_height,
        42  uint32_t trick_play_factor,
        43  uint8_t nalu_length_size,
        44  const std::string& language,
        45  bool is_encrypted);
        46 
        47  ~VideoStreamInfo() override;
        48 
        51  bool IsValidConfig() const override;
        52  std::string ToString() const override;
        53  std::unique_ptr<StreamInfo> Clone() const override;
        55 
        56  H26xStreamFormat h26x_stream_format() const { return h26x_stream_format_; }
        57  uint16_t width() const { return width_; }
        58  uint16_t height() const { return height_; }
        61  uint32_t pixel_width() const { return pixel_width_; }
        64  uint32_t pixel_height() const { return pixel_height_; }
        65  uint8_t nalu_length_size() const { return nalu_length_size_; }
        66  uint32_t trick_play_factor() const { return trick_play_factor_; }
        67  uint32_t playback_rate() const { return playback_rate_; }
        68  const std::vector<uint8_t>& eme_init_data() const { return eme_init_data_; }
        69 
        70  void set_width(uint32_t width) { width_ = width; }
        71  void set_height(uint32_t height) { height_ = height; }
        72  void set_pixel_width(uint32_t pixel_width) { pixel_width_ = pixel_width; }
        73  void set_pixel_height(uint32_t pixel_height) { pixel_height_ = pixel_height; }
        74  void set_trick_play_factor(uint32_t trick_play_factor) {
        75  trick_play_factor_ = trick_play_factor;
        76  }
        77  void set_playback_rate(uint32_t playback_rate) {
        78  playback_rate_ = playback_rate;
        79  }
        80  void set_eme_init_data(const uint8_t* eme_init_data,
        81  size_t eme_init_data_size) {
        82  eme_init_data_.assign(eme_init_data, eme_init_data + eme_init_data_size);
        83  }
        84 
        85  private:
        86  H26xStreamFormat h26x_stream_format_;
        87  uint16_t width_;
        88  uint16_t height_;
        89 
        90  // pixel_width_:pixel_height_ is the sample aspect ratio.
        91  // 0 means unknown.
        92  uint32_t pixel_width_;
        93  uint32_t pixel_height_;
        94  uint32_t trick_play_factor_ = 0; // Non-zero for trick-play streams.
        95 
        96  // Playback rate is the attribute for trick play stream, which signals the
        97  // playout capabilities
        98  // (http://dashif.org/wp-content/uploads/2016/12/DASH-IF-IOP-v4.0-clean.pdf,
        99  // page 18, line 1). It is the ratio of main frame rate to the trick play
        100  // frame rate. If the time scale and frame duration are not modified after
        101  // trick play handler processing, the playback_rate equals to the number of
        102  // frames between consecutive key frames selected for trick play stream. For
        103  // example, if the video stream has GOP size of 10 and the trick play factor
        104  // is 3, the key frames are in this trick play stream are [frame_0, frame_30,
        105  // frame_60, ...]. Then the playback_rate is 30.
        106  // Non-zero for trick-play streams.
        107  uint32_t playback_rate_ = 0;
        108 
        109  // Specifies the size of the NAL unit length field. Can be 1, 2 or 4 bytes, or
        110  // 0 if the stream is not a NAL structured video stream or if it is an AnnexB
        111  // byte stream.
        112  uint8_t nalu_length_size_;
        113 
        114  // Container-specific data used by CDM to generate a license request:
        115  // https://w3c.github.io/encrypted-media/#initialization-data.
        116  std::vector<uint8_t> eme_init_data_;
        117 
        118  // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
        119  // generated copy constructor and assignment operator. Since the extra data is
        120  // typically small, the performance impact is minimal.
        121 };
        122 
        123 } // namespace media
        124 } // namespace shaka
        125 
        126 #endif // PACKAGER_MEDIA_BASE_VIDEO_STREAM_INFO_H_
        Abstract class holds stream information.
        Definition: stream_info.h:59
        +
        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_VIDEO_STREAM_INFO_H_
        8 #define PACKAGER_MEDIA_BASE_VIDEO_STREAM_INFO_H_
        9 
        10 #include "packager/media/base/stream_info.h"
        11 
        12 namespace shaka {
        13 namespace media {
        14 
        15 enum class H26xStreamFormat {
        16  kUnSpecified,
        17  kAnnexbByteStream,
        18  kNalUnitStreamWithParameterSetNalus,
        19  kNalUnitStreamWithoutParameterSetNalus,
        20 };
        21 
        23 class VideoStreamInfo : public StreamInfo {
        24  public:
        25  VideoStreamInfo() = default;
        26 
        30  VideoStreamInfo(int track_id,
        31  uint32_t time_scale,
        32  uint64_t duration,
        33  Codec codec,
        34  H26xStreamFormat h26x_stream_format,
        35  const std::string& codec_string,
        36  const uint8_t* codec_config,
        37  size_t codec_config_size,
        38  uint16_t width,
        39  uint16_t height,
        40  uint32_t pixel_width,
        41  uint32_t pixel_height,
        42  uint32_t trick_play_factor,
        43  uint8_t nalu_length_size,
        44  const std::string& language,
        45  bool is_encrypted);
        46 
        47  ~VideoStreamInfo() override;
        48 
        51  bool IsValidConfig() const override;
        52  std::string ToString() const override;
        53  std::unique_ptr<StreamInfo> Clone() const override;
        55 
        56  H26xStreamFormat h26x_stream_format() const { return h26x_stream_format_; }
        57  uint16_t width() const { return width_; }
        58  uint16_t height() const { return height_; }
        61  uint32_t pixel_width() const { return pixel_width_; }
        64  uint32_t pixel_height() const { return pixel_height_; }
        65  uint8_t nalu_length_size() const { return nalu_length_size_; }
        66  uint32_t trick_play_factor() const { return trick_play_factor_; }
        67  uint32_t playback_rate() const { return playback_rate_; }
        68  const std::vector<uint8_t>& eme_init_data() const { return eme_init_data_; }
        69 
        70  void set_width(uint32_t width) { width_ = width; }
        71  void set_height(uint32_t height) { height_ = height; }
        72  void set_pixel_width(uint32_t pixel_width) { pixel_width_ = pixel_width; }
        73  void set_pixel_height(uint32_t pixel_height) { pixel_height_ = pixel_height; }
        74  void set_trick_play_factor(uint32_t trick_play_factor) {
        75  trick_play_factor_ = trick_play_factor;
        76  }
        77  void set_playback_rate(uint32_t playback_rate) {
        78  playback_rate_ = playback_rate;
        79  }
        80  void set_eme_init_data(const uint8_t* eme_init_data,
        81  size_t eme_init_data_size) {
        82  eme_init_data_.assign(eme_init_data, eme_init_data + eme_init_data_size);
        83  }
        84 
        85  private:
        86  H26xStreamFormat h26x_stream_format_;
        87  uint16_t width_;
        88  uint16_t height_;
        89 
        90  // pixel_width_:pixel_height_ is the sample aspect ratio.
        91  // 0 means unknown.
        92  uint32_t pixel_width_;
        93  uint32_t pixel_height_;
        94  uint32_t trick_play_factor_ = 0; // Non-zero for trick-play streams.
        95 
        96  // Playback rate is the attribute for trick play stream, which signals the
        97  // playout capabilities
        98  // (http://dashif.org/wp-content/uploads/2016/12/DASH-IF-IOP-v4.0-clean.pdf,
        99  // page 18, line 1). It is the ratio of main frame rate to the trick play
        100  // frame rate. If the time scale and frame duration are not modified after
        101  // trick play handler processing, the playback_rate equals to the number of
        102  // frames between consecutive key frames selected for trick play stream. For
        103  // example, if the video stream has GOP size of 10 and the trick play factor
        104  // is 3, the key frames are in this trick play stream are [frame_0, frame_30,
        105  // frame_60, ...]. Then the playback_rate is 30.
        106  // Non-zero for trick-play streams.
        107  uint32_t playback_rate_ = 0;
        108 
        109  // Specifies the size of the NAL unit length field. Can be 1, 2 or 4 bytes, or
        110  // 0 if the stream is not a NAL structured video stream or if it is an AnnexB
        111  // byte stream.
        112  uint8_t nalu_length_size_;
        113 
        114  // Container-specific data used by CDM to generate a license request:
        115  // https://w3c.github.io/encrypted-media/#initialization-data.
        116  std::vector<uint8_t> eme_init_data_;
        117 
        118  // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
        119  // generated copy constructor and assignment operator. Since the extra data is
        120  // typically small, the performance impact is minimal.
        121 };
        122 
        123 } // namespace media
        124 } // namespace shaka
        125 
        126 #endif // PACKAGER_MEDIA_BASE_VIDEO_STREAM_INFO_H_
        Abstract class holds stream information.
        Definition: stream_info.h:61
        All the methods that are virtual are virtual for mocking.
        @@ -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 7d26444bdd..72d7546ec6 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 30dccedc28..656ecce3f9 100644 --- a/docs/d7/d94/representation_8cc_source.html +++ b/docs/d7/d94/representation_8cc_source.html @@ -66,7 +66,7 @@ $(function() {
        representation.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/representation.h"
        8 
        9 #include <gflags/gflags.h>
        10 
        11 #include <algorithm>
        12 
        13 #include "packager/base/logging.h"
        14 #include "packager/file/file.h"
        15 #include "packager/media/base/muxer_util.h"
        16 #include "packager/mpd/base/mpd_options.h"
        17 #include "packager/mpd/base/mpd_utils.h"
        18 #include "packager/mpd/base/xml/xml_node.h"
        19 
        20 namespace shaka {
        21 namespace {
        22 
        23 std::string GetMimeType(const std::string& prefix,
        24  MediaInfo::ContainerType container_type) {
        25  switch (container_type) {
        26  case MediaInfo::CONTAINER_MP4:
        27  return prefix + "/mp4";
        28  case MediaInfo::CONTAINER_MPEG2_TS:
        29  // NOTE: DASH MPD spec uses lowercase but RFC3555 says uppercase.
        30  return prefix + "/MP2T";
        31  case MediaInfo::CONTAINER_WEBM:
        32  return prefix + "/webm";
        33  default:
        34  break;
        35  }
        36 
        37  // Unsupported container types should be rejected/handled by the caller.
        38  LOG(ERROR) << "Unrecognized container type: " << container_type;
        39  return std::string();
        40 }
        41 
        42 // Check whether the video info has width and height.
        43 // DASH IOP also requires several other fields for video representations, namely
        44 // width, height, framerate, and sar.
        45 bool HasRequiredVideoFields(const MediaInfo_VideoInfo& video_info) {
        46  if (!video_info.has_height() || !video_info.has_width()) {
        47  LOG(ERROR)
        48  << "Width and height are required fields for generating a valid MPD.";
        49  return false;
        50  }
        51  // These fields are not required for a valid MPD, but required for DASH IOP
        52  // compliant MPD. MpdBuilder can keep generating MPDs without these fields.
        53  LOG_IF(WARNING, !video_info.has_time_scale())
        54  << "Video info does not contain timescale required for "
        55  "calculating framerate. @frameRate is required for DASH IOP.";
        56  LOG_IF(WARNING, !video_info.has_pixel_width())
        57  << "Video info does not contain pixel_width to calculate the sample "
        58  "aspect ratio required for DASH IOP.";
        59  LOG_IF(WARNING, !video_info.has_pixel_height())
        60  << "Video info does not contain pixel_height to calculate the sample "
        61  "aspect ratio required for DASH IOP.";
        62  return true;
        63 }
        64 
        65 uint32_t GetTimeScale(const MediaInfo& media_info) {
        66  if (media_info.has_reference_time_scale()) {
        67  return media_info.reference_time_scale();
        68  }
        69 
        70  if (media_info.has_video_info()) {
        71  return media_info.video_info().time_scale();
        72  }
        73 
        74  if (media_info.has_audio_info()) {
        75  return media_info.audio_info().time_scale();
        76  }
        77 
        78  LOG(WARNING) << "No timescale specified, using 1 as timescale.";
        79  return 1;
        80 }
        81 
        82 uint64_t LastSegmentStartTime(const SegmentInfo& segment_info) {
        83  return segment_info.start_time + segment_info.duration * segment_info.repeat;
        84 }
        85 
        86 // This is equal to |segment_info| end time
        87 uint64_t LastSegmentEndTime(const SegmentInfo& segment_info) {
        88  return segment_info.start_time +
        89  segment_info.duration * (segment_info.repeat + 1);
        90 }
        91 
        92 uint64_t LatestSegmentStartTime(const std::list<SegmentInfo>& segments) {
        93  DCHECK(!segments.empty());
        94  const SegmentInfo& latest_segment = segments.back();
        95  return LastSegmentStartTime(latest_segment);
        96 }
        97 
        98 // Given |timeshift_limit|, finds out the number of segments that are no longer
        99 // valid and should be removed from |segment_info|.
        100 uint64_t SearchTimedOutRepeatIndex(uint64_t timeshift_limit,
        101  const SegmentInfo& segment_info) {
        102  DCHECK_LE(timeshift_limit, LastSegmentEndTime(segment_info));
        103  if (timeshift_limit < segment_info.start_time)
        104  return 0;
        105 
        106  return (timeshift_limit - segment_info.start_time) / segment_info.duration;
        107 }
        108 
        109 } // namespace
        110 
        112  const MediaInfo& media_info,
        113  const MpdOptions& mpd_options,
        114  uint32_t id,
        115  std::unique_ptr<RepresentationStateChangeListener> state_change_listener)
        116  : media_info_(media_info),
        117  id_(id),
        118  bandwidth_estimator_(BandwidthEstimator::kUseAllBlocks),
        119  mpd_options_(mpd_options),
        120  state_change_listener_(std::move(state_change_listener)),
        121  allow_approximate_segment_timeline_(
        122  // TODO(kqyang): Need a better check. $Time is legitimate but not a
        123  // template.
        124  media_info.segment_template().find("$Time") == std::string::npos &&
        125  mpd_options_.mpd_params.allow_approximate_segment_timeline) {}
        126 
        128  const Representation& representation,
        129  std::unique_ptr<RepresentationStateChangeListener> state_change_listener)
        130  : Representation(representation.media_info_,
        131  representation.mpd_options_,
        132  representation.id_,
        133  std::move(state_change_listener)) {
        134  mime_type_ = representation.mime_type_;
        135  codecs_ = representation.codecs_;
        136 
        137  start_number_ = representation.start_number_;
        138  for (const SegmentInfo& segment_info : representation.segment_infos_)
        139  start_number_ += segment_info.repeat + 1;
        140 }
        141 
        142 Representation::~Representation() {}
        143 
        145  if (!AtLeastOneTrue(media_info_.has_video_info(),
        146  media_info_.has_audio_info(),
        147  media_info_.has_text_info())) {
        148  // This is an error. Segment information can be in AdaptationSet, Period, or
        149  // MPD but the interface does not provide a way to set them.
        150  // See 5.3.9.1 ISO 23009-1:2012 for segment info.
        151  LOG(ERROR) << "Representation needs one of video, audio, or text.";
        152  return false;
        153  }
        154 
        155  if (MoreThanOneTrue(media_info_.has_video_info(),
        156  media_info_.has_audio_info(),
        157  media_info_.has_text_info())) {
        158  LOG(ERROR) << "Only one of VideoInfo, AudioInfo, or TextInfo can be set.";
        159  return false;
        160  }
        161 
        162  if (media_info_.container_type() == MediaInfo::CONTAINER_UNKNOWN) {
        163  LOG(ERROR) << "'container_type' in MediaInfo cannot be CONTAINER_UNKNOWN.";
        164  return false;
        165  }
        166 
        167  if (media_info_.has_video_info()) {
        168  mime_type_ = GetVideoMimeType();
        169  if (!HasRequiredVideoFields(media_info_.video_info())) {
        170  LOG(ERROR) << "Missing required fields to create a video Representation.";
        171  return false;
        172  }
        173  } else if (media_info_.has_audio_info()) {
        174  mime_type_ = GetAudioMimeType();
        175  } else if (media_info_.has_text_info()) {
        176  mime_type_ = GetTextMimeType();
        177  }
        178 
        179  if (mime_type_.empty())
        180  return false;
        181 
        182  codecs_ = GetCodecs(media_info_);
        183  return true;
        184 }
        185 
        187  const ContentProtectionElement& content_protection_element) {
        188  content_protection_elements_.push_back(content_protection_element);
        189  RemoveDuplicateAttributes(&content_protection_elements_.back());
        190 }
        191 
        192 void Representation::UpdateContentProtectionPssh(const std::string& drm_uuid,
        193  const std::string& pssh) {
        194  UpdateContentProtectionPsshHelper(drm_uuid, pssh,
        195  &content_protection_elements_);
        196 }
        197 
        198 void Representation::AddNewSegment(uint64_t start_time,
        199  uint64_t duration,
        200  uint64_t size) {
        201  if (start_time == 0 && duration == 0) {
        202  LOG(WARNING) << "Got segment with start_time and duration == 0. Ignoring.";
        203  return;
        204  }
        205 
        206  if (state_change_listener_)
        207  state_change_listener_->OnNewSegmentForRepresentation(start_time, duration);
        208 
        209  AddSegmentInfo(start_time, duration);
        210 
        211  bandwidth_estimator_.AddBlock(
        212  size, static_cast<double>(duration) / media_info_.reference_time_scale());
        213 
        214  SlideWindow();
        215  DCHECK_GE(segment_infos_.size(), 1u);
        216 }
        217 
        218 void Representation::SetSampleDuration(uint32_t frame_duration) {
        219  // Sample duration is used to generate approximate SegmentTimeline.
        220  // Text is required to have exactly the same segment duration.
        221  if (media_info_.has_audio_info() || media_info_.has_video_info())
        222  frame_duration_ = frame_duration;
        223 
        224  if (media_info_.has_video_info()) {
        225  media_info_.mutable_video_info()->set_frame_duration(frame_duration);
        226  if (state_change_listener_) {
        227  state_change_listener_->OnSetFrameRateForRepresentation(
        228  frame_duration, media_info_.video_info().time_scale());
        229  }
        230  }
        231 }
        232 
        233 const MediaInfo& Representation::GetMediaInfo() const {
        234  return media_info_;
        235 }
        236 
        237 // Uses info in |media_info_| and |content_protection_elements_| to create a
        238 // "Representation" node.
        239 // MPD schema has strict ordering. The following must be done in order.
        240 // AddVideoInfo() (possibly adds FramePacking elements), AddAudioInfo() (Adds
        241 // AudioChannelConfig elements), AddContentProtectionElements*(), and
        242 // AddVODOnlyInfo() (Adds segment info).
        243 xml::scoped_xml_ptr<xmlNode> Representation::GetXml() {
        244  if (!HasRequiredMediaInfoFields()) {
        245  LOG(ERROR) << "MediaInfo missing required fields.";
        246  return xml::scoped_xml_ptr<xmlNode>();
        247  }
        248 
        249  const uint64_t bandwidth = media_info_.has_bandwidth()
        250  ? media_info_.bandwidth()
        251  : bandwidth_estimator_.Max();
        252 
        253  DCHECK(!(HasVODOnlyFields(media_info_) && HasLiveOnlyFields(media_info_)));
        254 
        255  xml::RepresentationXmlNode representation;
        256  // Mandatory fields for Representation.
        257  representation.SetId(id_);
        258  representation.SetIntegerAttribute("bandwidth", bandwidth);
        259  if (!codecs_.empty())
        260  representation.SetStringAttribute("codecs", codecs_);
        261  representation.SetStringAttribute("mimeType", mime_type_);
        262 
        263  const bool has_video_info = media_info_.has_video_info();
        264  const bool has_audio_info = media_info_.has_audio_info();
        265 
        266  if (has_video_info &&
        267  !representation.AddVideoInfo(
        268  media_info_.video_info(),
        269  !(output_suppression_flags_ & kSuppressWidth),
        270  !(output_suppression_flags_ & kSuppressHeight),
        271  !(output_suppression_flags_ & kSuppressFrameRate))) {
        272  LOG(ERROR) << "Failed to add video info to Representation XML.";
        273  return xml::scoped_xml_ptr<xmlNode>();
        274  }
        275 
        276  if (has_audio_info &&
        277  !representation.AddAudioInfo(media_info_.audio_info())) {
        278  LOG(ERROR) << "Failed to add audio info to Representation XML.";
        279  return xml::scoped_xml_ptr<xmlNode>();
        280  }
        281 
        282  if (!representation.AddContentProtectionElements(
        283  content_protection_elements_)) {
        284  return xml::scoped_xml_ptr<xmlNode>();
        285  }
        286 
        287  if (HasVODOnlyFields(media_info_) &&
        288  !representation.AddVODOnlyInfo(media_info_)) {
        289  LOG(ERROR) << "Failed to add VOD info.";
        290  return xml::scoped_xml_ptr<xmlNode>();
        291  }
        292 
        293  if (HasLiveOnlyFields(media_info_) &&
        294  !representation.AddLiveOnlyInfo(media_info_, segment_infos_,
        295  start_number_)) {
        296  LOG(ERROR) << "Failed to add Live info.";
        297  return xml::scoped_xml_ptr<xmlNode>();
        298  }
        299  // TODO(rkuroiwa): It is likely that all representations have the exact same
        300  // SegmentTemplate. Optimize and propagate the tag up to AdaptationSet level.
        301 
        302  output_suppression_flags_ = 0;
        303  return representation.PassScopedPtr();
        304 }
        305 
        306 void Representation::SuppressOnce(SuppressFlag flag) {
        307  output_suppression_flags_ |= flag;
        308 }
        309 
        311  double presentation_time_offset) {
        312  uint64_t pto = presentation_time_offset * media_info_.reference_time_scale();
        313  if (pto <= 0)
        314  return;
        315  media_info_.set_presentation_time_offset(pto);
        316 }
        317 
        319  double* start_timestamp_seconds,
        320  double* end_timestamp_seconds) const {
        321  if (segment_infos_.empty())
        322  return false;
        323 
        324  if (start_timestamp_seconds) {
        325  *start_timestamp_seconds =
        326  static_cast<double>(segment_infos_.begin()->start_time) /
        327  GetTimeScale(media_info_);
        328  }
        329  if (end_timestamp_seconds) {
        330  *end_timestamp_seconds =
        331  static_cast<double>(segment_infos_.rbegin()->start_time +
        332  segment_infos_.rbegin()->duration *
        333  (segment_infos_.rbegin()->repeat + 1)) /
        334  GetTimeScale(media_info_);
        335  }
        336  return true;
        337 }
        338 
        339 bool Representation::HasRequiredMediaInfoFields() const {
        340  if (HasVODOnlyFields(media_info_) && HasLiveOnlyFields(media_info_)) {
        341  LOG(ERROR) << "MediaInfo cannot have both VOD and Live fields.";
        342  return false;
        343  }
        344 
        345  if (!media_info_.has_container_type()) {
        346  LOG(ERROR) << "MediaInfo missing required field: container_type.";
        347  return false;
        348  }
        349 
        350  return true;
        351 }
        352 
        353 void Representation::AddSegmentInfo(uint64_t start_time, uint64_t duration) {
        354  const uint64_t kNoRepeat = 0;
        355  const uint64_t adjusted_duration = AdjustDuration(duration);
        356 
        357  if (!segment_infos_.empty()) {
        358  // Contiguous segment.
        359  const SegmentInfo& previous = segment_infos_.back();
        360  const uint64_t previous_segment_end_time =
        361  previous.start_time + previous.duration * (previous.repeat + 1);
        362  // Make it continuous if the segment start time is close to previous segment
        363  // end time.
        364  if (ApproximiatelyEqual(previous_segment_end_time, start_time)) {
        365  const uint64_t segment_end_time_for_same_duration =
        366  previous_segment_end_time + previous.duration;
        367  const uint64_t actual_segment_end_time = start_time + duration;
        368  // Consider the segments having identical duration if the segment end time
        369  // is close to calculated segment end time by assuming identical duration.
        370  if (ApproximiatelyEqual(segment_end_time_for_same_duration,
        371  actual_segment_end_time)) {
        372  ++segment_infos_.back().repeat;
        373  } else {
        374  segment_infos_.push_back(
        375  {previous_segment_end_time,
        376  actual_segment_end_time - previous_segment_end_time, kNoRepeat});
        377  }
        378  return;
        379  }
        380 
        381  // A gap since previous.
        382  const uint64_t kRoundingErrorGrace = 5;
        383  if (previous_segment_end_time + kRoundingErrorGrace < start_time) {
        384  LOG(WARNING) << "Found a gap of size "
        385  << (start_time - previous_segment_end_time)
        386  << " > kRoundingErrorGrace (" << kRoundingErrorGrace
        387  << "). The new segment starts at " << start_time
        388  << " but the previous segment ends at "
        389  << previous_segment_end_time << ".";
        390  }
        391 
        392  // No overlapping segments.
        393  if (start_time < previous_segment_end_time - kRoundingErrorGrace) {
        394  LOG(WARNING)
        395  << "Segments should not be overlapping. The new segment starts at "
        396  << start_time << " but the previous segment ends at "
        397  << previous_segment_end_time << ".";
        398  }
        399  }
        400 
        401  segment_infos_.push_back({start_time, adjusted_duration, kNoRepeat});
        402 }
        403 
        404 bool Representation::ApproximiatelyEqual(uint64_t time1, uint64_t time2) const {
        405  if (!allow_approximate_segment_timeline_)
        406  return time1 == time2;
        407 
        408  // It is not always possible to align segment duration to target duration
        409  // exactly. For example, for AAC with sampling rate of 44100, there are always
        410  // 1024 audio samples per frame, so the frame duration is 1024/44100. For a
        411  // target duration of 2 seconds, the closest segment duration would be 1.984
        412  // or 2.00533.
        413 
        414  // An arbitrary error threshold cap. This makes sure that the error is not too
        415  // large for large samples.
        416  const double kErrorThresholdSeconds = 0.05;
        417 
        418  // So we consider two times equal if they differ by less than one sample.
        419  const uint32_t error_threshold =
        420  std::min(frame_duration_,
        421  static_cast<uint32_t>(kErrorThresholdSeconds *
        422  media_info_.reference_time_scale()));
        423  return time1 < time2 + error_threshold && time2 < time1 + error_threshold;
        424 }
        425 
        426 uint64_t Representation::AdjustDuration(uint64_t duration) const {
        427  if (!allow_approximate_segment_timeline_)
        428  return duration;
        429  const uint64_t scaled_target_duration =
        430  mpd_options_.target_segment_duration * media_info_.reference_time_scale();
        431  return ApproximiatelyEqual(scaled_target_duration, duration)
        432  ? scaled_target_duration
        433  : duration;
        434 }
        435 
        436 void Representation::SlideWindow() {
        437  DCHECK(!segment_infos_.empty());
        438  if (mpd_options_.mpd_params.time_shift_buffer_depth <= 0.0 ||
        439  mpd_options_.mpd_type == MpdType::kStatic)
        440  return;
        441 
        442  const uint32_t time_scale = GetTimeScale(media_info_);
        443  DCHECK_GT(time_scale, 0u);
        444 
        445  uint64_t time_shift_buffer_depth = static_cast<uint64_t>(
        446  mpd_options_.mpd_params.time_shift_buffer_depth * time_scale);
        447 
        448  // The start time of the latest segment is considered the current_play_time,
        449  // and this should guarantee that the latest segment will stay in the list.
        450  const uint64_t current_play_time = LatestSegmentStartTime(segment_infos_);
        451  if (current_play_time <= time_shift_buffer_depth)
        452  return;
        453 
        454  const uint64_t timeshift_limit = current_play_time - time_shift_buffer_depth;
        455 
        456  // First remove all the SegmentInfos that are completely out of range, by
        457  // looking at the very last segment's end time.
        458  std::list<SegmentInfo>::iterator first = segment_infos_.begin();
        459  std::list<SegmentInfo>::iterator last = first;
        460  for (; last != segment_infos_.end(); ++last) {
        461  const uint64_t last_segment_end_time = LastSegmentEndTime(*last);
        462  if (timeshift_limit < last_segment_end_time)
        463  break;
        464  RemoveSegments(last->start_time, last->duration, last->repeat + 1);
        465  start_number_ += last->repeat + 1;
        466  }
        467  segment_infos_.erase(first, last);
        468 
        469  // Now some segment in the first SegmentInfo should be left in the list.
        470  SegmentInfo* first_segment_info = &segment_infos_.front();
        471  DCHECK_LE(timeshift_limit, LastSegmentEndTime(*first_segment_info));
        472 
        473  // Identify which segments should still be in the SegmentInfo.
        474  const uint64_t repeat_index =
        475  SearchTimedOutRepeatIndex(timeshift_limit, *first_segment_info);
        476  if (repeat_index == 0)
        477  return;
        478 
        479  RemoveSegments(first_segment_info->start_time, first_segment_info->duration,
        480  repeat_index);
        481 
        482  first_segment_info->start_time = first_segment_info->start_time +
        483  first_segment_info->duration * repeat_index;
        484  first_segment_info->repeat = first_segment_info->repeat - repeat_index;
        485  start_number_ += repeat_index;
        486 }
        487 
        488 void Representation::RemoveSegments(uint64_t start_time,
        489  uint64_t duration,
        490  uint64_t num_segments) {
        491  if (mpd_options_.mpd_params.preserved_segments_outside_live_window == 0)
        492  return;
        493 
        494  for (size_t i = 0; i < num_segments; ++i) {
        495  segments_to_be_removed_.push_back(media::GetSegmentName(
        496  media_info_.segment_template(), start_time + i * duration,
        497  start_number_ - 1 + i, media_info_.bandwidth()));
        498  }
        499  while (segments_to_be_removed_.size() >
        500  mpd_options_.mpd_params.preserved_segments_outside_live_window) {
        501  VLOG(2) << "Deleting " << segments_to_be_removed_.front();
        502  File::Delete(segments_to_be_removed_.front().c_str());
        503  segments_to_be_removed_.pop_front();
        504  }
        505 }
        506 
        507 std::string Representation::GetVideoMimeType() const {
        508  return GetMimeType("video", media_info_.container_type());
        509 }
        510 
        511 std::string Representation::GetAudioMimeType() const {
        512  return GetMimeType("audio", media_info_.container_type());
        513 }
        514 
        515 std::string Representation::GetTextMimeType() const {
        516  CHECK(media_info_.has_text_info());
        517  if (media_info_.text_info().codec() == "ttml") {
        518  switch (media_info_.container_type()) {
        519  case MediaInfo::CONTAINER_TEXT:
        520  return "application/ttml+xml";
        521  case MediaInfo::CONTAINER_MP4:
        522  return "application/mp4";
        523  default:
        524  LOG(ERROR) << "Failed to determine MIME type for TTML container: "
        525  << media_info_.container_type();
        526  return "";
        527  }
        528  }
        529  if (media_info_.text_info().codec() == "wvtt") {
        530  if (media_info_.container_type() == MediaInfo::CONTAINER_TEXT) {
        531  return "text/vtt";
        532  } else if (media_info_.container_type() == MediaInfo::CONTAINER_MP4) {
        533  return "application/mp4";
        534  }
        535  LOG(ERROR) << "Failed to determine MIME type for VTT container: "
        536  << media_info_.container_type();
        537  return "";
        538  }
        539 
        540  LOG(ERROR) << "Cannot determine MIME type for format: "
        541  << media_info_.text_info().codec()
        542  << " container: " << media_info_.container_type();
        543  return "";
        544 }
        545 
        546 } // namespace shaka
        bool AddVideoInfo(const MediaInfo::VideoInfo &video_info, bool set_width, bool set_height, bool set_frame_rate)
        Definition: xml_node.cc:266
        +
        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/representation.h"
        8 
        9 #include <gflags/gflags.h>
        10 
        11 #include <algorithm>
        12 
        13 #include "packager/base/logging.h"
        14 #include "packager/file/file.h"
        15 #include "packager/media/base/muxer_util.h"
        16 #include "packager/mpd/base/mpd_options.h"
        17 #include "packager/mpd/base/mpd_utils.h"
        18 #include "packager/mpd/base/xml/xml_node.h"
        19 
        20 namespace shaka {
        21 namespace {
        22 
        23 std::string GetMimeType(const std::string& prefix,
        24  MediaInfo::ContainerType container_type) {
        25  switch (container_type) {
        26  case MediaInfo::CONTAINER_MP4:
        27  return prefix + "/mp4";
        28  case MediaInfo::CONTAINER_MPEG2_TS:
        29  // NOTE: DASH MPD spec uses lowercase but RFC3555 says uppercase.
        30  return prefix + "/MP2T";
        31  case MediaInfo::CONTAINER_WEBM:
        32  return prefix + "/webm";
        33  default:
        34  break;
        35  }
        36 
        37  // Unsupported container types should be rejected/handled by the caller.
        38  LOG(ERROR) << "Unrecognized container type: " << container_type;
        39  return std::string();
        40 }
        41 
        42 // Check whether the video info has width and height.
        43 // DASH IOP also requires several other fields for video representations, namely
        44 // width, height, framerate, and sar.
        45 bool HasRequiredVideoFields(const MediaInfo_VideoInfo& video_info) {
        46  if (!video_info.has_height() || !video_info.has_width()) {
        47  LOG(ERROR)
        48  << "Width and height are required fields for generating a valid MPD.";
        49  return false;
        50  }
        51  // These fields are not required for a valid MPD, but required for DASH IOP
        52  // compliant MPD. MpdBuilder can keep generating MPDs without these fields.
        53  LOG_IF(WARNING, !video_info.has_time_scale())
        54  << "Video info does not contain timescale required for "
        55  "calculating framerate. @frameRate is required for DASH IOP.";
        56  LOG_IF(WARNING, !video_info.has_pixel_width())
        57  << "Video info does not contain pixel_width to calculate the sample "
        58  "aspect ratio required for DASH IOP.";
        59  LOG_IF(WARNING, !video_info.has_pixel_height())
        60  << "Video info does not contain pixel_height to calculate the sample "
        61  "aspect ratio required for DASH IOP.";
        62  return true;
        63 }
        64 
        65 uint32_t GetTimeScale(const MediaInfo& media_info) {
        66  if (media_info.has_reference_time_scale()) {
        67  return media_info.reference_time_scale();
        68  }
        69 
        70  if (media_info.has_video_info()) {
        71  return media_info.video_info().time_scale();
        72  }
        73 
        74  if (media_info.has_audio_info()) {
        75  return media_info.audio_info().time_scale();
        76  }
        77 
        78  LOG(WARNING) << "No timescale specified, using 1 as timescale.";
        79  return 1;
        80 }
        81 
        82 uint64_t LastSegmentStartTime(const SegmentInfo& segment_info) {
        83  return segment_info.start_time + segment_info.duration * segment_info.repeat;
        84 }
        85 
        86 // This is equal to |segment_info| end time
        87 uint64_t LastSegmentEndTime(const SegmentInfo& segment_info) {
        88  return segment_info.start_time +
        89  segment_info.duration * (segment_info.repeat + 1);
        90 }
        91 
        92 uint64_t LatestSegmentStartTime(const std::list<SegmentInfo>& segments) {
        93  DCHECK(!segments.empty());
        94  const SegmentInfo& latest_segment = segments.back();
        95  return LastSegmentStartTime(latest_segment);
        96 }
        97 
        98 // Given |timeshift_limit|, finds out the number of segments that are no longer
        99 // valid and should be removed from |segment_info|.
        100 uint64_t SearchTimedOutRepeatIndex(uint64_t timeshift_limit,
        101  const SegmentInfo& segment_info) {
        102  DCHECK_LE(timeshift_limit, LastSegmentEndTime(segment_info));
        103  if (timeshift_limit < segment_info.start_time)
        104  return 0;
        105 
        106  return (timeshift_limit - segment_info.start_time) / segment_info.duration;
        107 }
        108 
        109 } // namespace
        110 
        112  const MediaInfo& media_info,
        113  const MpdOptions& mpd_options,
        114  uint32_t id,
        115  std::unique_ptr<RepresentationStateChangeListener> state_change_listener)
        116  : media_info_(media_info),
        117  id_(id),
        118  bandwidth_estimator_(BandwidthEstimator::kUseAllBlocks),
        119  mpd_options_(mpd_options),
        120  state_change_listener_(std::move(state_change_listener)),
        121  allow_approximate_segment_timeline_(
        122  // TODO(kqyang): Need a better check. $Time is legitimate but not a
        123  // template.
        124  media_info.segment_template().find("$Time") == std::string::npos &&
        125  mpd_options_.mpd_params.allow_approximate_segment_timeline) {}
        126 
        128  const Representation& representation,
        129  std::unique_ptr<RepresentationStateChangeListener> state_change_listener)
        130  : Representation(representation.media_info_,
        131  representation.mpd_options_,
        132  representation.id_,
        133  std::move(state_change_listener)) {
        134  mime_type_ = representation.mime_type_;
        135  codecs_ = representation.codecs_;
        136 
        137  start_number_ = representation.start_number_;
        138  for (const SegmentInfo& segment_info : representation.segment_infos_)
        139  start_number_ += segment_info.repeat + 1;
        140 }
        141 
        142 Representation::~Representation() {}
        143 
        145  if (!AtLeastOneTrue(media_info_.has_video_info(),
        146  media_info_.has_audio_info(),
        147  media_info_.has_text_info())) {
        148  // This is an error. Segment information can be in AdaptationSet, Period, or
        149  // MPD but the interface does not provide a way to set them.
        150  // See 5.3.9.1 ISO 23009-1:2012 for segment info.
        151  LOG(ERROR) << "Representation needs one of video, audio, or text.";
        152  return false;
        153  }
        154 
        155  if (MoreThanOneTrue(media_info_.has_video_info(),
        156  media_info_.has_audio_info(),
        157  media_info_.has_text_info())) {
        158  LOG(ERROR) << "Only one of VideoInfo, AudioInfo, or TextInfo can be set.";
        159  return false;
        160  }
        161 
        162  if (media_info_.container_type() == MediaInfo::CONTAINER_UNKNOWN) {
        163  LOG(ERROR) << "'container_type' in MediaInfo cannot be CONTAINER_UNKNOWN.";
        164  return false;
        165  }
        166 
        167  if (media_info_.has_video_info()) {
        168  mime_type_ = GetVideoMimeType();
        169  if (!HasRequiredVideoFields(media_info_.video_info())) {
        170  LOG(ERROR) << "Missing required fields to create a video Representation.";
        171  return false;
        172  }
        173  } else if (media_info_.has_audio_info()) {
        174  mime_type_ = GetAudioMimeType();
        175  } else if (media_info_.has_text_info()) {
        176  mime_type_ = GetTextMimeType();
        177  }
        178 
        179  if (mime_type_.empty())
        180  return false;
        181 
        182  codecs_ = GetCodecs(media_info_);
        183  return true;
        184 }
        185 
        187  const ContentProtectionElement& content_protection_element) {
        188  content_protection_elements_.push_back(content_protection_element);
        189  RemoveDuplicateAttributes(&content_protection_elements_.back());
        190 }
        191 
        192 void Representation::UpdateContentProtectionPssh(const std::string& drm_uuid,
        193  const std::string& pssh) {
        194  UpdateContentProtectionPsshHelper(drm_uuid, pssh,
        195  &content_protection_elements_);
        196 }
        197 
        198 void Representation::AddNewSegment(uint64_t start_time,
        199  uint64_t duration,
        200  uint64_t size) {
        201  if (start_time == 0 && duration == 0) {
        202  LOG(WARNING) << "Got segment with start_time and duration == 0. Ignoring.";
        203  return;
        204  }
        205 
        206  if (state_change_listener_)
        207  state_change_listener_->OnNewSegmentForRepresentation(start_time, duration);
        208 
        209  AddSegmentInfo(start_time, duration);
        210 
        211  bandwidth_estimator_.AddBlock(
        212  size, static_cast<double>(duration) / media_info_.reference_time_scale());
        213 
        214  SlideWindow();
        215  DCHECK_GE(segment_infos_.size(), 1u);
        216 }
        217 
        218 void Representation::SetSampleDuration(uint32_t frame_duration) {
        219  // Sample duration is used to generate approximate SegmentTimeline.
        220  // Text is required to have exactly the same segment duration.
        221  if (media_info_.has_audio_info() || media_info_.has_video_info())
        222  frame_duration_ = frame_duration;
        223 
        224  if (media_info_.has_video_info()) {
        225  media_info_.mutable_video_info()->set_frame_duration(frame_duration);
        226  if (state_change_listener_) {
        227  state_change_listener_->OnSetFrameRateForRepresentation(
        228  frame_duration, media_info_.video_info().time_scale());
        229  }
        230  }
        231 }
        232 
        233 const MediaInfo& Representation::GetMediaInfo() const {
        234  return media_info_;
        235 }
        236 
        237 // Uses info in |media_info_| and |content_protection_elements_| to create a
        238 // "Representation" node.
        239 // MPD schema has strict ordering. The following must be done in order.
        240 // AddVideoInfo() (possibly adds FramePacking elements), AddAudioInfo() (Adds
        241 // AudioChannelConfig elements), AddContentProtectionElements*(), and
        242 // AddVODOnlyInfo() (Adds segment info).
        243 xml::scoped_xml_ptr<xmlNode> Representation::GetXml() {
        244  if (!HasRequiredMediaInfoFields()) {
        245  LOG(ERROR) << "MediaInfo missing required fields.";
        246  return xml::scoped_xml_ptr<xmlNode>();
        247  }
        248 
        249  const uint64_t bandwidth = media_info_.has_bandwidth()
        250  ? media_info_.bandwidth()
        251  : bandwidth_estimator_.Max();
        252 
        253  DCHECK(!(HasVODOnlyFields(media_info_) && HasLiveOnlyFields(media_info_)));
        254 
        255  xml::RepresentationXmlNode representation;
        256  // Mandatory fields for Representation.
        257  representation.SetId(id_);
        258  representation.SetIntegerAttribute("bandwidth", bandwidth);
        259  if (!codecs_.empty())
        260  representation.SetStringAttribute("codecs", codecs_);
        261  representation.SetStringAttribute("mimeType", mime_type_);
        262 
        263  const bool has_video_info = media_info_.has_video_info();
        264  const bool has_audio_info = media_info_.has_audio_info();
        265 
        266  if (has_video_info &&
        267  !representation.AddVideoInfo(
        268  media_info_.video_info(),
        269  !(output_suppression_flags_ & kSuppressWidth),
        270  !(output_suppression_flags_ & kSuppressHeight),
        271  !(output_suppression_flags_ & kSuppressFrameRate))) {
        272  LOG(ERROR) << "Failed to add video info to Representation XML.";
        273  return xml::scoped_xml_ptr<xmlNode>();
        274  }
        275 
        276  if (has_audio_info &&
        277  !representation.AddAudioInfo(media_info_.audio_info())) {
        278  LOG(ERROR) << "Failed to add audio info to Representation XML.";
        279  return xml::scoped_xml_ptr<xmlNode>();
        280  }
        281 
        282  if (!representation.AddContentProtectionElements(
        283  content_protection_elements_)) {
        284  return xml::scoped_xml_ptr<xmlNode>();
        285  }
        286 
        287  if (HasVODOnlyFields(media_info_) &&
        288  !representation.AddVODOnlyInfo(media_info_)) {
        289  LOG(ERROR) << "Failed to add VOD info.";
        290  return xml::scoped_xml_ptr<xmlNode>();
        291  }
        292 
        293  if (HasLiveOnlyFields(media_info_) &&
        294  !representation.AddLiveOnlyInfo(media_info_, segment_infos_,
        295  start_number_)) {
        296  LOG(ERROR) << "Failed to add Live info.";
        297  return xml::scoped_xml_ptr<xmlNode>();
        298  }
        299  // TODO(rkuroiwa): It is likely that all representations have the exact same
        300  // SegmentTemplate. Optimize and propagate the tag up to AdaptationSet level.
        301 
        302  output_suppression_flags_ = 0;
        303  return representation.PassScopedPtr();
        304 }
        305 
        306 void Representation::SuppressOnce(SuppressFlag flag) {
        307  output_suppression_flags_ |= flag;
        308 }
        309 
        311  double presentation_time_offset) {
        312  uint64_t pto = presentation_time_offset * media_info_.reference_time_scale();
        313  if (pto <= 0)
        314  return;
        315  media_info_.set_presentation_time_offset(pto);
        316 }
        317 
        319  double* start_timestamp_seconds,
        320  double* end_timestamp_seconds) const {
        321  if (segment_infos_.empty())
        322  return false;
        323 
        324  if (start_timestamp_seconds) {
        325  *start_timestamp_seconds =
        326  static_cast<double>(segment_infos_.begin()->start_time) /
        327  GetTimeScale(media_info_);
        328  }
        329  if (end_timestamp_seconds) {
        330  *end_timestamp_seconds =
        331  static_cast<double>(segment_infos_.rbegin()->start_time +
        332  segment_infos_.rbegin()->duration *
        333  (segment_infos_.rbegin()->repeat + 1)) /
        334  GetTimeScale(media_info_);
        335  }
        336  return true;
        337 }
        338 
        339 bool Representation::HasRequiredMediaInfoFields() const {
        340  if (HasVODOnlyFields(media_info_) && HasLiveOnlyFields(media_info_)) {
        341  LOG(ERROR) << "MediaInfo cannot have both VOD and Live fields.";
        342  return false;
        343  }
        344 
        345  if (!media_info_.has_container_type()) {
        346  LOG(ERROR) << "MediaInfo missing required field: container_type.";
        347  return false;
        348  }
        349 
        350  return true;
        351 }
        352 
        353 void Representation::AddSegmentInfo(uint64_t start_time, uint64_t duration) {
        354  const uint64_t kNoRepeat = 0;
        355  const uint64_t adjusted_duration = AdjustDuration(duration);
        356 
        357  if (!segment_infos_.empty()) {
        358  // Contiguous segment.
        359  const SegmentInfo& previous = segment_infos_.back();
        360  const uint64_t previous_segment_end_time =
        361  previous.start_time + previous.duration * (previous.repeat + 1);
        362  // Make it continuous if the segment start time is close to previous segment
        363  // end time.
        364  if (ApproximiatelyEqual(previous_segment_end_time, start_time)) {
        365  const uint64_t segment_end_time_for_same_duration =
        366  previous_segment_end_time + previous.duration;
        367  const uint64_t actual_segment_end_time = start_time + duration;
        368  // Consider the segments having identical duration if the segment end time
        369  // is close to calculated segment end time by assuming identical duration.
        370  if (ApproximiatelyEqual(segment_end_time_for_same_duration,
        371  actual_segment_end_time)) {
        372  ++segment_infos_.back().repeat;
        373  } else {
        374  segment_infos_.push_back(
        375  {previous_segment_end_time,
        376  actual_segment_end_time - previous_segment_end_time, kNoRepeat});
        377  }
        378  return;
        379  }
        380 
        381  // A gap since previous.
        382  const uint64_t kRoundingErrorGrace = 5;
        383  if (previous_segment_end_time + kRoundingErrorGrace < start_time) {
        384  LOG(WARNING) << "Found a gap of size "
        385  << (start_time - previous_segment_end_time)
        386  << " > kRoundingErrorGrace (" << kRoundingErrorGrace
        387  << "). The new segment starts at " << start_time
        388  << " but the previous segment ends at "
        389  << previous_segment_end_time << ".";
        390  }
        391 
        392  // No overlapping segments.
        393  if (start_time < previous_segment_end_time - kRoundingErrorGrace) {
        394  LOG(WARNING)
        395  << "Segments should not be overlapping. The new segment starts at "
        396  << start_time << " but the previous segment ends at "
        397  << previous_segment_end_time << ".";
        398  }
        399  }
        400 
        401  segment_infos_.push_back({start_time, adjusted_duration, kNoRepeat});
        402 }
        403 
        404 bool Representation::ApproximiatelyEqual(uint64_t time1, uint64_t time2) const {
        405  if (!allow_approximate_segment_timeline_)
        406  return time1 == time2;
        407 
        408  // It is not always possible to align segment duration to target duration
        409  // exactly. For example, for AAC with sampling rate of 44100, there are always
        410  // 1024 audio samples per frame, so the frame duration is 1024/44100. For a
        411  // target duration of 2 seconds, the closest segment duration would be 1.984
        412  // or 2.00533.
        413 
        414  // An arbitrary error threshold cap. This makes sure that the error is not too
        415  // large for large samples.
        416  const double kErrorThresholdSeconds = 0.05;
        417 
        418  // So we consider two times equal if they differ by less than one sample.
        419  const uint32_t error_threshold =
        420  std::min(frame_duration_,
        421  static_cast<uint32_t>(kErrorThresholdSeconds *
        422  media_info_.reference_time_scale()));
        423  return time1 <= time2 + error_threshold && time2 <= time1 + error_threshold;
        424 }
        425 
        426 uint64_t Representation::AdjustDuration(uint64_t duration) const {
        427  if (!allow_approximate_segment_timeline_)
        428  return duration;
        429  const uint64_t scaled_target_duration =
        430  mpd_options_.target_segment_duration * media_info_.reference_time_scale();
        431  return ApproximiatelyEqual(scaled_target_duration, duration)
        432  ? scaled_target_duration
        433  : duration;
        434 }
        435 
        436 void Representation::SlideWindow() {
        437  DCHECK(!segment_infos_.empty());
        438  if (mpd_options_.mpd_params.time_shift_buffer_depth <= 0.0 ||
        439  mpd_options_.mpd_type == MpdType::kStatic)
        440  return;
        441 
        442  const uint32_t time_scale = GetTimeScale(media_info_);
        443  DCHECK_GT(time_scale, 0u);
        444 
        445  uint64_t time_shift_buffer_depth = static_cast<uint64_t>(
        446  mpd_options_.mpd_params.time_shift_buffer_depth * time_scale);
        447 
        448  // The start time of the latest segment is considered the current_play_time,
        449  // and this should guarantee that the latest segment will stay in the list.
        450  const uint64_t current_play_time = LatestSegmentStartTime(segment_infos_);
        451  if (current_play_time <= time_shift_buffer_depth)
        452  return;
        453 
        454  const uint64_t timeshift_limit = current_play_time - time_shift_buffer_depth;
        455 
        456  // First remove all the SegmentInfos that are completely out of range, by
        457  // looking at the very last segment's end time.
        458  std::list<SegmentInfo>::iterator first = segment_infos_.begin();
        459  std::list<SegmentInfo>::iterator last = first;
        460  for (; last != segment_infos_.end(); ++last) {
        461  const uint64_t last_segment_end_time = LastSegmentEndTime(*last);
        462  if (timeshift_limit < last_segment_end_time)
        463  break;
        464  RemoveSegments(last->start_time, last->duration, last->repeat + 1);
        465  start_number_ += last->repeat + 1;
        466  }
        467  segment_infos_.erase(first, last);
        468 
        469  // Now some segment in the first SegmentInfo should be left in the list.
        470  SegmentInfo* first_segment_info = &segment_infos_.front();
        471  DCHECK_LE(timeshift_limit, LastSegmentEndTime(*first_segment_info));
        472 
        473  // Identify which segments should still be in the SegmentInfo.
        474  const uint64_t repeat_index =
        475  SearchTimedOutRepeatIndex(timeshift_limit, *first_segment_info);
        476  if (repeat_index == 0)
        477  return;
        478 
        479  RemoveSegments(first_segment_info->start_time, first_segment_info->duration,
        480  repeat_index);
        481 
        482  first_segment_info->start_time = first_segment_info->start_time +
        483  first_segment_info->duration * repeat_index;
        484  first_segment_info->repeat = first_segment_info->repeat - repeat_index;
        485  start_number_ += repeat_index;
        486 }
        487 
        488 void Representation::RemoveSegments(uint64_t start_time,
        489  uint64_t duration,
        490  uint64_t num_segments) {
        491  if (mpd_options_.mpd_params.preserved_segments_outside_live_window == 0)
        492  return;
        493 
        494  for (size_t i = 0; i < num_segments; ++i) {
        495  segments_to_be_removed_.push_back(media::GetSegmentName(
        496  media_info_.segment_template(), start_time + i * duration,
        497  start_number_ - 1 + i, media_info_.bandwidth()));
        498  }
        499  while (segments_to_be_removed_.size() >
        500  mpd_options_.mpd_params.preserved_segments_outside_live_window) {
        501  VLOG(2) << "Deleting " << segments_to_be_removed_.front();
        502  File::Delete(segments_to_be_removed_.front().c_str());
        503  segments_to_be_removed_.pop_front();
        504  }
        505 }
        506 
        507 std::string Representation::GetVideoMimeType() const {
        508  return GetMimeType("video", media_info_.container_type());
        509 }
        510 
        511 std::string Representation::GetAudioMimeType() const {
        512  return GetMimeType("audio", media_info_.container_type());
        513 }
        514 
        515 std::string Representation::GetTextMimeType() const {
        516  CHECK(media_info_.has_text_info());
        517  if (media_info_.text_info().codec() == "ttml") {
        518  switch (media_info_.container_type()) {
        519  case MediaInfo::CONTAINER_TEXT:
        520  return "application/ttml+xml";
        521  case MediaInfo::CONTAINER_MP4:
        522  return "application/mp4";
        523  default:
        524  LOG(ERROR) << "Failed to determine MIME type for TTML container: "
        525  << media_info_.container_type();
        526  return "";
        527  }
        528  }
        529  if (media_info_.text_info().codec() == "wvtt") {
        530  if (media_info_.container_type() == MediaInfo::CONTAINER_TEXT) {
        531  return "text/vtt";
        532  } else if (media_info_.container_type() == MediaInfo::CONTAINER_MP4) {
        533  return "application/mp4";
        534  }
        535  LOG(ERROR) << "Failed to determine MIME type for VTT container: "
        536  << media_info_.container_type();
        537  return "";
        538  }
        539 
        540  LOG(ERROR) << "Cannot determine MIME type for format: "
        541  << media_info_.text_info().codec()
        542  << " container: " << media_info_.container_type();
        543  return "";
        544 }
        545 
        546 } // namespace shaka
        bool AddVideoInfo(const MediaInfo::VideoInfo &video_info, bool set_width, bool set_height, bool set_frame_rate)
        Definition: xml_node.cc:266
        virtual const MediaInfo & GetMediaInfo() const
        RepresentationType in MPD.
        Definition: xml_node.h:139
        virtual void AddNewSegment(uint64_t start_time, uint64_t duration, uint64_t size)
        @@ -87,7 +87,7 @@ $(function() {
        void SetId(uint32_t id)
        Definition: xml_node.cc:160
        xml::scoped_xml_ptr< xmlNode > GetXml()
        void SetPresentationTimeOffset(double presentation_time_offset)
        Set in SegmentBase / SegmentTemplate.
        - +
        double target_segment_duration
        Definition: mpd_options.h:33
        virtual void AddContentProtectionElement(const ContentProtectionElement &element)
        @@ -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 a60ac56575..c829792f21 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 cc2aae1378..89bd8a910b 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 56822be84e..bbc594e34d 100644 --- a/docs/d7/da4/track__run__iterator_8h_source.html +++ b/docs/d7/da4/track__run__iterator_8h_source.html @@ -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 78607a56a6..4dc580426c 100644 --- a/docs/d7/dad/simple__hls__notifier_8cc_source.html +++ b/docs/d7/dad/simple__hls__notifier_8cc_source.html @@ -77,7 +77,7 @@ $(function() {
        bool NotifyCueEvent(uint32_t container_id, uint64_t timestamp) override
        const HlsParams & hls_params() const
        Definition: hls_notifier.h:95
        -
        Methods are virtual for mocking.
        +
        Methods are virtual for mocking.
        static std::unique_ptr< PsshBoxBuilder > ParseFromBox(const uint8_t *data, size_t data_size)
        bool NotifyNewStream(const MediaInfo &media_info, const std::string &playlist_name, const std::string &stream_name, const std::string &group_id, uint32_t *stream_id) override
        std::string default_language
        Definition: hls_params.h:48
        @@ -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 78f55794ef..626f1b15b2 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 @@ -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 e692788261..5c25f61930 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 6aab2b3742..8eaf8c01ea 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 c9fdb57226..c87bc87bbe 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 db2dd31708..685b2f501b 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 @@ -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 836e7d5f5e..78c77f0b7c 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 2009097d91..7decd9f99a 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 ac01975aaf..0d81564452 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 4a26f8c4b1..ac835345eb 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 be7153b2d7..f414c8cc3a 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 6808a6262d..d90fcccb3e 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 efb50a867a..85ad3ebd85 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 07c578bd7d..b3f1b19a6f 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 cb1a0ad09e..750d31a7fb 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 a14053c4fe..de46ef1bdf 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 @@ -96,7 +96,7 @@ uint32_t group_description 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 5cbf9546b4..e927fd9aa4 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 9c9c63f9d8..5a35759f0e 100644 --- a/docs/d7/dee/mpd__generator_8cc_source.html +++ b/docs/d7/dee/mpd__generator_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d7/def/mp4__media__parser_8cc_source.html b/docs/d7/def/mp4__media__parser_8cc_source.html index 4ece257c47..907029b650 100644 --- a/docs/d7/def/mp4__media__parser_8cc_source.html +++ b/docs/d7/def/mp4__media__parser_8cc_source.html @@ -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 ddf2ed5757..e15fc15016 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 1f1427da56..67b07feb2b 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 8643ad75ba..320a5083fa 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 d4fe0c00c0..295cf191a7 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 863de8bffe..ed542b1fa8 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 dbb1c8b7f0..1aeed92fbb 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 index 23894fcabf..7314683112 100644 --- a/docs/d8/d0c/webvtt__text__output__handler_8h_source.html +++ b/docs/d8/d0c/webvtt__text__output__handler_8h_source.html @@ -67,9 +67,9 @@ $(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_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
        +
        Abstract class holds stream information.
        Definition: stream_info.h:61
        - +
        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/d8/d0d/media__sample_8cc_source.html b/docs/d8/d0d/media__sample_8cc_source.html index 33df8e04f0..9619447deb 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 5a357a1ac6..46b2d910db 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 b38f77069c..535e841370 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 @@ -88,7 +88,7 @@ uint32_t sample_delta< 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 2cb765b9e0..3270248d5e 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 cf94c6897e..c884d2b0eb 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 c9e11fee20..f84c81a18d 100644 --- a/docs/d8/d16/structshaka_1_1media_1_1MuxerOptions-members.html +++ b/docs/d8/d16/structshaka_1_1media_1_1MuxerOptions-members.html @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/d8/d19/bandwidth__estimator_8h_source.html b/docs/d8/d19/bandwidth__estimator_8h_source.html index 8f61e7217a..7b4b39fe73 100644 --- a/docs/d8/d19/bandwidth__estimator_8h_source.html +++ b/docs/d8/d19/bandwidth__estimator_8h_source.html @@ -70,12 +70,12 @@ $(function() {
        All the methods that are virtual are virtual for mocking.
        void AddBlock(uint64_t size, double duration)
        - - + + diff --git a/docs/d8/d1c/crypto__flags_8cc_source.html b/docs/d8/d1c/crypto__flags_8cc_source.html index 1c5adb3d8b..f55d996634 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 afcae771c2..f5ef879dd6 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 @@ -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 eeaef2ed35..f3121f8672 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 af24495053..388a1bcee0 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 6084efe1ae..a88ff854ff 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 3f22bfeada..6cc3295724 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 68cffbcb2b..f2146ab376 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 0578d81ead..4034698528 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 6a8b1e83a1..ead4d4fba7 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 376cea87dc..1075786071 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 e237e0aea3..0c2494bb4d 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 @@ -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 20222c4727..4e894c37bf 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 a838d77c25..5437691600 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 26f5902652..cfa6fd07ca 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 47133ca0cb..281d65b79b 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 @@ -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 63477e2f23..9cb3482e38 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 9c10c8c0ba..01b4820145 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 20472c5adc..24794ec7a8 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 8f2889777a..a0a33b1073 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 b7f8f6e393..5b4fa34c89 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 baf7fc1f48..1a16f77efe 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 76d92a88aa..7bea4bd945 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 31ad8a4dee..38974dff09 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 c7b09ff434..45e6600689 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 b3cf3f7e8c..4f9a8de702 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 68308525df..60be90835b 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 1053c6c6ed..536b03ae53 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 cd0ad6b678..b6a588cd47 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 2a77008e51..4a204898e7 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 5f185c2eab..e2f8d0eaf2 100644 --- a/docs/d8/d9a/fragmenter_8cc_source.html +++ b/docs/d8/d9a/fragmenter_8cc_source.html @@ -87,7 +87,7 @@ $(function() { diff --git a/docs/d8/d9c/webm__tracks__parser_8cc_source.html b/docs/d8/d9c/webm__tracks__parser_8cc_source.html index 89b6db9b90..efa23ee0db 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 accff9f4ee..cadc7f8eff 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 1e0fdaa82b..d37b2e4921 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 9d7c7d7933..219b244c5c 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 ed0557b6cc..714f5433ea 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 0bf73d610b..8fe01b241a 100644 --- a/docs/d8/daa/stream__info_8h_source.html +++ b/docs/d8/daa/stream__info_8h_source.html @@ -66,16 +66,16 @@ $(function() {
        stream_info.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_STREAM_INFO_H_
        8 #define PACKAGER_MEDIA_BASE_STREAM_INFO_H_
        9 
        10 #include <memory>
        11 #include <string>
        12 #include <vector>
        13 
        14 #include "packager/media/base/encryption_config.h"
        15 
        16 namespace shaka {
        17 namespace media {
        18 
        19 enum StreamType {
        20  kStreamUnknown = 0,
        21  kStreamAudio,
        22  kStreamVideo,
        23  kStreamText,
        24 };
        25 
        26 enum Codec {
        27  kUnknownCodec = 0,
        28 
        29  kCodecVideo = 100,
        30  kCodecH264 = kCodecVideo,
        31  kCodecH265,
        32  kCodecVP8,
        33  kCodecVP9,
        34  kCodecVP10,
        35  kCodecVideoMaxPlusOne,
        36 
        37  kCodecAudio = 200,
        38  kCodecAAC = kCodecAudio,
        39  kCodecAC3,
        40  // TODO(kqyang): Use kCodecDTS and a kDtsStreamFormat for the various DTS
        41  // streams.
        42  kCodecDTSC,
        43  kCodecDTSE,
        44  kCodecDTSH,
        45  kCodecDTSL,
        46  kCodecDTSM,
        47  kCodecDTSP,
        48  kCodecEAC3,
        49  kCodecFlac,
        50  kCodecOpus,
        51  kCodecVorbis,
        52  kCodecAudioMaxPlusOne,
        53 
        54  kCodecText = 300,
        55  kCodecWebVtt = kCodecText,
        56 };
        57 
        59 class StreamInfo {
        60  public:
        61  StreamInfo() = default;
        62 
        63  StreamInfo(StreamType stream_type, int track_id, uint32_t time_scale,
        64  uint64_t duration, Codec codec, const std::string& codec_string,
        65  const uint8_t* codec_config, size_t codec_config_size,
        66  const std::string& language, bool is_encrypted);
        67 
        68  virtual ~StreamInfo();
        69 
        72  virtual bool IsValidConfig() const = 0;
        73 
        75  virtual std::string ToString() const;
        76 
        80  virtual std::unique_ptr<StreamInfo> Clone() const = 0;
        81 
        82  StreamType stream_type() const { return stream_type_; }
        83  uint32_t track_id() const { return track_id_; }
        84  uint32_t time_scale() const { return time_scale_; }
        85  uint64_t duration() const { return duration_; }
        86  Codec codec() const { return codec_; }
        87  const std::string& codec_string() const { return codec_string_; }
        88  const std::vector<uint8_t>& codec_config() const { return codec_config_; }
        89  const std::string& language() const { return language_; }
        90  bool is_encrypted() const { return is_encrypted_; }
        91  bool has_clear_lead() const { return has_clear_lead_; }
        92  const EncryptionConfig& encryption_config() const {
        93  return encryption_config_;
        94  }
        95 
        96  void set_duration(uint64_t duration) { duration_ = duration; }
        97  void set_codec(Codec codec) { codec_ = codec; }
        98  void set_codec_config(const std::vector<uint8_t>& data) { codec_config_ = data; }
        99  void set_codec_string(const std::string& codec_string) {
        100  codec_string_ = codec_string;
        101  }
        102  void set_language(const std::string& language) { language_ = language; }
        103  void set_is_encrypted(bool is_encrypted) { is_encrypted_ = is_encrypted; }
        104  void set_has_clear_lead(bool has_clear_lead) {
        105  has_clear_lead_ = has_clear_lead;
        106  }
        107  void set_encryption_config(const EncryptionConfig& encryption_config) {
        108  encryption_config_ = encryption_config;
        109  }
        110 
        111  private:
        112  // Whether the stream is Audio or Video.
        113  StreamType stream_type_;
        114  uint32_t track_id_;
        115  // The actual time is calculated as time / time_scale_ in seconds.
        116  uint32_t time_scale_;
        117  // Duration base on time_scale.
        118  uint64_t duration_;
        119  Codec codec_;
        120  std::string codec_string_;
        121  std::string language_;
        122  // Whether the stream is potentially encrypted.
        123  // Note that in a potentially encrypted stream, individual buffers
        124  // can be encrypted or not encrypted.
        125  bool is_encrypted_;
        126  // Whether the stream has clear lead.
        127  bool has_clear_lead_ = false;
        128  EncryptionConfig encryption_config_;
        129  // Optional byte data required for some audio/video decoders such as Vorbis
        130  // codebooks.
        131  std::vector<uint8_t> codec_config_;
        132 
        133  // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
        134  // generated copy constructor and assignment operator. Since the extra data is
        135  // typically small, the performance impact is minimal.
        136 };
        137 
        138 } // namespace media
        139 } // namespace shaka
        140 
        141 #endif // PACKAGER_MEDIA_BASE_STREAM_INFO_H_
        Abstract class holds stream information.
        Definition: stream_info.h:59
        +
        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_STREAM_INFO_H_
        8 #define PACKAGER_MEDIA_BASE_STREAM_INFO_H_
        9 
        10 #include <memory>
        11 #include <string>
        12 #include <vector>
        13 
        14 #include "packager/media/base/encryption_config.h"
        15 
        16 namespace shaka {
        17 namespace media {
        18 
        19 enum StreamType {
        20  kStreamUnknown = 0,
        21  kStreamAudio,
        22  kStreamVideo,
        23  kStreamText,
        24 };
        25 
        26 std::string StreamTypeToString(StreamType type);
        27 
        28 enum Codec {
        29  kUnknownCodec = 0,
        30 
        31  kCodecVideo = 100,
        32  kCodecH264 = kCodecVideo,
        33  kCodecH265,
        34  kCodecVP8,
        35  kCodecVP9,
        36  kCodecVP10,
        37  kCodecVideoMaxPlusOne,
        38 
        39  kCodecAudio = 200,
        40  kCodecAAC = kCodecAudio,
        41  kCodecAC3,
        42  // TODO(kqyang): Use kCodecDTS and a kDtsStreamFormat for the various DTS
        43  // streams.
        44  kCodecDTSC,
        45  kCodecDTSE,
        46  kCodecDTSH,
        47  kCodecDTSL,
        48  kCodecDTSM,
        49  kCodecDTSP,
        50  kCodecEAC3,
        51  kCodecFlac,
        52  kCodecOpus,
        53  kCodecVorbis,
        54  kCodecAudioMaxPlusOne,
        55 
        56  kCodecText = 300,
        57  kCodecWebVtt = kCodecText,
        58 };
        59 
        61 class StreamInfo {
        62  public:
        63  StreamInfo() = default;
        64 
        65  StreamInfo(StreamType stream_type,
        66  int track_id,
        67  uint32_t time_scale,
        68  uint64_t duration,
        69  Codec codec,
        70  const std::string& codec_string,
        71  const uint8_t* codec_config,
        72  size_t codec_config_size,
        73  const std::string& language,
        74  bool is_encrypted);
        75 
        76  virtual ~StreamInfo();
        77 
        80  virtual bool IsValidConfig() const = 0;
        81 
        83  virtual std::string ToString() const;
        84 
        88  virtual std::unique_ptr<StreamInfo> Clone() const = 0;
        89 
        90  StreamType stream_type() const { return stream_type_; }
        91  uint32_t track_id() const { return track_id_; }
        92  uint32_t time_scale() const { return time_scale_; }
        93  uint64_t duration() const { return duration_; }
        94  Codec codec() const { return codec_; }
        95  const std::string& codec_string() const { return codec_string_; }
        96  const std::vector<uint8_t>& codec_config() const { return codec_config_; }
        97  const std::string& language() const { return language_; }
        98  bool is_encrypted() const { return is_encrypted_; }
        99  bool has_clear_lead() const { return has_clear_lead_; }
        100  const EncryptionConfig& encryption_config() const {
        101  return encryption_config_;
        102  }
        103 
        104  void set_duration(uint64_t duration) { duration_ = duration; }
        105  void set_codec(Codec codec) { codec_ = codec; }
        106  void set_codec_config(const std::vector<uint8_t>& data) {
        107  codec_config_ = data;
        108  }
        109  void set_codec_string(const std::string& codec_string) {
        110  codec_string_ = codec_string;
        111  }
        112  void set_language(const std::string& language) { language_ = language; }
        113  void set_is_encrypted(bool is_encrypted) { is_encrypted_ = is_encrypted; }
        114  void set_has_clear_lead(bool has_clear_lead) {
        115  has_clear_lead_ = has_clear_lead;
        116  }
        117  void set_encryption_config(const EncryptionConfig& encryption_config) {
        118  encryption_config_ = encryption_config;
        119  }
        120 
        121  private:
        122  // Whether the stream is Audio or Video.
        123  StreamType stream_type_;
        124  uint32_t track_id_;
        125  // The actual time is calculated as time / time_scale_ in seconds.
        126  uint32_t time_scale_;
        127  // Duration base on time_scale.
        128  uint64_t duration_;
        129  Codec codec_;
        130  std::string codec_string_;
        131  std::string language_;
        132  // Whether the stream is potentially encrypted.
        133  // Note that in a potentially encrypted stream, individual buffers
        134  // can be encrypted or not encrypted.
        135  bool is_encrypted_;
        136  // Whether the stream has clear lead.
        137  bool has_clear_lead_ = false;
        138  EncryptionConfig encryption_config_;
        139  // Optional byte data required for some audio/video decoders such as Vorbis
        140  // codebooks.
        141  std::vector<uint8_t> codec_config_;
        142 
        143  // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
        144  // generated copy constructor and assignment operator. Since the extra data is
        145  // typically small, the performance impact is minimal.
        146 };
        147 
        148 } // namespace media
        149 } // namespace shaka
        150 
        151 #endif // PACKAGER_MEDIA_BASE_STREAM_INFO_H_
        Abstract class holds stream information.
        Definition: stream_info.h:61
        virtual std::unique_ptr< StreamInfo > Clone() const =0
        virtual bool IsValidConfig() const =0
        -
        virtual std::string ToString() const
        Definition: stream_info.cc:37
        +
        virtual std::string ToString() const
        Definition: stream_info.cc:58
        All the methods that are virtual are virtual for mocking.
        diff --git a/docs/d8/daf/namespaceshaka.html b/docs/d8/daf/namespaceshaka.html index 2a6772bb5c..b3de9cd566 100644 --- a/docs/d8/daf/namespaceshaka.html +++ b/docs/d8/daf/namespaceshaka.html @@ -406,7 +406,7 @@ const char kPsshElementNam -

        Definition at line 369 of file mpd_utils.cc.

        +

        Definition at line 380 of file mpd_utils.cc.

        @@ -443,7 +443,7 @@ const char kPsshElementNam -

        Definition at line 374 of file mpd_utils.cc.

        +

        Definition at line 385 of file mpd_utils.cc.

        @@ -507,7 +507,7 @@ const char kPsshElementNam -

        Definition at line 205 of file mpd_utils.cc.

        +

        Definition at line 216 of file mpd_utils.cc.

        @@ -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 bab11052eb..f677ef7402 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 328f7d47fe..93844ae81f 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 a9ac719752..e020ad1ebe 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 29c43435fd..89ac335569 100644 --- a/docs/d8/dc2/classshaka_1_1media_1_1Replicator-members.html +++ b/docs/d8/dc2/classshaka_1_1media_1_1Replicator-members.html @@ -70,28 +70,29 @@ $(function() {

        This is the complete list of members for shaka::media::Replicator, 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
        output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
        SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
        ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
        Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
        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
        output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
        SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
        ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
        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 ecac21b205..0cd1a19017 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 44f132a982..ee6cb0266b 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 @@ -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 baeb554143..f1c925ae5e 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 3e0446b06e..ee72f4464a 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 6d605dd236..9df1561047 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 7d873cd458..829e8d4219 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/d8/dd2/classshaka_1_1media_1_1WebVttFileBuffer-members.html b/docs/d8/dd2/classshaka_1_1media_1_1WebVttFileBuffer-members.html index 662a65255d..9a8cf31948 100644 --- a/docs/d8/dd2/classshaka_1_1media_1_1WebVttFileBuffer-members.html +++ b/docs/d8/dd2/classshaka_1_1media_1_1WebVttFileBuffer-members.html @@ -78,7 +78,7 @@ $(function() { 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 c03c3c2d22..d651b352cd 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 a707e30ee2..7523afa1c4 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 @@ -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 a90a31d45d..f26547db87 100644 --- a/docs/d8/de1/classshaka_1_1Period.html +++ b/docs/d8/de1/classshaka_1_1Period.html @@ -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 a085f13416..eebd1fe469 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 da7f425d2b..e97a12193a 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 b7df3a8bfb..34c6e21b32 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 c46a726b4a..989b16f6ac 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 9044f2bd9c..10611cc46b 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 3995ab95d1..e0e360c9bb 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 7a189a0231..01eef08d26 100644 --- a/docs/d8/df0/webm_2single__segment__segmenter_8cc_source.html +++ b/docs/d8/df0/webm_2single__segment__segmenter_8cc_source.html @@ -77,7 +77,7 @@ $(function() { 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 9818269754..ffc86e9bd7 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 b3d00d9151..f480a933d1 100644 --- a/docs/d8/df8/classshaka_1_1media_1_1TextPadder.html +++ b/docs/d8/df8/classshaka_1_1media_1_1TextPadder.html @@ -105,6 +105,10 @@ bool 

        Additional Inherited Members

        +- Static Public Member Functions inherited from shaka::media::MediaHandler + +static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list) +  - Protected Member Functions inherited from shaka::media::MediaHandler virtual bool ValidateOutputStreamIndex (size_t stream_index) const @@ -168,7 +172,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 7b7998aca9..db42828b15 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 e06f280425..f85694f7f1 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 2f77c40922..2ad3a61936 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 2fb4e2e4ac..ce13d10878 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 e7e5014569..b1ddc709f4 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 f5b72a0842..4647dbff6d 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 45b93cad4f..04b3c8efc3 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 2d63c34626..4369d7062f 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 2e53ea4d83..c699eb5598 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 08beda8273..f7135b4ab4 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 @@ -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 2f7fe46d10..9381c5c408 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 ff06a9b5c2..fbe1c86a87 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 @@ -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 518b140518..a3de17a0da 100644 --- a/docs/d9/d2e/packed__audio__segmenter_8h_source.html +++ b/docs/d9/d2e/packed__audio__segmenter_8h_source.html @@ -66,7 +66,7 @@ $(function() {
        packed_audio_segmenter.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_PACKED_AUDIO_PACKED_AUDIO_SEGMENTER_H_
        8 #define PACKAGER_MEDIA_FORMATS_PACKED_AUDIO_PACKED_AUDIO_SEGMENTER_H_
        9 
        10 #include <memory>
        11 
        12 #include "packager/media/base/buffer_writer.h"
        13 #include "packager/media/base/stream_info.h"
        14 #include "packager/status.h"
        15 
        16 namespace shaka {
        17 namespace media {
        18 
        19 class AACAudioSpecificConfig;
        20 class Id3Tag;
        21 class MediaSample;
        22 
        24 constexpr double kPackedAudioTimescale = 90000;
        25 
        28 constexpr char kTimestampOwnerIdentifier[] =
        29  "com.apple.streaming.transportStreamTimestamp";
        30 
        33 constexpr char kAudioDescriptionOwnerIdentifier[] =
        34  "com.apple.streaming.audioDescription";
        35 
        41  public:
        43  virtual ~PackedAudioSegmenter();
        44 
        48  // This function is made virtual for testing.
        49  virtual Status Initialize(const StreamInfo& stream_info);
        50 
        53  // This function is made virtual for testing.
        54  virtual Status AddSample(const MediaSample& sample);
        55 
        59  // This function is made virtual for testing.
        60  virtual Status FinalizeSegment();
        61 
        64  // This function is made virtual for testing.
        65  virtual double TimescaleScale() const;
        66 
        68  BufferWriter* segment_buffer() { return &segment_buffer_; }
        69 
        70  private:
        72  PackedAudioSegmenter& operator=(const PackedAudioSegmenter&) = delete;
        73 
        74  // These functions is made virtual for testing.
        75  virtual std::unique_ptr<AACAudioSpecificConfig> CreateAdtsConverter();
        76  virtual std::unique_ptr<Id3Tag> CreateId3Tag();
        77 
        78  Status EncryptionAudioSetup(const MediaSample& sample);
        79  void StartNewSegment(const MediaSample& first_sample);
        80 
        81  // Codec for the stream.
        82  Codec codec_ = kUnknownCodec;
        83  std::vector<uint8_t> audio_codec_config_;
        84  // Calculated by output stream's timescale / input stream's timescale. This is
        85  // used to scale the timestamps.
        86  double timescale_scale_ = 0.0;
        87  // Whether it is the start of a new segment.
        88  bool start_of_new_segment_ = true;
        89 
        90  // Audio setup information for encrypted segment.
        91  std::string audio_setup_information_;
        92  // AAC is carried in ADTS.
        93  std::unique_ptr<AACAudioSpecificConfig> adts_converter_;
        94 
        95  BufferWriter segment_buffer_;
        96 };
        97 
        98 } // namespace media
        99 } // namespace shaka
        100 
        101 #endif // PACKAGER_MEDIA_FORMATS_PACKED_AUDIO_PACKED_AUDIO_SEGMENTER_H_
        Abstract class holds stream information.
        Definition: stream_info.h:59
        +
        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_SEGMENTER_H_
        8 #define PACKAGER_MEDIA_FORMATS_PACKED_AUDIO_PACKED_AUDIO_SEGMENTER_H_
        9 
        10 #include <memory>
        11 
        12 #include "packager/media/base/buffer_writer.h"
        13 #include "packager/media/base/stream_info.h"
        14 #include "packager/status.h"
        15 
        16 namespace shaka {
        17 namespace media {
        18 
        19 class AACAudioSpecificConfig;
        20 class Id3Tag;
        21 class MediaSample;
        22 
        24 constexpr double kPackedAudioTimescale = 90000;
        25 
        28 constexpr char kTimestampOwnerIdentifier[] =
        29  "com.apple.streaming.transportStreamTimestamp";
        30 
        33 constexpr char kAudioDescriptionOwnerIdentifier[] =
        34  "com.apple.streaming.audioDescription";
        35 
        41  public:
        43  virtual ~PackedAudioSegmenter();
        44 
        48  // This function is made virtual for testing.
        49  virtual Status Initialize(const StreamInfo& stream_info);
        50 
        53  // This function is made virtual for testing.
        54  virtual Status AddSample(const MediaSample& sample);
        55 
        59  // This function is made virtual for testing.
        60  virtual Status FinalizeSegment();
        61 
        64  // This function is made virtual for testing.
        65  virtual double TimescaleScale() const;
        66 
        68  BufferWriter* segment_buffer() { return &segment_buffer_; }
        69 
        70  private:
        72  PackedAudioSegmenter& operator=(const PackedAudioSegmenter&) = delete;
        73 
        74  // These functions is made virtual for testing.
        75  virtual std::unique_ptr<AACAudioSpecificConfig> CreateAdtsConverter();
        76  virtual std::unique_ptr<Id3Tag> CreateId3Tag();
        77 
        78  Status EncryptionAudioSetup(const MediaSample& sample);
        79  void StartNewSegment(const MediaSample& first_sample);
        80 
        81  // Codec for the stream.
        82  Codec codec_ = kUnknownCodec;
        83  std::vector<uint8_t> audio_codec_config_;
        84  // Calculated by output stream's timescale / input stream's timescale. This is
        85  // used to scale the timestamps.
        86  double timescale_scale_ = 0.0;
        87  // Whether it is the start of a new segment.
        88  bool start_of_new_segment_ = true;
        89 
        90  // Audio setup information for encrypted segment.
        91  std::string audio_setup_information_;
        92  // AAC is carried in ADTS.
        93  std::unique_ptr<AACAudioSpecificConfig> adts_converter_;
        94 
        95  BufferWriter segment_buffer_;
        96 };
        97 
        98 } // namespace media
        99 } // namespace shaka
        100 
        101 #endif // PACKAGER_MEDIA_FORMATS_PACKED_AUDIO_PACKED_AUDIO_SEGMENTER_H_
        Abstract class holds stream information.
        Definition: stream_info.h:61
        All the methods that are virtual are virtual for mocking.
        @@ -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 6531070229..100dd8c730 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 8ea7d6ee49..64de386269 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 b05f6ab23c..056cd099c5 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 @@ -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 8b78ec963f..f06fbaccf8 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 @@ -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 85e3e02bb7..5a1b398192 100644 --- a/docs/d9/d40/classshaka_1_1media_1_1WebVttParser.html +++ b/docs/d9/d40/classshaka_1_1media_1_1WebVttParser.html @@ -109,6 +109,10 @@ bool 

        Additional Inherited Members

        +- Static Public Member Functions inherited from shaka::media::MediaHandler + +static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list) +  - Protected Member Functions inherited from shaka::media::MediaHandler virtual Status OnFlushRequest (size_t input_stream_index) @@ -171,7 +175,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 b50876b9a7..fa38e049fe 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 56a61e0e96..5756f476bb 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 2839d995bd..9882705b6c 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 a3d446f216..132c4cd36d 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 bf98a0471e..1ad47a4f23 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 7997c9c627..e93bd34915 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 90202a03a2..85315e3396 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 3d14bf1545..f501841cd5 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 07ca3c5cdb..bc1ace27d8 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 4f327182a5..e03371049f 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 06a69de7e8..c11c199908 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 794e5acd08..6cef694eaa 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 5f2d2c1ba4..12eb4984bc 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 963f7da55f..fc9110cd14 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 a4aa920b51..8c2587057b 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 aa2f8bd2bd..b07e493fae 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 4c8f34c940..b6858d7000 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 4ec6917b97..6b672d2b06 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 5068654daf..d61d8e82e2 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 4db68fcd00..feb6b77a3a 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 9823fd7a94..14e4205cac 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 e33b377438..73863c434f 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 9170b0f5aa..d43e4e4248 100644 --- a/docs/d9/db9/muxer_8cc_source.html +++ b/docs/d9/db9/muxer_8cc_source.html @@ -80,7 +80,7 @@ $(function() { 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 d24d137387..774832f0dd 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 1adb5eed35..9633fbb98f 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 @@ -78,7 +78,7 @@ $(function() { 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 4e67e1dc43..f1479e83f5 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 161de4e89c..adad28c942 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 25fe586287..8ecf808822 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 e88991a598..817d1d60e1 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 ac9a1c2335..2bbccbcc82 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 30ff07c002..17c37b04d3 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 c3c1711d44..ec1f0e1d6c 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 d680e6e018..ded8e7c190 100644 --- a/docs/d9/de3/muxer__listener__internal_8cc_source.html +++ b/docs/d9/de3/muxer__listener__internal_8cc_source.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/d9/deb/classshaka_1_1hls_1_1HlsNotifier.html b/docs/d9/deb/classshaka_1_1hls_1_1HlsNotifier.html index a2f1d3afc0..129ae79a90 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 a108259baa..1b30cf093c 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 041df17e7d..6cb411f70d 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 32ff597d5b..85af7776a9 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 39b0a37547..32544ff163 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 da78cb3cd5..a9db12039d 100644 --- a/docs/d9/dfe/classshaka_1_1UdpOptions.html +++ b/docs/d9/dfe/classshaka_1_1UdpOptions.html @@ -99,6 +99,9 @@ const std::string & so bool is_source_specific_multicast () const   + +int buffer_size () const +  @@ -141,7 +144,7 @@ Static Public Member Functions
        Returns
        a UdpOptions object on success, nullptr otherwise.
        -

        Definition at line 73 of file udp_options.cc.

        +

        Definition at line 75 of file udp_options.cc.

        @@ -152,7 +155,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 dcbd48193a..fb4e620461 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 b145316a7d..c552ab2f28 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() {

        Static Public Member Functions

        diff --git a/docs/da/d04/audio__stream__info_8cc_source.html b/docs/da/d04/audio__stream__info_8cc_source.html index cedaab40df..e28adcb4a6 100644 --- a/docs/da/d04/audio__stream__info_8cc_source.html +++ b/docs/da/d04/audio__stream__info_8cc_source.html @@ -66,8 +66,8 @@ $(function() {
        audio_stream_info.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/audio_stream_info.h"
        8 
        9 #include <inttypes.h>
        10 
        11 #include "packager/base/logging.h"
        12 #include "packager/base/strings/string_number_conversions.h"
        13 #include "packager/base/strings/stringprintf.h"
        14 #include "packager/media/base/limits.h"
        15 
        16 namespace shaka {
        17 namespace media {
        18 
        19 namespace {
        20 std::string AudioCodecToString(Codec codec) {
        21  switch (codec) {
        22  case kCodecAAC:
        23  return "AAC";
        24  case kCodecAC3:
        25  return "AC3";
        26  case kCodecDTSC:
        27  return "DTSC";
        28  case kCodecDTSE:
        29  return "DTSE";
        30  case kCodecDTSH:
        31  return "DTSH";
        32  case kCodecDTSL:
        33  return "DTSL";
        34  case kCodecDTSM:
        35  return "DTS-";
        36  case kCodecDTSP:
        37  return "DTS+";
        38  case kCodecEAC3:
        39  return "EAC3";
        40  case kCodecFlac:
        41  return "FLAC";
        42  case kCodecOpus:
        43  return "Opus";
        44  case kCodecVorbis:
        45  return "Vorbis";
        46  default:
        47  NOTIMPLEMENTED() << "Unknown Audio Codec: " << codec;
        48  return "UnknownCodec";
        49  }
        50 }
        51 } // namespace
        52 
        54  int track_id, uint32_t time_scale, uint64_t duration, Codec codec,
        55  const std::string& codec_string, const uint8_t* codec_config,
        56  size_t codec_config_size, uint8_t sample_bits, uint8_t num_channels,
        57  uint32_t sampling_frequency, uint64_t seek_preroll_ns,
        58  uint64_t codec_delay_ns, uint32_t max_bitrate, uint32_t avg_bitrate,
        59  const std::string& language, bool is_encrypted)
        60  : StreamInfo(kStreamAudio, track_id, time_scale, duration, codec,
        61  codec_string, codec_config, codec_config_size, language,
        62  is_encrypted),
        63  sample_bits_(sample_bits),
        64  num_channels_(num_channels),
        65  sampling_frequency_(sampling_frequency),
        66  seek_preroll_ns_(seek_preroll_ns),
        67  codec_delay_ns_(codec_delay_ns),
        68  max_bitrate_(max_bitrate),
        69  avg_bitrate_(avg_bitrate) {}
        70 
        71 AudioStreamInfo::~AudioStreamInfo() {}
        72 
        74  return codec() != kUnknownCodec && num_channels_ != 0 &&
        75  num_channels_ <= limits::kMaxChannels && sample_bits_ > 0 &&
        76  sample_bits_ <= limits::kMaxBitsPerSample && sampling_frequency_ > 0 &&
        77  sampling_frequency_ <= limits::kMaxSampleRate;
        78 }
        79 
        80 std::string AudioStreamInfo::ToString() const {
        81  std::string str = base::StringPrintf(
        82  "%s codec: %s\n sample_bits: %d\n num_channels: %d\n "
        83  "sampling_frequency: %d\n language: %s\n",
        84  StreamInfo::ToString().c_str(), AudioCodecToString(codec()).c_str(),
        85  sample_bits_, num_channels_, sampling_frequency_, language().c_str());
        86  if (seek_preroll_ns_ != 0) {
        87  base::StringAppendF(&str, " seek_preroll_ns: %" PRIu64 "\n",
        88  seek_preroll_ns_);
        89  }
        90  if (codec_delay_ns_ != 0) {
        91  base::StringAppendF(&str, " codec_delay_ns: %" PRIu64 "\n",
        92  codec_delay_ns_);
        93  }
        94  return str;
        95 }
        96 
        97 std::unique_ptr<StreamInfo> AudioStreamInfo::Clone() const {
        98  return std::unique_ptr<StreamInfo>(new AudioStreamInfo(*this));
        99 }
        100 
        101 std::string AudioStreamInfo::GetCodecString(Codec codec,
        102  uint8_t audio_object_type) {
        103  switch (codec) {
        104  case kCodecAAC:
        105  return "mp4a.40." + base::UintToString(audio_object_type);
        106  case kCodecAC3:
        107  return "ac-3";
        108  case kCodecDTSC:
        109  return "dtsc";
        110  case kCodecDTSE:
        111  return "dtse";
        112  case kCodecDTSH:
        113  return "dtsh";
        114  case kCodecDTSL:
        115  return "dtsl";
        116  case kCodecDTSM:
        117  return "dts-";
        118  case kCodecDTSP:
        119  return "dts+";
        120  case kCodecEAC3:
        121  return "ec-3";
        122  case kCodecFlac:
        123  return "flac";
        124  case kCodecOpus:
        125  return "opus";
        126  case kCodecVorbis:
        127  return "vorbis";
        128  default:
        129  NOTIMPLEMENTED() << "Codec: " << codec;
        130  return "unknown";
        131  }
        132 }
        133 
        134 } // namespace media
        135 } // namespace shaka
        Abstract class holds stream information.
        Definition: stream_info.h:59
        -
        virtual std::string ToString() const
        Definition: stream_info.cc:37
        +
        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/audio_stream_info.h"
        8 
        9 #include <inttypes.h>
        10 
        11 #include "packager/base/logging.h"
        12 #include "packager/base/strings/string_number_conversions.h"
        13 #include "packager/base/strings/stringprintf.h"
        14 #include "packager/media/base/limits.h"
        15 
        16 namespace shaka {
        17 namespace media {
        18 
        19 namespace {
        20 std::string AudioCodecToString(Codec codec) {
        21  switch (codec) {
        22  case kCodecAAC:
        23  return "AAC";
        24  case kCodecAC3:
        25  return "AC3";
        26  case kCodecDTSC:
        27  return "DTSC";
        28  case kCodecDTSE:
        29  return "DTSE";
        30  case kCodecDTSH:
        31  return "DTSH";
        32  case kCodecDTSL:
        33  return "DTSL";
        34  case kCodecDTSM:
        35  return "DTS-";
        36  case kCodecDTSP:
        37  return "DTS+";
        38  case kCodecEAC3:
        39  return "EAC3";
        40  case kCodecFlac:
        41  return "FLAC";
        42  case kCodecOpus:
        43  return "Opus";
        44  case kCodecVorbis:
        45  return "Vorbis";
        46  default:
        47  NOTIMPLEMENTED() << "Unknown Audio Codec: " << codec;
        48  return "UnknownCodec";
        49  }
        50 }
        51 } // namespace
        52 
        54  int track_id, uint32_t time_scale, uint64_t duration, Codec codec,
        55  const std::string& codec_string, const uint8_t* codec_config,
        56  size_t codec_config_size, uint8_t sample_bits, uint8_t num_channels,
        57  uint32_t sampling_frequency, uint64_t seek_preroll_ns,
        58  uint64_t codec_delay_ns, uint32_t max_bitrate, uint32_t avg_bitrate,
        59  const std::string& language, bool is_encrypted)
        60  : StreamInfo(kStreamAudio, track_id, time_scale, duration, codec,
        61  codec_string, codec_config, codec_config_size, language,
        62  is_encrypted),
        63  sample_bits_(sample_bits),
        64  num_channels_(num_channels),
        65  sampling_frequency_(sampling_frequency),
        66  seek_preroll_ns_(seek_preroll_ns),
        67  codec_delay_ns_(codec_delay_ns),
        68  max_bitrate_(max_bitrate),
        69  avg_bitrate_(avg_bitrate) {}
        70 
        71 AudioStreamInfo::~AudioStreamInfo() {}
        72 
        74  return codec() != kUnknownCodec && num_channels_ != 0 &&
        75  num_channels_ <= limits::kMaxChannels && sample_bits_ > 0 &&
        76  sample_bits_ <= limits::kMaxBitsPerSample && sampling_frequency_ > 0 &&
        77  sampling_frequency_ <= limits::kMaxSampleRate;
        78 }
        79 
        80 std::string AudioStreamInfo::ToString() const {
        81  std::string str = base::StringPrintf(
        82  "%s codec: %s\n sample_bits: %d\n num_channels: %d\n "
        83  "sampling_frequency: %d\n language: %s\n",
        84  StreamInfo::ToString().c_str(), AudioCodecToString(codec()).c_str(),
        85  sample_bits_, num_channels_, sampling_frequency_, language().c_str());
        86  if (seek_preroll_ns_ != 0) {
        87  base::StringAppendF(&str, " seek_preroll_ns: %" PRIu64 "\n",
        88  seek_preroll_ns_);
        89  }
        90  if (codec_delay_ns_ != 0) {
        91  base::StringAppendF(&str, " codec_delay_ns: %" PRIu64 "\n",
        92  codec_delay_ns_);
        93  }
        94  return str;
        95 }
        96 
        97 std::unique_ptr<StreamInfo> AudioStreamInfo::Clone() const {
        98  return std::unique_ptr<StreamInfo>(new AudioStreamInfo(*this));
        99 }
        100 
        101 std::string AudioStreamInfo::GetCodecString(Codec codec,
        102  uint8_t audio_object_type) {
        103  switch (codec) {
        104  case kCodecAAC:
        105  return "mp4a.40." + base::UintToString(audio_object_type);
        106  case kCodecAC3:
        107  return "ac-3";
        108  case kCodecDTSC:
        109  return "dtsc";
        110  case kCodecDTSE:
        111  return "dtse";
        112  case kCodecDTSH:
        113  return "dtsh";
        114  case kCodecDTSL:
        115  return "dtsl";
        116  case kCodecDTSM:
        117  return "dts-";
        118  case kCodecDTSP:
        119  return "dts+";
        120  case kCodecEAC3:
        121  return "ec-3";
        122  case kCodecFlac:
        123  return "flac";
        124  case kCodecOpus:
        125  return "opus";
        126  case kCodecVorbis:
        127  return "vorbis";
        128  default:
        129  NOTIMPLEMENTED() << "Codec: " << codec;
        130  return "unknown";
        131  }
        132 }
        133 
        134 } // namespace media
        135 } // namespace shaka
        Abstract class holds stream information.
        Definition: stream_info.h:61
        +
        virtual std::string ToString() const
        Definition: stream_info.cc:58
        std::string ToString() const override
        All the methods that are virtual are virtual for mocking.
        bool IsValidConfig() const override
        @@ -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 829b8850ee..2f11e080d1 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 df7d760e57..659a466c13 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 28366db6b6..727a8a5d0d 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 a938bcc165..6c9325cb4b 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 c309188989..583fac54f3 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 30da5d9ab3..278c0065a8 100644 --- a/docs/da/d1d/udp__options_8cc_source.html +++ b/docs/da/d1d/udp__options_8cc_source.html @@ -66,13 +66,13 @@ $(function() {
        udp_options.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/file/udp_options.h"
        8 
        9 #include <gflags/gflags.h>
        10 
        11 #include "packager/base/strings/string_number_conversions.h"
        12 #include "packager/base/strings/string_split.h"
        13 
        14 DEFINE_string(udp_interface_address,
        15  "",
        16  "IP address of the interface over which to receive UDP unicast"
        17  " or multicast streams");
        18 
        19 namespace shaka {
        20 
        21 namespace {
        22 
        23 enum FieldType {
        24  kUnknownField = 0,
        25  kReuseField,
        26  kInterfaceAddressField,
        27  kMulticastSourceField,
        28  kTimeoutField,
        29 };
        30 
        31 struct FieldNameToTypeMapping {
        32  const char* field_name;
        33  FieldType field_type;
        34 };
        35 
        36 const FieldNameToTypeMapping kFieldNameTypeMappings[] = {
        37  {"reuse", kReuseField},
        38  {"interface", kInterfaceAddressField},
        39  {"source", kMulticastSourceField},
        40  {"timeout", kTimeoutField},
        41 };
        42 
        43 FieldType GetFieldType(const std::string& field_name) {
        44  for (size_t idx = 0; idx < arraysize(kFieldNameTypeMappings); ++idx) {
        45  if (field_name == kFieldNameTypeMappings[idx].field_name)
        46  return kFieldNameTypeMappings[idx].field_type;
        47  }
        48  return kUnknownField;
        49 }
        50 
        51 bool StringToAddressAndPort(base::StringPiece addr_and_port,
        52  std::string* addr,
        53  uint16_t* port) {
        54  DCHECK(addr);
        55  DCHECK(port);
        56 
        57  const size_t colon_pos = addr_and_port.find(':');
        58  if (colon_pos == base::StringPiece::npos) {
        59  return false;
        60  }
        61  *addr = addr_and_port.substr(0, colon_pos).as_string();
        62  unsigned port_value;
        63  if (!base::StringToUint(addr_and_port.substr(colon_pos + 1), &port_value) ||
        64  (port_value > 65535)) {
        65  return false;
        66  }
        67  *port = port_value;
        68  return true;
        69 }
        70 
        71 } // namespace
        72 
        73 std::unique_ptr<UdpOptions> UdpOptions::ParseFromString(
        74  base::StringPiece udp_url) {
        75  std::unique_ptr<UdpOptions> options(new UdpOptions);
        76 
        77  const size_t question_mark_pos = udp_url.find('?');
        78  base::StringPiece address_str = udp_url.substr(0, question_mark_pos);
        79 
        80  if (question_mark_pos != base::StringPiece::npos) {
        81  base::StringPiece options_str = udp_url.substr(question_mark_pos + 1);
        82 
        83  base::StringPairs pairs;
        84  if (!base::SplitStringIntoKeyValuePairs(options_str, '=', '&', &pairs)) {
        85  LOG(ERROR) << "Invalid udp options name/value pairs " << options_str;
        86  return nullptr;
        87  }
        88  for (const auto& pair : pairs) {
        89  switch (GetFieldType(pair.first)) {
        90  case kReuseField: {
        91  int reuse_value = 0;
        92  if (!base::StringToInt(pair.second, &reuse_value)) {
        93  LOG(ERROR) << "Invalid udp option for reuse field " << pair.second;
        94  return nullptr;
        95  }
        96  options->reuse_ = reuse_value > 0;
        97  break;
        98  }
        99  case kInterfaceAddressField:
        100  options->interface_address_ = pair.second;
        101  break;
        102  case kTimeoutField:
        103  if (!base::StringToUint(pair.second, &options->timeout_us_)) {
        104  LOG(ERROR) << "Invalid udp option for timeout field "
        105  << pair.second;
        106  return nullptr;
        107  }
        108  break;
        109  case kMulticastSourceField:
        110  options->source_address_ = pair.second;
        111  options->is_source_specific_multicast_ = true;
        112  break;
        113  default:
        114  LOG(ERROR) << "Unknown field in udp options (\"" << pair.first
        115  << "\").";
        116  return nullptr;
        117  }
        118  }
        119  }
        120 
        121  if (!FLAGS_udp_interface_address.empty()) {
        122  LOG(WARNING) << "--udp_interface_address is deprecated. Consider switching "
        123  "to udp options instead, something like "
        124  "udp:://ip:port?interface=interface_ip.";
        125  options->interface_address_ = FLAGS_udp_interface_address;
        126  }
        127 
        128  if (!StringToAddressAndPort(address_str, &options->address_,
        129  &options->port_)) {
        130  LOG(ERROR) << "Malformed address:port UDP url " << address_str;
        131  return nullptr;
        132  }
        133  return options;
        134 }
        135 
        136 } // namespace shaka
        static std::unique_ptr< UdpOptions > ParseFromString(base::StringPiece udp_url)
        Definition: udp_options.cc:73
        +
        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/file/udp_options.h"
        8 
        9 #include <gflags/gflags.h>
        10 
        11 #include "packager/base/strings/string_number_conversions.h"
        12 #include "packager/base/strings/string_split.h"
        13 
        14 DEFINE_string(udp_interface_address,
        15  "",
        16  "IP address of the interface over which to receive UDP unicast"
        17  " or multicast streams");
        18 
        19 namespace shaka {
        20 
        21 namespace {
        22 
        23 enum FieldType {
        24  kUnknownField = 0,
        25  kBufferSizeField,
        26  kInterfaceAddressField,
        27  kMulticastSourceField,
        28  kReuseField,
        29  kTimeoutField,
        30 };
        31 
        32 struct FieldNameToTypeMapping {
        33  const char* field_name;
        34  FieldType field_type;
        35 };
        36 
        37 const FieldNameToTypeMapping kFieldNameTypeMappings[] = {
        38  {"buffer_size", kBufferSizeField},
        39  {"interface", kInterfaceAddressField},
        40  {"reuse", kReuseField},
        41  {"source", kMulticastSourceField},
        42  {"timeout", kTimeoutField},
        43 };
        44 
        45 FieldType GetFieldType(const std::string& field_name) {
        46  for (size_t idx = 0; idx < arraysize(kFieldNameTypeMappings); ++idx) {
        47  if (field_name == kFieldNameTypeMappings[idx].field_name)
        48  return kFieldNameTypeMappings[idx].field_type;
        49  }
        50  return kUnknownField;
        51 }
        52 
        53 bool StringToAddressAndPort(base::StringPiece addr_and_port,
        54  std::string* addr,
        55  uint16_t* port) {
        56  DCHECK(addr);
        57  DCHECK(port);
        58 
        59  const size_t colon_pos = addr_and_port.find(':');
        60  if (colon_pos == base::StringPiece::npos) {
        61  return false;
        62  }
        63  *addr = addr_and_port.substr(0, colon_pos).as_string();
        64  unsigned port_value;
        65  if (!base::StringToUint(addr_and_port.substr(colon_pos + 1), &port_value) ||
        66  (port_value > 65535)) {
        67  return false;
        68  }
        69  *port = port_value;
        70  return true;
        71 }
        72 
        73 } // namespace
        74 
        75 std::unique_ptr<UdpOptions> UdpOptions::ParseFromString(
        76  base::StringPiece udp_url) {
        77  std::unique_ptr<UdpOptions> options(new UdpOptions);
        78 
        79  const size_t question_mark_pos = udp_url.find('?');
        80  base::StringPiece address_str = udp_url.substr(0, question_mark_pos);
        81 
        82  if (question_mark_pos != base::StringPiece::npos) {
        83  base::StringPiece options_str = udp_url.substr(question_mark_pos + 1);
        84 
        85  base::StringPairs pairs;
        86  if (!base::SplitStringIntoKeyValuePairs(options_str, '=', '&', &pairs)) {
        87  LOG(ERROR) << "Invalid udp options name/value pairs " << options_str;
        88  return nullptr;
        89  }
        90  for (const auto& pair : pairs) {
        91  switch (GetFieldType(pair.first)) {
        92  case kBufferSizeField:
        93  if (!base::StringToInt(pair.second, &options->buffer_size_)) {
        94  LOG(ERROR) << "Invalid udp option for buffer_size field "
        95  << pair.second;
        96  return nullptr;
        97  }
        98  break;
        99  case kInterfaceAddressField:
        100  options->interface_address_ = pair.second;
        101  break;
        102  case kMulticastSourceField:
        103  options->source_address_ = pair.second;
        104  options->is_source_specific_multicast_ = true;
        105  break;
        106  case kReuseField: {
        107  int reuse_value = 0;
        108  if (!base::StringToInt(pair.second, &reuse_value)) {
        109  LOG(ERROR) << "Invalid udp option for reuse field " << pair.second;
        110  return nullptr;
        111  }
        112  options->reuse_ = reuse_value > 0;
        113  break;
        114  }
        115  case kTimeoutField:
        116  if (!base::StringToUint(pair.second, &options->timeout_us_)) {
        117  LOG(ERROR) << "Invalid udp option for timeout field "
        118  << pair.second;
        119  return nullptr;
        120  }
        121  break;
        122  default:
        123  LOG(ERROR) << "Unknown field in udp options (\"" << pair.first
        124  << "\").";
        125  return nullptr;
        126  }
        127  }
        128  }
        129 
        130  if (!FLAGS_udp_interface_address.empty()) {
        131  LOG(WARNING) << "--udp_interface_address is deprecated. Consider switching "
        132  "to udp options instead, something like "
        133  "udp:://ip:port?interface=interface_ip.";
        134  options->interface_address_ = FLAGS_udp_interface_address;
        135  }
        136 
        137  if (!StringToAddressAndPort(address_str, &options->address_,
        138  &options->port_)) {
        139  LOG(ERROR) << "Malformed address:port UDP url " << address_str;
        140  return nullptr;
        141  }
        142  return options;
        143 }
        144 
        145 } // namespace shaka
        static std::unique_ptr< UdpOptions > ParseFromString(base::StringPiece udp_url)
        Definition: udp_options.cc:75
        All the methods that are virtual are virtual for mocking.
        Options parsed from UDP url string of the form: udp://ip:port[?options].
        Definition: udp_options.h:15
        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 b97fca91b6..c3f7752c14 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 565da23318..1d4a644479 100644 --- a/docs/da/d23/ts__muxer_8h_source.html +++ b/docs/da/d23/ts__muxer_8h_source.html @@ -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 3b86741b0d..328ec73a2d 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 e0cd7ab9a8..a42afbe923 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 d99e2c8ef2..c35383713f 100644 --- a/docs/da/d2a/text__stream__info_8h_source.html +++ b/docs/da/d2a/text__stream__info_8h_source.html @@ -66,7 +66,7 @@ $(function() {
        text_stream_info.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_BASE_TEXT_STREAM_INFO_H_
        8 #define PACKAGER_MEDIA_BASE_TEXT_STREAM_INFO_H_
        9 
        10 #include "packager/media/base/stream_info.h"
        11 
        12 #include <string>
        13 
        14 namespace shaka {
        15 namespace media {
        16 
        17 class TextStreamInfo : public StreamInfo {
        18  public:
        31  TextStreamInfo(int track_id, uint32_t time_scale, uint64_t duration,
        32  Codec codec,
        33  const std::string& codec_string,
        34  const std::string& codec_config, uint16_t width,
        35  uint16_t height, const std::string& language);
        36 
        37  ~TextStreamInfo() override;
        38 
        39  bool IsValidConfig() const override;
        40 
        41  std::unique_ptr<StreamInfo> Clone() const override;
        42 
        43  uint16_t width() const { return width_; }
        44  uint16_t height() const { return height_; }
        45 
        46  private:
        47  uint16_t width_;
        48  uint16_t height_;
        49 
        50  // Allow copying. This is very light weight.
        51 };
        52 
        53 } // namespace media
        54 } // namespace shaka
        55 
        56 #endif // PACKAGER_MEDIA_BASE_TEXT_STREAM_INFO_H_
        Abstract class holds stream information.
        Definition: stream_info.h:59
        +
        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_BASE_TEXT_STREAM_INFO_H_
        8 #define PACKAGER_MEDIA_BASE_TEXT_STREAM_INFO_H_
        9 
        10 #include "packager/media/base/stream_info.h"
        11 
        12 #include <string>
        13 
        14 namespace shaka {
        15 namespace media {
        16 
        17 class TextStreamInfo : public StreamInfo {
        18  public:
        31  TextStreamInfo(int track_id, uint32_t time_scale, uint64_t duration,
        32  Codec codec,
        33  const std::string& codec_string,
        34  const std::string& codec_config, uint16_t width,
        35  uint16_t height, const std::string& language);
        36 
        37  ~TextStreamInfo() override;
        38 
        39  bool IsValidConfig() const override;
        40 
        41  std::unique_ptr<StreamInfo> Clone() const override;
        42 
        43  uint16_t width() const { return width_; }
        44  uint16_t height() const { return height_; }
        45 
        46  private:
        47  uint16_t width_;
        48  uint16_t height_;
        49 
        50  // Allow copying. This is very light weight.
        51 };
        52 
        53 } // namespace media
        54 } // namespace shaka
        55 
        56 #endif // PACKAGER_MEDIA_BASE_TEXT_STREAM_INFO_H_
        Abstract class holds stream information.
        Definition: stream_info.h:61
        All the methods that are virtual are virtual for mocking.
        TextStreamInfo(int track_id, uint32_t time_scale, uint64_t duration, Codec codec, const std::string &codec_string, const std::string &codec_config, uint16_t width, uint16_t height, const std::string &language)
        bool IsValidConfig() const override
        @@ -75,7 +75,7 @@ $(function() {
        diff --git a/docs/da/d2c/classshaka_1_1BandwidthEstimator.html b/docs/da/d2c/classshaka_1_1BandwidthEstimator.html index c8d0094b30..42332ea0d9 100644 --- a/docs/da/d2c/classshaka_1_1BandwidthEstimator.html +++ b/docs/da/d2c/classshaka_1_1BandwidthEstimator.html @@ -146,7 +146,7 @@ Static Public Attributes
        Returns
        The estimate bandwidth, in bits per second, from the harmonic mean of the number of blocks specified in the constructor. The value is rounded up to the nearest integer.
        -

        Definition at line 28 of file bandwidth_estimator.cc.

        +

        Definition at line 30 of file bandwidth_estimator.cc.

        @@ -166,7 +166,7 @@ Static Public Attributes
        Returns
        The max bandwidth, in bits per second, of the number of blocks specified in the constructor. The value is rounded up to the nearest integer.
        -

        Definition at line 35 of file bandwidth_estimator.cc.

        +

        Definition at line 37 of file bandwidth_estimator.cc.

        @@ -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 36dbc2ec59..80764c95a5 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 @@ -71,44 +71,45 @@ $(function() { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        AddHandler(std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandlerinline
        Cancel()shaka::media::Muxer
        clock() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected
        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
        InitializeInternal() overrideshaka::media::Muxerinlineprotectedvirtual
        IsConnected()shaka::media::MediaHandlerinline
        MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandler
        Muxer(const MuxerOptions &options) (defined in shaka::media::Muxer)shaka::media::Muxerexplicit
        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::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
        progress_listener() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected
        set_clock(base::Clock *clock)shaka::media::Muxerinline
        SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
        SetMuxerListener(std::unique_ptr< MuxerListener > muxer_listener)shaka::media::Muxer
        SetProgressListener(std::unique_ptr< ProgressListener > progress_listener)shaka::media::Muxer
        streams() const (defined in shaka::media::Muxer)shaka::media::Muxerinline
        ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
        WebMMuxer(const MuxerOptions &options)shaka::media::webm::WebMMuxerexplicit
        ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
        ~Muxer() (defined in shaka::media::Muxer)shaka::media::Muxervirtual
        ~WebMMuxer() override (defined in shaka::media::webm::WebMMuxer)shaka::media::webm::WebMMuxer
        Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
        clock() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected
        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
        InitializeInternal() overrideshaka::media::Muxerinlineprotectedvirtual
        IsConnected()shaka::media::MediaHandlerinline
        MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandler
        Muxer(const MuxerOptions &options) (defined in shaka::media::Muxer)shaka::media::Muxerexplicit
        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::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
        progress_listener() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected
        set_clock(base::Clock *clock)shaka::media::Muxerinline
        SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
        SetMuxerListener(std::unique_ptr< MuxerListener > muxer_listener)shaka::media::Muxer
        SetProgressListener(std::unique_ptr< ProgressListener > progress_listener)shaka::media::Muxer
        streams() const (defined in shaka::media::Muxer)shaka::media::Muxerinline
        ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
        WebMMuxer(const MuxerOptions &options)shaka::media::webm::WebMMuxerexplicit
        ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
        ~Muxer() (defined in shaka::media::Muxer)shaka::media::Muxervirtual
        ~WebMMuxer() override (defined in shaka::media::webm::WebMMuxer)shaka::media::webm::WebMMuxer
        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 bb676e014d..17811f1e10 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 586a59c5b1..37fb63258c 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 4f074f3049..6772ebfcf0 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 7a9a156340..dd8981eb00 100644 --- a/docs/da/d4a/media__playlist_8h_source.html +++ b/docs/da/d4a/media__playlist_8h_source.html @@ -66,15 +66,16 @@ $(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  // 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_
        +
        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/bandwidth_estimator.h"
        17 #include "packager/mpd/base/media_info.pb.h"
        18 
        19 namespace shaka {
        20 
        21 class File;
        22 
        23 namespace hls {
        24 
        25 class HlsEntry {
        26  public:
        27  enum class EntryType {
        28  kExtInf,
        29  kExtKey,
        30  kExtDiscontinuity,
        31  kExtPlacementOpportunity,
        32  };
        33  virtual ~HlsEntry();
        34 
        35  EntryType type() const { return type_; }
        36  virtual std::string ToString() = 0;
        37 
        38  protected:
        39  explicit HlsEntry(EntryType type);
        40 
        41  private:
        42  EntryType type_;
        43 };
        44 
        47  public:
        48  enum class MediaPlaylistStreamType {
        49  kUnknown,
        50  kAudio,
        51  kVideo,
        52  kVideoIFramesOnly,
        53  kSubtitle,
        54  };
        55  enum class EncryptionMethod {
        56  kNone, // No encryption, i.e. clear.
        57  kAes128, // Completely encrypted using AES-CBC.
        58  kSampleAes, // Encrypted using SAMPLE-AES method.
        59  kSampleAesCenc, // 'cenc' encrypted content.
        60  };
        61 
        69  MediaPlaylist(const HlsParams& hls_params,
        70  const std::string& file_name,
        71  const std::string& name,
        72  const std::string& group_id);
        73  virtual ~MediaPlaylist();
        74 
        75  const std::string& file_name() const { return file_name_; }
        76  const std::string& name() const { return name_; }
        77  const std::string& group_id() const { return group_id_; }
        78  MediaPlaylistStreamType stream_type() const { return stream_type_; }
        79  const std::string& codec() const { return codec_; }
        80 
        82  void SetStreamTypeForTesting(MediaPlaylistStreamType stream_type);
        83 
        85  void SetCodecForTesting(const std::string& codec);
        86 
        88  void SetLanguageForTesting(const std::string& language);
        89 
        94  virtual bool SetMediaInfo(const MediaInfo& media_info);
        95 
        103  virtual void AddSegment(const std::string& file_name,
        104  uint64_t start_time,
        105  uint64_t duration,
        106  uint64_t start_byte_offset,
        107  uint64_t size);
        108 
        115  virtual void AddKeyFrame(uint64_t timestamp,
        116  uint64_t start_byte_offset,
        117  uint64_t size);
        118 
        130  virtual void AddEncryptionInfo(EncryptionMethod method,
        131  const std::string& url,
        132  const std::string& key_id,
        133  const std::string& iv,
        134  const std::string& key_format,
        135  const std::string& key_format_versions);
        136 
        139  virtual void AddPlacementOpportunity();
        140 
        151  virtual bool WriteToFile(const std::string& file_path);
        152 
        156  virtual uint64_t Bitrate() const;
        157 
        160  virtual double GetLongestSegmentDuration() const;
        161 
        169  virtual void SetTargetDuration(uint32_t target_duration);
        170 
        172  virtual int GetNumChannels() const;
        173 
        176  virtual bool GetDisplayResolution(uint32_t* width, uint32_t* height) const;
        177 
        180  std::string language() const { return language_; }
        181 
        182  private:
        183  // Add a SegmentInfoEntry (#EXTINF).
        184  void AddSegmentInfoEntry(const std::string& segment_file_name,
        185  uint64_t start_time,
        186  uint64_t duration,
        187  uint64_t start_byte_offset,
        188  uint64_t size);
        189  // Adjust the duration of the last SegmentInfoEntry to end on
        190  // |next_timestamp|.
        191  void AdjustLastSegmentInfoEntryDuration(uint64_t next_timestamp);
        192  // Remove elements from |entries_| for live profile. Increments
        193  // |sequence_number_| by the number of segments removed.
        194  void SlideWindow();
        195  // Remove the segment specified by |start_time|. The actual deletion can
        196  // happen at a later time depending on the value of
        197  // |preserved_segment_outside_live_window| in |hls_params_|.
        198  void RemoveOldSegment(uint64_t start_time);
        199 
        200  const HlsParams& hls_params_;
        201  // Mainly for MasterPlaylist to use these values.
        202  const std::string file_name_;
        203  const std::string name_;
        204  const std::string group_id_;
        205  MediaInfo media_info_;
        206  MediaPlaylistStreamType stream_type_ = MediaPlaylistStreamType::kUnknown;
        207  // Whether to use byte range for SegmentInfoEntry.
        208  bool use_byte_range_ = false;
        209  std::string codec_;
        210  std::string language_;
        211  int media_sequence_number_ = 0;
        212  bool inserted_discontinuity_tag_ = false;
        213  int discontinuity_sequence_number_ = 0;
        214 
        215  double longest_segment_duration_ = 0.0;
        216  uint32_t time_scale_ = 0;
        217 
        218  BandwidthEstimator bandwidth_estimator_;
        219 
        220  // Cache the previous calls AddSegment() end offset. This is used to construct
        221  // SegmentInfoEntry.
        222  uint64_t previous_segment_end_offset_ = 0;
        223 
        224  // See SetTargetDuration() comments.
        225  bool target_duration_set_ = false;
        226  uint32_t target_duration_ = 0;
        227 
        228  std::list<std::unique_ptr<HlsEntry>> entries_;
        229  // A list to hold the file names of the segments to be removed temporarily.
        230  // Once a file is actually removed, it is removed from the list.
        231  std::list<std::string> segments_to_be_removed_;
        232 
        233  // Used by kVideoIFrameOnly playlists to track the i-frames (key frames).
        234  struct KeyFrameInfo {
        235  uint64_t timestamp;
        236  uint64_t start_byte_offset;
        237  uint64_t size;
        238  std::string segment_file_name;
        239  };
        240  std::list<KeyFrameInfo> key_frames_;
        241 
        242  DISALLOW_COPY_AND_ASSIGN(MediaPlaylist);
        243 };
        244 
        245 } // namespace hls
        246 } // namespace shaka
        247 
        248 #endif // PACKAGER_HLS_BASE_MEDIA_PLAYLIST_H_
        HLS related parameters.
        Definition: hls_params.h:23
        -
        std::string language() const
        +
        std::string language() const
        All the methods that are virtual are virtual for mocking.
        -
        Methods are virtual for mocking.
        + +
        Methods are virtual for mocking.
        diff --git a/docs/da/d4e/classshaka_1_1media_1_1AudioStreamInfo.html b/docs/da/d4e/classshaka_1_1media_1_1AudioStreamInfo.html index d4a586de50..0fdbaa34df 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 0c829e8ef1..2fd3790e53 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 @@ -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 01483b57e6..1bbc877bfe 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 07bbe48c8c..f4563ab78b 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 ab0c01465c..53b3283cef 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 470b17e9bf..d1ceca68ab 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 @@ -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 b15a6785c6..985451a3cf 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 d45a93521a..a30a533aa8 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 a5bf737f00..db788be62c 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 48f30a2b98..aa6b33a42b 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 a8868cec44..904a15a24d 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 @@ -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 c0e78073c0..84532d626b 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 dec7dc5caa..f302504278 100644 --- a/docs/da/d88/mp4__muxer_8cc_source.html +++ b/docs/da/d88/mp4__muxer_8cc_source.html @@ -67,7 +67,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/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
        +
        Abstract class holds stream information.
        Definition: stream_info.h:61
        @@ -106,7 +106,7 @@ $(function() {
        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 068a8b695a..e2b3a004dc 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 6db9928261..904da8fa69 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 8f7797733b..b447234587 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 fa1fb4b05b..aa0ce3a426 100644 --- a/docs/da/d93/structshaka_1_1media_1_1CueEvent.html +++ b/docs/da/d93/structshaka_1_1media_1_1CueEvent.html @@ -91,7 +91,7 @@ std::string cue_data 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 dc9e7bd2c7..87c80e1764 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 db1aec58ec..022f6f7dfc 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 8b7fa6b508..38c8d5c62d 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 fb29891c1f..53141e0077 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 553a3ec535..50c25b9edd 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 cdcc6ee0b8..2d2c030bff 100644 --- a/docs/da/dab/classshaka_1_1media_1_1CueAlignmentHandler.html +++ b/docs/da/dab/classshaka_1_1media_1_1CueAlignmentHandler.html @@ -105,6 +105,10 @@ bool 

        Additional Inherited Members

        +- Static Public Member Functions inherited from shaka::media::MediaHandler + +static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list) +  - Protected Member Functions inherited from shaka::media::MediaHandler virtual bool ValidateOutputStreamIndex (size_t stream_index) const @@ -169,7 +173,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 970beae285..cc3143749e 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 index 2a0ccb02a9..bf129f87ae 100644 --- a/docs/da/db3/webvtt__file__buffer_8cc_source.html +++ b/docs/da/db3/webvtt__file__buffer_8cc_source.html @@ -70,7 +70,7 @@ $(function() { 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 9d0e1bf5b8..709f8e39cd 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 @@ -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 401443bfd9..696d1bc055 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 1aea1b58bb..ddef2f2944 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 @@ -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 fb54b0ba54..865a18e78d 100644 --- a/docs/da/dca/classshaka_1_1media_1_1OriginHandler-members.html +++ b/docs/da/dca/classshaka_1_1media_1_1OriginHandler-members.html @@ -71,33 +71,34 @@ $(function() { - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + +
        AddHandler(std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandlerinline
        Cancel()=0 (defined in shaka::media::OriginHandler)shaka::media::OriginHandlerpure virtual
        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
        InitializeInternal()=0shaka::media::MediaHandlerprotectedpure virtual
        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
        OnFlushRequest(size_t input_stream_index)shaka::media::MediaHandlerprotectedvirtual
        OriginHandler()=default (defined in shaka::media::OriginHandler)shaka::media::OriginHandler
        output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
        Run()=0 (defined in shaka::media::OriginHandler)shaka::media::OriginHandlerpure virtual
        SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
        ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
        ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
        Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
        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
        InitializeInternal()=0shaka::media::MediaHandlerprotectedpure virtual
        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
        OnFlushRequest(size_t input_stream_index)shaka::media::MediaHandlerprotectedvirtual
        OriginHandler()=default (defined in shaka::media::OriginHandler)shaka::media::OriginHandler
        output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
        Run()=0 (defined in shaka::media::OriginHandler)shaka::media::OriginHandlerpure virtual
        SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
        ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
        ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
        diff --git a/docs/da/dcb/es__descriptor_8h_source.html b/docs/da/dcb/es__descriptor_8h_source.html index 3ab9ac59d5..245d46bfa0 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 70c7bdfad6..0536fce8a2 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 479172669a..5f2818a187 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 @@ -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 4416ee5f50..1a61d0ea2c 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 9e453d15fc..c33ffe714a 100644 --- a/docs/da/dd1/fragmenter_8h_source.html +++ b/docs/da/dd1/fragmenter_8h_source.html @@ -84,7 +84,7 @@ $(function() { 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 6142de1c63..5b53d282c2 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 897359871a..1f8defa202 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 39ca791bcb..df47a584e4 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 204ee7b12c..63e0ac66d0 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 b6e9e1ab96..4c941a9946 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 e90153c26b..529ad90054 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 7194e82e30..8d8ef7d987 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 60b327d239..a69a3666f5 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 20edf3e8b2..6fd8d361fb 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 ce042964ad..32045c65d2 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 e466ff2c72..0d7698ffa5 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 @@ -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 979f05add5..faf5de330d 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 3aaa3028ff..5f4584cc01 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 a54ff85ccc..fc5b0490a8 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 @@ -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 bb0ef3689b..748779858b 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 5c34529be7..60448e184a 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 ee35e82b23..4d165a5e65 100644 --- a/docs/da/dfd/classshaka_1_1media_1_1MediaHandler.html +++ b/docs/da/dfd/classshaka_1_1media_1_1MediaHandler.html @@ -64,6 +64,7 @@ $(function() {
        @@ -78,21 +79,20 @@ Inheritance diagram for shaka::media::MediaHandler:
        -shaka::media::AdCueGenerator -shaka::media::ChunkingHandler -shaka::media::CueAlignmentHandler -shaka::media::EncryptionHandler -shaka::media::FakeInputMediaHandler -shaka::media::FakeMediaHandler -shaka::media::MockOutputMediaHandler -shaka::media::Muxer -shaka::media::OriginHandler -shaka::media::Replicator -shaka::media::TextChunker -shaka::media::TextPadder -shaka::media::TrickPlayHandler -shaka::media::WebVttTextOutputHandler -shaka::media::WebVttToMp4Handler +shaka::media::ChunkingHandler +shaka::media::CueAlignmentHandler +shaka::media::EncryptionHandler +shaka::media::FakeInputMediaHandler +shaka::media::FakeMediaHandler +shaka::media::MockOutputMediaHandler +shaka::media::Muxer +shaka::media::OriginHandler +shaka::media::Replicator +shaka::media::TextChunker +shaka::media::TextPadder +shaka::media::TrickPlayHandler +shaka::media::WebVttTextOutputHandler +shaka::media::WebVttToMp4Handler
        @@ -113,6 +113,12 @@ bool 
         Validate if the handler is connected to its upstream handler.
         
        + + + +

        +Static Public Member Functions

        +static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list)
         
        @@ -175,9 +181,9 @@ const std::map< size_t, std::pair< std::shared_ptr<

        Protected Member Functions

        virtual Status InitializeInternal ()=0
         

        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.

        +

        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 the replicator media handler. Other types of media handlers are disallowed and not supported.

        -

        Definition at line 150 of file media_handler.h.

        +

        Definition at line 154 of file media_handler.h.

        Member Function Documentation

        ◆ Dispatch()

        @@ -204,7 +210,7 @@ const std::map< size_t, std::pair< std::shared_ptr<
        @@ -224,7 +230,7 @@ const std::map< size_t, std::pair< std::shared_ptr< @@ -292,7 +298,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 88f5df2e94..9882150bae 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 f53722a2f6..7bf5bcd63f 100644 --- a/docs/db/d04/webvtt__parser_8cc_source.html +++ b/docs/db/d04/webvtt__parser_8cc_source.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/db/d05/structshaka_1_1media_1_1H265SliceHeader.html b/docs/db/d05/structshaka_1_1media_1_1H265SliceHeader.html index eb285422c0..c735c12c9e 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 1a7e2f42bf..f9645bc41c 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 @@ -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 deace16c81..d73d26e8cf 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 fec8444f68..db198c1c19 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 3362f94003..73f934c146 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 f97860d3b3..b06bc6389a 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 b0cbc412e2..b4cd8d6b37 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 @@ -153,7 +153,7 @@ uint32_t flags = 0 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 3a44f5eaaa..8f43d06fe6 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 1e4f971e4b..0df0639541 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 @@ -121,6 +121,10 @@ bool 

        Additional Inherited Members

        +- Static Public Member Functions inherited from shaka::media::MediaHandler + +static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list) +  - Protected Member Functions inherited from shaka::media::Muxer const MuxerOptionsoptions () const @@ -205,7 +209,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 99a1d3489c..4b1b394f1d 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 4b6687de71..b9b2ce81f6 100644 --- a/docs/db/d31/track__run__iterator_8cc_source.html +++ b/docs/db/d31/track__run__iterator_8cc_source.html @@ -121,7 +121,7 @@ $(function() { 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 17042c2e49..531563e372 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 6c64e4a250..d2bc157a65 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 807acb324b..f1ae4b0cd9 100644 --- a/docs/db/d45/mpd__notify__muxer__listener_8h_source.html +++ b/docs/db/d45/mpd__notify__muxer__listener_8h_source.html @@ -67,7 +67,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 // Implementation of MuxerListener that deals with MpdNotifier.
        8 
        9 #ifndef PACKAGER_MEDIA_EVENT_MPD_NOTIFY_MUXER_LISTENER_H_
        10 #define PACKAGER_MEDIA_EVENT_MPD_NOTIFY_MUXER_LISTENER_H_
        11 
        12 #include <memory>
        13 #include <vector>
        14 
        15 #include "packager/base/optional.h"
        16 #include "packager/media/base/muxer_options.h"
        17 #include "packager/media/event/event_info.h"
        18 #include "packager/media/event/muxer_listener.h"
        19 
        20 namespace shaka {
        21 
        22 class MediaInfo;
        23 class MpdNotifier;
        24 
        25 namespace media {
        26 
        28  public:
        31  explicit MpdNotifyMuxerListener(MpdNotifier* mpd_notifier);
        32  ~MpdNotifyMuxerListener() override;
        33 
        36  void OnEncryptionInfoReady(bool is_initial_encryption_info,
        37  FourCC protection_scheme,
        38  const std::vector<uint8_t>& key_id,
        39  const std::vector<uint8_t>& iv,
        40  const std::vector<ProtectionSystemSpecificInfo>&
        41  key_system_info) override;
        42  void OnEncryptionStart() override;
        43  void OnMediaStart(const MuxerOptions& muxer_options,
        44  const StreamInfo& stream_info,
        45  uint32_t time_scale,
        46  ContainerType container_type) override;
        47  void OnSampleDurationReady(uint32_t sample_duration) override;
        48  void OnMediaEnd(const MediaRanges& media_ranges,
        49  float duration_seconds) override;
        50  void OnNewSegment(const std::string& file_name,
        51  uint64_t start_time,
        52  uint64_t duration,
        53  uint64_t segment_file_size) override;
        54  void OnKeyFrame(uint64_t timestamp,
        55  uint64_t start_byte_offset,
        56  uint64_t size);
        57  void OnCueEvent(uint64_t timestamp, const std::string& cue_data) override;
        59 
        60  private:
        62  MpdNotifyMuxerListener& operator=(const MpdNotifyMuxerListener&) = delete;
        63 
        64  bool NotifyNewContainer();
        65 
        66  MpdNotifier* const mpd_notifier_ = nullptr;
        67  base::Optional<uint32_t> notification_id_;
        68  std::unique_ptr<MediaInfo> media_info_;
        69 
        70  bool is_encrypted_ = false;
        71  // Storage for values passed to OnEncryptionInfoReady().
        72  FourCC protection_scheme_ = FOURCC_NULL;
        73  std::vector<uint8_t> default_key_id_;
        74  std::vector<ProtectionSystemSpecificInfo> key_system_info_;
        75 
        76  // Saves all the Subsegment and CueEvent information for VOD. This should be
        77  // used to call NotifyNewSegment() and NotifyCueEvent after
        78  // NotifyNewContainer() is called (in OnMediaEnd). This is not used for live
        79  // because NotifyNewSegment() is called immediately in OnNewSegment(), and
        80  // NotifyCueEvent is called immediately in OnCueEvent.
        81  std::vector<EventInfo> event_info_;
        82 };
        83 
        84 } // namespace media
        85 } // namespace shaka
        86 
        87 #endif // PACKAGER_MEDIA_EVENT_MPD_NOTIFY_MUXER_LISTENER_H_
        void OnNewSegment(const std::string &file_name, uint64_t start_time, uint64_t duration, uint64_t segment_file_size) override
        -
        Abstract class holds stream information.
        Definition: stream_info.h:59
        +
        Abstract class holds stream information.
        Definition: stream_info.h:61
        All the methods that are virtual are virtual for mocking.
        void OnCueEvent(uint64_t timestamp, const std::string &cue_data) override
        @@ -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 6e1c488ed8..6931c4c9f8 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 5b32d73658..8b44e18802 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 1511d933b5..00d73c1e3e 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 3af8b68bb5..c32039e213 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 764745de2c..64bab862d2 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 f6c54644a5..b8720bff1d 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 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
        +
        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 #include "packager/media/base/video_stream_info.h"
        16 
        17 namespace shaka {
        18 namespace media {
        19 
        20 std::string BoolToString(bool value);
        21 std::string ToPrettyString(const std::string& str);
        22 
        23 bool TryMatchStreamDataType(const StreamDataType& actual,
        24  const StreamDataType& expected,
        25  ::testing::MatchResultListener* listener);
        26 
        27 bool TryMatchStreamType(const StreamType& actual,
        28  const StreamType& expected,
        29  ::testing::MatchResultListener* listener);
        30 
        31 template <typename T, typename M>
        32 bool TryMatch(const T& value,
        33  const M& matcher,
        34  ::testing::MatchResultListener* listener,
        35  const char* value_name) {
        36  if (!ExplainMatchResult(matcher, value, listener)) {
        37  // Need a space at the start of the string in the case that
        38  // it gets combined with another string.
        39  *listener << " Mismatch on " << value_name;
        40  return false;
        41  }
        42 
        43  return true;
        44 }
        45 
        46 MATCHER_P4(IsStreamInfo, stream_index, time_scale, encrypted, language, "") {
        47  if (!TryMatchStreamDataType(arg->stream_data_type,
        48  StreamDataType::kStreamInfo, result_listener)) {
        49  return false;
        50  }
        51 
        52  const std::string is_encrypted_string =
        53  BoolToString(arg->stream_info->is_encrypted());
        54 
        55  *result_listener << "which is (" << arg->stream_index << ", "
        56  << arg->stream_info->time_scale() << ", "
        57  << is_encrypted_string << ", "
        58  << arg->stream_info->language() << ")";
        59 
        60  return TryMatch(arg->stream_index, stream_index, result_listener,
        61  "stream_index") &&
        62  TryMatch(arg->stream_info->time_scale(), time_scale, result_listener,
        63  "time_scale") &&
        64  TryMatch(arg->stream_info->is_encrypted(), encrypted, result_listener,
        65  "is_encrypted") &&
        66  TryMatch(arg->stream_info->language(), language, result_listener,
        67  "language");
        68 }
        69 
        70 MATCHER_P3(IsVideoStream, stream_index, trick_play_factor, playback_rate, "") {
        71  if (!TryMatchStreamDataType(arg->stream_data_type,
        72  StreamDataType::kStreamInfo, result_listener)) {
        73  return false;
        74  }
        75 
        76  if (!TryMatchStreamType(arg->stream_info->stream_type(), kStreamVideo,
        77  result_listener)) {
        78  return false;
        79  }
        80 
        81  const VideoStreamInfo* info =
        82  static_cast<const VideoStreamInfo*>(arg->stream_info.get());
        83 
        84  *result_listener << "which is (" << arg->stream_index << ", "
        85  << info->trick_play_factor() << ", " << info->playback_rate()
        86  << ")";
        87 
        88  return TryMatch(arg->stream_index, stream_index, result_listener,
        89  "stream_index") &&
        90  TryMatch(info->trick_play_factor(), trick_play_factor, result_listener,
        91  "trick_play_factor") &&
        92  TryMatch(info->playback_rate(), playback_rate, result_listener,
        93  "playback_rate");
        94 }
        95 
        96 MATCHER_P5(IsSegmentInfo,
        97  stream_index,
        98  start_timestamp,
        99  duration,
        100  subsegment,
        101  encrypted,
        102  "") {
        103  if (!TryMatchStreamDataType(arg->stream_data_type,
        104  StreamDataType::kSegmentInfo, result_listener)) {
        105  return false;
        106  }
        107 
        108  const std::string is_subsegment_string =
        109  BoolToString(arg->segment_info->is_subsegment);
        110  const std::string is_encrypted_string =
        111  BoolToString(arg->segment_info->is_encrypted);
        112 
        113  *result_listener << "which is (" << arg->stream_index << ", "
        114  << arg->segment_info->start_timestamp << ", "
        115  << arg->segment_info->duration << ", "
        116  << is_subsegment_string << ", " << is_encrypted_string
        117  << ")";
        118 
        119  return TryMatch(arg->stream_index, stream_index, result_listener,
        120  "stream_index") &&
        121  TryMatch(arg->segment_info->start_timestamp, start_timestamp,
        122  result_listener, "start_timestamp") &&
        123  TryMatch(arg->segment_info->duration, duration, result_listener,
        124  "duration") &&
        125  TryMatch(arg->segment_info->is_subsegment, subsegment, result_listener,
        126  "is_subsegment") &&
        127  TryMatch(arg->segment_info->is_encrypted, encrypted, result_listener,
        128  "is_encrypted");
        129 }
        130 
        131 MATCHER_P6(MatchEncryptionConfig,
        132  protection_scheme,
        133  crypt_byte_block,
        134  skip_byte_block,
        135  per_sample_iv_size,
        136  constant_iv,
        137  key_id,
        138  "") {
        139  const std::string constant_iv_hex =
        140  base::HexEncode(arg.constant_iv.data(), arg.constant_iv.size());
        141  const std::string key_id_hex =
        142  base::HexEncode(arg.key_id.data(), arg.key_id.size());
        143  const std::string protection_scheme_as_string =
        144  FourCCToString(arg.protection_scheme);
        145  // Convert to integers so that they will print as a number and not a uint8_t
        146  // (char).
        147  const int crypt_byte_as_int = static_cast<int>(arg.crypt_byte_block);
        148  const int skip_byte_as_int = static_cast<int>(arg.skip_byte_block);
        149 
        150  *result_listener << "which is (" << protection_scheme_as_string << ", "
        151  << crypt_byte_as_int << ", " << skip_byte_as_int << ", "
        152  << arg.per_sample_iv_size << ", " << constant_iv_hex << ", "
        153  << key_id_hex << ")";
        154 
        155  return TryMatch(arg.protection_scheme, protection_scheme, result_listener,
        156  "protection_scheme") &&
        157  TryMatch(arg.crypt_byte_block, crypt_byte_block, result_listener,
        158  "crypt_byte_block") &&
        159  TryMatch(arg.skip_byte_block, skip_byte_block, result_listener,
        160  "skip_byte_block") &&
        161  TryMatch(arg.per_sample_iv_size, per_sample_iv_size, result_listener,
        162  "per_sample_iv_size") &&
        163  TryMatch(arg.constant_iv, constant_iv, result_listener,
        164  "constant_iv") &&
        165  TryMatch(arg.key_id, key_id, result_listener, "key_id");
        166 }
        167 
        168 MATCHER_P5(IsMediaSample,
        169  stream_index,
        170  timestamp,
        171  duration,
        172  encrypted,
        173  keyframe,
        174  "") {
        175  if (!TryMatchStreamDataType(arg->stream_data_type,
        176  StreamDataType::kMediaSample, result_listener)) {
        177  return false;
        178  }
        179 
        180  const std::string is_encrypted_string =
        181  BoolToString(arg->media_sample->is_encrypted());
        182  const std::string is_key_frame_string =
        183  BoolToString(arg->media_sample->is_key_frame());
        184 
        185  *result_listener << "which is (" << arg->stream_index << ", "
        186  << arg->media_sample->dts() << ", "
        187  << arg->media_sample->duration() << ", "
        188  << is_encrypted_string << ", " << is_key_frame_string << ")";
        189 
        190  return TryMatch(arg->stream_index, stream_index, result_listener,
        191  "stream_index") &&
        192  TryMatch(arg->media_sample->dts(), timestamp, result_listener,
        193  "dts") &&
        194  TryMatch(arg->media_sample->duration(), duration, result_listener,
        195  "duration") &&
        196  TryMatch(arg->media_sample->is_encrypted(), encrypted, result_listener,
        197  "is_encrypted") &&
        198  TryMatch(arg->media_sample->is_key_frame(), keyframe, result_listener,
        199  "is_key_frame");
        200 }
        201 
        202 MATCHER_P6(IsTextSample,
        203  stream_index,
        204  id,
        205  start_time,
        206  end_time,
        207  settings,
        208  payload,
        209  "") {
        210  if (!TryMatchStreamDataType(arg->stream_data_type,
        211  StreamDataType::kTextSample, result_listener)) {
        212  return false;
        213  }
        214 
        215  *result_listener << "which is (" << arg->stream_index << ", "
        216  << ToPrettyString(arg->text_sample->id()) << ", "
        217  << arg->text_sample->start_time() << ", "
        218  << arg->text_sample->EndTime() << ", "
        219  << ToPrettyString(arg->text_sample->settings()) << ", "
        220  << ToPrettyString(arg->text_sample->payload()) << ")";
        221 
        222  return TryMatch(arg->stream_index, stream_index, result_listener,
        223  "stream_index") &&
        224  TryMatch(arg->text_sample->id(), id, result_listener, "id") &&
        225  TryMatch(arg->text_sample->start_time(), start_time, result_listener,
        226  "start_time") &&
        227  TryMatch(arg->text_sample->EndTime(), end_time, result_listener,
        228  "EndTime") &&
        229  TryMatch(arg->text_sample->settings(), settings, result_listener,
        230  "settings") &&
        231  TryMatch(arg->text_sample->payload(), payload, result_listener,
        232  "payload");
        233 }
        234 
        235 MATCHER_P2(IsCueEvent, stream_index, time_in_seconds, "") {
        236  if (!TryMatchStreamDataType(arg->stream_data_type, StreamDataType::kCueEvent,
        237  result_listener)) {
        238  return false;
        239  }
        240 
        241  *result_listener << "which is (" << arg->stream_index << ", "
        242  << arg->cue_event->time_in_seconds << ")";
        243 
        244  return TryMatch(arg->stream_index, stream_index, result_listener,
        245  "stream_index") &&
        246  TryMatch(arg->cue_event->time_in_seconds, time_in_seconds,
        247  result_listener, "time_in_seconds");
        248 }
        249 
        251  public:
        255 
        256  private:
        257  bool ValidateOutputStreamIndex(size_t index) const override;
        258  Status InitializeInternal() override;
        259  Status Process(std::unique_ptr<StreamData> stream_data) override;
        260 };
        261 
        263  public:
        264  MOCK_METHOD1(OnProcess, void(const StreamData*));
        265  MOCK_METHOD1(OnFlush, void(size_t index));
        266 
        267  private:
        268  Status InitializeInternal() override;
        269  Status Process(std::unique_ptr<StreamData> stream_data) override;
        270  Status OnFlushRequest(size_t index) override;
        271 };
        272 
        273 // TODO(vaage) : Remove this test handler and convert other tests to use
        274 // FakeInputMediaHandler and MockOutputMediaHandler.
        276  public:
        277  const std::vector<std::unique_ptr<StreamData>>& stream_data_vector() const {
        278  return stream_data_vector_;
        279  }
        280  void clear_stream_data_vector() { stream_data_vector_.clear(); }
        281 
        282  protected:
        283  Status InitializeInternal() override;
        284  Status Process(std::unique_ptr<StreamData> stream_data) override;
        285  Status OnFlushRequest(size_t input_stream_index) override;
        286  bool ValidateOutputStreamIndex(size_t stream_index) const override;
        287 
        288  std::vector<std::unique_ptr<StreamData>> stream_data_vector_;
        289 };
        290 
        291 class MediaHandlerTestBase : public ::testing::Test {
        292  public:
        293  MediaHandlerTestBase() = default;
        294 
        295  protected:
        296  bool IsVideoCodec(Codec codec) const;
        297 
        298  std::unique_ptr<StreamInfo> GetVideoStreamInfo(uint32_t time_scale) const;
        299 
        300  std::unique_ptr<StreamInfo> GetVideoStreamInfo(uint32_t time_scale,
        301  uint32_t width,
        302  uint64_t height) const;
        303 
        304  std::unique_ptr<StreamInfo> GetVideoStreamInfo(uint32_t time_scale,
        305  Codec codec) const;
        306 
        307  std::unique_ptr<StreamInfo> GetVideoStreamInfo(uint32_t time_scale,
        308  Codec codec,
        309  uint32_t width,
        310  uint64_t height) const;
        311 
        312  std::unique_ptr<StreamInfo> GetAudioStreamInfo(uint32_t time_scale) const;
        313 
        314  std::unique_ptr<StreamInfo> GetAudioStreamInfo(uint32_t time_scale,
        315  Codec codec) const;
        316 
        317  std::shared_ptr<MediaSample> GetMediaSample(int64_t timestamp,
        318  int64_t duration,
        319  bool is_keyframe) const;
        320 
        321  std::shared_ptr<MediaSample> GetMediaSample(int64_t timestamp,
        322  int64_t duration,
        323  bool is_keyframe,
        324  const uint8_t* data,
        325  size_t data_length) const;
        326 
        327  std::unique_ptr<SegmentInfo> GetSegmentInfo(int64_t start_timestamp,
        328  int64_t duration,
        329  bool is_subsegment) const;
        330 
        331  std::unique_ptr<StreamInfo> GetTextStreamInfo(uint32_t timescale) const;
        332 
        333  std::unique_ptr<TextSample> GetTextSample(const std::string& id,
        334  int64_t start,
        335  int64_t end,
        336  const std::string& payload) const;
        337 
        338  std::unique_ptr<CueEvent> GetCueEvent(double time_in_seconds) const;
        339 
        340  // Connect and initialize all handlers.
        341  Status SetUpAndInitializeGraph(std::shared_ptr<MediaHandler> handler,
        342  size_t input_count,
        343  size_t output_count);
        344 
        345  // Get the input handler at |index|. The values of |index| will match the
        346  // call to |AddInput|.
        347  FakeInputMediaHandler* Input(size_t index);
        348 
        349  // Get the output handler at |index|. The values of |index| will match the
        350  // call to |AddOutput|.
        351  MockOutputMediaHandler* Output(size_t index);
        352 
        353  private:
        355  MediaHandlerTestBase& operator=(const MediaHandlerTestBase&) = delete;
        356 
        357  std::shared_ptr<MediaHandler> handler_;
        358 
        359  std::vector<std::shared_ptr<FakeInputMediaHandler>> inputs_;
        360  std::vector<std::shared_ptr<MockOutputMediaHandler>> outputs_;
        361 };
        362 
        364  public:
        366 
        367  protected:
        369  void SetUpGraph(size_t num_inputs,
        370  size_t num_outputs,
        371  std::shared_ptr<MediaHandler> handler);
        372 
        374  const std::vector<std::unique_ptr<StreamData>>& GetOutputStreamDataVector()
        375  const;
        376 
        378  void ClearOutputStreamDataVector();
        379 
        381  std::shared_ptr<MediaHandler> some_handler() { return some_handler_; }
        382 
        384  std::shared_ptr<FakeMediaHandler> next_handler() { return next_handler_; }
        385 
        386  private:
        389  delete;
        390 
        391  // Downstream handler used in testing graph.
        392  std::shared_ptr<FakeMediaHandler> next_handler_;
        393  // Some random handler which can be used for testing.
        394  std::shared_ptr<MediaHandler> some_handler_;
        395 };
        396 
        397 } // namespace media
        398 } // namespace shaka
        399 
        400 #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()
        + + +
        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 ce806c0b90..ddea296b15 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 506eac80e4..d10e6aac69 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 c65ef09ed7..e7f440a3df 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 e41241e238..401d571378 100644 --- a/docs/db/d66/udp__file_8cc_source.html +++ b/docs/db/d66/udp__file_8cc_source.html @@ -66,11 +66,11 @@ $(function() {
        udp_file.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/file/udp_file.h"
        8 
        9 #if defined(OS_WIN)
        10 
        11 #include <windows.h>
        12 #include <ws2tcpip.h>
        13 #define close closesocket
        14 
        15 #else
        16 
        17 #include <arpa/inet.h>
        18 #include <errno.h>
        19 #include <strings.h>
        20 #include <sys/socket.h>
        21 #include <unistd.h>
        22 #define INVALID_SOCKET -1
        23 
        24 // IP_MULTICAST_ALL has been supported since kernel version 2.6.31 but we may be
        25 // building on a machine that is older than that.
        26 #ifndef IP_MULTICAST_ALL
        27 #define IP_MULTICAST_ALL 49
        28 #endif
        29 
        30 #endif // defined(OS_WIN)
        31 
        32 #include <limits>
        33 
        34 #include "packager/base/logging.h"
        35 #include "packager/file/udp_options.h"
        36 
        37 namespace shaka {
        38 
        39 namespace {
        40 
        41 bool IsIpv4MulticastAddress(const struct in_addr& addr) {
        42  return (ntohl(addr.s_addr) & 0xf0000000) == 0xe0000000;
        43 }
        44 
        45 } // anonymous namespace
        46 
        47 UdpFile::UdpFile(const char* file_name)
        48  : File(file_name), socket_(INVALID_SOCKET) {}
        49 
        50 UdpFile::~UdpFile() {}
        51 
        53  if (socket_ != INVALID_SOCKET) {
        54  close(socket_);
        55  socket_ = INVALID_SOCKET;
        56  }
        57  delete this;
        58  return true;
        59 }
        60 
        61 int64_t UdpFile::Read(void* buffer, uint64_t length) {
        62  DCHECK(buffer);
        63  DCHECK_GE(length, 65535u)
        64  << "Buffer may be too small to read entire datagram.";
        65 
        66  if (socket_ == INVALID_SOCKET)
        67  return -1;
        68 
        69  int64_t result;
        70  do {
        71  result =
        72  recvfrom(socket_, reinterpret_cast<char*>(buffer), length, 0, NULL, 0);
        73  } while ((result == -1) && (errno == EINTR));
        74 
        75  return result;
        76 }
        77 
        78 int64_t UdpFile::Write(const void* buffer, uint64_t length) {
        79  NOTIMPLEMENTED();
        80  return -1;
        81 }
        82 
        83 int64_t UdpFile::Size() {
        84  if (socket_ == INVALID_SOCKET)
        85  return -1;
        86 
        87  return std::numeric_limits<int64_t>::max();
        88 }
        89 
        91  NOTIMPLEMENTED();
        92  return false;
        93 }
        94 
        95 bool UdpFile::Seek(uint64_t position) {
        96  NOTIMPLEMENTED();
        97  return false;
        98 }
        99 
        100 bool UdpFile::Tell(uint64_t* position) {
        101  NOTIMPLEMENTED();
        102  return false;
        103 }
        104 
        105 #if defined(OS_WIN)
        106 class LibWinsockInitializer {
        107  public:
        108  LibWinsockInitializer() {
        109  WSADATA wsa_data;
        110  error_ = WSAStartup(MAKEWORD(2, 2), &wsa_data);
        111  }
        112 
        113  ~LibWinsockInitializer() {
        114  if (error_ == 0)
        115  WSACleanup();
        116  }
        117 
        118  int error() const { return error_; }
        119 
        120  private:
        121  int error_;
        122 };
        123 #endif // defined(OS_WIN)
        124 
        125 class ScopedSocket {
        126  public:
        127  explicit ScopedSocket(SOCKET sock_fd) : sock_fd_(sock_fd) {}
        128 
        129  ~ScopedSocket() {
        130  if (sock_fd_ != INVALID_SOCKET)
        131  close(sock_fd_);
        132  }
        133 
        134  SOCKET get() { return sock_fd_; }
        135 
        136  SOCKET release() {
        137  SOCKET socket = sock_fd_;
        138  sock_fd_ = INVALID_SOCKET;
        139  return socket;
        140  }
        141 
        142  private:
        143  SOCKET sock_fd_;
        144 
        145  DISALLOW_COPY_AND_ASSIGN(ScopedSocket);
        146 };
        147 
        149 #if defined(OS_WIN)
        150  static LibWinsockInitializer lib_winsock_initializer;
        151  if (lib_winsock_initializer.error() != 0) {
        152  LOG(ERROR) << "Winsock start up failed with error "
        153  << lib_winsock_initializer.error();
        154  return false;
        155  }
        156 #endif // defined(OS_WIN)
        157 
        158  DCHECK_EQ(INVALID_SOCKET, socket_);
        159 
        160  std::unique_ptr<UdpOptions> options =
        162  if (!options)
        163  return false;
        164 
        165  ScopedSocket new_socket(socket(AF_INET, SOCK_DGRAM, 0));
        166  if (new_socket.get() == INVALID_SOCKET) {
        167  LOG(ERROR) << "Could not allocate socket.";
        168  return false;
        169  }
        170 
        171  struct in_addr local_in_addr = {0};
        172  if (inet_pton(AF_INET, options->address().c_str(), &local_in_addr) != 1) {
        173  LOG(ERROR) << "Malformed IPv4 address " << options->address();
        174  return false;
        175  }
        176 
        177  struct sockaddr_in local_sock_addr = {0};
        178  // TODO(kqyang): Support IPv6.
        179  local_sock_addr.sin_family = AF_INET;
        180  local_sock_addr.sin_port = htons(options->port());
        181  const bool is_multicast = IsIpv4MulticastAddress(local_in_addr);
        182  if (is_multicast) {
        183  local_sock_addr.sin_addr.s_addr = htonl(INADDR_ANY);
        184  } else {
        185  local_sock_addr.sin_addr = local_in_addr;
        186  }
        187 
        188  if (options->reuse()) {
        189  const int optval = 1;
        190  if (setsockopt(new_socket.get(), SOL_SOCKET, SO_REUSEADDR,
        191  reinterpret_cast<const char*>(&optval),
        192  sizeof(optval)) < 0) {
        193  LOG(ERROR)
        194  << "Could not apply the SO_REUSEADDR property to the UDP socket";
        195  return false;
        196  }
        197  }
        198 
        199  if (bind(new_socket.get(),
        200  reinterpret_cast<struct sockaddr*>(&local_sock_addr),
        201  sizeof(local_sock_addr))) {
        202  LOG(ERROR) << "Could not bind UDP socket";
        203  return false;
        204  }
        205 
        206  if (is_multicast) {
        207  if (options->is_source_specific_multicast()) {
        208  struct ip_mreq_source source_multicast_group;
        209 
        210  source_multicast_group.imr_multiaddr = local_in_addr;
        211  if (inet_pton(AF_INET,
        212  options->interface_address().c_str(),
        213  &source_multicast_group.imr_interface) != 1) {
        214  LOG(ERROR) << "Malformed IPv4 interface address "
        215  << options->interface_address();
        216  return false;
        217  }
        218  if (inet_pton(AF_INET,
        219  options->source_address().c_str(),
        220  &source_multicast_group.imr_sourceaddr) != 1) {
        221  LOG(ERROR) << "Malformed IPv4 source specific multicast address "
        222  << options->source_address();
        223  return false;
        224  }
        225 
        226  if (setsockopt(new_socket.get(),
        227  IPPROTO_IP,
        228  IP_ADD_SOURCE_MEMBERSHIP,
        229  reinterpret_cast<const char*>(&source_multicast_group),
        230  sizeof(source_multicast_group)) < 0) {
        231  LOG(ERROR) << "Failed to join multicast group.";
        232  return false;
        233  }
        234  } else {
        235  // this is a v2 join without a specific source.
        236  struct ip_mreq multicast_group;
        237 
        238  multicast_group.imr_multiaddr = local_in_addr;
        239 
        240  if (inet_pton(AF_INET, options->interface_address().c_str(),
        241  &multicast_group.imr_interface) != 1) {
        242  LOG(ERROR) << "Malformed IPv4 interface address "
        243  << options->interface_address();
        244  return false;
        245  }
        246 
        247  if (setsockopt(new_socket.get(), IPPROTO_IP, IP_ADD_MEMBERSHIP,
        248  reinterpret_cast<const char*>(&multicast_group),
        249  sizeof(multicast_group)) < 0) {
        250  LOG(ERROR) << "Failed to join multicast group.";
        251  return false;
        252  }
        253 
        254  }
        255 
        256 #if defined(__linux__)
        257  // Disable IP_MULTICAST_ALL to avoid interference caused when two sockets
        258  // are bound to the same port but joined to different multicast groups.
        259  const int optval_zero = 0;
        260  if (setsockopt(new_socket.get(), IPPROTO_IP, IP_MULTICAST_ALL,
        261  reinterpret_cast<const char*>(&optval_zero),
        262  sizeof(optval_zero)) < 0 &&
        263  errno != ENOPROTOOPT) {
        264  LOG(ERROR) << "Failed to disable IP_MULTICAST_ALL option.";
        265  return false;
        266  }
        267 #endif // #if defined(__linux__)
        268  }
        269 
        270  // Set timeout if needed.
        271  if (options->timeout_us() != 0) {
        272  struct timeval tv;
        273  tv.tv_sec = options->timeout_us() / 1000000;
        274  tv.tv_usec = options->timeout_us() % 1000000;
        275  if (setsockopt(new_socket.get(), SOL_SOCKET, SO_RCVTIMEO,
        276  reinterpret_cast<char*>(&tv), sizeof(tv)) < 0) {
        277  LOG(ERROR) << "Failed to set socket timeout.";
        278  return false;
        279  }
        280  }
        281 
        282  socket_ = new_socket.release();
        283  return true;
        284 }
        285 
        286 } // namespace shaka
        int64_t Read(void *buffer, uint64_t length) override
        Definition: udp_file.cc:61
        +
        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/file/udp_file.h"
        8 
        9 #if defined(OS_WIN)
        10 
        11 #include <windows.h>
        12 #include <ws2tcpip.h>
        13 #define close closesocket
        14 
        15 #else
        16 
        17 #include <arpa/inet.h>
        18 #include <errno.h>
        19 #include <strings.h>
        20 #include <sys/socket.h>
        21 #include <unistd.h>
        22 #define INVALID_SOCKET -1
        23 
        24 // IP_MULTICAST_ALL has been supported since kernel version 2.6.31 but we may be
        25 // building on a machine that is older than that.
        26 #ifndef IP_MULTICAST_ALL
        27 #define IP_MULTICAST_ALL 49
        28 #endif
        29 
        30 #endif // defined(OS_WIN)
        31 
        32 #include <limits>
        33 
        34 #include "packager/base/logging.h"
        35 #include "packager/file/udp_options.h"
        36 
        37 namespace shaka {
        38 
        39 namespace {
        40 
        41 bool IsIpv4MulticastAddress(const struct in_addr& addr) {
        42  return (ntohl(addr.s_addr) & 0xf0000000) == 0xe0000000;
        43 }
        44 
        45 } // anonymous namespace
        46 
        47 UdpFile::UdpFile(const char* file_name)
        48  : File(file_name), socket_(INVALID_SOCKET) {}
        49 
        50 UdpFile::~UdpFile() {}
        51 
        53  if (socket_ != INVALID_SOCKET) {
        54  close(socket_);
        55  socket_ = INVALID_SOCKET;
        56  }
        57  delete this;
        58  return true;
        59 }
        60 
        61 int64_t UdpFile::Read(void* buffer, uint64_t length) {
        62  DCHECK(buffer);
        63  DCHECK_GE(length, 65535u)
        64  << "Buffer may be too small to read entire datagram.";
        65 
        66  if (socket_ == INVALID_SOCKET)
        67  return -1;
        68 
        69  int64_t result;
        70  do {
        71  result =
        72  recvfrom(socket_, reinterpret_cast<char*>(buffer), length, 0, NULL, 0);
        73  } while ((result == -1) && (errno == EINTR));
        74 
        75  return result;
        76 }
        77 
        78 int64_t UdpFile::Write(const void* buffer, uint64_t length) {
        79  NOTIMPLEMENTED();
        80  return -1;
        81 }
        82 
        83 int64_t UdpFile::Size() {
        84  if (socket_ == INVALID_SOCKET)
        85  return -1;
        86 
        87  return std::numeric_limits<int64_t>::max();
        88 }
        89 
        91  NOTIMPLEMENTED();
        92  return false;
        93 }
        94 
        95 bool UdpFile::Seek(uint64_t position) {
        96  NOTIMPLEMENTED();
        97  return false;
        98 }
        99 
        100 bool UdpFile::Tell(uint64_t* position) {
        101  NOTIMPLEMENTED();
        102  return false;
        103 }
        104 
        105 #if defined(OS_WIN)
        106 class LibWinsockInitializer {
        107  public:
        108  LibWinsockInitializer() {
        109  WSADATA wsa_data;
        110  error_ = WSAStartup(MAKEWORD(2, 2), &wsa_data);
        111  }
        112 
        113  ~LibWinsockInitializer() {
        114  if (error_ == 0)
        115  WSACleanup();
        116  }
        117 
        118  int error() const { return error_; }
        119 
        120  private:
        121  int error_;
        122 };
        123 #endif // defined(OS_WIN)
        124 
        125 class ScopedSocket {
        126  public:
        127  explicit ScopedSocket(SOCKET sock_fd) : sock_fd_(sock_fd) {}
        128 
        129  ~ScopedSocket() {
        130  if (sock_fd_ != INVALID_SOCKET)
        131  close(sock_fd_);
        132  }
        133 
        134  SOCKET get() { return sock_fd_; }
        135 
        136  SOCKET release() {
        137  SOCKET socket = sock_fd_;
        138  sock_fd_ = INVALID_SOCKET;
        139  return socket;
        140  }
        141 
        142  private:
        143  SOCKET sock_fd_;
        144 
        145  DISALLOW_COPY_AND_ASSIGN(ScopedSocket);
        146 };
        147 
        149 #if defined(OS_WIN)
        150  static LibWinsockInitializer lib_winsock_initializer;
        151  if (lib_winsock_initializer.error() != 0) {
        152  LOG(ERROR) << "Winsock start up failed with error "
        153  << lib_winsock_initializer.error();
        154  return false;
        155  }
        156 #endif // defined(OS_WIN)
        157 
        158  DCHECK_EQ(INVALID_SOCKET, socket_);
        159 
        160  std::unique_ptr<UdpOptions> options =
        162  if (!options)
        163  return false;
        164 
        165  ScopedSocket new_socket(socket(AF_INET, SOCK_DGRAM, 0));
        166  if (new_socket.get() == INVALID_SOCKET) {
        167  LOG(ERROR) << "Could not allocate socket.";
        168  return false;
        169  }
        170 
        171  struct in_addr local_in_addr = {0};
        172  if (inet_pton(AF_INET, options->address().c_str(), &local_in_addr) != 1) {
        173  LOG(ERROR) << "Malformed IPv4 address " << options->address();
        174  return false;
        175  }
        176 
        177  struct sockaddr_in local_sock_addr = {0};
        178  // TODO(kqyang): Support IPv6.
        179  local_sock_addr.sin_family = AF_INET;
        180  local_sock_addr.sin_port = htons(options->port());
        181  const bool is_multicast = IsIpv4MulticastAddress(local_in_addr);
        182  if (is_multicast) {
        183  local_sock_addr.sin_addr.s_addr = htonl(INADDR_ANY);
        184  } else {
        185  local_sock_addr.sin_addr = local_in_addr;
        186  }
        187 
        188  if (options->reuse()) {
        189  const int optval = 1;
        190  if (setsockopt(new_socket.get(), SOL_SOCKET, SO_REUSEADDR,
        191  reinterpret_cast<const char*>(&optval),
        192  sizeof(optval)) < 0) {
        193  LOG(ERROR)
        194  << "Could not apply the SO_REUSEADDR property to the UDP socket";
        195  return false;
        196  }
        197  }
        198 
        199  if (bind(new_socket.get(),
        200  reinterpret_cast<struct sockaddr*>(&local_sock_addr),
        201  sizeof(local_sock_addr))) {
        202  LOG(ERROR) << "Could not bind UDP socket";
        203  return false;
        204  }
        205 
        206  if (is_multicast) {
        207  if (options->is_source_specific_multicast()) {
        208  struct ip_mreq_source source_multicast_group;
        209 
        210  source_multicast_group.imr_multiaddr = local_in_addr;
        211  if (inet_pton(AF_INET,
        212  options->interface_address().c_str(),
        213  &source_multicast_group.imr_interface) != 1) {
        214  LOG(ERROR) << "Malformed IPv4 interface address "
        215  << options->interface_address();
        216  return false;
        217  }
        218  if (inet_pton(AF_INET,
        219  options->source_address().c_str(),
        220  &source_multicast_group.imr_sourceaddr) != 1) {
        221  LOG(ERROR) << "Malformed IPv4 source specific multicast address "
        222  << options->source_address();
        223  return false;
        224  }
        225 
        226  if (setsockopt(new_socket.get(),
        227  IPPROTO_IP,
        228  IP_ADD_SOURCE_MEMBERSHIP,
        229  reinterpret_cast<const char*>(&source_multicast_group),
        230  sizeof(source_multicast_group)) < 0) {
        231  LOG(ERROR) << "Failed to join multicast group.";
        232  return false;
        233  }
        234  } else {
        235  // this is a v2 join without a specific source.
        236  struct ip_mreq multicast_group;
        237 
        238  multicast_group.imr_multiaddr = local_in_addr;
        239 
        240  if (inet_pton(AF_INET, options->interface_address().c_str(),
        241  &multicast_group.imr_interface) != 1) {
        242  LOG(ERROR) << "Malformed IPv4 interface address "
        243  << options->interface_address();
        244  return false;
        245  }
        246 
        247  if (setsockopt(new_socket.get(), IPPROTO_IP, IP_ADD_MEMBERSHIP,
        248  reinterpret_cast<const char*>(&multicast_group),
        249  sizeof(multicast_group)) < 0) {
        250  LOG(ERROR) << "Failed to join multicast group.";
        251  return false;
        252  }
        253 
        254  }
        255 
        256 #if defined(__linux__)
        257  // Disable IP_MULTICAST_ALL to avoid interference caused when two sockets
        258  // are bound to the same port but joined to different multicast groups.
        259  const int optval_zero = 0;
        260  if (setsockopt(new_socket.get(), IPPROTO_IP, IP_MULTICAST_ALL,
        261  reinterpret_cast<const char*>(&optval_zero),
        262  sizeof(optval_zero)) < 0 &&
        263  errno != ENOPROTOOPT) {
        264  LOG(ERROR) << "Failed to disable IP_MULTICAST_ALL option.";
        265  return false;
        266  }
        267 #endif // #if defined(__linux__)
        268  }
        269 
        270  // Set timeout if needed.
        271  if (options->timeout_us() != 0) {
        272  struct timeval tv;
        273  tv.tv_sec = options->timeout_us() / 1000000;
        274  tv.tv_usec = options->timeout_us() % 1000000;
        275  if (setsockopt(new_socket.get(), SOL_SOCKET, SO_RCVTIMEO,
        276  reinterpret_cast<const char*>(&tv), sizeof(tv)) < 0) {
        277  LOG(ERROR) << "Failed to set socket timeout.";
        278  return false;
        279  }
        280  }
        281 
        282  if (options->buffer_size() > 0) {
        283  const int receive_buffer_size = options->buffer_size();
        284  if (setsockopt(new_socket.get(), SOL_SOCKET, SO_RCVBUF,
        285  reinterpret_cast<const char*>(&receive_buffer_size),
        286  sizeof(receive_buffer_size)) < 0) {
        287  LOG(ERROR) << "Failed to set the maximum receive buffer size: "
        288  << strerror(errno);
        289  return false;
        290  }
        291  }
        292 
        293  socket_ = new_socket.release();
        294  return true;
        295 }
        296 
        297 } // namespace shaka
        int64_t Read(void *buffer, uint64_t length) override
        Definition: udp_file.cc:61
        bool Tell(uint64_t *position) override
        Definition: udp_file.cc:100
        bool Seek(uint64_t position) override
        Definition: udp_file.cc:95
        UdpFile(const char *address_and_port)
        Definition: udp_file.cc:47
        -
        static std::unique_ptr< UdpOptions > ParseFromString(base::StringPiece udp_url)
        Definition: udp_options.cc:73
        +
        static std::unique_ptr< UdpOptions > ParseFromString(base::StringPiece udp_url)
        Definition: udp_options.cc:75
        Define an abstract file interface.
        Definition: file.h:26
        int64_t Write(const void *buffer, uint64_t length) override
        Definition: udp_file.cc:78
        const std::string & file_name() const
        Definition: file.h:94
        @@ -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 e0ca2705db..ccba1a2528 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 681b9e29dc..abde7b545e 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 8257ea269b..8ba93f8f32 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 0387a47688..fb2dc57657 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 83a033d8ed..8bb83bd67e 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 bf8337c8a9..011ba1eb54 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 2ff5d2f4a5..084d173049 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 86e9128901..cbfa95c393 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 c4098d900c..720080a97e 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 d2fc1de883..679ed7c636 100644 --- a/docs/db/d8f/mp4__muxer_8h_source.html +++ b/docs/db/d8f/mp4__muxer_8h_source.html @@ -66,7 +66,7 @@ $(function() {
        mp4_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 #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
        +
        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:61
        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.
        @@ -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 dac7707715..1ca19799bb 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 d7bbb79967..e47adec355 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 @@ -330,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 45caa68741..16b901dafc 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 @@ -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 183254585c..58ea795ea9 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 f089a87d0b..5ebc7f3949 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 46d878d827..0e0b417f79 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 b40b9c2478..7a624a2d7e 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 int64_t GetScaledTime(const StreamInfo& info, const StreamData& data) {
        20  DCHECK(data.text_sample || data.media_sample);
        21 
        22  if (data.text_sample) {
        23  return data.text_sample->start_time();
        24  }
        25 
        26  if (info.stream_type() == kStreamText) {
        27  // This class does not support splitting MediaSample at cue points, which is
        28  // required for text stream. This class expects MediaSample to be converted
        29  // to TextSample before passing to this class.
        30  NOTREACHED()
        31  << "A text streams should use text samples, not media samples.";
        32  }
        33 
        34  if (info.stream_type() == kStreamAudio) {
        35  // Return the mid-point for audio because if the portion of the sample
        36  // after the cue point is bigger than the portion of the sample before
        37  // the cue point, the sample is placed after the cue.
        38  return data.media_sample->pts() + data.media_sample->duration() / 2;
        39  }
        40 
        41  DCHECK_EQ(info.stream_type(), kStreamVideo);
        42  return data.media_sample->pts();
        43 }
        44 
        45 double TimeInSeconds(const StreamInfo& info, const StreamData& data) {
        46  const int64_t scaled_time = GetScaledTime(info, data);
        47  const uint32_t time_scale = info.time_scale();
        48 
        49  return static_cast<double>(scaled_time) / time_scale;
        50 }
        51 
        52 Status GetNextCue(double hint,
        53  SyncPointQueue* sync_points,
        54  std::shared_ptr<const CueEvent>* out_cue) {
        55  DCHECK(sync_points);
        56  DCHECK(out_cue);
        57 
        58  *out_cue = sync_points->GetNext(hint);
        59 
        60  // |*out_cue| will only be null if the job was cancelled.
        61  return *out_cue ? Status::OK
        62  : Status(error::CANCELLED, "SyncPointQueue is cancelled.");
        63 }
        64 } // namespace
        65 
        66 CueAlignmentHandler::CueAlignmentHandler(SyncPointQueue* sync_points)
        67  : sync_points_(sync_points) {}
        68 
        69 Status CueAlignmentHandler::InitializeInternal() {
        70  sync_points_->AddThread();
        71  stream_states_.resize(num_input_streams());
        72 
        73  // Get the first hint for the stream. Use a negative hint so that if there is
        74  // suppose to be a sync point at zero, we will still respect it.
        75  hint_ = sync_points_->GetHint(-1);
        76 
        77  return Status::OK;
        78 }
        79 
        80 Status CueAlignmentHandler::Process(std::unique_ptr<StreamData> data) {
        81  switch (data->stream_data_type) {
        82  case StreamDataType::kStreamInfo:
        83  return OnStreamInfo(std::move(data));
        84  case StreamDataType::kTextSample:
        85  case StreamDataType::kMediaSample:
        86  return OnSample(std::move(data));
        87  default:
        88  VLOG(3) << "Dropping unsupported data type "
        89  << static_cast<int>(data->stream_data_type);
        90  return Status::OK;
        91  }
        92 }
        93 
        94 Status CueAlignmentHandler::OnFlushRequest(size_t stream_index) {
        95  stream_states_[stream_index].to_be_flushed = true;
        96 
        97  // We need to wait for all stream to flush before we can flush each stream.
        98  // This allows cached buffers to be cleared and cues to be properly
        99  // synchronized and set on all streams.
        100  for (const StreamState& stream_state : stream_states_) {
        101  if (!stream_state.to_be_flushed) {
        102  return Status::OK;
        103  }
        104  }
        105 
        106  // Do a once over all the streams to ensure that their states are as we expect
        107  // them. Video and non-video streams have different allowances here. Video
        108  // should absolutely have no cues or samples where as non-video streams may
        109  // have cues or samples.
        110  for (StreamState& stream : stream_states_) {
        111  DCHECK(stream.to_be_flushed);
        112 
        113  if (stream.info->stream_type() == kStreamVideo) {
        114  DCHECK_EQ(stream.samples.size(), 0u)
        115  << "Video streams should not store samples";
        116  DCHECK_EQ(stream.cues.size(), 0u)
        117  << "Video streams should not store cues";
        118  }
        119  }
        120 
        121  // It is possible that we did not get all the cues. |hint_| will get updated
        122  // when we call |UseNextSyncPoint|.
        123  while (sync_points_->HasMore(hint_)) {
        124  std::shared_ptr<const CueEvent> next_cue;
        125  RETURN_IF_ERROR(GetNextCue(hint_, sync_points_, &next_cue));
        126  RETURN_IF_ERROR(UseNewSyncPoint(std::move(next_cue)));
        127  }
        128 
        129  // Now that there are new cues, it may be possible to dispatch some of the
        130  // samples that may be left waiting.
        131  for (StreamState& stream : stream_states_) {
        132  RETURN_IF_ERROR(RunThroughSamples(&stream));
        133  DCHECK_EQ(stream.samples.size(), 0u);
        134 
        135  // It is possible for there to be cues that come after all the samples. Make
        136  // sure to send them out too.
        137  while (stream.cues.size()) {
        138  RETURN_IF_ERROR(Dispatch(std::move(stream.cues.front())));
        139  stream.cues.pop_front();
        140  }
        141  }
        142 
        143  return FlushAllDownstreams();
        144 }
        145 
        146 Status CueAlignmentHandler::OnStreamInfo(std::unique_ptr<StreamData> data) {
        147  StreamState& stream_state = stream_states_[data->stream_index];
        148  // Keep a copy of the stream info so that we can check type and check
        149  // timescale.
        150  stream_state.info = data->stream_info;
        151 
        152  return Dispatch(std::move(data));
        153 }
        154 
        155 Status CueAlignmentHandler::OnVideoSample(std::unique_ptr<StreamData> sample) {
        156  DCHECK(sample);
        157  DCHECK(sample->media_sample);
        158 
        159  const size_t stream_index = sample->stream_index;
        160  StreamState& stream = stream_states_[stream_index];
        161 
        162  const double sample_time = TimeInSeconds(*stream.info, *sample);
        163  const bool is_key_frame = sample->media_sample->is_key_frame();
        164 
        165  if (is_key_frame && sample_time >= hint_) {
        166  auto next_sync = sync_points_->PromoteAt(sample_time);
        167 
        168  if (!next_sync) {
        169  LOG(ERROR) << "Failed to promote sync point at " << sample_time
        170  << ". This happens only if video streams are not GOP-aligned.";
        171  return Status(error::INVALID_ARGUMENT,
        172  "Streams are not properly GOP-aligned.");
        173  }
        174 
        175  RETURN_IF_ERROR(UseNewSyncPoint(std::move(next_sync)));
        176  DCHECK_EQ(stream.cues.size(), 1u);
        177  RETURN_IF_ERROR(Dispatch(std::move(stream.cues.front())));
        178  stream.cues.pop_front();
        179  }
        180 
        181  return Dispatch(std::move(sample));
        182 }
        183 
        184 Status CueAlignmentHandler::OnNonVideoSample(
        185  std::unique_ptr<StreamData> sample) {
        186  DCHECK(sample);
        187  DCHECK(sample->media_sample || sample->text_sample);
        188 
        189  const size_t stream_index = sample->stream_index;
        190  StreamState& stream_state = stream_states_[stream_index];
        191 
        192  // Accept the sample. This will output it if it comes before the hint point or
        193  // will cache it if it comes after the hint point.
        194  RETURN_IF_ERROR(AcceptSample(std::move(sample), &stream_state));
        195 
        196  // If all the streams are waiting on a hint, it means that none has next sync
        197  // point determined. It also means that there are no video streams and we need
        198  // to wait for all streams to converge on a hint so that we can get the next
        199  // sync point.
        200  if (EveryoneWaitingAtHint()) {
        201  std::shared_ptr<const CueEvent> next_sync;
        202  RETURN_IF_ERROR(GetNextCue(hint_, sync_points_, &next_sync));
        203  RETURN_IF_ERROR(UseNewSyncPoint(next_sync));
        204  }
        205 
        206  return Status::OK;
        207 }
        208 
        209 Status CueAlignmentHandler::OnSample(std::unique_ptr<StreamData> sample) {
        210  // There are two modes:
        211  // 1. There is a video input.
        212  // 2. There are no video inputs.
        213  //
        214  // When there is a video input, we rely on the video input get the next sync
        215  // point and release all the samples.
        216  //
        217  // When there are no video inputs, we rely on the sync point queue to block
        218  // us until there is a sync point.
        219 
        220  const size_t stream_index = sample->stream_index;
        221  const StreamType stream_type =
        222  stream_states_[stream_index].info->stream_type();
        223 
        224  const bool is_video = stream_type == kStreamVideo;
        225 
        226  return is_video ? OnVideoSample(std::move(sample))
        227  : OnNonVideoSample(std::move(sample));
        228 }
        229 
        230 Status CueAlignmentHandler::UseNewSyncPoint(
        231  std::shared_ptr<const CueEvent> new_sync) {
        232  hint_ = sync_points_->GetHint(new_sync->time_in_seconds);
        233  DCHECK_GT(hint_, new_sync->time_in_seconds);
        234 
        235  for (size_t stream_index = 0; stream_index < stream_states_.size();
        236  stream_index++) {
        237  StreamState& stream = stream_states_[stream_index];
        238  stream.cues.push_back(StreamData::FromCueEvent(stream_index, new_sync));
        239 
        240  RETURN_IF_ERROR(RunThroughSamples(&stream));
        241  }
        242 
        243  return Status::OK;
        244 }
        245 
        246 bool CueAlignmentHandler::EveryoneWaitingAtHint() const {
        247  for (const StreamState& stream_state : stream_states_) {
        248  if (stream_state.samples.empty()) {
        249  return false;
        250  }
        251  }
        252  return true;
        253 }
        254 
        255 Status CueAlignmentHandler::AcceptSample(std::unique_ptr<StreamData> sample,
        256  StreamState* stream) {
        257  DCHECK(sample);
        258  DCHECK(sample->media_sample || sample->text_sample);
        259  DCHECK(stream);
        260 
        261  // Need to cache the stream index as we will lose the pointer when we add
        262  // the sample to the queue.
        263  const size_t stream_index = sample->stream_index;
        264 
        265  stream->samples.push_back(std::move(sample));
        266 
        267  if (stream->samples.size() > kMaxBufferSize) {
        268  LOG(ERROR) << "Stream " << stream_index << " has buffered "
        269  << stream->samples.size() << " when the max is "
        270  << kMaxBufferSize;
        271  return Status(error::INVALID_ARGUMENT,
        272  "Streams are not properly multiplexed.");
        273  }
        274 
        275  return RunThroughSamples(stream);
        276 }
        277 
        278 Status CueAlignmentHandler::RunThroughSamples(StreamState* stream) {
        279  // Step through all our samples until we find where we can insert the cue.
        280  // Think of this as a merge sort.
        281  while (stream->cues.size() && stream->samples.size()) {
        282  const double cue_time = stream->cues.front()->cue_event->time_in_seconds;
        283  const double sample_time =
        284  TimeInSeconds(*stream->info, *stream->samples.front());
        285 
        286  if (sample_time < cue_time) {
        287  RETURN_IF_ERROR(Dispatch(std::move(stream->samples.front())));
        288  stream->samples.pop_front();
        289  } else {
        290  RETURN_IF_ERROR(Dispatch(std::move(stream->cues.front())));
        291  stream->cues.pop_front();
        292  }
        293  }
        294 
        295  // If we still have samples, then it means that we sent out the cue and can
        296  // now work up to the hint. So now send all samples that come before the hint
        297  // downstream.
        298  while (stream->samples.size() &&
        299  TimeInSeconds(*stream->info, *stream->samples.front()) < hint_) {
        300  RETURN_IF_ERROR(Dispatch(std::move(stream->samples.front())));
        301  stream->samples.pop_front();
        302  }
        303 
        304  return Status::OK;
        305 }
        306 } // namespace media
        307 } // 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 3c95a8ea5a..23c744e763 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 36b3148042..fd03ecf36a 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 60da07f8a3..4c8f606114 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 @@ -80,7 +80,7 @@ $(function() { diff --git a/docs/db/db8/structshaka_1_1media_1_1OnMediaEndParameters.html b/docs/db/db8/structshaka_1_1media_1_1OnMediaEndParameters.html index 6f5caab005..3a0e4f5ea2 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 e57447342b..a1c5587e7b 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 @@ -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 6b61110549..3cea4504c1 100644 --- a/docs/db/db9/text__chunker_8cc_source.html +++ b/docs/db/db9/text__chunker_8cc_source.html @@ -66,11 +66,11 @@ $(function() {
        text_chunker.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/chunking/text_chunker.h"
        8 
        9 #include "packager/status_macros.h"
        10 
        11 namespace shaka {
        12 namespace media {
        13 namespace {
        14 const size_t kStreamIndex = 0;
        15 
        16 std::shared_ptr<const SegmentInfo> MakeSegmentInfo(int64_t start_ms,
        17  int64_t end_ms) {
        18  DCHECK_LT(start_ms, end_ms);
        19 
        20  std::shared_ptr<SegmentInfo> info = std::make_shared<SegmentInfo>();
        21  info->start_timestamp = start_ms;
        22  info->duration = end_ms - start_ms;
        23 
        24  return info;
        25 }
        26 } // namespace
        27 
        28 TextChunker::TextChunker(int64_t segment_duration_ms)
        29  : segment_duration_ms_(segment_duration_ms),
        30  segment_start_ms_(0),
        31  segment_expected_end_ms_(segment_duration_ms) {}
        32 
        33 Status TextChunker::InitializeInternal() {
        34  return Status::OK;
        35 }
        36 
        37 Status TextChunker::Process(std::unique_ptr<StreamData> data) {
        38  switch (data->stream_data_type) {
        39  case StreamDataType::kStreamInfo:
        40  return OnStreamInfo(std::move(data->stream_info));
        41  case StreamDataType::kTextSample:
        42  return OnTextSample(data->text_sample);
        43  case StreamDataType::kCueEvent:
        44  return OnCueEvent(data->cue_event);
        45  default:
        46  return Status(error::INTERNAL_ERROR,
        47  "Invalid stream data type for this handler");
        48  }
        49 }
        50 
        51 Status TextChunker::OnFlushRequest(size_t input_stream_index) {
        52  // Keep outputting segments until all the samples leave the system.
        53  while (segment_samples_.size()) {
        54  RETURN_IF_ERROR(EndSegment(segment_expected_end_ms_));
        55  }
        56 
        57  return FlushAllDownstreams();
        58 }
        59 
        60 Status TextChunker::OnStreamInfo(std::shared_ptr<const StreamInfo> info) {
        61  // There is no information we need from the stream info, so just pass it
        62  // downstream.
        63  return DispatchStreamInfo(kStreamIndex, std::move(info));
        64 }
        65 
        66 Status TextChunker::OnCueEvent(std::shared_ptr<const CueEvent> event) {
        67  // We are going to cut the current segment into two using the event's time as
        68  // the division.
        69  const int64_t cue_time_in_ms = event->time_in_seconds * 1000;
        70 
        71  // In the case that there is a gap with no samples between the last sample
        72  // and the cue event, output all the segments until we get to the segment that
        73  // the cue event interrupts.
        74  while (segment_expected_end_ms_ < cue_time_in_ms) {
        75  RETURN_IF_ERROR(EndSegment(segment_expected_end_ms_));
        76  }
        77 
        78  RETURN_IF_ERROR(EndSegment(cue_time_in_ms));
        79  RETURN_IF_ERROR(DispatchCueEvent(kStreamIndex, std::move(event)));
        80 
        81  return Status::OK;
        82 }
        83 
        84 Status TextChunker::OnTextSample(std::shared_ptr<const TextSample> sample) {
        85  // Output all segments that come before our new sample.
        86  while (segment_expected_end_ms_ <= sample->start_time()) {
        87  RETURN_IF_ERROR(EndSegment(segment_expected_end_ms_));
        88  }
        89 
        90  segment_samples_.push_back(std::move(sample));
        91 
        92  return Status::OK;
        93 }
        94 
        95 Status TextChunker::EndSegment(int64_t segment_actual_end_ms) {
        96  // Output all the samples that are part of the segment.
        97  for (const auto& sample : segment_samples_) {
        98  RETURN_IF_ERROR(DispatchTextSample(kStreamIndex, sample));
        99  }
        100 
        101  RETURN_IF_ERROR(DispatchSegmentInfo(
        102  kStreamIndex, MakeSegmentInfo(segment_start_ms_, segment_actual_end_ms)));
        103 
        104  // Create a new segment that comes right after the old segment and remove all
        105  // samples that don't cross over into the new segment.
        106  StartNewSegment(segment_actual_end_ms);
        107 
        108  return Status::OK;
        109 }
        110 
        111 void TextChunker::StartNewSegment(int64_t start_ms) {
        112  segment_start_ms_ = start_ms;
        113  segment_expected_end_ms_ = start_ms + segment_duration_ms_;
        114 
        115  // Remove all samples that no longer overlap with the new segment.
        116  segment_samples_.remove_if(
        117  [start_ms](const std::shared_ptr<const TextSample>& sample) {
        118  return sample->EndTime() <= start_ms;
        119  });
        120 }
        121 
        122 } // namespace media
        123 } // namespace shaka
        All the methods that are virtual are virtual for mocking.
        +
        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/chunking/text_chunker.h"
        8 
        9 #include "packager/status_macros.h"
        10 
        11 namespace shaka {
        12 namespace media {
        13 namespace {
        14 const size_t kStreamIndex = 0;
        15 } // namespace
        16 
        17 TextChunker::TextChunker(double segment_duration_in_seconds)
        18  : segment_duration_in_seconds_(segment_duration_in_seconds){};
        19 
        20 Status TextChunker::Process(std::unique_ptr<StreamData> data) {
        21  switch (data->stream_data_type) {
        22  case StreamDataType::kStreamInfo:
        23  return OnStreamInfo(std::move(data->stream_info));
        24  case StreamDataType::kTextSample:
        25  return OnTextSample(data->text_sample);
        26  case StreamDataType::kCueEvent:
        27  return OnCueEvent(data->cue_event);
        28  default:
        29  return Status(error::INTERNAL_ERROR,
        30  "Invalid stream data type for this handler");
        31  }
        32 }
        33 
        34 Status TextChunker::OnFlushRequest(size_t input_stream_index) {
        35  // Keep outputting segments until all the samples leave the system. Calling
        36  // |DispatchSegment| will remove samples over time.
        37  while (samples_in_current_segment_.size()) {
        38  RETURN_IF_ERROR(DispatchSegment(segment_duration_));
        39  }
        40 
        41  return FlushAllDownstreams();
        42 }
        43 
        44 Status TextChunker::OnStreamInfo(std::shared_ptr<const StreamInfo> info) {
        45  time_scale_ = info->time_scale();
        46  segment_duration_ = ScaleTime(segment_duration_in_seconds_);
        47 
        48  return DispatchStreamInfo(kStreamIndex, std::move(info));
        49 }
        50 
        51 Status TextChunker::OnCueEvent(std::shared_ptr<const CueEvent> event) {
        52  // We are going to end the current segment prematurely using the cue event's
        53  // time as the new segment end.
        54 
        55  // Because the cue should have been inserted into the stream such that no
        56  // later sample could start before it does, we know that there should
        57  // be no later samples starting before the cue event.
        58 
        59  // Convert the event's time to be scaled to the time of each sample.
        60  const int64_t event_time = ScaleTime(event->time_in_seconds);
        61 
        62  // Output all full segments before the segment that the cue event interupts.
        63  while (segment_start_ + segment_duration_ < event_time) {
        64  RETURN_IF_ERROR(DispatchSegment(segment_duration_));
        65  }
        66 
        67  const int64_t shorten_duration = event_time - segment_start_;
        68 
        69  RETURN_IF_ERROR(DispatchSegment(shorten_duration));
        70  return DispatchCueEvent(kStreamIndex, std::move(event));
        71 }
        72 
        73 Status TextChunker::OnTextSample(std::shared_ptr<const TextSample> sample) {
        74  // Output all segments that come before our new sample.
        75  const int64_t sample_start = sample->start_time();
        76  while (sample_start >= segment_start_ + segment_duration_) {
        77  RETURN_IF_ERROR(DispatchSegment(segment_duration_));
        78  }
        79 
        80  samples_in_current_segment_.push_back(std::move(sample));
        81 
        82  return Status::OK;
        83 }
        84 
        85 Status TextChunker::DispatchSegment(int64_t duration) {
        86  DCHECK_GT(duration, 0) << "Segment duration should always be positive";
        87 
        88  // Output all the samples that are part of the segment.
        89  for (const auto& sample : samples_in_current_segment_) {
        90  RETURN_IF_ERROR(DispatchTextSample(kStreamIndex, sample));
        91  }
        92 
        93  // Output the segment info.
        94  std::shared_ptr<SegmentInfo> info = std::make_shared<SegmentInfo>();
        95  info->start_timestamp = segment_start_;
        96  info->duration = duration;
        97  RETURN_IF_ERROR(DispatchSegmentInfo(kStreamIndex, std::move(info)));
        98 
        99  // Move onto the next segment.
        100  const int64_t new_segment_start = segment_start_ + duration;
        101  segment_start_ = new_segment_start;
        102 
        103  // Remove all samples that end before the (new) current segment started.
        104  samples_in_current_segment_.remove_if(
        105  [new_segment_start](const std::shared_ptr<const TextSample>& sample) {
        106  // For the sample to even be in this list, it should have started
        107  // before the (new) current segment.
        108  DCHECK_LT(sample->start_time(), new_segment_start);
        109  return sample->EndTime() <= new_segment_start;
        110  });
        111 
        112  return Status::OK;
        113 }
        114 
        115 int64_t TextChunker::ScaleTime(double seconds) const {
        116  DCHECK_GT(time_scale_, 0) << "Need positive time scale to scale time.";
        117  return static_cast<int64_t>(seconds * time_scale_);
        118 }
        119 } // namespace media
        120 } // namespace shaka
        All the methods that are virtual are virtual for mocking.
        diff --git a/docs/db/dcb/classshaka_1_1media_1_1VPxParser.html b/docs/db/dcb/classshaka_1_1media_1_1VPxParser.html index d3abd7cc52..6cc49b211e 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 0785bfac25..6e61c8243a 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 d2d433aeb7..6eb6d2296b 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 1caab71fe8..1b1dcc0efb 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 963 of file packager.cc.

        +

        Definition at line 940 of file packager.cc.

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

        Definition at line 959 of file packager.cc.

        +

        Definition at line 936 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 809 of file packager.cc.

        +

        Definition at line 786 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 934 of file packager.cc.

        +

        Definition at line 911 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 8d588968b3..327f827658 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 12873cdf98..92d667f5bf 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 d5007fd7e8..5d1f890170 100644 --- a/docs/db/dd2/chunk__info__iterator_8h_source.html +++ b/docs/db/dd2/chunk__info__iterator_8h_source.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/db/dd9/sync__sample__iterator_8h_source.html b/docs/db/dd9/sync__sample__iterator_8h_source.html index 8b1a8242c3..70479a2eb2 100644 --- a/docs/db/dd9/sync__sample__iterator_8h_source.html +++ b/docs/db/dd9/sync__sample__iterator_8h_source.html @@ -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 60712351f5..3343e79813 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 08230b1d8d..ada42f56a3 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 7e9070300e..8d296cb6fb 100644 --- a/docs/db/dea/classshaka_1_1media_1_1TrickPlayHandler.html +++ b/docs/db/dea/classshaka_1_1media_1_1TrickPlayHandler.html @@ -104,6 +104,10 @@ bool 

        Additional Inherited Members

        +- Static Public Member Functions inherited from shaka::media::MediaHandler + +static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list) +  - Protected Member Functions inherited from shaka::media::MediaHandler virtual bool ValidateOutputStreamIndex (size_t stream_index) const @@ -167,7 +171,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 ae302f35e9..ebc066dbe6 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 2a760e1a8a..0e75a840d2 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 c9241482d3..e272573af2 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 dc5d80e865..0723be9728 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 7347343f58..ce041b5aae 100644 --- a/docs/db/df6/muxer_8h_source.html +++ b/docs/db/df6/muxer_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 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
        @@ -85,7 +85,7 @@ $(function() {
        diff --git a/docs/db/df8/classshaka_1_1media_1_1H265ByteToUnitStreamConverter.html b/docs/db/df8/classshaka_1_1media_1_1H265ByteToUnitStreamConverter.html index cb6fbaf87d..16b929f80d 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 ea447ad4b3..00b6157f52 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 99496d225c..530f89b830 100644 --- a/docs/db/dfb/mpd__utils_8cc_source.html +++ b/docs/db/dfb/mpd__utils_8cc_source.html @@ -66,18 +66,18 @@ $(function() {
        mpd_utils.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/mpd/base/mpd_utils.h"
        8 
        9 #include <libxml/tree.h>
        10 
        11 #include "packager/base/base64.h"
        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/language_utils.h"
        16 #include "packager/mpd/base/adaptation_set.h"
        17 #include "packager/mpd/base/content_protection_element.h"
        18 #include "packager/mpd/base/representation.h"
        19 #include "packager/mpd/base/xml/scoped_xml_ptr.h"
        20 
        21 namespace shaka {
        22 namespace {
        23 
        24 bool IsKeyRotationDefaultKeyId(const std::string& key_id) {
        25  for (char c : key_id) {
        26  if (c != '\0')
        27  return false;
        28  }
        29  return true;
        30 }
        31 
        32 std::string TextCodecString(const MediaInfo& media_info) {
        33  CHECK(media_info.has_text_info());
        34  const auto container_type = media_info.container_type();
        35 
        36  // Codecs are not needed when mimeType is "text/*". Having a codec would be
        37  // redundant.
        38  if (container_type == MediaInfo::CONTAINER_TEXT) {
        39  return "";
        40  }
        41 
        42  // DASH IOP mentions that the codec for ttml in mp4 is stpp, so override
        43  // the default codec value.
        44  const std::string& codec = media_info.text_info().codec();
        45  if (codec == "ttml" && container_type == MediaInfo::CONTAINER_MP4) {
        46  return "stpp";
        47  }
        48 
        49  return codec;
        50 }
        51 
        52 } // namespace
        53 
        54 bool HasVODOnlyFields(const MediaInfo& media_info) {
        55  return media_info.has_init_range() || media_info.has_index_range() ||
        56  media_info.has_media_file_url();
        57 }
        58 
        59 bool HasLiveOnlyFields(const MediaInfo& media_info) {
        60  return media_info.has_init_segment_url() ||
        61  media_info.has_segment_template_url();
        62 }
        63 
        64 void RemoveDuplicateAttributes(
        65  ContentProtectionElement* content_protection_element) {
        66  DCHECK(content_protection_element);
        67  typedef std::map<std::string, std::string> AttributesMap;
        68 
        69  AttributesMap& attributes = content_protection_element->additional_attributes;
        70  if (!content_protection_element->value.empty())
        71  attributes.erase("value");
        72 
        73  if (!content_protection_element->scheme_id_uri.empty())
        74  attributes.erase("schemeIdUri");
        75 }
        76 
        77 std::string GetLanguage(const MediaInfo& media_info) {
        78  std::string lang;
        79  if (media_info.has_audio_info()) {
        80  lang = media_info.audio_info().language();
        81  } else if (media_info.has_text_info()) {
        82  lang = media_info.text_info().language();
        83  }
        84  return LanguageToShortestForm(lang);
        85 }
        86 
        87 std::string GetCodecs(const MediaInfo& media_info) {
        88  CHECK(OnlyOneTrue(media_info.has_video_info(), media_info.has_audio_info(),
        89  media_info.has_text_info()));
        90 
        91  if (media_info.has_video_info()) {
        92  if (media_info.container_type() == MediaInfo::CONTAINER_WEBM) {
        93  std::string codec = media_info.video_info().codec().substr(0, 4);
        94  // media_info.video_info().codec() contains new revised codec string
        95  // specified by "VPx in ISO BMFF" document, which is not compatible to
        96  // old codec strings in WebM. Hack it here before all browsers support
        97  // new codec strings.
        98  if (codec == "vp08")
        99  return "vp8";
        100  if (codec == "vp09")
        101  return "vp9";
        102  }
        103  return media_info.video_info().codec();
        104  }
        105 
        106  if (media_info.has_audio_info())
        107  return media_info.audio_info().codec();
        108 
        109  if (media_info.has_text_info())
        110  return TextCodecString(media_info);
        111 
        112  NOTREACHED();
        113  return "";
        114 }
        115 
        116 std::string GetBaseCodec(const MediaInfo& media_info) {
        117  std::string codec;
        118  if (media_info.has_video_info()) {
        119  codec = media_info.video_info().codec();
        120  } else if (media_info.has_audio_info()) {
        121  codec = media_info.audio_info().codec();
        122  } else if (media_info.has_text_info()) {
        123  codec = media_info.text_info().codec();
        124  }
        125  // Convert, for example, "mp4a.40.2" to simply "mp4a".
        126  // "mp4a.40.2" and "mp4a.40.5" can exist in the same AdaptationSet.
        127  size_t dot = codec.find('.');
        128  if (dot != std::string::npos) {
        129  codec.erase(dot);
        130  }
        131  return codec;
        132 }
        133 
        134 std::string GetAdaptationSetKey(const MediaInfo& media_info) {
        135  std::string key;
        136 
        137  if (media_info.has_video_info()) {
        138  key.append("video:");
        139  } else if (media_info.has_audio_info()) {
        140  key.append("audio:");
        141  } else if (media_info.has_text_info()) {
        142  key.append(MediaInfo_TextInfo_TextType_Name(media_info.text_info().type()));
        143  key.append(":");
        144  } else {
        145  key.append("unknown:");
        146  }
        147 
        148  key.append(MediaInfo_ContainerType_Name(media_info.container_type()));
        149  key.append(":");
        150  key.append(GetBaseCodec(media_info));
        151  key.append(":");
        152  key.append(GetLanguage(media_info));
        153 
        154  // Trick play streams of the same original stream, but possibly with
        155  // different trick_play_factors, belong to the same trick play AdaptationSet.
        156  if (media_info.video_info().has_playback_rate()) {
        157  key.append(":trick_play");
        158  }
        159 
        160  return key;
        161 }
        162 
        163 std::string SecondsToXmlDuration(double seconds) {
        164  // Chrome internally uses time accurate to microseconds, which is implemented
        165  // per MSE spec (https://www.w3.org/TR/media-source/).
        166  // We need a string formatter that has at least microseconds accuracy for a
        167  // normal video (with duration up to 3 hours). Chrome's DoubleToString
        168  // implementation meets the requirement.
        169  return "PT" + base::DoubleToString(seconds) + "S";
        170 }
        171 
        172 bool GetDurationAttribute(xmlNodePtr node, float* duration) {
        173  DCHECK(node);
        174  DCHECK(duration);
        175  static const char kDuration[] = "duration";
        176  xml::scoped_xml_ptr<xmlChar> duration_value(
        177  xmlGetProp(node, BAD_CAST kDuration));
        178 
        179  if (!duration_value)
        180  return false;
        181 
        182  double duration_double_precision = 0.0;
        183  if (!base::StringToDouble(reinterpret_cast<const char*>(duration_value.get()),
        184  &duration_double_precision)) {
        185  return false;
        186  }
        187 
        188  *duration = static_cast<float>(duration_double_precision);
        189  return true;
        190 }
        191 
        192 bool MoreThanOneTrue(bool b1, bool b2, bool b3) {
        193  return (b1 && b2) || (b2 && b3) || (b3 && b1);
        194 }
        195 
        196 bool AtLeastOneTrue(bool b1, bool b2, bool b3) {
        197  return b1 || b2 || b3;
        198 }
        199 
        200 bool OnlyOneTrue(bool b1, bool b2, bool b3) {
        201  return !MoreThanOneTrue(b1, b2, b3) && AtLeastOneTrue(b1, b2, b3);
        202 }
        203 
        204 // Coverts binary data into human readable UUID format.
        205 bool HexToUUID(const std::string& data, std::string* uuid_format) {
        206  DCHECK(uuid_format);
        207  const size_t kExpectedUUIDSize = 16;
        208  if (data.size() != kExpectedUUIDSize) {
        209  LOG(ERROR) << "UUID size is expected to be " << kExpectedUUIDSize
        210  << " but is " << data.size() << " and the data in hex is "
        211  << base::HexEncode(data.data(), data.size());
        212  return false;
        213  }
        214 
        215  const std::string hex_encoded =
        216  base::ToLowerASCII(base::HexEncode(data.data(), data.size()));
        217  DCHECK_EQ(hex_encoded.size(), kExpectedUUIDSize * 2);
        218  base::StringPiece all(hex_encoded);
        219  // Note UUID has 5 parts separated with dashes.
        220  // e.g. 123e4567-e89b-12d3-a456-426655440000
        221  // These StringPieces have each part.
        222  base::StringPiece first = all.substr(0, 8);
        223  base::StringPiece second = all.substr(8, 4);
        224  base::StringPiece third = all.substr(12, 4);
        225  base::StringPiece fourth = all.substr(16, 4);
        226  base::StringPiece fifth = all.substr(20, 12);
        227 
        228  // 32 hexadecimal characters with 4 hyphens.
        229  const size_t kHumanReadableUUIDSize = 36;
        230  uuid_format->reserve(kHumanReadableUUIDSize);
        231  first.CopyToString(uuid_format);
        232  uuid_format->append("-");
        233  second.AppendToString(uuid_format);
        234  uuid_format->append("-");
        235  third.AppendToString(uuid_format);
        236  uuid_format->append("-");
        237  fourth.AppendToString(uuid_format);
        238  uuid_format->append("-");
        239  fifth.AppendToString(uuid_format);
        240  return true;
        241 }
        242 
        243 void UpdateContentProtectionPsshHelper(
        244  const std::string& drm_uuid,
        245  const std::string& pssh,
        246  std::list<ContentProtectionElement>* content_protection_elements) {
        247  const std::string drm_uuid_schemd_id_uri_form = "urn:uuid:" + drm_uuid;
        248  for (std::list<ContentProtectionElement>::iterator protection =
        249  content_protection_elements->begin();
        250  protection != content_protection_elements->end(); ++protection) {
        251  if (protection->scheme_id_uri != drm_uuid_schemd_id_uri_form) {
        252  continue;
        253  }
        254 
        255  for (std::vector<Element>::iterator subelement =
        256  protection->subelements.begin();
        257  subelement != protection->subelements.end(); ++subelement) {
        258  if (subelement->name == kPsshElementName) {
        259  // For now, we want to remove the PSSH element because some players do
        260  // not support updating pssh.
        261  protection->subelements.erase(subelement);
        262 
        263  // TODO(rkuroiwa): Uncomment this and remove the line above when
        264  // shaka-player supports updating PSSH.
        265  // subelement->content = pssh;
        266  return;
        267  }
        268  }
        269 
        270  // Reaching here means <cenc:pssh> does not exist under the
        271  // ContentProtection element. Add it.
        272  // TODO(rkuroiwa): Uncomment this when shaka-player supports updating PSSH.
        273  // Element cenc_pssh;
        274  // cenc_pssh.name = kPsshElementName;
        275  // cenc_pssh.content = pssh;
        276  // protection->subelements.push_back(cenc_pssh);
        277  return;
        278  }
        279 
        280  // Reaching here means that ContentProtection for the DRM does not exist.
        281  // Add it.
        282  ContentProtectionElement content_protection;
        283  content_protection.scheme_id_uri = drm_uuid_schemd_id_uri_form;
        284  // TODO(rkuroiwa): Uncomment this when shaka-player supports updating PSSH.
        285  // Element cenc_pssh;
        286  // cenc_pssh.name = kPsshElementName;
        287  // cenc_pssh.content = pssh;
        288  // content_protection.subelements.push_back(cenc_pssh);
        289  content_protection_elements->push_back(content_protection);
        290  return;
        291 }
        292 
        293 namespace {
        294 // Helper function. This works because Representation and AdaptationSet both
        295 // have AddContentProtectionElement().
        296 template <typename ContentProtectionParent>
        297 void AddContentProtectionElementsHelperTemplated(
        298  const MediaInfo& media_info,
        299  ContentProtectionParent* parent) {
        300  DCHECK(parent);
        301  if (!media_info.has_protected_content())
        302  return;
        303 
        304  const MediaInfo::ProtectedContent& protected_content =
        305  media_info.protected_content();
        306 
        307  // DASH MPD spec specifies a default ContentProtection element for ISO BMFF
        308  // (MP4) files.
        309  const bool is_mp4_container =
        310  media_info.container_type() == MediaInfo::CONTAINER_MP4;
        311  std::string key_id_uuid_format;
        312  if (protected_content.has_default_key_id() &&
        313  !IsKeyRotationDefaultKeyId(protected_content.default_key_id())) {
        314  if (!HexToUUID(protected_content.default_key_id(), &key_id_uuid_format)) {
        315  LOG(ERROR) << "Failed to convert default key ID into UUID format.";
        316  }
        317  }
        318 
        319  if (is_mp4_container) {
        320  ContentProtectionElement mp4_content_protection;
        321  mp4_content_protection.scheme_id_uri = kEncryptedMp4Scheme;
        322  mp4_content_protection.value = protected_content.protection_scheme();
        323  if (!key_id_uuid_format.empty()) {
        324  mp4_content_protection.additional_attributes["cenc:default_KID"] =
        325  key_id_uuid_format;
        326  }
        327 
        328  parent->AddContentProtectionElement(mp4_content_protection);
        329  }
        330 
        331  for (const auto& entry : protected_content.content_protection_entry()) {
        332  if (!entry.has_uuid()) {
        333  LOG(WARNING)
        334  << "ContentProtectionEntry was specified but no UUID is set for "
        335  << entry.name_version() << ", skipping.";
        336  continue;
        337  }
        338 
        339  ContentProtectionElement drm_content_protection;
        340  drm_content_protection.scheme_id_uri = "urn:uuid:" + entry.uuid();
        341  if (entry.has_name_version())
        342  drm_content_protection.value = entry.name_version();
        343 
        344  if (entry.has_pssh()) {
        345  std::string base64_encoded_pssh;
        346  base::Base64Encode(
        347  base::StringPiece(entry.pssh().data(), entry.pssh().size()),
        348  &base64_encoded_pssh);
        349  Element cenc_pssh;
        350  cenc_pssh.name = kPsshElementName;
        351  cenc_pssh.content = base64_encoded_pssh;
        352  drm_content_protection.subelements.push_back(cenc_pssh);
        353  }
        354 
        355  if (!key_id_uuid_format.empty() && !is_mp4_container) {
        356  drm_content_protection.additional_attributes["cenc:default_KID"] =
        357  key_id_uuid_format;
        358  }
        359 
        360  parent->AddContentProtectionElement(drm_content_protection);
        361  }
        362 
        363  VLOG_IF(1, protected_content.content_protection_entry().size() == 0)
        364  << "The media is encrypted but no content protection specified (can "
        365  "happen with key rotation).";
        366 }
        367 } // namespace
        368 
        369 void AddContentProtectionElements(const MediaInfo& media_info,
        370  Representation* parent) {
        371  AddContentProtectionElementsHelperTemplated(media_info, parent);
        372 }
        373 
        374 void AddContentProtectionElements(const MediaInfo& media_info,
        375  AdaptationSet* parent) {
        376  AddContentProtectionElementsHelperTemplated(media_info, parent);
        377 }
        378 
        379 } // 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/mpd/base/mpd_utils.h"
        8 
        9 #include <gflags/gflags.h>
        10 #include <libxml/tree.h>
        11 
        12 #include "packager/base/base64.h"
        13 #include "packager/base/logging.h"
        14 #include "packager/base/strings/string_number_conversions.h"
        15 #include "packager/base/strings/string_util.h"
        16 #include "packager/media/base/language_utils.h"
        17 #include "packager/mpd/base/adaptation_set.h"
        18 #include "packager/mpd/base/content_protection_element.h"
        19 #include "packager/mpd/base/representation.h"
        20 #include "packager/mpd/base/xml/scoped_xml_ptr.h"
        21 
        22 DEFINE_bool(
        23  use_legacy_vp9_codec_string,
        24  false,
        25  "Use legacy vp9 codec string 'vp9' if set to true; otherwise new style "
        26  "vp09.xx.xx.xx... codec string will be used. Default to false as indicated "
        27  "in https://github.com/google/shaka-packager/issues/406, all major "
        28  "browsers and platforms already support the new 'vp09' codec string.");
        29 
        30 namespace shaka {
        31 namespace {
        32 
        33 bool IsKeyRotationDefaultKeyId(const std::string& key_id) {
        34  for (char c : key_id) {
        35  if (c != '\0')
        36  return false;
        37  }
        38  return true;
        39 }
        40 
        41 std::string TextCodecString(const MediaInfo& media_info) {
        42  CHECK(media_info.has_text_info());
        43  const auto container_type = media_info.container_type();
        44 
        45  // Codecs are not needed when mimeType is "text/*". Having a codec would be
        46  // redundant.
        47  if (container_type == MediaInfo::CONTAINER_TEXT) {
        48  return "";
        49  }
        50 
        51  // DASH IOP mentions that the codec for ttml in mp4 is stpp, so override
        52  // the default codec value.
        53  const std::string& codec = media_info.text_info().codec();
        54  if (codec == "ttml" && container_type == MediaInfo::CONTAINER_MP4) {
        55  return "stpp";
        56  }
        57 
        58  return codec;
        59 }
        60 
        61 } // namespace
        62 
        63 bool HasVODOnlyFields(const MediaInfo& media_info) {
        64  return media_info.has_init_range() || media_info.has_index_range() ||
        65  media_info.has_media_file_url();
        66 }
        67 
        68 bool HasLiveOnlyFields(const MediaInfo& media_info) {
        69  return media_info.has_init_segment_url() ||
        70  media_info.has_segment_template_url();
        71 }
        72 
        73 void RemoveDuplicateAttributes(
        74  ContentProtectionElement* content_protection_element) {
        75  DCHECK(content_protection_element);
        76  typedef std::map<std::string, std::string> AttributesMap;
        77 
        78  AttributesMap& attributes = content_protection_element->additional_attributes;
        79  if (!content_protection_element->value.empty())
        80  attributes.erase("value");
        81 
        82  if (!content_protection_element->scheme_id_uri.empty())
        83  attributes.erase("schemeIdUri");
        84 }
        85 
        86 std::string GetLanguage(const MediaInfo& media_info) {
        87  std::string lang;
        88  if (media_info.has_audio_info()) {
        89  lang = media_info.audio_info().language();
        90  } else if (media_info.has_text_info()) {
        91  lang = media_info.text_info().language();
        92  }
        93  return LanguageToShortestForm(lang);
        94 }
        95 
        96 std::string GetCodecs(const MediaInfo& media_info) {
        97  CHECK(OnlyOneTrue(media_info.has_video_info(), media_info.has_audio_info(),
        98  media_info.has_text_info()));
        99 
        100  if (media_info.has_video_info()) {
        101  if (media_info.container_type() == MediaInfo::CONTAINER_WEBM) {
        102  std::string codec = media_info.video_info().codec().substr(0, 4);
        103  // media_info.video_info().codec() contains new revised codec string
        104  // specified by "VPx in ISO BMFF" document, which is not compatible to
        105  // old codec strings in WebM. Hack it here before all browsers support
        106  // new codec strings.
        107  if (codec == "vp08")
        108  return "vp8";
        109  if (FLAGS_use_legacy_vp9_codec_string) {
        110  if (codec == "vp09")
        111  return "vp9";
        112  }
        113  }
        114  return media_info.video_info().codec();
        115  }
        116 
        117  if (media_info.has_audio_info())
        118  return media_info.audio_info().codec();
        119 
        120  if (media_info.has_text_info())
        121  return TextCodecString(media_info);
        122 
        123  NOTREACHED();
        124  return "";
        125 }
        126 
        127 std::string GetBaseCodec(const MediaInfo& media_info) {
        128  std::string codec;
        129  if (media_info.has_video_info()) {
        130  codec = media_info.video_info().codec();
        131  } else if (media_info.has_audio_info()) {
        132  codec = media_info.audio_info().codec();
        133  } else if (media_info.has_text_info()) {
        134  codec = media_info.text_info().codec();
        135  }
        136  // Convert, for example, "mp4a.40.2" to simply "mp4a".
        137  // "mp4a.40.2" and "mp4a.40.5" can exist in the same AdaptationSet.
        138  size_t dot = codec.find('.');
        139  if (dot != std::string::npos) {
        140  codec.erase(dot);
        141  }
        142  return codec;
        143 }
        144 
        145 std::string GetAdaptationSetKey(const MediaInfo& media_info) {
        146  std::string key;
        147 
        148  if (media_info.has_video_info()) {
        149  key.append("video:");
        150  } else if (media_info.has_audio_info()) {
        151  key.append("audio:");
        152  } else if (media_info.has_text_info()) {
        153  key.append(MediaInfo_TextInfo_TextType_Name(media_info.text_info().type()));
        154  key.append(":");
        155  } else {
        156  key.append("unknown:");
        157  }
        158 
        159  key.append(MediaInfo_ContainerType_Name(media_info.container_type()));
        160  key.append(":");
        161  key.append(GetBaseCodec(media_info));
        162  key.append(":");
        163  key.append(GetLanguage(media_info));
        164 
        165  // Trick play streams of the same original stream, but possibly with
        166  // different trick_play_factors, belong to the same trick play AdaptationSet.
        167  if (media_info.video_info().has_playback_rate()) {
        168  key.append(":trick_play");
        169  }
        170 
        171  return key;
        172 }
        173 
        174 std::string SecondsToXmlDuration(double seconds) {
        175  // Chrome internally uses time accurate to microseconds, which is implemented
        176  // per MSE spec (https://www.w3.org/TR/media-source/).
        177  // We need a string formatter that has at least microseconds accuracy for a
        178  // normal video (with duration up to 3 hours). Chrome's DoubleToString
        179  // implementation meets the requirement.
        180  return "PT" + base::DoubleToString(seconds) + "S";
        181 }
        182 
        183 bool GetDurationAttribute(xmlNodePtr node, float* duration) {
        184  DCHECK(node);
        185  DCHECK(duration);
        186  static const char kDuration[] = "duration";
        187  xml::scoped_xml_ptr<xmlChar> duration_value(
        188  xmlGetProp(node, BAD_CAST kDuration));
        189 
        190  if (!duration_value)
        191  return false;
        192 
        193  double duration_double_precision = 0.0;
        194  if (!base::StringToDouble(reinterpret_cast<const char*>(duration_value.get()),
        195  &duration_double_precision)) {
        196  return false;
        197  }
        198 
        199  *duration = static_cast<float>(duration_double_precision);
        200  return true;
        201 }
        202 
        203 bool MoreThanOneTrue(bool b1, bool b2, bool b3) {
        204  return (b1 && b2) || (b2 && b3) || (b3 && b1);
        205 }
        206 
        207 bool AtLeastOneTrue(bool b1, bool b2, bool b3) {
        208  return b1 || b2 || b3;
        209 }
        210 
        211 bool OnlyOneTrue(bool b1, bool b2, bool b3) {
        212  return !MoreThanOneTrue(b1, b2, b3) && AtLeastOneTrue(b1, b2, b3);
        213 }
        214 
        215 // Coverts binary data into human readable UUID format.
        216 bool HexToUUID(const std::string& data, std::string* uuid_format) {
        217  DCHECK(uuid_format);
        218  const size_t kExpectedUUIDSize = 16;
        219  if (data.size() != kExpectedUUIDSize) {
        220  LOG(ERROR) << "UUID size is expected to be " << kExpectedUUIDSize
        221  << " but is " << data.size() << " and the data in hex is "
        222  << base::HexEncode(data.data(), data.size());
        223  return false;
        224  }
        225 
        226  const std::string hex_encoded =
        227  base::ToLowerASCII(base::HexEncode(data.data(), data.size()));
        228  DCHECK_EQ(hex_encoded.size(), kExpectedUUIDSize * 2);
        229  base::StringPiece all(hex_encoded);
        230  // Note UUID has 5 parts separated with dashes.
        231  // e.g. 123e4567-e89b-12d3-a456-426655440000
        232  // These StringPieces have each part.
        233  base::StringPiece first = all.substr(0, 8);
        234  base::StringPiece second = all.substr(8, 4);
        235  base::StringPiece third = all.substr(12, 4);
        236  base::StringPiece fourth = all.substr(16, 4);
        237  base::StringPiece fifth = all.substr(20, 12);
        238 
        239  // 32 hexadecimal characters with 4 hyphens.
        240  const size_t kHumanReadableUUIDSize = 36;
        241  uuid_format->reserve(kHumanReadableUUIDSize);
        242  first.CopyToString(uuid_format);
        243  uuid_format->append("-");
        244  second.AppendToString(uuid_format);
        245  uuid_format->append("-");
        246  third.AppendToString(uuid_format);
        247  uuid_format->append("-");
        248  fourth.AppendToString(uuid_format);
        249  uuid_format->append("-");
        250  fifth.AppendToString(uuid_format);
        251  return true;
        252 }
        253 
        254 void UpdateContentProtectionPsshHelper(
        255  const std::string& drm_uuid,
        256  const std::string& pssh,
        257  std::list<ContentProtectionElement>* content_protection_elements) {
        258  const std::string drm_uuid_schemd_id_uri_form = "urn:uuid:" + drm_uuid;
        259  for (std::list<ContentProtectionElement>::iterator protection =
        260  content_protection_elements->begin();
        261  protection != content_protection_elements->end(); ++protection) {
        262  if (protection->scheme_id_uri != drm_uuid_schemd_id_uri_form) {
        263  continue;
        264  }
        265 
        266  for (std::vector<Element>::iterator subelement =
        267  protection->subelements.begin();
        268  subelement != protection->subelements.end(); ++subelement) {
        269  if (subelement->name == kPsshElementName) {
        270  // For now, we want to remove the PSSH element because some players do
        271  // not support updating pssh.
        272  protection->subelements.erase(subelement);
        273 
        274  // TODO(rkuroiwa): Uncomment this and remove the line above when
        275  // shaka-player supports updating PSSH.
        276  // subelement->content = pssh;
        277  return;
        278  }
        279  }
        280 
        281  // Reaching here means <cenc:pssh> does not exist under the
        282  // ContentProtection element. Add it.
        283  // TODO(rkuroiwa): Uncomment this when shaka-player supports updating PSSH.
        284  // Element cenc_pssh;
        285  // cenc_pssh.name = kPsshElementName;
        286  // cenc_pssh.content = pssh;
        287  // protection->subelements.push_back(cenc_pssh);
        288  return;
        289  }
        290 
        291  // Reaching here means that ContentProtection for the DRM does not exist.
        292  // Add it.
        293  ContentProtectionElement content_protection;
        294  content_protection.scheme_id_uri = drm_uuid_schemd_id_uri_form;
        295  // TODO(rkuroiwa): Uncomment this when shaka-player supports updating PSSH.
        296  // Element cenc_pssh;
        297  // cenc_pssh.name = kPsshElementName;
        298  // cenc_pssh.content = pssh;
        299  // content_protection.subelements.push_back(cenc_pssh);
        300  content_protection_elements->push_back(content_protection);
        301  return;
        302 }
        303 
        304 namespace {
        305 // Helper function. This works because Representation and AdaptationSet both
        306 // have AddContentProtectionElement().
        307 template <typename ContentProtectionParent>
        308 void AddContentProtectionElementsHelperTemplated(
        309  const MediaInfo& media_info,
        310  ContentProtectionParent* parent) {
        311  DCHECK(parent);
        312  if (!media_info.has_protected_content())
        313  return;
        314 
        315  const MediaInfo::ProtectedContent& protected_content =
        316  media_info.protected_content();
        317 
        318  // DASH MPD spec specifies a default ContentProtection element for ISO BMFF
        319  // (MP4) files.
        320  const bool is_mp4_container =
        321  media_info.container_type() == MediaInfo::CONTAINER_MP4;
        322  std::string key_id_uuid_format;
        323  if (protected_content.has_default_key_id() &&
        324  !IsKeyRotationDefaultKeyId(protected_content.default_key_id())) {
        325  if (!HexToUUID(protected_content.default_key_id(), &key_id_uuid_format)) {
        326  LOG(ERROR) << "Failed to convert default key ID into UUID format.";
        327  }
        328  }
        329 
        330  if (is_mp4_container) {
        331  ContentProtectionElement mp4_content_protection;
        332  mp4_content_protection.scheme_id_uri = kEncryptedMp4Scheme;
        333  mp4_content_protection.value = protected_content.protection_scheme();
        334  if (!key_id_uuid_format.empty()) {
        335  mp4_content_protection.additional_attributes["cenc:default_KID"] =
        336  key_id_uuid_format;
        337  }
        338 
        339  parent->AddContentProtectionElement(mp4_content_protection);
        340  }
        341 
        342  for (const auto& entry : protected_content.content_protection_entry()) {
        343  if (!entry.has_uuid()) {
        344  LOG(WARNING)
        345  << "ContentProtectionEntry was specified but no UUID is set for "
        346  << entry.name_version() << ", skipping.";
        347  continue;
        348  }
        349 
        350  ContentProtectionElement drm_content_protection;
        351  drm_content_protection.scheme_id_uri = "urn:uuid:" + entry.uuid();
        352  if (entry.has_name_version())
        353  drm_content_protection.value = entry.name_version();
        354 
        355  if (entry.has_pssh()) {
        356  std::string base64_encoded_pssh;
        357  base::Base64Encode(
        358  base::StringPiece(entry.pssh().data(), entry.pssh().size()),
        359  &base64_encoded_pssh);
        360  Element cenc_pssh;
        361  cenc_pssh.name = kPsshElementName;
        362  cenc_pssh.content = base64_encoded_pssh;
        363  drm_content_protection.subelements.push_back(cenc_pssh);
        364  }
        365 
        366  if (!key_id_uuid_format.empty() && !is_mp4_container) {
        367  drm_content_protection.additional_attributes["cenc:default_KID"] =
        368  key_id_uuid_format;
        369  }
        370 
        371  parent->AddContentProtectionElement(drm_content_protection);
        372  }
        373 
        374  VLOG_IF(1, protected_content.content_protection_entry().size() == 0)
        375  << "The media is encrypted but no content protection specified (can "
        376  "happen with key rotation).";
        377 }
        378 } // namespace
        379 
        380 void AddContentProtectionElements(const MediaInfo& media_info,
        381  Representation* parent) {
        382  AddContentProtectionElementsHelperTemplated(media_info, parent);
        383 }
        384 
        385 void AddContentProtectionElements(const MediaInfo& media_info,
        386  AdaptationSet* parent) {
        387  AddContentProtectionElementsHelperTemplated(media_info, parent);
        388 }
        389 
        390 } // namespace shaka
        std::string LanguageToShortestForm(const std::string &language)
        All the methods that are virtual are virtual for mocking.
        -
        void AddContentProtectionElements(const MediaInfo &media_info, Representation *parent)
        Definition: mpd_utils.cc:369
        -
        bool HexToUUID(const std::string &data, std::string *uuid_format)
        Definition: mpd_utils.cc:205
        +
        void AddContentProtectionElements(const MediaInfo &media_info, Representation *parent)
        Definition: mpd_utils.cc:380
        +
        bool HexToUUID(const std::string &data, std::string *uuid_format)
        Definition: mpd_utils.cc:216
        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 0d89f7dfe6..cdbf8e4da2 100644 --- a/docs/db/dfc/mpd__notify__muxer__listener_8cc_source.html +++ b/docs/db/dfc/mpd__notify__muxer__listener_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/event/mpd_notify_muxer_listener.h"
        8 
        9 #include <cmath>
        10 
        11 #include "packager/base/logging.h"
        12 #include "packager/media/base/audio_stream_info.h"
        13 #include "packager/media/base/protection_system_specific_info.h"
        14 #include "packager/media/base/video_stream_info.h"
        15 #include "packager/media/event/muxer_listener_internal.h"
        16 #include "packager/mpd/base/media_info.pb.h"
        17 #include "packager/mpd/base/mpd_notifier.h"
        18 
        19 namespace shaka {
        20 namespace media {
        21 
        23  : mpd_notifier_(mpd_notifier), is_encrypted_(false) {
        24  DCHECK(mpd_notifier);
        25  DCHECK(mpd_notifier->dash_profile() == DashProfile::kOnDemand ||
        26  mpd_notifier->dash_profile() == DashProfile::kLive);
        27 }
        28 
        29 MpdNotifyMuxerListener::~MpdNotifyMuxerListener() {}
        30 
        32  bool is_initial_encryption_info,
        33  FourCC protection_scheme,
        34  const std::vector<uint8_t>& key_id,
        35  const std::vector<uint8_t>& iv,
        36  const std::vector<ProtectionSystemSpecificInfo>& key_system_info) {
        37  if (is_initial_encryption_info) {
        38  LOG_IF(WARNING, is_encrypted_)
        39  << "Updating initial encryption information.";
        40  protection_scheme_ = protection_scheme;
        41  default_key_id_ = key_id;
        42  key_system_info_ = key_system_info;
        43  is_encrypted_ = true;
        44  return;
        45  }
        46  if (!notification_id_)
        47  return;
        48  DCHECK_EQ(protection_scheme, protection_scheme_);
        49 
        50  for (const ProtectionSystemSpecificInfo& info : key_system_info) {
        51  const std::string drm_uuid = internal::CreateUUIDString(info.system_id);
        52  bool updated = mpd_notifier_->NotifyEncryptionUpdate(
        53  notification_id_.value(), drm_uuid, key_id, info.psshs);
        54  LOG_IF(WARNING, !updated) << "Failed to update encryption info.";
        55  }
        56 }
        57 
        59 
        61  const MuxerOptions& muxer_options,
        62  const StreamInfo& stream_info,
        63  uint32_t time_scale,
        64  ContainerType container_type) {
        65  std::unique_ptr<MediaInfo> media_info(new MediaInfo());
        66  if (!internal::GenerateMediaInfo(muxer_options,
        67  stream_info,
        68  time_scale,
        69  container_type,
        70  media_info.get())) {
        71  LOG(ERROR) << "Failed to generate MediaInfo from input.";
        72  return;
        73  }
        74 
        75  if (is_encrypted_) {
        76  internal::SetContentProtectionFields(protection_scheme_, default_key_id_,
        77  key_system_info_, media_info.get());
        78  }
        79 
        80  // The content may be splitted into multiple files, but their MediaInfo
        81  // should be compatible.
        82  if (media_info_ &&
        83  !internal::IsMediaInfoCompatible(*media_info, *media_info_)) {
        84  LOG(WARNING) << "Incompatible MediaInfo \n"
        85  << media_info->ShortDebugString() << "\n vs \n"
        86  << media_info_->ShortDebugString()
        87  << "\nThe result manifest may not be playable.";
        88  }
        89  media_info_ = std::move(media_info);
        90 
        91  if (mpd_notifier_->dash_profile() == DashProfile::kLive) {
        92  if (!NotifyNewContainer())
        93  return;
        94  DCHECK(notification_id_);
        95  }
        96 }
        97 
        98 // Record the sample duration in the media info for VOD so that OnMediaEnd, all
        99 // the information is in the media info.
        101  uint32_t sample_duration) {
        102  if (mpd_notifier_->dash_profile() == DashProfile::kLive) {
        103  mpd_notifier_->NotifySampleDuration(notification_id_.value(),
        104  sample_duration);
        105  return;
        106  }
        107 
        108  if (!media_info_) {
        109  LOG(WARNING) << "Got sample duration " << sample_duration
        110  << " but no media was specified.";
        111  return;
        112  }
        113  if (!media_info_->has_video_info()) {
        114  // If non video, don't worry about it (at the moment).
        115  return;
        116  }
        117  if (media_info_->video_info().has_frame_duration()) {
        118  return;
        119  }
        120 
        121  media_info_->mutable_video_info()->set_frame_duration(sample_duration);
        122 }
        123 
        125  float duration_seconds) {
        126  if (mpd_notifier_->dash_profile() == DashProfile::kLive) {
        127  DCHECK(event_info_.empty());
        128  // TODO(kqyang): Set mpd duration to |duration_seconds|, which is more
        129  // accurate than the duration coded in the original media header.
        130  if (mpd_notifier_->mpd_type() == MpdType::kStatic)
        131  mpd_notifier_->Flush();
        132  return;
        133  }
        134 
        135  DCHECK(media_info_);
        136  if (!internal::SetVodInformation(media_ranges, duration_seconds,
        137  media_info_.get())) {
        138  LOG(ERROR) << "Failed to generate VOD information from input.";
        139  return;
        140  }
        141 
        142  if (notification_id_) {
        143  mpd_notifier_->NotifyMediaInfoUpdate(notification_id_.value(),
        144  *media_info_);
        145  } else {
        146  if (!NotifyNewContainer())
        147  return;
        148  DCHECK(notification_id_);
        149  }
        150  // TODO(rkuroiwa): Use media_ranges.subsegment_ranges instead of caching the
        151  // subsegments.
        152  for (const auto& event_info : event_info_) {
        153  switch (event_info.type) {
        154  case EventInfoType::kSegment:
        155  mpd_notifier_->NotifyNewSegment(
        156  notification_id_.value(), event_info.segment_info.start_time,
        157  event_info.segment_info.duration,
        158  event_info.segment_info.segment_file_size);
        159  break;
        160  case EventInfoType::kKeyFrame:
        161  // NO-OP for DASH.
        162  break;
        163  case EventInfoType::kCue:
        164  mpd_notifier_->NotifyCueEvent(notification_id_.value(),
        165  event_info.cue_event_info.timestamp);
        166  break;
        167  }
        168  }
        169  event_info_.clear();
        170  mpd_notifier_->Flush();
        171 }
        172 
        173 void MpdNotifyMuxerListener::OnNewSegment(const std::string& file_name,
        174  uint64_t start_time,
        175  uint64_t duration,
        176  uint64_t segment_file_size) {
        177  if (mpd_notifier_->dash_profile() == DashProfile::kLive) {
        178  mpd_notifier_->NotifyNewSegment(notification_id_.value(), start_time,
        179  duration, segment_file_size);
        180  if (mpd_notifier_->mpd_type() == MpdType::kDynamic)
        181  mpd_notifier_->Flush();
        182  } else {
        183  EventInfo event_info;
        184  event_info.type = EventInfoType::kSegment;
        185  event_info.segment_info = {start_time, duration, segment_file_size};
        186  event_info_.push_back(event_info);
        187  }
        188 }
        189 
        190 void MpdNotifyMuxerListener::OnKeyFrame(uint64_t timestamp,
        191  uint64_t start_byte_offset,
        192  uint64_t size) {
        193  // NO-OP for DASH.
        194 }
        195 
        196 void MpdNotifyMuxerListener::OnCueEvent(uint64_t timestamp,
        197  const std::string& cue_data) {
        198  // Not using |cue_data| at this moment.
        199  if (mpd_notifier_->dash_profile() == DashProfile::kLive) {
        200  mpd_notifier_->NotifyCueEvent(notification_id_.value(), timestamp);
        201  } else {
        202  EventInfo event_info;
        203  event_info.type = EventInfoType::kCue;
        204  event_info.cue_event_info = {timestamp};
        205  event_info_.push_back(event_info);
        206  }
        207 }
        208 
        209 bool MpdNotifyMuxerListener::NotifyNewContainer() {
        210  uint32_t notification_id;
        211  if (!mpd_notifier_->NotifyNewContainer(*media_info_, &notification_id)) {
        212  LOG(ERROR) << "Failed to notify MpdNotifier.";
        213  return false;
        214  }
        215  notification_id_ = notification_id;
        216  return true;
        217 }
        218 
        219 } // namespace media
        220 } // namespace shaka
        void OnNewSegment(const std::string &file_name, uint64_t start_time, uint64_t duration, uint64_t segment_file_size) override
        virtual bool Flush()=0
        MpdType mpd_type() const
        Definition: mpd_notifier.h:111
        -
        Abstract class holds stream information.
        Definition: stream_info.h:59
        +
        Abstract class holds stream information.
        Definition: stream_info.h:61
        virtual bool NotifyNewSegment(uint32_t container_id, uint64_t start_time, uint64_t duration, uint64_t size)=0
        DashProfile dash_profile() const
        Definition: mpd_notifier.h:108
        @@ -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 1c35647cbd..755aeadc93 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 index cadf9f6e5f..75554baf0d 100644 --- a/docs/db/dff/webvtt__file__buffer_8h_source.html +++ b/docs/db/dff/webvtt__file__buffer_8h_source.html @@ -73,7 +73,7 @@ $(function() { 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 dfeb6171a4..92fd326084 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 b470762240..ef9bd04888 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 6dc1b7ca50..efc21bfe5c 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 f350b2ac9c..67d976c477 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 9321ba59de..b6d9866b98 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 a5cc502f3f..c08f3ab8a0 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 0a2dd5b883..1501a5c45c 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 e5795954e4..48437636e1 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 20e9ca4ef6..3080b62f18 100644 --- a/docs/dc/d19/box_8h_source.html +++ b/docs/dc/d19/box_8h_source.html @@ -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 b1bab85ec6..433eff5f40 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 f608cf1f25..26eab065c0 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 e6cfe89414..0ddb00a6c3 100644 --- a/docs/dc/d1f/classshaka_1_1media_1_1WebVttParser-members.html +++ b/docs/dc/d1f/classshaka_1_1media_1_1WebVttParser-members.html @@ -71,32 +71,33 @@ $(function() { - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + +
        AddHandler(std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandlerinline
        Cancel() override (defined in shaka::media::WebVttParser)shaka::media::WebVttParservirtual
        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
        OnFlushRequest(size_t input_stream_index)shaka::media::MediaHandlerprotectedvirtual
        OriginHandler()=default (defined in shaka::media::OriginHandler)shaka::media::OriginHandler
        output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
        Run() override (defined in shaka::media::WebVttParser)shaka::media::WebVttParservirtual
        SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
        WebVttParser(std::unique_ptr< FileReader > source, const std::string &language) (defined in shaka::media::WebVttParser)shaka::media::WebVttParser
        ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
        Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
        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
        OnFlushRequest(size_t input_stream_index)shaka::media::MediaHandlerprotectedvirtual
        OriginHandler()=default (defined in shaka::media::OriginHandler)shaka::media::OriginHandler
        output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
        Run() override (defined in shaka::media::WebVttParser)shaka::media::WebVttParservirtual
        SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
        WebVttParser(std::unique_ptr< FileReader > source, const std::string &language) (defined in shaka::media::WebVttParser)shaka::media::WebVttParser
        ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
        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 70dc3aed96..6d036abbf8 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 715cde0f7f..caa78da55f 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 5c3f2f10b9..875de8031f 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 fb445d102b..f7fddcde5c 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 41e147a58c..47271326c4 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 feaeaef85c..e30bfa15d1 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 261ef9926c..2c0e7df2c5 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 0e0202a480..3d311ad9ed 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 248f8739c4..ae091f3306 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 644fbad87e..54c190a2f9 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 3e7a4007f3..69b2c580cf 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 d7dcaa13af..ef4126147a 100644 --- a/docs/dc/d52/decoding__time__iterator_8h_source.html +++ b/docs/dc/d52/decoding__time__iterator_8h_source.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/dc/d52/sync__point__queue_8cc_source.html b/docs/dc/d52/sync__point__queue_8cc_source.html index 498cd86938..df5e631f2d 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 abfd63283c..d8e6dd874d 100644 --- a/docs/dc/d53/webm_2segmenter_8cc_source.html +++ b/docs/dc/d53/webm_2segmenter_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 #include "packager/media/formats/webm/segmenter.h"
        8 
        9 #include "packager/base/time/time.h"
        10 #include "packager/media/base/audio_stream_info.h"
        11 #include "packager/media/base/media_handler.h"
        12 #include "packager/media/base/media_sample.h"
        13 #include "packager/media/base/muxer_options.h"
        14 #include "packager/media/base/muxer_util.h"
        15 #include "packager/media/base/stream_info.h"
        16 #include "packager/media/base/video_stream_info.h"
        17 #include "packager/media/codecs/vp_codec_configuration_record.h"
        18 #include "packager/media/event/muxer_listener.h"
        19 #include "packager/media/event/progress_listener.h"
        20 #include "packager/media/formats/webm/encryptor.h"
        21 #include "packager/media/formats/webm/webm_constants.h"
        22 #include "packager/third_party/libwebm/src/mkvmuxerutil.hpp"
        23 #include "packager/third_party/libwebm/src/webmids.hpp"
        24 #include "packager/version/version.h"
        25 
        26 using mkvmuxer::AudioTrack;
        27 using mkvmuxer::VideoTrack;
        28 
        29 namespace shaka {
        30 namespace media {
        31 namespace webm {
        32 namespace {
        33 const int64_t kTimecodeScale = 1000000;
        34 const int64_t kSecondsToNs = 1000000000L;
        35 
        36 // Round to closest integer.
        37 uint64_t Round(double value) {
        38  return static_cast<uint64_t>(value + 0.5);
        39 }
        40 
        41 // There are three different kinds of timestamp here:
        42 // (1) ISO-BMFF timestamp (seconds scaled by ISO-BMFF timescale)
        43 // This is used in our MediaSample and StreamInfo structures.
        44 // (2) WebM timecode (seconds scaled by kSecondsToNs / WebM timecode scale)
        45 // This is used in most WebM structures.
        46 // (3) Nanoseconds (seconds scaled by kSecondsToNs)
        47 // This is used in some WebM structures, e.g. Frame.
        48 // We use Nanoseconds as intermediate format here for conversion, in
        49 // uint64_t/int64_t, which is sufficient to represent a time as large as 292
        50 // years.
        51 
        52 uint64_t BmffTimestampToNs(uint64_t timestamp, uint64_t time_scale) {
        53  // Casting to double is needed otherwise kSecondsToNs * timestamp may overflow
        54  // uint64_t/int64_t.
        55  return Round(static_cast<double>(timestamp) / time_scale * kSecondsToNs);
        56 }
        57 
        58 uint64_t NsToBmffTimestamp(uint64_t ns, uint64_t time_scale) {
        59  // Casting to double is needed otherwise ns * time_scale may overflow
        60  // uint64_t/int64_t.
        61  return Round(static_cast<double>(ns) / kSecondsToNs * time_scale);
        62 }
        63 
        64 uint64_t NsToWebMTimecode(uint64_t ns, uint64_t timecode_scale) {
        65  return ns / timecode_scale;
        66 }
        67 
        68 uint64_t WebMTimecodeToNs(uint64_t timecode, uint64_t timecode_scale) {
        69  return timecode * timecode_scale;
        70 }
        71 
        72 } // namespace
        73 
        74 Segmenter::Segmenter(const MuxerOptions& options) : options_(options) {}
        75 
        76 Segmenter::~Segmenter() {}
        77 
        79  ProgressListener* progress_listener,
        80  MuxerListener* muxer_listener) {
        81  is_encrypted_ = info.is_encrypted();
        82  duration_ = info.duration();
        83  time_scale_ = info.time_scale();
        84 
        85  muxer_listener_ = muxer_listener;
        86 
        87  // Use media duration as progress target.
        88  progress_target_ = info.duration();
        89  progress_listener_ = progress_listener;
        90 
        91  segment_info_.Init();
        92  segment_info_.set_timecode_scale(kTimecodeScale);
        93 
        94  const std::string version = GetPackagerVersion();
        95  if (!version.empty()) {
        96  segment_info_.set_writing_app(
        97  (GetPackagerProjectUrl() + " version " + version).c_str());
        98  }
        99 
        100  if (options().segment_template.empty()) {
        101  // Set an initial duration so the duration element is written; will be
        102  // overwritten at the end. This works because this is a float and floats
        103  // are always the same size.
        104  segment_info_.set_duration(1);
        105  }
        106 
        107  // Create the track info.
        108  // The seed is only used to create a UID which we overwrite later.
        109  unsigned int seed = 0;
        110  std::unique_ptr<mkvmuxer::Track> track;
        111  Status status;
        112  switch (info.stream_type()) {
        113  case kStreamVideo: {
        114  std::unique_ptr<VideoTrack> video_track(new VideoTrack(&seed));
        115  status = InitializeVideoTrack(static_cast<const VideoStreamInfo&>(info),
        116  video_track.get());
        117  track = std::move(video_track);
        118  break;
        119  }
        120  case kStreamAudio: {
        121  std::unique_ptr<AudioTrack> audio_track(new AudioTrack(&seed));
        122  status = InitializeAudioTrack(static_cast<const AudioStreamInfo&>(info),
        123  audio_track.get());
        124  track = std::move(audio_track);
        125  break;
        126  }
        127  default:
        128  NOTIMPLEMENTED() << "Not implemented for stream type: "
        129  << info.stream_type();
        130  status = Status(error::UNIMPLEMENTED, "Not implemented for stream type");
        131  }
        132  if (!status.ok())
        133  return status;
        134 
        135  if (info.is_encrypted()) {
        136  if (info.encryption_config().per_sample_iv_size != kWebMIvSize)
        137  return Status(error::MUXER_FAILURE, "Incorrect size WebM encryption IV.");
        138  status = UpdateTrackForEncryption(info.encryption_config().key_id,
        139  track.get());
        140  if (!status.ok())
        141  return status;
        142  }
        143 
        144  tracks_.AddTrack(track.get(), info.track_id());
        145  // number() is only available after the above instruction.
        146  track_id_ = track->number();
        147  // |tracks_| owns |track|.
        148  track.release();
        149  return DoInitialize();
        150 }
        151 
        153  uint64_t duration =
        154  prev_sample_->pts() - first_timestamp_ + prev_sample_->duration();
        155  segment_info_.set_duration(FromBmffTimestamp(duration));
        156  return DoFinalize();
        157 }
        158 
        159 Status Segmenter::AddSample(const MediaSample& source_sample) {
        160  std::shared_ptr<MediaSample> sample(source_sample.Clone());
        161 
        162  if (sample_duration_ == 0) {
        163  first_timestamp_ = sample->pts();
        164  sample_duration_ = sample->duration();
        165  if (muxer_listener_)
        166  muxer_listener_->OnSampleDurationReady(sample_duration_);
        167  }
        168 
        169  UpdateProgress(sample->duration());
        170 
        171  // This writes frames in a delay. Meaning that the previous frame is written
        172  // on this call to AddSample. The current frame is stored until the next
        173  // call. This is done to determine which frame is the last in a Cluster.
        174  // This first block determines if this is a new Cluster and writes the
        175  // previous frame first before creating the new Cluster.
        176 
        177  Status status;
        178  if (new_segment_ || new_subsegment_) {
        179  status = NewSegment(sample->pts(), new_subsegment_);
        180  } else {
        181  status = WriteFrame(false /* write_duration */);
        182  }
        183  if (!status.ok())
        184  return status;
        185 
        186  if (is_encrypted_)
        187  UpdateFrameForEncryption(sample.get());
        188 
        189  new_subsegment_ = false;
        190  new_segment_ = false;
        191  prev_sample_ = sample;
        192  return Status::OK;
        193 }
        194 
        195 Status Segmenter::FinalizeSegment(uint64_t start_timestamp,
        196  uint64_t duration_timestamp,
        197  bool is_subsegment) {
        198  if (is_subsegment)
        199  new_subsegment_ = true;
        200  else
        201  new_segment_ = true;
        202  return WriteFrame(true /* write duration */);
        203 }
        204 
        205 float Segmenter::GetDurationInSeconds() const {
        206  return WebMTimecodeToNs(segment_info_.duration(),
        207  segment_info_.timecode_scale()) /
        208  static_cast<double>(kSecondsToNs);
        209 }
        210 
        211 uint64_t Segmenter::FromBmffTimestamp(uint64_t bmff_timestamp) {
        212  return NsToWebMTimecode(
        213  BmffTimestampToNs(bmff_timestamp, time_scale_),
        214  segment_info_.timecode_scale());
        215 }
        216 
        217 uint64_t Segmenter::FromWebMTimecode(uint64_t webm_timecode) {
        218  return NsToBmffTimestamp(
        219  WebMTimecodeToNs(webm_timecode, segment_info_.timecode_scale()),
        220  time_scale_);
        221 }
        222 
        223 Status Segmenter::WriteSegmentHeader(uint64_t file_size, MkvWriter* writer) {
        224  Status error_status(error::FILE_FAILURE, "Error writing segment header.");
        225 
        226  if (!WriteEbmlHeader(writer))
        227  return error_status;
        228 
        229  if (WriteID(writer, mkvmuxer::kMkvSegment) != 0)
        230  return error_status;
        231 
        232  const uint64_t segment_size_size = 8;
        233  segment_payload_pos_ = writer->Position() + segment_size_size;
        234  if (file_size > 0) {
        235  // We want the size of the segment element, so subtract the header.
        236  if (WriteUIntSize(writer, file_size - segment_payload_pos_,
        237  segment_size_size) != 0)
        238  return error_status;
        239  if (!seek_head_.Write(writer))
        240  return error_status;
        241  } else {
        242  if (SerializeInt(writer, mkvmuxer::kEbmlUnknownValue, segment_size_size) !=
        243  0)
        244  return error_status;
        245  // We don't know the header size, so write a placeholder.
        246  if (!seek_head_.WriteVoid(writer))
        247  return error_status;
        248  }
        249 
        250  seek_head_.set_info_pos(writer->Position() - segment_payload_pos_);
        251  if (!segment_info_.Write(writer))
        252  return error_status;
        253 
        254  seek_head_.set_tracks_pos(writer->Position() - segment_payload_pos_);
        255  if (!tracks_.Write(writer))
        256  return error_status;
        257 
        258  return Status::OK;
        259 }
        260 
        261 Status Segmenter::SetCluster(uint64_t start_webm_timecode,
        262  uint64_t position,
        263  MkvWriter* writer) {
        264  const uint64_t scale = segment_info_.timecode_scale();
        265  cluster_.reset(new mkvmuxer::Cluster(start_webm_timecode, position, scale));
        266  cluster_->Init(writer);
        267  return Status::OK;
        268 }
        269 
        270 void Segmenter::UpdateProgress(uint64_t progress) {
        271  accumulated_progress_ += progress;
        272  if (!progress_listener_ || progress_target_ == 0)
        273  return;
        274  // It might happen that accumulated progress exceeds progress_target due to
        275  // computation errors, e.g. rounding error. Cap it so it never reports > 100%
        276  // progress.
        277  if (accumulated_progress_ >= progress_target_) {
        278  progress_listener_->OnProgress(1.0);
        279  } else {
        280  progress_listener_->OnProgress(static_cast<double>(accumulated_progress_) /
        281  progress_target_);
        282  }
        283 }
        284 
        285 Status Segmenter::InitializeVideoTrack(const VideoStreamInfo& info,
        286  VideoTrack* track) {
        287  if (info.codec() == kCodecVP8) {
        288  track->set_codec_id(mkvmuxer::Tracks::kVp8CodecId);
        289  } else if (info.codec() == kCodecVP9) {
        290  track->set_codec_id(mkvmuxer::Tracks::kVp9CodecId);
        291 
        292  // The |StreamInfo::codec_config| field is stored using the MP4 format; we
        293  // need to convert it to the WebM format.
        294  VPCodecConfigurationRecord vp_config;
        295  if (!vp_config.ParseMP4(info.codec_config())) {
        296  return Status(error::INTERNAL_ERROR,
        297  "Unable to parse VP9 codec configuration");
        298  }
        299 
        300  mkvmuxer::Colour colour;
        301  if (vp_config.matrix_coefficients() != AVCOL_SPC_UNSPECIFIED) {
        302  colour.set_matrix_coefficients(vp_config.matrix_coefficients());
        303  }
        304  if (vp_config.transfer_characteristics() != AVCOL_TRC_UNSPECIFIED) {
        305  colour.set_transfer_characteristics(vp_config.transfer_characteristics());
        306  }
        307  if (vp_config.color_primaries() != AVCOL_PRI_UNSPECIFIED) {
        308  colour.set_primaries(vp_config.color_primaries());
        309  }
        310  if (!track->SetColour(colour)) {
        311  return Status(error::INTERNAL_ERROR,
        312  "Failed to setup color element for VPx streams");
        313  }
        314 
        315  std::vector<uint8_t> codec_config;
        316  vp_config.WriteWebM(&codec_config);
        317  if (!track->SetCodecPrivate(codec_config.data(), codec_config.size())) {
        318  return Status(error::INTERNAL_ERROR,
        319  "Private codec data required for VPx streams");
        320  }
        321  } else {
        322  LOG(ERROR) << "Only VP8 and VP9 video codecs are supported in WebM.";
        323  return Status(error::UNIMPLEMENTED,
        324  "Only VP8 and VP9 video codecs are supported in WebM.");
        325  }
        326 
        327  track->set_uid(info.track_id());
        328  if (!info.language().empty())
        329  track->set_language(info.language().c_str());
        330  track->set_type(mkvmuxer::Tracks::kVideo);
        331  track->set_width(info.width());
        332  track->set_height(info.height());
        333  track->set_display_height(info.height());
        334  track->set_display_width(info.width() * info.pixel_width() /
        335  info.pixel_height());
        336  return Status::OK;
        337 }
        338 
        339 Status Segmenter::InitializeAudioTrack(const AudioStreamInfo& info,
        340  AudioTrack* track) {
        341  if (info.codec() == kCodecOpus) {
        342  track->set_codec_id(mkvmuxer::Tracks::kOpusCodecId);
        343  } else if (info.codec() == kCodecVorbis) {
        344  track->set_codec_id(mkvmuxer::Tracks::kVorbisCodecId);
        345  } else {
        346  LOG(ERROR) << "Only Vorbis and Opus audio codec are supported in WebM.";
        347  return Status(error::UNIMPLEMENTED,
        348  "Only Vorbis and Opus audio codecs are supported in WebM.");
        349  }
        350  if (!track->SetCodecPrivate(info.codec_config().data(),
        351  info.codec_config().size())) {
        352  return Status(error::INTERNAL_ERROR,
        353  "Private codec data required for audio streams");
        354  }
        355 
        356  track->set_uid(info.track_id());
        357  if (!info.language().empty())
        358  track->set_language(info.language().c_str());
        359  track->set_type(mkvmuxer::Tracks::kAudio);
        360  track->set_sample_rate(info.sampling_frequency());
        361  track->set_channels(info.num_channels());
        362  track->set_seek_pre_roll(info.seek_preroll_ns());
        363  track->set_codec_delay(info.codec_delay_ns());
        364  return Status::OK;
        365 }
        366 
        367 Status Segmenter::WriteFrame(bool write_duration) {
        368  // Create a frame manually so we can create non-SimpleBlock frames. This
        369  // is required to allow the frame duration to be added. If the duration
        370  // is not set, then a SimpleBlock will still be written.
        371  mkvmuxer::Frame frame;
        372 
        373  if (!frame.Init(prev_sample_->data(), prev_sample_->data_size())) {
        374  return Status(error::MUXER_FAILURE,
        375  "Error adding sample to segment: Frame::Init failed");
        376  }
        377 
        378  if (write_duration) {
        379  frame.set_duration(
        380  BmffTimestampToNs(prev_sample_->duration(), time_scale_));
        381  }
        382  frame.set_is_key(prev_sample_->is_key_frame());
        383  frame.set_timestamp(
        384  BmffTimestampToNs(prev_sample_->pts(), time_scale_));
        385  frame.set_track_number(track_id_);
        386 
        387  if (prev_sample_->side_data_size() > 0) {
        388  uint64_t block_add_id;
        389  // First 8 bytes of side_data is the BlockAddID element's value, which is
        390  // done to mimic ffmpeg behavior. See webm_cluster_parser.cc for details.
        391  CHECK_GT(prev_sample_->side_data_size(), sizeof(block_add_id));
        392  memcpy(&block_add_id, prev_sample_->side_data(), sizeof(block_add_id));
        393  if (!frame.AddAdditionalData(
        394  prev_sample_->side_data() + sizeof(block_add_id),
        395  prev_sample_->side_data_size() - sizeof(block_add_id),
        396  block_add_id)) {
        397  return Status(
        398  error::MUXER_FAILURE,
        399  "Error adding sample to segment: Frame::AddAditionalData Failed");
        400  }
        401  }
        402 
        403  if (!prev_sample_->is_key_frame() && !frame.CanBeSimpleBlock()) {
        404  frame.set_reference_block_timestamp(
        405  BmffTimestampToNs(reference_frame_timestamp_, time_scale_));
        406  }
        407 
        408  // GetRelativeTimecode will return -1 if the relative timecode is too large
        409  // to fit in the frame.
        410  if (cluster_->GetRelativeTimecode(NsToWebMTimecode(
        411  frame.timestamp(), cluster_->timecode_scale())) < 0) {
        412  const double segment_duration =
        413  static_cast<double>(frame.timestamp() -
        414  WebMTimecodeToNs(cluster_->timecode(),
        415  cluster_->timecode_scale())) /
        416  kSecondsToNs;
        417  LOG(ERROR) << "Error adding sample to segment: segment too large, "
        418  << segment_duration
        419  << " seconds. Please check your GOP size and segment duration.";
        420  return Status(error::MUXER_FAILURE,
        421  "Error adding sample to segment: segment too large");
        422  }
        423 
        424  if (!cluster_->AddFrame(&frame)) {
        425  return Status(error::MUXER_FAILURE,
        426  "Error adding sample to segment: Cluster::AddFrame failed");
        427  }
        428 
        429  // A reference frame is needed for non-keyframes. Having a reference to the
        430  // previous block is good enough.
        431  // See libwebm Segment::AddGenericFrame
        432  reference_frame_timestamp_ = prev_sample_->pts();
        433  return Status::OK;
        434 }
        435 
        436 } // namespace webm
        437 } // namespace media
        438 } // namespace shaka
        std::shared_ptr< MediaSample > Clone() const
        Clone the object and return a new MediaSample.
        Definition: media_sample.cc:81
        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
        +
        Abstract class holds stream information.
        Definition: stream_info.h:61
        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.
        @@ -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 ecef9321f8..2d1cc8a3cb 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 db6fcdbe6a..241c6759b7 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 0604bb4f7a..19352a1084 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 e43b10b04b..b9334b5735 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 7cb46c0f2c..c5f757c4b8 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 5abaaef97d..0db5f850c6 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 c1bf24097a..25b8079578 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 02c78da55e..2144e52622 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 fec966a837..cd8b040dc8 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 730620af00..4a8c07b4df 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 e770585d7b..fe6d8c02c7 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 665f6111d1..2d075b8a08 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 c81fd5796a..6bb9f49e64 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 528324a3fd..cc399953bf 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 b2d429572e..39114adfbb 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 @@ -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 d5712c0b85..fbce88ee21 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 c1e912b96a..3f056251c7 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 4623ab3973..6ecb4d0699 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 @@ -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 0711596c16..cfb3e89073 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 0d3f34052a..9e994fd642 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 310ff9e469..a771d8ee07 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 f3ed57ab0d..b68dc255df 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 a7a4260f90..1217d4a00d 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 117291c956..120584e615 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 172dd6a6a8..04b1bdfb56 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 41238ae1c8..836332f7fb 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 69a605a088..58c928a446 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 cf6f88fdbe..91ff6108ac 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 bc397ec56c..2dfe66ef6b 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 c717c90cab..6ed29f65dd 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 @@ -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 d64add1c66..afdd50fa3b 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 f4ce62df71..fbbb71914c 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 @@ -90,7 +90,7 @@ $(function() { 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 d71efbe86f..183a53b4b3 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 b383669768..0338119ffc 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 2a4e55107e..0e9e4a4d3f 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 9670e932d4..d734913ae1 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 c4cf6e750c..8ec4ed3229 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 4ce74ab726..beb2a4aaae 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 a279255132..1874fa272b 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 c477caee90..38970d9227 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 365e4bff49..ad31a1c99d 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 081d20a679..1e9db68c53 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 @@ -158,7 +158,7 @@ uint32_t flags = 0 diff --git a/docs/dd/d0c/classshaka_1_1ThreadedIoFile.html b/docs/dd/d0c/classshaka_1_1ThreadedIoFile.html index f9f5272ad7..36f1ef1cea 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 a2975fd116..d226a5c521 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 64b1669288..bda6c2f93c 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 694471bc0d..12dad4a4be 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 f5e7865549..4b0f9fee32 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 @@ -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 63e0619ee2..d04b84f539 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 60919aed05..b0343211a0 100644 --- a/docs/dd/d17/classshaka_1_1media_1_1Demuxer.html +++ b/docs/dd/d17/classshaka_1_1media_1_1Demuxer.html @@ -180,6 +180,13 @@ size_t next_output_stream_ const std::map< size_t, std::pair< std::shared_ptr< MediaHandler >, size_t > > & output_handlers ()   + + + + +

        +Additional Inherited Members

        - Static Public Member Functions inherited from shaka::media::MediaHandler
        +static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list)
         

        Detailed Description

        Demuxer is responsible for extracting elementary stream samples from a media file, e.g. an ISO BMFF file.

        @@ -477,7 +484,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 7d2d11122a..b3452b60eb 100644 --- a/docs/dd/d19/video__stream__info_8cc_source.html +++ b/docs/dd/d19/video__stream__info_8cc_source.html @@ -66,17 +66,17 @@ $(function() {
        video_stream_info.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/video_stream_info.h"
        8 
        9 #include "packager/base/logging.h"
        10 #include "packager/base/strings/string_number_conversions.h"
        11 #include "packager/base/strings/string_util.h"
        12 #include "packager/base/strings/stringprintf.h"
        13 #include "packager/media/base/limits.h"
        14 
        15 namespace shaka {
        16 namespace media {
        17 
        18 namespace {
        19 std::string VideoCodecToString(Codec codec) {
        20  switch (codec) {
        21  case kCodecH264:
        22  return "H264";
        23  case kCodecH265:
        24  return "H265";
        25  case kCodecVP8:
        26  return "VP8";
        27  case kCodecVP9:
        28  return "VP9";
        29  case kCodecVP10:
        30  return "VP10";
        31  default:
        32  NOTIMPLEMENTED() << "Unknown Video Codec: " << codec;
        33  return "UnknownCodec";
        34  }
        35 }
        36 
        37 } // namespace
        38 
        39 VideoStreamInfo::VideoStreamInfo(int track_id,
        40  uint32_t time_scale,
        41  uint64_t duration,
        42  Codec codec,
        43  H26xStreamFormat h26x_stream_format,
        44  const std::string& codec_string,
        45  const uint8_t* codec_config,
        46  size_t codec_config_size,
        47  uint16_t width,
        48  uint16_t height,
        49  uint32_t pixel_width,
        50  uint32_t pixel_height,
        51  uint32_t trick_play_factor,
        52  uint8_t nalu_length_size,
        53  const std::string& language,
        54  bool is_encrypted)
        55  : StreamInfo(kStreamVideo,
        56  track_id,
        57  time_scale,
        58  duration,
        59  codec,
        60  codec_string,
        61  codec_config,
        62  codec_config_size,
        63  language,
        64  is_encrypted),
        65  h26x_stream_format_(h26x_stream_format),
        66  width_(width),
        67  height_(height),
        68  pixel_width_(pixel_width),
        69  pixel_height_(pixel_height),
        70  trick_play_factor_(trick_play_factor),
        71  nalu_length_size_(nalu_length_size) {}
        72 
        73 VideoStreamInfo::~VideoStreamInfo() {}
        74 
        76  return codec() != kUnknownCodec && width_ > 0 &&
        77  width_ <= limits::kMaxDimension && height_ > 0 &&
        78  height_ <= limits::kMaxDimension &&
        79  (nalu_length_size_ <= 2 || nalu_length_size_ == 4);
        80 }
        81 
        82 std::string VideoStreamInfo::ToString() const {
        83  return base::StringPrintf(
        84  "%s codec: %s\n width: %d\n height: %d\n pixel_aspect_ratio: %d:%d\n "
        85  "trick_play_factor: %d\n nalu_length_size: %d\n",
        86  StreamInfo::ToString().c_str(), VideoCodecToString(codec()).c_str(),
        87  width_, height_, pixel_width_, pixel_height_, trick_play_factor_,
        88  nalu_length_size_);
        89 }
        90 
        91 std::unique_ptr<StreamInfo> VideoStreamInfo::Clone() const {
        92  return std::unique_ptr<StreamInfo>(new VideoStreamInfo(*this));
        93 }
        94 
        95 } // namespace media
        96 } // namespace shaka
        Abstract class holds stream information.
        Definition: stream_info.h:59
        +
        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/video_stream_info.h"
        8 
        9 #include "packager/base/logging.h"
        10 #include "packager/base/strings/string_number_conversions.h"
        11 #include "packager/base/strings/string_util.h"
        12 #include "packager/base/strings/stringprintf.h"
        13 #include "packager/media/base/limits.h"
        14 
        15 namespace shaka {
        16 namespace media {
        17 
        18 namespace {
        19 std::string VideoCodecToString(Codec codec) {
        20  switch (codec) {
        21  case kCodecH264:
        22  return "H264";
        23  case kCodecH265:
        24  return "H265";
        25  case kCodecVP8:
        26  return "VP8";
        27  case kCodecVP9:
        28  return "VP9";
        29  case kCodecVP10:
        30  return "VP10";
        31  default:
        32  NOTIMPLEMENTED() << "Unknown Video Codec: " << codec;
        33  return "UnknownCodec";
        34  }
        35 }
        36 
        37 } // namespace
        38 
        39 VideoStreamInfo::VideoStreamInfo(int track_id,
        40  uint32_t time_scale,
        41  uint64_t duration,
        42  Codec codec,
        43  H26xStreamFormat h26x_stream_format,
        44  const std::string& codec_string,
        45  const uint8_t* codec_config,
        46  size_t codec_config_size,
        47  uint16_t width,
        48  uint16_t height,
        49  uint32_t pixel_width,
        50  uint32_t pixel_height,
        51  uint32_t trick_play_factor,
        52  uint8_t nalu_length_size,
        53  const std::string& language,
        54  bool is_encrypted)
        55  : StreamInfo(kStreamVideo,
        56  track_id,
        57  time_scale,
        58  duration,
        59  codec,
        60  codec_string,
        61  codec_config,
        62  codec_config_size,
        63  language,
        64  is_encrypted),
        65  h26x_stream_format_(h26x_stream_format),
        66  width_(width),
        67  height_(height),
        68  pixel_width_(pixel_width),
        69  pixel_height_(pixel_height),
        70  trick_play_factor_(trick_play_factor),
        71  nalu_length_size_(nalu_length_size) {}
        72 
        73 VideoStreamInfo::~VideoStreamInfo() {}
        74 
        76  return codec() != kUnknownCodec && width_ > 0 &&
        77  width_ <= limits::kMaxDimension && height_ > 0 &&
        78  height_ <= limits::kMaxDimension &&
        79  (nalu_length_size_ <= 2 || nalu_length_size_ == 4);
        80 }
        81 
        82 std::string VideoStreamInfo::ToString() const {
        83  return base::StringPrintf(
        84  "%s codec: %s\n width: %d\n height: %d\n pixel_aspect_ratio: %d:%d\n "
        85  "trick_play_factor: %d\n nalu_length_size: %d\n",
        86  StreamInfo::ToString().c_str(), VideoCodecToString(codec()).c_str(),
        87  width_, height_, pixel_width_, pixel_height_, trick_play_factor_,
        88  nalu_length_size_);
        89 }
        90 
        91 std::unique_ptr<StreamInfo> VideoStreamInfo::Clone() const {
        92  return std::unique_ptr<StreamInfo>(new VideoStreamInfo(*this));
        93 }
        94 
        95 } // namespace media
        96 } // namespace shaka
        Abstract class holds stream information.
        Definition: stream_info.h:61
        bool IsValidConfig() const override
        std::unique_ptr< StreamInfo > Clone() const override
        -
        virtual std::string ToString() const
        Definition: stream_info.cc:37
        +
        virtual std::string ToString() const
        Definition: stream_info.cc:58
        All the methods that are virtual are virtual for mocking.
        Holds video stream information.
        std::string ToString() const override
        diff --git a/docs/dd/d1c/classshaka_1_1hls_1_1MediaPlaylist.html b/docs/dd/d1c/classshaka_1_1hls_1_1MediaPlaylist.html index 8d1bde3a92..c8c390c780 100644 --- a/docs/dd/d1c/classshaka_1_1hls_1_1MediaPlaylist.html +++ b/docs/dd/d1c/classshaka_1_1hls_1_1MediaPlaylist.html @@ -164,7 +164,7 @@ void 

        Detailed Description

        Methods are virtual for mocking.

        -

        Definition at line 45 of file media_playlist.h.

        +

        Definition at line 46 of file media_playlist.h.

        Constructor & Destructor Documentation

        ◆ MediaPlaylist()

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

        +

        Definition at line 419 of file media_playlist.cc.

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

        +

        Definition at line 404 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 435 of file media_playlist.cc.

        +

        Definition at line 436 of file media_playlist.cc.

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

        +

        Definition at line 376 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 462 of file media_playlist.cc.

        +

        Definition at line 463 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 487 of file media_playlist.cc.

        +

        Definition at line 488 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 468 of file media_playlist.cc.

        +

        Definition at line 469 of file media_playlist.cc.

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

        Definition at line 483 of file media_playlist.cc.

        +

        Definition at line 484 of file media_playlist.cc.

        @@ -583,7 +583,7 @@ void 
        Returns
        the language of the media, as an ISO language tag in its shortest form. May be an empty string for video.
        -

        Definition at line 179 of file media_playlist.h.

        +

        Definition at line 180 of file media_playlist.h.

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

        Definition at line 350 of file media_playlist.cc.

        +

        Definition at line 351 of file media_playlist.cc.

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

        +

        Definition at line 473 of file media_playlist.cc.

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

        Definition at line 439 of file media_playlist.cc.

        +

        Definition at line 440 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 df1f2fb65f..c3b2751695 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 9bc201dfea..a4a5dbfb6f 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 9bdb7dd5f7..d042e58d3e 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 208e799515..e0abd8e406 100644 --- a/docs/dd/d3b/mp4_2segmenter_8h_source.html +++ b/docs/dd/d3b/mp4_2segmenter_8h_source.html @@ -92,7 +92,7 @@ $(function() { diff --git a/docs/dd/d3e/callback__file_8cc_source.html b/docs/dd/d3e/callback__file_8cc_source.html index 7019e54d64..4b0e99527c 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 5b9892c227..f162c75a33 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 @@ -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 e7e5ed2a54..e03c70bd29 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 def8d9aa9c..599d80e429 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 04fd04d9df..af3cd357d7 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 ab572b4fac..508926a954 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 a318ed8109..9bf7462478 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 ab7a29582d..ab802316ad 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 b07c8667d4..7c7e8ff1ff 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 8c0c14906a..4d2014d086 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 1b8cc3a2e8..2356ff890d 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 c70787891c..515ebcea46 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 7a1e937594..1550deffee 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 52a1cb83c5..df218ab5cf 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 30630022b7..07a3a8c193 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 a89c241e6c..785793c641 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 39984cc4ee..7a26ae7bf3 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 3a17c8ccb2..1d0d933cbe 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 0f3f5fe9fa..800bfeca37 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 e17139c3be..54d734b3b8 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 b141590e20..18d29c8e98 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 400ae28b34..c4a8a6ebb9 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 @@ -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 e6d808e3ad..d1c9df77de 100644 --- a/docs/dd/d74/classshaka_1_1media_1_1MediaHandlerGraphTestBase-members.html +++ b/docs/dd/d74/classshaka_1_1media_1_1MediaHandlerGraphTestBase-members.html @@ -78,7 +78,7 @@ $(function() { GetOutputStreamDataVector() constshaka::media::MediaHandlerGraphTestBaseprotected GetSegmentInfo(int64_t start_timestamp, int64_t duration, bool is_subsegment) const (defined in shaka::media::MediaHandlerTestBase)shaka::media::MediaHandlerTestBaseprotected GetTextSample(const std::string &id, int64_t start, int64_t end, const std::string &payload) const (defined in shaka::media::MediaHandlerTestBase)shaka::media::MediaHandlerTestBaseprotected - GetTextStreamInfo() const (defined in shaka::media::MediaHandlerTestBase)shaka::media::MediaHandlerTestBaseprotected + GetTextStreamInfo(uint32_t timescale) const (defined in shaka::media::MediaHandlerTestBase)shaka::media::MediaHandlerTestBaseprotected GetVideoStreamInfo(uint32_t time_scale) const (defined in shaka::media::MediaHandlerTestBase)shaka::media::MediaHandlerTestBaseprotected GetVideoStreamInfo(uint32_t time_scale, uint32_t width, uint64_t height) const (defined in shaka::media::MediaHandlerTestBase)shaka::media::MediaHandlerTestBaseprotected GetVideoStreamInfo(uint32_t time_scale, Codec codec) const (defined in shaka::media::MediaHandlerTestBase)shaka::media::MediaHandlerTestBaseprotected @@ -95,7 +95,7 @@ $(function() { diff --git a/docs/dd/d7a/classshaka_1_1media_1_1MuxerListener.html b/docs/dd/d7a/classshaka_1_1media_1_1MuxerListener.html index 17373b29a9..732cbe0546 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 c85c1021f0..294858f6b7 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 4d713d3b6c..0f38b93afd 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 b853f09a4f..fe05d0ddaa 100644 --- a/docs/dd/d88/pes__packet__generator_8h_source.html +++ b/docs/dd/d88/pes__packet__generator_8h_source.html @@ -67,7 +67,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_FORMATS_MP2T_PES_PACKET_GENERATOR_H_
        8 #define PACKAGER_MEDIA_FORMATS_MP2T_PES_PACKET_GENERATOR_H_
        9 
        10 #include <list>
        11 #include <memory>
        12 
        13 #include "packager/media/base/media_sample.h"
        14 #include "packager/media/base/stream_info.h"
        15 
        16 namespace shaka {
        17 namespace media {
        18 
        19 class AACAudioSpecificConfig;
        20 class NalUnitToByteStreamConverter;
        21 class StreamInfo;
        22 
        23 namespace mp2t {
        24 
        25 class PesPacket;
        26 
        30  public:
        32  virtual ~PesPacketGenerator();
        33 
        39  virtual bool Initialize(const StreamInfo& stream);
        40 
        45  virtual bool PushSample(const MediaSample& sample);
        46 
        48  virtual size_t NumberOfReadyPesPackets();
        49 
        53  virtual std::unique_ptr<PesPacket> GetNextPesPacket();
        54 
        58  virtual bool Flush();
        59 
        60  private:
        61  friend class PesPacketGeneratorTest;
        62 
        63  StreamType stream_type_;
        64 
        65  // Calculated by 90000 / input stream's timescale. This is used to scale the
        66  // timestamps.
        67  double timescale_scale_ = 0.0;
        68 
        69  std::unique_ptr<NalUnitToByteStreamConverter> converter_;
        70  std::unique_ptr<AACAudioSpecificConfig> adts_converter_;
        71 
        72  // This is the PES packet that this object is currently working on.
        73  // This can be used to create a PES from multiple audio samples.
        74  std::unique_ptr<PesPacket> current_processing_pes_;
        75 
        76  // Audio stream id PES packet is codec dependent.
        77  uint8_t audio_stream_id_ = 0;
        78  std::list<std::unique_ptr<PesPacket>> pes_packets_;
        79 
        80  DISALLOW_COPY_AND_ASSIGN(PesPacketGenerator);
        81 };
        82 
        83 } // namespace mp2t
        84 } // namespace media
        85 } // namespace shaka
        86 
        87 #endif // PACKAGER_MEDIA_FORMATS_MP2T_PES_PACKET_GENERATOR_H_
        -
        Abstract class holds stream information.
        Definition: stream_info.h:59
        +
        Abstract class holds stream information.
        Definition: stream_info.h:61
        virtual bool PushSample(const MediaSample &sample)
        virtual std::unique_ptr< PesPacket > GetNextPesPacket()
        @@ -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 a84a94c867..e356dffce5 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 c6357ffb9d..a4bd6a4bc7 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 ea0ac06778..103147ce2c 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 dcf3b39d7b..29e001d841 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 030ae00f87..b963b49d42 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 af0f38fb00..39e97e0d0f 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 @@ -119,7 +119,7 @@ uint64_t earliest_presenta diff --git a/docs/dd/d9d/classshaka_1_1MpdNotifier-members.html b/docs/dd/d9d/classshaka_1_1MpdNotifier-members.html index 83d0a0928e..d9d82bf9d9 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 d458f581e8..e5e2f74503 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 9c3d8f2a5e..4ee2e42c8d 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 07bd301071..d610ffe442 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 @@ -66,7 +66,7 @@ $(function() {
        vod_media_info_dump_muxer_listener.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 // Implementation of MuxerListener that converts the info to a MediaInfo
        8 // protobuf and dumps it to a file.
        9 // This is specifically for VOD.
        10 
        11 #ifndef PACKAGER_MEDIA_EVENT_VOD_MEDIA_INFO_DUMP_MUXER_LISTENER_H_
        12 #define PACKAGER_MEDIA_EVENT_VOD_MEDIA_INFO_DUMP_MUXER_LISTENER_H_
        13 
        14 #include <memory>
        15 #include <string>
        16 #include <vector>
        17 
        18 #include "packager/base/macros.h"
        19 #include "packager/media/base/muxer_options.h"
        20 #include "packager/media/event/muxer_listener.h"
        21 
        22 namespace shaka {
        23 
        24 class MediaInfo;
        25 
        26 namespace media {
        27 
        29  public:
        30  VodMediaInfoDumpMuxerListener(const std::string& output_file_name);
        32 
        35  void OnEncryptionInfoReady(bool is_initial_encryption_info,
        36  FourCC protection_scheme,
        37  const std::vector<uint8_t>& default_key_id,
        38  const std::vector<uint8_t>& iv,
        39  const std::vector<ProtectionSystemSpecificInfo>&
        40  key_system_info) override;
        41  void OnEncryptionStart() override;
        42  void OnMediaStart(const MuxerOptions& muxer_options,
        43  const StreamInfo& stream_info,
        44  uint32_t time_scale,
        45  ContainerType container_type) override;
        46  void OnSampleDurationReady(uint32_t sample_duration) override;
        47  void OnMediaEnd(const MediaRanges& media_ranges,
        48  float duration_seconds) override;
        49  void OnNewSegment(const std::string& file_name,
        50  uint64_t start_time,
        51  uint64_t duration,
        52  uint64_t segment_file_size) override;
        53  void OnKeyFrame(uint64_t timestamp,
        54  uint64_t start_byte_offset,
        55  uint64_t size);
        56  void OnCueEvent(uint64_t timestamp, const std::string& cue_data) override;
        58 
        63  // TODO(rkuroiwa): Move this to muxer_listener_internal and rename
        64  // muxer_listener_internal to muxer_listener_util.
        65  static bool WriteMediaInfoToFile(const MediaInfo& media_info,
        66  const std::string& output_file_path);
        67 
        68  private:
        69  std::string output_file_name_;
        70  std::unique_ptr<MediaInfo> media_info_;
        71  uint64_t max_bitrate_ = 0;
        72 
        73  bool is_encrypted_ = false;
        74  // Storage for values passed to OnEncryptionInfoReady().
        75  FourCC protection_scheme_;
        76  std::vector<uint8_t> default_key_id_;
        77  std::vector<ProtectionSystemSpecificInfo> key_system_info_;
        78 
        79  DISALLOW_COPY_AND_ASSIGN(VodMediaInfoDumpMuxerListener);
        80 };
        81 
        82 } // namespace media
        83 } // namespace shaka
        84 
        85 #endif // PACKAGER_MEDIA_EVENT_VOD_MEDIA_INFO_DUMP_MUXER_LISTENER_H_
        Abstract class holds stream information.
        Definition: stream_info.h:59
        +
        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 // Implementation of MuxerListener that converts the info to a MediaInfo
        8 // protobuf and dumps it to a file.
        9 // This is specifically for VOD.
        10 
        11 #ifndef PACKAGER_MEDIA_EVENT_VOD_MEDIA_INFO_DUMP_MUXER_LISTENER_H_
        12 #define PACKAGER_MEDIA_EVENT_VOD_MEDIA_INFO_DUMP_MUXER_LISTENER_H_
        13 
        14 #include <memory>
        15 #include <string>
        16 #include <vector>
        17 
        18 #include "packager/base/macros.h"
        19 #include "packager/media/base/muxer_options.h"
        20 #include "packager/media/event/muxer_listener.h"
        21 
        22 namespace shaka {
        23 
        24 class MediaInfo;
        25 
        26 namespace media {
        27 
        29  public:
        30  VodMediaInfoDumpMuxerListener(const std::string& output_file_name);
        32 
        35  void OnEncryptionInfoReady(bool is_initial_encryption_info,
        36  FourCC protection_scheme,
        37  const std::vector<uint8_t>& default_key_id,
        38  const std::vector<uint8_t>& iv,
        39  const std::vector<ProtectionSystemSpecificInfo>&
        40  key_system_info) override;
        41  void OnEncryptionStart() override;
        42  void OnMediaStart(const MuxerOptions& muxer_options,
        43  const StreamInfo& stream_info,
        44  uint32_t time_scale,
        45  ContainerType container_type) override;
        46  void OnSampleDurationReady(uint32_t sample_duration) override;
        47  void OnMediaEnd(const MediaRanges& media_ranges,
        48  float duration_seconds) override;
        49  void OnNewSegment(const std::string& file_name,
        50  uint64_t start_time,
        51  uint64_t duration,
        52  uint64_t segment_file_size) override;
        53  void OnKeyFrame(uint64_t timestamp,
        54  uint64_t start_byte_offset,
        55  uint64_t size);
        56  void OnCueEvent(uint64_t timestamp, const std::string& cue_data) override;
        58 
        63  // TODO(rkuroiwa): Move this to muxer_listener_internal and rename
        64  // muxer_listener_internal to muxer_listener_util.
        65  static bool WriteMediaInfoToFile(const MediaInfo& media_info,
        66  const std::string& output_file_path);
        67 
        68  private:
        69  std::string output_file_name_;
        70  std::unique_ptr<MediaInfo> media_info_;
        71  uint64_t max_bitrate_ = 0;
        72 
        73  bool is_encrypted_ = false;
        74  // Storage for values passed to OnEncryptionInfoReady().
        75  FourCC protection_scheme_;
        76  std::vector<uint8_t> default_key_id_;
        77  std::vector<ProtectionSystemSpecificInfo> key_system_info_;
        78 
        79  DISALLOW_COPY_AND_ASSIGN(VodMediaInfoDumpMuxerListener);
        80 };
        81 
        82 } // namespace media
        83 } // namespace shaka
        84 
        85 #endif // PACKAGER_MEDIA_EVENT_VOD_MEDIA_INFO_DUMP_MUXER_LISTENER_H_
        Abstract class holds stream information.
        Definition: stream_info.h:61
        void OnSampleDurationReady(uint32_t sample_duration) override
        void OnNewSegment(const std::string &file_name, uint64_t start_time, uint64_t duration, uint64_t segment_file_size) override
        @@ -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 c7a04aa0f7..8870394e05 100644 --- a/docs/dd/dab/webm__muxer_8h_source.html +++ b/docs/dd/dab/webm__muxer_8h_source.html @@ -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 b14f980099..242fb06175 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 2755a12b95..f0180d3c2b 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 a2ea715f84..64a36acb85 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 5181c002e9..7c42ef8576 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 23f5d781d2..7de962c365 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 5600e12791..0b82573daf 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 382d0c2be1..7deeb0e9c8 100644 --- a/docs/dd/dbc/encryption__handler_8h_source.html +++ b/docs/dd/dbc/encryption__handler_8h_source.html @@ -66,10 +66,10 @@ $(function() {
        encryption_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_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
        +
        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:61
        - +
        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 db96cb8d33..c9949f33bd 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 f981a2e41a..1794e30340 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 64ba9dcf27..7cef772da5 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 817852e653..de86e57d56 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 @@ -225,7 +225,7 @@ Protected Member Functions 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 9ead34d087..6802dd4143 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() { 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 4a17d64b4a..182ab32046 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 6de47ff8a0..f8c2089e26 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 8be456ac4c..447238637a 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 a456f8a46f..140b10ed00 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 f8c19b7fdf..ca34cb797a 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 ff8341b67a..76adfa5c46 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 703dabb43b..fdd634884b 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 c56b9b9501..02a597a315 100644 --- a/docs/dd/ddc/trick__play__handler_8h_source.html +++ b/docs/dd/ddc/trick__play__handler_8h_source.html @@ -67,15 +67,15 @@ $(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
        - +
        Abstract class holds stream information.
        Definition: stream_info.h:61
        +
        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 e9694f32ac..870ca89d71 100644 --- a/docs/dd/de1/period_8cc_source.html +++ b/docs/dd/de1/period_8cc_source.html @@ -76,7 +76,7 @@ $(function() {
        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:99
        -
        void AddContentProtectionElements(const MediaInfo &media_info, Representation *parent)
        Definition: mpd_utils.cc:369
        +
        void AddContentProtectionElements(const MediaInfo &media_info, Representation *parent)
        Definition: mpd_utils.cc:380
        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:131
        @@ -86,7 +86,7 @@ $(function() { diff --git a/docs/dd/de4/classshaka_1_1media_1_1VideoSliceHeaderParser.html b/docs/dd/de4/classshaka_1_1media_1_1VideoSliceHeaderParser.html index 3888ae2525..ad1dfcbf9f 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 3567afbb09..57a0dbf427 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 f03a83777a..47dc6a0f22 100644 --- a/docs/dd/de7/xml__node_8h_source.html +++ b/docs/dd/de7/xml__node_8h_source.html @@ -78,7 +78,7 @@ $(function() {
        bool AddChild(scoped_xml_ptr< xmlNode > child)
        Definition: xml_node.cc:95
        xmlNodePtr Release()
        Definition: xml_node.cc:175
        -
        void AddContentProtectionElements(const MediaInfo &media_info, Representation *parent)
        Definition: mpd_utils.cc:369
        +
        void AddContentProtectionElements(const MediaInfo &media_info, Representation *parent)
        Definition: mpd_utils.cc:380
        void SetId(uint32_t id)
        Definition: xml_node.cc:160
        bool AddElements(const std::vector< Element > &elements)
        Adds Elements to this node using the Element struct.
        Definition: xml_node.cc:107
        void SetIntegerAttribute(const char *attribute_name, uint64_t number)
        Definition: xml_node.cc:144
        @@ -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 996eb24e4f..cdf43b067e 100644 --- a/docs/dd/de9/classshaka_1_1media_1_1MediaHandler-members.html +++ b/docs/dd/de9/classshaka_1_1media_1_1MediaHandler-members.html @@ -70,32 +70,33 @@ $(function() {

        This is the complete list of members for shaka::media::MediaHandler, 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
        InitializeInternal()=0shaka::media::MediaHandlerprotectedpure virtual
        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
        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)=0shaka::media::MediaHandlerprotectedpure virtual
        SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
        ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
        ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
        Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
        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
        InitializeInternal()=0shaka::media::MediaHandlerprotectedpure virtual
        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
        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)=0shaka::media::MediaHandlerprotectedpure virtual
        SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
        ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
        ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
        diff --git a/docs/dd/de9/structshaka_1_1ChunkingParams-members.html b/docs/dd/de9/structshaka_1_1ChunkingParams-members.html index b83d7aad02..a14939777d 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 54506abfc3..aa8c32d1b2 100644 --- a/docs/dd/dee/box__definitions_8cc_source.html +++ b/docs/dd/dee/box__definitions_8cc_source.html @@ -180,7 +180,7 @@ $(function() { 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 23beea8ab8..1651eac5ab 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 e6fc36368e..1425084d8b 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 4ae902d70c..87c6ae9ec2 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 @@ -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 63dc6368f3..b7c71b0529 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 @@ -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 668e441610..8399495a3a 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() { diff --git a/docs/dd/dfd/structshaka_1_1AdCueGeneratorParams.html b/docs/dd/dfd/structshaka_1_1AdCueGeneratorParams.html index 385e074e8d..fdd7fc30a0 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 3c55a9bd70..99bf8d3218 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 0ec0812a3f..2856b24075 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 d5b6468f0d..a7baa3cb2c 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 4fffa44528..523d6d6f91 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 b3fe603c10..580bbe4e30 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 3c7077a6c3..64b2e496aa 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 5059ae252f..dccd578cbd 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 e5932a25af..17c06e9f14 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 fbffe38a99..a86a885fcc 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 a53d9890a5..500263536b 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 b2f7cfc42f..dbe3a9a218 100644 --- a/docs/de/d1e/mp4_2single__segment__segmenter_8cc_source.html +++ b/docs/de/d1e/mp4_2single__segment__segmenter_8cc_source.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/de/d22/aes__pattern__cryptor_8cc_source.html b/docs/de/d22/aes__pattern__cryptor_8cc_source.html index 305c91497e..b34350312c 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 e4b903f5fe..2f1ca0df29 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 0060e327e0..485636ae25 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 59dd8a046d..3e15342e31 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 @@ -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 cb809d9c9e..654aefe37e 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 d62a41916a..dbd52b7c6f 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 29bebebdfa..ac9e2058a3 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 40e8b30b71..839aaf83a1 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 640c272fc8..c7b11e1e1a 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 6d2f1962e0..013fb1824e 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 80eaa5c263..50d4df3468 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 a17013ef1b..f590ee9e01 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 1de7d9b6cf..121532005d 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 93377bec4e..e6060e9dd9 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 593b8d1b3a..a7311ff683 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 bc0c0e9b87..2c14a41ebf 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/d53/classshaka_1_1media_1_1FakeInputMediaHandler-members.html b/docs/de/d53/classshaka_1_1media_1_1FakeInputMediaHandler-members.html index 6859d1ab86..3056b1b4e8 100644 --- a/docs/de/d53/classshaka_1_1media_1_1FakeInputMediaHandler-members.html +++ b/docs/de/d53/classshaka_1_1media_1_1FakeInputMediaHandler-members.html @@ -70,29 +70,30 @@ $(function() {

        This is the complete list of members for shaka::media::FakeInputMediaHandler, 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
        OnFlushRequest(size_t input_stream_index)shaka::media::MediaHandlerprotectedvirtual
        output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
        SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
        ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
        Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
        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
        OnFlushRequest(size_t input_stream_index)shaka::media::MediaHandlerprotectedvirtual
        output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
        SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
        ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
        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 f78f96c07e..9359b46b88 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 @@ -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 7b95b4e323..fc48e06fa0 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 e7da11bd6e..1ce7c291c9 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 4d22a8a978..2364e8685c 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 db60db42f0..4bccd63ba9 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 dd965c5375..19b19de1c8 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 18560fc0f5..3552f2f694 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)
        -
        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 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
        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 0671593da2..4348297fb0 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 5b20e83e9b..9c28aa4360 100644 --- a/docs/de/d6e/classshaka_1_1media_1_1MockOutputMediaHandler-members.html +++ b/docs/de/d6e/classshaka_1_1media_1_1MockOutputMediaHandler-members.html @@ -70,31 +70,32 @@ $(function() {

        This is the complete list of members for shaka::media::MockOutputMediaHandler, 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
        MOCK_METHOD1(OnProcess, void(const StreamData *)) (defined in shaka::media::MockOutputMediaHandler)shaka::media::MockOutputMediaHandler
        MOCK_METHOD1(OnFlush, void(size_t index)) (defined in shaka::media::MockOutputMediaHandler)shaka::media::MockOutputMediaHandler
        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
        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
        ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
        Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
        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
        MOCK_METHOD1(OnProcess, void(const StreamData *)) (defined in shaka::media::MockOutputMediaHandler)shaka::media::MockOutputMediaHandler
        MOCK_METHOD1(OnFlush, void(size_t index)) (defined in shaka::media::MockOutputMediaHandler)shaka::media::MockOutputMediaHandler
        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
        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
        ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
        diff --git a/docs/de/d6e/language__utils_8h_source.html b/docs/de/d6e/language__utils_8h_source.html index 0b0a088871..7e2637be56 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 2e1bf5e33d..6ad36747be 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 5379b53241..4f42b9f0ae 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 7576141063..95a2fa5a3a 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 7cda2fb74e..87b52a8b18 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 045bc0c434..df0793a7c9 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 f779b1706b..661c51bdd5 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 f2702b2003..3d96f73758 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 17aae4fc1f..06ad214b80 100644 --- a/docs/de/d85/classshaka_1_1media_1_1OriginHandler.html +++ b/docs/de/d85/classshaka_1_1media_1_1OriginHandler.html @@ -107,6 +107,10 @@ bool 

        Additional Inherited Members

        +- Static Public Member Functions inherited from shaka::media::MediaHandler + +static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list) +  - Protected Member Functions inherited from shaka::media::MediaHandler virtual Status InitializeInternal ()=0   @@ -175,7 +179,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 6904bf81fd..d60650b982 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 651bf20c7b..6015e2c879 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 92cb6c0485..bbeeed5695 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 d6c40ed855..ab770a4ff8 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/de/da9/classshaka_1_1media_1_1WebVttTextOutputHandler-members.html b/docs/de/da9/classshaka_1_1media_1_1WebVttTextOutputHandler-members.html index 6bb5090cd5..9c7a093241 100644 --- a/docs/de/da9/classshaka_1_1media_1_1WebVttTextOutputHandler-members.html +++ b/docs/de/da9/classshaka_1_1media_1_1WebVttTextOutputHandler-members.html @@ -70,31 +70,32 @@ $(function() {

        This is the complete list of members for shaka::media::WebVttTextOutputHandler, 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
        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
        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
        Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
        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
        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
        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 cb4c0161ea..197985be44 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 baeb35621b..fdb9d56c6c 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 84e8f6482b..fc960e7ebc 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 b8278abf26..788e563abd 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 aa90626ee6..3e481fd554 100644 --- a/docs/de/db2/classshaka_1_1media_1_1MockOutputMediaHandler.html +++ b/docs/de/db2/classshaka_1_1media_1_1MockOutputMediaHandler.html @@ -105,6 +105,10 @@ bool 

        Additional Inherited Members

        +- Static Public Member Functions inherited from shaka::media::MediaHandler + +static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list) +  - Protected Member Functions inherited from shaka::media::MediaHandler virtual bool ValidateOutputStreamIndex (size_t stream_index) const @@ -159,7 +163,7 @@ const std::map< size_t, std::pair< std::shared_ptr<

        Detailed Description

        -

        Definition at line 165 of file media_handler_test_base.h.

        +

        Definition at line 262 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 +171,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 aaf328ec97..2fe25bc8c8 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 93104f4779..e14f19dae8 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 c3ddbad2e8..52f869f3c5 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 795d8efcec..38ed8dd90a 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 54d98179e0..727b5b4f07 100644 --- a/docs/de/dbf/udp__options_8h_source.html +++ b/docs/de/dbf/udp__options_8h_source.html @@ -66,13 +66,13 @@ $(function() {
          udp_options.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 #include <memory>
          8 #include <string>
          9 
          10 #include "packager/base/strings/string_piece.h"
          11 
          12 namespace shaka {
          13 
          15 class UdpOptions {
          16  public:
          17  ~UdpOptions() = default;
          18 
          22  static std::unique_ptr<UdpOptions> ParseFromString(base::StringPiece udp_url);
          23 
          24  const std::string& address() const { return address_; }
          25  uint16_t port() const { return port_; }
          26  bool reuse() const { return reuse_; }
          27  const std::string& interface_address() const { return interface_address_; }
          28  unsigned timeout_us() const { return timeout_us_; }
          29  const std::string& source_address() const { return source_address_; }
          30  bool is_source_specific_multicast() const {
          31  return is_source_specific_multicast_;
          32  }
          33 
          34  private:
          35  UdpOptions() = default;
          36 
          38  std::string address_ = "0.0.0.0";
          39  uint16_t port_ = 0;
          41  bool reuse_ = false;
          42  // Address of the interface over which to receive UDP multicast streams.
          43  std::string interface_address_ = "0.0.0.0";
          45  unsigned timeout_us_ = 0;
          46  // Source specific multicast source address
          47  std::string source_address_ = "0.0.0.0";
          48  bool is_source_specific_multicast_ = false;
          49 };
          50 
          51 } // namespace shaka
          static std::unique_ptr< UdpOptions > ParseFromString(base::StringPiece udp_url)
          Definition: udp_options.cc:73
          +
          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 <memory>
          8 #include <string>
          9 
          10 #include "packager/base/strings/string_piece.h"
          11 
          12 namespace shaka {
          13 
          15 class UdpOptions {
          16  public:
          17  ~UdpOptions() = default;
          18 
          22  static std::unique_ptr<UdpOptions> ParseFromString(base::StringPiece udp_url);
          23 
          24  const std::string& address() const { return address_; }
          25  uint16_t port() const { return port_; }
          26  bool reuse() const { return reuse_; }
          27  const std::string& interface_address() const { return interface_address_; }
          28  unsigned timeout_us() const { return timeout_us_; }
          29  const std::string& source_address() const { return source_address_; }
          30  bool is_source_specific_multicast() const {
          31  return is_source_specific_multicast_;
          32  }
          33  int buffer_size() const { return buffer_size_; }
          34 
          35  private:
          36  UdpOptions() = default;
          37 
          38  // IP Address.
          39  std::string address_ = "0.0.0.0";
          40  uint16_t port_ = 0;
          41  // Allow or disallow reusing UDP sockets.
          42  bool reuse_ = false;
          43  // Address of the interface over which to receive UDP multicast streams.
          44  std::string interface_address_ = "0.0.0.0";
          45  // Timeout in microseconds. 0 to indicate unlimited timeout.
          46  unsigned timeout_us_ = 0;
          47  // Source specific multicast source address
          48  std::string source_address_ = "0.0.0.0";
          49  bool is_source_specific_multicast_ = false;
          50  // Maximum receive buffer size in bytes.
          51  // Note that the actual buffer size is capped by the maximum buffer size set
          52  // by the underlying operating system ('sysctl net.core.rmem_max' on Linux
          53  // returns the maximum receive memory size).
          54  int buffer_size_ = 0;
          55 };
          56 
          57 } // namespace shaka
          static std::unique_ptr< UdpOptions > ParseFromString(base::StringPiece udp_url)
          Definition: udp_options.cc:75
          All the methods that are virtual are virtual for mocking.
          Options parsed from UDP url string of the form: udp://ip:port[?options].
          Definition: udp_options.h:15
          diff --git a/docs/de/dc1/demuxer_8h_source.html b/docs/de/dc1/demuxer_8h_source.html index a6704fd5bd..ca527478fd 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 cba4a9c392..f0cdf951d7 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 5ba2dfc13d..527df6ab3a 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 5b61585498..0c03cab152 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 71737b9dc1..e33623bf7b 100644 --- a/docs/de/dcb/ts__segmenter_8h_source.html +++ b/docs/de/dcb/ts__segmenter_8h_source.html @@ -66,7 +66,7 @@ $(function() {
          ts_segmenter.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_SEGMENTER_H_
          8 #define PACKAGER_MEDIA_FORMATS_MP2T_TS_SEGMENTER_H_
          9 
          10 #include <memory>
          11 #include "packager/file/file.h"
          12 #include "packager/media/base/muxer_options.h"
          13 #include "packager/media/formats/mp2t/pes_packet_generator.h"
          14 #include "packager/media/formats/mp2t/ts_writer.h"
          15 #include "packager/status.h"
          16 
          17 namespace shaka {
          18 namespace media {
          19 
          20 class KeySource;
          21 class MuxerListener;
          22 
          23 namespace mp2t {
          24 
          25 // TODO(rkuroiwa): For now, this implements multifile segmenter. Like other
          26 // make this an abstract super class and implement multifile and single file
          27 // segmenters.
          28 class TsSegmenter {
          29  public:
          30  // TODO(rkuroiwa): Add progress listener?
          35  TsSegmenter(const MuxerOptions& options, MuxerListener* listener);
          36  ~TsSegmenter();
          37 
          41  Status Initialize(const StreamInfo& stream_info);
          42 
          45  Status Finalize();
          46 
          49  Status AddSample(const MediaSample& sample);
          50 
          58  // TODO(kqyang): Remove the usage of segment start timestamp and duration in
          59  // xx_segmenter, which could cause confusions on which is the source of truth
          60  // as the segment start timestamp and duration could be tracked locally.
          61  Status FinalizeSegment(uint64_t start_timestamp, uint64_t duration);
          62 
          64  void InjectTsWriterForTesting(std::unique_ptr<TsWriter> writer);
          65 
          68  std::unique_ptr<PesPacketGenerator> generator);
          69 
          71  void SetTsWriterFileOpenedForTesting(bool value);
          72 
          73  private:
          74  Status OpenNewSegmentIfClosed(uint32_t next_pts);
          75 
          76  // Writes PES packets (carried in TsPackets) to a file. If a file is not open,
          77  // it will open one. This will not close the file.
          78  Status WritePesPacketsToFile();
          79 
          80  const MuxerOptions& muxer_options_;
          81  MuxerListener* const listener_;
          82 
          83  // Codec for the stream.
          84  Codec codec_ = kUnknownCodec;
          85  std::vector<uint8_t> audio_codec_config_;
          86 
          87  // Scale used to scale the input stream to TS's timesccale (which is 90000).
          88  // Used for calculating the duration in seconds fo the current segment.
          89  double timescale_scale_ = 1.0;
          90 
          91  // Used for segment template.
          92  uint64_t segment_number_ = 0;
          93 
          94  std::unique_ptr<TsWriter> ts_writer_;
          95  // Set to true if TsWriter::NewFile() succeeds, set to false after
          96  // TsWriter::FinalizeFile() succeeds.
          97  bool ts_writer_file_opened_ = false;
          98  std::unique_ptr<PesPacketGenerator> pes_packet_generator_;
          99 
          100  // For OnNewSegment().
          101  // Path of the current segment so that File::GetFileSize() can be used after
          102  // the segment has been finalized.
          103  std::string current_segment_path_;
          104 
          105  DISALLOW_COPY_AND_ASSIGN(TsSegmenter);
          106 };
          107 
          108 } // namespace mp2t
          109 } // namespace media
          110 } // namespace shaka
          111 #endif // PACKAGER_MEDIA_FORMATS_MP2T_TS_SEGMENTER_H_
          Abstract class holds stream information.
          Definition: stream_info.h:59
          +
          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_SEGMENTER_H_
          8 #define PACKAGER_MEDIA_FORMATS_MP2T_TS_SEGMENTER_H_
          9 
          10 #include <memory>
          11 #include "packager/file/file.h"
          12 #include "packager/media/base/muxer_options.h"
          13 #include "packager/media/formats/mp2t/pes_packet_generator.h"
          14 #include "packager/media/formats/mp2t/ts_writer.h"
          15 #include "packager/status.h"
          16 
          17 namespace shaka {
          18 namespace media {
          19 
          20 class KeySource;
          21 class MuxerListener;
          22 
          23 namespace mp2t {
          24 
          25 // TODO(rkuroiwa): For now, this implements multifile segmenter. Like other
          26 // make this an abstract super class and implement multifile and single file
          27 // segmenters.
          28 class TsSegmenter {
          29  public:
          30  // TODO(rkuroiwa): Add progress listener?
          35  TsSegmenter(const MuxerOptions& options, MuxerListener* listener);
          36  ~TsSegmenter();
          37 
          41  Status Initialize(const StreamInfo& stream_info);
          42 
          45  Status Finalize();
          46 
          49  Status AddSample(const MediaSample& sample);
          50 
          58  // TODO(kqyang): Remove the usage of segment start timestamp and duration in
          59  // xx_segmenter, which could cause confusions on which is the source of truth
          60  // as the segment start timestamp and duration could be tracked locally.
          61  Status FinalizeSegment(uint64_t start_timestamp, uint64_t duration);
          62 
          64  void InjectTsWriterForTesting(std::unique_ptr<TsWriter> writer);
          65 
          68  std::unique_ptr<PesPacketGenerator> generator);
          69 
          71  void SetTsWriterFileOpenedForTesting(bool value);
          72 
          73  private:
          74  Status OpenNewSegmentIfClosed(uint32_t next_pts);
          75 
          76  // Writes PES packets (carried in TsPackets) to a file. If a file is not open,
          77  // it will open one. This will not close the file.
          78  Status WritePesPacketsToFile();
          79 
          80  const MuxerOptions& muxer_options_;
          81  MuxerListener* const listener_;
          82 
          83  // Codec for the stream.
          84  Codec codec_ = kUnknownCodec;
          85  std::vector<uint8_t> audio_codec_config_;
          86 
          87  // Scale used to scale the input stream to TS's timesccale (which is 90000).
          88  // Used for calculating the duration in seconds fo the current segment.
          89  double timescale_scale_ = 1.0;
          90 
          91  // Used for segment template.
          92  uint64_t segment_number_ = 0;
          93 
          94  std::unique_ptr<TsWriter> ts_writer_;
          95  // Set to true if TsWriter::NewFile() succeeds, set to false after
          96  // TsWriter::FinalizeFile() succeeds.
          97  bool ts_writer_file_opened_ = false;
          98  std::unique_ptr<PesPacketGenerator> pes_packet_generator_;
          99 
          100  // For OnNewSegment().
          101  // Path of the current segment so that File::GetFileSize() can be used after
          102  // the segment has been finalized.
          103  std::string current_segment_path_;
          104 
          105  DISALLOW_COPY_AND_ASSIGN(TsSegmenter);
          106 };
          107 
          108 } // namespace mp2t
          109 } // namespace media
          110 } // namespace shaka
          111 #endif // PACKAGER_MEDIA_FORMATS_MP2T_TS_SEGMENTER_H_
          Abstract class holds stream information.
          Definition: stream_info.h:61
          Status Initialize(const StreamInfo &stream_info)
          Definition: ts_segmenter.cc:42
          All the methods that are virtual are virtual for mocking.
          @@ -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 899da36a8a..e053e08826 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 c37d0bd960..3fea24cc46 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 72a352ab39..02859ac394 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 9a3e54ff94..c136cf7bd8 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 4751a40f2e..898a32e3f7 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 2335ce94ce..977c585a97 100644 --- a/docs/de/ddd/classshaka_1_1media_1_1Muxer-members.html +++ b/docs/de/ddd/classshaka_1_1media_1_1Muxer-members.html @@ -71,42 +71,43 @@ $(function() { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
          AddHandler(std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandlerinline
          Cancel()shaka::media::Muxer
          clock() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected
          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
          InitializeInternal() overrideshaka::media::Muxerinlineprotectedvirtual
          IsConnected()shaka::media::MediaHandlerinline
          MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandler
          Muxer(const MuxerOptions &options) (defined in shaka::media::Muxer)shaka::media::Muxerexplicit
          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::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
          progress_listener() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected
          set_clock(base::Clock *clock)shaka::media::Muxerinline
          SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
          SetMuxerListener(std::unique_ptr< MuxerListener > muxer_listener)shaka::media::Muxer
          SetProgressListener(std::unique_ptr< ProgressListener > progress_listener)shaka::media::Muxer
          streams() const (defined in shaka::media::Muxer)shaka::media::Muxerinline
          ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
          ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
          ~Muxer() (defined in shaka::media::Muxer)shaka::media::Muxervirtual
          Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
          clock() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected
          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
          InitializeInternal() overrideshaka::media::Muxerinlineprotectedvirtual
          IsConnected()shaka::media::MediaHandlerinline
          MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandler
          Muxer(const MuxerOptions &options) (defined in shaka::media::Muxer)shaka::media::Muxerexplicit
          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::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
          progress_listener() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected
          set_clock(base::Clock *clock)shaka::media::Muxerinline
          SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
          SetMuxerListener(std::unique_ptr< MuxerListener > muxer_listener)shaka::media::Muxer
          SetProgressListener(std::unique_ptr< ProgressListener > progress_listener)shaka::media::Muxer
          streams() const (defined in shaka::media::Muxer)shaka::media::Muxerinline
          ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
          ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
          ~Muxer() (defined in shaka::media::Muxer)shaka::media::Muxervirtual
          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 60dad78a35..cbf2c7a7d4 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 9da5fba5c3..6baf02e564 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 9b35689e9e..9b69178f6d 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 2dfbb62da7..9bb56ca98a 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 @@ -71,44 +71,45 @@ $(function() { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
          AddHandler(std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandlerinline
          Cancel()shaka::media::Muxer
          clock() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected
          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
          InitializeInternal() overrideshaka::media::Muxerinlineprotectedvirtual
          IsConnected()shaka::media::MediaHandlerinline
          MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandler
          MP4Muxer(const MuxerOptions &options)shaka::media::mp4::MP4Muxerexplicit
          Muxer(const MuxerOptions &options) (defined in shaka::media::Muxer)shaka::media::Muxerexplicit
          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::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
          progress_listener() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected
          set_clock(base::Clock *clock)shaka::media::Muxerinline
          SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
          SetMuxerListener(std::unique_ptr< MuxerListener > muxer_listener)shaka::media::Muxer
          SetProgressListener(std::unique_ptr< ProgressListener > progress_listener)shaka::media::Muxer
          streams() const (defined in shaka::media::Muxer)shaka::media::Muxerinline
          ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
          ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
          ~MP4Muxer() override (defined in shaka::media::mp4::MP4Muxer)shaka::media::mp4::MP4Muxer
          ~Muxer() (defined in shaka::media::Muxer)shaka::media::Muxervirtual
          Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
          clock() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected
          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
          InitializeInternal() overrideshaka::media::Muxerinlineprotectedvirtual
          IsConnected()shaka::media::MediaHandlerinline
          MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandler
          MP4Muxer(const MuxerOptions &options)shaka::media::mp4::MP4Muxerexplicit
          Muxer(const MuxerOptions &options) (defined in shaka::media::Muxer)shaka::media::Muxerexplicit
          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::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
          progress_listener() (defined in shaka::media::Muxer)shaka::media::Muxerinlineprotected
          set_clock(base::Clock *clock)shaka::media::Muxerinline
          SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
          SetMuxerListener(std::unique_ptr< MuxerListener > muxer_listener)shaka::media::Muxer
          SetProgressListener(std::unique_ptr< ProgressListener > progress_listener)shaka::media::Muxer
          streams() const (defined in shaka::media::Muxer)shaka::media::Muxerinline
          ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
          ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
          ~MP4Muxer() override (defined in shaka::media::mp4::MP4Muxer)shaka::media::mp4::MP4Muxer
          ~Muxer() (defined in shaka::media::Muxer)shaka::media::Muxervirtual
          diff --git a/docs/de/de4/classshaka_1_1media_1_1AdCueGenerator.html b/docs/de/de4/classshaka_1_1media_1_1AdCueGenerator.html deleted file mode 100644 index a716df06f1..0000000000 --- a/docs/de/de4/classshaka_1_1media_1_1AdCueGenerator.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - -Shaka Packager SDK: shaka::media::AdCueGenerator Class Reference - - - - - - - - - -
          -
          - - - - - - -
          -
          Shaka Packager SDK -
          -
          -
          - - - - - - - - -
          -
          - - -
          - -
          - - -
          -
          - -
          -
          shaka::media::AdCueGenerator Class Reference
          -
          -
          - -

          AdCueGenerator converts out of band cuepoint markers into SCTE-35 events. - More...

          - -

          #include <ad_cue_generator.h>

          -
          -Inheritance diagram for shaka::media::AdCueGenerator:
          -
          -
          - - -shaka::media::MediaHandler - -
          - - - - - - - - - - - - - - - - -

          -Public Member Functions

          AdCueGenerator (const AdCueGeneratorParams &ad_cue_generator_params)
           
          - 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.
           
          - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

          -Additional Inherited Members

          - 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.
           
          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 ()
           
          -

          Detailed Description

          -

          AdCueGenerator converts out of band cuepoint markers into SCTE-35 events.

          - -

          Definition at line 17 of file ad_cue_generator.h.

          -

          The documentation for this class was generated from the following files: -
          - - - - diff --git a/docs/de/de4/classshaka_1_1media_1_1AdCueGenerator.png b/docs/de/de4/classshaka_1_1media_1_1AdCueGenerator.png deleted file mode 100644 index 45a6d787b6..0000000000 Binary files a/docs/de/de4/classshaka_1_1media_1_1AdCueGenerator.png and /dev/null differ diff --git a/docs/de/de4/structshaka_1_1media_1_1H264Pps.html b/docs/de/de4/structshaka_1_1media_1_1H264Pps.html index 88f0135b7a..eea699d13c 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 c4b4ac3174..e145995fe8 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 e2de0ade04..7ee291406f 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 d8b97dea23..88d57f8223 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 @@ -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 a9daf10a78..69b61655d4 100644 --- a/docs/de/df2/combined__muxer__listener_8h_source.html +++ b/docs/de/df2/combined__muxer__listener_8h_source.html @@ -66,7 +66,7 @@ $(function() {
          combined_muxer_listener.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_EVENT_COMBINED_MUXER_LISTENER_H_
          8 #define PACKAGER_MEDIA_EVENT_COMBINED_MUXER_LISTENER_H_
          9 
          10 #include <list>
          11 #include <memory>
          12 
          13 #include "packager/media/event/muxer_listener.h"
          14 
          15 namespace shaka {
          16 namespace media {
          17 
          19  public:
          20  CombinedMuxerListener() = default;
          21 
          22  void AddListener(std::unique_ptr<MuxerListener> listener);
          23 
          24  void OnEncryptionInfoReady(bool is_initial_encryption_info,
          25  FourCC protection_scheme,
          26  const std::vector<uint8_t>& key_id,
          27  const std::vector<uint8_t>& iv,
          28  const std::vector<ProtectionSystemSpecificInfo>&
          29  key_system_info) override;
          30  void OnEncryptionStart() override;
          31  void OnMediaStart(const MuxerOptions& muxer_options,
          32  const StreamInfo& stream_info,
          33  uint32_t time_scale,
          34  ContainerType container_type) override;
          35  void OnSampleDurationReady(uint32_t sample_duration) override;
          36  void OnMediaEnd(const MediaRanges& media_ranges,
          37  float duration_seconds) override;
          38  void OnNewSegment(const std::string& file_name,
          39  uint64_t start_time,
          40  uint64_t duration,
          41  uint64_t segment_file_size) override;
          42  void OnKeyFrame(uint64_t timestamp,
          43  uint64_t start_byte_offset,
          44  uint64_t size);
          45  void OnCueEvent(uint64_t timestamp, const std::string& cue_data) override;
          46 
          47  private:
          48  std::list<std::unique_ptr<MuxerListener>> muxer_listeners_;
          49 
          50  DISALLOW_COPY_AND_ASSIGN(CombinedMuxerListener);
          51 };
          52 
          53 } // namespace media
          54 } // namespace shaka
          55 
          56 #endif // PACKAGER_MEDIA_EVENT_COMBINED_MUXER_LISTENER_H_
          Abstract class holds stream information.
          Definition: stream_info.h:59
          +
          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_EVENT_COMBINED_MUXER_LISTENER_H_
          8 #define PACKAGER_MEDIA_EVENT_COMBINED_MUXER_LISTENER_H_
          9 
          10 #include <list>
          11 #include <memory>
          12 
          13 #include "packager/media/event/muxer_listener.h"
          14 
          15 namespace shaka {
          16 namespace media {
          17 
          19  public:
          20  CombinedMuxerListener() = default;
          21 
          22  void AddListener(std::unique_ptr<MuxerListener> listener);
          23 
          24  void OnEncryptionInfoReady(bool is_initial_encryption_info,
          25  FourCC protection_scheme,
          26  const std::vector<uint8_t>& key_id,
          27  const std::vector<uint8_t>& iv,
          28  const std::vector<ProtectionSystemSpecificInfo>&
          29  key_system_info) override;
          30  void OnEncryptionStart() override;
          31  void OnMediaStart(const MuxerOptions& muxer_options,
          32  const StreamInfo& stream_info,
          33  uint32_t time_scale,
          34  ContainerType container_type) override;
          35  void OnSampleDurationReady(uint32_t sample_duration) override;
          36  void OnMediaEnd(const MediaRanges& media_ranges,
          37  float duration_seconds) override;
          38  void OnNewSegment(const std::string& file_name,
          39  uint64_t start_time,
          40  uint64_t duration,
          41  uint64_t segment_file_size) override;
          42  void OnKeyFrame(uint64_t timestamp,
          43  uint64_t start_byte_offset,
          44  uint64_t size);
          45  void OnCueEvent(uint64_t timestamp, const std::string& cue_data) override;
          46 
          47  private:
          48  std::list<std::unique_ptr<MuxerListener>> muxer_listeners_;
          49 
          50  DISALLOW_COPY_AND_ASSIGN(CombinedMuxerListener);
          51 };
          52 
          53 } // namespace media
          54 } // namespace shaka
          55 
          56 #endif // PACKAGER_MEDIA_EVENT_COMBINED_MUXER_LISTENER_H_
          Abstract class holds stream information.
          Definition: stream_info.h:61
          void OnEncryptionInfoReady(bool is_initial_encryption_info, FourCC protection_scheme, const std::vector< uint8_t > &key_id, const std::vector< uint8_t > &iv, const std::vector< ProtectionSystemSpecificInfo > &key_system_info) override
          All the methods that are virtual are virtual for mocking.
          @@ -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 a2b2612634..81a42fa3e6 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 f020e4635f..7173b1da50 100644 --- a/docs/de/dfa/muxer__listener_8h_source.html +++ b/docs/de/dfa/muxer__listener_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 // Event handler for events fired by Muxer.
          8 
          9 #ifndef PACKAGER_MEDIA_EVENT_MUXER_LISTENER_H_
          10 #define PACKAGER_MEDIA_EVENT_MUXER_LISTENER_H_
          11 
          12 #include <stdint.h>
          13 
          14 #include <string>
          15 #include <vector>
          16 
          17 #include "packager/base/optional.h"
          18 #include "packager/media/base/fourccs.h"
          19 #include "packager/media/base/range.h"
          20 
          21 namespace shaka {
          22 namespace media {
          23 
          24 struct MuxerOptions;
          25 struct ProtectionSystemSpecificInfo;
          26 class StreamInfo;
          27 
          33  public:
          34  enum ContainerType {
          35  kContainerUnknown = 0,
          36  kContainerMp4,
          37  kContainerMpeg2ts,
          38  kContainerWebM,
          39  kContainerText,
          40  kContainerPackedAudio,
          41  };
          42 
          46  struct MediaRanges {
          48  base::Optional<Range> init_range;
          50  base::Optional<Range> index_range;
          54  std::vector<Range> subsegment_ranges;
          55  };
          56 
          57  virtual ~MuxerListener() = default;
          58 
          77  virtual void OnEncryptionInfoReady(
          78  bool is_initial_encryption_info,
          79  FourCC protection_scheme,
          80  const std::vector<uint8_t>& key_id,
          81  const std::vector<uint8_t>& iv,
          82  const std::vector<ProtectionSystemSpecificInfo>& key_system_info) = 0;
          83 
          88  virtual void OnEncryptionStart() = 0;
          89 
          98  virtual void OnMediaStart(const MuxerOptions& muxer_options,
          99  const StreamInfo& stream_info,
          100  uint32_t time_scale,
          101  ContainerType container_type) = 0;
          102 
          105  virtual void OnSampleDurationReady(uint32_t sample_duration) = 0;
          106 
          113  virtual void OnMediaEnd(const MediaRanges& media_ranges,
          114  float duration_seconds) = 0;
          115 
          127  virtual void OnNewSegment(const std::string& segment_name,
          128  uint64_t start_time,
          129  uint64_t duration,
          130  uint64_t segment_file_size) = 0;
          131 
          137  virtual void OnKeyFrame(uint64_t timestamp,
          138  uint64_t start_byte_offset,
          139  uint64_t size) = 0;
          140 
          144  virtual void OnCueEvent(uint64_t timestamp, const std::string& cue_data) = 0;
          145 
          146  protected:
          147  MuxerListener() = default;
          148 };
          149 
          150 } // namespace media
          151 } // namespace shaka
          152 
          153 #endif // PACKAGER_MEDIA_EVENT_MUXER_LISTENER_H_
          virtual void OnNewSegment(const std::string &segment_name, uint64_t start_time, uint64_t duration, uint64_t segment_file_size)=0
          virtual void OnEncryptionInfoReady(bool is_initial_encryption_info, FourCC protection_scheme, const std::vector< uint8_t > &key_id, const std::vector< uint8_t > &iv, const std::vector< ProtectionSystemSpecificInfo > &key_system_info)=0
          base::Optional< Range > init_range
          Range of the initialization section of a segment.
          -
          Abstract class holds stream information.
          Definition: stream_info.h:59
          +
          Abstract class holds stream information.
          Definition: stream_info.h:61
          virtual void OnSampleDurationReady(uint32_t sample_duration)=0
          virtual void OnKeyFrame(uint64_t timestamp, uint64_t start_byte_offset, uint64_t size)=0
          base::Optional< Range > index_range
          Range of the index section of a segment.
          @@ -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 3d755e6e9e..d62e4a1cbf 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 @@ -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 a479412568..85b7c1b566 100644 --- a/docs/de/dfd/stream__info_8cc_source.html +++ b/docs/de/dfd/stream__info_8cc_source.html @@ -66,12 +66,12 @@ $(function() {
          stream_info.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/stream_info.h"
          8 
          9 #include <inttypes.h>
          10 
          11 #include "packager/base/logging.h"
          12 #include "packager/base/strings/stringprintf.h"
          13 
          14 namespace shaka {
          15 namespace media {
          16 
          17 StreamInfo::StreamInfo(StreamType stream_type, int track_id,
          18  uint32_t time_scale, uint64_t duration, Codec codec,
          19  const std::string& codec_string,
          20  const uint8_t* codec_config, size_t codec_config_size,
          21  const std::string& language, bool is_encrypted)
          22  : stream_type_(stream_type),
          23  track_id_(track_id),
          24  time_scale_(time_scale),
          25  duration_(duration),
          26  codec_(codec),
          27  codec_string_(codec_string),
          28  language_(language),
          29  is_encrypted_(is_encrypted) {
          30  if (codec_config_size > 0) {
          31  codec_config_.assign(codec_config, codec_config + codec_config_size);
          32  }
          33 }
          34 
          35 StreamInfo::~StreamInfo() {}
          36 
          37 std::string StreamInfo::ToString() const {
          38  return base::StringPrintf(
          39  "type: %s\n codec_string: %s\n time_scale: %d\n duration: "
          40  "%" PRIu64 " (%.1f seconds)\n is_encrypted: %s\n",
          41  (stream_type_ == kStreamAudio ? "Audio" : "Video"),
          42  codec_string_.c_str(),
          43  time_scale_, duration_,
          44  static_cast<double>(duration_) / time_scale_,
          45  is_encrypted_ ? "true" : "false");
          46 }
          47 
          48 } // namespace media
          49 } // namespace shaka
          virtual std::string ToString() const
          Definition: stream_info.cc:37
          +
          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/stream_info.h"
          8 
          9 #include <inttypes.h>
          10 
          11 #include "packager/base/logging.h"
          12 #include "packager/base/strings/stringprintf.h"
          13 
          14 namespace shaka {
          15 namespace media {
          16 
          17 std::string StreamTypeToString(StreamType type) {
          18  switch (type) {
          19  case kStreamUnknown:
          20  return "Unknown";
          21  case kStreamVideo:
          22  return "Video";
          23  case kStreamAudio:
          24  return "Audio";
          25  case kStreamText:
          26  return "Text";
          27  }
          28 
          29  NOTREACHED() << "Unhandled StreamType with value " << static_cast<int>(type);
          30  return "";
          31 }
          32 
          33 StreamInfo::StreamInfo(StreamType stream_type,
          34  int track_id,
          35  uint32_t time_scale,
          36  uint64_t duration,
          37  Codec codec,
          38  const std::string& codec_string,
          39  const uint8_t* codec_config,
          40  size_t codec_config_size,
          41  const std::string& language,
          42  bool is_encrypted)
          43  : stream_type_(stream_type),
          44  track_id_(track_id),
          45  time_scale_(time_scale),
          46  duration_(duration),
          47  codec_(codec),
          48  codec_string_(codec_string),
          49  language_(language),
          50  is_encrypted_(is_encrypted) {
          51  if (codec_config_size > 0) {
          52  codec_config_.assign(codec_config, codec_config + codec_config_size);
          53  }
          54 }
          55 
          56 StreamInfo::~StreamInfo() {}
          57 
          58 std::string StreamInfo::ToString() const {
          59  return base::StringPrintf(
          60  "type: %s\n codec_string: %s\n time_scale: %d\n duration: "
          61  "%" PRIu64 " (%.1f seconds)\n is_encrypted: %s\n",
          62  (stream_type_ == kStreamAudio ? "Audio" : "Video"), codec_string_.c_str(),
          63  time_scale_, duration_, static_cast<double>(duration_) / time_scale_,
          64  is_encrypted_ ? "true" : "false");
          65 }
          66 
          67 } // namespace media
          68 } // namespace shaka
          virtual std::string ToString() const
          Definition: stream_info.cc:58
          All the methods that are virtual are virtual for mocking.
          diff --git a/docs/df/d00/playready__key__source_8h_source.html b/docs/df/d00/playready__key__source_8h_source.html index 0ad1d373c2..a64ccfd2d3 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 2aa8da93b9..4bed115336 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 5dfc92f2a9..25127d019c 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 8137f34df6..c8b8c88ce7 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 7d875554cb..c31ed092d5 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 40e6498d82..142cc7c8f1 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 9a5046a64c..d56c7b7b76 100644 --- a/docs/df/d1c/composition__offset__iterator_8h_source.html +++ b/docs/df/d1c/composition__offset__iterator_8h_source.html @@ -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 3169ae7f01..a6d74fc3c5 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 7c4a1ce13c..5437055b9a 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 6002008810..10dd4f25ed 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 f06b81b6e6..4660c6b051 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 10ab7242c6..bf9a455317 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 5954140343..8fc41a0d18 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 5bd03f5268..242d177bd0 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 f51a34a2a4..bed345f539 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 ad91f7581f..1ceb996153 100644 --- a/docs/df/d32/audio__stream__info_8h_source.html +++ b/docs/df/d32/audio__stream__info_8h_source.html @@ -66,7 +66,7 @@ $(function() {
          audio_stream_info.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_AUDIO_STREAM_INFO_H_
          8 #define PACKAGER_MEDIA_BASE_AUDIO_STREAM_INFO_H_
          9 
          10 #include <vector>
          11 
          12 #include "packager/media/base/stream_info.h"
          13 
          14 namespace shaka {
          15 namespace media {
          16 
          18 class AudioStreamInfo : public StreamInfo {
          19  public:
          21  AudioStreamInfo(int track_id, uint32_t time_scale, uint64_t duration,
          22  Codec codec, const std::string& codec_string,
          23  const uint8_t* codec_config, size_t codec_config_size,
          24  uint8_t sample_bits, uint8_t num_channels,
          25  uint32_t sampling_frequency, uint64_t seek_preroll_ns,
          26  uint64_t codec_delay_ns, uint32_t max_bitrate,
          27  uint32_t avg_bitrate, const std::string& language,
          28  bool is_encrypted);
          29 
          30  ~AudioStreamInfo() override;
          31 
          34  bool IsValidConfig() const override;
          35  std::string ToString() const override;
          36  std::unique_ptr<StreamInfo> Clone() const override;
          38 
          39  uint8_t sample_bits() const { return sample_bits_; }
          40  uint8_t sample_bytes() const { return sample_bits_ / 8; }
          41  uint8_t num_channels() const { return num_channels_; }
          42  uint32_t sampling_frequency() const { return sampling_frequency_; }
          43  uint32_t bytes_per_frame() const {
          44  return static_cast<uint32_t>(num_channels_) * sample_bits_ / 8;
          45  }
          46  uint64_t seek_preroll_ns() const { return seek_preroll_ns_; }
          47  uint64_t codec_delay_ns() const { return codec_delay_ns_; }
          48  uint32_t max_bitrate() const { return max_bitrate_; }
          49  uint32_t avg_bitrate() const { return avg_bitrate_; }
          50 
          51  void set_sampling_frequency(const uint32_t sampling_frequency) {
          52  sampling_frequency_ = sampling_frequency;
          53  }
          54 
          57  static std::string GetCodecString(Codec codec, uint8_t audio_object_type);
          58 
          59  private:
          60  uint8_t sample_bits_;
          61  uint8_t num_channels_;
          62  uint32_t sampling_frequency_;
          63  uint64_t seek_preroll_ns_;
          64  uint64_t codec_delay_ns_;
          65  uint32_t max_bitrate_;
          66  uint32_t avg_bitrate_;
          67 
          68  // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
          69  // generated copy constructor and assignment operator. Since the extra data is
          70  // typically small, the performance impact is minimal.
          71 };
          72 
          73 } // namespace media
          74 } // namespace shaka
          75 
          76 #endif // PACKAGER_MEDIA_BASE_AUDIO_STREAM_INFO_H_
          Abstract class holds stream information.
          Definition: stream_info.h:59
          +
          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_AUDIO_STREAM_INFO_H_
          8 #define PACKAGER_MEDIA_BASE_AUDIO_STREAM_INFO_H_
          9 
          10 #include <vector>
          11 
          12 #include "packager/media/base/stream_info.h"
          13 
          14 namespace shaka {
          15 namespace media {
          16 
          18 class AudioStreamInfo : public StreamInfo {
          19  public:
          21  AudioStreamInfo(int track_id, uint32_t time_scale, uint64_t duration,
          22  Codec codec, const std::string& codec_string,
          23  const uint8_t* codec_config, size_t codec_config_size,
          24  uint8_t sample_bits, uint8_t num_channels,
          25  uint32_t sampling_frequency, uint64_t seek_preroll_ns,
          26  uint64_t codec_delay_ns, uint32_t max_bitrate,
          27  uint32_t avg_bitrate, const std::string& language,
          28  bool is_encrypted);
          29 
          30  ~AudioStreamInfo() override;
          31 
          34  bool IsValidConfig() const override;
          35  std::string ToString() const override;
          36  std::unique_ptr<StreamInfo> Clone() const override;
          38 
          39  uint8_t sample_bits() const { return sample_bits_; }
          40  uint8_t sample_bytes() const { return sample_bits_ / 8; }
          41  uint8_t num_channels() const { return num_channels_; }
          42  uint32_t sampling_frequency() const { return sampling_frequency_; }
          43  uint32_t bytes_per_frame() const {
          44  return static_cast<uint32_t>(num_channels_) * sample_bits_ / 8;
          45  }
          46  uint64_t seek_preroll_ns() const { return seek_preroll_ns_; }
          47  uint64_t codec_delay_ns() const { return codec_delay_ns_; }
          48  uint32_t max_bitrate() const { return max_bitrate_; }
          49  uint32_t avg_bitrate() const { return avg_bitrate_; }
          50 
          51  void set_sampling_frequency(const uint32_t sampling_frequency) {
          52  sampling_frequency_ = sampling_frequency;
          53  }
          54 
          57  static std::string GetCodecString(Codec codec, uint8_t audio_object_type);
          58 
          59  private:
          60  uint8_t sample_bits_;
          61  uint8_t num_channels_;
          62  uint32_t sampling_frequency_;
          63  uint64_t seek_preroll_ns_;
          64  uint64_t codec_delay_ns_;
          65  uint32_t max_bitrate_;
          66  uint32_t avg_bitrate_;
          67 
          68  // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
          69  // generated copy constructor and assignment operator. Since the extra data is
          70  // typically small, the performance impact is minimal.
          71 };
          72 
          73 } // namespace media
          74 } // namespace shaka
          75 
          76 #endif // PACKAGER_MEDIA_BASE_AUDIO_STREAM_INFO_H_
          Abstract class holds stream information.
          Definition: stream_info.h:61
          std::string ToString() const override
          All the methods that are virtual are virtual for mocking.
          bool IsValidConfig() const override
          @@ -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 541fb3396b..2818634461 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 29cc9cfb94..deaf668a61 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 @@ -91,7 +91,7 @@ uint32_t sample_descriptio 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 09fdd5f09b..115de5483a 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 a39877434e..a2cb4d576e 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 5863fd5190..86acb98148 100644 --- a/docs/df/d46/classshaka_1_1media_1_1Muxer.html +++ b/docs/df/d46/classshaka_1_1media_1_1Muxer.html @@ -192,6 +192,13 @@ size_t next_output_stream_ const std::map< size_t, std::pair< std::shared_ptr< MediaHandler >, size_t > > & output_handlers ()   + + + + +

          +Additional Inherited Members

          - Static Public Member Functions inherited from shaka::media::MediaHandler
          +static Status Chain (std::initializer_list< std::shared_ptr< MediaHandler >> list)
           

          Detailed Description

          Muxer is responsible for taking elementary stream samples and producing media containers. An optional KeySource can be provided to Muxer to generate encrypted outputs.

          @@ -372,7 +379,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 8a3d55dbae..3a9adecf22 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 6cf5c72851..9ea210424d 100644 --- a/docs/df/d4e/classshaka_1_1IoCache.html +++ b/docs/df/d4e/classshaka_1_1IoCache.html @@ -126,7 +126,7 @@ void 

          Returns the number of bytes in the cache.

          Returns
          the number of bytes in the cache.
          -

          Definition at line 125 of file io_cache.cc.

          +

          Definition at line 128 of file io_cache.cc.

          @@ -146,7 +146,7 @@ void 

          Returns the number of free bytes in the cache.

          Returns
          the number of free bytes in the cache.
          -

          Definition at line 130 of file io_cache.cc.

          +

          Definition at line 133 of file io_cache.cc.

          @@ -166,7 +166,7 @@ void 

          Close the cache. This will call any blocking calls to unblock, and the cache won't be usable until Reopened.

          -

          Definition at line 109 of file io_cache.cc.

          +

          Definition at line 112 of file io_cache.cc.

          @@ -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 5034f482d3..03b6ec9d22 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 f95c85fdd1..65ab243717 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 3bc9807028..9b22c4936c 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 8f359ab954..f8ce43df8a 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 deleted file mode 100644 index 137e57018d..0000000000 --- a/docs/df/d62/ad__cue__generator_8cc_source.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - -Shaka Packager SDK: packager/media/ad_cue_generator/ad_cue_generator.cc Source File - - - - - - - - - -
          -
          - - - - - - -
          -
          Shaka Packager SDK -
          -
          -
          - - - - - - - - -
          -
          - - -
          - -
          - - -
          -
          -
          -
          ad_cue_generator.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/ad_cue_generator/ad_cue_generator.h"
          8 
          9 namespace shaka {
          10 namespace media {
          11 
          12 namespace {
          13 
          14 // The AdCuGenerator only supports single input and single output.
          15 const size_t kStreamIndex = 0;
          16 
          17 } // namespace
          18 
          19 AdCueGenerator::AdCueGenerator(
          20  const AdCueGeneratorParams& ad_cue_generator_params)
          21  : ad_cue_generator_params_(ad_cue_generator_params) {}
          22 
          23 AdCueGenerator::~AdCueGenerator() {}
          24 
          25 Status AdCueGenerator::InitializeInternal() {
          26  if (num_input_streams() != 1 || next_output_stream_index() != 1) {
          27  return Status(error::INVALID_ARGUMENT,
          28  "Expects exactly one input and one output.");
          29  }
          30  return Status::OK;
          31 }
          32 
          33 Status AdCueGenerator::Process(std::unique_ptr<StreamData> stream_data) {
          34  switch (stream_data->stream_data_type) {
          35  case StreamDataType::kStreamInfo: {
          36  const uint32_t time_scale = stream_data->stream_info->time_scale();
          37  Status status = Dispatch(std::move(stream_data));
          38  if (!status.ok()) {
          39  return status;
          40  }
          41  return DispatchScte35Events(kStreamIndex, time_scale);
          42  }
          43  default:
          44  return Dispatch(std::move(stream_data));
          45  }
          46 }
          47 
          48 Status AdCueGenerator::DispatchScte35Events(size_t stream_index,
          49  uint32_t time_scale) {
          50  Status status;
          51  for (const auto& cue_point : ad_cue_generator_params_.cue_points) {
          52  std::shared_ptr<Scte35Event> scte35_event = std::make_shared<Scte35Event>();
          53  scte35_event->start_time_in_seconds = cue_point.start_time_in_seconds;
          54  scte35_event->duration_in_seconds = cue_point.duration_in_seconds;
          55  status.Update(DispatchScte35Event(stream_index, std::move(scte35_event)));
          56  if (!status.ok()) {
          57  return status;
          58  }
          59  }
          60  return Status::OK;
          61 }
          62 
          63 } // namespace media
          64 } // namespace shaka
          All the methods that are virtual are virtual for mocking.
          -
          - - - - 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 c85d0cfddd..69f53c84ff 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 @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/df/d66/classshaka_1_1media_1_1KeyFetcher.html b/docs/df/d66/classshaka_1_1media_1_1KeyFetcher.html index a3fe3eaabb..fc62ac40dc 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 0629a2ca5b..551f7f7126 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 56d8aebdf3..2f9945f3ec 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 eede68886b..28fae5e757 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 7e10496818..893a0b61c8 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 @@ -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 4353a75c85..f55daeed5c 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 @@ -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 e81be5fe06..1b3d8690d0 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 7ad317bf44..91f5ac5e62 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 af3970d266..b9b3fd6b02 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 9b16c6564a..72d0ed74b9 100644 --- a/docs/df/d83/classshaka_1_1media_1_1TextPadder-members.html +++ b/docs/df/d83/classshaka_1_1media_1_1TextPadder-members.html @@ -70,31 +70,32 @@ $(function() {

          This is the complete list of members for shaka::media::TextPadder, 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
          output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
          SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
          TextPadder(int64_t duration_ms)shaka::media::TextPadderexplicit
          ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
          ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
          ~TextPadder() override=default (defined in shaka::media::TextPadder)shaka::media::TextPadder
          Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
          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
          output_handlers() (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerinlineprotected
          SetHandler(size_t output_stream_index, std::shared_ptr< MediaHandler > handler)shaka::media::MediaHandler
          TextPadder(int64_t duration_ms)shaka::media::TextPadderexplicit
          ValidateOutputStreamIndex(size_t stream_index) constshaka::media::MediaHandlerprotectedvirtual
          ~MediaHandler()=default (defined in shaka::media::MediaHandler)shaka::media::MediaHandlervirtual
          ~TextPadder() override=default (defined in shaka::media::TextPadder)shaka::media::TextPadder
          diff --git a/docs/df/d87/classshaka_1_1media_1_1AesCryptor.html b/docs/df/d87/classshaka_1_1media_1_1AesCryptor.html index d4ab33104b..d0392f250b 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 deb0dc54fd..3a190977d4 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 @@ -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 3323050921..7c75646b0d 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 363177c18d..078d4cb755 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 f6aee1a863..d68a4a961b 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 1bc49562d8..3e68288dce 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 3d52eb146b..b63eae0efb 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 569f010d9d..643bedfb83 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 859c9b44c5..d415e65862 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 @@ -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 e994bc614f..7c80b819f3 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 26316aebeb..dff9781a3d 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 9867553a4c..006a9206cf 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 b7213c5c6f..d442aba2f3 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 d7cf975794..9a0566e654 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 1522c86485..22408531d1 100644 --- a/docs/df/dc0/classshaka_1_1media_1_1WebVttToMp4Handler-members.html +++ b/docs/df/dc0/classshaka_1_1media_1_1WebVttToMp4Handler-members.html @@ -70,32 +70,33 @@ $(function() {

          This is the complete list of members for shaka::media::WebVttToMp4Handler, 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
          OnFlushRequest(size_t input_stream_index)shaka::media::MediaHandlerprotectedvirtual
          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
          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
          Chain(std::initializer_list< std::shared_ptr< MediaHandler >> list) (defined in shaka::media::MediaHandler)shaka::media::MediaHandlerstatic
          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
          OnFlushRequest(size_t input_stream_index)shaka::media::MediaHandlerprotectedvirtual
          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
          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 6d6626a457..74949ef5ba 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/dce/classshaka_1_1hls_1_1MockMediaPlaylist-members.html b/docs/df/dce/classshaka_1_1hls_1_1MockMediaPlaylist-members.html index 36f13ada46..893061c02f 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 365370fd9b..325f4c7e75 100644 --- a/docs/df/dd2/mpd__utils_8h_source.html +++ b/docs/df/dd2/mpd__utils_8h_source.html @@ -67,12 +67,12 @@ $(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 // Funtions used by MpdBuilder class to generate an MPD file.
          8 
          9 #ifndef MPD_BASE_MPD_UTILS_H_
          10 #define MPD_BASE_MPD_UTILS_H_
          11 
          12 #include <libxml/tree.h>
          13 
          14 #include <list>
          15 #include <string>
          16 
          17 namespace shaka {
          18 
          19 class AdaptationSet;
          20 class MediaInfo;
          21 class Representation;
          22 struct ContentProtectionElement;
          23 struct SegmentInfo;
          24 
          25 const char kEncryptedMp4Scheme[] = "urn:mpeg:dash:mp4protection:2011";
          26 const char kPsshElementName[] = "cenc:pssh";
          27 
          28 bool HasVODOnlyFields(const MediaInfo& media_info);
          29 
          30 bool HasLiveOnlyFields(const MediaInfo& media_info);
          31 
          32 // If |content_protection_element| has 'value' or 'schemeIdUri' set but it's
          33 // also in the map, then this removes them from the map.
          34 // |content_protection_element| cannot be NULL.
          35 void RemoveDuplicateAttributes(
          36  ContentProtectionElement* content_protection_element);
          37 
          38 // Returns a language in ISO-639 shortest form. May be blank for video.
          39 std::string GetLanguage(const MediaInfo& media_info);
          40 
          41 // Returns a 'codecs' string that has all the video and audio codecs joined with
          42 // comma.
          43 std::string GetCodecs(const MediaInfo& media_info);
          44 
          45 // Returns a codec string without variants. For example, "mp4a" instead of
          46 // "mp4a.40.2". May return a format for text streams.
          47 std::string GetBaseCodec(const MediaInfo& media_info);
          48 
          49 // Returns a key made from the characteristics that separate AdaptationSets.
          50 std::string GetAdaptationSetKey(const MediaInfo& media_info);
          51 
          52 std::string SecondsToXmlDuration(double seconds);
          53 
          54 // Tries to get "duration" attribute from |node|. On success |duration| is set.
          55 bool GetDurationAttribute(xmlNodePtr node, float* duration);
          56 
          57 bool MoreThanOneTrue(bool b1, bool b2, bool b3);
          58 bool AtLeastOneTrue(bool b1, bool b2, bool b3);
          59 bool OnlyOneTrue(bool b1, bool b2, bool b3);
          60 
          64 bool HexToUUID(const std::string& data, std::string* uuid_format);
          65 
          66 // Update the <cenc:pssh> element for |drm_uuid| ContentProtection element.
          67 // If the element does not exist, this will add one.
          68 void UpdateContentProtectionPsshHelper(
          69  const std::string& drm_uuid,
          70  const std::string& pssh,
          71  std::list<ContentProtectionElement>* content_protection_elements);
          72 
          79 void AddContentProtectionElements(const MediaInfo& media_info,
          80  Representation* parent);
          81 
          87 void AddContentProtectionElements(const MediaInfo& media_info,
          88  AdaptationSet* parent);
          89 
          90 } // namespace shaka
          91 
          92 #endif // MPD_BASE_MPD_UTILS_H_
          All the methods that are virtual are virtual for mocking.
          -
          void AddContentProtectionElements(const MediaInfo &media_info, Representation *parent)
          Definition: mpd_utils.cc:369
          -
          bool HexToUUID(const std::string &data, std::string *uuid_format)
          Definition: mpd_utils.cc:205
          +
          void AddContentProtectionElements(const MediaInfo &media_info, Representation *parent)
          Definition: mpd_utils.cc:380
          +
          bool HexToUUID(const std::string &data, std::string *uuid_format)
          Definition: mpd_utils.cc:216
          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 98c251f540..34f1ebc56f 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 cbbe4a30ba..64548067f4 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 bf8e82e89d..c13bcf3727 100644 --- a/docs/df/ddc/webm_2segmenter_8h_source.html +++ b/docs/df/ddc/webm_2segmenter_8h_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 #ifndef PACKAGER_MEDIA_FORMATS_WEBM_SEGMENTER_H_
          8 #define PACKAGER_MEDIA_FORMATS_WEBM_SEGMENTER_H_
          9 
          10 #include <memory>
          11 
          12 #include "packager/base/optional.h"
          13 #include "packager/media/base/range.h"
          14 #include "packager/media/formats/webm/mkv_writer.h"
          15 #include "packager/media/formats/webm/seek_head.h"
          16 #include "packager/status.h"
          17 #include "packager/third_party/libwebm/src/mkvmuxer.hpp"
          18 
          19 namespace shaka {
          20 namespace media {
          21 
          22 struct MuxerOptions;
          23 
          24 class AudioStreamInfo;
          25 class MediaSample;
          26 class MuxerListener;
          27 class ProgressListener;
          28 class StreamInfo;
          29 class VideoStreamInfo;
          30 
          31 namespace webm {
          32 
          33 class Segmenter {
          34  public:
          35  explicit Segmenter(const MuxerOptions& options);
          36  virtual ~Segmenter();
          37 
          44  Status Initialize(const StreamInfo& info,
          45  ProgressListener* progress_listener,
          46  MuxerListener* muxer_listener);
          47 
          50  Status Finalize();
          51 
          55  Status AddSample(const MediaSample& sample);
          56 
          58  virtual Status FinalizeSegment(uint64_t start_timestamp,
          59  uint64_t duration_timestamp,
          60  bool is_subsegment) = 0;
          61 
          64  virtual bool GetInitRangeStartAndEnd(uint64_t* start, uint64_t* end) = 0;
          65 
          68  virtual bool GetIndexRangeStartAndEnd(uint64_t* start, uint64_t* end) = 0;
          69 
          70  // Returns an empty vector if there are no specific ranges for the segments,
          71  // e.g. the media is in multiple files.
          72  // Otherwise, a vector of ranges for the media segments are returned.
          73  virtual std::vector<Range> GetSegmentRanges() = 0;
          74 
          76  float GetDurationInSeconds() const;
          77 
          78  protected:
          80  uint64_t FromBmffTimestamp(uint64_t bmff_timestamp);
          82  uint64_t FromWebMTimecode(uint64_t webm_timecode);
          84  Status WriteSegmentHeader(uint64_t file_size, MkvWriter* writer);
          86  Status SetCluster(uint64_t start_webm_timecode,
          87  uint64_t position,
          88  MkvWriter* writer);
          89 
          91  void UpdateProgress(uint64_t progress);
          92  void set_progress_target(uint64_t target) { progress_target_ = target; }
          93 
          94  const MuxerOptions& options() const { return options_; }
          95  mkvmuxer::Cluster* cluster() { return cluster_.get(); }
          96  mkvmuxer::Cues* cues() { return &cues_; }
          97  MuxerListener* muxer_listener() { return muxer_listener_; }
          98  SeekHead* seek_head() { return &seek_head_; }
          99 
          100  int track_id() const { return track_id_; }
          101  uint64_t segment_payload_pos() const { return segment_payload_pos_; }
          102 
          103  uint64_t duration() const { return duration_; }
          104 
          105  virtual Status DoInitialize() = 0;
          106  virtual Status DoFinalize() = 0;
          107 
          108  private:
          109  Status InitializeAudioTrack(const AudioStreamInfo& info,
          110  mkvmuxer::AudioTrack* track);
          111  Status InitializeVideoTrack(const VideoStreamInfo& info,
          112  mkvmuxer::VideoTrack* track);
          113 
          114  // Writes the previous frame to the file.
          115  Status WriteFrame(bool write_duration);
          116 
          117  // This is called when there needs to be a new (sub)segment.
          118  // In single-segment mode, a Cluster is a segment and there is no subsegment.
          119  // In multi-segment mode, a new file is a segment and the clusters in the file
          120  // are subsegments.
          121  virtual Status NewSegment(uint64_t start_timestamp, bool is_subsegment) = 0;
          122 
          123  // Store the previous sample so we know which one is the last frame.
          124  std::shared_ptr<const MediaSample> prev_sample_;
          125  // The reference frame timestamp; used to populate the ReferenceBlock element
          126  // when writing non-keyframe BlockGroups.
          127  uint64_t reference_frame_timestamp_ = 0;
          128 
          129  const MuxerOptions& options_;
          130 
          131  std::unique_ptr<mkvmuxer::Cluster> cluster_;
          132  mkvmuxer::Cues cues_;
          133  SeekHead seek_head_;
          134  mkvmuxer::SegmentInfo segment_info_;
          135  mkvmuxer::Tracks tracks_;
          136 
          137  MuxerListener* muxer_listener_ = nullptr;
          138  ProgressListener* progress_listener_ = nullptr;
          139  uint64_t progress_target_ = 0;
          140  uint64_t accumulated_progress_ = 0;
          141  uint64_t first_timestamp_ = 0;
          142  int64_t sample_duration_ = 0;
          143  // The position (in bytes) of the start of the Segment payload in the init
          144  // file. This is also the size of the header before the SeekHead.
          145  uint64_t segment_payload_pos_ = 0;
          146 
          147  // Indicate whether a new segment needed to be created, which is always true
          148  // in the beginning.
          149  bool new_segment_ = true;
          150  // Indicate whether a new subsegment needed to be created.
          151  bool new_subsegment_ = false;
          152  int track_id_ = 0;
          153 
          154  // The subset of information that we need from StreamInfo
          155  bool is_encrypted_ = false;
          156  uint64_t time_scale_ = 0;
          157  uint64_t duration_ = 0;
          158 
          159  DISALLOW_COPY_AND_ASSIGN(Segmenter);
          160 };
          161 
          162 } // namespace webm
          163 } // namespace media
          164 } // namespace shaka
          165 
          166 #endif // PACKAGER_MEDIA_FORMATS_WEBM_SEGMENTER_H_
          Status WriteSegmentHeader(uint64_t file_size, MkvWriter *writer)
          Writes the Segment header to writer.
          Definition: segmenter.cc:223
          -
          Abstract class holds stream information.
          Definition: stream_info.h:59
          +
          Abstract class holds stream information.
          Definition: stream_info.h:61
          uint64_t FromWebMTimecode(uint64_t webm_timecode)
          Converts the given time in WebM timecode to ISO BMFF timestamp.
          Definition: segmenter.cc:217
          uint64_t FromBmffTimestamp(uint64_t bmff_timestamp)
          Converts the given time in ISO BMFF timestamp to WebM timecode.
          Definition: segmenter.cc:211
          @@ -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 1eac21b8b4..4529a0e23a 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 41ff8361df..b3bc94cd09 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 a8a4e64921..b4fd6c3c72 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 02217639b5..1437d31627 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 ab3f7721a1..ce68877c15 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 955f3692e4..8d243be18c 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 1fde9356df..c7602d8642 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 d1e197c704..eebcd26e97 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 00232b55d6..0d17d2147a 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 faad15e44e..14e245a6e3 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 39812c4842..66ba39f12a 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 3e89d0671e..d0c33d8624 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 e3fdf3a9f6..7ccd6406e7 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 0ccd223042..756440b713 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 99e8aa543e..aa8d13c6da 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 8d0fc0040d..8696ba39b3 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 c1b46fd4d3..252829878d 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 631c81e22d..e13b82ef77 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 2737493849..b285c182aa 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 83b0363057..8e213b8c04 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 deleted file mode 100644 index df9cbcb0cb..0000000000 --- a/docs/dir_89aadd87adc268d697d42604fc1bbfe1.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - -Shaka Packager SDK: packager/media/ad_cue_generator Directory Reference - - - - - - - - - -
          -
          - - - - - - -
          -
          Shaka Packager SDK -
          -
          -
          - - - - - - - - -
          -
          - - -
          - -
          - - -
          -
          -
          -
          ad_cue_generator Directory Reference
          -
          -
          -
          - - - - diff --git a/docs/dir_933242dc2ed3ec7a82c146e98110781e.html b/docs/dir_933242dc2ed3ec7a82c146e98110781e.html index 9749d411ee..1ddf2a2c0e 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 688d7df7f1..03b75a3a5b 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 b03707a25a..0a624f7f12 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 095614f8b7..548d720d04 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 c76a273d39..a41b0be403 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 14dde1e9c5..5b879aeea9 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 0a4c4ddfe9..3bbaa7ceab 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 28efacfff3..578a7b4364 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 bedb5e846b..39b87a18d6 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 847f5543a3..05a450a7fb 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 c5ccb851c1..45ff88d59d 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 777648190a..2c76c2f650 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 c89d7ec875..249eab7913 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 0f5f6d3346..746a2aa83f 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 7df64b1711..c92e27f4c2 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 28d34b1836..f7e10fbc93 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 1579d7830d..e4309fdc9f 100644 --- a/docs/files.html +++ b/docs/files.html @@ -146,401 +146,398 @@ $(function() {   public  hls_params.h   media -  ad_cue_generator - ad_cue_generator.cc - ad_cue_generator.h -  base - aes_cryptor.cc - aes_cryptor.h - aes_decryptor.cc - aes_decryptor.h - aes_encryptor.cc - aes_encryptor.h - aes_pattern_cryptor.cc - aes_pattern_cryptor.h - audio_stream_info.cc - audio_stream_info.h - audio_timestamp_helper.cc - audio_timestamp_helper.h - bit_reader.cc - bit_reader.h - bit_writer.cc - bit_writer.h - buffer_reader.cc - buffer_reader.h - buffer_writer.cc - buffer_writer.h - byte_queue.cc - byte_queue.h - closure_thread.cc - closure_thread.h - container_names.cc - container_names.h - decrypt_config.cc - decrypt_config.h - decryptor_source.cc - decryptor_source.h - encryption_config.h - fourccs.h - http_key_fetcher.cc - http_key_fetcher.h - id3_tag.cc - id3_tag.h - key_fetcher.cc - key_fetcher.h - key_source.cc - key_source.h - language_utils.cc - language_utils.h - limits.h - macros.h - media_handler.cc - media_handler.h - media_handler_test_base.cc - media_handler_test_base.h - media_parser.h - media_sample.cc - media_sample.h - muxer.cc - muxer.h - muxer_options.cc - muxer_options.h - muxer_util.cc - muxer_util.h - network_util.cc - network_util.h - offset_byte_queue.cc - offset_byte_queue.h - playready_key_source.cc - playready_key_source.h - playready_pssh_generator.cc - playready_pssh_generator.h - producer_consumer_queue.h - protection_system_specific_info.cc - protection_system_specific_info.h - proto_json_util.cc - proto_json_util.h - pssh_generator.cc - pssh_generator.h - pssh_generator_util.cc - pssh_generator_util.h - range.h - raw_key_pssh_generator.cc - raw_key_pssh_generator.h - raw_key_source.cc - raw_key_source.h - rcheck.h - request_signer.cc - request_signer.h - rsa_key.cc - rsa_key.h - stream_info.cc - stream_info.h - text_sample.cc - text_sample.h - text_stream_info.cc - text_stream_info.h - text_track.h - text_track_config.cc - text_track_config.h - timestamp.h - video_stream_info.cc - video_stream_info.h - widevine_key_source.cc - widevine_key_source.h - widevine_pssh_generator.cc - widevine_pssh_generator.h -  chunking - chunking_handler.cc - chunking_handler.h - cue_alignment_handler.cc - cue_alignment_handler.h - sync_point_queue.cc - sync_point_queue.h - text_chunker.cc - text_chunker.h -  codecs - aac_audio_specific_config.cc - aac_audio_specific_config.h - ac3_audio_util.cc - ac3_audio_util.h - avc_decoder_configuration_record.cc - avc_decoder_configuration_record.h - decoder_configuration_record.cc - decoder_configuration_record.h - ec3_audio_util.cc - ec3_audio_util.h - es_descriptor.cc - es_descriptor.h - h264_byte_to_unit_stream_converter.cc - h264_byte_to_unit_stream_converter.h - h264_parser.cc - h264_parser.h - h265_byte_to_unit_stream_converter.cc - h265_byte_to_unit_stream_converter.h - h265_parser.cc - h265_parser.h - h26x_bit_reader.cc - h26x_bit_reader.h - h26x_byte_to_unit_stream_converter.cc - h26x_byte_to_unit_stream_converter.h - hevc_decoder_configuration_record.cc - hevc_decoder_configuration_record.h - hls_audio_util.cc - hls_audio_util.h - nal_unit_to_byte_stream_converter.cc - nal_unit_to_byte_stream_converter.h - nalu_reader.cc - nalu_reader.h - video_slice_header_parser.cc - video_slice_header_parser.h - vp8_parser.cc - vp8_parser.h - vp9_parser.cc - vp9_parser.h - vp_codec_configuration_record.cc - vp_codec_configuration_record.h - vpx_parser.h - webvtt_util.h -  crypto - encryption_handler.cc - encryption_handler.h - sample_aes_ec3_cryptor.cc - sample_aes_ec3_cryptor.h -  demuxer - demuxer.cc - demuxer.h -  event - combined_muxer_listener.cc - combined_muxer_listener.h - event_info.h - hls_notify_muxer_listener.cc - hls_notify_muxer_listener.h - mock_muxer_listener.cc - mock_muxer_listener.h - mpd_notify_muxer_listener.cc - mpd_notify_muxer_listener.h - muxer_listener.h - muxer_listener_factory.cc - muxer_listener_factory.h - muxer_listener_internal.cc - muxer_listener_internal.h - muxer_listener_test_helper.cc - muxer_listener_test_helper.h - progress_listener.h - vod_media_info_dump_muxer_listener.cc - vod_media_info_dump_muxer_listener.h -  formats -  mp2t - ac3_header.cc - ac3_header.h - adts_header.cc - adts_header.h - audio_header.h - continuity_counter.cc - continuity_counter.h - es_parser.h - es_parser_audio.cc - es_parser_audio.h - es_parser_h264.cc - es_parser_h264.h - es_parser_h265.cc - es_parser_h265.h - es_parser_h26x.cc - es_parser_h26x.h - mp2t_common.h - mp2t_media_parser.cc - mp2t_media_parser.h - pes_packet.cc - pes_packet.h - pes_packet_generator.cc - pes_packet_generator.h - program_map_table_writer.cc - program_map_table_writer.h - ts_muxer.cc - ts_muxer.h - ts_packet.cc - ts_packet.h - ts_packet_writer_util.cc - ts_packet_writer_util.h - ts_section.h - ts_section_pat.cc - ts_section_pat.h - ts_section_pes.cc - ts_section_pes.h - ts_section_pmt.cc - ts_section_pmt.h - ts_section_psi.cc - ts_section_psi.h - ts_segmenter.cc - ts_segmenter.h - ts_stream_type.h - ts_writer.cc - ts_writer.h -  mp4 - box.cc - box.h - box_buffer.h - box_definitions.cc - box_definitions.h - box_definitions_comparison.h - box_reader.cc - box_reader.h - chunk_info_iterator.cc - chunk_info_iterator.h - composition_offset_iterator.cc - composition_offset_iterator.h - decoding_time_iterator.cc - decoding_time_iterator.h - fragmenter.cc - fragmenter.h - key_frame_info.h - mp4_media_parser.cc - mp4_media_parser.h - mp4_muxer.cc - mp4_muxer.h - multi_segment_segmenter.cc - multi_segment_segmenter.h - segmenter.cc - segmenter.h - single_segment_segmenter.cc - single_segment_segmenter.h - sync_sample_iterator.cc - sync_sample_iterator.h - track_run_iterator.cc - track_run_iterator.h -  packed_audio - packed_audio_segmenter.cc - packed_audio_segmenter.h - packed_audio_writer.cc - packed_audio_writer.h -  webm - cluster_builder.cc - cluster_builder.h - encryptor.cc - encryptor.h - mkv_writer.cc - mkv_writer.h - multi_segment_segmenter.cc - multi_segment_segmenter.h - seek_head.cc - seek_head.h - segmenter.cc - segmenter.h - segmenter_test_base.cc - segmenter_test_base.h - single_segment_segmenter.cc - single_segment_segmenter.h - tracks_builder.cc - tracks_builder.h - two_pass_single_segment_segmenter.cc - two_pass_single_segment_segmenter.h - webm_audio_client.cc - webm_audio_client.h - webm_cluster_parser.cc - webm_cluster_parser.h - webm_constants.cc - webm_constants.h - webm_content_encodings.cc - webm_content_encodings.h - webm_content_encodings_client.cc - webm_content_encodings_client.h - webm_crypto_helpers.cc - webm_crypto_helpers.h - webm_info_parser.cc - webm_info_parser.h - webm_media_parser.cc - webm_media_parser.h - webm_muxer.cc - webm_muxer.h - webm_parser.cc - webm_parser.h - webm_tracks_parser.cc - webm_tracks_parser.h - webm_video_client.cc - webm_video_client.h - webm_webvtt_parser.cc - webm_webvtt_parser.h -  webvtt - text_padder.cc - text_padder.h - text_readers.cc - text_readers.h - webvtt_file_buffer.cc - webvtt_file_buffer.h - webvtt_parser.cc - webvtt_parser.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 -  origin - origin_handler.cc - origin_handler.h -  public - ad_cue_generator_params.h - chunking_params.h - crypto_params.h - mp4_output_params.h -  replicator - replicator.cc - replicator.h -  trick_play - trick_play_handler.cc - trick_play_handler.h -  mpd -  base -  xml - scoped_xml_ptr.h - xml_node.cc - xml_node.h - adaptation_set.cc - adaptation_set.h - bandwidth_estimator.cc - bandwidth_estimator.h - content_protection_element.cc - content_protection_element.h - mock_mpd_builder.cc - mock_mpd_builder.h - mock_mpd_notifier.cc - mock_mpd_notifier.h - mpd_builder.cc - mpd_builder.h - mpd_notifier.h - mpd_notifier_util.cc - mpd_notifier_util.h - mpd_options.h - mpd_utils.cc - mpd_utils.h - period.cc - period.h - representation.cc - representation.h - segment_info.h - simple_mpd_notifier.cc - simple_mpd_notifier.h -  public - mpd_params.h -  util - mpd_writer.cc - mpd_writer.h - packager.cc - packager.h - status.cc - status.h - status_macros.h - status_test_util.h +  base + aes_cryptor.cc + aes_cryptor.h + aes_decryptor.cc + aes_decryptor.h + aes_encryptor.cc + aes_encryptor.h + aes_pattern_cryptor.cc + aes_pattern_cryptor.h + audio_stream_info.cc + audio_stream_info.h + audio_timestamp_helper.cc + audio_timestamp_helper.h + bit_reader.cc + bit_reader.h + bit_writer.cc + bit_writer.h + buffer_reader.cc + buffer_reader.h + buffer_writer.cc + buffer_writer.h + byte_queue.cc + byte_queue.h + closure_thread.cc + closure_thread.h + container_names.cc + container_names.h + decrypt_config.cc + decrypt_config.h + decryptor_source.cc + decryptor_source.h + encryption_config.h + fourccs.h + http_key_fetcher.cc + http_key_fetcher.h + id3_tag.cc + id3_tag.h + key_fetcher.cc + key_fetcher.h + key_source.cc + key_source.h + language_utils.cc + language_utils.h + limits.h + macros.h + media_handler.cc + media_handler.h + media_handler_test_base.cc + media_handler_test_base.h + media_parser.h + media_sample.cc + media_sample.h + muxer.cc + muxer.h + muxer_options.cc + muxer_options.h + muxer_util.cc + muxer_util.h + network_util.cc + network_util.h + offset_byte_queue.cc + offset_byte_queue.h + playready_key_source.cc + playready_key_source.h + playready_pssh_generator.cc + playready_pssh_generator.h + producer_consumer_queue.h + protection_system_specific_info.cc + protection_system_specific_info.h + proto_json_util.cc + proto_json_util.h + pssh_generator.cc + pssh_generator.h + pssh_generator_util.cc + pssh_generator_util.h + range.h + raw_key_pssh_generator.cc + raw_key_pssh_generator.h + raw_key_source.cc + raw_key_source.h + rcheck.h + request_signer.cc + request_signer.h + rsa_key.cc + rsa_key.h + stream_info.cc + stream_info.h + text_sample.cc + text_sample.h + text_stream_info.cc + text_stream_info.h + text_track.h + text_track_config.cc + text_track_config.h + timestamp.h + video_stream_info.cc + video_stream_info.h + widevine_key_source.cc + widevine_key_source.h + widevine_pssh_generator.cc + widevine_pssh_generator.h +  chunking + chunking_handler.cc + chunking_handler.h + cue_alignment_handler.cc + cue_alignment_handler.h + sync_point_queue.cc + sync_point_queue.h + text_chunker.cc + text_chunker.h +  codecs + aac_audio_specific_config.cc + aac_audio_specific_config.h + ac3_audio_util.cc + ac3_audio_util.h + avc_decoder_configuration_record.cc + avc_decoder_configuration_record.h + decoder_configuration_record.cc + decoder_configuration_record.h + ec3_audio_util.cc + ec3_audio_util.h + es_descriptor.cc + es_descriptor.h + h264_byte_to_unit_stream_converter.cc + h264_byte_to_unit_stream_converter.h + h264_parser.cc + h264_parser.h + h265_byte_to_unit_stream_converter.cc + h265_byte_to_unit_stream_converter.h + h265_parser.cc + h265_parser.h + h26x_bit_reader.cc + h26x_bit_reader.h + h26x_byte_to_unit_stream_converter.cc + h26x_byte_to_unit_stream_converter.h + hevc_decoder_configuration_record.cc + hevc_decoder_configuration_record.h + hls_audio_util.cc + hls_audio_util.h + nal_unit_to_byte_stream_converter.cc + nal_unit_to_byte_stream_converter.h + nalu_reader.cc + nalu_reader.h + video_slice_header_parser.cc + video_slice_header_parser.h + vp8_parser.cc + vp8_parser.h + vp9_parser.cc + vp9_parser.h + vp_codec_configuration_record.cc + vp_codec_configuration_record.h + vpx_parser.h + webvtt_util.h +  crypto + encryption_handler.cc + encryption_handler.h + sample_aes_ec3_cryptor.cc + sample_aes_ec3_cryptor.h +  demuxer + demuxer.cc + demuxer.h +  event + combined_muxer_listener.cc + combined_muxer_listener.h + event_info.h + hls_notify_muxer_listener.cc + hls_notify_muxer_listener.h + mock_muxer_listener.cc + mock_muxer_listener.h + mpd_notify_muxer_listener.cc + mpd_notify_muxer_listener.h + muxer_listener.h + muxer_listener_factory.cc + muxer_listener_factory.h + muxer_listener_internal.cc + muxer_listener_internal.h + muxer_listener_test_helper.cc + muxer_listener_test_helper.h + progress_listener.h + vod_media_info_dump_muxer_listener.cc + vod_media_info_dump_muxer_listener.h +  formats +  mp2t + ac3_header.cc + ac3_header.h + adts_header.cc + adts_header.h + audio_header.h + continuity_counter.cc + continuity_counter.h + es_parser.h + es_parser_audio.cc + es_parser_audio.h + es_parser_h264.cc + es_parser_h264.h + es_parser_h265.cc + es_parser_h265.h + es_parser_h26x.cc + es_parser_h26x.h + mp2t_common.h + mp2t_media_parser.cc + mp2t_media_parser.h + pes_packet.cc + pes_packet.h + pes_packet_generator.cc + pes_packet_generator.h + program_map_table_writer.cc + program_map_table_writer.h + ts_muxer.cc + ts_muxer.h + ts_packet.cc + ts_packet.h + ts_packet_writer_util.cc + ts_packet_writer_util.h + ts_section.h + ts_section_pat.cc + ts_section_pat.h + ts_section_pes.cc + ts_section_pes.h + ts_section_pmt.cc + ts_section_pmt.h + ts_section_psi.cc + ts_section_psi.h + ts_segmenter.cc + ts_segmenter.h + ts_stream_type.h + ts_writer.cc + ts_writer.h +  mp4 + box.cc + box.h + box_buffer.h + box_definitions.cc + box_definitions.h + box_definitions_comparison.h + box_reader.cc + box_reader.h + chunk_info_iterator.cc + chunk_info_iterator.h + composition_offset_iterator.cc + composition_offset_iterator.h + decoding_time_iterator.cc + decoding_time_iterator.h + fragmenter.cc + fragmenter.h + key_frame_info.h + mp4_media_parser.cc + mp4_media_parser.h + mp4_muxer.cc + mp4_muxer.h + multi_segment_segmenter.cc + multi_segment_segmenter.h + segmenter.cc + segmenter.h + single_segment_segmenter.cc + single_segment_segmenter.h + sync_sample_iterator.cc + sync_sample_iterator.h + track_run_iterator.cc + track_run_iterator.h +  packed_audio + packed_audio_segmenter.cc + packed_audio_segmenter.h + packed_audio_writer.cc + packed_audio_writer.h +  webm + cluster_builder.cc + cluster_builder.h + encryptor.cc + encryptor.h + mkv_writer.cc + mkv_writer.h + multi_segment_segmenter.cc + multi_segment_segmenter.h + seek_head.cc + seek_head.h + segmenter.cc + segmenter.h + segmenter_test_base.cc + segmenter_test_base.h + single_segment_segmenter.cc + single_segment_segmenter.h + tracks_builder.cc + tracks_builder.h + two_pass_single_segment_segmenter.cc + two_pass_single_segment_segmenter.h + webm_audio_client.cc + webm_audio_client.h + webm_cluster_parser.cc + webm_cluster_parser.h + webm_constants.cc + webm_constants.h + webm_content_encodings.cc + webm_content_encodings.h + webm_content_encodings_client.cc + webm_content_encodings_client.h + webm_crypto_helpers.cc + webm_crypto_helpers.h + webm_info_parser.cc + webm_info_parser.h + webm_media_parser.cc + webm_media_parser.h + webm_muxer.cc + webm_muxer.h + webm_parser.cc + webm_parser.h + webm_tracks_parser.cc + webm_tracks_parser.h + webm_video_client.cc + webm_video_client.h + webm_webvtt_parser.cc + webm_webvtt_parser.h +  webvtt + text_padder.cc + text_padder.h + text_readers.cc + text_readers.h + webvtt_file_buffer.cc + webvtt_file_buffer.h + webvtt_parser.cc + webvtt_parser.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 +  origin + origin_handler.cc + origin_handler.h +  public + ad_cue_generator_params.h + chunking_params.h + crypto_params.h + mp4_output_params.h +  replicator + replicator.cc + replicator.h +  trick_play + trick_play_handler.cc + trick_play_handler.h +  mpd +  base +  xml + scoped_xml_ptr.h + xml_node.cc + xml_node.h + adaptation_set.cc + adaptation_set.h + bandwidth_estimator.cc + bandwidth_estimator.h + content_protection_element.cc + content_protection_element.h + mock_mpd_builder.cc + mock_mpd_builder.h + mock_mpd_notifier.cc + mock_mpd_notifier.h + mpd_builder.cc + mpd_builder.h + mpd_notifier.h + mpd_notifier_util.cc + mpd_notifier_util.h + mpd_options.h + mpd_utils.cc + mpd_utils.h + period.cc + period.h + representation.cc + representation.h + segment_info.h + simple_mpd_notifier.cc + simple_mpd_notifier.h +  public + mpd_params.h +  util + mpd_writer.cc + mpd_writer.h + packager.cc + packager.h + status.cc + status.h + status_macros.h + status_test_util.h diff --git a/docs/functions.html b/docs/functions.html index 8780e5eed9..a4013dc56e 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 8b6f611f25..cd32602d7d 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 4fc018f966..edc43b9415 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 6fbea59006..2aa0b43b3e 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 d76b25669b..6f35599c7d 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 f56235e895..a3b0ce0ff1 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 542a9593aa..91f8c32105 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 197b989d63..d641e2ae34 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 a6794e9388..0e743c075f 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 bb8f504d01..3565aacba9 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 605bd42135..f14b7b3015 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 ef1219784f..c468e3f921 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 f7c0fd8efc..8e573350a1 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 38b5f5b447..543363e490 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 e5026a4f39..619ad1d000 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 5da2345812..e2627db16e 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 5cdf0478eb..a829c06469 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 778e6e2107..1eee67b94d 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 9a28ebfe35..a74e3f5330 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 8c3ecc1673..9997742fd7 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 64804f2a35..94cbd7ef9d 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 9e23be34a7..a2b09c1ba5 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 54c0ec2a34..8d9caa97b8 100644 --- a/docs/functions_func_o.html +++ b/docs/functions_func_o.html @@ -164,7 +164,7 @@ $(function() { diff --git a/docs/functions_func_p.html b/docs/functions_func_p.html index 8a943cb07f..2d3e69f92e 100644 --- a/docs/functions_func_p.html +++ b/docs/functions_func_p.html @@ -187,7 +187,7 @@ $(function() { diff --git a/docs/functions_func_r.html b/docs/functions_func_r.html index a1cefc5b19..5aa63ac5f6 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 04d9a07977..d64b9ef261 100644 --- a/docs/functions_func_s.html +++ b/docs/functions_func_s.html @@ -290,7 +290,7 @@ $(function() { diff --git a/docs/functions_func_t.html b/docs/functions_func_t.html index f49858ed45..ea35aa40d1 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 d13c7223b8..866aeff0c1 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 b4e8594f9c..bb23e68044 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 13be0e1cdf..ca60aee770 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 92ee18624f..5a99322fa3 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 bc686e3efd..2b238175d0 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 eae16b7e44..b243a4045c 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 a43d536659..1d6067d134 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 efc34b211d..67ecebe214 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 2b59efadd4..0b5ee3b59f 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 b236f34faf..93f293e77c 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 89d512fd96..168e9b18a3 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 edc3f8ed6c..6ab512820f 100644 --- a/docs/functions_o.html +++ b/docs/functions_o.html @@ -179,7 +179,7 @@ $(function() { diff --git a/docs/functions_p.html b/docs/functions_p.html index df8772416c..37b447fa1a 100644 --- a/docs/functions_p.html +++ b/docs/functions_p.html @@ -206,7 +206,7 @@ $(function() { diff --git a/docs/functions_r.html b/docs/functions_r.html index 26f598da67..d8970f0438 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 485482abe8..51f124ed84 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 9186955531..d512fa7305 100644 --- a/docs/functions_s.html +++ b/docs/functions_s.html @@ -335,7 +335,7 @@ $(function() { diff --git a/docs/functions_t.html b/docs/functions_t.html index ba5b8f75c0..446daf3115 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 4f395a4637..0bc45938b0 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 5c516cb4fd..255bbe4f4e 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 30a87c528b..99c1f4e8b3 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 c7d5ee6b47..58855da434 100644 --- a/docs/functions_vars.html +++ b/docs/functions_vars.html @@ -418,7 +418,7 @@ $(function() { diff --git a/docs/functions_w.html b/docs/functions_w.html index 2501ae24c6..ca86e39acb 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 0223bf1b75..511b722a30 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 a7b28461e3..ff903f76fa 100644 --- a/docs/hierarchy.html +++ b/docs/hierarchy.html @@ -254,27 +254,26 @@ $(function() {  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::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 @@ -426,7 +425,7 @@ $(function() { diff --git a/docs/index.html b/docs/index.html index 296d8c8538..fb11d44f54 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 2630413272..bd0f604b91 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 196ee34394..24fa07b59c 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 776e40dcf1..d0257e635a 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 bea1a1a2e0..4e78825433 100644 --- a/docs/namespaces.html +++ b/docs/namespaces.html @@ -70,7 +70,7 @@ $(function() { diff --git a/docs/search/all_0.js b/docs/search/all_0.js index 919b9b1879..675434cb31 100644 --- a/docs/search/all_0.js +++ b/docs/search/all_0.js @@ -6,7 +6,6 @@ var searchData= ['ad_5fcue_5fgenerator_5fparams',['ad_cue_generator_params',['../d5/de3/structshaka_1_1PackagingParams.html#aa52d546c86b3b36234bcfc0cd50ef083',1,'shaka::PackagingParams']]], ['adaptationset',['AdaptationSet',['../d8/d8e/classshaka_1_1AdaptationSet.html',1,'shaka::AdaptationSet'],['../d8/d8e/classshaka_1_1AdaptationSet.html#ac4e96321642dc738e5c21511746fcb1f',1,'shaka::AdaptationSet::AdaptationSet()']]], ['adaptationsetxmlnode',['AdaptationSetXmlNode',['../d1/de7/classshaka_1_1xml_1_1AdaptationSetXmlNode.html',1,'shaka::xml']]], - ['adcuegenerator',['AdCueGenerator',['../de/de4/classshaka_1_1media_1_1AdCueGenerator.html',1,'shaka::media']]], ['adcuegeneratorparams',['AdCueGeneratorParams',['../dd/dfd/structshaka_1_1AdCueGeneratorParams.html',1,'shaka']]], ['addadaptationsetswitching',['AddAdaptationSetSwitching',['../d8/d8e/classshaka_1_1AdaptationSet.html#a979cef296d0e67c271641a0c3146e8f3',1,'shaka::AdaptationSet']]], ['addaudioinfo',['AddAudioInfo',['../df/d9e/classshaka_1_1xml_1_1RepresentationXmlNode.html#a49050cf0e7883bfa6e8e2fb0174b2a7a',1,'shaka::xml::RepresentationXmlNode']]], diff --git a/docs/search/classes_0.js b/docs/search/classes_0.js index 87c425485e..f9bf05b61c 100644 --- a/docs/search/classes_0.js +++ b/docs/search/classes_0.js @@ -5,7 +5,6 @@ var searchData= ['ac3specific',['AC3Specific',['../d4/dfa/structshaka_1_1media_1_1mp4_1_1AC3Specific.html',1,'shaka::media::mp4']]], ['adaptationset',['AdaptationSet',['../d8/d8e/classshaka_1_1AdaptationSet.html',1,'shaka']]], ['adaptationsetxmlnode',['AdaptationSetXmlNode',['../d1/de7/classshaka_1_1xml_1_1AdaptationSetXmlNode.html',1,'shaka::xml']]], - ['adcuegenerator',['AdCueGenerator',['../de/de4/classshaka_1_1media_1_1AdCueGenerator.html',1,'shaka::media']]], ['adcuegeneratorparams',['AdCueGeneratorParams',['../dd/dfd/structshaka_1_1AdCueGeneratorParams.html',1,'shaka']]], ['adtsheader',['AdtsHeader',['../d3/d0c/classshaka_1_1media_1_1mp2t_1_1AdtsHeader.html',1,'shaka::media::mp2t']]], ['aescbcdecryptor',['AesCbcDecryptor',['../df/d2d/classshaka_1_1media_1_1AesCbcDecryptor.html',1,'shaka::media']]], diff --git a/html/_images/plantuml-2b4e7ead076336273a38a8dd3c2a8047700aa621.png b/html/_images/plantuml-2b4e7ead076336273a38a8dd3c2a8047700aa621.png index 45c0016c88..869d0f802a 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 bea63223a9..3eb99df1d5 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 a3a3bdec4c..af4cd91b92 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 8d3875c244..b30c54e851 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 5cbc2caee6..12dc34ee44 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 d2bc5d6b44..688f43a53c 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 5e12decc27..347a991c1a 100644 Binary files a/html/_images/plantuml-edc9d35f3b0f3e20a550695f8a0bdb29a752d238.png and b/html/_images/plantuml-edc9d35f3b0f3e20a550695f8a0bdb29a752d238.png differ diff --git a/html/_sources/options/udp_file_options.rst.txt b/html/_sources/options/udp_file_options.rst.txt index 2671911c69..234c564c38 100644 --- a/html/_sources/options/udp_file_options.rst.txt +++ b/html/_sources/options/udp_file_options.rst.txt @@ -7,15 +7,23 @@ UDP file is of the form:: Here is the list of supported options: -:reuse=0|1: +:buffer_size=: - Allow or disallow reusing UDP sockets. + UDP maximum receive buffer size in bytes. Note that although it can be set + to any value, the actual value is capped by maximum allowed size defined by + the underlying operating system. On linux, the maximum size allowed can be + retrieved using `sysctl net.core.rmem_max` and configured using + `sysctl -w net.core.rmem_max=`. :interface=: Multicast group interface address. Only the packets sent to this address are received. Default to "0.0.0.0" if not specified. +:reuse=0|1: + + Allow or disallow reusing UDP sockets. + :source=: Multicast source ip address. Only the packets sent from this source address @@ -28,3 +36,24 @@ Here is the list of supported options: Example:: udp://224.1.2.30:88?interface=10.11.12.13&reuse=1 + +.. note:: + + UDP is by definition unreliable. There could be packets dropped. + + UDP packets do not get lost magically. There are things you can do to + minimize the packet loss. A common cause of packet loss is buffer overrun, + either in send buffer or receive buffer. + + On Linux, you can check UDP errors by monitoring the output from + `netstat -suna` command. + + If there is an increase in `send buffer errors` from the `netstat` output, + then try increasing `buffer_size` in + [FFmpeg](https://ffmpeg.org/ffmpeg-protocols.html#udp). + + If there is an increase in `receive buffer errors`, then try increasing + `buffer_size` in UDP options (See above) or increasing `--io_cache_size`. + `buffer_size` in UDP options defines the UDP buffer size of the underlying + system while `io_cache_size` defines the size of the internal circular + buffer managed by `Shaka Packager`. diff --git a/html/_sources/tutorials/ffmpeg_piping.rst.txt b/html/_sources/tutorials/ffmpeg_piping.rst.txt index 15d1449422..1dcf595862 100644 --- a/html/_sources/tutorials/ffmpeg_piping.rst.txt +++ b/html/_sources/tutorials/ffmpeg_piping.rst.txt @@ -13,7 +13,7 @@ There are two options to pipe data to packager. - UDP socket *FFmpeg* supports writing to a UDP socket and *packager* supports reading - from UDP sockets:: + from UDP sockets (See :doc:`/options/udp_file_options`):: $ packager 'input=udp://127.0.0.1:40000,...' ... $ ffmpeg ... -f mpegts udp://127.0.0.1:40000 diff --git a/html/options/udp_file_options.html b/html/options/udp_file_options.html index 026f6e7585..68f06430dd 100644 --- a/html/options/udp_file_options.html +++ b/html/options/udp_file_options.html @@ -74,17 +74,24 @@ -reuse=0|1:Allow or disallow reusing UDP sockets. +buffer_size=<size_in_bytes>: + UDP maximum receive buffer size in bytes. Note that although it can be set +to any value, the actual value is capped by maximum allowed size defined by +the underlying operating system. On linux, the maximum size allowed can be +retrieved using sysctl net.core.rmem_max and configured using +sysctl -w net.core.rmem_max=<size_in_bytes>. interface=<addr>:  Multicast group interface address. Only the packets sent to this address are received. Default to “0.0.0.0” if not specified. -source=<addr>:Multicast source ip address. Only the packets sent from this source address +reuse=0|1:Allow or disallow reusing UDP sockets. + +source=<addr>:Multicast source ip address. Only the packets sent from this source address are received. Enables Source Specific Multicast (SSM) if set. -timeout=<microseconds>: - UDP timeout in microseconds. +timeout=<microseconds>: + UDP timeout in microseconds. @@ -92,6 +99,23 @@ are received. Enables Source Specific Multicast (SSM) if set.
          udp://224.1.2.30:88?interface=10.11.12.13&reuse=1
           
          +
          +

          Note

          +

          UDP is by definition unreliable. There could be packets dropped.

          +

          UDP packets do not get lost magically. There are things you can do to +minimize the packet loss. A common cause of packet loss is buffer overrun, +either in send buffer or receive buffer.

          +

          On Linux, you can check UDP errors by monitoring the output from +netstat -suna command.

          +

          If there is an increase in send buffer errors from the netstat output, +then try increasing buffer_size in +[FFmpeg](https://ffmpeg.org/ffmpeg-protocols.html#udp).

          +

          If there is an increase in receive buffer errors, then try increasing +buffer_size in UDP options (See above) or increasing –io_cache_size. +buffer_size in UDP options defines the UDP buffer size of the underlying +system while io_cache_size defines the size of the internal circular +buffer managed by Shaka Packager.

          +
          diff --git a/html/searchindex.js b/html/searchindex.js index c3dac53f6a..fa2f9de1a2 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,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 +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,19,26,27,29,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,19,29],"void":[6,7],"while":[19,29],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,19,27,29,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,19,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,19,29],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,although:[19,29],alwai:[4,7,9,22,27],among:[4,18],analysi:32,ani:[0,4,7,9,18,19,22,29],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,19,22,28,29],buffer_callback_param:7,buffer_s:[19,29],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,19,21,22,25,26,27,28,29,31,33],cancel:[6,7],cannot:[4,7,27],cap:[19,29],capabl:21,captur:32,care:29,carefulli:27,carri:27,categori:0,caus:[19,29],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,19,29],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,circular:[19,29],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,19,21,22,23,26,28,29,31,32],commit:0,common:[0,4,7,9,16,19,20,22,25,26,29,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,19,29],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],core:[19,29],correct:[4,7,9,12,22,28],correctli:0,correspond:[17,22,28,29],could:[7,19,29],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,19,20,22,26,28,29,31,33],definit:[4,7,9,17,19,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,19,29],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,19,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,19,29],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,19,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,19,29,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,html:[19,29],http:[0,4,5,7,14,19,20,22,26,28,29,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:[19,27,29],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,19,25,29],internal_error:7,invalid:7,invalid_argu:7,io_block_s:27,io_cache_s:[19,29],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],linux:[19,29],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,loss:[19,29],lost:[19,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],magic:[19,29],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,manag:[19,29],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],maximum:[19,29],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],minim:[19,29],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:[19,27,29],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,19,29],netstat:[19,29],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,19,22,26,28,29,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,19,29],optim:[4,7,9,22],option:[0,3,5,7,10,13,18,21,27],opu:25,order:29,org:[0,19,29],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,19,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],overrun:[19,29],own:4,pacakg:0,pack:[4,7,14],packag:[9,15,19,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:[19,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],retriev:[19,29],reus:[19,29],revis:0,rfc:[17,22,28,29],right:[4,7,20,29,33],rmem_max:[19,29],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,19,20,22,27,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,send:[19,29],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,19,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:[19,25,29],size_in_byt:[19,29],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,suna:[19,29],support:[0,4,7,19,27],switchabl:25,sync:[0,29],synopsi:[5,24,32],sysctl:[19,29],sysroot:0,system:[3,4,7,19,20,26,29,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],thing:[19,29],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],underli:[19,29],unimpl:7,uniqu:[4,20,33],univers:0,unknown:7,unlik:0,unmanag:0,unreli:[19,29],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,19,20,26,27,28,29,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,19,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,19,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/ffmpeg_piping.html b/html/tutorials/ffmpeg_piping.html index 3e3fecfaaf..7990206cc8 100644 --- a/html/tutorials/ffmpeg_piping.html +++ b/html/tutorials/ffmpeg_piping.html @@ -104,7 +104,7 @@ depicted here can be applied to other FFmpeg supported device or protoc
        • UDP socket

          FFmpeg supports writing to a UDP socket and packager supports reading -from UDP sockets:

          +from UDP sockets (See UDP file options):

          $ packager 'input=udp://127.0.0.1:40000,...' ...
           $ ffmpeg ... -f mpegts udp://127.0.0.1:40000
           
          diff --git a/html/tutorials/live.html b/html/tutorials/live.html index f98702077b..290ba673e6 100644 --- a/html/tutorials/live.html +++ b/html/tutorials/live.html @@ -161,17 +161,24 @@ manifest / playlists and media segments to content server:

          -reuse=0|1:Allow or disallow reusing UDP sockets. +buffer_size=<size_in_bytes>: + UDP maximum receive buffer size in bytes. Note that although it can be set +to any value, the actual value is capped by maximum allowed size defined by +the underlying operating system. On linux, the maximum size allowed can be +retrieved using sysctl net.core.rmem_max and configured using +sysctl -w net.core.rmem_max=<size_in_bytes>. interface=<addr>:  Multicast group interface address. Only the packets sent to this address are received. Default to “0.0.0.0” if not specified. -source=<addr>:Multicast source ip address. Only the packets sent from this source address +reuse=0|1:Allow or disallow reusing UDP sockets. + +source=<addr>:Multicast source ip address. Only the packets sent from this source address are received. Enables Source Specific Multicast (SSM) if set. -timeout=<microseconds>: - UDP timeout in microseconds. +timeout=<microseconds>: + UDP timeout in microseconds. @@ -179,6 +186,23 @@ are received. Enables Source Specific Multicast (SSM) if set.
          udp://224.1.2.30:88?interface=10.11.12.13&reuse=1
           
          +
          +

          Note

          +

          UDP is by definition unreliable. There could be packets dropped.

          +

          UDP packets do not get lost magically. There are things you can do to +minimize the packet loss. A common cause of packet loss is buffer overrun, +either in send buffer or receive buffer.

          +

          On Linux, you can check UDP errors by monitoring the output from +netstat -suna command.

          +

          If there is an increase in send buffer errors from the netstat output, +then try increasing buffer_size in +[FFmpeg](https://ffmpeg.org/ffmpeg-protocols.html#udp).

          +

          If there is an increase in receive buffer errors, then try increasing +buffer_size in UDP options (See above) or increasing –io_cache_size. +buffer_size in UDP options defines the UDP buffer size of the underlying +system while io_cache_size defines the size of the internal circular +buffer managed by Shaka Packager.

          +

          Segment template formatting