diff --git a/docs/annotated.html b/docs/annotated.html index 30018cc308..ef73ec0b79 100644 --- a/docs/annotated.html +++ b/docs/annotated.html @@ -372,7 +372,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/classes.html b/docs/classes.html index 4d9accbe3f..e68c634263 100644 --- a/docs/classes.html +++ b/docs/classes.html @@ -179,7 +179,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); 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 0e870c3e3e..074c8bfdab 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 ed73b867de..ed2a42d906 100644 --- a/docs/d0/d04/classshaka_1_1media_1_1RsaRequestSigner-members.html +++ b/docs/d0/d04/classshaka_1_1media_1_1RsaRequestSigner-members.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d0/d06/mpd__flags_8cc_source.html b/docs/d0/d06/mpd__flags_8cc_source.html index 4421f45251..7633112931 100644 --- a/docs/d0/d06/mpd__flags_8cc_source.html +++ b/docs/d0/d06/mpd__flags_8cc_source.html @@ -140,7 +140,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 e186d316d1..e53f5f242b 100644 --- a/docs/d0/d0e/classshaka_1_1media_1_1HttpKeyFetcher-members.html +++ b/docs/d0/d0e/classshaka_1_1media_1_1HttpKeyFetcher-members.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 a7aa60a672..b1b766639c 100644 --- a/docs/d0/d0e/hevc__decoder__configuration__record_8h_source.html +++ b/docs/d0/d0e/hevc__decoder__configuration__record_8h_source.html @@ -138,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d0/d0e/muxer__options_8h_source.html b/docs/d0/d0e/muxer__options_8h_source.html index 1b1999a7a2..22bac74bc7 100644 --- a/docs/d0/d0e/muxer__options_8h_source.html +++ b/docs/d0/d0e/muxer__options_8h_source.html @@ -152,7 +152,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 15bd011f76..be8942ad97 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d0/d11/structshaka_1_1media_1_1VPxFrameInfo.html b/docs/d0/d11/structshaka_1_1media_1_1VPxFrameInfo.html index 47161b8350..1a83a11917 100644 --- a/docs/d0/d11/structshaka_1_1media_1_1VPxFrameInfo.html +++ b/docs/d0/d11/structshaka_1_1media_1_1VPxFrameInfo.html @@ -121,7 +121,7 @@ uint32_t height 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 1375191dbd..2b71e5eb1a 100644 --- a/docs/d0/d1e/classshaka_1_1media_1_1H265ByteToUnitStreamConverter-members.html +++ b/docs/d0/d1e/classshaka_1_1media_1_1H265ByteToUnitStreamConverter-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 b52afd6a13..c3a5ce8fd2 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 3e337294a8..926194c957 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 @@ -155,7 +155,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 e2171890db..8163c32a8a 100644 --- a/docs/d0/d27/structshaka_1_1media_1_1MuxerOptions.html +++ b/docs/d0/d27/structshaka_1_1media_1_1MuxerOptions.html @@ -291,7 +291,7 @@ bool webm_subsample_encryp diff --git a/docs/d0/d30/mock__mpd__notifier_8h_source.html b/docs/d0/d30/mock__mpd__notifier_8h_source.html index 7f2f733a4f..afc7812cb2 100644 --- a/docs/d0/d30/mock__mpd__notifier_8h_source.html +++ b/docs/d0/d30/mock__mpd__notifier_8h_source.html @@ -148,7 +148,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d0/d32/mp2t__common_8h_source.html b/docs/d0/d32/mp2t__common_8h_source.html index 710b9125ad..03d90eb902 100644 --- a/docs/d0/d32/mp2t__common_8h_source.html +++ b/docs/d0/d32/mp2t__common_8h_source.html @@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d0/d33/classshaka_1_1MockRepresentation.html b/docs/d0/d33/classshaka_1_1MockRepresentation.html index 6c1bab7cf2..d79c934676 100644 --- a/docs/d0/d33/classshaka_1_1MockRepresentation.html +++ b/docs/d0/d33/classshaka_1_1MockRepresentation.html @@ -160,7 +160,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 1f94cdde1d..2339c4f2d3 100644 --- a/docs/d0/d35/es__descriptor_8cc_source.html +++ b/docs/d0/d35/es__descriptor_8cc_source.html @@ -285,7 +285,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 499c40dff2..fefa590bce 100644 --- a/docs/d0/d3a/hls__notify__muxer__listener_8cc_source.html +++ b/docs/d0/d3a/hls__notify__muxer__listener_8cc_source.html @@ -220,7 +220,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d0/d3a/webm__constants_8h_source.html b/docs/d0/d3a/webm__constants_8h_source.html index 469eac042c..0f875184e7 100644 --- a/docs/d0/d3a/webm__constants_8h_source.html +++ b/docs/d0/d3a/webm__constants_8h_source.html @@ -318,7 +318,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 0a598e6d90..d312e93fad 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 @@ -182,7 +182,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 01f0927716..f16c99b2ac 100644 --- a/docs/d0/d42/aes__cryptor_8h_source.html +++ b/docs/d0/d42/aes__cryptor_8h_source.html @@ -204,18 +204,18 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
141 
142 
Definition: aes_cryptor.h:25
-
void UpdateIv()
Definition: aes_cryptor.cc:80
-
AesCryptor(ConstantIvFlag constant_iv_flag)
Definition: aes_cryptor.cc:32
+
void UpdateIv()
Definition: aes_cryptor.cc:78
+
AesCryptor(ConstantIvFlag constant_iv_flag)
Definition: aes_cryptor.cc:31
virtual bool InitializeWithIv(const std::vector< uint8_t > &key, const std::vector< uint8_t > &iv)=0
const std::vector< uint8_t > & iv() const
Definition: aes_cryptor.h:81
bool Crypt(const uint8_t *text, size_t text_size, uint8_t *crypt_text)
Definition: aes_cryptor.h:55
-
static bool GenerateRandomIv(FourCC protection_scheme, std::vector< uint8_t > *iv)
Definition: aes_cryptor.cc:109
-
bool SetIv(const std::vector< uint8_t > &iv)
Definition: aes_cryptor.cc:69
+
static bool GenerateRandomIv(FourCC protection_scheme, std::vector< uint8_t > *iv)
Definition: aes_cryptor.cc:107
+
bool SetIv(const std::vector< uint8_t > &iv)
Definition: aes_cryptor.cc:67
bool use_constant_iv() const
Definition: aes_cryptor.h:84
diff --git a/docs/d0/d42/widevine__encryption__flags_8cc_source.html b/docs/d0/d42/widevine__encryption__flags_8cc_source.html index aff5a8a5f2..8e109097ba 100644 --- a/docs/d0/d42/widevine__encryption__flags_8cc_source.html +++ b/docs/d0/d42/widevine__encryption__flags_8cc_source.html @@ -258,7 +258,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d0/d46/fourccs_8h_source.html b/docs/d0/d46/fourccs_8h_source.html index 42a7028f92..2749431910 100644 --- a/docs/d0/d46/fourccs_8h_source.html +++ b/docs/d0/d46/fourccs_8h_source.html @@ -248,7 +248,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 1dfd3e3c8a..1d08efca56 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 @@ -237,7 +237,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 d1afa3a64a..a58c08cce0 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d0/d4d/classshaka_1_1media_1_1AudioTimestampHelper.html b/docs/d0/d4d/classshaka_1_1media_1_1AudioTimestampHelper.html index e59a69274a..d76b98029c 100644 --- a/docs/d0/d4d/classshaka_1_1media_1_1AudioTimestampHelper.html +++ b/docs/d0/d4d/classshaka_1_1media_1_1AudioTimestampHelper.html @@ -131,7 +131,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 971fcfcb16..a42cc3be96 100644 --- a/docs/d0/d4e/libcrypto__threading_8cc_source.html +++ b/docs/d0/d4e/libcrypto__threading_8cc_source.html @@ -143,7 +143,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 1f44079cc3..c8682a4823 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 @@ -117,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 0d74d187fc..4369ae7b23 100644 --- a/docs/d0/d5b/classshaka_1_1media_1_1MpdNotifyMuxerListener-members.html +++ b/docs/d0/d5b/classshaka_1_1media_1_1MpdNotifyMuxerListener-members.html @@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d0/d66/classshaka_1_1media_1_1ThreadedIoFile.html b/docs/d0/d66/classshaka_1_1media_1_1ThreadedIoFile.html index 5998949ce0..fdf2bf781b 100644 --- a/docs/d0/d66/classshaka_1_1media_1_1ThreadedIoFile.html +++ b/docs/d0/d66/classshaka_1_1media_1_1ThreadedIoFile.html @@ -438,7 +438,7 @@ Additional Inherited Members diff --git a/docs/d0/d6a/classshaka_1_1media_1_1StreamDescriptorCompareFn-members.html b/docs/d0/d6a/classshaka_1_1media_1_1StreamDescriptorCompareFn-members.html index 2eece2503e..dff4b80eb2 100644 --- a/docs/d0/d6a/classshaka_1_1media_1_1StreamDescriptorCompareFn-members.html +++ b/docs/d0/d6a/classshaka_1_1media_1_1StreamDescriptorCompareFn-members.html @@ -97,7 +97,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 eddb3a93f3..e55c8717cc 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 @@ -197,7 +197,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 58e4141aa0..3be80edb14 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 @@ -188,7 +188,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 8bd0859907..09cdbbc751 100644 --- a/docs/d0/d7d/decryptor__source_8h_source.html +++ b/docs/d0/d7d/decryptor__source_8h_source.html @@ -97,43 +97,43 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
8 #define MEDIA_BASE_DECRYPTOR_SOURCE_H_
9 
10 #include <map>
-
11 #include <vector>
-
12 
-
13 #include "packager/media/base/aes_decryptor.h"
-
14 #include "packager/media/base/decrypt_config.h"
-
15 #include "packager/media/base/key_source.h"
-
16 
-
17 namespace shaka {
-
18 namespace media {
-
19 
- -
22  public:
-
23  explicit DecryptorSource(KeySource* key_source);
-
24  ~DecryptorSource();
-
25 
-
26  bool DecryptSampleBuffer(const DecryptConfig* decrypt_config,
-
27  uint8_t* buffer,
-
28  size_t buffer_size);
-
29 
-
30  private:
-
31  KeySource* key_source_;
-
32  std::map<std::vector<uint8_t>, AesCryptor*> decryptor_map_;
-
33 
-
34  DISALLOW_COPY_AND_ASSIGN(DecryptorSource);
-
35 };
-
36 
-
37 } // namespace media
-
38 } // namespace shaka
-
39 
-
40 #endif // MEDIA_BASE_DECRYPTOR_SOURCE_H_
- +
11 #include <memory>
+
12 #include <vector>
+
13 
+
14 #include "packager/media/base/aes_decryptor.h"
+
15 #include "packager/media/base/decrypt_config.h"
+
16 #include "packager/media/base/key_source.h"
+
17 
+
18 namespace shaka {
+
19 namespace media {
+
20 
+ +
23  public:
+
24  explicit DecryptorSource(KeySource* key_source);
+
25  ~DecryptorSource();
+
26 
+
27  bool DecryptSampleBuffer(const DecryptConfig* decrypt_config,
+
28  uint8_t* buffer,
+
29  size_t buffer_size);
+
30 
+
31  private:
+
32  KeySource* key_source_;
+
33  std::map<std::vector<uint8_t>, std::unique_ptr<AesCryptor>> decryptor_map_;
+
34 
+
35  DISALLOW_COPY_AND_ASSIGN(DecryptorSource);
+
36 };
+
37 
+
38 } // namespace media
+
39 } // namespace shaka
+
40 
+
41 #endif // MEDIA_BASE_DECRYPTOR_SOURCE_H_
KeySource is responsible for encryption key acquisition.
Definition: key_source.h:30
-
DecryptorSource wraps KeySource and is responsible for decryptor management.
+
DecryptorSource wraps KeySource and is responsible for decryptor management.
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 1255564d8f..ae23db23d1 100644 --- a/docs/d0/d80/classshaka_1_1media_1_1AesCbcEncryptor-members.html +++ b/docs/d0/d80/classshaka_1_1media_1_1AesCbcEncryptor-members.html @@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d0/d80/classshaka_1_1media_1_1Status-members.html b/docs/d0/d80/classshaka_1_1media_1_1Status-members.html index c35bca4551..ca0f672cd1 100644 --- a/docs/d0/d80/classshaka_1_1media_1_1Status-members.html +++ b/docs/d0/d80/classshaka_1_1media_1_1Status-members.html @@ -112,7 +112,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d0/d93/classshaka_1_1media_1_1Status.html b/docs/d0/d93/classshaka_1_1media_1_1Status.html index 016b96d74a..e1708e7ce5 100644 --- a/docs/d0/d93/classshaka_1_1media_1_1Status.html +++ b/docs/d0/d93/classshaka_1_1media_1_1Status.html @@ -302,7 +302,7 @@ static const 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 8085cf7d7c..87e7146366 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 @@ -186,7 +186,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 0dd34bb8ac..b5e64ce8ca 100644 --- a/docs/d0/da2/classshaka_1_1media_1_1AACAudioSpecificConfig.html +++ b/docs/d0/da2/classshaka_1_1media_1_1AACAudioSpecificConfig.html @@ -329,7 +329,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 4573f8d6bf..1c620a7bd0 100644 --- a/docs/d0/da2/classshaka_1_1media_1_1RequestSigner-members.html +++ b/docs/d0/da2/classshaka_1_1media_1_1RequestSigner-members.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 85d2ccbf64..f821ad6b42 100644 --- a/docs/d0/da2/structshaka_1_1xml_1_1XmlDeleter-members.html +++ b/docs/d0/da2/structshaka_1_1xml_1_1XmlDeleter-members.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d0/da6/stream__descriptor_8cc_source.html b/docs/d0/da6/stream__descriptor_8cc_source.html index ae2cc81368..58efdeb742 100644 --- a/docs/d0/da6/stream__descriptor_8cc_source.html +++ b/docs/d0/da6/stream__descriptor_8cc_source.html @@ -295,7 +295,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 799e546c15..633781f9e0 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 @@ -259,7 +259,7 @@ void set_progress_target diff --git a/docs/d0/dac/classshaka_1_1media_1_1FixedKeySource.html b/docs/d0/dac/classshaka_1_1media_1_1FixedKeySource.html index 772df34471..d4ec9cdbd3 100644 --- a/docs/d0/dac/classshaka_1_1media_1_1FixedKeySource.html +++ b/docs/d0/dac/classshaka_1_1media_1_1FixedKeySource.html @@ -480,7 +480,7 @@ Additional Inherited Members 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 4e56db528e..8b51c7abcc 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 @@ -123,7 +123,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 dc66f30689..b0181c8401 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 @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 7614cbbaa4..e1bd1d96db 100644 --- a/docs/d0/dc8/classshaka_1_1xml_1_1AdaptationSetXmlNode-members.html +++ b/docs/d0/dc8/classshaka_1_1xml_1_1AdaptationSetXmlNode-members.html @@ -114,7 +114,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d0/dce/classshaka_1_1media_1_1RsaPrivateKey.html b/docs/d0/dce/classshaka_1_1media_1_1RsaPrivateKey.html index aaa33eebe8..29eb58f750 100644 --- a/docs/d0/dce/classshaka_1_1media_1_1RsaPrivateKey.html +++ b/docs/d0/dce/classshaka_1_1media_1_1RsaPrivateKey.html @@ -141,7 +141,7 @@ Static Public Member Functions

Create an RsaPrivateKey object using a DER encoded PKCS#1 RSAPrivateKey.

Returns
The created RsaPrivateKey object on success, NULL otherwise.
-

Definition at line 97 of file rsa_key.cc.

+

Definition at line 96 of file rsa_key.cc.

@@ -177,7 +177,7 @@ Static Public Member Functions
Returns
true if successful, false otherwise.
-

Definition at line 102 of file rsa_key.cc.

+

Definition at line 101 of file rsa_key.cc.

@@ -213,7 +213,7 @@ Static Public Member Functions
Returns
true if successful, false otherwise.
-

Definition at line 130 of file rsa_key.cc.

+

Definition at line 127 of file rsa_key.cc.

@@ -224,7 +224,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 e6ea849b3c..2b93d8e657 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 @@ -173,7 +173,7 @@ Additional Inherited Members diff --git a/docs/d0/dd4/classshaka_1_1media_1_1ProtectionSystemSpecificInfo.html b/docs/d0/dd4/classshaka_1_1media_1_1ProtectionSystemSpecificInfo.html index 2d454b958a..9e3ed4b8e3 100644 --- a/docs/d0/dd4/classshaka_1_1media_1_1ProtectionSystemSpecificInfo.html +++ b/docs/d0/dd4/classshaka_1_1media_1_1ProtectionSystemSpecificInfo.html @@ -222,7 +222,7 @@ Static Public Member Functions diff --git a/docs/d0/dd6/webm__crypto__helpers_8cc_source.html b/docs/d0/dd6/webm__crypto__helpers_8cc_source.html index 1a5d9be01d..45b729cb06 100644 --- a/docs/d0/dd6/webm__crypto__helpers_8cc_source.html +++ b/docs/d0/dd6/webm__crypto__helpers_8cc_source.html @@ -205,7 +205,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d0/dd8/classshaka_1_1media_1_1AesCtrEncryptor.html b/docs/d0/dd8/classshaka_1_1media_1_1AesCtrEncryptor.html index 3245201267..ae4b7366f4 100644 --- a/docs/d0/dd8/classshaka_1_1media_1_1AesCtrEncryptor.html +++ b/docs/d0/dd8/classshaka_1_1media_1_1AesCtrEncryptor.html @@ -165,7 +165,7 @@ AES_KEY * mutable_aes_key< diff --git a/docs/d0/dee/segmenter__test__base_8h_source.html b/docs/d0/dee/segmenter__test__base_8h_source.html index 267b7803ba..0de56450af 100644 --- a/docs/d0/dee/segmenter__test__base_8h_source.html +++ b/docs/d0/dee/segmenter__test__base_8h_source.html @@ -216,7 +216,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d0/df3/packager__util_8cc_source.html b/docs/d0/df3/packager__util_8cc_source.html index d72355d9de..8b089d3f1e 100644 --- a/docs/d0/df3/packager__util_8cc_source.html +++ b/docs/d0/df3/packager__util_8cc_source.html @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
36 namespace shaka {
37 namespace media {
38 
-
39 void DumpStreamInfo(const std::vector<MediaStream*>& streams) {
+
39 void DumpStreamInfo(const std::vector<std::unique_ptr<MediaStream>>& streams) {
40  printf("Found %zu stream(s).\n", streams.size());
41  for (size_t i = 0; i < streams.size(); ++i)
42  printf("Stream [%zu] %s\n", i, streams[i]->info()->ToString().c_str());
@@ -269,64 +269,66 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
180  return true;
181 }
182 
-
183 MediaStream* FindFirstStreamOfType(const std::vector<MediaStream*>& streams,
-
184  StreamType stream_type) {
-
185  typedef std::vector<MediaStream*>::const_iterator StreamIterator;
-
186  for (StreamIterator it = streams.begin(); it != streams.end(); ++it) {
-
187  if ((*it)->info()->stream_type() == stream_type)
-
188  return *it;
+
183 MediaStream* FindFirstStreamOfType(
+
184  const std::vector<std::unique_ptr<MediaStream>>& streams,
+
185  StreamType stream_type) {
+
186  for (const std::unique_ptr<MediaStream>& stream : streams) {
+
187  if (stream->info()->stream_type() == stream_type)
+
188  return stream.get();
189  }
-
190  return NULL;
+
190  return nullptr;
191 }
-
192 MediaStream* FindFirstVideoStream(const std::vector<MediaStream*>& streams) {
-
193  return FindFirstStreamOfType(streams, kStreamVideo);
-
194 }
-
195 MediaStream* FindFirstAudioStream(const std::vector<MediaStream*>& streams) {
-
196  return FindFirstStreamOfType(streams, kStreamAudio);
-
197 }
-
198 
-
199 bool AddStreamToMuxer(const std::vector<MediaStream*>& streams,
-
200  const std::string& stream_selector,
-
201  const std::string& language_override,
-
202  Muxer* muxer) {
-
203  DCHECK(muxer);
-
204 
-
205  MediaStream* stream = NULL;
-
206  if (stream_selector == "video") {
-
207  stream = FindFirstVideoStream(streams);
-
208  } else if (stream_selector == "audio") {
-
209  stream = FindFirstAudioStream(streams);
-
210  } else {
-
211  // Expect stream_selector to be a zero based stream id.
-
212  size_t stream_id;
-
213  if (!base::StringToSizeT(stream_selector, &stream_id) ||
-
214  stream_id >= streams.size()) {
-
215  LOG(ERROR) << "Invalid argument --stream=" << stream_selector << "; "
-
216  << "should be 'audio', 'video', or a number within [0, "
-
217  << streams.size() - 1 << "].";
-
218  return false;
-
219  }
-
220  stream = streams[stream_id];
-
221  DCHECK(stream);
-
222  }
-
223 
-
224  // This could occur only if stream_selector=audio|video and the corresponding
-
225  // stream does not exist in the input.
-
226  if (!stream) {
-
227  LOG(ERROR) << "No " << stream_selector << " stream found in the input.";
-
228  return false;
-
229  }
-
230 
-
231  if (!language_override.empty()) {
-
232  stream->info()->set_language(language_override);
-
233  }
-
234 
-
235  muxer->AddStream(stream);
-
236  return true;
-
237 }
-
238 
-
239 } // namespace media
-
240 } // namespace shaka
+
192 MediaStream* FindFirstVideoStream(
+
193  const std::vector<std::unique_ptr<MediaStream>>& streams) {
+
194  return FindFirstStreamOfType(streams, kStreamVideo);
+
195 }
+
196 MediaStream* FindFirstAudioStream(
+
197  const std::vector<std::unique_ptr<MediaStream>>& streams) {
+
198  return FindFirstStreamOfType(streams, kStreamAudio);
+
199 }
+
200 
+
201 bool AddStreamToMuxer(const std::vector<std::unique_ptr<MediaStream>>& streams,
+
202  const std::string& stream_selector,
+
203  const std::string& language_override,
+
204  Muxer* muxer) {
+
205  DCHECK(muxer);
+
206 
+
207  MediaStream* stream = nullptr;
+
208  if (stream_selector == "video") {
+
209  stream = FindFirstVideoStream(streams);
+
210  } else if (stream_selector == "audio") {
+
211  stream = FindFirstAudioStream(streams);
+
212  } else {
+
213  // Expect stream_selector to be a zero based stream id.
+
214  size_t stream_id;
+
215  if (!base::StringToSizeT(stream_selector, &stream_id) ||
+
216  stream_id >= streams.size()) {
+
217  LOG(ERROR) << "Invalid argument --stream=" << stream_selector << "; "
+
218  << "should be 'audio', 'video', or a number within [0, "
+
219  << streams.size() - 1 << "].";
+
220  return false;
+
221  }
+
222  stream = streams[stream_id].get();
+
223  DCHECK(stream);
+
224  }
+
225 
+
226  // This could occur only if stream_selector=audio|video and the corresponding
+
227  // stream does not exist in the input.
+
228  if (!stream) {
+
229  LOG(ERROR) << "No " << stream_selector << " stream found in the input.";
+
230  return false;
+
231  }
+
232 
+
233  if (!language_override.empty()) {
+
234  stream->info()->set_language(language_override);
+
235  }
+
236 
+
237  muxer->AddStream(stream);
+
238  return true;
+
239 }
+
240 
+
241 } // namespace media
+
242 } // namespace shaka
static RsaRequestSigner * CreateSigner(const std::string &signer_name, const std::string &pkcs1_rsa_key)
static AesRequestSigner * CreateSigner(const std::string &signer_name, const std::string &aes_key_hex, const std::string &iv_hex)
static std::unique_ptr< FixedKeySource > CreateFromHexStrings(const std::string &key_id_hex, const std::string &key_hex, const std::string &pssh_boxes_hex, const std::string &iv_hex)
@@ -334,7 +336,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 60bed78976..c62f66ac2f 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 @@ -120,7 +120,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/d0a/classshaka_1_1media_1_1MkvWriter.html b/docs/d1/d0a/classshaka_1_1media_1_1MkvWriter.html index 8ecb6db01c..ac9e0d05c4 100644 --- a/docs/d1/d0a/classshaka_1_1media_1_1MkvWriter.html +++ b/docs/d1/d0a/classshaka_1_1media_1_1MkvWriter.html @@ -376,7 +376,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 7e621c1dec..5078a41672 100644 --- a/docs/d1/d0a/structshaka_1_1media_1_1H264Sps.html +++ b/docs/d1/d0a/structshaka_1_1media_1_1H264Sps.html @@ -234,7 +234,7 @@ int chroma_array_type<

Detailed Description

-

Definition at line 36 of file h264_parser.h.

+

Definition at line 37 of file h264_parser.h.


The documentation for this struct was generated from the following files:
  • media/codecs/h264_parser.h
  • media/codecs/h264_parser.cc
  • @@ -242,7 +242,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 e8f632e919..0279769dbb 100644 --- a/docs/d1/d0b/hevc__decoder__configuration__record_8cc_source.html +++ b/docs/d1/d0b/hevc__decoder__configuration__record_8cc_source.html @@ -256,7 +256,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 3a56d3569c..00b8b2d213 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 @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/d13/status_8h_source.html b/docs/d1/d13/status_8h_source.html index 296d845fa5..29679789aa 100644 --- a/docs/d1/d13/status_8h_source.html +++ b/docs/d1/d13/status_8h_source.html @@ -239,7 +239,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 e7cbbd825b..7ced17916b 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 @@ -277,7 +277,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/d1d/muxer__flags_8cc_source.html b/docs/d1/d1d/muxer__flags_8cc_source.html index c8c708b182..924b3a0fa7 100644 --- a/docs/d1/d1d/muxer__flags_8cc_source.html +++ b/docs/d1/d1d/muxer__flags_8cc_source.html @@ -144,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/d1f/classshaka_1_1media_1_1KeySource.html b/docs/d1/d1f/classshaka_1_1media_1_1KeySource.html index 10f679fa89..8fd039bc37 100644 --- a/docs/d1/d1f/classshaka_1_1media_1_1KeySource.html +++ b/docs/d1/d1f/classshaka_1_1media_1_1KeySource.html @@ -407,7 +407,7 @@ static std::string  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 716ab68bc7..8346bf5cff 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 @@ -235,7 +235,7 @@ Public Member Functions diff --git a/docs/d1/d27/key__fetcher_8h_source.html b/docs/d1/d27/key__fetcher_8h_source.html index 79fa959ebf..ede5048ad0 100644 --- a/docs/d1/d27/key__fetcher_8h_source.html +++ b/docs/d1/d27/key__fetcher_8h_source.html @@ -126,7 +126,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 97bde72df5..73d1db461b 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 @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/d2a/decryptor__source_8cc_source.html b/docs/d1/d2a/decryptor__source_8cc_source.html index 58a7c0ac11..a1341b61f9 100644 --- a/docs/d1/d2a/decryptor__source_8cc_source.html +++ b/docs/d1/d2a/decryptor__source_8cc_source.html @@ -96,120 +96,117 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
    7 #include "packager/media/base/decryptor_source.h"
    8 
    9 #include "packager/base/logging.h"
    -
    10 #include "packager/base/stl_util.h"
    -
    11 #include "packager/media/base/aes_decryptor.h"
    -
    12 #include "packager/media/base/aes_pattern_cryptor.h"
    -
    13 
    -
    14 namespace shaka {
    -
    15 namespace media {
    -
    16 
    -
    17 DecryptorSource::DecryptorSource(KeySource* key_source)
    -
    18  : key_source_(key_source) {
    -
    19  CHECK(key_source);
    -
    20 }
    -
    21 DecryptorSource::~DecryptorSource() {
    -
    22  STLDeleteValues(&decryptor_map_);
    -
    23 }
    -
    24 
    -
    25 bool DecryptorSource::DecryptSampleBuffer(const DecryptConfig* decrypt_config,
    -
    26  uint8_t* buffer,
    -
    27  size_t buffer_size) {
    -
    28  DCHECK(decrypt_config);
    -
    29  DCHECK(buffer);
    -
    30 
    -
    31  // Get the decryptor object.
    -
    32  AesCryptor* decryptor;
    -
    33  auto found = decryptor_map_.find(decrypt_config->key_id());
    -
    34  if (found == decryptor_map_.end()) {
    -
    35  // Create new AesDecryptor based on decryption mode.
    -
    36  EncryptionKey key;
    -
    37  Status status(key_source_->GetKey(decrypt_config->key_id(), &key));
    -
    38  if (!status.ok()) {
    -
    39  LOG(ERROR) << "Error retrieving decryption key: " << status;
    -
    40  return false;
    -
    41  }
    -
    42 
    -
    43  std::unique_ptr<AesCryptor> aes_decryptor;
    -
    44  switch (decrypt_config->protection_scheme()) {
    -
    45  case FOURCC_cenc:
    -
    46  aes_decryptor.reset(new AesCtrDecryptor);
    +
    10 #include "packager/media/base/aes_decryptor.h"
    +
    11 #include "packager/media/base/aes_pattern_cryptor.h"
    +
    12 
    +
    13 namespace shaka {
    +
    14 namespace media {
    +
    15 
    +
    16 DecryptorSource::DecryptorSource(KeySource* key_source)
    +
    17  : key_source_(key_source) {
    +
    18  CHECK(key_source);
    +
    19 }
    +
    20 DecryptorSource::~DecryptorSource() {}
    +
    21 
    +
    22 bool DecryptorSource::DecryptSampleBuffer(const DecryptConfig* decrypt_config,
    +
    23  uint8_t* buffer,
    +
    24  size_t buffer_size) {
    +
    25  DCHECK(decrypt_config);
    +
    26  DCHECK(buffer);
    +
    27 
    +
    28  // Get the decryptor object.
    +
    29  AesCryptor* decryptor = nullptr;
    +
    30  auto found = decryptor_map_.find(decrypt_config->key_id());
    +
    31  if (found == decryptor_map_.end()) {
    +
    32  // Create new AesDecryptor based on decryption mode.
    +
    33  EncryptionKey key;
    +
    34  Status status(key_source_->GetKey(decrypt_config->key_id(), &key));
    +
    35  if (!status.ok()) {
    +
    36  LOG(ERROR) << "Error retrieving decryption key: " << status;
    +
    37  return false;
    +
    38  }
    +
    39 
    +
    40  std::unique_ptr<AesCryptor> aes_decryptor;
    +
    41  switch (decrypt_config->protection_scheme()) {
    +
    42  case FOURCC_cenc:
    +
    43  aes_decryptor.reset(new AesCtrDecryptor);
    +
    44  break;
    +
    45  case FOURCC_cbc1:
    +
    46  aes_decryptor.reset(new AesCbcDecryptor(kNoPadding));
    47  break;
    -
    48  case FOURCC_cbc1:
    -
    49  aes_decryptor.reset(new AesCbcDecryptor(kNoPadding));
    -
    50  break;
    -
    51  case FOURCC_cens:
    -
    52  aes_decryptor.reset(new AesPatternCryptor(
    -
    53  decrypt_config->crypt_byte_block(),
    -
    54  decrypt_config->skip_byte_block(),
    - -
    56  AesCryptor::kDontUseConstantIv,
    -
    57  std::unique_ptr<AesCryptor>(new AesCtrDecryptor())));
    -
    58  break;
    -
    59  case FOURCC_cbcs:
    -
    60  aes_decryptor.reset(new AesPatternCryptor(
    -
    61  decrypt_config->crypt_byte_block(),
    -
    62  decrypt_config->skip_byte_block(),
    - -
    64  AesCryptor::kUseConstantIv,
    -
    65  std::unique_ptr<AesCryptor>(new AesCbcDecryptor(kNoPadding))));
    -
    66  break;
    -
    67  default:
    -
    68  LOG(ERROR) << "Unsupported protection scheme: "
    -
    69  << decrypt_config->protection_scheme();
    -
    70  return false;
    -
    71  }
    -
    72 
    -
    73  if (!aes_decryptor->InitializeWithIv(key.key, decrypt_config->iv())) {
    -
    74  LOG(ERROR) << "Failed to initialize AesDecryptor for decryption.";
    -
    75  return false;
    -
    76  }
    -
    77  decryptor = aes_decryptor.release();
    -
    78  decryptor_map_[decrypt_config->key_id()] = decryptor;
    -
    79  } else {
    -
    80  decryptor = found->second;
    -
    81  }
    -
    82  if (!decryptor->SetIv(decrypt_config->iv())) {
    -
    83  LOG(ERROR) << "Invalid initialization vector.";
    -
    84  return false;
    -
    85  }
    -
    86 
    -
    87  if (decrypt_config->subsamples().empty()) {
    -
    88  // Sample not encrypted using subsample encryption. Decrypt whole.
    -
    89  if (!decryptor->Crypt(buffer, buffer_size, buffer)) {
    -
    90  LOG(ERROR) << "Error during bulk sample decryption.";
    -
    91  return false;
    -
    92  }
    -
    93  return true;
    -
    94  }
    -
    95 
    -
    96  // Subsample decryption.
    -
    97  const std::vector<SubsampleEntry>& subsamples = decrypt_config->subsamples();
    -
    98  uint8_t* current_ptr = buffer;
    -
    99  const uint8_t* const buffer_end = buffer + buffer_size;
    -
    100  for (const auto& subsample : subsamples) {
    -
    101  if ((current_ptr + subsample.clear_bytes + subsample.cipher_bytes) >
    -
    102  buffer_end) {
    -
    103  LOG(ERROR) << "Subsamples overflow sample buffer.";
    -
    104  return false;
    -
    105  }
    -
    106  current_ptr += subsample.clear_bytes;
    -
    107  if (!decryptor->Crypt(current_ptr, subsample.cipher_bytes, current_ptr)) {
    -
    108  LOG(ERROR) << "Error decrypting subsample buffer.";
    -
    109  return false;
    -
    110  }
    -
    111  current_ptr += subsample.cipher_bytes;
    -
    112  }
    -
    113  return true;
    -
    114 }
    -
    115 
    -
    116 } // namespace media
    -
    117 } // namespace shaka
    +
    48  case FOURCC_cens:
    +
    49  aes_decryptor.reset(new AesPatternCryptor(
    +
    50  decrypt_config->crypt_byte_block(),
    +
    51  decrypt_config->skip_byte_block(),
    + +
    53  AesCryptor::kDontUseConstantIv,
    +
    54  std::unique_ptr<AesCryptor>(new AesCtrDecryptor())));
    +
    55  break;
    +
    56  case FOURCC_cbcs:
    +
    57  aes_decryptor.reset(new AesPatternCryptor(
    +
    58  decrypt_config->crypt_byte_block(),
    +
    59  decrypt_config->skip_byte_block(),
    + +
    61  AesCryptor::kUseConstantIv,
    +
    62  std::unique_ptr<AesCryptor>(new AesCbcDecryptor(kNoPadding))));
    +
    63  break;
    +
    64  default:
    +
    65  LOG(ERROR) << "Unsupported protection scheme: "
    +
    66  << decrypt_config->protection_scheme();
    +
    67  return false;
    +
    68  }
    +
    69 
    +
    70  if (!aes_decryptor->InitializeWithIv(key.key, decrypt_config->iv())) {
    +
    71  LOG(ERROR) << "Failed to initialize AesDecryptor for decryption.";
    +
    72  return false;
    +
    73  }
    +
    74  decryptor = aes_decryptor.get();
    +
    75  decryptor_map_[decrypt_config->key_id()] = std::move(aes_decryptor);
    +
    76  } else {
    +
    77  decryptor = found->second.get();
    +
    78  }
    +
    79  if (!decryptor->SetIv(decrypt_config->iv())) {
    +
    80  LOG(ERROR) << "Invalid initialization vector.";
    +
    81  return false;
    +
    82  }
    +
    83 
    +
    84  if (decrypt_config->subsamples().empty()) {
    +
    85  // Sample not encrypted using subsample encryption. Decrypt whole.
    +
    86  if (!decryptor->Crypt(buffer, buffer_size, buffer)) {
    +
    87  LOG(ERROR) << "Error during bulk sample decryption.";
    +
    88  return false;
    +
    89  }
    +
    90  return true;
    +
    91  }
    +
    92 
    +
    93  // Subsample decryption.
    +
    94  const std::vector<SubsampleEntry>& subsamples = decrypt_config->subsamples();
    +
    95  uint8_t* current_ptr = buffer;
    +
    96  const uint8_t* const buffer_end = buffer + buffer_size;
    +
    97  for (const auto& subsample : subsamples) {
    +
    98  if ((current_ptr + subsample.clear_bytes + subsample.cipher_bytes) >
    +
    99  buffer_end) {
    +
    100  LOG(ERROR) << "Subsamples overflow sample buffer.";
    +
    101  return false;
    +
    102  }
    +
    103  current_ptr += subsample.clear_bytes;
    +
    104  if (!decryptor->Crypt(current_ptr, subsample.cipher_bytes, current_ptr)) {
    +
    105  LOG(ERROR) << "Error decrypting subsample buffer.";
    +
    106  return false;
    +
    107  }
    +
    108  current_ptr += subsample.cipher_bytes;
    +
    109  }
    +
    110  return true;
    +
    111 }
    +
    112 
    +
    113 } // namespace media
    +
    114 } // namespace shaka
    virtual Status GetKey(TrackType track_type, EncryptionKey *key)=0
    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 4183913a3c..b18ca9eaf2 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 2b161cefcd..d8355332c2 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 @@ -385,7 +385,7 @@ class BoxBuffer diff --git a/docs/d1/d2f/webvtt__media__parser_8cc_source.html b/docs/d1/d2f/webvtt__media__parser_8cc_source.html index 039e3de4c5..a9252a4214 100644 --- a/docs/d1/d2f/webvtt__media__parser_8cc_source.html +++ b/docs/d1/d2f/webvtt__media__parser_8cc_source.html @@ -488,7 +488,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 70909d0c05..79d9ef3d43 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 @@ -142,7 +142,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 19a006a1c0..ee68cda150 100644 --- a/docs/d1/d31/classshaka_1_1xml_1_1XmlNode.html +++ b/docs/d1/d31/classshaka_1_1xml_1_1XmlNode.html @@ -168,7 +168,7 @@ bool 55 of file xml_node.cc.

    +

    Definition at line 54 of file xml_node.cc.

    @@ -195,7 +195,7 @@ bool 
    Returns
    true on success, false otherwise.
    -

    Definition at line 62 of file xml_node.cc.

    +

    Definition at line 61 of file xml_node.cc.

    @@ -213,7 +213,7 @@ bool 
    Returns
    Raw pointer to the element.
    -

    Definition at line 149 of file xml_node.cc.

    +

    Definition at line 148 of file xml_node.cc.

    @@ -232,7 +232,7 @@ bool 
    Returns
    The resource of this object.
    -

    Definition at line 137 of file xml_node.cc.

    +

    Definition at line 136 of file xml_node.cc.

    @@ -250,7 +250,7 @@ bool 

    Release the xmlNodePtr of this object. After calling this method, the behavior of any methods, except the destructor, is undefined.

    -

    Definition at line 143 of file xml_node.cc.

    +

    Definition at line 142 of file xml_node.cc.

    @@ -275,7 +275,7 @@ bool 132 of file xml_node.cc.

    +

    Definition at line 131 of file xml_node.cc.

    @@ -311,7 +311,7 @@ bool 119 of file xml_node.cc.

    +

    Definition at line 118 of file xml_node.cc.

    @@ -336,7 +336,7 @@ bool 128 of file xml_node.cc.

    +

    Definition at line 127 of file xml_node.cc.

    @@ -372,7 +372,7 @@ bool 111 of file xml_node.cc.

    +

    Definition at line 110 of file xml_node.cc.

    @@ -408,7 +408,7 @@ bool 104 of file xml_node.cc.

    +

    Definition at line 103 of file xml_node.cc.

    @@ -419,7 +419,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 42f05c082f..c1a4a62598 100644 --- a/docs/d1/d34/structshaka_1_1media_1_1SubsampleEntry.html +++ b/docs/d1/d34/structshaka_1_1media_1_1SubsampleEntry.html @@ -122,7 +122,7 @@ uint32_t cipher_bytes< diff --git a/docs/d1/d37/es__parser__h264_8h_source.html b/docs/d1/d37/es__parser__h264_8h_source.html index 4ba203c349..59f1d9d782 100644 --- a/docs/d1/d37/es__parser__h264_8h_source.html +++ b/docs/d1/d37/es__parser__h264_8h_source.html @@ -150,7 +150,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/d3b/mpd__generator__flags_8h_source.html b/docs/d1/d3b/mpd__generator__flags_8h_source.html index 5bab622e58..5af5ddc00c 100644 --- a/docs/d1/d3b/mpd__generator__flags_8h_source.html +++ b/docs/d1/d3b/mpd__generator__flags_8h_source.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 1fb5339b74..a3e951bdc8 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 @@ -176,7 +176,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 3fc6dc1cee..76ac175cd5 100644 --- a/docs/d1/d40/classshaka_1_1MpdWriter-members.html +++ b/docs/d1/d40/classshaka_1_1MpdWriter-members.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/d45/decoding__time__iterator_8cc_source.html b/docs/d1/d45/decoding__time__iterator_8cc_source.html index 2927b1e532..da47cdba6c 100644 --- a/docs/d1/d45/decoding__time__iterator_8cc_source.html +++ b/docs/d1/d45/decoding__time__iterator_8cc_source.html @@ -168,7 +168,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/d48/text__track__config_8h_source.html b/docs/d1/d48/text__track__config_8h_source.html index 7b54d9eed6..23a698eebc 100644 --- a/docs/d1/d48/text__track__config_8h_source.html +++ b/docs/d1/d48/text__track__config_8h_source.html @@ -139,7 +139,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 558eef0bfa..57d46c138f 100644 --- a/docs/d1/d4f/classshaka_1_1media_1_1OffsetByteQueue-members.html +++ b/docs/d1/d4f/classshaka_1_1media_1_1OffsetByteQueue-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 2db3d72b37..0265cb96d6 100644 --- a/docs/d1/d5a/structshaka_1_1media_1_1EncryptionKey-members.html +++ b/docs/d1/d5a/structshaka_1_1media_1_1EncryptionKey-members.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 b127ed514a..3854f9de60 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 @@ -222,7 +222,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 edd27287d9..6ff9a3dd8b 100644 --- a/docs/d1/d70/vp8__parser_8cc_source.html +++ b/docs/d1/d70/vp8__parser_8cc_source.html @@ -293,7 +293,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/d72/language__utils_8cc_source.html b/docs/d1/d72/language__utils_8cc_source.html index 8b0fc441f6..d2f32bcc29 100644 --- a/docs/d1/d72/language__utils_8cc_source.html +++ b/docs/d1/d72/language__utils_8cc_source.html @@ -226,7 +226,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/d74/mp2t__media__parser_8cc_source.html b/docs/d1/d74/mp2t__media__parser_8cc_source.html index ac3106e00c..711e3013d1 100644 --- a/docs/d1/d74/mp2t__media__parser_8cc_source.html +++ b/docs/d1/d74/mp2t__media__parser_8cc_source.html @@ -95,445 +95,443 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
    6 
    7 #include <memory>
    8 #include "packager/base/bind.h"
    -
    9 #include "packager/base/stl_util.h"
    -
    10 #include "packager/media/base/media_sample.h"
    -
    11 #include "packager/media/base/stream_info.h"
    -
    12 #include "packager/media/formats/mp2t/es_parser.h"
    -
    13 #include "packager/media/formats/mp2t/es_parser_adts.h"
    -
    14 #include "packager/media/formats/mp2t/es_parser_h264.h"
    -
    15 #include "packager/media/formats/mp2t/es_parser_h265.h"
    -
    16 #include "packager/media/formats/mp2t/mp2t_common.h"
    -
    17 #include "packager/media/formats/mp2t/ts_packet.h"
    -
    18 #include "packager/media/formats/mp2t/ts_section.h"
    -
    19 #include "packager/media/formats/mp2t/ts_section_pat.h"
    -
    20 #include "packager/media/formats/mp2t/ts_section_pes.h"
    -
    21 #include "packager/media/formats/mp2t/ts_section_pmt.h"
    -
    22 
    -
    23 namespace shaka {
    -
    24 namespace media {
    -
    25 namespace mp2t {
    -
    26 
    -
    27 enum StreamType {
    -
    28  // ISO-13818.1 / ITU H.222 Table 2.34 "Stream type assignments"
    -
    29  kStreamTypeMpeg1Audio = 0x3,
    -
    30  kStreamTypeAAC = 0xf,
    -
    31  kStreamTypeAVC = 0x1b,
    -
    32  kStreamTypeHEVC = 0x24,
    -
    33 };
    -
    34 
    -
    35 class PidState {
    -
    36  public:
    -
    37  enum PidType {
    -
    38  kPidPat,
    -
    39  kPidPmt,
    -
    40  kPidAudioPes,
    -
    41  kPidVideoPes,
    -
    42  };
    -
    43 
    -
    44  PidState(int pid,
    -
    45  PidType pid_type,
    -
    46  std::unique_ptr<TsSection> section_parser);
    -
    47 
    -
    48  // Extract the content of the TS packet and parse it.
    -
    49  // Return true if successful.
    -
    50  bool PushTsPacket(const TsPacket& ts_packet);
    -
    51 
    -
    52  // Flush the PID state (possibly emitting some pending frames)
    -
    53  // and reset its state.
    -
    54  void Flush();
    -
    55 
    -
    56  // Enable/disable the PID.
    -
    57  // Disabling a PID will reset its state and ignore any further incoming TS
    -
    58  // packets.
    -
    59  void Enable();
    -
    60  void Disable();
    -
    61  bool IsEnabled() const;
    -
    62 
    -
    63  PidType pid_type() const { return pid_type_; }
    -
    64 
    -
    65  scoped_refptr<StreamInfo>& config() { return config_; }
    -
    66  void set_config(const scoped_refptr<StreamInfo>& config) { config_ = config; }
    -
    67 
    -
    68  SampleQueue& sample_queue() { return sample_queue_; }
    -
    69 
    -
    70  private:
    -
    71  void ResetState();
    -
    72 
    -
    73  int pid_;
    -
    74  PidType pid_type_;
    -
    75  std::unique_ptr<TsSection> section_parser_;
    -
    76 
    -
    77  bool enable_;
    -
    78  int continuity_counter_;
    -
    79  scoped_refptr<StreamInfo> config_;
    -
    80  SampleQueue sample_queue_;
    -
    81 };
    -
    82 
    -
    83 PidState::PidState(int pid,
    -
    84  PidType pid_type,
    -
    85  std::unique_ptr<TsSection> section_parser)
    -
    86  : pid_(pid),
    -
    87  pid_type_(pid_type),
    -
    88  section_parser_(std::move(section_parser)),
    -
    89  enable_(false),
    -
    90  continuity_counter_(-1) {
    -
    91  DCHECK(section_parser_);
    -
    92 }
    -
    93 
    -
    94 bool PidState::PushTsPacket(const TsPacket& ts_packet) {
    -
    95  DCHECK_EQ(ts_packet.pid(), pid_);
    -
    96 
    -
    97  // The current PID is not part of the PID filter,
    -
    98  // just discard the incoming TS packet.
    -
    99  if (!enable_)
    -
    100  return true;
    -
    101 
    -
    102  int expected_continuity_counter = (continuity_counter_ + 1) % 16;
    -
    103  if (continuity_counter_ >= 0 &&
    -
    104  ts_packet.continuity_counter() != expected_continuity_counter) {
    -
    105  DVLOG(1) << "TS discontinuity detected for pid: " << pid_;
    -
    106  // TODO(tinskip): Handle discontinuity better.
    -
    107  return false;
    -
    108  }
    -
    109 
    -
    110  bool status = section_parser_->Parse(
    -
    111  ts_packet.payload_unit_start_indicator(),
    -
    112  ts_packet.payload(),
    -
    113  ts_packet.payload_size());
    -
    114 
    -
    115  // At the minimum, when parsing failed, auto reset the section parser.
    -
    116  // Components that use the Mp2tMediaParser can take further action if needed.
    -
    117  if (!status) {
    -
    118  DVLOG(1) << "Parsing failed for pid = " << pid_;
    -
    119  ResetState();
    -
    120  }
    -
    121 
    -
    122  return status;
    -
    123 }
    -
    124 
    -
    125 void PidState::Flush() {
    -
    126  section_parser_->Flush();
    -
    127  ResetState();
    -
    128 }
    -
    129 
    -
    130 void PidState::Enable() {
    -
    131  enable_ = true;
    -
    132 }
    -
    133 
    -
    134 void PidState::Disable() {
    -
    135  if (!enable_)
    -
    136  return;
    -
    137 
    -
    138  ResetState();
    -
    139  enable_ = false;
    -
    140 }
    -
    141 
    -
    142 bool PidState::IsEnabled() const {
    -
    143  return enable_;
    -
    144 }
    -
    145 
    -
    146 void PidState::ResetState() {
    -
    147  section_parser_->Reset();
    -
    148  continuity_counter_ = -1;
    -
    149 }
    -
    150 
    -
    151 Mp2tMediaParser::Mp2tMediaParser()
    -
    152  : sbr_in_mimetype_(false),
    -
    153  is_initialized_(false) {
    -
    154 }
    -
    155 
    -
    156 Mp2tMediaParser::~Mp2tMediaParser() {
    -
    157  STLDeleteValues(&pids_);
    -
    158 }
    -
    159 
    - -
    161  const InitCB& init_cb,
    -
    162  const NewSampleCB& new_sample_cb,
    -
    163  KeySource* decryption_key_source) {
    -
    164  DCHECK(!is_initialized_);
    -
    165  DCHECK(init_cb_.is_null());
    -
    166  DCHECK(!init_cb.is_null());
    -
    167  DCHECK(!new_sample_cb.is_null());
    -
    168 
    -
    169  init_cb_ = init_cb;
    -
    170  new_sample_cb_ = new_sample_cb;
    -
    171 }
    +
    9 #include "packager/media/base/media_sample.h"
    +
    10 #include "packager/media/base/stream_info.h"
    +
    11 #include "packager/media/formats/mp2t/es_parser.h"
    +
    12 #include "packager/media/formats/mp2t/es_parser_adts.h"
    +
    13 #include "packager/media/formats/mp2t/es_parser_h264.h"
    +
    14 #include "packager/media/formats/mp2t/es_parser_h265.h"
    +
    15 #include "packager/media/formats/mp2t/mp2t_common.h"
    +
    16 #include "packager/media/formats/mp2t/ts_packet.h"
    +
    17 #include "packager/media/formats/mp2t/ts_section.h"
    +
    18 #include "packager/media/formats/mp2t/ts_section_pat.h"
    +
    19 #include "packager/media/formats/mp2t/ts_section_pes.h"
    +
    20 #include "packager/media/formats/mp2t/ts_section_pmt.h"
    +
    21 
    +
    22 namespace shaka {
    +
    23 namespace media {
    +
    24 namespace mp2t {
    +
    25 
    +
    26 enum StreamType {
    +
    27  // ISO-13818.1 / ITU H.222 Table 2.34 "Stream type assignments"
    +
    28  kStreamTypeMpeg1Audio = 0x3,
    +
    29  kStreamTypeAAC = 0xf,
    +
    30  kStreamTypeAVC = 0x1b,
    +
    31  kStreamTypeHEVC = 0x24,
    +
    32 };
    +
    33 
    +
    34 class PidState {
    +
    35  public:
    +
    36  enum PidType {
    +
    37  kPidPat,
    +
    38  kPidPmt,
    +
    39  kPidAudioPes,
    +
    40  kPidVideoPes,
    +
    41  };
    +
    42 
    +
    43  PidState(int pid,
    +
    44  PidType pid_type,
    +
    45  std::unique_ptr<TsSection> section_parser);
    +
    46 
    +
    47  // Extract the content of the TS packet and parse it.
    +
    48  // Return true if successful.
    +
    49  bool PushTsPacket(const TsPacket& ts_packet);
    +
    50 
    +
    51  // Flush the PID state (possibly emitting some pending frames)
    +
    52  // and reset its state.
    +
    53  void Flush();
    +
    54 
    +
    55  // Enable/disable the PID.
    +
    56  // Disabling a PID will reset its state and ignore any further incoming TS
    +
    57  // packets.
    +
    58  void Enable();
    +
    59  void Disable();
    +
    60  bool IsEnabled() const;
    +
    61 
    +
    62  PidType pid_type() const { return pid_type_; }
    +
    63 
    +
    64  scoped_refptr<StreamInfo>& config() { return config_; }
    +
    65  void set_config(const scoped_refptr<StreamInfo>& config) { config_ = config; }
    +
    66 
    +
    67  SampleQueue& sample_queue() { return sample_queue_; }
    +
    68 
    +
    69  private:
    +
    70  void ResetState();
    +
    71 
    +
    72  int pid_;
    +
    73  PidType pid_type_;
    +
    74  std::unique_ptr<TsSection> section_parser_;
    +
    75 
    +
    76  bool enable_;
    +
    77  int continuity_counter_;
    +
    78  scoped_refptr<StreamInfo> config_;
    +
    79  SampleQueue sample_queue_;
    +
    80 };
    +
    81 
    +
    82 PidState::PidState(int pid,
    +
    83  PidType pid_type,
    +
    84  std::unique_ptr<TsSection> section_parser)
    +
    85  : pid_(pid),
    +
    86  pid_type_(pid_type),
    +
    87  section_parser_(std::move(section_parser)),
    +
    88  enable_(false),
    +
    89  continuity_counter_(-1) {
    +
    90  DCHECK(section_parser_);
    +
    91 }
    +
    92 
    +
    93 bool PidState::PushTsPacket(const TsPacket& ts_packet) {
    +
    94  DCHECK_EQ(ts_packet.pid(), pid_);
    +
    95 
    +
    96  // The current PID is not part of the PID filter,
    +
    97  // just discard the incoming TS packet.
    +
    98  if (!enable_)
    +
    99  return true;
    +
    100 
    +
    101  int expected_continuity_counter = (continuity_counter_ + 1) % 16;
    +
    102  if (continuity_counter_ >= 0 &&
    +
    103  ts_packet.continuity_counter() != expected_continuity_counter) {
    +
    104  DVLOG(1) << "TS discontinuity detected for pid: " << pid_;
    +
    105  // TODO(tinskip): Handle discontinuity better.
    +
    106  return false;
    +
    107  }
    +
    108 
    +
    109  bool status = section_parser_->Parse(
    +
    110  ts_packet.payload_unit_start_indicator(),
    +
    111  ts_packet.payload(),
    +
    112  ts_packet.payload_size());
    +
    113 
    +
    114  // At the minimum, when parsing failed, auto reset the section parser.
    +
    115  // Components that use the Mp2tMediaParser can take further action if needed.
    +
    116  if (!status) {
    +
    117  DVLOG(1) << "Parsing failed for pid = " << pid_;
    +
    118  ResetState();
    +
    119  }
    +
    120 
    +
    121  return status;
    +
    122 }
    +
    123 
    +
    124 void PidState::Flush() {
    +
    125  section_parser_->Flush();
    +
    126  ResetState();
    +
    127 }
    +
    128 
    +
    129 void PidState::Enable() {
    +
    130  enable_ = true;
    +
    131 }
    +
    132 
    +
    133 void PidState::Disable() {
    +
    134  if (!enable_)
    +
    135  return;
    +
    136 
    +
    137  ResetState();
    +
    138  enable_ = false;
    +
    139 }
    +
    140 
    +
    141 bool PidState::IsEnabled() const {
    +
    142  return enable_;
    +
    143 }
    +
    144 
    +
    145 void PidState::ResetState() {
    +
    146  section_parser_->Reset();
    +
    147  continuity_counter_ = -1;
    +
    148 }
    +
    149 
    +
    150 Mp2tMediaParser::Mp2tMediaParser()
    +
    151  : sbr_in_mimetype_(false),
    +
    152  is_initialized_(false) {
    +
    153 }
    +
    154 
    +
    155 Mp2tMediaParser::~Mp2tMediaParser() {}
    +
    156 
    + +
    158  const InitCB& init_cb,
    +
    159  const NewSampleCB& new_sample_cb,
    +
    160  KeySource* decryption_key_source) {
    +
    161  DCHECK(!is_initialized_);
    +
    162  DCHECK(init_cb_.is_null());
    +
    163  DCHECK(!init_cb.is_null());
    +
    164  DCHECK(!new_sample_cb.is_null());
    +
    165 
    +
    166  init_cb_ = init_cb;
    +
    167  new_sample_cb_ = new_sample_cb;
    +
    168 }
    +
    169 
    + +
    171  DVLOG(1) << "Mp2tMediaParser::Flush";
    172 
    - -
    174  DVLOG(1) << "Mp2tMediaParser::Flush";
    -
    175 
    -
    176  // Flush the buffers and reset the pids.
    -
    177  for (std::map<int, PidState*>::iterator it = pids_.begin();
    -
    178  it != pids_.end(); ++it) {
    -
    179  DVLOG(1) << "Flushing PID: " << it->first;
    -
    180  PidState* pid_state = it->second;
    -
    181  pid_state->Flush();
    -
    182  }
    -
    183  bool result = EmitRemainingSamples();
    -
    184  STLDeleteValues(&pids_);
    -
    185 
    -
    186  // Remove any bytes left in the TS buffer.
    -
    187  // (i.e. any partial TS packet => less than 188 bytes).
    -
    188  ts_byte_queue_.Reset();
    -
    189  return result;
    -
    190 }
    -
    191 
    -
    192 bool Mp2tMediaParser::Parse(const uint8_t* buf, int size) {
    -
    193  DVLOG(1) << "Mp2tMediaParser::Parse size=" << size;
    -
    194 
    -
    195  // Add the data to the parser state.
    -
    196  ts_byte_queue_.Push(buf, size);
    -
    197 
    -
    198  while (true) {
    -
    199  const uint8_t* ts_buffer;
    -
    200  int ts_buffer_size;
    -
    201  ts_byte_queue_.Peek(&ts_buffer, &ts_buffer_size);
    -
    202  if (ts_buffer_size < TsPacket::kPacketSize)
    -
    203  break;
    -
    204 
    -
    205  // Synchronization.
    -
    206  int skipped_bytes = TsPacket::Sync(ts_buffer, ts_buffer_size);
    -
    207  if (skipped_bytes > 0) {
    -
    208  DVLOG(1) << "Packet not aligned on a TS syncword:"
    -
    209  << " skipped_bytes=" << skipped_bytes;
    -
    210  ts_byte_queue_.Pop(skipped_bytes);
    -
    211  continue;
    -
    212  }
    -
    213 
    -
    214  // Parse the TS header, skipping 1 byte if the header is invalid.
    -
    215  std::unique_ptr<TsPacket> ts_packet(
    -
    216  TsPacket::Parse(ts_buffer, ts_buffer_size));
    -
    217  if (!ts_packet) {
    -
    218  DVLOG(1) << "Error: invalid TS packet";
    -
    219  ts_byte_queue_.Pop(1);
    -
    220  continue;
    -
    221  }
    -
    222  DVLOG(LOG_LEVEL_TS)
    -
    223  << "Processing PID=" << ts_packet->pid()
    -
    224  << " start_unit=" << ts_packet->payload_unit_start_indicator();
    -
    225 
    -
    226  // Parse the section.
    -
    227  std::map<int, PidState*>::iterator it = pids_.find(ts_packet->pid());
    -
    228  if (it == pids_.end() &&
    -
    229  ts_packet->pid() == TsSection::kPidPat) {
    -
    230  // Create the PAT state here if needed.
    -
    231  std::unique_ptr<TsSection> pat_section_parser(new TsSectionPat(
    -
    232  base::Bind(&Mp2tMediaParser::RegisterPmt, base::Unretained(this))));
    -
    233  std::unique_ptr<PidState> pat_pid_state(new PidState(
    -
    234  ts_packet->pid(), PidState::kPidPat, std::move(pat_section_parser)));
    -
    235  pat_pid_state->Enable();
    -
    236  it = pids_.insert(
    -
    237  std::pair<int, PidState*>(ts_packet->pid(),
    -
    238  pat_pid_state.release())).first;
    -
    239  }
    -
    240 
    -
    241  if (it != pids_.end()) {
    -
    242  if (!it->second->PushTsPacket(*ts_packet))
    -
    243  return false;
    -
    244  } else {
    -
    245  DVLOG(LOG_LEVEL_TS) << "Ignoring TS packet for pid: " << ts_packet->pid();
    -
    246  }
    -
    247 
    -
    248  // Go to the next packet.
    -
    249  ts_byte_queue_.Pop(TsPacket::kPacketSize);
    -
    250  }
    -
    251 
    -
    252  // Emit the A/V buffers that kept accumulating during TS parsing.
    -
    253  return EmitRemainingSamples();
    -
    254 }
    -
    255 
    -
    256 void Mp2tMediaParser::RegisterPmt(int program_number, int pmt_pid) {
    -
    257  DVLOG(1) << "RegisterPmt:"
    -
    258  << " program_number=" << program_number
    -
    259  << " pmt_pid=" << pmt_pid;
    -
    260 
    -
    261  // Only one TS program is allowed. Ignore the incoming program map table,
    -
    262  // if there is already one registered.
    -
    263  for (std::map<int, PidState*>::iterator it = pids_.begin();
    -
    264  it != pids_.end(); ++it) {
    -
    265  PidState* pid_state = it->second;
    -
    266  if (pid_state->pid_type() == PidState::kPidPmt) {
    -
    267  DVLOG_IF(1, pmt_pid != it->first) << "More than one program is defined";
    -
    268  return;
    -
    269  }
    -
    270  }
    -
    271 
    -
    272  // Create the PMT state here if needed.
    -
    273  DVLOG(1) << "Create a new PMT parser";
    -
    274  std::unique_ptr<TsSection> pmt_section_parser(new TsSectionPmt(base::Bind(
    -
    275  &Mp2tMediaParser::RegisterPes, base::Unretained(this), pmt_pid)));
    -
    276  std::unique_ptr<PidState> pmt_pid_state(
    -
    277  new PidState(pmt_pid, PidState::kPidPmt, std::move(pmt_section_parser)));
    -
    278  pmt_pid_state->Enable();
    -
    279  pids_.insert(std::pair<int, PidState*>(pmt_pid, pmt_pid_state.release()));
    -
    280 }
    -
    281 
    -
    282 void Mp2tMediaParser::RegisterPes(int pmt_pid,
    -
    283  int pes_pid,
    -
    284  int stream_type) {
    -
    285  DVLOG(1) << "RegisterPes:"
    -
    286  << " pes_pid=" << pes_pid
    -
    287  << " stream_type=" << std::hex << stream_type << std::dec;
    -
    288  std::map<int, PidState*>::iterator it = pids_.find(pes_pid);
    -
    289  if (it != pids_.end())
    -
    290  return;
    -
    291 
    -
    292  // Create a stream parser corresponding to the stream type.
    -
    293  bool is_audio = false;
    -
    294  std::unique_ptr<EsParser> es_parser;
    -
    295  if (stream_type == kStreamTypeAVC) {
    -
    296  es_parser.reset(
    -
    297  new EsParserH264(
    -
    298  pes_pid,
    -
    299  base::Bind(&Mp2tMediaParser::OnNewStreamInfo,
    -
    300  base::Unretained(this)),
    -
    301  base::Bind(&Mp2tMediaParser::OnEmitSample,
    -
    302  base::Unretained(this))));
    -
    303  } else if (stream_type == kStreamTypeHEVC) {
    -
    304  es_parser.reset(
    -
    305  new EsParserH265(
    -
    306  pes_pid,
    -
    307  base::Bind(&Mp2tMediaParser::OnNewStreamInfo,
    -
    308  base::Unretained(this)),
    -
    309  base::Bind(&Mp2tMediaParser::OnEmitSample,
    -
    310  base::Unretained(this))));
    -
    311  } else if (stream_type == kStreamTypeAAC) {
    -
    312  es_parser.reset(
    -
    313  new EsParserAdts(
    -
    314  pes_pid,
    -
    315  base::Bind(&Mp2tMediaParser::OnNewStreamInfo,
    -
    316  base::Unretained(this)),
    -
    317  base::Bind(&Mp2tMediaParser::OnEmitSample,
    -
    318  base::Unretained(this)),
    -
    319  sbr_in_mimetype_));
    -
    320  is_audio = true;
    -
    321  } else {
    -
    322  return;
    -
    323  }
    -
    324 
    -
    325  // Create the PES state here.
    -
    326  DVLOG(1) << "Create a new PES state";
    -
    327  std::unique_ptr<TsSection> pes_section_parser(
    -
    328  new TsSectionPes(std::move(es_parser)));
    -
    329  PidState::PidType pid_type =
    -
    330  is_audio ? PidState::kPidAudioPes : PidState::kPidVideoPes;
    -
    331  std::unique_ptr<PidState> pes_pid_state(
    -
    332  new PidState(pes_pid, pid_type, std::move(pes_section_parser)));
    -
    333  pes_pid_state->Enable();
    -
    334  pids_.insert(std::pair<int, PidState*>(pes_pid, pes_pid_state.release()));
    -
    335 }
    -
    336 
    -
    337 void Mp2tMediaParser::OnNewStreamInfo(
    -
    338  const scoped_refptr<StreamInfo>& new_stream_info) {
    -
    339  DCHECK(new_stream_info);
    -
    340  DVLOG(1) << "OnVideoConfigChanged for pid=" << new_stream_info->track_id();
    -
    341 
    -
    342  PidMap::iterator pid_state = pids_.find(new_stream_info->track_id());
    -
    343  if (pid_state == pids_.end()) {
    -
    344  LOG(ERROR) << "PID State for new stream not found (pid = "
    -
    345  << new_stream_info->track_id() << ").";
    -
    346  return;
    -
    347  }
    -
    348 
    -
    349  // Set the stream configuration information for the PID.
    -
    350  pid_state->second->set_config(new_stream_info);
    -
    351 
    -
    352  // Finish initialization if all streams have configs.
    -
    353  FinishInitializationIfNeeded();
    -
    354 }
    -
    355 
    -
    356 bool Mp2tMediaParser::FinishInitializationIfNeeded() {
    -
    357  // Nothing to be done if already initialized.
    -
    358  if (is_initialized_)
    -
    359  return true;
    -
    360 
    -
    361  // Wait for more data to come to finish initialization.
    -
    362  if (pids_.empty())
    -
    363  return true;
    -
    364 
    -
    365  std::vector<scoped_refptr<StreamInfo> > all_stream_info;
    -
    366  uint32_t num_es(0);
    -
    367  for (PidMap::const_iterator iter = pids_.begin(); iter != pids_.end();
    -
    368  ++iter) {
    -
    369  if (((iter->second->pid_type() == PidState::kPidAudioPes) ||
    -
    370  (iter->second->pid_type() == PidState::kPidVideoPes))) {
    -
    371  ++num_es;
    -
    372  if (iter->second->config())
    -
    373  all_stream_info.push_back(iter->second->config());
    -
    374  }
    -
    375  }
    -
    376  if (num_es && (all_stream_info.size() == num_es)) {
    -
    377  // All stream configurations have been received. Initialization can
    -
    378  // be completed.
    -
    379  init_cb_.Run(all_stream_info);
    -
    380  DVLOG(1) << "Mpeg2TS stream parser initialization done";
    -
    381  is_initialized_ = true;
    -
    382  }
    -
    383  return true;
    -
    384 }
    -
    385 
    -
    386 void Mp2tMediaParser::OnEmitSample(
    -
    387  uint32_t pes_pid,
    -
    388  const scoped_refptr<MediaSample>& new_sample) {
    -
    389  DCHECK(new_sample);
    -
    390  DVLOG(LOG_LEVEL_ES)
    -
    391  << "OnEmitSample: "
    -
    392  << " pid="
    -
    393  << pes_pid
    -
    394  << " size="
    -
    395  << new_sample->data_size()
    -
    396  << " dts="
    -
    397  << new_sample->dts()
    -
    398  << " pts="
    -
    399  << new_sample->pts();
    -
    400 
    -
    401  // Add the sample to the appropriate PID sample queue.
    -
    402  PidMap::iterator pid_state = pids_.find(pes_pid);
    -
    403  if (pid_state == pids_.end()) {
    -
    404  LOG(ERROR) << "PID State for new sample not found (pid = "
    -
    405  << pes_pid << ").";
    -
    406  return;
    -
    407  }
    -
    408  pid_state->second->sample_queue().push_back(new_sample);
    -
    409 }
    -
    410 
    -
    411 bool Mp2tMediaParser::EmitRemainingSamples() {
    -
    412  DVLOG(LOG_LEVEL_ES) << "Mp2tMediaParser::EmitRemainingBuffers";
    -
    413 
    -
    414  // No buffer should be sent until fully initialized.
    -
    415  if (!is_initialized_)
    -
    416  return true;
    -
    417 
    -
    418  // Buffer emission.
    -
    419  for (PidMap::const_iterator pid_iter = pids_.begin(); pid_iter != pids_.end();
    -
    420  ++pid_iter) {
    -
    421  SampleQueue& sample_queue = pid_iter->second->sample_queue();
    -
    422  for (SampleQueue::iterator sample_iter = sample_queue.begin();
    -
    423  sample_iter != sample_queue.end();
    -
    424  ++sample_iter) {
    -
    425  if (!new_sample_cb_.Run(pid_iter->first, *sample_iter)) {
    -
    426  // Error processing sample. Propagate error condition.
    -
    427  return false;
    -
    428  }
    -
    429  }
    -
    430  sample_queue.clear();
    -
    431  }
    -
    432 
    -
    433  return true;
    -
    434 }
    -
    435 
    -
    436 } // namespace mp2t
    -
    437 } // namespace media
    -
    438 } // namespace shaka
    -
    void Init(const InitCB &init_cb, const NewSampleCB &new_sample_cb, KeySource *decryption_key_source) override
    -
    bool Flush() override WARN_UNUSED_RESULT
    +
    173  // Flush the buffers and reset the pids.
    +
    174  for (const auto& pair : pids_) {
    +
    175  DVLOG(1) << "Flushing PID: " << pair.first;
    +
    176  PidState* pid_state = pair.second.get();
    +
    177  pid_state->Flush();
    +
    178  }
    +
    179  bool result = EmitRemainingSamples();
    +
    180  pids_.clear();
    +
    181 
    +
    182  // Remove any bytes left in the TS buffer.
    +
    183  // (i.e. any partial TS packet => less than 188 bytes).
    +
    184  ts_byte_queue_.Reset();
    +
    185  return result;
    +
    186 }
    +
    187 
    +
    188 bool Mp2tMediaParser::Parse(const uint8_t* buf, int size) {
    +
    189  DVLOG(1) << "Mp2tMediaParser::Parse size=" << size;
    +
    190 
    +
    191  // Add the data to the parser state.
    +
    192  ts_byte_queue_.Push(buf, size);
    +
    193 
    +
    194  while (true) {
    +
    195  const uint8_t* ts_buffer;
    +
    196  int ts_buffer_size;
    +
    197  ts_byte_queue_.Peek(&ts_buffer, &ts_buffer_size);
    +
    198  if (ts_buffer_size < TsPacket::kPacketSize)
    +
    199  break;
    +
    200 
    +
    201  // Synchronization.
    +
    202  int skipped_bytes = TsPacket::Sync(ts_buffer, ts_buffer_size);
    +
    203  if (skipped_bytes > 0) {
    +
    204  DVLOG(1) << "Packet not aligned on a TS syncword:"
    +
    205  << " skipped_bytes=" << skipped_bytes;
    +
    206  ts_byte_queue_.Pop(skipped_bytes);
    +
    207  continue;
    +
    208  }
    +
    209 
    +
    210  // Parse the TS header, skipping 1 byte if the header is invalid.
    +
    211  std::unique_ptr<TsPacket> ts_packet(
    +
    212  TsPacket::Parse(ts_buffer, ts_buffer_size));
    +
    213  if (!ts_packet) {
    +
    214  DVLOG(1) << "Error: invalid TS packet";
    +
    215  ts_byte_queue_.Pop(1);
    +
    216  continue;
    +
    217  }
    +
    218  DVLOG(LOG_LEVEL_TS)
    +
    219  << "Processing PID=" << ts_packet->pid()
    +
    220  << " start_unit=" << ts_packet->payload_unit_start_indicator();
    +
    221 
    +
    222  // Parse the section.
    +
    223  std::map<int, std::unique_ptr<PidState>>::iterator it =
    +
    224  pids_.find(ts_packet->pid());
    +
    225  if (it == pids_.end() &&
    +
    226  ts_packet->pid() == TsSection::kPidPat) {
    +
    227  // Create the PAT state here if needed.
    +
    228  std::unique_ptr<TsSection> pat_section_parser(new TsSectionPat(
    +
    229  base::Bind(&Mp2tMediaParser::RegisterPmt, base::Unretained(this))));
    +
    230  std::unique_ptr<PidState> pat_pid_state(new PidState(
    +
    231  ts_packet->pid(), PidState::kPidPat, std::move(pat_section_parser)));
    +
    232  pat_pid_state->Enable();
    +
    233  it = pids_
    +
    234  .insert(std::pair<int, std::unique_ptr<PidState>>(
    +
    235  ts_packet->pid(), std::move(pat_pid_state)))
    +
    236  .first;
    +
    237  }
    +
    238 
    +
    239  if (it != pids_.end()) {
    +
    240  if (!it->second->PushTsPacket(*ts_packet))
    +
    241  return false;
    +
    242  } else {
    +
    243  DVLOG(LOG_LEVEL_TS) << "Ignoring TS packet for pid: " << ts_packet->pid();
    +
    244  }
    +
    245 
    +
    246  // Go to the next packet.
    +
    247  ts_byte_queue_.Pop(TsPacket::kPacketSize);
    +
    248  }
    +
    249 
    +
    250  // Emit the A/V buffers that kept accumulating during TS parsing.
    +
    251  return EmitRemainingSamples();
    +
    252 }
    +
    253 
    +
    254 void Mp2tMediaParser::RegisterPmt(int program_number, int pmt_pid) {
    +
    255  DVLOG(1) << "RegisterPmt:"
    +
    256  << " program_number=" << program_number
    +
    257  << " pmt_pid=" << pmt_pid;
    +
    258 
    +
    259  // Only one TS program is allowed. Ignore the incoming program map table,
    +
    260  // if there is already one registered.
    +
    261  for (const auto& pair : pids_) {
    +
    262  if (pair.second->pid_type() == PidState::kPidPmt) {
    +
    263  DVLOG_IF(1, pmt_pid != pair.first) << "More than one program is defined";
    +
    264  return;
    +
    265  }
    +
    266  }
    +
    267 
    +
    268  // Create the PMT state here if needed.
    +
    269  DVLOG(1) << "Create a new PMT parser";
    +
    270  std::unique_ptr<TsSection> pmt_section_parser(new TsSectionPmt(base::Bind(
    +
    271  &Mp2tMediaParser::RegisterPes, base::Unretained(this), pmt_pid)));
    +
    272  std::unique_ptr<PidState> pmt_pid_state(
    +
    273  new PidState(pmt_pid, PidState::kPidPmt, std::move(pmt_section_parser)));
    +
    274  pmt_pid_state->Enable();
    +
    275  pids_.insert(std::pair<int, std::unique_ptr<PidState>>(
    +
    276  pmt_pid, std::move(pmt_pid_state)));
    +
    277 }
    +
    278 
    +
    279 void Mp2tMediaParser::RegisterPes(int pmt_pid,
    +
    280  int pes_pid,
    +
    281  int stream_type) {
    +
    282  DVLOG(1) << "RegisterPes:"
    +
    283  << " pes_pid=" << pes_pid
    +
    284  << " stream_type=" << std::hex << stream_type << std::dec;
    +
    285  std::map<int, std::unique_ptr<PidState>>::iterator it = pids_.find(pes_pid);
    +
    286  if (it != pids_.end())
    +
    287  return;
    +
    288 
    +
    289  // Create a stream parser corresponding to the stream type.
    +
    290  bool is_audio = false;
    +
    291  std::unique_ptr<EsParser> es_parser;
    +
    292  if (stream_type == kStreamTypeAVC) {
    +
    293  es_parser.reset(
    +
    294  new EsParserH264(
    +
    295  pes_pid,
    +
    296  base::Bind(&Mp2tMediaParser::OnNewStreamInfo,
    +
    297  base::Unretained(this)),
    +
    298  base::Bind(&Mp2tMediaParser::OnEmitSample,
    +
    299  base::Unretained(this))));
    +
    300  } else if (stream_type == kStreamTypeHEVC) {
    +
    301  es_parser.reset(
    +
    302  new EsParserH265(
    +
    303  pes_pid,
    +
    304  base::Bind(&Mp2tMediaParser::OnNewStreamInfo,
    +
    305  base::Unretained(this)),
    +
    306  base::Bind(&Mp2tMediaParser::OnEmitSample,
    +
    307  base::Unretained(this))));
    +
    308  } else if (stream_type == kStreamTypeAAC) {
    +
    309  es_parser.reset(
    +
    310  new EsParserAdts(
    +
    311  pes_pid,
    +
    312  base::Bind(&Mp2tMediaParser::OnNewStreamInfo,
    +
    313  base::Unretained(this)),
    +
    314  base::Bind(&Mp2tMediaParser::OnEmitSample,
    +
    315  base::Unretained(this)),
    +
    316  sbr_in_mimetype_));
    +
    317  is_audio = true;
    +
    318  } else {
    +
    319  return;
    +
    320  }
    +
    321 
    +
    322  // Create the PES state here.
    +
    323  DVLOG(1) << "Create a new PES state";
    +
    324  std::unique_ptr<TsSection> pes_section_parser(
    +
    325  new TsSectionPes(std::move(es_parser)));
    +
    326  PidState::PidType pid_type =
    +
    327  is_audio ? PidState::kPidAudioPes : PidState::kPidVideoPes;
    +
    328  std::unique_ptr<PidState> pes_pid_state(
    +
    329  new PidState(pes_pid, pid_type, std::move(pes_section_parser)));
    +
    330  pes_pid_state->Enable();
    +
    331  pids_.insert(std::pair<int, std::unique_ptr<PidState>>(
    +
    332  pes_pid, std::move(pes_pid_state)));
    +
    333 }
    +
    334 
    +
    335 void Mp2tMediaParser::OnNewStreamInfo(
    +
    336  const scoped_refptr<StreamInfo>& new_stream_info) {
    +
    337  DCHECK(new_stream_info);
    +
    338  DVLOG(1) << "OnVideoConfigChanged for pid=" << new_stream_info->track_id();
    +
    339 
    +
    340  PidMap::iterator pid_state = pids_.find(new_stream_info->track_id());
    +
    341  if (pid_state == pids_.end()) {
    +
    342  LOG(ERROR) << "PID State for new stream not found (pid = "
    +
    343  << new_stream_info->track_id() << ").";
    +
    344  return;
    +
    345  }
    +
    346 
    +
    347  // Set the stream configuration information for the PID.
    +
    348  pid_state->second->set_config(new_stream_info);
    +
    349 
    +
    350  // Finish initialization if all streams have configs.
    +
    351  FinishInitializationIfNeeded();
    +
    352 }
    +
    353 
    +
    354 bool Mp2tMediaParser::FinishInitializationIfNeeded() {
    +
    355  // Nothing to be done if already initialized.
    +
    356  if (is_initialized_)
    +
    357  return true;
    +
    358 
    +
    359  // Wait for more data to come to finish initialization.
    +
    360  if (pids_.empty())
    +
    361  return true;
    +
    362 
    +
    363  std::vector<scoped_refptr<StreamInfo> > all_stream_info;
    +
    364  uint32_t num_es(0);
    +
    365  for (PidMap::const_iterator iter = pids_.begin(); iter != pids_.end();
    +
    366  ++iter) {
    +
    367  if (((iter->second->pid_type() == PidState::kPidAudioPes) ||
    +
    368  (iter->second->pid_type() == PidState::kPidVideoPes))) {
    +
    369  ++num_es;
    +
    370  if (iter->second->config())
    +
    371  all_stream_info.push_back(iter->second->config());
    +
    372  }
    +
    373  }
    +
    374  if (num_es && (all_stream_info.size() == num_es)) {
    +
    375  // All stream configurations have been received. Initialization can
    +
    376  // be completed.
    +
    377  init_cb_.Run(all_stream_info);
    +
    378  DVLOG(1) << "Mpeg2TS stream parser initialization done";
    +
    379  is_initialized_ = true;
    +
    380  }
    +
    381  return true;
    +
    382 }
    +
    383 
    +
    384 void Mp2tMediaParser::OnEmitSample(
    +
    385  uint32_t pes_pid,
    +
    386  const scoped_refptr<MediaSample>& new_sample) {
    +
    387  DCHECK(new_sample);
    +
    388  DVLOG(LOG_LEVEL_ES)
    +
    389  << "OnEmitSample: "
    +
    390  << " pid="
    +
    391  << pes_pid
    +
    392  << " size="
    +
    393  << new_sample->data_size()
    +
    394  << " dts="
    +
    395  << new_sample->dts()
    +
    396  << " pts="
    +
    397  << new_sample->pts();
    +
    398 
    +
    399  // Add the sample to the appropriate PID sample queue.
    +
    400  PidMap::iterator pid_state = pids_.find(pes_pid);
    +
    401  if (pid_state == pids_.end()) {
    +
    402  LOG(ERROR) << "PID State for new sample not found (pid = "
    +
    403  << pes_pid << ").";
    +
    404  return;
    +
    405  }
    +
    406  pid_state->second->sample_queue().push_back(new_sample);
    +
    407 }
    +
    408 
    +
    409 bool Mp2tMediaParser::EmitRemainingSamples() {
    +
    410  DVLOG(LOG_LEVEL_ES) << "Mp2tMediaParser::EmitRemainingBuffers";
    +
    411 
    +
    412  // No buffer should be sent until fully initialized.
    +
    413  if (!is_initialized_)
    +
    414  return true;
    +
    415 
    +
    416  // Buffer emission.
    +
    417  for (PidMap::const_iterator pid_iter = pids_.begin(); pid_iter != pids_.end();
    +
    418  ++pid_iter) {
    +
    419  SampleQueue& sample_queue = pid_iter->second->sample_queue();
    +
    420  for (SampleQueue::iterator sample_iter = sample_queue.begin();
    +
    421  sample_iter != sample_queue.end();
    +
    422  ++sample_iter) {
    +
    423  if (!new_sample_cb_.Run(pid_iter->first, *sample_iter)) {
    +
    424  // Error processing sample. Propagate error condition.
    +
    425  return false;
    +
    426  }
    +
    427  }
    +
    428  sample_queue.clear();
    +
    429  }
    +
    430 
    +
    431  return true;
    +
    432 }
    +
    433 
    +
    434 } // namespace mp2t
    +
    435 } // namespace media
    +
    436 } // namespace shaka
    +
    void Init(const InitCB &init_cb, const NewSampleCB &new_sample_cb, KeySource *decryption_key_source) override
    +
    bool Flush() override WARN_UNUSED_RESULT
    KeySource is responsible for encryption key acquisition.
    Definition: key_source.h:30
    -
    bool Parse(const uint8_t *buf, int size) override WARN_UNUSED_RESULT
    +
    bool Parse(const uint8_t *buf, int size) override WARN_UNUSED_RESULT
    diff --git a/docs/d1/d79/classshaka_1_1media_1_1H265VideoSliceHeaderParser.html b/docs/d1/d79/classshaka_1_1media_1_1H265VideoSliceHeaderParser.html index e797b4174b..547801967e 100644 --- a/docs/d1/d79/classshaka_1_1media_1_1H265VideoSliceHeaderParser.html +++ b/docs/d1/d79/classshaka_1_1media_1_1H265VideoSliceHeaderParser.html @@ -152,7 +152,7 @@ int64_t  diff --git a/docs/d1/d7d/webm__video__client_8cc_source.html b/docs/d1/d7d/webm__video__client_8cc_source.html index f1e6da226c..3f34d363ea 100644 --- a/docs/d1/d7d/webm__video__client_8cc_source.html +++ b/docs/d1/d7d/webm__video__client_8cc_source.html @@ -94,183 +94,182 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
    5 #include "packager/media/formats/webm/webm_video_client.h"
    6 
    7 #include "packager/base/logging.h"
    -
    8 #include "packager/base/stl_util.h"
    -
    9 #include "packager/media/codecs/vp_codec_configuration_record.h"
    -
    10 #include "packager/media/formats/webm/webm_constants.h"
    -
    11 
    -
    12 namespace {
    -
    13 
    -
    14 // Timestamps are represented in double in WebM. Convert to uint64_t in us.
    -
    15 const uint32_t kWebMTimeScale = 1000000u;
    -
    16 
    -
    17 int64_t GetGreatestCommonDivisor(int64_t a, int64_t b) {
    -
    18  while (b) {
    -
    19  int64_t temp = b;
    -
    20  b = a % b;
    -
    21  a = temp;
    -
    22  }
    -
    23  return a;
    -
    24 }
    -
    25 
    -
    26 } // namespace
    -
    27 
    -
    28 namespace shaka {
    -
    29 namespace media {
    -
    30 
    -
    31 WebMVideoClient::WebMVideoClient() {
    -
    32  Reset();
    -
    33 }
    -
    34 
    -
    35 WebMVideoClient::~WebMVideoClient() {
    -
    36 }
    -
    37 
    - -
    39  pixel_width_ = -1;
    -
    40  pixel_height_ = -1;
    -
    41  crop_bottom_ = -1;
    -
    42  crop_top_ = -1;
    -
    43  crop_left_ = -1;
    -
    44  crop_right_ = -1;
    -
    45  display_width_ = -1;
    -
    46  display_height_ = -1;
    -
    47  display_unit_ = -1;
    -
    48  alpha_mode_ = -1;
    -
    49 }
    -
    50 
    -
    51 scoped_refptr<VideoStreamInfo> WebMVideoClient::GetVideoStreamInfo(
    -
    52  int64_t track_num,
    -
    53  const std::string& codec_id,
    -
    54  const std::vector<uint8_t>& codec_private,
    -
    55  bool is_encrypted) {
    -
    56  Codec video_codec = kUnknownCodec;
    -
    57  if (codec_id == "V_VP8") {
    -
    58  video_codec = kCodecVP8;
    -
    59  } else if (codec_id == "V_VP9") {
    -
    60  video_codec = kCodecVP9;
    -
    61  // The codec private data is in WebM format, but needs to be converted to
    -
    62  // MP4 format. Don't do it yet, it will be handled in
    -
    63  // webm_cluster_parser.cc
    -
    64  } else if (codec_id == "V_VP10") {
    -
    65  video_codec = kCodecVP10;
    -
    66  } else {
    -
    67  LOG(ERROR) << "Unsupported video codec_id " << codec_id;
    -
    68  return scoped_refptr<VideoStreamInfo>();
    -
    69  }
    -
    70 
    -
    71  if (pixel_width_ <= 0 || pixel_height_ <= 0)
    -
    72  return scoped_refptr<VideoStreamInfo>();
    -
    73 
    -
    74  // Set crop and display unit defaults if these elements are not present.
    -
    75  if (crop_bottom_ == -1)
    -
    76  crop_bottom_ = 0;
    -
    77 
    -
    78  if (crop_top_ == -1)
    -
    79  crop_top_ = 0;
    -
    80 
    -
    81  if (crop_left_ == -1)
    -
    82  crop_left_ = 0;
    -
    83 
    -
    84  if (crop_right_ == -1)
    -
    85  crop_right_ = 0;
    -
    86 
    -
    87  if (display_unit_ == -1)
    -
    88  display_unit_ = 0;
    -
    89 
    -
    90  uint16_t width_after_crop = pixel_width_ - (crop_left_ + crop_right_);
    -
    91  uint16_t height_after_crop = pixel_height_ - (crop_top_ + crop_bottom_);
    -
    92 
    -
    93  if (display_unit_ == 0) {
    -
    94  if (display_width_ <= 0)
    -
    95  display_width_ = width_after_crop;
    -
    96  if (display_height_ <= 0)
    -
    97  display_height_ = height_after_crop;
    -
    98  } else if (display_unit_ == 3) {
    -
    99  if (display_width_ <= 0 || display_height_ <= 0)
    -
    100  return scoped_refptr<VideoStreamInfo>();
    -
    101  } else {
    -
    102  LOG(ERROR) << "Unsupported display unit type " << display_unit_;
    -
    103  return scoped_refptr<VideoStreamInfo>();
    -
    104  }
    -
    105  // Calculate sample aspect ratio.
    -
    106  int64_t sar_x = display_width_ * height_after_crop;
    -
    107  int64_t sar_y = display_height_ * width_after_crop;
    -
    108  int64_t gcd = GetGreatestCommonDivisor(sar_x, sar_y);
    -
    109  sar_x /= gcd;
    -
    110  sar_y /= gcd;
    -
    111 
    -
    112  return scoped_refptr<VideoStreamInfo>(new VideoStreamInfo(
    -
    113  track_num, kWebMTimeScale, 0, video_codec, std::string(),
    -
    114  codec_private.data(), codec_private.size(), width_after_crop,
    -
    115  height_after_crop, sar_x, sar_y, 0, 0, std::string(), is_encrypted));
    -
    116 }
    -
    117 
    -
    118 bool WebMVideoClient::OnUInt(int id, int64_t val) {
    -
    119  int64_t* dst = NULL;
    -
    120 
    -
    121  switch (id) {
    -
    122  case kWebMIdPixelWidth:
    -
    123  dst = &pixel_width_;
    -
    124  break;
    -
    125  case kWebMIdPixelHeight:
    -
    126  dst = &pixel_height_;
    -
    127  break;
    -
    128  case kWebMIdPixelCropTop:
    -
    129  dst = &crop_top_;
    -
    130  break;
    -
    131  case kWebMIdPixelCropBottom:
    -
    132  dst = &crop_bottom_;
    -
    133  break;
    -
    134  case kWebMIdPixelCropLeft:
    -
    135  dst = &crop_left_;
    -
    136  break;
    -
    137  case kWebMIdPixelCropRight:
    -
    138  dst = &crop_right_;
    -
    139  break;
    -
    140  case kWebMIdDisplayWidth:
    -
    141  dst = &display_width_;
    -
    142  break;
    -
    143  case kWebMIdDisplayHeight:
    -
    144  dst = &display_height_;
    -
    145  break;
    -
    146  case kWebMIdDisplayUnit:
    -
    147  dst = &display_unit_;
    -
    148  break;
    -
    149  case kWebMIdAlphaMode:
    -
    150  dst = &alpha_mode_;
    -
    151  break;
    -
    152  default:
    -
    153  return true;
    -
    154  }
    -
    155 
    -
    156  if (*dst != -1) {
    -
    157  LOG(ERROR) << "Multiple values for id " << std::hex << id << " specified ("
    -
    158  << *dst << " and " << val << ")";
    -
    159  return false;
    -
    160  }
    -
    161 
    -
    162  *dst = val;
    -
    163  return true;
    -
    164 }
    -
    165 
    -
    166 bool WebMVideoClient::OnBinary(int id, const uint8_t* data, int size) {
    -
    167  // Accept binary fields we don't care about for now.
    -
    168  return true;
    -
    169 }
    -
    170 
    -
    171 bool WebMVideoClient::OnFloat(int id, double val) {
    -
    172  // Accept float fields we don't care about for now.
    -
    173  return true;
    -
    174 }
    -
    175 
    -
    176 } // namespace media
    -
    177 } // namespace shaka
    -
    void Reset()
    Reset this object's state so it can process a new video track element.
    -
    scoped_refptr< VideoStreamInfo > GetVideoStreamInfo(int64_t track_num, const std::string &codec_id, const std::vector< uint8_t > &codec_private, bool is_encrypted)
    +
    8 #include "packager/media/codecs/vp_codec_configuration_record.h"
    +
    9 #include "packager/media/formats/webm/webm_constants.h"
    +
    10 
    +
    11 namespace {
    +
    12 
    +
    13 // Timestamps are represented in double in WebM. Convert to uint64_t in us.
    +
    14 const uint32_t kWebMTimeScale = 1000000u;
    +
    15 
    +
    16 int64_t GetGreatestCommonDivisor(int64_t a, int64_t b) {
    +
    17  while (b) {
    +
    18  int64_t temp = b;
    +
    19  b = a % b;
    +
    20  a = temp;
    +
    21  }
    +
    22  return a;
    +
    23 }
    +
    24 
    +
    25 } // namespace
    +
    26 
    +
    27 namespace shaka {
    +
    28 namespace media {
    +
    29 
    +
    30 WebMVideoClient::WebMVideoClient() {
    +
    31  Reset();
    +
    32 }
    +
    33 
    +
    34 WebMVideoClient::~WebMVideoClient() {
    +
    35 }
    +
    36 
    + +
    38  pixel_width_ = -1;
    +
    39  pixel_height_ = -1;
    +
    40  crop_bottom_ = -1;
    +
    41  crop_top_ = -1;
    +
    42  crop_left_ = -1;
    +
    43  crop_right_ = -1;
    +
    44  display_width_ = -1;
    +
    45  display_height_ = -1;
    +
    46  display_unit_ = -1;
    +
    47  alpha_mode_ = -1;
    +
    48 }
    +
    49 
    +
    50 scoped_refptr<VideoStreamInfo> WebMVideoClient::GetVideoStreamInfo(
    +
    51  int64_t track_num,
    +
    52  const std::string& codec_id,
    +
    53  const std::vector<uint8_t>& codec_private,
    +
    54  bool is_encrypted) {
    +
    55  Codec video_codec = kUnknownCodec;
    +
    56  if (codec_id == "V_VP8") {
    +
    57  video_codec = kCodecVP8;
    +
    58  } else if (codec_id == "V_VP9") {
    +
    59  video_codec = kCodecVP9;
    +
    60  // The codec private data is in WebM format, but needs to be converted to
    +
    61  // MP4 format. Don't do it yet, it will be handled in
    +
    62  // webm_cluster_parser.cc
    +
    63  } else if (codec_id == "V_VP10") {
    +
    64  video_codec = kCodecVP10;
    +
    65  } else {
    +
    66  LOG(ERROR) << "Unsupported video codec_id " << codec_id;
    +
    67  return scoped_refptr<VideoStreamInfo>();
    +
    68  }
    +
    69 
    +
    70  if (pixel_width_ <= 0 || pixel_height_ <= 0)
    +
    71  return scoped_refptr<VideoStreamInfo>();
    +
    72 
    +
    73  // Set crop and display unit defaults if these elements are not present.
    +
    74  if (crop_bottom_ == -1)
    +
    75  crop_bottom_ = 0;
    +
    76 
    +
    77  if (crop_top_ == -1)
    +
    78  crop_top_ = 0;
    +
    79 
    +
    80  if (crop_left_ == -1)
    +
    81  crop_left_ = 0;
    +
    82 
    +
    83  if (crop_right_ == -1)
    +
    84  crop_right_ = 0;
    +
    85 
    +
    86  if (display_unit_ == -1)
    +
    87  display_unit_ = 0;
    +
    88 
    +
    89  uint16_t width_after_crop = pixel_width_ - (crop_left_ + crop_right_);
    +
    90  uint16_t height_after_crop = pixel_height_ - (crop_top_ + crop_bottom_);
    +
    91 
    +
    92  if (display_unit_ == 0) {
    +
    93  if (display_width_ <= 0)
    +
    94  display_width_ = width_after_crop;
    +
    95  if (display_height_ <= 0)
    +
    96  display_height_ = height_after_crop;
    +
    97  } else if (display_unit_ == 3) {
    +
    98  if (display_width_ <= 0 || display_height_ <= 0)
    +
    99  return scoped_refptr<VideoStreamInfo>();
    +
    100  } else {
    +
    101  LOG(ERROR) << "Unsupported display unit type " << display_unit_;
    +
    102  return scoped_refptr<VideoStreamInfo>();
    +
    103  }
    +
    104  // Calculate sample aspect ratio.
    +
    105  int64_t sar_x = display_width_ * height_after_crop;
    +
    106  int64_t sar_y = display_height_ * width_after_crop;
    +
    107  int64_t gcd = GetGreatestCommonDivisor(sar_x, sar_y);
    +
    108  sar_x /= gcd;
    +
    109  sar_y /= gcd;
    +
    110 
    +
    111  return scoped_refptr<VideoStreamInfo>(new VideoStreamInfo(
    +
    112  track_num, kWebMTimeScale, 0, video_codec, std::string(),
    +
    113  codec_private.data(), codec_private.size(), width_after_crop,
    +
    114  height_after_crop, sar_x, sar_y, 0, 0, std::string(), is_encrypted));
    +
    115 }
    +
    116 
    +
    117 bool WebMVideoClient::OnUInt(int id, int64_t val) {
    +
    118  int64_t* dst = NULL;
    +
    119 
    +
    120  switch (id) {
    +
    121  case kWebMIdPixelWidth:
    +
    122  dst = &pixel_width_;
    +
    123  break;
    +
    124  case kWebMIdPixelHeight:
    +
    125  dst = &pixel_height_;
    +
    126  break;
    +
    127  case kWebMIdPixelCropTop:
    +
    128  dst = &crop_top_;
    +
    129  break;
    +
    130  case kWebMIdPixelCropBottom:
    +
    131  dst = &crop_bottom_;
    +
    132  break;
    +
    133  case kWebMIdPixelCropLeft:
    +
    134  dst = &crop_left_;
    +
    135  break;
    +
    136  case kWebMIdPixelCropRight:
    +
    137  dst = &crop_right_;
    +
    138  break;
    +
    139  case kWebMIdDisplayWidth:
    +
    140  dst = &display_width_;
    +
    141  break;
    +
    142  case kWebMIdDisplayHeight:
    +
    143  dst = &display_height_;
    +
    144  break;
    +
    145  case kWebMIdDisplayUnit:
    +
    146  dst = &display_unit_;
    +
    147  break;
    +
    148  case kWebMIdAlphaMode:
    +
    149  dst = &alpha_mode_;
    +
    150  break;
    +
    151  default:
    +
    152  return true;
    +
    153  }
    +
    154 
    +
    155  if (*dst != -1) {
    +
    156  LOG(ERROR) << "Multiple values for id " << std::hex << id << " specified ("
    +
    157  << *dst << " and " << val << ")";
    +
    158  return false;
    +
    159  }
    +
    160 
    +
    161  *dst = val;
    +
    162  return true;
    +
    163 }
    +
    164 
    +
    165 bool WebMVideoClient::OnBinary(int id, const uint8_t* data, int size) {
    +
    166  // Accept binary fields we don't care about for now.
    +
    167  return true;
    +
    168 }
    +
    169 
    +
    170 bool WebMVideoClient::OnFloat(int id, double val) {
    +
    171  // Accept float fields we don't care about for now.
    +
    172  return true;
    +
    173 }
    +
    174 
    +
    175 } // namespace media
    +
    176 } // namespace shaka
    +
    void Reset()
    Reset this object's state so it can process a new video track element.
    +
    scoped_refptr< VideoStreamInfo > GetVideoStreamInfo(int64_t track_num, const std::string &codec_id, const std::vector< uint8_t > &codec_private, bool is_encrypted)
    Holds video stream information.
    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 2eac74b71b..fb437fc856 100644 --- a/docs/d1/d81/structshaka_1_1media_1_1H265ReferencePictureSet-members.html +++ b/docs/d1/d81/structshaka_1_1media_1_1H265ReferencePictureSet-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/d82/adts__constants_8h_source.html b/docs/d1/d82/adts__constants_8h_source.html index 1522fca269..7dc854eee7 100644 --- a/docs/d1/d82/adts__constants_8h_source.html +++ b/docs/d1/d82/adts__constants_8h_source.html @@ -117,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 b0a1a788a2..24c61d252f 100644 --- a/docs/d1/d82/classshaka_1_1media_1_1WebMParserClient-members.html +++ b/docs/d1/d82/classshaka_1_1media_1_1WebMParserClient-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/d86/classshaka_1_1media_1_1mp4_1_1KeyRotationFragmenter-members.html b/docs/d1/d86/classshaka_1_1media_1_1mp4_1_1KeyRotationFragmenter-members.html index 88ab2ada0a..8f64bc2903 100644 --- a/docs/d1/d86/classshaka_1_1media_1_1mp4_1_1KeyRotationFragmenter-members.html +++ b/docs/d1/d86/classshaka_1_1media_1_1mp4_1_1KeyRotationFragmenter-members.html @@ -124,7 +124,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/d8e/webm__audio__client_8cc_source.html b/docs/d1/d8e/webm__audio__client_8cc_source.html index d5c54f9adc..6c29f576ed 100644 --- a/docs/d1/d8e/webm__audio__client_8cc_source.html +++ b/docs/d1/d8e/webm__audio__client_8cc_source.html @@ -214,7 +214,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 dd25572fc6..e8287ea67a 100644 --- a/docs/d1/d91/classshaka_1_1media_1_1H26xBitReader-members.html +++ b/docs/d1/d91/classshaka_1_1media_1_1H26xBitReader-members.html @@ -107,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 ea78bccb24..7611196572 100644 --- a/docs/d1/d9d/classshaka_1_1media_1_1ByteQueue-members.html +++ b/docs/d1/d9d/classshaka_1_1media_1_1ByteQueue-members.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/d9d/tracks__builder_8h_source.html b/docs/d1/d9d/tracks__builder_8h_source.html index dde17e7360..fcb4070ff7 100644 --- a/docs/d1/d9d/tracks__builder_8h_source.html +++ b/docs/d1/d9d/tracks__builder_8h_source.html @@ -210,7 +210,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 abaffb7cae..87d3eb8e86 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 @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 5f7cdb41fe..b0cae823f0 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 @@ -589,7 +589,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 f7065ab9f2..7f3d86441b 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 @@ -116,7 +116,7 @@ scoped_refptr< 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 8055f99a39..313c479f1f 100644 --- a/docs/d1/da2/classshaka_1_1media_1_1NalUnitToByteStreamConverter-members.html +++ b/docs/d1/da2/classshaka_1_1media_1_1NalUnitToByteStreamConverter-members.html @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/da5/classshaka_1_1media_1_1VPCodecConfigurationRecord.html b/docs/d1/da5/classshaka_1_1media_1_1VPCodecConfigurationRecord.html index 0be0dd6f7a..6be94ad53e 100644 --- a/docs/d1/da5/classshaka_1_1media_1_1VPCodecConfigurationRecord.html +++ b/docs/d1/da5/classshaka_1_1media_1_1VPCodecConfigurationRecord.html @@ -306,7 +306,7 @@ bool video_full_range_flag 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 4a69e8b6fe..abc25f74d3 100644 --- a/docs/d1/dad/classshaka_1_1media_1_1Demuxer-members.html +++ b/docs/d1/dad/classshaka_1_1media_1_1Demuxer-members.html @@ -100,12 +100,12 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); Parse()shaka::media::Demuxer Run()shaka::media::Demuxer SetKeySource(std::unique_ptr< KeySource > key_source)shaka::media::Demuxer - streams()shaka::media::Demuxerinline + streams()shaka::media::Demuxerinline ~Demuxer() (defined in shaka::media::Demuxer)shaka::media::Demuxer 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 a022936626..0e1c6f4996 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 @@ -191,7 +191,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 cb4e73bd50..82fc772ad9 100644 --- a/docs/d1/db2/decoder__configuration__record_8h_source.html +++ b/docs/d1/db2/decoder__configuration__record_8h_source.html @@ -166,7 +166,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/dc2/h26x__bit__reader_8h_source.html b/docs/d1/dc2/h26x__bit__reader_8h_source.html index 13ecc0bd6a..2f16ea7a5b 100644 --- a/docs/d1/dc2/h26x__bit__reader_8h_source.html +++ b/docs/d1/dc2/h26x__bit__reader_8h_source.html @@ -192,7 +192,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/dcb/encrypting__fragmenter_8h_source.html b/docs/d1/dcb/encrypting__fragmenter_8h_source.html index 9083fcb32f..f4603d9f7f 100644 --- a/docs/d1/dcb/encrypting__fragmenter_8h_source.html +++ b/docs/d1/dcb/encrypting__fragmenter_8h_source.html @@ -195,7 +195,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/dd5/classshaka_1_1media_1_1Cluster.html b/docs/d1/dd5/classshaka_1_1media_1_1Cluster.html index 3ba277295c..4a38010ba4 100644 --- a/docs/d1/dd5/classshaka_1_1media_1_1Cluster.html +++ b/docs/d1/dd5/classshaka_1_1media_1_1Cluster.html @@ -116,7 +116,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 5182acb3dc..fd3737ecc9 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 @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 30ee088ef5..8df9262f54 100644 --- a/docs/d1/de2/classshaka_1_1media_1_1VideoStreamInfo-members.html +++ b/docs/d1/de2/classshaka_1_1media_1_1VideoStreamInfo-members.html @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/de2/composition__offset__iterator_8cc_source.html b/docs/d1/de2/composition__offset__iterator_8cc_source.html index 3ba661ff33..39e2076750 100644 --- a/docs/d1/de2/composition__offset__iterator_8cc_source.html +++ b/docs/d1/de2/composition__offset__iterator_8cc_source.html @@ -159,7 +159,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 2f50c5578e..b4067a326b 100644 --- a/docs/d1/de4/classshaka_1_1media_1_1KeyFetcher-members.html +++ b/docs/d1/de4/classshaka_1_1media_1_1KeyFetcher-members.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/de7/classshaka_1_1xml_1_1AdaptationSetXmlNode.html b/docs/d1/de7/classshaka_1_1xml_1_1AdaptationSetXmlNode.html index dd4e032a7f..3bdbb499df 100644 --- a/docs/d1/de7/classshaka_1_1xml_1_1AdaptationSetXmlNode.html +++ b/docs/d1/de7/classshaka_1_1xml_1_1AdaptationSetXmlNode.html @@ -186,7 +186,7 @@ Additional Inherited Members -

    Definition at line 204 of file xml_node.cc.

    +

    Definition at line 203 of file xml_node.cc.

    @@ -197,7 +197,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 9196609e0e..4c8e98ce7e 100644 --- a/docs/d1/de7/structshaka_1_1media_1_1H265ReferencePictureListModifications-members.html +++ b/docs/d1/de7/structshaka_1_1media_1_1H265ReferencePictureListModifications-members.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 b73bb438ca..b88b424053 100644 --- a/docs/d1/de9/classshaka_1_1media_1_1ProgressListener-members.html +++ b/docs/d1/de9/classshaka_1_1media_1_1ProgressListener-members.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 8bab074187..3ca59a7b95 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 @@ -468,7 +468,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 d1660fd492..bc240fe385 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 @@ -198,7 +198,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 de7e324654..561e3cb827 100644 --- a/docs/d1/df0/aes__encryptor_8h_source.html +++ b/docs/d1/df0/aes__encryptor_8h_source.html @@ -194,7 +194,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d1/df3/structshaka_1_1MpdOptions.html b/docs/d1/df3/structshaka_1_1MpdOptions.html index a05ecfc097..7787114960 100644 --- a/docs/d1/df3/structshaka_1_1MpdOptions.html +++ b/docs/d1/df3/structshaka_1_1MpdOptions.html @@ -127,7 +127,7 @@ double suggested_presentat diff --git a/docs/d1/df5/nalu__reader_8cc_source.html b/docs/d1/df5/nalu__reader_8cc_source.html index 8db5c5543a..314a1e3994 100644 --- a/docs/d1/df5/nalu__reader_8cc_source.html +++ b/docs/d1/df5/nalu__reader_8cc_source.html @@ -428,7 +428,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 85b65274ab..3c2446f98a 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 @@ -116,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/d02/timestamp_8h_source.html b/docs/d2/d02/timestamp_8h_source.html index 98a95f34f7..01f16a55bd 100644 --- a/docs/d2/d02/timestamp_8h_source.html +++ b/docs/d2/d02/timestamp_8h_source.html @@ -114,7 +114,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 3e271ad011..d7d865ca69 100644 --- a/docs/d2/d0b/classshaka_1_1media_1_1SeekHead-members.html +++ b/docs/d2/d0b/classshaka_1_1media_1_1SeekHead-members.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/d0f/classshaka_1_1MpdBuilder-members.html b/docs/d2/d0f/classshaka_1_1MpdBuilder-members.html index fb4f2a08bb..76c1ad1822 100644 --- a/docs/d2/d0f/classshaka_1_1MpdBuilder-members.html +++ b/docs/d2/d0f/classshaka_1_1MpdBuilder-members.html @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 2b240fccdd..454be5325b 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 @@ -132,7 +132,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 9b2794f275..e4038927fb 100644 --- a/docs/d2/d11/classshaka_1_1media_1_1MuxerListener-members.html +++ b/docs/d2/d11/classshaka_1_1media_1_1MuxerListener-members.html @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/d17/ts__section__pat_8cc_source.html b/docs/d2/d17/ts__section__pat_8cc_source.html index fbe3ff51b7..9d0805a4d3 100644 --- a/docs/d2/d17/ts__section__pat_8cc_source.html +++ b/docs/d2/d17/ts__section__pat_8cc_source.html @@ -214,7 +214,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/d23/threaded__io__file_8cc_source.html b/docs/d2/d23/threaded__io__file_8cc_source.html index e57032d804..94b0d5f877 100644 --- a/docs/d2/d23/threaded__io__file_8cc_source.html +++ b/docs/d2/d23/threaded__io__file_8cc_source.html @@ -317,7 +317,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/d24/packager__util_8h_source.html b/docs/d2/d24/packager__util_8h_source.html index de82af3491..76d7b23fc5 100644 --- a/docs/d2/d24/packager__util_8h_source.html +++ b/docs/d2/d24/packager__util_8h_source.html @@ -116,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
    27 class Muxer;
    28 struct MuxerOptions;
    29 
    -
    31 void DumpStreamInfo(const std::vector<MediaStream*>& streams);
    +
    31 void DumpStreamInfo(const std::vector<std::unique_ptr<MediaStream>>& streams);
    32 
    37 std::unique_ptr<KeySource> CreateEncryptionKeySource();
    38 
    @@ -128,7 +128,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
    50 
    52 bool GetMpdOptions(MpdOptions* mpd_options);
    53 
    -
    63 bool AddStreamToMuxer(const std::vector<MediaStream*>& streams,
    +
    63 bool AddStreamToMuxer(const std::vector<std::unique_ptr<MediaStream>>& streams,
    64  const std::string& stream_selector,
    65  const std::string& language_override,
    66  Muxer* muxer);
    @@ -140,7 +140,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/d29/classshaka_1_1media_1_1mp4_1_1KeyRotationFragmenter.html b/docs/d2/d29/classshaka_1_1media_1_1mp4_1_1KeyRotationFragmenter.html index cc5d7a5aca..e498c33168 100644 --- a/docs/d2/d29/classshaka_1_1media_1_1mp4_1_1KeyRotationFragmenter.html +++ b/docs/d2/d29/classshaka_1_1media_1_1mp4_1_1KeyRotationFragmenter.html @@ -328,7 +328,7 @@ void set_encryption_key diff --git a/docs/d2/d30/tracks__builder_8cc_source.html b/docs/d2/d30/tracks__builder_8cc_source.html index 4e47bbf464..a1bbe7ef21 100644 --- a/docs/d2/d30/tracks__builder_8cc_source.html +++ b/docs/d2/d30/tracks__builder_8cc_source.html @@ -487,7 +487,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 700efb1ddf..197f7cc75e 100644 --- a/docs/d2/d33/video__slice__header__parser_8h_source.html +++ b/docs/d2/d33/video__slice__header__parser_8h_source.html @@ -153,7 +153,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
    73 #endif // MEDIA_CODECS_VIDEO_SLICE_HEADER_PARSER_H_
    74 
    - +
    virtual int64_t GetHeaderSize(const Nalu &nalu)=0
    Gets the header size of the given NALU. Returns < 0 on error.
    int64_t GetHeaderSize(const Nalu &nalu) override
    Gets the header size of the given NALU. Returns < 0 on error.
    int64_t GetHeaderSize(const Nalu &nalu) override
    Gets the header size of the given NALU. Returns < 0 on error.
    @@ -167,7 +167,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 a228441742..f0f519e6ee 100644 --- a/docs/d2/d35/classshaka_1_1media_1_1WidevineKeySource-members.html +++ b/docs/d2/d35/classshaka_1_1media_1_1WidevineKeySource-members.html @@ -119,7 +119,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 a4da200e71..ff04d345f7 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 @@ -133,7 +133,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 9d18ad41b7..0030175e00 100644 --- a/docs/d2/d45/program__map__table__writer_8cc_source.html +++ b/docs/d2/d45/program__map__table__writer_8cc_source.html @@ -500,7 +500,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 1a8b0b3236..15e29307eb 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 @@ -291,7 +291,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/d4d/file_8h_source.html b/docs/d2/d4d/file_8h_source.html index 51c9d9f9be..b552b71320 100644 --- a/docs/d2/d4d/file_8h_source.html +++ b/docs/d2/d4d/file_8h_source.html @@ -191,7 +191,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/d4f/structshaka_1_1Element-members.html b/docs/d2/d4f/structshaka_1_1Element-members.html index d35710728a..cdf7b10b31 100644 --- a/docs/d2/d4f/structshaka_1_1Element-members.html +++ b/docs/d2/d4f/structshaka_1_1Element-members.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/d51/classshaka_1_1MockMpdNotifier-members.html b/docs/d2/d51/classshaka_1_1MockMpdNotifier-members.html index e75a812e8f..e29997e662 100644 --- a/docs/d2/d51/classshaka_1_1MockMpdNotifier-members.html +++ b/docs/d2/d51/classshaka_1_1MockMpdNotifier-members.html @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/d59/structshaka_1_1media_1_1H264SliceHeader.html b/docs/d2/d59/structshaka_1_1media_1_1H264SliceHeader.html index 4abd3f8462..54c9f84da2 100644 --- a/docs/d2/d59/structshaka_1_1media_1_1H264SliceHeader.html +++ b/docs/d2/d59/structshaka_1_1media_1_1H264SliceHeader.html @@ -268,7 +268,7 @@ int slice_beta_offset_div2

    Detailed Description

    -

    Definition at line 143 of file h264_parser.h.

    +

    Definition at line 144 of file h264_parser.h.


    The documentation for this struct was generated from the following files:
    • media/codecs/h264_parser.h
    • media/codecs/h264_parser.cc
    • @@ -276,7 +276,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 82b3bae69d..3348a9a8d5 100644 --- a/docs/d2/d5b/classshaka_1_1media_1_1KeySource-members.html +++ b/docs/d2/d5b/classshaka_1_1media_1_1KeySource-members.html @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/d5c/classshaka_1_1SimpleMpdNotifier-members.html b/docs/d2/d5c/classshaka_1_1SimpleMpdNotifier-members.html index c2e5fa2967..2003c51a91 100644 --- a/docs/d2/d5c/classshaka_1_1SimpleMpdNotifier-members.html +++ b/docs/d2/d5c/classshaka_1_1SimpleMpdNotifier-members.html @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 2fa83e2a72..90ef740ee1 100644 --- a/docs/d2/d61/structshaka_1_1media_1_1H264ModificationOfPicNum-members.html +++ b/docs/d2/d61/structshaka_1_1media_1_1H264ModificationOfPicNum-members.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/d62/simple__mpd__notifier_8h_source.html b/docs/d2/d62/simple__mpd__notifier_8h_source.html index a678860354..2d7ad4e100 100644 --- a/docs/d2/d62/simple__mpd__notifier_8h_source.html +++ b/docs/d2/d62/simple__mpd__notifier_8h_source.html @@ -170,23 +170,23 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
      86 } // namespace shaka
      87 
      88 #endif // MPD_BASE_SIMPLE_MPD_NOTIFIER_H_
      - -
      This class generates DASH MPDs (Media Presentation Descriptions).
      Definition: mpd_builder.h:58
      + +
      This class generates DASH MPDs (Media Presentation Descriptions).
      Definition: mpd_builder.h:57
      -
      bool AddContentProtectionElement(uint32_t id, const ContentProtectionElement &content_protection_element) override
      +
      bool AddContentProtectionElement(uint32_t id, const ContentProtectionElement &content_protection_element) override
      -
      bool NotifyNewSegment(uint32_t id, uint64_t start_time, uint64_t duration, uint64_t size) override
      - -
      bool NotifySampleDuration(uint32_t container_id, uint32_t sample_duration) override
      +
      bool NotifyNewSegment(uint32_t id, uint64_t start_time, uint64_t duration, uint64_t size) override
      + +
      bool NotifySampleDuration(uint32_t container_id, uint32_t sample_duration) override
      DashProfile dash_profile() const
      Definition: mpd_notifier.h:108
      -
      bool NotifyEncryptionUpdate(uint32_t container_id, const std::string &drm_uuid, const std::vector< uint8_t > &new_key_id, const std::vector< uint8_t > &new_pssh) override
      +
      bool NotifyEncryptionUpdate(uint32_t container_id, const std::string &drm_uuid, const std::vector< uint8_t > &new_key_id, const std::vector< uint8_t > &new_pssh) override
      Defines Mpd Options.
      Definition: mpd_options.h:15
      -
      bool NotifyNewContainer(const MediaInfo &media_info, uint32_t *id) override
      +
      bool NotifyNewContainer(const MediaInfo &media_info, uint32_t *id) override
      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 e15579fdc8..e04bd72b6f 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 736ff7c16e..7efefe8e15 100644 --- a/docs/d2/d6a/classshaka_1_1media_1_1AesCryptor-members.html +++ b/docs/d2/d6a/classshaka_1_1media_1_1AesCryptor-members.html @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/d6f/classBandwidthEstimator.html b/docs/d2/d6f/classBandwidthEstimator.html index e89381a44d..3854e7d15d 100644 --- a/docs/d2/d6f/classBandwidthEstimator.html +++ b/docs/d2/d6f/classBandwidthEstimator.html @@ -151,7 +151,7 @@ static const int kUseAllBl 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 9fac417555..71bf2a5efa 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 @@ -173,7 +173,7 @@ Additional Inherited Members diff --git a/docs/d2/d7b/classshaka_1_1DashIopMpdNotifier-members.html b/docs/d2/d7b/classshaka_1_1DashIopMpdNotifier-members.html index 8cb3469d2c..4698aa72f9 100644 --- a/docs/d2/d7b/classshaka_1_1DashIopMpdNotifier-members.html +++ b/docs/d2/d7b/classshaka_1_1DashIopMpdNotifier-members.html @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/d7b/simple__mpd__notifier_8cc_source.html b/docs/d2/d7b/simple__mpd__notifier_8cc_source.html index a708de582f..169c52e6c9 100644 --- a/docs/d2/d7b/simple__mpd__notifier_8cc_source.html +++ b/docs/d2/d7b/simple__mpd__notifier_8cc_source.html @@ -96,150 +96,151 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
      7 #include "packager/mpd/base/simple_mpd_notifier.h"
      8 
      9 #include "packager/base/logging.h"
      -
      10 #include "packager/mpd/base/mpd_builder.h"
      -
      11 #include "packager/mpd/base/mpd_notifier_util.h"
      -
      12 #include "packager/mpd/base/mpd_utils.h"
      -
      13 
      -
      14 namespace shaka {
      -
      15 
      -
      16 SimpleMpdNotifier::SimpleMpdNotifier(DashProfile dash_profile,
      -
      17  const MpdOptions& mpd_options,
      -
      18  const std::vector<std::string>& base_urls,
      -
      19  const std::string& output_path)
      -
      20  : MpdNotifier(dash_profile),
      -
      21  output_path_(output_path),
      -
      22  mpd_builder_(new MpdBuilder(dash_profile == kLiveProfile
      -
      23  ? MpdBuilder::kDynamic
      -
      24  : MpdBuilder::kStatic,
      -
      25  mpd_options)) {
      -
      26  DCHECK(dash_profile == kLiveProfile || dash_profile == kOnDemandProfile);
      -
      27  for (size_t i = 0; i < base_urls.size(); ++i)
      -
      28  mpd_builder_->AddBaseUrl(base_urls[i]);
      -
      29 }
      -
      30 
      -
      31 SimpleMpdNotifier::~SimpleMpdNotifier() {
      -
      32 }
      -
      33 
      - -
      35  return true;
      -
      36 }
      -
      37 
      -
      38 bool SimpleMpdNotifier::NotifyNewContainer(const MediaInfo& media_info,
      -
      39  uint32_t* container_id) {
      -
      40  DCHECK(container_id);
      -
      41 
      -
      42  ContentType content_type = GetContentType(media_info);
      -
      43  if (content_type == kContentTypeUnknown)
      -
      44  return false;
      -
      45 
      -
      46  base::AutoLock auto_lock(lock_);
      -
      47 
      -
      48  // TODO(kqyang): Consider adding a new method MpdBuilder::AddRepresentation.
      -
      49  // Most of the codes here can be moved inside.
      -
      50  std::string key = GetAdaptationSetKey(media_info);
      -
      51  std::string lang = GetLanguage(media_info);
      -
      52  AdaptationSet** adaptation_set = &adaptation_set_map_[key];
      -
      53  if (*adaptation_set == NULL)
      -
      54  *adaptation_set = mpd_builder_->AddAdaptationSet(lang);
      -
      55 
      -
      56  DCHECK(*adaptation_set);
      -
      57  MediaInfo adjusted_media_info(media_info);
      -
      58  MpdBuilder::MakePathsRelativeToMpd(output_path_, &adjusted_media_info);
      -
      59  Representation* representation =
      -
      60  (*adaptation_set)->AddRepresentation(adjusted_media_info);
      -
      61  if (representation == NULL)
      -
      62  return false;
      -
      63 
      -
      64  // For SimpleMpdNotifier, just put it in Representation. It should still
      -
      65  // generate a valid MPD.
      -
      66  AddContentProtectionElements(media_info, representation);
      -
      67  *container_id = representation->id();
      -
      68  DCHECK(!ContainsKey(representation_map_, representation->id()));
      -
      69  representation_map_[representation->id()] = representation;
      -
      70  return true;
      -
      71 }
      -
      72 
      -
      73 bool SimpleMpdNotifier::NotifySampleDuration(uint32_t container_id,
      -
      74  uint32_t sample_duration) {
      -
      75  base::AutoLock auto_lock(lock_);
      -
      76  RepresentationMap::iterator it = representation_map_.find(container_id);
      -
      77  if (it == representation_map_.end()) {
      -
      78  LOG(ERROR) << "Unexpected container_id: " << container_id;
      -
      79  return false;
      -
      80  }
      -
      81  it->second->SetSampleDuration(sample_duration);
      -
      82  return true;
      -
      83 }
      -
      84 
      -
      85 bool SimpleMpdNotifier::NotifyNewSegment(uint32_t container_id,
      -
      86  uint64_t start_time,
      -
      87  uint64_t duration,
      -
      88  uint64_t size) {
      -
      89  base::AutoLock auto_lock(lock_);
      -
      90  RepresentationMap::iterator it = representation_map_.find(container_id);
      -
      91  if (it == representation_map_.end()) {
      -
      92  LOG(ERROR) << "Unexpected container_id: " << container_id;
      -
      93  return false;
      -
      94  }
      -
      95  it->second->AddNewSegment(start_time, duration, size);
      -
      96  return true;
      -
      97 }
      -
      98 
      - -
      100  uint32_t container_id,
      -
      101  const std::string& drm_uuid,
      -
      102  const std::vector<uint8_t>& new_key_id,
      -
      103  const std::vector<uint8_t>& new_pssh) {
      -
      104  base::AutoLock auto_lock(lock_);
      -
      105  RepresentationMap::iterator it = representation_map_.find(container_id);
      -
      106  if (it == representation_map_.end()) {
      -
      107  LOG(ERROR) << "Unexpected container_id: " << container_id;
      -
      108  return false;
      -
      109  }
      -
      110  it->second->UpdateContentProtectionPssh(drm_uuid,
      -
      111  Uint8VectorToBase64(new_pssh));
      -
      112  return true;
      -
      113 }
      -
      114 
      - -
      116  uint32_t container_id,
      -
      117  const ContentProtectionElement& content_protection_element) {
      -
      118  base::AutoLock auto_lock(lock_);
      -
      119  RepresentationMap::iterator it = representation_map_.find(container_id);
      -
      120  if (it == representation_map_.end()) {
      -
      121  LOG(ERROR) << "Unexpected container_id: " << container_id;
      -
      122  return false;
      -
      123  }
      -
      124  it->second->AddContentProtectionElement(content_protection_element);
      -
      125  return true;
      -
      126 }
      -
      127 
      - -
      129  base::AutoLock auto_lock(lock_);
      -
      130  return WriteMpdToFile(output_path_, mpd_builder_.get());
      -
      131 }
      -
      132 
      -
      133 } // namespace shaka
      - - -
      uint32_t id() const
      Definition: mpd_builder.h:503
      +
      10 #include "packager/base/stl_util.h"
      +
      11 #include "packager/mpd/base/mpd_builder.h"
      +
      12 #include "packager/mpd/base/mpd_notifier_util.h"
      +
      13 #include "packager/mpd/base/mpd_utils.h"
      +
      14 
      +
      15 namespace shaka {
      +
      16 
      +
      17 SimpleMpdNotifier::SimpleMpdNotifier(DashProfile dash_profile,
      +
      18  const MpdOptions& mpd_options,
      +
      19  const std::vector<std::string>& base_urls,
      +
      20  const std::string& output_path)
      +
      21  : MpdNotifier(dash_profile),
      +
      22  output_path_(output_path),
      +
      23  mpd_builder_(new MpdBuilder(dash_profile == kLiveProfile
      +
      24  ? MpdBuilder::kDynamic
      +
      25  : MpdBuilder::kStatic,
      +
      26  mpd_options)) {
      +
      27  DCHECK(dash_profile == kLiveProfile || dash_profile == kOnDemandProfile);
      +
      28  for (size_t i = 0; i < base_urls.size(); ++i)
      +
      29  mpd_builder_->AddBaseUrl(base_urls[i]);
      +
      30 }
      +
      31 
      +
      32 SimpleMpdNotifier::~SimpleMpdNotifier() {
      +
      33 }
      +
      34 
      + +
      36  return true;
      +
      37 }
      +
      38 
      +
      39 bool SimpleMpdNotifier::NotifyNewContainer(const MediaInfo& media_info,
      +
      40  uint32_t* container_id) {
      +
      41  DCHECK(container_id);
      +
      42 
      +
      43  ContentType content_type = GetContentType(media_info);
      +
      44  if (content_type == kContentTypeUnknown)
      +
      45  return false;
      +
      46 
      +
      47  base::AutoLock auto_lock(lock_);
      +
      48 
      +
      49  // TODO(kqyang): Consider adding a new method MpdBuilder::AddRepresentation.
      +
      50  // Most of the codes here can be moved inside.
      +
      51  std::string key = GetAdaptationSetKey(media_info);
      +
      52  std::string lang = GetLanguage(media_info);
      +
      53  AdaptationSet** adaptation_set = &adaptation_set_map_[key];
      +
      54  if (*adaptation_set == NULL)
      +
      55  *adaptation_set = mpd_builder_->AddAdaptationSet(lang);
      +
      56 
      +
      57  DCHECK(*adaptation_set);
      +
      58  MediaInfo adjusted_media_info(media_info);
      +
      59  MpdBuilder::MakePathsRelativeToMpd(output_path_, &adjusted_media_info);
      +
      60  Representation* representation =
      +
      61  (*adaptation_set)->AddRepresentation(adjusted_media_info);
      +
      62  if (representation == NULL)
      +
      63  return false;
      +
      64 
      +
      65  // For SimpleMpdNotifier, just put it in Representation. It should still
      +
      66  // generate a valid MPD.
      +
      67  AddContentProtectionElements(media_info, representation);
      +
      68  *container_id = representation->id();
      +
      69  DCHECK(!ContainsKey(representation_map_, representation->id()));
      +
      70  representation_map_[representation->id()] = representation;
      +
      71  return true;
      +
      72 }
      +
      73 
      +
      74 bool SimpleMpdNotifier::NotifySampleDuration(uint32_t container_id,
      +
      75  uint32_t sample_duration) {
      +
      76  base::AutoLock auto_lock(lock_);
      +
      77  RepresentationMap::iterator it = representation_map_.find(container_id);
      +
      78  if (it == representation_map_.end()) {
      +
      79  LOG(ERROR) << "Unexpected container_id: " << container_id;
      +
      80  return false;
      +
      81  }
      +
      82  it->second->SetSampleDuration(sample_duration);
      +
      83  return true;
      +
      84 }
      +
      85 
      +
      86 bool SimpleMpdNotifier::NotifyNewSegment(uint32_t container_id,
      +
      87  uint64_t start_time,
      +
      88  uint64_t duration,
      +
      89  uint64_t size) {
      +
      90  base::AutoLock auto_lock(lock_);
      +
      91  RepresentationMap::iterator it = representation_map_.find(container_id);
      +
      92  if (it == representation_map_.end()) {
      +
      93  LOG(ERROR) << "Unexpected container_id: " << container_id;
      +
      94  return false;
      +
      95  }
      +
      96  it->second->AddNewSegment(start_time, duration, size);
      +
      97  return true;
      +
      98 }
      +
      99 
      + +
      101  uint32_t container_id,
      +
      102  const std::string& drm_uuid,
      +
      103  const std::vector<uint8_t>& new_key_id,
      +
      104  const std::vector<uint8_t>& new_pssh) {
      +
      105  base::AutoLock auto_lock(lock_);
      +
      106  RepresentationMap::iterator it = representation_map_.find(container_id);
      +
      107  if (it == representation_map_.end()) {
      +
      108  LOG(ERROR) << "Unexpected container_id: " << container_id;
      +
      109  return false;
      +
      110  }
      +
      111  it->second->UpdateContentProtectionPssh(drm_uuid,
      +
      112  Uint8VectorToBase64(new_pssh));
      +
      113  return true;
      +
      114 }
      +
      115 
      + +
      117  uint32_t container_id,
      +
      118  const ContentProtectionElement& content_protection_element) {
      +
      119  base::AutoLock auto_lock(lock_);
      +
      120  RepresentationMap::iterator it = representation_map_.find(container_id);
      +
      121  if (it == representation_map_.end()) {
      +
      122  LOG(ERROR) << "Unexpected container_id: " << container_id;
      +
      123  return false;
      +
      124  }
      +
      125  it->second->AddContentProtectionElement(content_protection_element);
      +
      126  return true;
      +
      127 }
      +
      128 
      + +
      130  base::AutoLock auto_lock(lock_);
      +
      131  return WriteMpdToFile(output_path_, mpd_builder_.get());
      +
      132 }
      +
      133 
      +
      134 } // namespace shaka
      + + +
      uint32_t id() const
      Definition: mpd_builder.h:500
      -
      bool AddContentProtectionElement(uint32_t id, const ContentProtectionElement &content_protection_element) override
      +
      bool AddContentProtectionElement(uint32_t id, const ContentProtectionElement &content_protection_element) override
      void AddContentProtectionElements(const MediaInfo &media_info, Representation *parent)
      Definition: mpd_utils.cc:339
      -
      bool NotifyNewSegment(uint32_t id, uint64_t start_time, uint64_t duration, uint64_t size) override
      - +
      bool NotifyNewSegment(uint32_t id, uint64_t start_time, uint64_t duration, uint64_t size) override
      +
      std::string Uint8VectorToBase64(const std::vector< uint8_t > &input)
      Converts uint8 vector into base64 encoded string.
      -
      bool NotifySampleDuration(uint32_t container_id, uint32_t sample_duration) override
      -
      bool NotifyEncryptionUpdate(uint32_t container_id, const std::string &drm_uuid, const std::vector< uint8_t > &new_key_id, const std::vector< uint8_t > &new_pssh) override
      -
      static void MakePathsRelativeToMpd(const std::string &mpd_path, MediaInfo *media_info)
      Definition: mpd_builder.cc:646
      - +
      bool NotifySampleDuration(uint32_t container_id, uint32_t sample_duration) override
      +
      bool NotifyEncryptionUpdate(uint32_t container_id, const std::string &drm_uuid, const std::vector< uint8_t > &new_key_id, const std::vector< uint8_t > &new_pssh) override
      +
      static void MakePathsRelativeToMpd(const std::string &mpd_path, MediaInfo *media_info)
      Definition: mpd_builder.cc:643
      +
      ContentType GetContentType(const MediaInfo &media_info)
      bool WriteMpdToFile(const std::string &output_path, MpdBuilder *mpd_builder)
      -
      bool NotifyNewContainer(const MediaInfo &media_info, uint32_t *id) override
      +
      bool NotifyNewContainer(const MediaInfo &media_info, uint32_t *id) override
      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 618f7ca6d8..4ff561aba7 100644 --- a/docs/d2/d7e/aac__audio__specific__config_8h_source.html +++ b/docs/d2/d7e/aac__audio__specific__config_8h_source.html @@ -164,7 +164,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 51ccbd10a9..997442a017 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 @@ -173,7 +173,7 @@ Additional Inherited Members 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 1bbee4e8f8..5d5d8c741d 100644 --- a/docs/d2/d8a/hls__notify__muxer__listener_8h_source.html +++ b/docs/d2/d8a/hls__notify__muxer__listener_8h_source.html @@ -175,7 +175,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 9da92982ac..a074828da7 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 @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/d92/box__reader_8h_source.html b/docs/d2/d92/box__reader_8h_source.html index 549baa695c..8c16722929 100644 --- a/docs/d2/d92/box__reader_8h_source.html +++ b/docs/d2/d92/box__reader_8h_source.html @@ -246,7 +246,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 eefd2ddc99..a5846cee50 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 @@ -387,7 +387,7 @@ const std::vector< uint8_t > &  diff --git a/docs/d2/d95/structshaka_1_1media_1_1StreamDescriptor.html b/docs/d2/d95/structshaka_1_1media_1_1StreamDescriptor.html index 80b2eb9e20..567c090957 100644 --- a/docs/d2/d95/structshaka_1_1media_1_1StreamDescriptor.html +++ b/docs/d2/d95/structshaka_1_1media_1_1StreamDescriptor.html @@ -140,7 +140,7 @@ std::string hls_playlist_n diff --git a/docs/d2/da6/threaded__io__file_8h_source.html b/docs/d2/da6/threaded__io__file_8h_source.html index aa5f86ecf0..8b90970ec2 100644 --- a/docs/d2/da6/threaded__io__file_8h_source.html +++ b/docs/d2/da6/threaded__io__file_8h_source.html @@ -172,7 +172,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/da8/mp4_2segmenter_8cc_source.html b/docs/d2/da8/mp4_2segmenter_8cc_source.html index ebcb60e25e..349680f58b 100644 --- a/docs/d2/da8/mp4_2segmenter_8cc_source.html +++ b/docs/d2/da8/mp4_2segmenter_8cc_source.html @@ -98,189 +98,189 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
      9 #include <algorithm>
      10 
      11 #include "packager/base/logging.h"
      -
      12 #include "packager/base/stl_util.h"
      -
      13 #include "packager/media/base/aes_cryptor.h"
      -
      14 #include "packager/media/base/buffer_writer.h"
      -
      15 #include "packager/media/base/key_source.h"
      -
      16 #include "packager/media/base/media_sample.h"
      -
      17 #include "packager/media/base/media_stream.h"
      -
      18 #include "packager/media/base/muxer_options.h"
      -
      19 #include "packager/media/base/muxer_util.h"
      -
      20 #include "packager/media/base/video_stream_info.h"
      -
      21 #include "packager/media/event/muxer_listener.h"
      -
      22 #include "packager/media/event/progress_listener.h"
      -
      23 #include "packager/media/formats/mp4/box_definitions.h"
      -
      24 #include "packager/media/formats/mp4/key_rotation_fragmenter.h"
      -
      25 #include "packager/version/version.h"
      -
      26 
      -
      27 namespace shaka {
      -
      28 namespace media {
      -
      29 namespace mp4 {
      -
      30 
      -
      31 namespace {
      -
      32 const size_t kCencKeyIdSize = 16u;
      -
      33 
      -
      34 // The version of cenc implemented here. CENC 4.
      -
      35 const int kCencSchemeVersion = 0x00010000;
      -
      36 
      -
      37 // The default KID for key rotation is all 0s.
      -
      38 const uint8_t kKeyRotationDefaultKeyId[] = {
      -
      39  0, 0, 0, 0, 0, 0, 0, 0,
      -
      40  0, 0, 0, 0, 0, 0, 0, 0
      -
      41 };
      -
      42 
      -
      43 // Defines protection pattern for pattern-based encryption.
      -
      44 struct ProtectionPattern {
      -
      45  uint8_t crypt_byte_block;
      -
      46  uint8_t skip_byte_block;
      -
      47 };
      -
      48 
      -
      49 static_assert(arraysize(kKeyRotationDefaultKeyId) == kCencKeyIdSize,
      -
      50  "cenc_key_id_must_be_size_16");
      -
      51 
      -
      52 uint64_t Rescale(uint64_t time_in_old_scale,
      -
      53  uint32_t old_scale,
      -
      54  uint32_t new_scale) {
      -
      55  return static_cast<double>(time_in_old_scale) / old_scale * new_scale;
      -
      56 }
      -
      57 
      -
      58 ProtectionPattern GetProtectionPattern(FourCC protection_scheme,
      -
      59  TrackType track_type) {
      -
      60  ProtectionPattern pattern;
      -
      61  if (protection_scheme != FOURCC_cbcs && protection_scheme != FOURCC_cens) {
      -
      62  // Not using pattern encryption.
      -
      63  pattern.crypt_byte_block = 0u;
      -
      64  pattern.skip_byte_block = 0u;
      -
      65  } else if (track_type != kVideo) {
      -
      66  // Tracks other than video are protected using whole-block full-sample
      -
      67  // encryption, which is essentially a pattern of 1:0. Note that this may not
      -
      68  // be the same as the non-pattern based encryption counterparts, e.g. in
      -
      69  // 'cens' for full sample encryption, the whole sample is encrypted up to
      -
      70  // the last 16-byte boundary, see 23001-7:2016(E) 9.7; while in 'cenc' for
      -
      71  // full sample encryption, the last partial 16-byte block is also encrypted,
      -
      72  // see 23001-7:2016(E) 9.4.2. Another difference is the use of constant iv.
      -
      73  pattern.crypt_byte_block = 1u;
      -
      74  pattern.skip_byte_block = 0u;
      -
      75  } else {
      -
      76  // Use 1:9 pattern for video.
      -
      77  const uint8_t kCryptByteBlock = 1u;
      -
      78  const uint8_t kSkipByteBlock = 9u;
      -
      79  pattern.crypt_byte_block = kCryptByteBlock;
      -
      80  pattern.skip_byte_block = kSkipByteBlock;
      -
      81  }
      -
      82  return pattern;
      -
      83 }
      -
      84 
      -
      85 void GenerateSinf(const EncryptionKey& encryption_key,
      -
      86  FourCC old_type,
      -
      87  FourCC protection_scheme,
      -
      88  ProtectionPattern pattern,
      -
      89  ProtectionSchemeInfo* sinf) {
      -
      90  sinf->format.format = old_type;
      -
      91 
      -
      92  DCHECK_NE(protection_scheme, FOURCC_NULL);
      -
      93  sinf->type.type = protection_scheme;
      -
      94  sinf->type.version = kCencSchemeVersion;
      -
      95 
      -
      96  auto& track_encryption = sinf->info.track_encryption;
      -
      97  track_encryption.default_is_protected = 1;
      -
      98  DCHECK(!encryption_key.iv.empty());
      -
      99  if (protection_scheme == FOURCC_cbcs) {
      -
      100  // ISO/IEC 23001-7:2016 10.4.1
      -
      101  // For 'cbcs' scheme, Constant IVs SHALL be used.
      -
      102  track_encryption.default_per_sample_iv_size = 0;
      -
      103  track_encryption.default_constant_iv = encryption_key.iv;
      -
      104  } else {
      -
      105  track_encryption.default_per_sample_iv_size =
      -
      106  static_cast<uint8_t>(encryption_key.iv.size());
      -
      107  }
      -
      108  track_encryption.default_crypt_byte_block = pattern.crypt_byte_block;
      -
      109  track_encryption.default_skip_byte_block = pattern.skip_byte_block;
      -
      110  track_encryption.default_kid = encryption_key.key_id;
      -
      111 }
      -
      112 
      -
      113 void GenerateEncryptedSampleEntry(const EncryptionKey& encryption_key,
      -
      114  double clear_lead_in_seconds,
      -
      115  FourCC protection_scheme,
      -
      116  ProtectionPattern pattern,
      -
      117  SampleDescription* description) {
      -
      118  DCHECK(description);
      -
      119  if (description->type == kVideo) {
      -
      120  DCHECK_EQ(1u, description->video_entries.size());
      -
      121 
      -
      122  // Add a second entry for clear content if needed.
      -
      123  if (clear_lead_in_seconds > 0)
      -
      124  description->video_entries.push_back(description->video_entries[0]);
      -
      125 
      -
      126  // Convert the first entry to an encrypted entry.
      -
      127  VideoSampleEntry& entry = description->video_entries[0];
      -
      128  GenerateSinf(encryption_key, entry.format, protection_scheme, pattern,
      -
      129  &entry.sinf);
      -
      130  entry.format = FOURCC_encv;
      -
      131  } else {
      -
      132  DCHECK_EQ(kAudio, description->type);
      -
      133  DCHECK_EQ(1u, description->audio_entries.size());
      -
      134 
      -
      135  // Add a second entry for clear content if needed.
      -
      136  if (clear_lead_in_seconds > 0)
      -
      137  description->audio_entries.push_back(description->audio_entries[0]);
      -
      138 
      -
      139  // Convert the first entry to an encrypted entry.
      -
      140  AudioSampleEntry& entry = description->audio_entries[0];
      -
      141  GenerateSinf(encryption_key, entry.format, protection_scheme, pattern,
      -
      142  &entry.sinf);
      -
      143  entry.format = FOURCC_enca;
      -
      144  }
      -
      145 }
      -
      146 
      -
      147 } // namespace
      -
      148 
      -
      149 Segmenter::Segmenter(const MuxerOptions& options,
      -
      150  std::unique_ptr<FileType> ftyp,
      -
      151  std::unique_ptr<Movie> moov)
      -
      152  : options_(options),
      -
      153  ftyp_(std::move(ftyp)),
      -
      154  moov_(std::move(moov)),
      -
      155  moof_(new MovieFragment()),
      -
      156  fragment_buffer_(new BufferWriter()),
      -
      157  sidx_(new SegmentIndex()),
      -
      158  muxer_listener_(NULL),
      -
      159  progress_listener_(NULL),
      -
      160  progress_target_(0),
      -
      161  accumulated_progress_(0),
      -
      162  sample_duration_(0u) {}
      -
      163 
      -
      164 Segmenter::~Segmenter() { STLDeleteElements(&fragmenters_); }
      -
      165 
      -
      166 Status Segmenter::Initialize(const std::vector<MediaStream*>& streams,
      -
      167  MuxerListener* muxer_listener,
      -
      168  ProgressListener* progress_listener,
      -
      169  KeySource* encryption_key_source,
      -
      170  uint32_t max_sd_pixels,
      -
      171  double clear_lead_in_seconds,
      -
      172  double crypto_period_duration_in_seconds,
      -
      173  FourCC protection_scheme) {
      -
      174  DCHECK_LT(0u, streams.size());
      -
      175  muxer_listener_ = muxer_listener;
      -
      176  progress_listener_ = progress_listener;
      -
      177  moof_->header.sequence_number = 0;
      -
      178 
      -
      179  moof_->tracks.resize(streams.size());
      -
      180  segment_durations_.resize(streams.size());
      -
      181  fragmenters_.resize(streams.size());
      -
      182  const bool key_rotation_enabled = crypto_period_duration_in_seconds != 0;
      -
      183  const bool kInitialEncryptionInfo = true;
      -
      184 
      -
      185  for (uint32_t i = 0; i < streams.size(); ++i) {
      -
      186  stream_map_[streams[i]] = i;
      -
      187  moof_->tracks[i].header.track_id = i + 1;
      -
      188  if (streams[i]->info()->stream_type() == kStreamVideo) {
      -
      189  // Use the first video stream as the reference stream (which is 1-based).
      -
      190  if (sidx_->reference_id == 0)
      -
      191  sidx_->reference_id = i + 1;
      -
      192  }
      -
      193  if (!encryption_key_source) {
      -
      194  fragmenters_[i] = new Fragmenter(streams[i]->info(), &moof_->tracks[i]);
      +
      12 #include "packager/media/base/aes_cryptor.h"
      +
      13 #include "packager/media/base/buffer_writer.h"
      +
      14 #include "packager/media/base/key_source.h"
      +
      15 #include "packager/media/base/media_sample.h"
      +
      16 #include "packager/media/base/media_stream.h"
      +
      17 #include "packager/media/base/muxer_options.h"
      +
      18 #include "packager/media/base/muxer_util.h"
      +
      19 #include "packager/media/base/video_stream_info.h"
      +
      20 #include "packager/media/event/muxer_listener.h"
      +
      21 #include "packager/media/event/progress_listener.h"
      +
      22 #include "packager/media/formats/mp4/box_definitions.h"
      +
      23 #include "packager/media/formats/mp4/key_rotation_fragmenter.h"
      +
      24 #include "packager/version/version.h"
      +
      25 
      +
      26 namespace shaka {
      +
      27 namespace media {
      +
      28 namespace mp4 {
      +
      29 
      +
      30 namespace {
      +
      31 const size_t kCencKeyIdSize = 16u;
      +
      32 
      +
      33 // The version of cenc implemented here. CENC 4.
      +
      34 const int kCencSchemeVersion = 0x00010000;
      +
      35 
      +
      36 // The default KID for key rotation is all 0s.
      +
      37 const uint8_t kKeyRotationDefaultKeyId[] = {
      +
      38  0, 0, 0, 0, 0, 0, 0, 0,
      +
      39  0, 0, 0, 0, 0, 0, 0, 0
      +
      40 };
      +
      41 
      +
      42 // Defines protection pattern for pattern-based encryption.
      +
      43 struct ProtectionPattern {
      +
      44  uint8_t crypt_byte_block;
      +
      45  uint8_t skip_byte_block;
      +
      46 };
      +
      47 
      +
      48 static_assert(arraysize(kKeyRotationDefaultKeyId) == kCencKeyIdSize,
      +
      49  "cenc_key_id_must_be_size_16");
      +
      50 
      +
      51 uint64_t Rescale(uint64_t time_in_old_scale,
      +
      52  uint32_t old_scale,
      +
      53  uint32_t new_scale) {
      +
      54  return static_cast<double>(time_in_old_scale) / old_scale * new_scale;
      +
      55 }
      +
      56 
      +
      57 ProtectionPattern GetProtectionPattern(FourCC protection_scheme,
      +
      58  TrackType track_type) {
      +
      59  ProtectionPattern pattern;
      +
      60  if (protection_scheme != FOURCC_cbcs && protection_scheme != FOURCC_cens) {
      +
      61  // Not using pattern encryption.
      +
      62  pattern.crypt_byte_block = 0u;
      +
      63  pattern.skip_byte_block = 0u;
      +
      64  } else if (track_type != kVideo) {
      +
      65  // Tracks other than video are protected using whole-block full-sample
      +
      66  // encryption, which is essentially a pattern of 1:0. Note that this may not
      +
      67  // be the same as the non-pattern based encryption counterparts, e.g. in
      +
      68  // 'cens' for full sample encryption, the whole sample is encrypted up to
      +
      69  // the last 16-byte boundary, see 23001-7:2016(E) 9.7; while in 'cenc' for
      +
      70  // full sample encryption, the last partial 16-byte block is also encrypted,
      +
      71  // see 23001-7:2016(E) 9.4.2. Another difference is the use of constant iv.
      +
      72  pattern.crypt_byte_block = 1u;
      +
      73  pattern.skip_byte_block = 0u;
      +
      74  } else {
      +
      75  // Use 1:9 pattern for video.
      +
      76  const uint8_t kCryptByteBlock = 1u;
      +
      77  const uint8_t kSkipByteBlock = 9u;
      +
      78  pattern.crypt_byte_block = kCryptByteBlock;
      +
      79  pattern.skip_byte_block = kSkipByteBlock;
      +
      80  }
      +
      81  return pattern;
      +
      82 }
      +
      83 
      +
      84 void GenerateSinf(const EncryptionKey& encryption_key,
      +
      85  FourCC old_type,
      +
      86  FourCC protection_scheme,
      +
      87  ProtectionPattern pattern,
      +
      88  ProtectionSchemeInfo* sinf) {
      +
      89  sinf->format.format = old_type;
      +
      90 
      +
      91  DCHECK_NE(protection_scheme, FOURCC_NULL);
      +
      92  sinf->type.type = protection_scheme;
      +
      93  sinf->type.version = kCencSchemeVersion;
      +
      94 
      +
      95  auto& track_encryption = sinf->info.track_encryption;
      +
      96  track_encryption.default_is_protected = 1;
      +
      97  DCHECK(!encryption_key.iv.empty());
      +
      98  if (protection_scheme == FOURCC_cbcs) {
      +
      99  // ISO/IEC 23001-7:2016 10.4.1
      +
      100  // For 'cbcs' scheme, Constant IVs SHALL be used.
      +
      101  track_encryption.default_per_sample_iv_size = 0;
      +
      102  track_encryption.default_constant_iv = encryption_key.iv;
      +
      103  } else {
      +
      104  track_encryption.default_per_sample_iv_size =
      +
      105  static_cast<uint8_t>(encryption_key.iv.size());
      +
      106  }
      +
      107  track_encryption.default_crypt_byte_block = pattern.crypt_byte_block;
      +
      108  track_encryption.default_skip_byte_block = pattern.skip_byte_block;
      +
      109  track_encryption.default_kid = encryption_key.key_id;
      +
      110 }
      +
      111 
      +
      112 void GenerateEncryptedSampleEntry(const EncryptionKey& encryption_key,
      +
      113  double clear_lead_in_seconds,
      +
      114  FourCC protection_scheme,
      +
      115  ProtectionPattern pattern,
      +
      116  SampleDescription* description) {
      +
      117  DCHECK(description);
      +
      118  if (description->type == kVideo) {
      +
      119  DCHECK_EQ(1u, description->video_entries.size());
      +
      120 
      +
      121  // Add a second entry for clear content if needed.
      +
      122  if (clear_lead_in_seconds > 0)
      +
      123  description->video_entries.push_back(description->video_entries[0]);
      +
      124 
      +
      125  // Convert the first entry to an encrypted entry.
      +
      126  VideoSampleEntry& entry = description->video_entries[0];
      +
      127  GenerateSinf(encryption_key, entry.format, protection_scheme, pattern,
      +
      128  &entry.sinf);
      +
      129  entry.format = FOURCC_encv;
      +
      130  } else {
      +
      131  DCHECK_EQ(kAudio, description->type);
      +
      132  DCHECK_EQ(1u, description->audio_entries.size());
      +
      133 
      +
      134  // Add a second entry for clear content if needed.
      +
      135  if (clear_lead_in_seconds > 0)
      +
      136  description->audio_entries.push_back(description->audio_entries[0]);
      +
      137 
      +
      138  // Convert the first entry to an encrypted entry.
      +
      139  AudioSampleEntry& entry = description->audio_entries[0];
      +
      140  GenerateSinf(encryption_key, entry.format, protection_scheme, pattern,
      +
      141  &entry.sinf);
      +
      142  entry.format = FOURCC_enca;
      +
      143  }
      +
      144 }
      +
      145 
      +
      146 } // namespace
      +
      147 
      +
      148 Segmenter::Segmenter(const MuxerOptions& options,
      +
      149  std::unique_ptr<FileType> ftyp,
      +
      150  std::unique_ptr<Movie> moov)
      +
      151  : options_(options),
      +
      152  ftyp_(std::move(ftyp)),
      +
      153  moov_(std::move(moov)),
      +
      154  moof_(new MovieFragment()),
      +
      155  fragment_buffer_(new BufferWriter()),
      +
      156  sidx_(new SegmentIndex()),
      +
      157  muxer_listener_(NULL),
      +
      158  progress_listener_(NULL),
      +
      159  progress_target_(0),
      +
      160  accumulated_progress_(0),
      +
      161  sample_duration_(0u) {}
      +
      162 
      +
      163 Segmenter::~Segmenter() {}
      +
      164 
      +
      165 Status Segmenter::Initialize(const std::vector<MediaStream*>& streams,
      +
      166  MuxerListener* muxer_listener,
      +
      167  ProgressListener* progress_listener,
      +
      168  KeySource* encryption_key_source,
      +
      169  uint32_t max_sd_pixels,
      +
      170  double clear_lead_in_seconds,
      +
      171  double crypto_period_duration_in_seconds,
      +
      172  FourCC protection_scheme) {
      +
      173  DCHECK_LT(0u, streams.size());
      +
      174  muxer_listener_ = muxer_listener;
      +
      175  progress_listener_ = progress_listener;
      +
      176  moof_->header.sequence_number = 0;
      +
      177 
      +
      178  moof_->tracks.resize(streams.size());
      +
      179  segment_durations_.resize(streams.size());
      +
      180  fragmenters_.resize(streams.size());
      +
      181  const bool key_rotation_enabled = crypto_period_duration_in_seconds != 0;
      +
      182  const bool kInitialEncryptionInfo = true;
      +
      183 
      +
      184  for (uint32_t i = 0; i < streams.size(); ++i) {
      +
      185  stream_map_[streams[i]] = i;
      +
      186  moof_->tracks[i].header.track_id = i + 1;
      +
      187  if (streams[i]->info()->stream_type() == kStreamVideo) {
      +
      188  // Use the first video stream as the reference stream (which is 1-based).
      +
      189  if (sidx_->reference_id == 0)
      +
      190  sidx_->reference_id = i + 1;
      +
      191  }
      +
      192  if (!encryption_key_source) {
      +
      193  fragmenters_[i].reset(
      +
      194  new Fragmenter(streams[i]->info(), &moof_->tracks[i]));
      195  continue;
      196  }
      197 
      @@ -309,13 +309,13 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
      220  encryption_key.iv, encryption_key.key_system_info);
      221  }
      222 
      -
      223  fragmenters_[i] = new KeyRotationFragmenter(
      +
      223  fragmenters_[i].reset(new KeyRotationFragmenter(
      224  moof_.get(), streams[i]->info(), &moof_->tracks[i],
      225  encryption_key_source, track_type,
      226  crypto_period_duration_in_seconds * streams[i]->info()->time_scale(),
      227  clear_lead_in_seconds * streams[i]->info()->time_scale(),
      228  protection_scheme, pattern.crypt_byte_block, pattern.skip_byte_block,
      -
      229  muxer_listener_);
      +
      229  muxer_listener_));
      230  continue;
      231  }
      232 
      @@ -347,11 +347,11 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
      258  }
      259  }
      260 
      -
      261  fragmenters_[i] = new EncryptingFragmenter(
      +
      261  fragmenters_[i].reset(new EncryptingFragmenter(
      262  streams[i]->info(), &moof_->tracks[i], std::move(encryption_key),
      263  clear_lead_in_seconds * streams[i]->info()->time_scale(),
      264  protection_scheme, pattern.crypt_byte_block, pattern.skip_byte_block,
      -
      265  muxer_listener_);
      +
      265  muxer_listener_));
      266  }
      267 
      @@ -383,197 +383,193 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
      294 }
      295 
      -
      297  for (std::vector<Fragmenter*>::iterator it = fragmenters_.begin();
      -
      298  it != fragmenters_.end();
      -
      299  ++it) {
      -
      300  Status status = FinalizeFragment(true, *it);
      -
      301  if (!status.ok())
      -
      302  return status;
      -
      303  }
      -
      304 
      -
      305  // Set tracks and moov durations.
      -
      306  // Note that the updated moov box will be written to output file for VOD case
      -
      307  // only.
      -
      308  for (std::vector<Track>::iterator track = moov_->tracks.begin();
      -
      309  track != moov_->tracks.end();
      -
      310  ++track) {
      -
      311  track->header.duration = Rescale(track->media.header.duration,
      -
      312  track->media.header.timescale,
      -
      313  moov_->header.timescale);
      -
      314  if (track->header.duration > moov_->header.duration)
      -
      315  moov_->header.duration = track->header.duration;
      -
      316  }
      -
      317  moov_->extends.header.fragment_duration = moov_->header.duration;
      -
      318 
      -
      319  return DoFinalize();
      -
      320 }
      -
      321 
      - -
      323  scoped_refptr<MediaSample> sample) {
      -
      324  // Find the fragmenter for this stream.
      -
      325  DCHECK(stream);
      -
      326  DCHECK(stream_map_.find(stream) != stream_map_.end());
      -
      327  uint32_t stream_id = stream_map_[stream];
      -
      328  Fragmenter* fragmenter = fragmenters_[stream_id];
      -
      329 
      -
      330  // Set default sample duration if it has not been set yet.
      -
      331  if (moov_->extends.tracks[stream_id].default_sample_duration == 0) {
      -
      332  moov_->extends.tracks[stream_id].default_sample_duration =
      -
      333  sample->duration();
      -
      334  }
      -
      335 
      -
      336  if (fragmenter->fragment_finalized()) {
      -
      337  return Status(error::FRAGMENT_FINALIZED,
      -
      338  "Current fragment is finalized already.");
      -
      339  }
      -
      340 
      -
      341  bool finalize_fragment = false;
      -
      342  if (fragmenter->fragment_duration() >=
      -
      343  options_.fragment_duration * stream->info()->time_scale()) {
      -
      344  if (sample->is_key_frame() || !options_.fragment_sap_aligned) {
      -
      345  finalize_fragment = true;
      -
      346  }
      -
      347  }
      -
      348  bool finalize_segment = false;
      -
      349  if (segment_durations_[stream_id] >=
      -
      350  options_.segment_duration * stream->info()->time_scale()) {
      -
      351  if (sample->is_key_frame() || !options_.segment_sap_aligned) {
      -
      352  finalize_segment = true;
      -
      353  finalize_fragment = true;
      -
      354  }
      -
      355  }
      -
      356 
      -
      357  Status status;
      -
      358  if (finalize_fragment) {
      -
      359  status = FinalizeFragment(finalize_segment, fragmenter);
      -
      360  if (!status.ok())
      -
      361  return status;
      -
      362  }
      -
      363 
      -
      364  status = fragmenter->AddSample(sample);
      -
      365  if (!status.ok())
      -
      366  return status;
      -
      367 
      -
      368  if (sample_duration_ == 0)
      -
      369  sample_duration_ = sample->duration();
      -
      370  moov_->tracks[stream_id].media.header.duration += sample->duration();
      -
      371  segment_durations_[stream_id] += sample->duration();
      -
      372  DCHECK_GE(segment_durations_[stream_id], fragmenter->fragment_duration());
      -
      373  return Status::OK;
      -
      374 }
      -
      375 
      -
      376 uint32_t Segmenter::GetReferenceTimeScale() const {
      -
      377  return moov_->header.timescale;
      -
      378 }
      -
      379 
      -
      380 double Segmenter::GetDuration() const {
      -
      381  if (moov_->header.timescale == 0) {
      -
      382  // Handling the case where this is not properly initialized.
      -
      383  return 0.0;
      -
      384  }
      -
      385 
      -
      386  return static_cast<double>(moov_->header.duration) / moov_->header.timescale;
      -
      387 }
      -
      388 
      -
      389 void Segmenter::UpdateProgress(uint64_t progress) {
      -
      390  accumulated_progress_ += progress;
      -
      391 
      -
      392  if (!progress_listener_) return;
      -
      393  if (progress_target_ == 0) return;
      -
      394  // It might happen that accumulated progress exceeds progress_target due to
      -
      395  // computation errors, e.g. rounding error. Cap it so it never reports > 100%
      -
      396  // progress.
      -
      397  if (accumulated_progress_ >= progress_target_) {
      -
      398  progress_listener_->OnProgress(1.0);
      -
      399  } else {
      -
      400  progress_listener_->OnProgress(static_cast<double>(accumulated_progress_) /
      -
      401  progress_target_);
      -
      402  }
      -
      403 }
      -
      404 
      -
      405 void Segmenter::SetComplete() {
      -
      406  if (!progress_listener_) return;
      -
      407  progress_listener_->OnProgress(1.0);
      -
      408 }
      -
      409 
      -
      410 Status Segmenter::FinalizeSegment() {
      -
      411  Status status = DoFinalizeSegment();
      -
      412 
      -
      413  // Reset segment information to initial state.
      -
      414  sidx_->references.clear();
      -
      415  std::vector<uint64_t>::iterator it = segment_durations_.begin();
      -
      416  for (; it != segment_durations_.end(); ++it)
      -
      417  *it = 0;
      -
      418 
      -
      419  return status;
      -
      420 }
      -
      421 
      -
      422 uint32_t Segmenter::GetReferenceStreamId() {
      -
      423  DCHECK(sidx_);
      -
      424  return sidx_->reference_id - 1;
      -
      425 }
      -
      426 
      -
      427 Status Segmenter::FinalizeFragment(bool finalize_segment,
      -
      428  Fragmenter* fragmenter) {
      -
      429  fragmenter->FinalizeFragment();
      -
      430 
      -
      431  // Check if all tracks are ready for fragmentation.
      -
      432  for (std::vector<Fragmenter*>::iterator it = fragmenters_.begin();
      -
      433  it != fragmenters_.end();
      -
      434  ++it) {
      -
      435  if (!(*it)->fragment_finalized())
      -
      436  return Status::OK;
      -
      437  }
      -
      438 
      -
      439  MediaData mdat;
      -
      440  // Data offset relative to 'moof': moof size + mdat header size.
      -
      441  // The code will also update box sizes for moof_ and its child boxes.
      -
      442  uint64_t data_offset = moof_->ComputeSize() + mdat.HeaderSize();
      -
      443  // 'traf' should follow 'mfhd' moof header box.
      -
      444  uint64_t next_traf_position = moof_->HeaderSize() + moof_->header.box_size();
      -
      445  for (size_t i = 0; i < moof_->tracks.size(); ++i) {
      -
      446  TrackFragment& traf = moof_->tracks[i];
      -
      447  if (traf.auxiliary_offset.offsets.size() > 0) {
      -
      448  DCHECK_EQ(traf.auxiliary_offset.offsets.size(), 1u);
      -
      449  DCHECK(!traf.sample_encryption.sample_encryption_entries.empty());
      -
      450 
      -
      451  next_traf_position += traf.box_size();
      -
      452  // SampleEncryption 'senc' box should be the last box in 'traf'.
      -
      453  // |auxiliary_offset| should point to the data of SampleEncryption.
      -
      454  traf.auxiliary_offset.offsets[0] =
      -
      455  next_traf_position - traf.sample_encryption.box_size() +
      -
      456  traf.sample_encryption.HeaderSize() +
      -
      457  sizeof(uint32_t); // for sample count field in 'senc'
      -
      458  }
      -
      459  traf.runs[0].data_offset = data_offset + mdat.data_size;
      -
      460  mdat.data_size += fragmenters_[i]->data()->Size();
      -
      461  }
      -
      462 
      -
      463  // Generate segment reference.
      -
      464  sidx_->references.resize(sidx_->references.size() + 1);
      -
      465  fragmenters_[GetReferenceStreamId()]->GenerateSegmentReference(
      -
      466  &sidx_->references[sidx_->references.size() - 1]);
      -
      467  sidx_->references[sidx_->references.size() - 1].referenced_size =
      -
      468  data_offset + mdat.data_size;
      -
      469 
      -
      470  // Write the fragment to buffer.
      -
      471  moof_->Write(fragment_buffer_.get());
      -
      472  mdat.WriteHeader(fragment_buffer_.get());
      -
      473  for (Fragmenter* fragmenter : fragmenters_)
      -
      474  fragment_buffer_->AppendBuffer(*fragmenter->data());
      -
      475 
      -
      476  // Increase sequence_number for next fragment.
      -
      477  ++moof_->header.sequence_number;
      -
      478 
      -
      479  if (finalize_segment)
      -
      480  return FinalizeSegment();
      -
      481 
      -
      482  return Status::OK;
      -
      483 }
      -
      484 
      -
      485 } // namespace mp4
      -
      486 } // namespace media
      -
      487 } // namespace shaka
      +
      297  for (const std::unique_ptr<Fragmenter>& fragmenter : fragmenters_) {
      +
      298  Status status = FinalizeFragment(true, fragmenter.get());
      +
      299  if (!status.ok())
      +
      300  return status;
      +
      301  }
      +
      302 
      +
      303  // Set tracks and moov durations.
      +
      304  // Note that the updated moov box will be written to output file for VOD case
      +
      305  // only.
      +
      306  for (std::vector<Track>::iterator track = moov_->tracks.begin();
      +
      307  track != moov_->tracks.end();
      +
      308  ++track) {
      +
      309  track->header.duration = Rescale(track->media.header.duration,
      +
      310  track->media.header.timescale,
      +
      311  moov_->header.timescale);
      +
      312  if (track->header.duration > moov_->header.duration)
      +
      313  moov_->header.duration = track->header.duration;
      +
      314  }
      +
      315  moov_->extends.header.fragment_duration = moov_->header.duration;
      +
      316 
      +
      317  return DoFinalize();
      +
      318 }
      +
      319 
      + +
      321  scoped_refptr<MediaSample> sample) {
      +
      322  // Find the fragmenter for this stream.
      +
      323  DCHECK(stream);
      +
      324  DCHECK(stream_map_.find(stream) != stream_map_.end());
      +
      325  uint32_t stream_id = stream_map_[stream];
      +
      326  Fragmenter* fragmenter = fragmenters_[stream_id].get();
      +
      327 
      +
      328  // Set default sample duration if it has not been set yet.
      +
      329  if (moov_->extends.tracks[stream_id].default_sample_duration == 0) {
      +
      330  moov_->extends.tracks[stream_id].default_sample_duration =
      +
      331  sample->duration();
      +
      332  }
      +
      333 
      +
      334  if (fragmenter->fragment_finalized()) {
      +
      335  return Status(error::FRAGMENT_FINALIZED,
      +
      336  "Current fragment is finalized already.");
      +
      337  }
      +
      338 
      +
      339  bool finalize_fragment = false;
      +
      340  if (fragmenter->fragment_duration() >=
      +
      341  options_.fragment_duration * stream->info()->time_scale()) {
      +
      342  if (sample->is_key_frame() || !options_.fragment_sap_aligned) {
      +
      343  finalize_fragment = true;
      +
      344  }
      +
      345  }
      +
      346  bool finalize_segment = false;
      +
      347  if (segment_durations_[stream_id] >=
      +
      348  options_.segment_duration * stream->info()->time_scale()) {
      +
      349  if (sample->is_key_frame() || !options_.segment_sap_aligned) {
      +
      350  finalize_segment = true;
      +
      351  finalize_fragment = true;
      +
      352  }
      +
      353  }
      +
      354 
      +
      355  Status status;
      +
      356  if (finalize_fragment) {
      +
      357  status = FinalizeFragment(finalize_segment, fragmenter);
      +
      358  if (!status.ok())
      +
      359  return status;
      +
      360  }
      +
      361 
      +
      362  status = fragmenter->AddSample(sample);
      +
      363  if (!status.ok())
      +
      364  return status;
      +
      365 
      +
      366  if (sample_duration_ == 0)
      +
      367  sample_duration_ = sample->duration();
      +
      368  moov_->tracks[stream_id].media.header.duration += sample->duration();
      +
      369  segment_durations_[stream_id] += sample->duration();
      +
      370  DCHECK_GE(segment_durations_[stream_id], fragmenter->fragment_duration());
      +
      371  return Status::OK;
      +
      372 }
      +
      373 
      +
      374 uint32_t Segmenter::GetReferenceTimeScale() const {
      +
      375  return moov_->header.timescale;
      +
      376 }
      +
      377 
      +
      378 double Segmenter::GetDuration() const {
      +
      379  if (moov_->header.timescale == 0) {
      +
      380  // Handling the case where this is not properly initialized.
      +
      381  return 0.0;
      +
      382  }
      +
      383 
      +
      384  return static_cast<double>(moov_->header.duration) / moov_->header.timescale;
      +
      385 }
      +
      386 
      +
      387 void Segmenter::UpdateProgress(uint64_t progress) {
      +
      388  accumulated_progress_ += progress;
      +
      389 
      +
      390  if (!progress_listener_) return;
      +
      391  if (progress_target_ == 0) return;
      +
      392  // It might happen that accumulated progress exceeds progress_target due to
      +
      393  // computation errors, e.g. rounding error. Cap it so it never reports > 100%
      +
      394  // progress.
      +
      395  if (accumulated_progress_ >= progress_target_) {
      +
      396  progress_listener_->OnProgress(1.0);
      +
      397  } else {
      +
      398  progress_listener_->OnProgress(static_cast<double>(accumulated_progress_) /
      +
      399  progress_target_);
      +
      400  }
      +
      401 }
      +
      402 
      +
      403 void Segmenter::SetComplete() {
      +
      404  if (!progress_listener_) return;
      +
      405  progress_listener_->OnProgress(1.0);
      +
      406 }
      +
      407 
      +
      408 Status Segmenter::FinalizeSegment() {
      +
      409  Status status = DoFinalizeSegment();
      +
      410 
      +
      411  // Reset segment information to initial state.
      +
      412  sidx_->references.clear();
      +
      413  std::vector<uint64_t>::iterator it = segment_durations_.begin();
      +
      414  for (; it != segment_durations_.end(); ++it)
      +
      415  *it = 0;
      +
      416 
      +
      417  return status;
      +
      418 }
      +
      419 
      +
      420 uint32_t Segmenter::GetReferenceStreamId() {
      +
      421  DCHECK(sidx_);
      +
      422  return sidx_->reference_id - 1;
      +
      423 }
      +
      424 
      +
      425 Status Segmenter::FinalizeFragment(bool finalize_segment,
      +
      426  Fragmenter* fragmenter) {
      +
      427  fragmenter->FinalizeFragment();
      +
      428 
      +
      429  // Check if all tracks are ready for fragmentation.
      +
      430  for (const std::unique_ptr<Fragmenter>& fragmenter : fragmenters_) {
      +
      431  if (!fragmenter->fragment_finalized())
      +
      432  return Status::OK;
      +
      433  }
      +
      434 
      +
      435  MediaData mdat;
      +
      436  // Data offset relative to 'moof': moof size + mdat header size.
      +
      437  // The code will also update box sizes for moof_ and its child boxes.
      +
      438  uint64_t data_offset = moof_->ComputeSize() + mdat.HeaderSize();
      +
      439  // 'traf' should follow 'mfhd' moof header box.
      +
      440  uint64_t next_traf_position = moof_->HeaderSize() + moof_->header.box_size();
      +
      441  for (size_t i = 0; i < moof_->tracks.size(); ++i) {
      +
      442  TrackFragment& traf = moof_->tracks[i];
      +
      443  if (traf.auxiliary_offset.offsets.size() > 0) {
      +
      444  DCHECK_EQ(traf.auxiliary_offset.offsets.size(), 1u);
      +
      445  DCHECK(!traf.sample_encryption.sample_encryption_entries.empty());
      +
      446 
      +
      447  next_traf_position += traf.box_size();
      +
      448  // SampleEncryption 'senc' box should be the last box in 'traf'.
      +
      449  // |auxiliary_offset| should point to the data of SampleEncryption.
      +
      450  traf.auxiliary_offset.offsets[0] =
      +
      451  next_traf_position - traf.sample_encryption.box_size() +
      +
      452  traf.sample_encryption.HeaderSize() +
      +
      453  sizeof(uint32_t); // for sample count field in 'senc'
      +
      454  }
      +
      455  traf.runs[0].data_offset = data_offset + mdat.data_size;
      +
      456  mdat.data_size += fragmenters_[i]->data()->Size();
      +
      457  }
      +
      458 
      +
      459  // Generate segment reference.
      +
      460  sidx_->references.resize(sidx_->references.size() + 1);
      +
      461  fragmenters_[GetReferenceStreamId()]->GenerateSegmentReference(
      +
      462  &sidx_->references[sidx_->references.size() - 1]);
      +
      463  sidx_->references[sidx_->references.size() - 1].referenced_size =
      +
      464  data_offset + mdat.data_size;
      +
      465 
      +
      466  // Write the fragment to buffer.
      +
      467  moof_->Write(fragment_buffer_.get());
      +
      468  mdat.WriteHeader(fragment_buffer_.get());
      +
      469  for (const std::unique_ptr<Fragmenter>& fragmenter : fragmenters_)
      +
      470  fragment_buffer_->AppendBuffer(*fragmenter->data());
      +
      471 
      +
      472  // Increase sequence_number for next fragment.
      +
      473  ++moof_->header.sequence_number;
      +
      474 
      +
      475  if (finalize_segment)
      +
      476  return FinalizeSegment();
      +
      477 
      +
      478  return Status::OK;
      +
      479 }
      +
      480 
      +
      481 } // namespace mp4
      +
      482 } // namespace media
      +
      483 } // namespace shaka
      Status AddSample(scoped_refptr< MediaSample > sample)
      Definition: segmenter.cc:120
      @@ -585,7 +581,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); -
      static bool GenerateRandomIv(FourCC protection_scheme, std::vector< uint8_t > *iv)
      Definition: aes_cryptor.cc:109
      +
      static bool GenerateRandomIv(FourCC protection_scheme, std::vector< uint8_t > *iv)
      Definition: aes_cryptor.cc:107
      Status Initialize(std::unique_ptr< MkvWriter > writer, StreamInfo *info, ProgressListener *progress_listener, MuxerListener *muxer_listener, KeySource *encryption_key_source, uint32_t max_sd_pixels, double clear_lead_in_seconds)
      Definition: segmenter.cc:51
      EncryptingFragmenter generates MP4 fragments with sample encrypted.
      @@ -601,7 +597,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 920975278f..ae619e0459 100644 --- a/docs/d2/da9/classshaka_1_1media_1_1BufferWriter-members.html +++ b/docs/d2/da9/classshaka_1_1media_1_1BufferWriter-members.html @@ -116,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/dae/classshaka_1_1MockAdaptationSet-members.html b/docs/d2/dae/classshaka_1_1MockAdaptationSet-members.html index 32ebf655aa..02a8fcd0b4 100644 --- a/docs/d2/dae/classshaka_1_1MockAdaptationSet-members.html +++ b/docs/d2/dae/classshaka_1_1MockAdaptationSet-members.html @@ -126,7 +126,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/dae/webm__muxer_8cc_source.html b/docs/d2/dae/webm__muxer_8cc_source.html index 8a2fce6bbc..e857be1a5b 100644 --- a/docs/d2/dae/webm__muxer_8cc_source.html +++ b/docs/d2/dae/webm__muxer_8cc_source.html @@ -225,7 +225,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 ccecb9c37f..3c2006e55a 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 @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 500c2e8f2d..4954d214e4 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 @@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 415c1d1b0e..fade7e3507 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 @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/dba/classshaka_1_1media_1_1SegmentTestBase.html b/docs/d2/dba/classshaka_1_1media_1_1SegmentTestBase.html index 58d45c62e7..0423454be8 100644 --- a/docs/d2/dba/classshaka_1_1media_1_1SegmentTestBase.html +++ b/docs/d2/dba/classshaka_1_1media_1_1SegmentTestBase.html @@ -180,7 +180,7 @@ bool single_segment_ 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 c4303b682b..9d62f17eb6 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 @@ -112,7 +112,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/dc7/structshaka_1_1MpdOptions-members.html b/docs/d2/dc7/structshaka_1_1MpdOptions-members.html index d98364c3ea..891a2f3083 100644 --- a/docs/d2/dc7/structshaka_1_1MpdOptions-members.html +++ b/docs/d2/dc7/structshaka_1_1MpdOptions-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 851558ebc4..64a61564cd 100644 --- a/docs/d2/dcd/program__map__table__writer_8h_source.html +++ b/docs/d2/dcd/program__map__table__writer_8h_source.html @@ -190,7 +190,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 ba85a14581..1abdf4ad28 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 4d1b83b11d..445703c094 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 @@ -277,7 +277,7 @@ double cluster_length_sec< diff --git a/docs/d2/dd6/mkv__writer_8h_source.html b/docs/d2/dd6/mkv__writer_8h_source.html index f0891c0321..bd878f844c 100644 --- a/docs/d2/dd6/mkv__writer_8h_source.html +++ b/docs/d2/dd6/mkv__writer_8h_source.html @@ -152,7 +152,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/ddb/classshaka_1_1media_1_1WebMMediaParser.html b/docs/d2/ddb/classshaka_1_1media_1_1WebMMediaParser.html index e45a08dd9c..bfae2aedc4 100644 --- a/docs/d2/ddb/classshaka_1_1media_1_1WebMMediaParser.html +++ b/docs/d2/ddb/classshaka_1_1media_1_1WebMMediaParser.html @@ -256,7 +256,7 @@ track_id, const scoped_refptr
      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 755bd6eb1c..397a0d49cd 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 @@ -155,7 +155,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 11301517b9..87561fdefc 100644 --- a/docs/d2/de6/packager__main_8cc_source.html +++ b/docs/d2/de6/packager__main_8cc_source.html @@ -110,574 +110,565 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
      21 #include "packager/base/files/file_path.h"
      22 #include "packager/base/logging.h"
      23 #include "packager/base/path_service.h"
      -
      24 #include "packager/base/stl_util.h"
      -
      25 #include "packager/base/strings/string_split.h"
      -
      26 #include "packager/base/strings/stringprintf.h"
      -
      27 #include "packager/base/threading/simple_thread.h"
      -
      28 #include "packager/base/time/clock.h"
      -
      29 #include "packager/hls/base/hls_notifier.h"
      -
      30 #include "packager/hls/base/simple_hls_notifier.h"
      -
      31 #include "packager/media/base/container_names.h"
      -
      32 #include "packager/media/base/demuxer.h"
      -
      33 #include "packager/media/base/fourccs.h"
      -
      34 #include "packager/media/base/key_source.h"
      -
      35 #include "packager/media/base/muxer_options.h"
      -
      36 #include "packager/media/base/muxer_util.h"
      -
      37 #include "packager/media/event/hls_notify_muxer_listener.h"
      -
      38 #include "packager/media/event/mpd_notify_muxer_listener.h"
      -
      39 #include "packager/media/event/vod_media_info_dump_muxer_listener.h"
      -
      40 #include "packager/media/file/file.h"
      -
      41 #include "packager/media/formats/mp2t/ts_muxer.h"
      -
      42 #include "packager/media/formats/mp4/mp4_muxer.h"
      -
      43 #include "packager/media/formats/webm/webm_muxer.h"
      -
      44 #include "packager/mpd/base/dash_iop_mpd_notifier.h"
      -
      45 #include "packager/mpd/base/media_info.pb.h"
      -
      46 #include "packager/mpd/base/mpd_builder.h"
      -
      47 #include "packager/mpd/base/simple_mpd_notifier.h"
      -
      48 #include "packager/version/version.h"
      -
      49 
      -
      50 #if defined(OS_WIN)
      -
      51 #include <codecvt>
      -
      52 #include <functional>
      -
      53 #include <locale>
      -
      54 #endif // defined(OS_WIN)
      -
      55 
      -
      56 DEFINE_bool(use_fake_clock_for_muxer,
      -
      57  false,
      -
      58  "Set to true to use a fake clock for muxer. With this flag set, "
      -
      59  "creation time and modification time in outputs are set to 0. "
      -
      60  "Should only be used for testing.");
      -
      61 DEFINE_bool(override_version,
      -
      62  false,
      -
      63  "Override packager version in the generated outputs with "
      -
      64  "--test_version if it is set to true. Should be used for "
      -
      65  "testing only.");
      -
      66 DEFINE_string(test_version,
      -
      67  "",
      -
      68  "Packager version for testing. Ignored if --override_version is "
      -
      69  "false. Should be used for testing only.");
      -
      70 
      -
      71 namespace shaka {
      -
      72 namespace media {
      -
      73 namespace {
      -
      74 
      -
      75 const char kUsage[] =
      -
      76  "Packager driver program. Usage:\n\n"
      -
      77  "%s [flags] <stream_descriptor> ...\n"
      -
      78  "stream_descriptor consists of comma separated field_name/value pairs:\n"
      -
      79  "field_name=value,[field_name=value,]...\n"
      -
      80  "Supported field names are as follows:\n"
      -
      81  " - input (in): Required input/source media file path or network stream\n"
      -
      82  " URL.\n"
      -
      83  " - stream_selector (stream): Required field with value 'audio',\n"
      -
      84  " 'video', or stream number (zero based).\n"
      -
      85  " - output (out): Required output file (single file) or initialization\n"
      -
      86  " file path (multiple file).\n"
      -
      87  " - segment_template (segment): Optional value which specifies the\n"
      -
      88  " naming pattern for the segment files, and that the stream should be\n"
      -
      89  " split into multiple files. Its presence should be consistent across\n"
      -
      90  " streams.\n"
      -
      91  " - bandwidth (bw): Optional value which contains a user-specified\n"
      -
      92  " content bit rate for the stream, in bits/sec. If specified, this\n"
      -
      93  " value is propagated to the $Bandwidth$ template parameter for\n"
      -
      94  " segment names. If not specified, its value may be estimated.\n"
      -
      95  " - language (lang): Optional value which contains a user-specified\n"
      -
      96  " language tag. If specified, this value overrides any language\n"
      -
      97  " metadata in the input track.\n"
      -
      98  " - output_format (format): Optional value which specifies the format\n"
      -
      99  " of the output files (MP4 or WebM). If not specified, it will be\n"
      -
      100  " derived from the file extension of the output file.\n"
      -
      101  " - hls_name: Required for audio when outputting HLS.\n"
      -
      102  " name of the output stream. This is not (necessarily) the same as\n"
      -
      103  " output. This is used as the NAME attribute for EXT-X-MEDIA\n"
      -
      104  " - hls_group_id: Required for audio when outputting HLS.\n"
      -
      105  " The group ID for the output stream. For HLS this is used as the\n"
      -
      106  " GROUP-ID attribute for EXT-X-MEDIA.\n"
      -
      107  " - playlist_name: Required for HLS output.\n"
      -
      108  " Name of the playlist for the stream. Usually ends with '.m3u8'.\n";
      -
      109 
      -
      110 const char kMediaInfoSuffix[] = ".media_info";
      -
      111 
      -
      112 enum ExitStatus {
      -
      113  kSuccess = 0,
      -
      114  kArgumentValidationFailed,
      -
      115  kPackagingFailed,
      -
      116  kInternalError,
      -
      117 };
      -
      118 
      -
      119 // TODO(rkuroiwa): Write TTML and WebVTT parser (demuxing) for a better check
      -
      120 // and for supporting live/segmenting (muxing). With a demuxer and a muxer,
      -
      121 // CreateRemuxJobs() shouldn't treat text as a special case.
      -
      122 std::string DetermineTextFileFormat(const std::string& file) {
      -
      123  std::string content;
      -
      124  if (!File::ReadFileToString(file.c_str(), &content)) {
      -
      125  LOG(ERROR) << "Failed to open file " << file
      -
      126  << " to determine file format.";
      -
      127  return "";
      -
      128  }
      -
      129  MediaContainerName container_name = DetermineContainer(
      -
      130  reinterpret_cast<const uint8_t*>(content.data()), content.size());
      -
      131  if (container_name == CONTAINER_WEBVTT) {
      -
      132  return "vtt";
      -
      133  } else if (container_name == CONTAINER_TTML) {
      -
      134  return "ttml";
      -
      135  }
      -
      136 
      -
      137  return "";
      -
      138 }
      -
      139 
      -
      140 FourCC GetProtectionScheme(const std::string& protection_scheme) {
      -
      141  if (protection_scheme == "cenc") {
      -
      142  return FOURCC_cenc;
      -
      143  } else if (protection_scheme == "cens") {
      -
      144  return FOURCC_cens;
      -
      145  } else if (protection_scheme == "cbc1") {
      -
      146  return FOURCC_cbc1;
      -
      147  } else if (protection_scheme == "cbcs") {
      -
      148  return FOURCC_cbcs;
      -
      149  } else {
      -
      150  LOG(ERROR) << "Unknown protection scheme: " << protection_scheme;
      -
      151  return FOURCC_NULL;
      -
      152  }
      -
      153 }
      -
      154 
      -
      155 } // namespace
      -
      156 
      -
      157 // A fake clock that always return time 0 (epoch). Should only be used for
      -
      158 // testing.
      -
      159 class FakeClock : public base::Clock {
      -
      160  public:
      -
      161  base::Time Now() override { return base::Time(); }
      -
      162 };
      -
      163 
      -
      164 // Demux, Mux(es) and worker thread used to remux a source file/stream.
      -
      165 class RemuxJob : public base::SimpleThread {
      -
      166  public:
      -
      167  RemuxJob(std::unique_ptr<Demuxer> demuxer)
      -
      168  : SimpleThread("RemuxJob"), demuxer_(std::move(demuxer)) {}
      -
      169 
      -
      170  ~RemuxJob() override {
      -
      171  STLDeleteElements(&muxers_);
      -
      172  }
      -
      173 
      -
      174  void AddMuxer(std::unique_ptr<Muxer> mux) {
      -
      175  muxers_.push_back(mux.release());
      -
      176  }
      +
      24 #include "packager/base/strings/string_split.h"
      +
      25 #include "packager/base/strings/stringprintf.h"
      +
      26 #include "packager/base/threading/simple_thread.h"
      +
      27 #include "packager/base/time/clock.h"
      +
      28 #include "packager/hls/base/hls_notifier.h"
      +
      29 #include "packager/hls/base/simple_hls_notifier.h"
      +
      30 #include "packager/media/base/container_names.h"
      +
      31 #include "packager/media/base/demuxer.h"
      +
      32 #include "packager/media/base/fourccs.h"
      +
      33 #include "packager/media/base/key_source.h"
      +
      34 #include "packager/media/base/muxer_options.h"
      +
      35 #include "packager/media/base/muxer_util.h"
      +
      36 #include "packager/media/event/hls_notify_muxer_listener.h"
      +
      37 #include "packager/media/event/mpd_notify_muxer_listener.h"
      +
      38 #include "packager/media/event/vod_media_info_dump_muxer_listener.h"
      +
      39 #include "packager/media/file/file.h"
      +
      40 #include "packager/media/formats/mp2t/ts_muxer.h"
      +
      41 #include "packager/media/formats/mp4/mp4_muxer.h"
      +
      42 #include "packager/media/formats/webm/webm_muxer.h"
      +
      43 #include "packager/mpd/base/dash_iop_mpd_notifier.h"
      +
      44 #include "packager/mpd/base/media_info.pb.h"
      +
      45 #include "packager/mpd/base/mpd_builder.h"
      +
      46 #include "packager/mpd/base/simple_mpd_notifier.h"
      +
      47 #include "packager/version/version.h"
      +
      48 
      +
      49 #if defined(OS_WIN)
      +
      50 #include <codecvt>
      +
      51 #include <functional>
      +
      52 #include <locale>
      +
      53 #endif // defined(OS_WIN)
      +
      54 
      +
      55 DEFINE_bool(use_fake_clock_for_muxer,
      +
      56  false,
      +
      57  "Set to true to use a fake clock for muxer. With this flag set, "
      +
      58  "creation time and modification time in outputs are set to 0. "
      +
      59  "Should only be used for testing.");
      +
      60 DEFINE_bool(override_version,
      +
      61  false,
      +
      62  "Override packager version in the generated outputs with "
      +
      63  "--test_version if it is set to true. Should be used for "
      +
      64  "testing only.");
      +
      65 DEFINE_string(test_version,
      +
      66  "",
      +
      67  "Packager version for testing. Ignored if --override_version is "
      +
      68  "false. Should be used for testing only.");
      +
      69 
      +
      70 namespace shaka {
      +
      71 namespace media {
      +
      72 namespace {
      +
      73 
      +
      74 const char kUsage[] =
      +
      75  "Packager driver program. Usage:\n\n"
      +
      76  "%s [flags] <stream_descriptor> ...\n"
      +
      77  "stream_descriptor consists of comma separated field_name/value pairs:\n"
      +
      78  "field_name=value,[field_name=value,]...\n"
      +
      79  "Supported field names are as follows:\n"
      +
      80  " - input (in): Required input/source media file path or network stream\n"
      +
      81  " URL.\n"
      +
      82  " - stream_selector (stream): Required field with value 'audio',\n"
      +
      83  " 'video', or stream number (zero based).\n"
      +
      84  " - output (out): Required output file (single file) or initialization\n"
      +
      85  " file path (multiple file).\n"
      +
      86  " - segment_template (segment): Optional value which specifies the\n"
      +
      87  " naming pattern for the segment files, and that the stream should be\n"
      +
      88  " split into multiple files. Its presence should be consistent across\n"
      +
      89  " streams.\n"
      +
      90  " - bandwidth (bw): Optional value which contains a user-specified\n"
      +
      91  " content bit rate for the stream, in bits/sec. If specified, this\n"
      +
      92  " value is propagated to the $Bandwidth$ template parameter for\n"
      +
      93  " segment names. If not specified, its value may be estimated.\n"
      +
      94  " - language (lang): Optional value which contains a user-specified\n"
      +
      95  " language tag. If specified, this value overrides any language\n"
      +
      96  " metadata in the input track.\n"
      +
      97  " - output_format (format): Optional value which specifies the format\n"
      +
      98  " of the output files (MP4 or WebM). If not specified, it will be\n"
      +
      99  " derived from the file extension of the output file.\n"
      +
      100  " - hls_name: Required for audio when outputting HLS.\n"
      +
      101  " name of the output stream. This is not (necessarily) the same as\n"
      +
      102  " output. This is used as the NAME attribute for EXT-X-MEDIA\n"
      +
      103  " - hls_group_id: Required for audio when outputting HLS.\n"
      +
      104  " The group ID for the output stream. For HLS this is used as the\n"
      +
      105  " GROUP-ID attribute for EXT-X-MEDIA.\n"
      +
      106  " - playlist_name: Required for HLS output.\n"
      +
      107  " Name of the playlist for the stream. Usually ends with '.m3u8'.\n";
      +
      108 
      +
      109 const char kMediaInfoSuffix[] = ".media_info";
      +
      110 
      +
      111 enum ExitStatus {
      +
      112  kSuccess = 0,
      +
      113  kArgumentValidationFailed,
      +
      114  kPackagingFailed,
      +
      115  kInternalError,
      +
      116 };
      +
      117 
      +
      118 // TODO(rkuroiwa): Write TTML and WebVTT parser (demuxing) for a better check
      +
      119 // and for supporting live/segmenting (muxing). With a demuxer and a muxer,
      +
      120 // CreateRemuxJobs() shouldn't treat text as a special case.
      +
      121 std::string DetermineTextFileFormat(const std::string& file) {
      +
      122  std::string content;
      +
      123  if (!File::ReadFileToString(file.c_str(), &content)) {
      +
      124  LOG(ERROR) << "Failed to open file " << file
      +
      125  << " to determine file format.";
      +
      126  return "";
      +
      127  }
      +
      128  MediaContainerName container_name = DetermineContainer(
      +
      129  reinterpret_cast<const uint8_t*>(content.data()), content.size());
      +
      130  if (container_name == CONTAINER_WEBVTT) {
      +
      131  return "vtt";
      +
      132  } else if (container_name == CONTAINER_TTML) {
      +
      133  return "ttml";
      +
      134  }
      +
      135 
      +
      136  return "";
      +
      137 }
      +
      138 
      +
      139 FourCC GetProtectionScheme(const std::string& protection_scheme) {
      +
      140  if (protection_scheme == "cenc") {
      +
      141  return FOURCC_cenc;
      +
      142  } else if (protection_scheme == "cens") {
      +
      143  return FOURCC_cens;
      +
      144  } else if (protection_scheme == "cbc1") {
      +
      145  return FOURCC_cbc1;
      +
      146  } else if (protection_scheme == "cbcs") {
      +
      147  return FOURCC_cbcs;
      +
      148  } else {
      +
      149  LOG(ERROR) << "Unknown protection scheme: " << protection_scheme;
      +
      150  return FOURCC_NULL;
      +
      151  }
      +
      152 }
      +
      153 
      +
      154 } // namespace
      +
      155 
      +
      156 // A fake clock that always return time 0 (epoch). Should only be used for
      +
      157 // testing.
      +
      158 class FakeClock : public base::Clock {
      +
      159  public:
      +
      160  base::Time Now() override { return base::Time(); }
      +
      161 };
      +
      162 
      +
      163 // Demux, Mux(es) and worker thread used to remux a source file/stream.
      +
      164 class RemuxJob : public base::SimpleThread {
      +
      165  public:
      +
      166  RemuxJob(std::unique_ptr<Demuxer> demuxer)
      +
      167  : SimpleThread("RemuxJob"), demuxer_(std::move(demuxer)) {}
      +
      168 
      +
      169  ~RemuxJob() override {}
      +
      170 
      +
      171  void AddMuxer(std::unique_ptr<Muxer> mux) {
      +
      172  muxers_.push_back(std::move(mux));
      +
      173  }
      +
      174 
      +
      175  Demuxer* demuxer() { return demuxer_.get(); }
      +
      176  Status status() { return status_; }
      177 
      -
      178  Demuxer* demuxer() { return demuxer_.get(); }
      -
      179  Status status() { return status_; }
      -
      180 
      -
      181  private:
      -
      182  void Run() override {
      -
      183  DCHECK(demuxer_);
      -
      184  status_ = demuxer_->Run();
      -
      185  }
      -
      186 
      -
      187  std::unique_ptr<Demuxer> demuxer_;
      -
      188  std::vector<Muxer*> muxers_;
      -
      189  Status status_;
      +
      178  private:
      +
      179  void Run() override {
      +
      180  DCHECK(demuxer_);
      +
      181  status_ = demuxer_->Run();
      +
      182  }
      +
      183 
      +
      184  std::unique_ptr<Demuxer> demuxer_;
      +
      185  std::vector<std::unique_ptr<Muxer>> muxers_;
      +
      186  Status status_;
      +
      187 
      +
      188  DISALLOW_COPY_AND_ASSIGN(RemuxJob);
      +
      189 };
      190 
      -
      191  DISALLOW_COPY_AND_ASSIGN(RemuxJob);
      -
      192 };
      -
      193 
      -
      194 bool StreamInfoToTextMediaInfo(const StreamDescriptor& stream_descriptor,
      -
      195  const MuxerOptions& stream_muxer_options,
      -
      196  MediaInfo* text_media_info) {
      -
      197  const std::string& language = stream_descriptor.language;
      -
      198  std::string format = DetermineTextFileFormat(stream_descriptor.input);
      -
      199  if (format.empty()) {
      -
      200  LOG(ERROR) << "Failed to determine the text file format for "
      -
      201  << stream_descriptor.input;
      -
      202  return false;
      -
      203  }
      -
      204 
      -
      205  if (!File::Copy(stream_descriptor.input.c_str(),
      -
      206  stream_muxer_options.output_file_name.c_str())) {
      -
      207  LOG(ERROR) << "Failed to copy the input file (" << stream_descriptor.input
      -
      208  << ") to output file (" << stream_muxer_options.output_file_name
      -
      209  << ").";
      -
      210  return false;
      -
      211  }
      +
      191 bool StreamInfoToTextMediaInfo(const StreamDescriptor& stream_descriptor,
      +
      192  const MuxerOptions& stream_muxer_options,
      +
      193  MediaInfo* text_media_info) {
      +
      194  const std::string& language = stream_descriptor.language;
      +
      195  std::string format = DetermineTextFileFormat(stream_descriptor.input);
      +
      196  if (format.empty()) {
      +
      197  LOG(ERROR) << "Failed to determine the text file format for "
      +
      198  << stream_descriptor.input;
      +
      199  return false;
      +
      200  }
      +
      201 
      +
      202  if (!File::Copy(stream_descriptor.input.c_str(),
      +
      203  stream_muxer_options.output_file_name.c_str())) {
      +
      204  LOG(ERROR) << "Failed to copy the input file (" << stream_descriptor.input
      +
      205  << ") to output file (" << stream_muxer_options.output_file_name
      +
      206  << ").";
      +
      207  return false;
      +
      208  }
      +
      209 
      +
      210  text_media_info->set_media_file_name(stream_muxer_options.output_file_name);
      +
      211  text_media_info->set_container_type(MediaInfo::CONTAINER_TEXT);
      212 
      -
      213  text_media_info->set_media_file_name(stream_muxer_options.output_file_name);
      -
      214  text_media_info->set_container_type(MediaInfo::CONTAINER_TEXT);
      -
      215 
      -
      216  if (stream_muxer_options.bandwidth != 0) {
      -
      217  text_media_info->set_bandwidth(stream_muxer_options.bandwidth);
      -
      218  } else {
      -
      219  // Text files are usually small and since the input is one file; there's no
      -
      220  // way for the player to do ranged requests. So set this value to something
      -
      221  // reasonable.
      -
      222  text_media_info->set_bandwidth(256);
      -
      223  }
      -
      224 
      -
      225  MediaInfo::TextInfo* text_info = text_media_info->mutable_text_info();
      -
      226  text_info->set_format(format);
      -
      227  if (!language.empty())
      -
      228  text_info->set_language(language);
      +
      213  if (stream_muxer_options.bandwidth != 0) {
      +
      214  text_media_info->set_bandwidth(stream_muxer_options.bandwidth);
      +
      215  } else {
      +
      216  // Text files are usually small and since the input is one file; there's no
      +
      217  // way for the player to do ranged requests. So set this value to something
      +
      218  // reasonable.
      +
      219  text_media_info->set_bandwidth(256);
      +
      220  }
      +
      221 
      +
      222  MediaInfo::TextInfo* text_info = text_media_info->mutable_text_info();
      +
      223  text_info->set_format(format);
      +
      224  if (!language.empty())
      +
      225  text_info->set_language(language);
      +
      226 
      +
      227  return true;
      +
      228 }
      229 
      -
      230  return true;
      -
      231 }
      -
      232 
      -
      233 std::unique_ptr<Muxer> CreateOutputMuxer(const MuxerOptions& options,
      -
      234  MediaContainerName container) {
      -
      235  if (container == CONTAINER_WEBM) {
      -
      236  return std::unique_ptr<Muxer>(new webm::WebMMuxer(options));
      -
      237  } else if (container == CONTAINER_MPEG2TS) {
      -
      238  return std::unique_ptr<Muxer>(new mp2t::TsMuxer(options));
      -
      239  } else {
      -
      240  DCHECK_EQ(container, CONTAINER_MOV);
      -
      241  return std::unique_ptr<Muxer>(new mp4::MP4Muxer(options));
      -
      242  }
      -
      243 }
      -
      244 
      -
      245 bool CreateRemuxJobs(const StreamDescriptorList& stream_descriptors,
      -
      246  const MuxerOptions& muxer_options,
      -
      247  FakeClock* fake_clock,
      -
      248  KeySource* key_source,
      -
      249  MpdNotifier* mpd_notifier,
      -
      250  hls::HlsNotifier* hls_notifier,
      -
      251  std::vector<RemuxJob*>* remux_jobs) {
      -
      252  // No notifiers OR (mpd_notifier XOR hls_notifier); which is NAND.
      -
      253  DCHECK(!(mpd_notifier && hls_notifier));
      -
      254  DCHECK(remux_jobs);
      -
      255 
      -
      256  std::string previous_input;
      -
      257  int stream_number = 0;
      -
      258  for (StreamDescriptorList::const_iterator
      -
      259  stream_iter = stream_descriptors.begin();
      -
      260  stream_iter != stream_descriptors.end();
      -
      261  ++stream_iter, ++stream_number) {
      -
      262  // Process stream descriptor.
      -
      263  MuxerOptions stream_muxer_options(muxer_options);
      -
      264  stream_muxer_options.output_file_name = stream_iter->output;
      -
      265  if (!stream_iter->segment_template.empty()) {
      -
      266  if (!ValidateSegmentTemplate(stream_iter->segment_template)) {
      -
      267  LOG(ERROR) << "ERROR: segment template with '"
      -
      268  << stream_iter->segment_template << "' is invalid.";
      -
      269  return false;
      -
      270  }
      -
      271  stream_muxer_options.segment_template = stream_iter->segment_template;
      -
      272  if (stream_muxer_options.single_segment) {
      -
      273  LOG(WARNING) << "Segment template and single segment are incompatible, "
      -
      274  "setting single segment to false.";
      -
      275  stream_muxer_options.single_segment = false;
      -
      276  }
      -
      277  }
      -
      278  stream_muxer_options.bandwidth = stream_iter->bandwidth;
      -
      279 
      -
      280  // Handle text input.
      -
      281  if (stream_iter->stream_selector == "text") {
      -
      282  MediaInfo text_media_info;
      -
      283  if (!StreamInfoToTextMediaInfo(*stream_iter, stream_muxer_options,
      -
      284  &text_media_info)) {
      -
      285  return false;
      -
      286  }
      -
      287 
      -
      288  if (mpd_notifier) {
      -
      289  uint32_t unused;
      -
      290  if (!mpd_notifier->NotifyNewContainer(text_media_info, &unused)) {
      -
      291  LOG(ERROR) << "Failed to process text file " << stream_iter->input;
      -
      292  } else {
      -
      293  mpd_notifier->Flush();
      -
      294  }
      -
      295  } else if (FLAGS_output_media_info) {
      - -
      297  text_media_info,
      -
      298  stream_muxer_options.output_file_name + kMediaInfoSuffix);
      -
      299  } else {
      -
      300  NOTIMPLEMENTED()
      -
      301  << "--mpd_output or --output_media_info flags are "
      -
      302  "required for text output. Skipping manifest related output for "
      -
      303  << stream_iter->input;
      -
      304  }
      -
      305  continue;
      -
      306  }
      -
      307 
      -
      308  if (stream_iter->input != previous_input) {
      -
      309  // New remux job needed. Create demux and job thread.
      -
      310  std::unique_ptr<Demuxer> demuxer(new Demuxer(stream_iter->input));
      -
      311  if (FLAGS_enable_widevine_decryption ||
      -
      312  FLAGS_enable_fixed_key_decryption) {
      -
      313  std::unique_ptr<KeySource> key_source(CreateDecryptionKeySource());
      -
      314  if (!key_source)
      -
      315  return false;
      -
      316  demuxer->SetKeySource(std::move(key_source));
      -
      317  }
      -
      318  Status status = demuxer->Initialize();
      -
      319  if (!status.ok()) {
      -
      320  LOG(ERROR) << "Demuxer failed to initialize: " << status.ToString();
      -
      321  return false;
      -
      322  }
      -
      323  if (FLAGS_dump_stream_info) {
      -
      324  printf("\nFile \"%s\":\n", stream_iter->input.c_str());
      -
      325  DumpStreamInfo(demuxer->streams());
      -
      326  if (stream_iter->output.empty())
      -
      327  continue; // just need stream info.
      -
      328  }
      -
      329  remux_jobs->push_back(new RemuxJob(std::move(demuxer)));
      -
      330  previous_input = stream_iter->input;
      -
      331  }
      -
      332  DCHECK(!remux_jobs->empty());
      -
      333 
      -
      334  std::unique_ptr<Muxer> muxer(
      -
      335  CreateOutputMuxer(stream_muxer_options, stream_iter->output_format));
      -
      336  if (FLAGS_use_fake_clock_for_muxer) muxer->set_clock(fake_clock);
      -
      337 
      -
      338  if (key_source) {
      -
      339  muxer->SetKeySource(key_source,
      -
      340  FLAGS_max_sd_pixels,
      -
      341  FLAGS_clear_lead,
      -
      342  FLAGS_crypto_period_duration,
      -
      343  GetProtectionScheme(FLAGS_protection_scheme));
      -
      344  }
      -
      345 
      -
      346  std::unique_ptr<MuxerListener> muxer_listener;
      -
      347  DCHECK(!(FLAGS_output_media_info && mpd_notifier));
      -
      348  if (FLAGS_output_media_info) {
      -
      349  const std::string output_media_info_file_name =
      -
      350  stream_muxer_options.output_file_name + kMediaInfoSuffix;
      -
      351  std::unique_ptr<VodMediaInfoDumpMuxerListener>
      -
      352  vod_media_info_dump_muxer_listener(
      -
      353  new VodMediaInfoDumpMuxerListener(output_media_info_file_name));
      -
      354  muxer_listener = std::move(vod_media_info_dump_muxer_listener);
      -
      355  }
      -
      356  if (mpd_notifier) {
      -
      357  std::unique_ptr<MpdNotifyMuxerListener> mpd_notify_muxer_listener(
      -
      358  new MpdNotifyMuxerListener(mpd_notifier));
      -
      359  muxer_listener = std::move(mpd_notify_muxer_listener);
      -
      360  }
      -
      361 
      -
      362  if (hls_notifier) {
      -
      363  // TODO(rkuroiwa): Do some smart stuff to group the audios, e.g. detect
      -
      364  // languages.
      -
      365  std::string group_id = stream_iter->hls_group_id;
      -
      366  std::string name = stream_iter->hls_name;
      -
      367  std::string hls_playlist_name = stream_iter->hls_playlist_name;
      -
      368  if (group_id.empty())
      -
      369  group_id = "audio";
      -
      370  if (name.empty())
      -
      371  name = base::StringPrintf("stream_%d", stream_number);
      -
      372  if (hls_playlist_name.empty())
      -
      373  hls_playlist_name = base::StringPrintf("stream_%d.m3u8", stream_number);
      -
      374 
      -
      375  muxer_listener.reset(new HlsNotifyMuxerListener(hls_playlist_name, name,
      -
      376  group_id, hls_notifier));
      -
      377  }
      +
      230 std::unique_ptr<Muxer> CreateOutputMuxer(const MuxerOptions& options,
      +
      231  MediaContainerName container) {
      +
      232  if (container == CONTAINER_WEBM) {
      +
      233  return std::unique_ptr<Muxer>(new webm::WebMMuxer(options));
      +
      234  } else if (container == CONTAINER_MPEG2TS) {
      +
      235  return std::unique_ptr<Muxer>(new mp2t::TsMuxer(options));
      +
      236  } else {
      +
      237  DCHECK_EQ(container, CONTAINER_MOV);
      +
      238  return std::unique_ptr<Muxer>(new mp4::MP4Muxer(options));
      +
      239  }
      +
      240 }
      +
      241 
      +
      242 bool CreateRemuxJobs(const StreamDescriptorList& stream_descriptors,
      +
      243  const MuxerOptions& muxer_options,
      +
      244  FakeClock* fake_clock,
      +
      245  KeySource* key_source,
      +
      246  MpdNotifier* mpd_notifier,
      +
      247  hls::HlsNotifier* hls_notifier,
      +
      248  std::vector<std::unique_ptr<RemuxJob>>* remux_jobs) {
      +
      249  // No notifiers OR (mpd_notifier XOR hls_notifier); which is NAND.
      +
      250  DCHECK(!(mpd_notifier && hls_notifier));
      +
      251  DCHECK(remux_jobs);
      +
      252 
      +
      253  std::string previous_input;
      +
      254  int stream_number = 0;
      +
      255  for (StreamDescriptorList::const_iterator
      +
      256  stream_iter = stream_descriptors.begin();
      +
      257  stream_iter != stream_descriptors.end();
      +
      258  ++stream_iter, ++stream_number) {
      +
      259  // Process stream descriptor.
      +
      260  MuxerOptions stream_muxer_options(muxer_options);
      +
      261  stream_muxer_options.output_file_name = stream_iter->output;
      +
      262  if (!stream_iter->segment_template.empty()) {
      +
      263  if (!ValidateSegmentTemplate(stream_iter->segment_template)) {
      +
      264  LOG(ERROR) << "ERROR: segment template with '"
      +
      265  << stream_iter->segment_template << "' is invalid.";
      +
      266  return false;
      +
      267  }
      +
      268  stream_muxer_options.segment_template = stream_iter->segment_template;
      +
      269  if (stream_muxer_options.single_segment) {
      +
      270  LOG(WARNING) << "Segment template and single segment are incompatible, "
      +
      271  "setting single segment to false.";
      +
      272  stream_muxer_options.single_segment = false;
      +
      273  }
      +
      274  }
      +
      275  stream_muxer_options.bandwidth = stream_iter->bandwidth;
      +
      276 
      +
      277  // Handle text input.
      +
      278  if (stream_iter->stream_selector == "text") {
      +
      279  MediaInfo text_media_info;
      +
      280  if (!StreamInfoToTextMediaInfo(*stream_iter, stream_muxer_options,
      +
      281  &text_media_info)) {
      +
      282  return false;
      +
      283  }
      +
      284 
      +
      285  if (mpd_notifier) {
      +
      286  uint32_t unused;
      +
      287  if (!mpd_notifier->NotifyNewContainer(text_media_info, &unused)) {
      +
      288  LOG(ERROR) << "Failed to process text file " << stream_iter->input;
      +
      289  } else {
      +
      290  mpd_notifier->Flush();
      +
      291  }
      +
      292  } else if (FLAGS_output_media_info) {
      + +
      294  text_media_info,
      +
      295  stream_muxer_options.output_file_name + kMediaInfoSuffix);
      +
      296  } else {
      +
      297  NOTIMPLEMENTED()
      +
      298  << "--mpd_output or --output_media_info flags are "
      +
      299  "required for text output. Skipping manifest related output for "
      +
      300  << stream_iter->input;
      +
      301  }
      +
      302  continue;
      +
      303  }
      +
      304 
      +
      305  if (stream_iter->input != previous_input) {
      +
      306  // New remux job needed. Create demux and job thread.
      +
      307  std::unique_ptr<Demuxer> demuxer(new Demuxer(stream_iter->input));
      +
      308  if (FLAGS_enable_widevine_decryption ||
      +
      309  FLAGS_enable_fixed_key_decryption) {
      +
      310  std::unique_ptr<KeySource> key_source(CreateDecryptionKeySource());
      +
      311  if (!key_source)
      +
      312  return false;
      +
      313  demuxer->SetKeySource(std::move(key_source));
      +
      314  }
      +
      315  Status status = demuxer->Initialize();
      +
      316  if (!status.ok()) {
      +
      317  LOG(ERROR) << "Demuxer failed to initialize: " << status.ToString();
      +
      318  return false;
      +
      319  }
      +
      320  if (FLAGS_dump_stream_info) {
      +
      321  printf("\nFile \"%s\":\n", stream_iter->input.c_str());
      +
      322  DumpStreamInfo(demuxer->streams());
      +
      323  if (stream_iter->output.empty())
      +
      324  continue; // just need stream info.
      +
      325  }
      +
      326  remux_jobs->emplace_back(new RemuxJob(std::move(demuxer)));
      +
      327  previous_input = stream_iter->input;
      +
      328  }
      +
      329  DCHECK(!remux_jobs->empty());
      +
      330 
      +
      331  std::unique_ptr<Muxer> muxer(
      +
      332  CreateOutputMuxer(stream_muxer_options, stream_iter->output_format));
      +
      333  if (FLAGS_use_fake_clock_for_muxer) muxer->set_clock(fake_clock);
      +
      334 
      +
      335  if (key_source) {
      +
      336  muxer->SetKeySource(key_source,
      +
      337  FLAGS_max_sd_pixels,
      +
      338  FLAGS_clear_lead,
      +
      339  FLAGS_crypto_period_duration,
      +
      340  GetProtectionScheme(FLAGS_protection_scheme));
      +
      341  }
      +
      342 
      +
      343  std::unique_ptr<MuxerListener> muxer_listener;
      +
      344  DCHECK(!(FLAGS_output_media_info && mpd_notifier));
      +
      345  if (FLAGS_output_media_info) {
      +
      346  const std::string output_media_info_file_name =
      +
      347  stream_muxer_options.output_file_name + kMediaInfoSuffix;
      +
      348  std::unique_ptr<VodMediaInfoDumpMuxerListener>
      +
      349  vod_media_info_dump_muxer_listener(
      +
      350  new VodMediaInfoDumpMuxerListener(output_media_info_file_name));
      +
      351  muxer_listener = std::move(vod_media_info_dump_muxer_listener);
      +
      352  }
      +
      353  if (mpd_notifier) {
      +
      354  std::unique_ptr<MpdNotifyMuxerListener> mpd_notify_muxer_listener(
      +
      355  new MpdNotifyMuxerListener(mpd_notifier));
      +
      356  muxer_listener = std::move(mpd_notify_muxer_listener);
      +
      357  }
      +
      358 
      +
      359  if (hls_notifier) {
      +
      360  // TODO(rkuroiwa): Do some smart stuff to group the audios, e.g. detect
      +
      361  // languages.
      +
      362  std::string group_id = stream_iter->hls_group_id;
      +
      363  std::string name = stream_iter->hls_name;
      +
      364  std::string hls_playlist_name = stream_iter->hls_playlist_name;
      +
      365  if (group_id.empty())
      +
      366  group_id = "audio";
      +
      367  if (name.empty())
      +
      368  name = base::StringPrintf("stream_%d", stream_number);
      +
      369  if (hls_playlist_name.empty())
      +
      370  hls_playlist_name = base::StringPrintf("stream_%d.m3u8", stream_number);
      +
      371 
      +
      372  muxer_listener.reset(new HlsNotifyMuxerListener(hls_playlist_name, name,
      +
      373  group_id, hls_notifier));
      +
      374  }
      +
      375 
      +
      376  if (muxer_listener)
      +
      377  muxer->SetMuxerListener(std::move(muxer_listener));
      378 
      -
      379  if (muxer_listener)
      -
      380  muxer->SetMuxerListener(std::move(muxer_listener));
      -
      381 
      -
      382  if (!AddStreamToMuxer(remux_jobs->back()->demuxer()->streams(),
      -
      383  stream_iter->stream_selector,
      -
      384  stream_iter->language,
      -
      385  muxer.get())) {
      -
      386  return false;
      -
      387  }
      -
      388  remux_jobs->back()->AddMuxer(std::move(muxer));
      -
      389  }
      +
      379  if (!AddStreamToMuxer(remux_jobs->back()->demuxer()->streams(),
      +
      380  stream_iter->stream_selector,
      +
      381  stream_iter->language,
      +
      382  muxer.get())) {
      +
      383  return false;
      +
      384  }
      +
      385  remux_jobs->back()->AddMuxer(std::move(muxer));
      +
      386  }
      +
      387 
      +
      388  return true;
      +
      389 }
      390 
      -
      391  return true;
      -
      392 }
      -
      393 
      -
      394 Status RunRemuxJobs(const std::vector<RemuxJob*>& remux_jobs) {
      -
      395  // Start the job threads.
      -
      396  for (std::vector<RemuxJob*>::const_iterator job_iter = remux_jobs.begin();
      -
      397  job_iter != remux_jobs.end();
      -
      398  ++job_iter) {
      -
      399  (*job_iter)->Start();
      -
      400  }
      -
      401 
      -
      402  // Wait for all jobs to complete or an error occurs.
      -
      403  Status status;
      -
      404  bool all_joined;
      -
      405  do {
      -
      406  all_joined = true;
      -
      407  for (std::vector<RemuxJob*>::const_iterator job_iter = remux_jobs.begin();
      -
      408  job_iter != remux_jobs.end();
      -
      409  ++job_iter) {
      -
      410  if ((*job_iter)->HasBeenJoined()) {
      -
      411  status = (*job_iter)->status();
      -
      412  if (!status.ok())
      -
      413  break;
      -
      414  } else {
      -
      415  all_joined = false;
      -
      416  (*job_iter)->Join();
      -
      417  }
      -
      418  }
      -
      419  } while (!all_joined && status.ok());
      +
      391 Status RunRemuxJobs(const std::vector<std::unique_ptr<RemuxJob>>& remux_jobs) {
      +
      392  // Start the job threads.
      +
      393  for (const std::unique_ptr<RemuxJob>& job : remux_jobs)
      +
      394  job->Start();
      +
      395 
      +
      396  // Wait for all jobs to complete or an error occurs.
      +
      397  Status status;
      +
      398  bool all_joined;
      +
      399  do {
      +
      400  all_joined = true;
      +
      401  for (const std::unique_ptr<RemuxJob>& job : remux_jobs) {
      +
      402  if (job->HasBeenJoined()) {
      +
      403  status = job->status();
      +
      404  if (!status.ok())
      +
      405  break;
      +
      406  } else {
      +
      407  all_joined = false;
      +
      408  job->Join();
      +
      409  }
      +
      410  }
      +
      411  } while (!all_joined && status.ok());
      +
      412 
      +
      413  return status;
      +
      414 }
      +
      415 
      +
      416 bool RunPackager(const StreamDescriptorList& stream_descriptors) {
      +
      417  const FourCC protection_scheme = GetProtectionScheme(FLAGS_protection_scheme);
      +
      418  if (protection_scheme == FOURCC_NULL)
      +
      419  return false;
      420 
      -
      421  return status;
      -
      422 }
      +
      421  if (!AssignFlagsFromProfile())
      +
      422  return false;
      423 
      -
      424 bool RunPackager(const StreamDescriptorList& stream_descriptors) {
      -
      425  const FourCC protection_scheme = GetProtectionScheme(FLAGS_protection_scheme);
      -
      426  if (protection_scheme == FOURCC_NULL)
      +
      424  if (FLAGS_output_media_info && !FLAGS_mpd_output.empty()) {
      +
      425  NOTIMPLEMENTED() << "ERROR: --output_media_info and --mpd_output do not "
      +
      426  "work together.";
      427  return false;
      -
      428 
      -
      429  if (!AssignFlagsFromProfile())
      -
      430  return false;
      -
      431 
      -
      432  if (FLAGS_output_media_info && !FLAGS_mpd_output.empty()) {
      -
      433  NOTIMPLEMENTED() << "ERROR: --output_media_info and --mpd_output do not "
      -
      434  "work together.";
      -
      435  return false;
      -
      436  }
      -
      437  if (FLAGS_output_media_info && !FLAGS_single_segment) {
      -
      438  // TODO(rkuroiwa, kqyang): Support partial media info dump for live.
      -
      439  NOTIMPLEMENTED() << "ERROR: --output_media_info is only supported if "
      -
      440  "--single_segment is true.";
      -
      441  return false;
      -
      442  }
      -
      443 
      -
      444  // Since there isn't a muxer listener that can output both MPD and HLS,
      -
      445  // disallow specifying both MPD and HLS flags.
      -
      446  if (!FLAGS_mpd_output.empty() && !FLAGS_hls_master_playlist_output.empty()) {
      -
      447  LOG(ERROR) << "Cannot output both MPD and HLS.";
      -
      448  return false;
      -
      449  }
      -
      450 
      -
      451  // Get basic muxer options.
      -
      452  MuxerOptions muxer_options;
      -
      453  if (!GetMuxerOptions(&muxer_options))
      -
      454  return false;
      -
      455 
      -
      456  MpdOptions mpd_options;
      -
      457  if (!GetMpdOptions(&mpd_options))
      -
      458  return false;
      +
      428  }
      +
      429  if (FLAGS_output_media_info && !FLAGS_single_segment) {
      +
      430  // TODO(rkuroiwa, kqyang): Support partial media info dump for live.
      +
      431  NOTIMPLEMENTED() << "ERROR: --output_media_info is only supported if "
      +
      432  "--single_segment is true.";
      +
      433  return false;
      +
      434  }
      +
      435 
      +
      436  // Since there isn't a muxer listener that can output both MPD and HLS,
      +
      437  // disallow specifying both MPD and HLS flags.
      +
      438  if (!FLAGS_mpd_output.empty() && !FLAGS_hls_master_playlist_output.empty()) {
      +
      439  LOG(ERROR) << "Cannot output both MPD and HLS.";
      +
      440  return false;
      +
      441  }
      +
      442 
      +
      443  // Get basic muxer options.
      +
      444  MuxerOptions muxer_options;
      +
      445  if (!GetMuxerOptions(&muxer_options))
      +
      446  return false;
      +
      447 
      +
      448  MpdOptions mpd_options;
      +
      449  if (!GetMpdOptions(&mpd_options))
      +
      450  return false;
      +
      451 
      +
      452  // Create encryption key source if needed.
      +
      453  std::unique_ptr<KeySource> encryption_key_source;
      +
      454  if (FLAGS_enable_widevine_encryption || FLAGS_enable_fixed_key_encryption) {
      +
      455  encryption_key_source = CreateEncryptionKeySource();
      +
      456  if (!encryption_key_source)
      +
      457  return false;
      +
      458  }
      459 
      -
      460  // Create encryption key source if needed.
      -
      461  std::unique_ptr<KeySource> encryption_key_source;
      -
      462  if (FLAGS_enable_widevine_encryption || FLAGS_enable_fixed_key_encryption) {
      -
      463  encryption_key_source = CreateEncryptionKeySource();
      -
      464  if (!encryption_key_source)
      -
      465  return false;
      -
      466  }
      -
      467 
      -
      468  std::unique_ptr<MpdNotifier> mpd_notifier;
      -
      469  if (!FLAGS_mpd_output.empty()) {
      -
      470  DashProfile profile =
      -
      471  FLAGS_single_segment ? kOnDemandProfile : kLiveProfile;
      -
      472  std::vector<std::string> base_urls = base::SplitString(
      -
      473  FLAGS_base_urls, ",", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
      -
      474  if (FLAGS_generate_dash_if_iop_compliant_mpd) {
      -
      475  mpd_notifier.reset(new DashIopMpdNotifier(profile, mpd_options, base_urls,
      -
      476  FLAGS_mpd_output));
      -
      477  } else {
      -
      478  mpd_notifier.reset(new SimpleMpdNotifier(profile, mpd_options, base_urls,
      -
      479  FLAGS_mpd_output));
      -
      480  }
      -
      481  if (!mpd_notifier->Init()) {
      -
      482  LOG(ERROR) << "MpdNotifier failed to initialize.";
      -
      483  return false;
      -
      484  }
      -
      485  }
      -
      486 
      -
      487  std::unique_ptr<hls::HlsNotifier> hls_notifier;
      -
      488  if (!FLAGS_hls_master_playlist_output.empty()) {
      -
      489  base::FilePath master_playlist_path(
      -
      490  base::FilePath::FromUTF8Unsafe(FLAGS_hls_master_playlist_output));
      -
      491  base::FilePath master_playlist_name = master_playlist_path.BaseName();
      -
      492 
      -
      493  hls_notifier.reset(new hls::SimpleHlsNotifier(
      -
      494  hls::HlsNotifier::HlsProfile::kOnDemandProfile, FLAGS_hls_base_url,
      -
      495  master_playlist_path.DirName().AsEndingWithSeparator().AsUTF8Unsafe(),
      -
      496  master_playlist_name.AsUTF8Unsafe()));
      +
      460  std::unique_ptr<MpdNotifier> mpd_notifier;
      +
      461  if (!FLAGS_mpd_output.empty()) {
      +
      462  DashProfile profile =
      +
      463  FLAGS_single_segment ? kOnDemandProfile : kLiveProfile;
      +
      464  std::vector<std::string> base_urls = base::SplitString(
      +
      465  FLAGS_base_urls, ",", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
      +
      466  if (FLAGS_generate_dash_if_iop_compliant_mpd) {
      +
      467  mpd_notifier.reset(new DashIopMpdNotifier(profile, mpd_options, base_urls,
      +
      468  FLAGS_mpd_output));
      +
      469  } else {
      +
      470  mpd_notifier.reset(new SimpleMpdNotifier(profile, mpd_options, base_urls,
      +
      471  FLAGS_mpd_output));
      +
      472  }
      +
      473  if (!mpd_notifier->Init()) {
      +
      474  LOG(ERROR) << "MpdNotifier failed to initialize.";
      +
      475  return false;
      +
      476  }
      +
      477  }
      +
      478 
      +
      479  std::unique_ptr<hls::HlsNotifier> hls_notifier;
      +
      480  if (!FLAGS_hls_master_playlist_output.empty()) {
      +
      481  base::FilePath master_playlist_path(
      +
      482  base::FilePath::FromUTF8Unsafe(FLAGS_hls_master_playlist_output));
      +
      483  base::FilePath master_playlist_name = master_playlist_path.BaseName();
      +
      484 
      +
      485  hls_notifier.reset(new hls::SimpleHlsNotifier(
      +
      486  hls::HlsNotifier::HlsProfile::kOnDemandProfile, FLAGS_hls_base_url,
      +
      487  master_playlist_path.DirName().AsEndingWithSeparator().AsUTF8Unsafe(),
      +
      488  master_playlist_name.AsUTF8Unsafe()));
      +
      489  }
      +
      490 
      +
      491  std::vector<std::unique_ptr<RemuxJob>> remux_jobs;
      +
      492  FakeClock fake_clock;
      +
      493  if (!CreateRemuxJobs(stream_descriptors, muxer_options, &fake_clock,
      +
      494  encryption_key_source.get(), mpd_notifier.get(),
      +
      495  hls_notifier.get(), &remux_jobs)) {
      +
      496  return false;
      497  }
      498 
      -
      499  std::vector<RemuxJob*> remux_jobs;
      -
      500  STLElementDeleter<std::vector<RemuxJob*> > scoped_jobs_deleter(&remux_jobs);
      -
      501  FakeClock fake_clock;
      -
      502  if (!CreateRemuxJobs(stream_descriptors, muxer_options, &fake_clock,
      -
      503  encryption_key_source.get(), mpd_notifier.get(),
      -
      504  hls_notifier.get(), &remux_jobs)) {
      -
      505  return false;
      -
      506  }
      -
      507 
      -
      508  Status status = RunRemuxJobs(remux_jobs);
      -
      509  if (!status.ok()) {
      -
      510  LOG(ERROR) << "Packaging Error: " << status.ToString();
      -
      511  return false;
      +
      499  Status status = RunRemuxJobs(remux_jobs);
      +
      500  if (!status.ok()) {
      +
      501  LOG(ERROR) << "Packaging Error: " << status.ToString();
      +
      502  return false;
      +
      503  }
      +
      504 
      +
      505  if (hls_notifier) {
      +
      506  if (!hls_notifier->Flush())
      +
      507  return false;
      +
      508  }
      +
      509  if (mpd_notifier) {
      +
      510  if (!mpd_notifier->Flush())
      +
      511  return false;
      512  }
      513 
      -
      514  if (hls_notifier) {
      -
      515  if (!hls_notifier->Flush())
      -
      516  return false;
      -
      517  }
      -
      518  if (mpd_notifier) {
      -
      519  if (!mpd_notifier->Flush())
      -
      520  return false;
      -
      521  }
      +
      514  printf("Packaging completed successfully.\n");
      +
      515  return true;
      +
      516 }
      +
      517 
      +
      518 int PackagerMain(int argc, char** argv) {
      +
      519  base::AtExitManager exit;
      +
      520  // Needed to enable VLOG/DVLOG through --vmodule or --v.
      +
      521  base::CommandLine::Init(argc, argv);
      522 
      -
      523  printf("Packaging completed successfully.\n");
      -
      524  return true;
      -
      525 }
      -
      526 
      -
      527 int PackagerMain(int argc, char** argv) {
      -
      528  base::AtExitManager exit;
      -
      529  // Needed to enable VLOG/DVLOG through --vmodule or --v.
      -
      530  base::CommandLine::Init(argc, argv);
      -
      531 
      -
      532  // Set up logging.
      -
      533  logging::LoggingSettings log_settings;
      -
      534  log_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
      -
      535  CHECK(logging::InitLogging(log_settings));
      +
      523  // Set up logging.
      +
      524  logging::LoggingSettings log_settings;
      +
      525  log_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
      +
      526  CHECK(logging::InitLogging(log_settings));
      +
      527 
      +
      528  google::SetUsageMessage(base::StringPrintf(kUsage, argv[0]));
      +
      529  google::ParseCommandLineFlags(&argc, &argv, true);
      +
      530  if (argc < 2) {
      +
      531  const std::string version_string = base::StringPrintf(
      +
      532  "shaka-packager version %s", GetPackagerVersion().c_str());
      +
      533  google::ShowUsageWithFlags(version_string.c_str());
      +
      534  return kSuccess;
      +
      535  }
      536 
      -
      537  google::SetUsageMessage(base::StringPrintf(kUsage, argv[0]));
      -
      538  google::ParseCommandLineFlags(&argc, &argv, true);
      -
      539  if (argc < 2) {
      -
      540  const std::string version_string = base::StringPrintf(
      -
      541  "shaka-packager version %s", GetPackagerVersion().c_str());
      -
      542  google::ShowUsageWithFlags(version_string.c_str());
      -
      543  return kSuccess;
      -
      544  }
      -
      545 
      - -
      547  return kArgumentValidationFailed;
      -
      548 
      -
      549  if (FLAGS_override_version)
      -
      550  SetPackagerVersionForTesting(FLAGS_test_version);
      -
      551 
      -
      552  LibcryptoThreading libcrypto_threading;
      -
      553  // TODO(tinskip): Make InsertStreamDescriptor a member of
      -
      554  // StreamDescriptorList.
      -
      555  StreamDescriptorList stream_descriptors;
      -
      556  for (int i = 1; i < argc; ++i) {
      -
      557  if (!InsertStreamDescriptor(argv[i], &stream_descriptors))
      -
      558  return kArgumentValidationFailed;
      -
      559  }
      -
      560  return RunPackager(stream_descriptors) ? kSuccess : kPackagingFailed;
      -
      561 }
      -
      562 
      -
      563 } // namespace media
      -
      564 } // namespace shaka
      -
      565 
      -
      566 #if defined(OS_WIN)
      -
      567 // Windows wmain, which converts wide character arguments to UTF-8.
      -
      568 int wmain(int argc, wchar_t* argv[], wchar_t* envp[]) {
      -
      569  std::unique_ptr<char* [], std::function<void(char**)>> utf8_argv(
      -
      570  new char*[argc], [argc](char** utf8_args) {
      -
      571  // TODO(tinskip): This leaks, but if this code is enabled, it crashes.
      -
      572  // Figure out why. I suspect gflags does something funny with the
      -
      573  // argument array.
      -
      574  // for (int idx = 0; idx < argc; ++idx)
      -
      575  // delete[] utf8_args[idx];
      -
      576  delete[] utf8_args;
      -
      577  });
      -
      578  std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
      -
      579  for (int idx = 0; idx < argc; ++idx) {
      -
      580  std::string utf8_arg(converter.to_bytes(argv[idx]));
      -
      581  utf8_arg += '\0';
      -
      582  utf8_argv[idx] = new char[utf8_arg.size()];
      -
      583  memcpy(utf8_argv[idx], &utf8_arg[0], utf8_arg.size());
      -
      584  }
      -
      585  return shaka::media::PackagerMain(argc, utf8_argv.get());
      -
      586 }
      -
      587 #else
      -
      588 int main(int argc, char** argv) {
      -
      589  return shaka::media::PackagerMain(argc, argv);
      -
      590 }
      -
      591 #endif // defined(OS_WIN)
      + +
      538  return kArgumentValidationFailed;
      +
      539 
      +
      540  if (FLAGS_override_version)
      +
      541  SetPackagerVersionForTesting(FLAGS_test_version);
      +
      542 
      +
      543  LibcryptoThreading libcrypto_threading;
      +
      544  // TODO(tinskip): Make InsertStreamDescriptor a member of
      +
      545  // StreamDescriptorList.
      +
      546  StreamDescriptorList stream_descriptors;
      +
      547  for (int i = 1; i < argc; ++i) {
      +
      548  if (!InsertStreamDescriptor(argv[i], &stream_descriptors))
      +
      549  return kArgumentValidationFailed;
      +
      550  }
      +
      551  return RunPackager(stream_descriptors) ? kSuccess : kPackagingFailed;
      +
      552 }
      +
      553 
      +
      554 } // namespace media
      +
      555 } // namespace shaka
      +
      556 
      +
      557 #if defined(OS_WIN)
      +
      558 // Windows wmain, which converts wide character arguments to UTF-8.
      +
      559 int wmain(int argc, wchar_t* argv[], wchar_t* envp[]) {
      +
      560  std::unique_ptr<char* [], std::function<void(char**)>> utf8_argv(
      +
      561  new char*[argc], [argc](char** utf8_args) {
      +
      562  // TODO(tinskip): This leaks, but if this code is enabled, it crashes.
      +
      563  // Figure out why. I suspect gflags does something funny with the
      +
      564  // argument array.
      +
      565  // for (int idx = 0; idx < argc; ++idx)
      +
      566  // delete[] utf8_args[idx];
      +
      567  delete[] utf8_args;
      +
      568  });
      +
      569  std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
      +
      570  for (int idx = 0; idx < argc; ++idx) {
      +
      571  std::string utf8_arg(converter.to_bytes(argv[idx]));
      +
      572  utf8_arg += '\0';
      +
      573  utf8_argv[idx] = new char[utf8_arg.size()];
      +
      574  memcpy(utf8_argv[idx], &utf8_arg[0], utf8_arg.size());
      +
      575  }
      +
      576  return shaka::media::PackagerMain(argc, utf8_argv.get());
      +
      577 }
      +
      578 #else
      +
      579 int main(int argc, char** argv) {
      +
      580  return shaka::media::PackagerMain(argc, argv);
      +
      581 }
      +
      582 #endif // defined(OS_WIN)
      static bool Copy(const char *from_file_name, const char *to_file_name)
      Definition: file.cc:203
      bool ValidateWidevineCryptoFlags()
      static bool WriteMediaInfoToFile(const MediaInfo &media_info, const std::string &output_file_path)
      @@ -686,7 +677,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 983877c854..401a672b82 100644 --- a/docs/d2/de7/classshaka_1_1media_1_1TextStreamInfo-members.html +++ b/docs/d2/de7/classshaka_1_1media_1_1TextStreamInfo-members.html @@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 bbb9b218dc..74cb568e8b 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 @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/de9/mock__muxer__listener_8h_source.html b/docs/d2/de9/mock__muxer__listener_8h_source.html index edf1155b91..e66c9b23c8 100644 --- a/docs/d2/de9/mock__muxer__listener_8h_source.html +++ b/docs/d2/de9/mock__muxer__listener_8h_source.html @@ -163,7 +163,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/deb/es__parser_8h_source.html b/docs/d2/deb/es__parser_8h_source.html index 0ea048e591..04a62ff7d5 100644 --- a/docs/d2/deb/es__parser_8h_source.html +++ b/docs/d2/deb/es__parser_8h_source.html @@ -145,7 +145,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 80ec28c1f3..9a3e28a309 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 @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/dee/pes__packet__generator_8cc_source.html b/docs/d2/dee/pes__packet__generator_8cc_source.html index d47be62875..9a27e65275 100644 --- a/docs/d2/dee/pes__packet__generator_8cc_source.html +++ b/docs/d2/dee/pes__packet__generator_8cc_source.html @@ -97,90 +97,90 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
      8 
      9 #include <algorithm>
      10 #include <cstring>
      -
      11 
      -
      12 #include "packager/media/base/aes_encryptor.h"
      -
      13 #include "packager/media/base/aes_pattern_cryptor.h"
      -
      14 #include "packager/media/base/audio_stream_info.h"
      -
      15 #include "packager/media/base/buffer_writer.h"
      -
      16 #include "packager/media/base/media_sample.h"
      -
      17 #include "packager/media/base/video_stream_info.h"
      -
      18 #include "packager/media/codecs/aac_audio_specific_config.h"
      -
      19 #include "packager/media/codecs/nal_unit_to_byte_stream_converter.h"
      -
      20 #include "packager/media/codecs/nalu_reader.h"
      -
      21 #include "packager/media/formats/mp2t/pes_packet.h"
      -
      22 
      -
      23 namespace shaka {
      -
      24 namespace media {
      -
      25 namespace mp2t {
      -
      26 
      -
      27 namespace {
      -
      28 const bool kEscapeData = true;
      -
      29 const uint8_t kVideoStreamId = 0xE0;
      -
      30 const uint8_t kAudioStreamId = 0xC0;
      -
      31 const double kTsTimescale = 90000.0;
      -
      32 
      -
      33 // |target_data| is input as well as output. On success |target_data| contains
      -
      34 // the encrypted sample. The input data should be Nal unit byte stream.
      -
      35 // This function constructs encrypted sample in |encrypted_sample_data| then
      -
      36 // swap with target_data on success.
      -
      37 bool EncryptH264Sample(AesCryptor* encryptor,
      -
      38  std::vector<uint8_t>* target_data) {
      -
      39  BufferWriter encrypted_sample_data(target_data->size() * 1.5);
      -
      40 
      -
      41  const int kLeadingClearBytesSize = 32;
      -
      42  // Any Nalu smaller than 48 bytes shall not be encrypted.
      -
      43  const uint64_t kSmallNalUnitSize = 48;
      -
      44 
      -
      45  NaluReader nalu_reader(Nalu::kH264, 0, target_data->data(),
      -
      46  target_data->size());
      -
      47  NaluReader::Result result;
      -
      48  Nalu nalu;
      -
      49  while ((result = nalu_reader.Advance(&nalu)) == NaluReader::Result::kOk) {
      -
      50  encrypted_sample_data.AppendInt(static_cast<uint32_t>(0x00000001));
      -
      51  const uint64_t nalu_total_size = nalu.header_size() + nalu.payload_size();
      -
      52  if (nalu.type() != Nalu::H264NaluType::H264_NonIDRSlice &&
      -
      53  nalu.type() != Nalu::H264NaluType::H264_IDRSlice) {
      -
      54  VLOG(3) << "Found Nalu type: " << nalu.type() << " skipping encryption.";
      -
      55  encrypted_sample_data.AppendArray(nalu.data(), nalu_total_size);
      -
      56  continue;
      -
      57  }
      -
      58 
      -
      59  if (nalu_total_size <= kSmallNalUnitSize) {
      -
      60  encrypted_sample_data.AppendArray(nalu.data(), nalu_total_size);
      -
      61  continue;
      -
      62  }
      -
      63 
      -
      64  const uint8_t* current = nalu.data() + kLeadingClearBytesSize;
      -
      65  const uint64_t bytes_remaining = nalu_total_size - kLeadingClearBytesSize;
      -
      66 
      -
      67  if (!encryptor->Crypt(current, bytes_remaining,
      -
      68  const_cast<uint8_t*>(current))) {
      -
      69  return false;
      -
      70  }
      -
      71  EscapeNalByteSequence(nalu.data(), nalu_total_size, &encrypted_sample_data);
      -
      72  }
      -
      73 
      -
      74  encrypted_sample_data.SwapBuffer(target_data);
      -
      75  return true;
      -
      76 }
      -
      77 
      -
      78 bool EncryptAacSample(AesCryptor* encryptor,
      -
      79  std::vector<uint8_t>* target_data) {
      -
      80  const int kUnencryptedLeaderSize = 16;
      -
      81  if (target_data->size() <= kUnencryptedLeaderSize)
      -
      82  return true;
      -
      83  uint8_t* data_ptr = target_data->data() + kUnencryptedLeaderSize;
      -
      84  return encryptor->Crypt(
      -
      85  data_ptr, target_data->size() - kUnencryptedLeaderSize, data_ptr);
      -
      86 }
      -
      87 } // namespace
      -
      88 
      -
      89 PesPacketGenerator::PesPacketGenerator()
      -
      90  : pes_packets_deleter_(&pes_packets_) {}
      +
      11 #include <memory>
      +
      12 
      +
      13 #include "packager/media/base/aes_encryptor.h"
      +
      14 #include "packager/media/base/aes_pattern_cryptor.h"
      +
      15 #include "packager/media/base/audio_stream_info.h"
      +
      16 #include "packager/media/base/buffer_writer.h"
      +
      17 #include "packager/media/base/media_sample.h"
      +
      18 #include "packager/media/base/video_stream_info.h"
      +
      19 #include "packager/media/codecs/aac_audio_specific_config.h"
      +
      20 #include "packager/media/codecs/nal_unit_to_byte_stream_converter.h"
      +
      21 #include "packager/media/codecs/nalu_reader.h"
      +
      22 #include "packager/media/formats/mp2t/pes_packet.h"
      +
      23 
      +
      24 namespace shaka {
      +
      25 namespace media {
      +
      26 namespace mp2t {
      +
      27 
      +
      28 namespace {
      +
      29 const bool kEscapeData = true;
      +
      30 const uint8_t kVideoStreamId = 0xE0;
      +
      31 const uint8_t kAudioStreamId = 0xC0;
      +
      32 const double kTsTimescale = 90000.0;
      +
      33 
      +
      34 // |target_data| is input as well as output. On success |target_data| contains
      +
      35 // the encrypted sample. The input data should be Nal unit byte stream.
      +
      36 // This function constructs encrypted sample in |encrypted_sample_data| then
      +
      37 // swap with target_data on success.
      +
      38 bool EncryptH264Sample(AesCryptor* encryptor,
      +
      39  std::vector<uint8_t>* target_data) {
      +
      40  BufferWriter encrypted_sample_data(target_data->size() * 1.5);
      +
      41 
      +
      42  const int kLeadingClearBytesSize = 32;
      +
      43  // Any Nalu smaller than 48 bytes shall not be encrypted.
      +
      44  const uint64_t kSmallNalUnitSize = 48;
      +
      45 
      +
      46  NaluReader nalu_reader(Nalu::kH264, 0, target_data->data(),
      +
      47  target_data->size());
      +
      48  NaluReader::Result result;
      +
      49  Nalu nalu;
      +
      50  while ((result = nalu_reader.Advance(&nalu)) == NaluReader::Result::kOk) {
      +
      51  encrypted_sample_data.AppendInt(static_cast<uint32_t>(0x00000001));
      +
      52  const uint64_t nalu_total_size = nalu.header_size() + nalu.payload_size();
      +
      53  if (nalu.type() != Nalu::H264NaluType::H264_NonIDRSlice &&
      +
      54  nalu.type() != Nalu::H264NaluType::H264_IDRSlice) {
      +
      55  VLOG(3) << "Found Nalu type: " << nalu.type() << " skipping encryption.";
      +
      56  encrypted_sample_data.AppendArray(nalu.data(), nalu_total_size);
      +
      57  continue;
      +
      58  }
      +
      59 
      +
      60  if (nalu_total_size <= kSmallNalUnitSize) {
      +
      61  encrypted_sample_data.AppendArray(nalu.data(), nalu_total_size);
      +
      62  continue;
      +
      63  }
      +
      64 
      +
      65  const uint8_t* current = nalu.data() + kLeadingClearBytesSize;
      +
      66  const uint64_t bytes_remaining = nalu_total_size - kLeadingClearBytesSize;
      +
      67 
      +
      68  if (!encryptor->Crypt(current, bytes_remaining,
      +
      69  const_cast<uint8_t*>(current))) {
      +
      70  return false;
      +
      71  }
      +
      72  EscapeNalByteSequence(nalu.data(), nalu_total_size, &encrypted_sample_data);
      +
      73  }
      +
      74 
      +
      75  encrypted_sample_data.SwapBuffer(target_data);
      +
      76  return true;
      +
      77 }
      +
      78 
      +
      79 bool EncryptAacSample(AesCryptor* encryptor,
      +
      80  std::vector<uint8_t>* target_data) {
      +
      81  const int kUnencryptedLeaderSize = 16;
      +
      82  if (target_data->size() <= kUnencryptedLeaderSize)
      +
      83  return true;
      +
      84  uint8_t* data_ptr = target_data->data() + kUnencryptedLeaderSize;
      +
      85  return encryptor->Crypt(
      +
      86  data_ptr, target_data->size() - kUnencryptedLeaderSize, data_ptr);
      +
      87 }
      +
      88 } // namespace
      +
      89 
      +
      90 PesPacketGenerator::PesPacketGenerator() {}
      91 PesPacketGenerator::~PesPacketGenerator() {}
      92 
      93 bool PesPacketGenerator::Initialize(const StreamInfo& stream_info) {
      -
      94  STLDeleteElements(&pes_packets_);
      +
      94  pes_packets_.clear();
      95  stream_type_ = stream_info.stream_type();
      96 
      97  if (stream_type_ == kStreamVideo) {
      @@ -237,7 +237,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
      148  }
      149  current_processing_pes_->mutable_data()->swap(byte_stream);
      150  current_processing_pes_->set_stream_id(kVideoStreamId);
      -
      151  pes_packets_.push_back(current_processing_pes_.release());
      +
      151  pes_packets_.push_back(std::move(current_processing_pes_));
      152  return true;
      153  }
      154  DCHECK_EQ(stream_type_, kStreamAudio);
      @@ -264,7 +264,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
      175  // packets.
      176  current_processing_pes_->mutable_data()->swap(aac_frame);
      177  current_processing_pes_->set_stream_id(kAudioStreamId);
      -
      178  pes_packets_.push_back(current_processing_pes_.release());
      +
      178  pes_packets_.push_back(std::move(current_processing_pes_));
      179  return true;
      180 }
      181 
      @@ -298,9 +298,9 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
      209 
      210 std::unique_ptr<PesPacket> PesPacketGenerator::GetNextPesPacket() {
      211  DCHECK(!pes_packets_.empty());
      -
      212  PesPacket* pes = pes_packets_.front();
      +
      212  std::unique_ptr<PesPacket> pes = std::move(pes_packets_.front());
      213  pes_packets_.pop_front();
      -
      214  return std::unique_ptr<PesPacket>(pes);
      +
      214  return pes;
      215 }
      216 
      @@ -328,7 +328,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 dfb5c822a6..a90200500b 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 @@ -128,7 +128,7 @@ int cluster_count () c 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 21c6546e54..be6f9c331d 100644 --- a/docs/d2/dfc/classshaka_1_1media_1_1MkvWriter-members.html +++ b/docs/d2/dfc/classshaka_1_1media_1_1MkvWriter-members.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d2/dfd/adts__header_8h_source.html b/docs/d2/dfd/adts__header_8h_source.html index a259f92903..d36f6864f0 100644 --- a/docs/d2/dfd/adts__header_8h_source.html +++ b/docs/d2/dfd/adts__header_8h_source.html @@ -150,7 +150,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 6e375a0482..86aefe0ad6 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 @@ -127,7 +127,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 7d5ad29d88..ad2e4a3da0 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 @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d3/d0a/classshaka_1_1media_1_1MediaParser.html b/docs/d3/d0a/classshaka_1_1media_1_1MediaParser.html index be35a68654..be01ba5f43 100644 --- a/docs/d3/d0a/classshaka_1_1media_1_1MediaParser.html +++ b/docs/d3/d0a/classshaka_1_1media_1_1MediaParser.html @@ -298,7 +298,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 da51c2b749..e9702007a5 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 @@ -336,7 +336,7 @@ Static 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 8a87f749ee..08eb9385c9 100644 --- a/docs/d3/d12/classshaka_1_1media_1_1LibcryptoThreading-members.html +++ b/docs/d3/d12/classshaka_1_1media_1_1LibcryptoThreading-members.html @@ -98,7 +98,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d3/d15/udp__file__win_8cc_source.html b/docs/d3/d15/udp__file__win_8cc_source.html index 7fab09ec43..79467daf1e 100644 --- a/docs/d3/d15/udp__file__win_8cc_source.html +++ b/docs/d3/d15/udp__file__win_8cc_source.html @@ -160,7 +160,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 d19bd7909d..117ec3059d 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d3/d19/io__cache_8h_source.html b/docs/d3/d19/io__cache_8h_source.html index 708709894f..ef52a5ed01 100644 --- a/docs/d3/d19/io__cache_8h_source.html +++ b/docs/d3/d19/io__cache_8h_source.html @@ -162,7 +162,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 9f0a7e0783..5fa4613a40 100644 --- a/docs/d3/d35/video__slice__header__parser_8cc_source.html +++ b/docs/d3/d35/video__slice__header__parser_8cc_source.html @@ -181,9 +181,9 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
      92 } // namespace media
      93 } // namespace shaka
      94 
      - -
      Result ParseSliceHeader(const Nalu &nalu, H265SliceHeader *slice_header)
      Definition: h265_parser.cc:187
      -
      Result ParsePps(const Nalu &nalu, int *pps_id)
      Definition: h265_parser.cc:404
      + +
      Result ParseSliceHeader(const Nalu &nalu, H265SliceHeader *slice_header)
      Definition: h265_parser.cc:183
      +
      Result ParsePps(const Nalu &nalu, int *pps_id)
      Definition: h265_parser.cc:400
      int type() const
      Definition: nalu_reader.h:112
      int64_t GetHeaderSize(const Nalu &nalu) override
      Gets the header size of the given NALU. Returns < 0 on error.
      int64_t GetHeaderSize(const Nalu &nalu) override
      Gets the header size of the given NALU. Returns < 0 on error.
      @@ -194,13 +194,13 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
      Class for parsing HEVC decoder configuration record.
      Class for parsing AVC decoder configuration record.
      -
      Result ParseSps(const Nalu &nalu, int *sps_id)
      Definition: h265_parser.cc:513
      +
      Result ParseSps(const Nalu &nalu, int *sps_id)
      Definition: h265_parser.cc:508
      bool Initialize(const std::vector< uint8_t > &decoder_configuration) override
      diff --git a/docs/d3/d47/structshaka_1_1media_1_1mp4_1_1PrivFrame.html b/docs/d3/d47/structshaka_1_1media_1_1mp4_1_1PrivFrame.html index 183aa82270..5a4b0b016a 100644 --- a/docs/d3/d47/structshaka_1_1media_1_1mp4_1_1PrivFrame.html +++ b/docs/d3/d47/structshaka_1_1media_1_1mp4_1_1PrivFrame.html @@ -129,7 +129,7 @@ std::string value diff --git a/docs/d3/d51/classshaka_1_1media_1_1LibcryptoThreading.html b/docs/d3/d51/classshaka_1_1media_1_1LibcryptoThreading.html index 7b5037cd1c..9536a5f995 100644 --- a/docs/d3/d51/classshaka_1_1media_1_1LibcryptoThreading.html +++ b/docs/d3/d51/classshaka_1_1media_1_1LibcryptoThreading.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d3/d56/decrypt__config_8cc_source.html b/docs/d3/d56/decrypt__config_8cc_source.html index dc0075f555..b5b259b5c7 100644 --- a/docs/d3/d56/decrypt__config_8cc_source.html +++ b/docs/d3/d56/decrypt__config_8cc_source.html @@ -127,7 +127,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d3/d61/classshaka_1_1media_1_1File.html b/docs/d3/d61/classshaka_1_1media_1_1File.html index a0fb6cd6f8..34e12f295d 100644 --- a/docs/d3/d61/classshaka_1_1media_1_1File.html +++ b/docs/d3/d61/classshaka_1_1media_1_1File.html @@ -811,7 +811,7 @@ class ThreadedIoFile diff --git a/docs/d3/d62/continuity__counter_8h_source.html b/docs/d3/d62/continuity__counter_8h_source.html index 4840e21dff..f03c849101 100644 --- a/docs/d3/d62/continuity__counter_8h_source.html +++ b/docs/d3/d62/continuity__counter_8h_source.html @@ -124,7 +124,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d3/d62/rcheck_8h_source.html b/docs/d3/d62/rcheck_8h_source.html index 88eece9772..dcf2a98c39 100644 --- a/docs/d3/d62/rcheck_8h_source.html +++ b/docs/d3/d62/rcheck_8h_source.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 97b864e50c..30d30efc39 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d3/d67/classshaka_1_1media_1_1WebMVideoClient.html b/docs/d3/d67/classshaka_1_1media_1_1WebMVideoClient.html index 15724047fb..8ea5212918 100644 --- a/docs/d3/d67/classshaka_1_1media_1_1WebMVideoClient.html +++ b/docs/d3/d67/classshaka_1_1media_1_1WebMVideoClient.html @@ -179,7 +179,7 @@ Additional Inherited Members
      An empty scoped_refptr if there was unexpected values in the provided parameters or video track element fields.
      -

      Definition at line 51 of file webm_video_client.cc.

      +

      Definition at line 50 of file webm_video_client.cc.

      @@ -190,7 +190,7 @@ An empty scoped_refptr if there was unexpected values in the provided parameters diff --git a/docs/d3/d6b/fixed__key__source_8cc_source.html b/docs/d3/d6b/fixed__key__source_8cc_source.html index 9d788ee98b..614d71a1a1 100644 --- a/docs/d3/d6b/fixed__key__source_8cc_source.html +++ b/docs/d3/d6b/fixed__key__source_8cc_source.html @@ -247,7 +247,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 ce760ba647..4ae1b3ec9e 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 @@ -178,7 +178,7 @@ FourCC protection_scheme diff --git a/docs/d3/d72/fixed__key__source_8h_source.html b/docs/d3/d72/fixed__key__source_8h_source.html index 8201e50f8f..3b5b87482d 100644 --- a/docs/d3/d72/fixed__key__source_8h_source.html +++ b/docs/d3/d72/fixed__key__source_8h_source.html @@ -160,7 +160,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 932c3cbe3f..0d8547b2ae 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 @@ -182,7 +182,7 @@ FourCC protection_scheme diff --git a/docs/d3/d75/classshaka_1_1media_1_1AesEncryptor.html b/docs/d3/d75/classshaka_1_1media_1_1AesEncryptor.html index 0ede9c5547..8ff2650ac8 100644 --- a/docs/d3/d75/classshaka_1_1media_1_1AesEncryptor.html +++ b/docs/d3/d75/classshaka_1_1media_1_1AesEncryptor.html @@ -236,7 +236,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 2c41d5804a..d48e2b22d9 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 @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d3/d76/muxer__flags_8h_source.html b/docs/d3/d76/muxer__flags_8h_source.html index 8c1efd1885..918774d157 100644 --- a/docs/d3/d76/muxer__flags_8h_source.html +++ b/docs/d3/d76/muxer__flags_8h_source.html @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 9ef1472b3d..cbecfd3417 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 @@ -112,7 +112,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 9efc83015d..6a02ccb2fa 100644 --- a/docs/d3/d7b/classshaka_1_1media_1_1RsaPublicKey-members.html +++ b/docs/d3/d7b/classshaka_1_1media_1_1RsaPublicKey-members.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d3/d7c/classshaka_1_1media_1_1WebMAudioClient.html b/docs/d3/d7c/classshaka_1_1media_1_1WebMAudioClient.html index 9611a76f33..c71126af58 100644 --- a/docs/d3/d7c/classshaka_1_1media_1_1WebMAudioClient.html +++ b/docs/d3/d7c/classshaka_1_1media_1_1WebMAudioClient.html @@ -223,7 +223,7 @@ An empty scoped_refptr if there was unexpected values in the provided parameters diff --git a/docs/d3/d80/muxer__util_8h_source.html b/docs/d3/d80/muxer__util_8h_source.html index c1d475c5cb..7079c6477b 100644 --- a/docs/d3/d80/muxer__util_8h_source.html +++ b/docs/d3/d80/muxer__util_8h_source.html @@ -127,7 +127,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 084075a6e7..afe149774b 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 @@ -182,7 +182,7 @@ Additional Inherited Members diff --git a/docs/d3/d8b/structshaka_1_1media_1_1FileCloser.html b/docs/d3/d8b/structshaka_1_1media_1_1FileCloser.html index 8931405af8..537b791adf 100644 --- a/docs/d3/d8b/structshaka_1_1media_1_1FileCloser.html +++ b/docs/d3/d8b/structshaka_1_1media_1_1FileCloser.html @@ -112,7 +112,7 @@ void operator() ( diff --git a/docs/d3/d8d/webm__audio__client_8h_source.html b/docs/d3/d8d/webm__audio__client_8h_source.html index 268b50e830..11d626a927 100644 --- a/docs/d3/d8d/webm__audio__client_8h_source.html +++ b/docs/d3/d8d/webm__audio__client_8h_source.html @@ -144,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d3/d90/ec3__audio__util_8cc_source.html b/docs/d3/d90/ec3__audio__util_8cc_source.html index 47ae2024d4..dbaa4255af 100644 --- a/docs/d3/d90/ec3__audio__util_8cc_source.html +++ b/docs/d3/d90/ec3__audio__util_8cc_source.html @@ -245,7 +245,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d3/d91/classshaka_1_1media_1_1H264Parser.html b/docs/d3/d91/classshaka_1_1media_1_1H264Parser.html index 9cf0fb87fa..1483fa63f8 100644 --- a/docs/d3/d91/classshaka_1_1media_1_1H264Parser.html +++ b/docs/d3/d91/classshaka_1_1media_1_1H264Parser.html @@ -127,7 +127,7 @@ Result ParseSEI (const

      Detailed Description

      -

      Definition at line 244 of file h264_parser.h.

      +

      Definition at line 245 of file h264_parser.h.


      The documentation for this class was generated from the following files:
      • media/codecs/h264_parser.h
      • media/codecs/h264_parser.cc
      • @@ -135,7 +135,7 @@ Result ParseSEI (const diff --git a/docs/d3/da0/ec3__audio__util_8h_source.html b/docs/d3/da0/ec3__audio__util_8h_source.html index 1cdbb90797..45375605e2 100644 --- a/docs/d3/da0/ec3__audio__util_8h_source.html +++ b/docs/d3/da0/ec3__audio__util_8h_source.html @@ -114,7 +114,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 82dcf37639..8b6c42c8b6 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 @@ -293,7 +293,7 @@ double cluster_length_sec< 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 0033befd1f..e94e0d566b 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 @@ -185,7 +185,7 @@ Additional Inherited Members 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 525e48d5aa..8d39308e6a 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 @@ -189,7 +189,7 @@ Additional Inherited Members 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 906c232174..3022c99831 100644 --- a/docs/d3/db4/classshaka_1_1media_1_1WebMWebVTTParser-members.html +++ b/docs/d3/db4/classshaka_1_1media_1_1WebMWebVTTParser-members.html @@ -97,7 +97,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 0efaf095c5..d84c4fee9d 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 @@ -182,7 +182,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 69988bfac2..fcd572431e 100644 --- a/docs/d3/db6/webm__parser_8cc_source.html +++ b/docs/d3/db6/webm__parser_8cc_source.html @@ -1068,7 +1068,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d3/dbc/seek__head_8cc_source.html b/docs/d3/dbc/seek__head_8cc_source.html index 5237401974..2fbb213975 100644 --- a/docs/d3/dbc/seek__head_8cc_source.html +++ b/docs/d3/dbc/seek__head_8cc_source.html @@ -216,7 +216,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d3/dbe/demuxer_8cc_source.html b/docs/d3/dbe/demuxer_8cc_source.html index a539876a2d..d484d0856a 100644 --- a/docs/d3/dbe/demuxer_8cc_source.html +++ b/docs/d3/dbe/demuxer_8cc_source.html @@ -97,255 +97,244 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
        8 
        9 #include "packager/base/bind.h"
        10 #include "packager/base/logging.h"
        -
        11 #include "packager/base/stl_util.h"
        -
        12 #include "packager/media/base/decryptor_source.h"
        -
        13 #include "packager/media/base/key_source.h"
        -
        14 #include "packager/media/base/media_sample.h"
        -
        15 #include "packager/media/base/media_stream.h"
        -
        16 #include "packager/media/base/stream_info.h"
        -
        17 #include "packager/media/file/file.h"
        -
        18 #include "packager/media/formats/mp2t/mp2t_media_parser.h"
        -
        19 #include "packager/media/formats/mp4/mp4_media_parser.h"
        -
        20 #include "packager/media/formats/webm/webm_media_parser.h"
        -
        21 #include "packager/media/formats/webvtt/webvtt_media_parser.h"
        -
        22 #include "packager/media/formats/wvm/wvm_media_parser.h"
        -
        23 
        -
        24 namespace {
        -
        25 // 65KB, sufficient to determine the container and likely all init data.
        -
        26 const size_t kInitBufSize = 0x10000;
        -
        27 const size_t kBufSize = 0x200000; // 2MB
        -
        28 // Maximum number of allowed queued samples. If we are receiving a lot of
        -
        29 // samples before seeing init_event, something is not right. The number
        -
        30 // set here is arbitrary though.
        -
        31 const size_t kQueuedSamplesLimit = 10000;
        -
        32 }
        -
        33 
        -
        34 namespace shaka {
        -
        35 namespace media {
        -
        36 
        -
        37 Demuxer::Demuxer(const std::string& file_name)
        -
        38  : file_name_(file_name),
        -
        39  media_file_(NULL),
        -
        40  init_event_received_(false),
        -
        41  container_name_(CONTAINER_UNKNOWN),
        -
        42  buffer_(new uint8_t[kBufSize]),
        -
        43  cancelled_(false) {
        -
        44 }
        -
        45 
        -
        46 Demuxer::~Demuxer() {
        -
        47  if (media_file_)
        -
        48  media_file_->Close();
        -
        49  STLDeleteElements(&streams_);
        -
        50 }
        -
        51 
        -
        52 void Demuxer::SetKeySource(std::unique_ptr<KeySource> key_source) {
        -
        53  key_source_ = std::move(key_source);
        -
        54 }
        -
        55 
        - -
        57  DCHECK(!media_file_);
        -
        58  DCHECK(!init_event_received_);
        +
        11 #include "packager/media/base/decryptor_source.h"
        +
        12 #include "packager/media/base/key_source.h"
        +
        13 #include "packager/media/base/media_sample.h"
        +
        14 #include "packager/media/base/media_stream.h"
        +
        15 #include "packager/media/base/stream_info.h"
        +
        16 #include "packager/media/file/file.h"
        +
        17 #include "packager/media/formats/mp2t/mp2t_media_parser.h"
        +
        18 #include "packager/media/formats/mp4/mp4_media_parser.h"
        +
        19 #include "packager/media/formats/webm/webm_media_parser.h"
        +
        20 #include "packager/media/formats/webvtt/webvtt_media_parser.h"
        +
        21 #include "packager/media/formats/wvm/wvm_media_parser.h"
        +
        22 
        +
        23 namespace {
        +
        24 // 65KB, sufficient to determine the container and likely all init data.
        +
        25 const size_t kInitBufSize = 0x10000;
        +
        26 const size_t kBufSize = 0x200000; // 2MB
        +
        27 // Maximum number of allowed queued samples. If we are receiving a lot of
        +
        28 // samples before seeing init_event, something is not right. The number
        +
        29 // set here is arbitrary though.
        +
        30 const size_t kQueuedSamplesLimit = 10000;
        +
        31 }
        +
        32 
        +
        33 namespace shaka {
        +
        34 namespace media {
        +
        35 
        +
        36 Demuxer::Demuxer(const std::string& file_name)
        +
        37  : file_name_(file_name),
        +
        38  media_file_(NULL),
        +
        39  init_event_received_(false),
        +
        40  container_name_(CONTAINER_UNKNOWN),
        +
        41  buffer_(new uint8_t[kBufSize]),
        +
        42  cancelled_(false) {
        +
        43 }
        +
        44 
        +
        45 Demuxer::~Demuxer() {
        +
        46  if (media_file_)
        +
        47  media_file_->Close();
        +
        48 }
        +
        49 
        +
        50 void Demuxer::SetKeySource(std::unique_ptr<KeySource> key_source) {
        +
        51  key_source_ = std::move(key_source);
        +
        52 }
        +
        53 
        + +
        55  DCHECK(!media_file_);
        +
        56  DCHECK(!init_event_received_);
        +
        57 
        +
        58  LOG(INFO) << "Initialize Demuxer for file '" << file_name_ << "'.";
        59 
        -
        60  LOG(INFO) << "Initialize Demuxer for file '" << file_name_ << "'.";
        -
        61 
        -
        62  media_file_ = File::Open(file_name_.c_str(), "r");
        -
        63  if (!media_file_) {
        -
        64  return Status(error::FILE_FAILURE,
        -
        65  "Cannot open file for reading " + file_name_);
        -
        66  }
        -
        67 
        -
        68  // Read enough bytes before detecting the container.
        -
        69  size_t bytes_read = 0;
        -
        70  while (bytes_read < kInitBufSize) {
        -
        71  int64_t read_result =
        -
        72  media_file_->Read(buffer_.get() + bytes_read, kInitBufSize);
        -
        73  if (read_result < 0)
        -
        74  return Status(error::FILE_FAILURE, "Cannot read file " + file_name_);
        -
        75  if (read_result == 0)
        -
        76  break;
        -
        77  bytes_read += read_result;
        -
        78  }
        -
        79  container_name_ = DetermineContainer(buffer_.get(), bytes_read);
        -
        80 
        -
        81  // Initialize media parser.
        -
        82  switch (container_name_) {
        -
        83  case CONTAINER_MOV:
        -
        84  parser_.reset(new mp4::MP4MediaParser());
        -
        85  break;
        -
        86  case CONTAINER_MPEG2TS:
        -
        87  parser_.reset(new mp2t::Mp2tMediaParser());
        -
        88  break;
        -
        89  case CONTAINER_MPEG2PS:
        -
        90  parser_.reset(new wvm::WvmMediaParser());
        -
        91  break;
        -
        92  case CONTAINER_WEBM:
        -
        93  parser_.reset(new WebMMediaParser());
        -
        94  break;
        -
        95  case CONTAINER_WEBVTT:
        -
        96  parser_.reset(new WebVttMediaParser());
        -
        97  break;
        -
        98  default:
        -
        99  NOTIMPLEMENTED();
        -
        100  return Status(error::UNIMPLEMENTED, "Container not supported.");
        -
        101  }
        -
        102 
        -
        103  parser_->Init(base::Bind(&Demuxer::ParserInitEvent, base::Unretained(this)),
        -
        104  base::Bind(&Demuxer::NewSampleEvent, base::Unretained(this)),
        -
        105  key_source_.get());
        -
        106 
        -
        107  // Handle trailing 'moov'.
        -
        108  if (container_name_ == CONTAINER_MOV)
        -
        109  static_cast<mp4::MP4MediaParser*>(parser_.get())->LoadMoov(file_name_);
        -
        110 
        -
        111  if (!parser_->Parse(buffer_.get(), bytes_read)) {
        -
        112  init_parsing_status_ =
        -
        113  Status(error::PARSER_FAILURE, "Cannot parse media file " + file_name_);
        -
        114  }
        -
        115 
        -
        116  // Parse until init event received or on error.
        -
        117  while (!init_event_received_ && init_parsing_status_.ok())
        -
        118  init_parsing_status_ = Parse();
        -
        119  // Defer error reporting if init completed successfully.
        -
        120  return init_event_received_ ? Status::OK : init_parsing_status_;
        -
        121 }
        -
        122 
        -
        123 void Demuxer::ParserInitEvent(
        -
        124  const std::vector<scoped_refptr<StreamInfo> >& streams) {
        -
        125  init_event_received_ = true;
        -
        126 
        -
        127  std::vector<scoped_refptr<StreamInfo> >::const_iterator it = streams.begin();
        -
        128  for (; it != streams.end(); ++it) {
        -
        129  streams_.push_back(new MediaStream(*it, this));
        -
        130  }
        -
        131 }
        +
        60  media_file_ = File::Open(file_name_.c_str(), "r");
        +
        61  if (!media_file_) {
        +
        62  return Status(error::FILE_FAILURE,
        +
        63  "Cannot open file for reading " + file_name_);
        +
        64  }
        +
        65 
        +
        66  // Read enough bytes before detecting the container.
        +
        67  size_t bytes_read = 0;
        +
        68  while (bytes_read < kInitBufSize) {
        +
        69  int64_t read_result =
        +
        70  media_file_->Read(buffer_.get() + bytes_read, kInitBufSize);
        +
        71  if (read_result < 0)
        +
        72  return Status(error::FILE_FAILURE, "Cannot read file " + file_name_);
        +
        73  if (read_result == 0)
        +
        74  break;
        +
        75  bytes_read += read_result;
        +
        76  }
        +
        77  container_name_ = DetermineContainer(buffer_.get(), bytes_read);
        +
        78 
        +
        79  // Initialize media parser.
        +
        80  switch (container_name_) {
        +
        81  case CONTAINER_MOV:
        +
        82  parser_.reset(new mp4::MP4MediaParser());
        +
        83  break;
        +
        84  case CONTAINER_MPEG2TS:
        +
        85  parser_.reset(new mp2t::Mp2tMediaParser());
        +
        86  break;
        +
        87  case CONTAINER_MPEG2PS:
        +
        88  parser_.reset(new wvm::WvmMediaParser());
        +
        89  break;
        +
        90  case CONTAINER_WEBM:
        +
        91  parser_.reset(new WebMMediaParser());
        +
        92  break;
        +
        93  case CONTAINER_WEBVTT:
        +
        94  parser_.reset(new WebVttMediaParser());
        +
        95  break;
        +
        96  default:
        +
        97  NOTIMPLEMENTED();
        +
        98  return Status(error::UNIMPLEMENTED, "Container not supported.");
        +
        99  }
        +
        100 
        +
        101  parser_->Init(base::Bind(&Demuxer::ParserInitEvent, base::Unretained(this)),
        +
        102  base::Bind(&Demuxer::NewSampleEvent, base::Unretained(this)),
        +
        103  key_source_.get());
        +
        104 
        +
        105  // Handle trailing 'moov'.
        +
        106  if (container_name_ == CONTAINER_MOV)
        +
        107  static_cast<mp4::MP4MediaParser*>(parser_.get())->LoadMoov(file_name_);
        +
        108 
        +
        109  if (!parser_->Parse(buffer_.get(), bytes_read)) {
        +
        110  init_parsing_status_ =
        +
        111  Status(error::PARSER_FAILURE, "Cannot parse media file " + file_name_);
        +
        112  }
        +
        113 
        +
        114  // Parse until init event received or on error.
        +
        115  while (!init_event_received_ && init_parsing_status_.ok())
        +
        116  init_parsing_status_ = Parse();
        +
        117  // Defer error reporting if init completed successfully.
        +
        118  return init_event_received_ ? Status::OK : init_parsing_status_;
        +
        119 }
        +
        120 
        +
        121 void Demuxer::ParserInitEvent(
        +
        122  const std::vector<scoped_refptr<StreamInfo>>& stream_infos) {
        +
        123  init_event_received_ = true;
        +
        124  for (const scoped_refptr<StreamInfo>& stream_info : stream_infos)
        +
        125  streams_.emplace_back(new MediaStream(stream_info, this));
        +
        126 }
        +
        127 
        +
        128 Demuxer::QueuedSample::QueuedSample(uint32_t local_track_id,
        +
        129  scoped_refptr<MediaSample> local_sample)
        +
        130  : track_id(local_track_id), sample(local_sample) {}
        +
        131 Demuxer::QueuedSample::~QueuedSample() {}
        132 
        -
        133 Demuxer::QueuedSample::QueuedSample(uint32_t local_track_id,
        -
        134  scoped_refptr<MediaSample> local_sample)
        -
        135  : track_id(local_track_id), sample(local_sample) {}
        -
        136 Demuxer::QueuedSample::~QueuedSample() {}
        -
        137 
        -
        138 bool Demuxer::NewSampleEvent(uint32_t track_id,
        -
        139  const scoped_refptr<MediaSample>& sample) {
        -
        140  if (!init_event_received_) {
        -
        141  if (queued_samples_.size() >= kQueuedSamplesLimit) {
        -
        142  LOG(ERROR) << "Queued samples limit reached: " << kQueuedSamplesLimit;
        -
        143  return false;
        -
        144  }
        -
        145  queued_samples_.push_back(QueuedSample(track_id, sample));
        -
        146  return true;
        -
        147  }
        -
        148  while (!queued_samples_.empty()) {
        -
        149  if (!PushSample(queued_samples_.front().track_id,
        -
        150  queued_samples_.front().sample)) {
        -
        151  return false;
        -
        152  }
        -
        153  queued_samples_.pop_front();
        -
        154  }
        -
        155  return PushSample(track_id, sample);
        -
        156 }
        -
        157 
        -
        158 bool Demuxer::PushSample(uint32_t track_id,
        -
        159  const scoped_refptr<MediaSample>& sample) {
        -
        160  std::vector<MediaStream*>::iterator it = streams_.begin();
        -
        161  for (; it != streams_.end(); ++it) {
        -
        162  if (track_id == (*it)->info()->track_id()) {
        -
        163  Status status = (*it)->PushSample(sample);
        -
        164  if (!status.ok())
        -
        165  LOG(ERROR) << "Demuxer::PushSample failed with " << status;
        -
        166  return status.ok();
        -
        167  }
        -
        168  }
        -
        169  LOG(ERROR) << "Track " << track_id << " not found.";
        -
        170  return false;
        -
        171 }
        -
        172 
        - -
        174  Status status;
        -
        175 
        -
        176  LOG(INFO) << "Demuxer::Run() on file '" << file_name_ << "'.";
        -
        177 
        -
        178  // Start the streams.
        -
        179  for (std::vector<MediaStream*>::iterator it = streams_.begin();
        -
        180  it != streams_.end();
        -
        181  ++it) {
        -
        182  status = (*it)->Start(MediaStream::kPush);
        -
        183  if (!status.ok())
        -
        184  return status;
        -
        185  }
        -
        186 
        -
        187  while (!cancelled_ && (status = Parse()).ok())
        -
        188  continue;
        -
        189 
        -
        190  if (cancelled_ && status.ok())
        -
        191  return Status(error::CANCELLED, "Demuxer run cancelled");
        -
        192 
        -
        193  if (status.error_code() == error::END_OF_STREAM) {
        -
        194  // Push EOS sample to muxer to indicate end of stream.
        -
        195  const scoped_refptr<MediaSample>& sample = MediaSample::CreateEOSBuffer();
        -
        196  for (std::vector<MediaStream*>::iterator it = streams_.begin();
        -
        197  it != streams_.end();
        -
        198  ++it) {
        -
        199  status = (*it)->PushSample(sample);
        -
        200  if (!status.ok())
        -
        201  return status;
        -
        202  }
        -
        203  }
        -
        204  return status;
        -
        205 }
        +
        133 bool Demuxer::NewSampleEvent(uint32_t track_id,
        +
        134  const scoped_refptr<MediaSample>& sample) {
        +
        135  if (!init_event_received_) {
        +
        136  if (queued_samples_.size() >= kQueuedSamplesLimit) {
        +
        137  LOG(ERROR) << "Queued samples limit reached: " << kQueuedSamplesLimit;
        +
        138  return false;
        +
        139  }
        +
        140  queued_samples_.push_back(QueuedSample(track_id, sample));
        +
        141  return true;
        +
        142  }
        +
        143  while (!queued_samples_.empty()) {
        +
        144  if (!PushSample(queued_samples_.front().track_id,
        +
        145  queued_samples_.front().sample)) {
        +
        146  return false;
        +
        147  }
        +
        148  queued_samples_.pop_front();
        +
        149  }
        +
        150  return PushSample(track_id, sample);
        +
        151 }
        +
        152 
        +
        153 bool Demuxer::PushSample(uint32_t track_id,
        +
        154  const scoped_refptr<MediaSample>& sample) {
        +
        155  for (const std::unique_ptr<MediaStream>& stream : streams_) {
        +
        156  if (track_id == stream->info()->track_id()) {
        +
        157  Status status = stream->PushSample(sample);
        +
        158  if (!status.ok())
        +
        159  LOG(ERROR) << "Demuxer::PushSample failed with " << status;
        +
        160  return status.ok();
        +
        161  }
        +
        162  }
        +
        163  LOG(ERROR) << "Track " << track_id << " not found.";
        +
        164  return false;
        +
        165 }
        +
        166 
        + +
        168  Status status;
        +
        169 
        +
        170  LOG(INFO) << "Demuxer::Run() on file '" << file_name_ << "'.";
        +
        171 
        +
        172  // Start the streams.
        +
        173  for (const std::unique_ptr<MediaStream>& stream : streams_) {
        +
        174  status = stream->Start(MediaStream::kPush);
        +
        175  if (!status.ok())
        +
        176  return status;
        +
        177  }
        +
        178 
        +
        179  while (!cancelled_ && (status = Parse()).ok())
        +
        180  continue;
        +
        181 
        +
        182  if (cancelled_ && status.ok())
        +
        183  return Status(error::CANCELLED, "Demuxer run cancelled");
        +
        184 
        +
        185  if (status.error_code() == error::END_OF_STREAM) {
        +
        186  // Push EOS sample to muxer to indicate end of stream.
        +
        187  const scoped_refptr<MediaSample>& sample = MediaSample::CreateEOSBuffer();
        +
        188  for (const std::unique_ptr<MediaStream>& stream : streams_) {
        +
        189  status = stream->PushSample(sample);
        +
        190  if (!status.ok())
        +
        191  return status;
        +
        192  }
        +
        193  }
        +
        194  return status;
        +
        195 }
        +
        196 
        + +
        198  DCHECK(media_file_);
        +
        199  DCHECK(parser_);
        +
        200  DCHECK(buffer_);
        +
        201 
        +
        202  // Return early and avoid call Parse(...) again if it has already failed at
        +
        203  // the initialization.
        +
        204  if (!init_parsing_status_.ok())
        +
        205  return init_parsing_status_;
        206 
        - -
        208  DCHECK(media_file_);
        -
        209  DCHECK(parser_);
        -
        210  DCHECK(buffer_);
        -
        211 
        -
        212  // Return early and avoid call Parse(...) again if it has already failed at
        -
        213  // the initialization.
        -
        214  if (!init_parsing_status_.ok())
        -
        215  return init_parsing_status_;
        -
        216 
        -
        217  int64_t bytes_read = media_file_->Read(buffer_.get(), kBufSize);
        -
        218  if (bytes_read == 0) {
        -
        219  if (!parser_->Flush())
        -
        220  return Status(error::PARSER_FAILURE, "Failed to flush.");
        -
        221  return Status(error::END_OF_STREAM, "");
        -
        222  } else if (bytes_read < 0) {
        -
        223  return Status(error::FILE_FAILURE, "Cannot read file " + file_name_);
        -
        224  }
        +
        207  int64_t bytes_read = media_file_->Read(buffer_.get(), kBufSize);
        +
        208  if (bytes_read == 0) {
        +
        209  if (!parser_->Flush())
        +
        210  return Status(error::PARSER_FAILURE, "Failed to flush.");
        +
        211  return Status(error::END_OF_STREAM, "");
        +
        212  } else if (bytes_read < 0) {
        +
        213  return Status(error::FILE_FAILURE, "Cannot read file " + file_name_);
        +
        214  }
        +
        215 
        +
        216  return parser_->Parse(buffer_.get(), bytes_read)
        +
        217  ? Status::OK
        +
        218  : Status(error::PARSER_FAILURE,
        +
        219  "Cannot parse media file " + file_name_);
        +
        220 }
        +
        221 
        + +
        223  cancelled_ = true;
        +
        224 }
        225 
        -
        226  return parser_->Parse(buffer_.get(), bytes_read)
        -
        227  ? Status::OK
        -
        228  : Status(error::PARSER_FAILURE,
        -
        229  "Cannot parse media file " + file_name_);
        -
        230 }
        -
        231 
        - -
        233  cancelled_ = true;
        -
        234 }
        -
        235 
        -
        236 } // namespace media
        -
        237 } // namespace shaka
        +
        226 } // namespace media
        +
        227 } // namespace shaka
        virtual bool Open()=0
        Internal open. Should not be used directly.
        - +
        virtual bool Close()=0
        - + -
        const std::vector< MediaStream * > & streams()
        Definition: demuxer.h:68
        -
        void SetKeySource(std::unique_ptr< KeySource > key_source)
        Definition: demuxer.cc:52
        +
        void SetKeySource(std::unique_ptr< KeySource > key_source)
        Definition: demuxer.cc:50
        virtual int64_t Read(void *buffer, uint64_t length)=0
        static scoped_refptr< MediaSample > CreateEOSBuffer()
        Definition: media_sample.cc:80
        -
        Status Parse()
        Read from the source and send it to the parser.
        Definition: demuxer.cc:207
        -
        Status Initialize()
        Definition: demuxer.cc:56
        -
        Demuxer(const std::string &file_name)
        Definition: demuxer.cc:37
        +
        Status Parse()
        Read from the source and send it to the parser.
        Definition: demuxer.cc:197
        +
        Status Initialize()
        Definition: demuxer.cc:54
        +
        Demuxer(const std::string &file_name)
        Definition: demuxer.cc:36
        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 e8341330ba..b2c7b812c3 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 @@ -182,7 +182,7 @@ Additional Inherited Members diff --git a/docs/d3/dc1/classshaka_1_1media_1_1mp2t_1_1Mp2tMediaParser.html b/docs/d3/dc1/classshaka_1_1media_1_1mp2t_1_1Mp2tMediaParser.html index d957491ece..159b8d902f 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 @@ -153,7 +153,7 @@ track_id, const scoped_refptr

        Implements shaka::media::MediaParser.

        -

        Definition at line 173 of file mp2t_media_parser.cc.

        +

        Definition at line 170 of file mp2t_media_parser.cc.

        @@ -205,7 +205,7 @@ track_id, const scoped_refptr

        Implements shaka::media::MediaParser.

        -

        Definition at line 160 of file mp2t_media_parser.cc.

        +

        Definition at line 157 of file mp2t_media_parser.cc.

        @@ -245,7 +245,7 @@ track_id, const scoped_refptr

        Implements shaka::media::MediaParser.

        -

        Definition at line 192 of file mp2t_media_parser.cc.

        +

        Definition at line 188 of file mp2t_media_parser.cc.

        @@ -256,7 +256,7 @@ track_id, const scoped_refptr
        diff --git a/docs/d3/dd0/classshaka_1_1MpdNotifier.html b/docs/d3/dd0/classshaka_1_1MpdNotifier.html index 976da74e60..d5ebd04d77 100644 --- a/docs/d3/dd0/classshaka_1_1MpdNotifier.html +++ b/docs/d3/dd0/classshaka_1_1MpdNotifier.html @@ -472,7 +472,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 85bb094f33..b73ee4d258 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 @@ -177,7 +177,7 @@ std::vector< FourCC > < diff --git a/docs/d3/de4/seek__head_8h_source.html b/docs/d3/de4/seek__head_8h_source.html index 17a5e56d37..3df0ac5c03 100644 --- a/docs/d3/de4/seek__head_8h_source.html +++ b/docs/d3/de4/seek__head_8h_source.html @@ -140,7 +140,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 ec4bde09a0..52e903dc7d 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 @@ -121,7 +121,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 b216d86936..37bd3a3699 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 @@ -116,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d3/df1/box__reader_8cc_source.html b/docs/d3/df1/box__reader_8cc_source.html index c2f94ca19a..e7a87891aa 100644 --- a/docs/d3/df1/box__reader_8cc_source.html +++ b/docs/d3/df1/box__reader_8cc_source.html @@ -260,7 +260,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d3/dfe/classshaka_1_1media_1_1AesPatternCryptor.html b/docs/d3/dfe/classshaka_1_1media_1_1AesPatternCryptor.html index 4948c084f9..23bed34c77 100644 --- a/docs/d3/dfe/classshaka_1_1media_1_1AesPatternCryptor.html +++ b/docs/d3/dfe/classshaka_1_1media_1_1AesPatternCryptor.html @@ -297,7 +297,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 4a25f05359..17d8690416 100644 --- a/docs/d4/d00/mp4_2multi__segment__segmenter_8cc_source.html +++ b/docs/d4/d00/mp4_2multi__segment__segmenter_8cc_source.html @@ -289,8 +289,8 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
        200 } // namespace shaka
        virtual void OnNewSegment(const std::string &segment_name, uint64_t start_time, uint64_t duration, uint64_t segment_file_size)=0
        virtual bool Open()=0
        Internal open. Should not be used directly.
        -
        void UpdateProgress(uint64_t progress)
        Update segmentation progress using ProgressListener.
        Definition: segmenter.cc:389
        -
        void SetComplete()
        Set progress to 100%.
        Definition: segmenter.cc:405
        +
        void UpdateProgress(uint64_t progress)
        Update segmentation progress using ProgressListener.
        Definition: segmenter.cc:387
        +
        void SetComplete()
        Set progress to 100%.
        Definition: segmenter.cc:403
        virtual void OnSampleDurationReady(uint32_t sample_duration)=0
        virtual bool Close()=0
        @@ -306,7 +306,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 20361d04a1..5b122c1fe8 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 @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d4/d0b/classshaka_1_1media_1_1TextTrack.html b/docs/d4/d0b/classshaka_1_1media_1_1TextTrack.html index 79d9d8b593..792806aa8f 100644 --- a/docs/d4/d0b/classshaka_1_1media_1_1TextTrack.html +++ b/docs/d4/d0b/classshaka_1_1media_1_1TextTrack.html @@ -109,7 +109,7 @@ virtual void addWebVTTCue< diff --git a/docs/d4/d14/classshaka_1_1media_1_1WebVttMediaParser-members.html b/docs/d4/d14/classshaka_1_1media_1_1WebVttMediaParser-members.html index 29c9d5bb7e..72e747bc72 100644 --- a/docs/d4/d14/classshaka_1_1media_1_1WebVttMediaParser-members.html +++ b/docs/d4/d14/classshaka_1_1media_1_1WebVttMediaParser-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 9e06bf0f59..964b18951c 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 @@ -118,7 +118,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 4263946b8f..27d41f352e 100644 --- a/docs/d4/d20/classshaka_1_1media_1_1AesCbcEncryptor.html +++ b/docs/d4/d20/classshaka_1_1media_1_1AesCbcEncryptor.html @@ -235,7 +235,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 8219d84326..e7f7fe2e37 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 cec3c09dc4..9e6ee7f86a 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 @@ -114,7 +114,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 005c6a644e..7939c5225c 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 @@ -173,7 +173,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 d00db8a2be..17fad2c324 100644 --- a/docs/d4/d37/io__cache_8cc_source.html +++ b/docs/d4/d37/io__cache_8cc_source.html @@ -254,7 +254,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 b15072faa4..054c7a6552 100644 --- a/docs/d4/d3a/structshaka_1_1media_1_1H264Sps-members.html +++ b/docs/d4/d3a/structshaka_1_1media_1_1H264Sps-members.html @@ -142,7 +142,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 294e8870e8..7d784403f8 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d4/d4c/structshaka_1_1media_1_1H264WeightingFactors.html b/docs/d4/d4c/structshaka_1_1media_1_1H264WeightingFactors.html index 116c1cd63d..3e1a02887b 100644 --- a/docs/d4/d4c/structshaka_1_1media_1_1H264WeightingFactors.html +++ b/docs/d4/d4c/structshaka_1_1media_1_1H264WeightingFactors.html @@ -117,14 +117,14 @@ int chroma_offset [32]

        Detailed Description

        -

        Definition at line 126 of file h264_parser.h.

        +

        Definition at line 127 of file h264_parser.h.


        The documentation for this struct was generated from the following file: 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 27512e9cb6..d996f1f953 100644 --- a/docs/d4/d58/classshaka_1_1media_1_1Nalu-members.html +++ b/docs/d4/d58/classshaka_1_1media_1_1Nalu-members.html @@ -158,7 +158,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d4/d59/classshaka_1_1media_1_1WebMWebVTTParser.html b/docs/d4/d59/classshaka_1_1media_1_1WebMWebVTTParser.html index 2ff7e90169..7d49e47f2a 100644 --- a/docs/d4/d59/classshaka_1_1media_1_1WebMWebVTTParser.html +++ b/docs/d4/d59/classshaka_1_1media_1_1WebMWebVTTParser.html @@ -111,7 +111,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 2b05272f23..8758331e11 100644 --- a/docs/d4/d5c/classshaka_1_1media_1_1DecryptConfig-members.html +++ b/docs/d4/d5c/classshaka_1_1media_1_1DecryptConfig-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d4/d5d/classshaka_1_1media_1_1UdpFile-members.html b/docs/d4/d5d/classshaka_1_1media_1_1UdpFile-members.html index eba48bcc0e..138ec6dffd 100644 --- a/docs/d4/d5d/classshaka_1_1media_1_1UdpFile-members.html +++ b/docs/d4/d5d/classshaka_1_1media_1_1UdpFile-members.html @@ -117,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d4/d70/classshaka_1_1DashIopMpdNotifier.html b/docs/d4/d70/classshaka_1_1DashIopMpdNotifier.html index c49d83ec67..acf6ad3ba7 100644 --- a/docs/d4/d70/classshaka_1_1DashIopMpdNotifier.html +++ b/docs/d4/d70/classshaka_1_1DashIopMpdNotifier.html @@ -189,7 +189,7 @@ class DashIopMpdNotifierTe

        Implements shaka::MpdNotifier.

        -

        Definition at line 146 of file dash_iop_mpd_notifier.cc.

        +

        Definition at line 147 of file dash_iop_mpd_notifier.cc.

        @@ -217,7 +217,7 @@ class DashIopMpdNotifierTe

        Implements shaka::MpdNotifier.

        -

        Definition at line 156 of file dash_iop_mpd_notifier.cc.

        +

        Definition at line 157 of file dash_iop_mpd_notifier.cc.

        @@ -246,7 +246,7 @@ class DashIopMpdNotifierTe

        Implements shaka::MpdNotifier.

        -

        Definition at line 61 of file dash_iop_mpd_notifier.cc.

        +

        Definition at line 62 of file dash_iop_mpd_notifier.cc.

        @@ -307,7 +307,7 @@ class DashIopMpdNotifierTe

        Implements shaka::MpdNotifier.

        -

        Definition at line 127 of file dash_iop_mpd_notifier.cc.

        +

        Definition at line 128 of file dash_iop_mpd_notifier.cc.

        @@ -354,7 +354,7 @@ class DashIopMpdNotifierTe

        Implements shaka::MpdNotifier.

        -

        Definition at line 65 of file dash_iop_mpd_notifier.cc.

        +

        Definition at line 66 of file dash_iop_mpd_notifier.cc.

        @@ -415,7 +415,7 @@ class DashIopMpdNotifierTe

        Implements shaka::MpdNotifier.

        -

        Definition at line 113 of file dash_iop_mpd_notifier.cc.

        +

        Definition at line 114 of file dash_iop_mpd_notifier.cc.

        @@ -462,7 +462,7 @@ class DashIopMpdNotifierTe

        Implements shaka::MpdNotifier.

        -

        Definition at line 101 of file dash_iop_mpd_notifier.cc.

        +

        Definition at line 102 of file dash_iop_mpd_notifier.cc.

        @@ -473,7 +473,7 @@ class DashIopMpdNotifierTe diff --git a/docs/d4/d70/structshaka_1_1SegmentInfo-members.html b/docs/d4/d70/structshaka_1_1SegmentInfo-members.html index 7d77dd95fa..6cdca09f35 100644 --- a/docs/d4/d70/structshaka_1_1SegmentInfo-members.html +++ b/docs/d4/d70/structshaka_1_1SegmentInfo-members.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d4/d87/nalu__reader_8h_source.html b/docs/d4/d87/nalu__reader_8h_source.html index 824ae93f0a..fd01445ab9 100644 --- a/docs/d4/d87/nalu__reader_8h_source.html +++ b/docs/d4/d87/nalu__reader_8h_source.html @@ -299,7 +299,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d4/d8a/classshaka_1_1media_1_1HEVCDecoderConfigurationRecord.html b/docs/d4/d8a/classshaka_1_1media_1_1HEVCDecoderConfigurationRecord.html index 18fc2bb063..55a342aebe 100644 --- a/docs/d4/d8a/classshaka_1_1media_1_1HEVCDecoderConfigurationRecord.html +++ b/docs/d4/d8a/classshaka_1_1media_1_1HEVCDecoderConfigurationRecord.html @@ -171,7 +171,7 @@ void  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 caa3776e5a..3b78b04cc6 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 @@ -173,7 +173,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 fd9c58e915..610b440f13 100644 --- a/docs/d4/da7/segmenter__test__base_8cc_source.html +++ b/docs/d4/da7/segmenter__test__base_8cc_source.html @@ -310,7 +310,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 ffd5c9d249..0197e2cb5a 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 @@ -250,7 +250,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 c017cc03ba..8cfa948d39 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 @@ -114,7 +114,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d4/db2/cluster__builder_8h_source.html b/docs/d4/db2/cluster__builder_8h_source.html index 00693bce6d..8af8b97e36 100644 --- a/docs/d4/db2/cluster__builder_8h_source.html +++ b/docs/d4/db2/cluster__builder_8h_source.html @@ -181,7 +181,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d4/db4/classshaka_1_1MpdNotifierFactory.html b/docs/d4/db4/classshaka_1_1MpdNotifierFactory.html index d6f3f2f2f7..f14e628c71 100644 --- a/docs/d4/db4/classshaka_1_1MpdNotifierFactory.html +++ b/docs/d4/db4/classshaka_1_1MpdNotifierFactory.html @@ -113,7 +113,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 98fb7984c2..6483f323d4 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 @@ -194,7 +194,7 @@ Additional Inherited Members diff --git a/docs/d4/dc8/classshaka_1_1media_1_1mp2t_1_1AacProgramMapTableWriter.html b/docs/d4/dc8/classshaka_1_1media_1_1mp2t_1_1AacProgramMapTableWriter.html index 797eb81a39..c593239a74 100644 --- a/docs/d4/dc8/classshaka_1_1media_1_1mp2t_1_1AacProgramMapTableWriter.html +++ b/docs/d4/dc8/classshaka_1_1media_1_1mp2t_1_1AacProgramMapTableWriter.html @@ -140,7 +140,7 @@ static const uint8_t kElem diff --git a/docs/d4/dd3/bit__reader_8h_source.html b/docs/d4/dd3/bit__reader_8h_source.html index daef2ac9a1..67429a1956 100644 --- a/docs/d4/dd3/bit__reader_8h_source.html +++ b/docs/d4/dd3/bit__reader_8h_source.html @@ -187,7 +187,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 3a6984e4b4..0b12a20dde 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 @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d4/ddb/classshaka_1_1media_1_1MemoryFile-members.html b/docs/d4/ddb/classshaka_1_1media_1_1MemoryFile-members.html index 1f7fec5e03..5a64276b13 100644 --- a/docs/d4/ddb/classshaka_1_1media_1_1MemoryFile-members.html +++ b/docs/d4/ddb/classshaka_1_1media_1_1MemoryFile-members.html @@ -119,7 +119,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d4/dde/webvtt__util_8h_source.html b/docs/d4/dde/webvtt__util_8h_source.html index 74e52a3419..bb5f8d2300 100644 --- a/docs/d4/dde/webvtt__util_8h_source.html +++ b/docs/d4/dde/webvtt__util_8h_source.html @@ -124,7 +124,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 1278999003..a62985a84f 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 @@ -182,7 +182,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 50bd543623..1b98d3d3ed 100644 --- a/docs/d4/de6/classshaka_1_1media_1_1ProgressListener.html +++ b/docs/d4/de6/classshaka_1_1media_1_1ProgressListener.html @@ -146,7 +146,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 dd2d71cb81..b74d6065ec 100644 --- a/docs/d4/de7/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener-members.html +++ b/docs/d4/de7/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener-members.html @@ -112,7 +112,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d4/dec/hls__flags_8h_source.html b/docs/d4/dec/hls__flags_8h_source.html index c319e1e239..a06b49d3c1 100644 --- a/docs/d4/dec/hls__flags_8h_source.html +++ b/docs/d4/dec/hls__flags_8h_source.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d4/df5/request__signer_8cc_source.html b/docs/d4/df5/request__signer_8cc_source.html index c26b918e67..770e494848 100644 --- a/docs/d4/df5/request__signer_8cc_source.html +++ b/docs/d4/df5/request__signer_8cc_source.html @@ -175,11 +175,11 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
        bool GenerateSignature(const std::string &message, std::string *signature) override
        RequestSigner implementation override.
        bool GenerateSignature(const std::string &message, std::string *signature) override
        RequestSigner implementation override.
        AesRequestSigner uses AES-CBC signing.
        -
        static RsaPrivateKey * Create(const std::string &serialized_key)
        Definition: rsa_key.cc:97
        +
        static RsaPrivateKey * Create(const std::string &serialized_key)
        Definition: rsa_key.cc:96
        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 1e0d46aeae..1b142793d7 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 @@ -194,7 +194,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 3b84604d54..dceec74309 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 @@ -173,7 +173,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 4747decc1b..c2c5843805 100644 --- a/docs/d4/dfd/structshaka_1_1media_1_1H265Sps.html +++ b/docs/d4/dfd/structshaka_1_1media_1_1H265Sps.html @@ -256,7 +256,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 8ebbd4a801..316bbe6204 100644 --- a/docs/d4/dff/webm__media__parser_8cc_source.html +++ b/docs/d4/dff/webm__media__parser_8cc_source.html @@ -364,7 +364,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 cff59646dc..c7cb707ad0 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 @@ -182,7 +182,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 cca4b51658..a02ab965f1 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 @@ -173,7 +173,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 0889819688..cf0556cfe1 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 @@ -173,7 +173,7 @@ Additional Inherited Members 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 5f7dd67eb9..23b96272e7 100644 --- a/docs/d5/d11/classshaka_1_1media_1_1WebMInfoParser-members.html +++ b/docs/d5/d11/classshaka_1_1media_1_1WebMInfoParser-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 a3389a3495..bea93ec2d0 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 @@ -185,7 +185,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 da3a6cad53..4b4d69d0f8 100644 --- a/docs/d5/d13/classshaka_1_1media_1_1ESDescriptor.html +++ b/docs/d5/d13/classshaka_1_1media_1_1ESDescriptor.html @@ -181,7 +181,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 ddf63703db..764e879a21 100644 --- a/docs/d5/d15/producer__consumer__queue_8h_source.html +++ b/docs/d5/d15/producer__consumer__queue_8h_source.html @@ -374,7 +374,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d5/d1a/ts__section_8h_source.html b/docs/d5/d1a/ts__section_8h_source.html index 8c78f21f56..7659382494 100644 --- a/docs/d5/d1a/ts__section_8h_source.html +++ b/docs/d5/d1a/ts__section_8h_source.html @@ -134,7 +134,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 00119abe47..8fedcb041f 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 @@ -122,7 +122,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d5/d27/key__fetcher_8cc_source.html b/docs/d5/d27/key__fetcher_8cc_source.html index e6befae7ed..4a9e8cf279 100644 --- a/docs/d5/d27/key__fetcher_8cc_source.html +++ b/docs/d5/d27/key__fetcher_8cc_source.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html b/docs/d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html index 3080ebacb2..c19e70c070 100644 --- a/docs/d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html +++ b/docs/d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html @@ -501,7 +501,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 cde7feb241..702fc642ce 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 @@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d5/d40/webm_2single__segment__segmenter_8h_source.html b/docs/d5/d40/webm_2single__segment__segmenter_8h_source.html index 6b8feb1e90..470ed458c7 100644 --- a/docs/d5/d40/webm_2single__segment__segmenter_8h_source.html +++ b/docs/d5/d40/webm_2single__segment__segmenter_8h_source.html @@ -158,7 +158,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d5/d4b/classshaka_1_1media_1_1mp2t_1_1TsSectionPsi-members.html b/docs/d5/d4b/classshaka_1_1media_1_1mp2t_1_1TsSectionPsi-members.html index d6634b4e44..3c31d94e86 100644 --- a/docs/d5/d4b/classshaka_1_1media_1_1mp2t_1_1TsSectionPsi-members.html +++ b/docs/d5/d4b/classshaka_1_1media_1_1mp2t_1_1TsSectionPsi-members.html @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d5/d4d/box_8cc_source.html b/docs/d5/d4d/box_8cc_source.html index 48662c8027..2bf7fa052f 100644 --- a/docs/d5/d4d/box_8cc_source.html +++ b/docs/d5/d4d/box_8cc_source.html @@ -195,7 +195,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d5/d52/ts__section__pes_8h_source.html b/docs/d5/d52/ts__section__pes_8h_source.html index 53445b9604..1a56825822 100644 --- a/docs/d5/d52/ts__section__pes_8h_source.html +++ b/docs/d5/d52/ts__section__pes_8h_source.html @@ -160,7 +160,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 aba251f999..f6b782f8e6 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 @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d5/d57/classshaka_1_1RepresentationStateChangeListener-members.html b/docs/d5/d57/classshaka_1_1RepresentationStateChangeListener-members.html index c2fc817ecb..1997c3a89e 100644 --- a/docs/d5/d57/classshaka_1_1RepresentationStateChangeListener-members.html +++ b/docs/d5/d57/classshaka_1_1RepresentationStateChangeListener-members.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d5/d59/classshaka_1_1MockRepresentation-members.html b/docs/d5/d59/classshaka_1_1MockRepresentation-members.html index 3eebe83207..1b42f2cfca 100644 --- a/docs/d5/d59/classshaka_1_1MockRepresentation-members.html +++ b/docs/d5/d59/classshaka_1_1MockRepresentation-members.html @@ -116,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d5/d5c/continuity__counter_8cc_source.html b/docs/d5/d5c/continuity__counter_8cc_source.html index c4b463eea6..d3c64ac355 100644 --- a/docs/d5/d5c/continuity__counter_8cc_source.html +++ b/docs/d5/d5c/continuity__counter_8cc_source.html @@ -116,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 a5da2cfa5b..364de9f960 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 @@ -161,7 +161,7 @@ const
        diff --git a/docs/d5/d63/network__util_8cc_source.html b/docs/d5/d63/network__util_8cc_source.html index f6022973d5..a7b912dbbf 100644 --- a/docs/d5/d63/network__util_8cc_source.html +++ b/docs/d5/d63/network__util_8cc_source.html @@ -122,7 +122,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d5/d66/classshaka_1_1media_1_1NalUnitToByteStreamConverter.html b/docs/d5/d66/classshaka_1_1media_1_1NalUnitToByteStreamConverter.html index e217af5a7d..697a14ba94 100644 --- a/docs/d5/d66/classshaka_1_1media_1_1NalUnitToByteStreamConverter.html +++ b/docs/d5/d66/classshaka_1_1media_1_1NalUnitToByteStreamConverter.html @@ -229,7 +229,7 @@ class NalUnitToByteStreamC diff --git a/docs/d5/d6f/vlog__flags_8cc_source.html b/docs/d5/d6f/vlog__flags_8cc_source.html index 8643eaa431..03a7ddae40 100644 --- a/docs/d5/d6f/vlog__flags_8cc_source.html +++ b/docs/d5/d6f/vlog__flags_8cc_source.html @@ -116,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 0f34416997..71669a15da 100644 --- a/docs/d5/d72/avc__decoder__configuration__record_8cc_source.html +++ b/docs/d5/d72/avc__decoder__configuration__record_8cc_source.html @@ -202,7 +202,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d5/d7b/box__definitions_8h_source.html b/docs/d5/d7b/box__definitions_8h_source.html index a87f03f0e3..72391ce884 100644 --- a/docs/d5/d7b/box__definitions_8h_source.html +++ b/docs/d5/d7b/box__definitions_8h_source.html @@ -1000,7 +1000,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 bda42c1574..bdb2c2d2c3 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 @@ -185,7 +185,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 759e63e116..1f3bff9f1e 100644 --- a/docs/d5/d89/widevine__key__source_8cc_source.html +++ b/docs/d5/d89/widevine__key__source_8cc_source.html @@ -102,630 +102,624 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
        13 #include "packager/base/json/json_reader.h"
        14 #include "packager/base/json/json_writer.h"
        15 #include "packager/base/memory/ref_counted.h"
        -
        16 #include "packager/base/stl_util.h"
        -
        17 #include "packager/media/base/fixed_key_source.h"
        -
        18 #include "packager/media/base/http_key_fetcher.h"
        -
        19 #include "packager/media/base/producer_consumer_queue.h"
        -
        20 #include "packager/media/base/protection_system_specific_info.h"
        -
        21 #include "packager/media/base/rcheck.h"
        -
        22 #include "packager/media/base/request_signer.h"
        -
        23 #include "packager/media/base/widevine_pssh_data.pb.h"
        -
        24 
        -
        25 namespace shaka {
        -
        26 namespace {
        -
        27 
        -
        28 const bool kEnableKeyRotation = true;
        -
        29 
        -
        30 const char kLicenseStatusOK[] = "OK";
        -
        31 // Server may return INTERNAL_ERROR intermittently, which is a transient error
        -
        32 // and the next client request may succeed without problem.
        -
        33 const char kLicenseStatusTransientError[] = "INTERNAL_ERROR";
        -
        34 
        -
        35 // Number of times to retry requesting keys in case of a transient error from
        -
        36 // the server.
        -
        37 const int kNumTransientErrorRetries = 5;
        -
        38 const int kFirstRetryDelayMilliseconds = 1000;
        -
        39 
        -
        40 // Default crypto period count, which is the number of keys to fetch on every
        -
        41 // key rotation enabled request.
        -
        42 const int kDefaultCryptoPeriodCount = 10;
        -
        43 const int kGetKeyTimeoutInSeconds = 5 * 60; // 5 minutes.
        -
        44 const int kKeyFetchTimeoutInSeconds = 60; // 1 minute.
        -
        45 
        -
        46 bool Base64StringToBytes(const std::string& base64_string,
        -
        47  std::vector<uint8_t>* bytes) {
        -
        48  DCHECK(bytes);
        -
        49  std::string str;
        -
        50  if (!base::Base64Decode(base64_string, &str))
        -
        51  return false;
        -
        52  bytes->assign(str.begin(), str.end());
        -
        53  return true;
        -
        54 }
        -
        55 
        -
        56 void BytesToBase64String(const std::vector<uint8_t>& bytes,
        -
        57  std::string* base64_string) {
        -
        58  DCHECK(base64_string);
        -
        59  base::Base64Encode(base::StringPiece(reinterpret_cast<const char*>
        -
        60  (bytes.data()), bytes.size()),
        -
        61  base64_string);
        -
        62 }
        -
        63 
        -
        64 bool GetKeyFromTrack(const base::DictionaryValue& track_dict,
        -
        65  std::vector<uint8_t>* key) {
        -
        66  DCHECK(key);
        -
        67  std::string key_base64_string;
        -
        68  RCHECK(track_dict.GetString("key", &key_base64_string));
        -
        69  VLOG(2) << "Key:" << key_base64_string;
        -
        70  RCHECK(Base64StringToBytes(key_base64_string, key));
        -
        71  return true;
        -
        72 }
        -
        73 
        -
        74 bool GetKeyIdFromTrack(const base::DictionaryValue& track_dict,
        -
        75  std::vector<uint8_t>* key_id) {
        -
        76  DCHECK(key_id);
        -
        77  std::string key_id_base64_string;
        -
        78  RCHECK(track_dict.GetString("key_id", &key_id_base64_string));
        -
        79  VLOG(2) << "Keyid:" << key_id_base64_string;
        -
        80  RCHECK(Base64StringToBytes(key_id_base64_string, key_id));
        -
        81  return true;
        -
        82 }
        -
        83 
        -
        84 bool GetPsshDataFromTrack(const base::DictionaryValue& track_dict,
        -
        85  std::vector<uint8_t>* pssh_data) {
        -
        86  DCHECK(pssh_data);
        -
        87 
        -
        88  const base::ListValue* pssh_list;
        -
        89  RCHECK(track_dict.GetList("pssh", &pssh_list));
        -
        90  // Invariant check. We don't want to crash in release mode if possible.
        -
        91  // The following code handles it gracefully if GetSize() does not return 1.
        -
        92  DCHECK_EQ(1u, pssh_list->GetSize());
        -
        93 
        -
        94  const base::DictionaryValue* pssh_dict;
        -
        95  RCHECK(pssh_list->GetDictionary(0, &pssh_dict));
        -
        96  std::string drm_type;
        -
        97  RCHECK(pssh_dict->GetString("drm_type", &drm_type));
        -
        98  if (drm_type != "WIDEVINE") {
        -
        99  LOG(ERROR) << "Expecting drm_type 'WIDEVINE', get '" << drm_type << "'.";
        -
        100  return false;
        -
        101  }
        -
        102  std::string pssh_data_base64_string;
        -
        103  RCHECK(pssh_dict->GetString("data", &pssh_data_base64_string));
        -
        104 
        -
        105  VLOG(2) << "Pssh Data:" << pssh_data_base64_string;
        -
        106  RCHECK(Base64StringToBytes(pssh_data_base64_string, pssh_data));
        -
        107  return true;
        -
        108 }
        -
        109 
        -
        110 } // namespace
        -
        111 
        -
        112 namespace media {
        -
        113 
        -
        114 // A ref counted wrapper for EncryptionKeyMap.
        -
        115 class WidevineKeySource::RefCountedEncryptionKeyMap
        -
        116  : public base::RefCountedThreadSafe<RefCountedEncryptionKeyMap> {
        -
        117  public:
        -
        118  explicit RefCountedEncryptionKeyMap(EncryptionKeyMap* encryption_key_map) {
        -
        119  DCHECK(encryption_key_map);
        -
        120  encryption_key_map_.swap(*encryption_key_map);
        -
        121  }
        -
        122 
        -
        123  std::map<KeySource::TrackType, EncryptionKey*>& map() {
        -
        124  return encryption_key_map_;
        -
        125  }
        +
        16 #include "packager/media/base/fixed_key_source.h"
        +
        17 #include "packager/media/base/http_key_fetcher.h"
        +
        18 #include "packager/media/base/producer_consumer_queue.h"
        +
        19 #include "packager/media/base/protection_system_specific_info.h"
        +
        20 #include "packager/media/base/rcheck.h"
        +
        21 #include "packager/media/base/request_signer.h"
        +
        22 #include "packager/media/base/widevine_pssh_data.pb.h"
        +
        23 
        +
        24 namespace shaka {
        +
        25 namespace {
        +
        26 
        +
        27 const bool kEnableKeyRotation = true;
        +
        28 
        +
        29 const char kLicenseStatusOK[] = "OK";
        +
        30 // Server may return INTERNAL_ERROR intermittently, which is a transient error
        +
        31 // and the next client request may succeed without problem.
        +
        32 const char kLicenseStatusTransientError[] = "INTERNAL_ERROR";
        +
        33 
        +
        34 // Number of times to retry requesting keys in case of a transient error from
        +
        35 // the server.
        +
        36 const int kNumTransientErrorRetries = 5;
        +
        37 const int kFirstRetryDelayMilliseconds = 1000;
        +
        38 
        +
        39 // Default crypto period count, which is the number of keys to fetch on every
        +
        40 // key rotation enabled request.
        +
        41 const int kDefaultCryptoPeriodCount = 10;
        +
        42 const int kGetKeyTimeoutInSeconds = 5 * 60; // 5 minutes.
        +
        43 const int kKeyFetchTimeoutInSeconds = 60; // 1 minute.
        +
        44 
        +
        45 bool Base64StringToBytes(const std::string& base64_string,
        +
        46  std::vector<uint8_t>* bytes) {
        +
        47  DCHECK(bytes);
        +
        48  std::string str;
        +
        49  if (!base::Base64Decode(base64_string, &str))
        +
        50  return false;
        +
        51  bytes->assign(str.begin(), str.end());
        +
        52  return true;
        +
        53 }
        +
        54 
        +
        55 void BytesToBase64String(const std::vector<uint8_t>& bytes,
        +
        56  std::string* base64_string) {
        +
        57  DCHECK(base64_string);
        +
        58  base::Base64Encode(base::StringPiece(reinterpret_cast<const char*>
        +
        59  (bytes.data()), bytes.size()),
        +
        60  base64_string);
        +
        61 }
        +
        62 
        +
        63 bool GetKeyFromTrack(const base::DictionaryValue& track_dict,
        +
        64  std::vector<uint8_t>* key) {
        +
        65  DCHECK(key);
        +
        66  std::string key_base64_string;
        +
        67  RCHECK(track_dict.GetString("key", &key_base64_string));
        +
        68  VLOG(2) << "Key:" << key_base64_string;
        +
        69  RCHECK(Base64StringToBytes(key_base64_string, key));
        +
        70  return true;
        +
        71 }
        +
        72 
        +
        73 bool GetKeyIdFromTrack(const base::DictionaryValue& track_dict,
        +
        74  std::vector<uint8_t>* key_id) {
        +
        75  DCHECK(key_id);
        +
        76  std::string key_id_base64_string;
        +
        77  RCHECK(track_dict.GetString("key_id", &key_id_base64_string));
        +
        78  VLOG(2) << "Keyid:" << key_id_base64_string;
        +
        79  RCHECK(Base64StringToBytes(key_id_base64_string, key_id));
        +
        80  return true;
        +
        81 }
        +
        82 
        +
        83 bool GetPsshDataFromTrack(const base::DictionaryValue& track_dict,
        +
        84  std::vector<uint8_t>* pssh_data) {
        +
        85  DCHECK(pssh_data);
        +
        86 
        +
        87  const base::ListValue* pssh_list;
        +
        88  RCHECK(track_dict.GetList("pssh", &pssh_list));
        +
        89  // Invariant check. We don't want to crash in release mode if possible.
        +
        90  // The following code handles it gracefully if GetSize() does not return 1.
        +
        91  DCHECK_EQ(1u, pssh_list->GetSize());
        +
        92 
        +
        93  const base::DictionaryValue* pssh_dict;
        +
        94  RCHECK(pssh_list->GetDictionary(0, &pssh_dict));
        +
        95  std::string drm_type;
        +
        96  RCHECK(pssh_dict->GetString("drm_type", &drm_type));
        +
        97  if (drm_type != "WIDEVINE") {
        +
        98  LOG(ERROR) << "Expecting drm_type 'WIDEVINE', get '" << drm_type << "'.";
        +
        99  return false;
        +
        100  }
        +
        101  std::string pssh_data_base64_string;
        +
        102  RCHECK(pssh_dict->GetString("data", &pssh_data_base64_string));
        +
        103 
        +
        104  VLOG(2) << "Pssh Data:" << pssh_data_base64_string;
        +
        105  RCHECK(Base64StringToBytes(pssh_data_base64_string, pssh_data));
        +
        106  return true;
        +
        107 }
        +
        108 
        +
        109 } // namespace
        +
        110 
        +
        111 namespace media {
        +
        112 
        +
        113 // A ref counted wrapper for EncryptionKeyMap.
        +
        114 class WidevineKeySource::RefCountedEncryptionKeyMap
        +
        115  : public base::RefCountedThreadSafe<RefCountedEncryptionKeyMap> {
        +
        116  public:
        +
        117  explicit RefCountedEncryptionKeyMap(EncryptionKeyMap* encryption_key_map) {
        +
        118  DCHECK(encryption_key_map);
        +
        119  encryption_key_map_.swap(*encryption_key_map);
        +
        120  }
        +
        121 
        +
        122  const EncryptionKeyMap& map() { return encryption_key_map_; }
        +
        123 
        +
        124  private:
        +
        125  friend class base::RefCountedThreadSafe<RefCountedEncryptionKeyMap>;
        126 
        -
        127  private:
        -
        128  friend class base::RefCountedThreadSafe<RefCountedEncryptionKeyMap>;
        -
        129 
        -
        130  ~RefCountedEncryptionKeyMap() { STLDeleteValues(&encryption_key_map_); }
        -
        131 
        -
        132  EncryptionKeyMap encryption_key_map_;
        +
        127  ~RefCountedEncryptionKeyMap() {}
        +
        128 
        +
        129  EncryptionKeyMap encryption_key_map_;
        +
        130 
        +
        131  DISALLOW_COPY_AND_ASSIGN(RefCountedEncryptionKeyMap);
        +
        132 };
        133 
        -
        134  DISALLOW_COPY_AND_ASSIGN(RefCountedEncryptionKeyMap);
        -
        135 };
        -
        136 
        -
        137 WidevineKeySource::WidevineKeySource(const std::string& server_url,
        -
        138  bool add_common_pssh)
        -
        139  : key_production_thread_("KeyProductionThread",
        -
        140  base::Bind(&WidevineKeySource::FetchKeysTask,
        -
        141  base::Unretained(this))),
        -
        142  key_fetcher_(new HttpKeyFetcher(kKeyFetchTimeoutInSeconds)),
        -
        143  server_url_(server_url),
        -
        144  crypto_period_count_(kDefaultCryptoPeriodCount),
        -
        145  add_common_pssh_(add_common_pssh),
        -
        146  key_production_started_(false),
        -
        147  start_key_production_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
        -
        148  base::WaitableEvent::InitialState::NOT_SIGNALED),
        -
        149  first_crypto_period_index_(0) {
        -
        150  key_production_thread_.Start();
        -
        151 }
        -
        152 
        -
        153 WidevineKeySource::~WidevineKeySource() {
        -
        154  if (key_pool_)
        -
        155  key_pool_->Stop();
        -
        156  if (key_production_thread_.HasBeenStarted()) {
        -
        157  // Signal the production thread to start key production if it is not
        -
        158  // signaled yet so the thread can be joined.
        -
        159  start_key_production_.Signal();
        -
        160  key_production_thread_.Join();
        -
        161  }
        -
        162  STLDeleteValues(&encryption_key_map_);
        -
        163 }
        -
        164 
        -
        165 Status WidevineKeySource::FetchKeys(const std::vector<uint8_t>& content_id,
        -
        166  const std::string& policy) {
        -
        167  base::AutoLock scoped_lock(lock_);
        -
        168  request_dict_.Clear();
        -
        169  std::string content_id_base64_string;
        -
        170  BytesToBase64String(content_id, &content_id_base64_string);
        -
        171  request_dict_.SetString("content_id", content_id_base64_string);
        -
        172  request_dict_.SetString("policy", policy);
        -
        173  return FetchKeysInternal(!kEnableKeyRotation, 0, false);
        -
        174 }
        +
        134 WidevineKeySource::WidevineKeySource(const std::string& server_url,
        +
        135  bool add_common_pssh)
        +
        136  : key_production_thread_("KeyProductionThread",
        +
        137  base::Bind(&WidevineKeySource::FetchKeysTask,
        +
        138  base::Unretained(this))),
        +
        139  key_fetcher_(new HttpKeyFetcher(kKeyFetchTimeoutInSeconds)),
        +
        140  server_url_(server_url),
        +
        141  crypto_period_count_(kDefaultCryptoPeriodCount),
        +
        142  add_common_pssh_(add_common_pssh),
        +
        143  key_production_started_(false),
        +
        144  start_key_production_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
        +
        145  base::WaitableEvent::InitialState::NOT_SIGNALED),
        +
        146  first_crypto_period_index_(0) {
        +
        147  key_production_thread_.Start();
        +
        148 }
        +
        149 
        +
        150 WidevineKeySource::~WidevineKeySource() {
        +
        151  if (key_pool_)
        +
        152  key_pool_->Stop();
        +
        153  if (key_production_thread_.HasBeenStarted()) {
        +
        154  // Signal the production thread to start key production if it is not
        +
        155  // signaled yet so the thread can be joined.
        +
        156  start_key_production_.Signal();
        +
        157  key_production_thread_.Join();
        +
        158  }
        +
        159 }
        +
        160 
        +
        161 Status WidevineKeySource::FetchKeys(const std::vector<uint8_t>& content_id,
        +
        162  const std::string& policy) {
        +
        163  base::AutoLock scoped_lock(lock_);
        +
        164  request_dict_.Clear();
        +
        165  std::string content_id_base64_string;
        +
        166  BytesToBase64String(content_id, &content_id_base64_string);
        +
        167  request_dict_.SetString("content_id", content_id_base64_string);
        +
        168  request_dict_.SetString("policy", policy);
        +
        169  return FetchKeysInternal(!kEnableKeyRotation, 0, false);
        +
        170 }
        +
        171 
        +
        172 Status WidevineKeySource::FetchKeys(const std::vector<uint8_t>& pssh_box) {
        +
        173  const std::vector<uint8_t> widevine_system_id(
        +
        174  kWidevineSystemId, kWidevineSystemId + arraysize(kWidevineSystemId));
        175 
        -
        176 Status WidevineKeySource::FetchKeys(const std::vector<uint8_t>& pssh_box) {
        -
        177  const std::vector<uint8_t> widevine_system_id(
        -
        178  kWidevineSystemId, kWidevineSystemId + arraysize(kWidevineSystemId));
        + +
        177  if (!info.Parse(pssh_box.data(), pssh_box.size()))
        +
        178  return Status(error::PARSER_FAILURE, "Error parsing the PSSH box.");
        179 
        - -
        181  if (!info.Parse(pssh_box.data(), pssh_box.size()))
        -
        182  return Status(error::PARSER_FAILURE, "Error parsing the PSSH box.");
        -
        183 
        -
        184  if (info.system_id() == widevine_system_id) {
        -
        185  base::AutoLock scoped_lock(lock_);
        -
        186  request_dict_.Clear();
        -
        187  std::string pssh_data_base64_string;
        -
        188 
        -
        189  BytesToBase64String(info.pssh_data(), &pssh_data_base64_string);
        -
        190  request_dict_.SetString("pssh_data", pssh_data_base64_string);
        -
        191  return FetchKeysInternal(!kEnableKeyRotation, 0, false);
        -
        192  } else if (!info.key_ids().empty()) {
        -
        193  // This is not a Widevine PSSH box. Try making the request for the key-IDs.
        -
        194  // Even if this is a different key-system, it should still work. Either
        -
        195  // the server will not recognize it and return an error, or it will
        -
        196  // recognize it and the key must be correct (or the content is bad).
        -
        197  return FetchKeys(info.key_ids());
        -
        198  } else {
        -
        199  return Status(error::NOT_FOUND, "No key IDs given in PSSH box.");
        -
        200  }
        -
        201 }
        -
        202 
        - -
        204  const std::vector<std::vector<uint8_t>>& key_ids) {
        -
        205  base::AutoLock scoped_lock(lock_);
        -
        206  request_dict_.Clear();
        -
        207  std::string pssh_data_base64_string;
        -
        208 
        -
        209  // Generate Widevine PSSH data from the key-IDs.
        -
        210  WidevinePsshData widevine_pssh_data;
        -
        211  for (size_t i = 0; i < key_ids.size(); i++) {
        -
        212  widevine_pssh_data.add_key_id(key_ids[i].data(), key_ids[i].size());
        -
        213  }
        +
        180  if (info.system_id() == widevine_system_id) {
        +
        181  base::AutoLock scoped_lock(lock_);
        +
        182  request_dict_.Clear();
        +
        183  std::string pssh_data_base64_string;
        +
        184 
        +
        185  BytesToBase64String(info.pssh_data(), &pssh_data_base64_string);
        +
        186  request_dict_.SetString("pssh_data", pssh_data_base64_string);
        +
        187  return FetchKeysInternal(!kEnableKeyRotation, 0, false);
        +
        188  } else if (!info.key_ids().empty()) {
        +
        189  // This is not a Widevine PSSH box. Try making the request for the key-IDs.
        +
        190  // Even if this is a different key-system, it should still work. Either
        +
        191  // the server will not recognize it and return an error, or it will
        +
        192  // recognize it and the key must be correct (or the content is bad).
        +
        193  return FetchKeys(info.key_ids());
        +
        194  } else {
        +
        195  return Status(error::NOT_FOUND, "No key IDs given in PSSH box.");
        +
        196  }
        +
        197 }
        +
        198 
        + +
        200  const std::vector<std::vector<uint8_t>>& key_ids) {
        +
        201  base::AutoLock scoped_lock(lock_);
        +
        202  request_dict_.Clear();
        +
        203  std::string pssh_data_base64_string;
        +
        204 
        +
        205  // Generate Widevine PSSH data from the key-IDs.
        +
        206  WidevinePsshData widevine_pssh_data;
        +
        207  for (size_t i = 0; i < key_ids.size(); i++) {
        +
        208  widevine_pssh_data.add_key_id(key_ids[i].data(), key_ids[i].size());
        +
        209  }
        +
        210 
        +
        211  const std::string serialized_string = widevine_pssh_data.SerializeAsString();
        +
        212  std::vector<uint8_t> pssh_data(serialized_string.begin(),
        +
        213  serialized_string.end());
        214 
        -
        215  const std::string serialized_string = widevine_pssh_data.SerializeAsString();
        -
        216  std::vector<uint8_t> pssh_data(serialized_string.begin(),
        -
        217  serialized_string.end());
        -
        218 
        -
        219  BytesToBase64String(pssh_data, &pssh_data_base64_string);
        -
        220  request_dict_.SetString("pssh_data", pssh_data_base64_string);
        -
        221  return FetchKeysInternal(!kEnableKeyRotation, 0, false);
        -
        222 }
        -
        223 
        - -
        225  base::AutoLock scoped_lock(lock_);
        -
        226  request_dict_.Clear();
        -
        227  // Javascript/JSON does not support int64_t or unsigned numbers. Use double
        -
        228  // instead as 32-bit integer can be lossless represented using double.
        -
        229  request_dict_.SetDouble("asset_id", asset_id);
        -
        230  return FetchKeysInternal(!kEnableKeyRotation, 0, true);
        -
        231 }
        -
        232 
        -
        233 Status WidevineKeySource::GetKey(TrackType track_type, EncryptionKey* key) {
        -
        234  DCHECK(key);
        -
        235  if (encryption_key_map_.find(track_type) == encryption_key_map_.end()) {
        -
        236  return Status(error::INTERNAL_ERROR,
        -
        237  "Cannot find key of type " + TrackTypeToString(track_type));
        -
        238  }
        -
        239  *key = *encryption_key_map_[track_type];
        -
        240  return Status::OK;
        -
        241 }
        -
        242 
        -
        243 Status WidevineKeySource::GetKey(const std::vector<uint8_t>& key_id,
        -
        244  EncryptionKey* key) {
        -
        245  DCHECK(key);
        -
        246  for (std::map<TrackType, EncryptionKey*>::iterator iter =
        -
        247  encryption_key_map_.begin();
        -
        248  iter != encryption_key_map_.end();
        -
        249  ++iter) {
        -
        250  if (iter->second->key_id == key_id) {
        -
        251  *key = *iter->second;
        -
        252  return Status::OK;
        -
        253  }
        -
        254  }
        -
        255  return Status(error::INTERNAL_ERROR,
        -
        256  "Cannot find key with specified key ID");
        -
        257 }
        -
        258 
        -
        259 Status WidevineKeySource::GetCryptoPeriodKey(uint32_t crypto_period_index,
        -
        260  TrackType track_type,
        -
        261  EncryptionKey* key) {
        -
        262  DCHECK(key_production_thread_.HasBeenStarted());
        -
        263  // TODO(kqyang): This is not elegant. Consider refactoring later.
        -
        264  {
        -
        265  base::AutoLock scoped_lock(lock_);
        -
        266  if (!key_production_started_) {
        -
        267  // Another client may have a slightly smaller starting crypto period
        -
        268  // index. Set the initial value to account for that.
        -
        269  first_crypto_period_index_ =
        -
        270  crypto_period_index ? crypto_period_index - 1 : 0;
        -
        271  DCHECK(!key_pool_);
        -
        272  key_pool_.reset(new EncryptionKeyQueue(crypto_period_count_,
        -
        273  first_crypto_period_index_));
        -
        274  start_key_production_.Signal();
        -
        275  key_production_started_ = true;
        -
        276  }
        -
        277  }
        -
        278  return GetKeyInternal(crypto_period_index, track_type, key);
        -
        279 }
        -
        280 
        -
        281 void WidevineKeySource::set_signer(std::unique_ptr<RequestSigner> signer) {
        -
        282  signer_ = std::move(signer);
        -
        283 }
        -
        284 
        - -
        286  std::unique_ptr<KeyFetcher> key_fetcher) {
        -
        287  key_fetcher_ = std::move(key_fetcher);
        -
        288 }
        -
        289 
        -
        290 Status WidevineKeySource::GetKeyInternal(uint32_t crypto_period_index,
        -
        291  TrackType track_type,
        -
        292  EncryptionKey* key) {
        -
        293  DCHECK(key_pool_);
        -
        294  DCHECK(key);
        -
        295  DCHECK_LE(track_type, NUM_VALID_TRACK_TYPES);
        -
        296  DCHECK_NE(track_type, TRACK_TYPE_UNKNOWN);
        -
        297 
        -
        298  scoped_refptr<RefCountedEncryptionKeyMap> ref_counted_encryption_key_map;
        -
        299  Status status =
        -
        300  key_pool_->Peek(crypto_period_index, &ref_counted_encryption_key_map,
        -
        301  kGetKeyTimeoutInSeconds * 1000);
        -
        302  if (!status.ok()) {
        -
        303  if (status.error_code() == error::STOPPED) {
        -
        304  CHECK(!common_encryption_request_status_.ok());
        -
        305  return common_encryption_request_status_;
        -
        306  }
        -
        307  return status;
        +
        215  BytesToBase64String(pssh_data, &pssh_data_base64_string);
        +
        216  request_dict_.SetString("pssh_data", pssh_data_base64_string);
        +
        217  return FetchKeysInternal(!kEnableKeyRotation, 0, false);
        +
        218 }
        +
        219 
        + +
        221  base::AutoLock scoped_lock(lock_);
        +
        222  request_dict_.Clear();
        +
        223  // Javascript/JSON does not support int64_t or unsigned numbers. Use double
        +
        224  // instead as 32-bit integer can be lossless represented using double.
        +
        225  request_dict_.SetDouble("asset_id", asset_id);
        +
        226  return FetchKeysInternal(!kEnableKeyRotation, 0, true);
        +
        227 }
        +
        228 
        +
        229 Status WidevineKeySource::GetKey(TrackType track_type, EncryptionKey* key) {
        +
        230  DCHECK(key);
        +
        231  if (encryption_key_map_.find(track_type) == encryption_key_map_.end()) {
        +
        232  return Status(error::INTERNAL_ERROR,
        +
        233  "Cannot find key of type " + TrackTypeToString(track_type));
        +
        234  }
        +
        235  *key = *encryption_key_map_[track_type];
        +
        236  return Status::OK;
        +
        237 }
        +
        238 
        +
        239 Status WidevineKeySource::GetKey(const std::vector<uint8_t>& key_id,
        +
        240  EncryptionKey* key) {
        +
        241  DCHECK(key);
        +
        242  for (const auto& pair : encryption_key_map_) {
        +
        243  if (pair.second->key_id == key_id) {
        +
        244  *key = *pair.second;
        +
        245  return Status::OK;
        +
        246  }
        +
        247  }
        +
        248  return Status(error::INTERNAL_ERROR,
        +
        249  "Cannot find key with specified key ID");
        +
        250 }
        +
        251 
        +
        252 Status WidevineKeySource::GetCryptoPeriodKey(uint32_t crypto_period_index,
        +
        253  TrackType track_type,
        +
        254  EncryptionKey* key) {
        +
        255  DCHECK(key_production_thread_.HasBeenStarted());
        +
        256  // TODO(kqyang): This is not elegant. Consider refactoring later.
        +
        257  {
        +
        258  base::AutoLock scoped_lock(lock_);
        +
        259  if (!key_production_started_) {
        +
        260  // Another client may have a slightly smaller starting crypto period
        +
        261  // index. Set the initial value to account for that.
        +
        262  first_crypto_period_index_ =
        +
        263  crypto_period_index ? crypto_period_index - 1 : 0;
        +
        264  DCHECK(!key_pool_);
        +
        265  key_pool_.reset(new EncryptionKeyQueue(crypto_period_count_,
        +
        266  first_crypto_period_index_));
        +
        267  start_key_production_.Signal();
        +
        268  key_production_started_ = true;
        +
        269  }
        +
        270  }
        +
        271  return GetKeyInternal(crypto_period_index, track_type, key);
        +
        272 }
        +
        273 
        +
        274 void WidevineKeySource::set_signer(std::unique_ptr<RequestSigner> signer) {
        +
        275  signer_ = std::move(signer);
        +
        276 }
        +
        277 
        + +
        279  std::unique_ptr<KeyFetcher> key_fetcher) {
        +
        280  key_fetcher_ = std::move(key_fetcher);
        +
        281 }
        +
        282 
        +
        283 Status WidevineKeySource::GetKeyInternal(uint32_t crypto_period_index,
        +
        284  TrackType track_type,
        +
        285  EncryptionKey* key) {
        +
        286  DCHECK(key_pool_);
        +
        287  DCHECK(key);
        +
        288  DCHECK_LE(track_type, NUM_VALID_TRACK_TYPES);
        +
        289  DCHECK_NE(track_type, TRACK_TYPE_UNKNOWN);
        +
        290 
        +
        291  scoped_refptr<RefCountedEncryptionKeyMap> ref_counted_encryption_key_map;
        +
        292  Status status =
        +
        293  key_pool_->Peek(crypto_period_index, &ref_counted_encryption_key_map,
        +
        294  kGetKeyTimeoutInSeconds * 1000);
        +
        295  if (!status.ok()) {
        +
        296  if (status.error_code() == error::STOPPED) {
        +
        297  CHECK(!common_encryption_request_status_.ok());
        +
        298  return common_encryption_request_status_;
        +
        299  }
        +
        300  return status;
        +
        301  }
        +
        302 
        +
        303  const EncryptionKeyMap& encryption_key_map =
        +
        304  ref_counted_encryption_key_map->map();
        +
        305  if (encryption_key_map.find(track_type) == encryption_key_map.end()) {
        +
        306  return Status(error::INTERNAL_ERROR,
        +
        307  "Cannot find key of type " + TrackTypeToString(track_type));
        308  }
        -
        309 
        -
        310  EncryptionKeyMap& encryption_key_map = ref_counted_encryption_key_map->map();
        -
        311  if (encryption_key_map.find(track_type) == encryption_key_map.end()) {
        -
        312  return Status(error::INTERNAL_ERROR,
        -
        313  "Cannot find key of type " + TrackTypeToString(track_type));
        -
        314  }
        -
        315  *key = *encryption_key_map[track_type];
        -
        316  return Status::OK;
        -
        317 }
        +
        309  *key = *encryption_key_map.at(track_type);
        +
        310  return Status::OK;
        +
        311 }
        +
        312 
        +
        313 void WidevineKeySource::FetchKeysTask() {
        +
        314  // Wait until key production is signaled.
        +
        315  start_key_production_.Wait();
        +
        316  if (!key_pool_ || key_pool_->Stopped())
        +
        317  return;
        318 
        -
        319 void WidevineKeySource::FetchKeysTask() {
        -
        320  // Wait until key production is signaled.
        -
        321  start_key_production_.Wait();
        -
        322  if (!key_pool_ || key_pool_->Stopped())
        -
        323  return;
        -
        324 
        -
        325  Status status = FetchKeysInternal(kEnableKeyRotation,
        -
        326  first_crypto_period_index_,
        -
        327  false);
        -
        328  while (status.ok()) {
        -
        329  first_crypto_period_index_ += crypto_period_count_;
        -
        330  status = FetchKeysInternal(kEnableKeyRotation,
        -
        331  first_crypto_period_index_,
        -
        332  false);
        -
        333  }
        -
        334  common_encryption_request_status_ = status;
        -
        335  key_pool_->Stop();
        -
        336 }
        -
        337 
        -
        338 Status WidevineKeySource::FetchKeysInternal(bool enable_key_rotation,
        -
        339  uint32_t first_crypto_period_index,
        -
        340  bool widevine_classic) {
        -
        341  std::string request;
        -
        342  FillRequest(enable_key_rotation,
        -
        343  first_crypto_period_index,
        -
        344  &request);
        +
        319  Status status = FetchKeysInternal(kEnableKeyRotation,
        +
        320  first_crypto_period_index_,
        +
        321  false);
        +
        322  while (status.ok()) {
        +
        323  first_crypto_period_index_ += crypto_period_count_;
        +
        324  status = FetchKeysInternal(kEnableKeyRotation,
        +
        325  first_crypto_period_index_,
        +
        326  false);
        +
        327  }
        +
        328  common_encryption_request_status_ = status;
        +
        329  key_pool_->Stop();
        +
        330 }
        +
        331 
        +
        332 Status WidevineKeySource::FetchKeysInternal(bool enable_key_rotation,
        +
        333  uint32_t first_crypto_period_index,
        +
        334  bool widevine_classic) {
        +
        335  std::string request;
        +
        336  FillRequest(enable_key_rotation,
        +
        337  first_crypto_period_index,
        +
        338  &request);
        +
        339 
        +
        340  std::string message;
        +
        341  Status status = GenerateKeyMessage(request, &message);
        +
        342  if (!status.ok())
        +
        343  return status;
        +
        344  VLOG(1) << "Message: " << message;
        345 
        -
        346  std::string message;
        -
        347  Status status = GenerateKeyMessage(request, &message);
        -
        348  if (!status.ok())
        -
        349  return status;
        -
        350  VLOG(1) << "Message: " << message;
        -
        351 
        -
        352  std::string raw_response;
        -
        353  int64_t sleep_duration = kFirstRetryDelayMilliseconds;
        -
        354 
        -
        355  // Perform client side retries if seeing server transient error to workaround
        -
        356  // server limitation.
        -
        357  for (int i = 0; i < kNumTransientErrorRetries; ++i) {
        -
        358  status = key_fetcher_->FetchKeys(server_url_, message, &raw_response);
        -
        359  if (status.ok()) {
        -
        360  VLOG(1) << "Retry [" << i << "] Response:" << raw_response;
        +
        346  std::string raw_response;
        +
        347  int64_t sleep_duration = kFirstRetryDelayMilliseconds;
        +
        348 
        +
        349  // Perform client side retries if seeing server transient error to workaround
        +
        350  // server limitation.
        +
        351  for (int i = 0; i < kNumTransientErrorRetries; ++i) {
        +
        352  status = key_fetcher_->FetchKeys(server_url_, message, &raw_response);
        +
        353  if (status.ok()) {
        +
        354  VLOG(1) << "Retry [" << i << "] Response:" << raw_response;
        +
        355 
        +
        356  std::string response;
        +
        357  if (!DecodeResponse(raw_response, &response)) {
        +
        358  return Status(error::SERVER_ERROR,
        +
        359  "Failed to decode response '" + raw_response + "'.");
        +
        360  }
        361 
        -
        362  std::string response;
        -
        363  if (!DecodeResponse(raw_response, &response)) {
        -
        364  return Status(error::SERVER_ERROR,
        -
        365  "Failed to decode response '" + raw_response + "'.");
        -
        366  }
        -
        367 
        -
        368  bool transient_error = false;
        -
        369  if (ExtractEncryptionKey(enable_key_rotation,
        -
        370  widevine_classic,
        -
        371  response,
        -
        372  &transient_error))
        -
        373  return Status::OK;
        -
        374 
        -
        375  if (!transient_error) {
        -
        376  return Status(
        -
        377  error::SERVER_ERROR,
        -
        378  "Failed to extract encryption key from '" + response + "'.");
        -
        379  }
        -
        380  } else if (status.error_code() != error::TIME_OUT) {
        -
        381  return status;
        -
        382  }
        -
        383 
        -
        384  // Exponential backoff.
        -
        385  if (i != kNumTransientErrorRetries - 1) {
        -
        386  base::PlatformThread::Sleep(
        -
        387  base::TimeDelta::FromMilliseconds(sleep_duration));
        -
        388  sleep_duration *= 2;
        -
        389  }
        -
        390  }
        -
        391  return Status(error::SERVER_ERROR,
        -
        392  "Failed to recover from server internal error.");
        -
        393 }
        +
        362  bool transient_error = false;
        +
        363  if (ExtractEncryptionKey(enable_key_rotation,
        +
        364  widevine_classic,
        +
        365  response,
        +
        366  &transient_error))
        +
        367  return Status::OK;
        +
        368 
        +
        369  if (!transient_error) {
        +
        370  return Status(
        +
        371  error::SERVER_ERROR,
        +
        372  "Failed to extract encryption key from '" + response + "'.");
        +
        373  }
        +
        374  } else if (status.error_code() != error::TIME_OUT) {
        +
        375  return status;
        +
        376  }
        +
        377 
        +
        378  // Exponential backoff.
        +
        379  if (i != kNumTransientErrorRetries - 1) {
        +
        380  base::PlatformThread::Sleep(
        +
        381  base::TimeDelta::FromMilliseconds(sleep_duration));
        +
        382  sleep_duration *= 2;
        +
        383  }
        +
        384  }
        +
        385  return Status(error::SERVER_ERROR,
        +
        386  "Failed to recover from server internal error.");
        +
        387 }
        +
        388 
        +
        389 void WidevineKeySource::FillRequest(bool enable_key_rotation,
        +
        390  uint32_t first_crypto_period_index,
        +
        391  std::string* request) {
        +
        392  DCHECK(request);
        +
        393  DCHECK(!request_dict_.empty());
        394 
        -
        395 void WidevineKeySource::FillRequest(bool enable_key_rotation,
        -
        396  uint32_t first_crypto_period_index,
        -
        397  std::string* request) {
        -
        398  DCHECK(request);
        -
        399  DCHECK(!request_dict_.empty());
        -
        400 
        -
        401  // Build tracks.
        -
        402  base::ListValue* tracks = new base::ListValue();
        -
        403 
        -
        404  base::DictionaryValue* track_sd = new base::DictionaryValue();
        -
        405  track_sd->SetString("type", "SD");
        -
        406  tracks->Append(track_sd);
        -
        407  base::DictionaryValue* track_hd = new base::DictionaryValue();
        -
        408  track_hd->SetString("type", "HD");
        -
        409  tracks->Append(track_hd);
        -
        410  base::DictionaryValue* track_audio = new base::DictionaryValue();
        -
        411  track_audio->SetString("type", "AUDIO");
        -
        412  tracks->Append(track_audio);
        -
        413 
        -
        414  request_dict_.Set("tracks", tracks);
        -
        415 
        -
        416  // Build DRM types.
        -
        417  base::ListValue* drm_types = new base::ListValue();
        -
        418  drm_types->AppendString("WIDEVINE");
        -
        419  request_dict_.Set("drm_types", drm_types);
        -
        420 
        -
        421  // Build key rotation fields.
        -
        422  if (enable_key_rotation) {
        -
        423  // Javascript/JSON does not support int64_t or unsigned numbers. Use double
        -
        424  // instead as 32-bit integer can be lossless represented using double.
        -
        425  request_dict_.SetDouble("first_crypto_period_index",
        -
        426  first_crypto_period_index);
        -
        427  request_dict_.SetInteger("crypto_period_count", crypto_period_count_);
        -
        428  }
        -
        429 
        -
        430  base::JSONWriter::WriteWithOptions(
        -
        431  request_dict_,
        -
        432  // Write doubles that have no fractional part as a normal integer, i.e.
        -
        433  // without using exponential notation or appending a '.0'.
        -
        434  base::JSONWriter::OPTIONS_OMIT_DOUBLE_TYPE_PRESERVATION, request);
        -
        435 }
        -
        436 
        -
        437 Status WidevineKeySource::GenerateKeyMessage(const std::string& request,
        -
        438  std::string* message) {
        -
        439  DCHECK(message);
        +
        395  // Build tracks.
        +
        396  base::ListValue* tracks = new base::ListValue();
        +
        397 
        +
        398  base::DictionaryValue* track_sd = new base::DictionaryValue();
        +
        399  track_sd->SetString("type", "SD");
        +
        400  tracks->Append(track_sd);
        +
        401  base::DictionaryValue* track_hd = new base::DictionaryValue();
        +
        402  track_hd->SetString("type", "HD");
        +
        403  tracks->Append(track_hd);
        +
        404  base::DictionaryValue* track_audio = new base::DictionaryValue();
        +
        405  track_audio->SetString("type", "AUDIO");
        +
        406  tracks->Append(track_audio);
        +
        407 
        +
        408  request_dict_.Set("tracks", tracks);
        +
        409 
        +
        410  // Build DRM types.
        +
        411  base::ListValue* drm_types = new base::ListValue();
        +
        412  drm_types->AppendString("WIDEVINE");
        +
        413  request_dict_.Set("drm_types", drm_types);
        +
        414 
        +
        415  // Build key rotation fields.
        +
        416  if (enable_key_rotation) {
        +
        417  // Javascript/JSON does not support int64_t or unsigned numbers. Use double
        +
        418  // instead as 32-bit integer can be lossless represented using double.
        +
        419  request_dict_.SetDouble("first_crypto_period_index",
        +
        420  first_crypto_period_index);
        +
        421  request_dict_.SetInteger("crypto_period_count", crypto_period_count_);
        +
        422  }
        +
        423 
        +
        424  base::JSONWriter::WriteWithOptions(
        +
        425  request_dict_,
        +
        426  // Write doubles that have no fractional part as a normal integer, i.e.
        +
        427  // without using exponential notation or appending a '.0'.
        +
        428  base::JSONWriter::OPTIONS_OMIT_DOUBLE_TYPE_PRESERVATION, request);
        +
        429 }
        +
        430 
        +
        431 Status WidevineKeySource::GenerateKeyMessage(const std::string& request,
        +
        432  std::string* message) {
        +
        433  DCHECK(message);
        +
        434 
        +
        435  std::string request_base64_string;
        +
        436  base::Base64Encode(request, &request_base64_string);
        +
        437 
        +
        438  base::DictionaryValue request_dict;
        +
        439  request_dict.SetString("request", request_base64_string);
        440 
        -
        441  std::string request_base64_string;
        -
        442  base::Base64Encode(request, &request_base64_string);
        -
        443 
        -
        444  base::DictionaryValue request_dict;
        -
        445  request_dict.SetString("request", request_base64_string);
        +
        441  // Sign the request.
        +
        442  if (signer_) {
        +
        443  std::string signature;
        +
        444  if (!signer_->GenerateSignature(request, &signature))
        +
        445  return Status(error::INTERNAL_ERROR, "Signature generation failed.");
        446 
        -
        447  // Sign the request.
        -
        448  if (signer_) {
        -
        449  std::string signature;
        -
        450  if (!signer_->GenerateSignature(request, &signature))
        -
        451  return Status(error::INTERNAL_ERROR, "Signature generation failed.");
        -
        452 
        -
        453  std::string signature_base64_string;
        -
        454  base::Base64Encode(signature, &signature_base64_string);
        -
        455 
        -
        456  request_dict.SetString("signature", signature_base64_string);
        -
        457  request_dict.SetString("signer", signer_->signer_name());
        -
        458  }
        -
        459 
        -
        460  base::JSONWriter::Write(request_dict, message);
        -
        461  return Status::OK;
        -
        462 }
        -
        463 
        -
        464 bool WidevineKeySource::DecodeResponse(
        -
        465  const std::string& raw_response,
        -
        466  std::string* response) {
        -
        467  DCHECK(response);
        -
        468 
        -
        469  // Extract base64 formatted response from JSON formatted raw response.
        -
        470  // TODO(kqyang): Remove ".release()" when base is updated to use unique_ptr.
        -
        471  std::unique_ptr<base::Value> root(
        -
        472  base::JSONReader::Read(raw_response).release());
        -
        473  if (!root) {
        -
        474  LOG(ERROR) << "'" << raw_response << "' is not in JSON format.";
        -
        475  return false;
        -
        476  }
        -
        477  const base::DictionaryValue* response_dict = NULL;
        -
        478  RCHECK(root->GetAsDictionary(&response_dict));
        +
        447  std::string signature_base64_string;
        +
        448  base::Base64Encode(signature, &signature_base64_string);
        +
        449 
        +
        450  request_dict.SetString("signature", signature_base64_string);
        +
        451  request_dict.SetString("signer", signer_->signer_name());
        +
        452  }
        +
        453 
        +
        454  base::JSONWriter::Write(request_dict, message);
        +
        455  return Status::OK;
        +
        456 }
        +
        457 
        +
        458 bool WidevineKeySource::DecodeResponse(
        +
        459  const std::string& raw_response,
        +
        460  std::string* response) {
        +
        461  DCHECK(response);
        +
        462 
        +
        463  // Extract base64 formatted response from JSON formatted raw response.
        +
        464  // TODO(kqyang): Remove ".release()" when base is updated to use unique_ptr.
        +
        465  std::unique_ptr<base::Value> root(
        +
        466  base::JSONReader::Read(raw_response).release());
        +
        467  if (!root) {
        +
        468  LOG(ERROR) << "'" << raw_response << "' is not in JSON format.";
        +
        469  return false;
        +
        470  }
        +
        471  const base::DictionaryValue* response_dict = NULL;
        +
        472  RCHECK(root->GetAsDictionary(&response_dict));
        +
        473 
        +
        474  std::string response_base64_string;
        +
        475  RCHECK(response_dict->GetString("response", &response_base64_string));
        +
        476  RCHECK(base::Base64Decode(response_base64_string, response));
        +
        477  return true;
        +
        478 }
        479 
        -
        480  std::string response_base64_string;
        -
        481  RCHECK(response_dict->GetString("response", &response_base64_string));
        -
        482  RCHECK(base::Base64Decode(response_base64_string, response));
        -
        483  return true;
        -
        484 }
        -
        485 
        -
        486 bool WidevineKeySource::ExtractEncryptionKey(
        -
        487  bool enable_key_rotation,
        -
        488  bool widevine_classic,
        -
        489  const std::string& response,
        -
        490  bool* transient_error) {
        -
        491  DCHECK(transient_error);
        -
        492  *transient_error = false;
        -
        493 
        -
        494  // TODO(kqyang): Remove ".release()" when base is updated to use unique_ptr.
        -
        495  std::unique_ptr<base::Value> root(base::JSONReader::Read(response).release());
        -
        496  if (!root) {
        -
        497  LOG(ERROR) << "'" << response << "' is not in JSON format.";
        -
        498  return false;
        -
        499  }
        -
        500 
        -
        501  const base::DictionaryValue* license_dict = NULL;
        -
        502  RCHECK(root->GetAsDictionary(&license_dict));
        -
        503 
        -
        504  std::string license_status;
        -
        505  RCHECK(license_dict->GetString("status", &license_status));
        -
        506  if (license_status != kLicenseStatusOK) {
        -
        507  LOG(ERROR) << "Received non-OK license response: " << response;
        -
        508  *transient_error = (license_status == kLicenseStatusTransientError);
        -
        509  return false;
        -
        510  }
        +
        480 bool WidevineKeySource::ExtractEncryptionKey(
        +
        481  bool enable_key_rotation,
        +
        482  bool widevine_classic,
        +
        483  const std::string& response,
        +
        484  bool* transient_error) {
        +
        485  DCHECK(transient_error);
        +
        486  *transient_error = false;
        +
        487 
        +
        488  // TODO(kqyang): Remove ".release()" when base is updated to use unique_ptr.
        +
        489  std::unique_ptr<base::Value> root(base::JSONReader::Read(response).release());
        +
        490  if (!root) {
        +
        491  LOG(ERROR) << "'" << response << "' is not in JSON format.";
        +
        492  return false;
        +
        493  }
        +
        494 
        +
        495  const base::DictionaryValue* license_dict = NULL;
        +
        496  RCHECK(root->GetAsDictionary(&license_dict));
        +
        497 
        +
        498  std::string license_status;
        +
        499  RCHECK(license_dict->GetString("status", &license_status));
        +
        500  if (license_status != kLicenseStatusOK) {
        +
        501  LOG(ERROR) << "Received non-OK license response: " << response;
        +
        502  *transient_error = (license_status == kLicenseStatusTransientError);
        +
        503  return false;
        +
        504  }
        +
        505 
        +
        506  const base::ListValue* tracks;
        +
        507  RCHECK(license_dict->GetList("tracks", &tracks));
        +
        508  // Should have at least one track per crypto_period.
        +
        509  RCHECK(enable_key_rotation ? tracks->GetSize() >= 1 * crypto_period_count_
        +
        510  : tracks->GetSize() >= 1);
        511 
        -
        512  const base::ListValue* tracks;
        -
        513  RCHECK(license_dict->GetList("tracks", &tracks));
        -
        514  // Should have at least one track per crypto_period.
        -
        515  RCHECK(enable_key_rotation ? tracks->GetSize() >= 1 * crypto_period_count_
        -
        516  : tracks->GetSize() >= 1);
        -
        517 
        -
        518  int current_crypto_period_index = first_crypto_period_index_;
        -
        519 
        -
        520  EncryptionKeyMap encryption_key_map;
        -
        521  for (size_t i = 0; i < tracks->GetSize(); ++i) {
        -
        522  const base::DictionaryValue* track_dict;
        -
        523  RCHECK(tracks->GetDictionary(i, &track_dict));
        -
        524 
        -
        525  if (enable_key_rotation) {
        -
        526  int crypto_period_index;
        -
        527  RCHECK(
        -
        528  track_dict->GetInteger("crypto_period_index", &crypto_period_index));
        -
        529  if (crypto_period_index != current_crypto_period_index) {
        -
        530  if (crypto_period_index != current_crypto_period_index + 1) {
        -
        531  LOG(ERROR) << "Expecting crypto period index "
        -
        532  << current_crypto_period_index << " or "
        -
        533  << current_crypto_period_index + 1 << "; Seen "
        -
        534  << crypto_period_index << " at track " << i;
        -
        535  return false;
        -
        536  }
        -
        537  if (!PushToKeyPool(&encryption_key_map))
        -
        538  return false;
        -
        539  ++current_crypto_period_index;
        -
        540  }
        -
        541  }
        +
        512  int current_crypto_period_index = first_crypto_period_index_;
        +
        513 
        +
        514  EncryptionKeyMap encryption_key_map;
        +
        515  for (size_t i = 0; i < tracks->GetSize(); ++i) {
        +
        516  const base::DictionaryValue* track_dict;
        +
        517  RCHECK(tracks->GetDictionary(i, &track_dict));
        +
        518 
        +
        519  if (enable_key_rotation) {
        +
        520  int crypto_period_index;
        +
        521  RCHECK(
        +
        522  track_dict->GetInteger("crypto_period_index", &crypto_period_index));
        +
        523  if (crypto_period_index != current_crypto_period_index) {
        +
        524  if (crypto_period_index != current_crypto_period_index + 1) {
        +
        525  LOG(ERROR) << "Expecting crypto period index "
        +
        526  << current_crypto_period_index << " or "
        +
        527  << current_crypto_period_index + 1 << "; Seen "
        +
        528  << crypto_period_index << " at track " << i;
        +
        529  return false;
        +
        530  }
        +
        531  if (!PushToKeyPool(&encryption_key_map))
        +
        532  return false;
        +
        533  ++current_crypto_period_index;
        +
        534  }
        +
        535  }
        +
        536 
        +
        537  std::string track_type_str;
        +
        538  RCHECK(track_dict->GetString("type", &track_type_str));
        +
        539  TrackType track_type = GetTrackTypeFromString(track_type_str);
        +
        540  DCHECK_NE(TRACK_TYPE_UNKNOWN, track_type);
        +
        541  RCHECK(encryption_key_map.find(track_type) == encryption_key_map.end());
        542 
        -
        543  std::string track_type_str;
        -
        544  RCHECK(track_dict->GetString("type", &track_type_str));
        -
        545  TrackType track_type = GetTrackTypeFromString(track_type_str);
        -
        546  DCHECK_NE(TRACK_TYPE_UNKNOWN, track_type);
        -
        547  RCHECK(encryption_key_map.find(track_type) == encryption_key_map.end());
        -
        548 
        -
        549  std::unique_ptr<EncryptionKey> encryption_key(new EncryptionKey());
        -
        550 
        -
        551  if (!GetKeyFromTrack(*track_dict, &encryption_key->key))
        -
        552  return false;
        -
        553 
        -
        554  // Get key ID and PSSH data for CENC content only.
        -
        555  if (!widevine_classic) {
        -
        556  if (!GetKeyIdFromTrack(*track_dict, &encryption_key->key_id))
        -
        557  return false;
        -
        558 
        -
        559  ProtectionSystemSpecificInfo info;
        -
        560  info.add_key_id(encryption_key->key_id);
        -
        561  info.set_system_id(kWidevineSystemId, arraysize(kWidevineSystemId));
        -
        562  info.set_pssh_box_version(0);
        -
        563 
        -
        564  std::vector<uint8_t> pssh_data;
        -
        565  if (!GetPsshDataFromTrack(*track_dict, &pssh_data))
        -
        566  return false;
        -
        567  info.set_pssh_data(pssh_data);
        -
        568 
        -
        569  encryption_key->key_system_info.push_back(info);
        -
        570  }
        -
        571  encryption_key_map[track_type] = encryption_key.release();
        -
        572  }
        -
        573 
        -
        574  // If the flag exists, create a common system ID PSSH box that contains the
        -
        575  // key IDs of all the keys.
        -
        576  if (add_common_pssh_ && !widevine_classic) {
        -
        577  std::set<std::vector<uint8_t>> key_ids;
        -
        578  for (const EncryptionKeyMap::value_type& pair : encryption_key_map) {
        -
        579  key_ids.insert(pair.second->key_id);
        -
        580  }
        -
        581 
        -
        582  // Create a common system PSSH box.
        -
        583  ProtectionSystemSpecificInfo info;
        -
        584  info.set_system_id(kCommonSystemId, arraysize(kCommonSystemId));
        -
        585  info.set_pssh_box_version(1);
        -
        586  for (const std::vector<uint8_t>& key_id : key_ids) {
        -
        587  info.add_key_id(key_id);
        -
        588  }
        -
        589 
        -
        590  for (const EncryptionKeyMap::value_type& pair : encryption_key_map) {
        -
        591  pair.second->key_system_info.push_back(info);
        -
        592  }
        +
        543  std::unique_ptr<EncryptionKey> encryption_key(new EncryptionKey());
        +
        544 
        +
        545  if (!GetKeyFromTrack(*track_dict, &encryption_key->key))
        +
        546  return false;
        +
        547 
        +
        548  // Get key ID and PSSH data for CENC content only.
        +
        549  if (!widevine_classic) {
        +
        550  if (!GetKeyIdFromTrack(*track_dict, &encryption_key->key_id))
        +
        551  return false;
        +
        552 
        +
        553  ProtectionSystemSpecificInfo info;
        +
        554  info.add_key_id(encryption_key->key_id);
        +
        555  info.set_system_id(kWidevineSystemId, arraysize(kWidevineSystemId));
        +
        556  info.set_pssh_box_version(0);
        +
        557 
        +
        558  std::vector<uint8_t> pssh_data;
        +
        559  if (!GetPsshDataFromTrack(*track_dict, &pssh_data))
        +
        560  return false;
        +
        561  info.set_pssh_data(pssh_data);
        +
        562 
        +
        563  encryption_key->key_system_info.push_back(info);
        +
        564  }
        +
        565  encryption_key_map[track_type] = std::move(encryption_key);
        +
        566  }
        +
        567 
        +
        568  // If the flag exists, create a common system ID PSSH box that contains the
        +
        569  // key IDs of all the keys.
        +
        570  if (add_common_pssh_ && !widevine_classic) {
        +
        571  std::set<std::vector<uint8_t>> key_ids;
        +
        572  for (const EncryptionKeyMap::value_type& pair : encryption_key_map) {
        +
        573  key_ids.insert(pair.second->key_id);
        +
        574  }
        +
        575 
        +
        576  // Create a common system PSSH box.
        +
        577  ProtectionSystemSpecificInfo info;
        +
        578  info.set_system_id(kCommonSystemId, arraysize(kCommonSystemId));
        +
        579  info.set_pssh_box_version(1);
        +
        580  for (const std::vector<uint8_t>& key_id : key_ids) {
        +
        581  info.add_key_id(key_id);
        +
        582  }
        +
        583 
        +
        584  for (const EncryptionKeyMap::value_type& pair : encryption_key_map) {
        +
        585  pair.second->key_system_info.push_back(info);
        +
        586  }
        +
        587  }
        +
        588 
        +
        589  DCHECK(!encryption_key_map.empty());
        +
        590  if (!enable_key_rotation) {
        +
        591  encryption_key_map_.swap(encryption_key_map);
        +
        592  return true;
        593  }
        -
        594 
        -
        595  DCHECK(!encryption_key_map.empty());
        -
        596  if (!enable_key_rotation) {
        -
        597  encryption_key_map_ = encryption_key_map;
        -
        598  return true;
        -
        599  }
        -
        600  return PushToKeyPool(&encryption_key_map);
        -
        601 }
        -
        602 
        -
        603 bool WidevineKeySource::PushToKeyPool(
        -
        604  EncryptionKeyMap* encryption_key_map) {
        -
        605  DCHECK(key_pool_);
        -
        606  DCHECK(encryption_key_map);
        -
        607  Status status =
        -
        608  key_pool_->Push(scoped_refptr<RefCountedEncryptionKeyMap>(
        -
        609  new RefCountedEncryptionKeyMap(encryption_key_map)),
        -
        610  kInfiniteTimeout);
        -
        611  encryption_key_map->clear();
        -
        612  if (!status.ok()) {
        -
        613  DCHECK_EQ(error::STOPPED, status.error_code());
        -
        614  return false;
        -
        615  }
        -
        616  return true;
        -
        617 }
        -
        618 
        -
        619 } // namespace media
        -
        620 } // namespace shaka
        +
        594  return PushToKeyPool(&encryption_key_map);
        +
        595 }
        +
        596 
        +
        597 bool WidevineKeySource::PushToKeyPool(
        +
        598  EncryptionKeyMap* encryption_key_map) {
        +
        599  DCHECK(key_pool_);
        +
        600  DCHECK(encryption_key_map);
        +
        601  Status status =
        +
        602  key_pool_->Push(scoped_refptr<RefCountedEncryptionKeyMap>(
        +
        603  new RefCountedEncryptionKeyMap(encryption_key_map)),
        +
        604  kInfiniteTimeout);
        +
        605  encryption_key_map->clear();
        +
        606  if (!status.ok()) {
        +
        607  DCHECK_EQ(error::STOPPED, status.error_code());
        +
        608  return false;
        +
        609  }
        +
        610  return true;
        +
        611 }
        +
        612 
        +
        613 } // namespace media
        +
        614 } // namespace shaka
        -
        Status FetchKeys(const std::vector< uint8_t > &pssh_box) override
        -
        Status GetCryptoPeriodKey(uint32_t crypto_period_index, TrackType track_type, EncryptionKey *key) override
        -
        Status GetKey(TrackType track_type, EncryptionKey *key) override
        +
        Status FetchKeys(const std::vector< uint8_t > &pssh_box) override
        +
        Status GetCryptoPeriodKey(uint32_t crypto_period_index, TrackType track_type, EncryptionKey *key) override
        +
        Status GetKey(TrackType track_type, EncryptionKey *key) override
        static std::string TrackTypeToString(TrackType track_type)
        Convert TrackType to string.
        Definition: key_source.cc:33
        static TrackType GetTrackTypeFromString(const std::string &track_type_string)
        Convert string representation of track type to enum representation.
        Definition: key_source.cc:19
        -
        void set_key_fetcher(std::unique_ptr< KeyFetcher > key_fetcher)
        -
        WidevineKeySource(const std::string &server_url, bool add_common_pssh)
        +
        void set_key_fetcher(std::unique_ptr< KeyFetcher > key_fetcher)
        +
        WidevineKeySource(const std::string &server_url, bool add_common_pssh)
        -
        void set_signer(std::unique_ptr< RequestSigner > signer)
        +
        void set_signer(std::unique_ptr< RequestSigner > signer)
        bool Parse(const uint8_t *data, size_t data_size)
        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 448204c2bc..72ce63de3f 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 @@ -112,7 +112,7 @@ int64_t sample_offset< diff --git a/docs/d5/d8f/webm__cluster__parser_8cc_source.html b/docs/d5/d8f/webm__cluster__parser_8cc_source.html index 13fe56a45c..dbaf3ea217 100644 --- a/docs/d5/d8f/webm__cluster__parser_8cc_source.html +++ b/docs/d5/d8f/webm__cluster__parser_8cc_source.html @@ -716,13 +716,13 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
        static scoped_refptr< MediaSample > CopyFrom(const uint8_t *data, size_t size, bool is_key_frame)
        Definition: media_sample.cc:45
        WebMClusterParser(int64_t timecode_scale, scoped_refptr< AudioStreamInfo > audio_stream_info, scoped_refptr< VideoStreamInfo > video_stream_info, int64_t audio_default_duration, int64_t video_default_duration, const WebMTracksParser::TextTracks &text_tracks, const std::set< int64_t > &ignored_tracks, const std::string &audio_encryption_key_id, const std::string &video_encryption_key_id, const MediaParser::NewSampleCB &new_sample_cb, const MediaParser::InitCB &init_cb, KeySource *decryption_key_source)
        -
        DecryptorSource wraps KeySource and is responsible for decryptor management.
        +
        DecryptorSource wraps KeySource and is responsible for decryptor management.
        void Reset()
        Resets the parser state so it can accept a new cluster.
        diff --git a/docs/d5/d91/es__parser__adts_8cc_source.html b/docs/d5/d91/es__parser__adts_8cc_source.html index 5ff7597db4..479e668bd0 100644 --- a/docs/d5/d91/es__parser__adts_8cc_source.html +++ b/docs/d5/d91/es__parser__adts_8cc_source.html @@ -367,7 +367,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 379295575b..f2f2397ace 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 @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d5/d98/encryptor_8cc_source.html b/docs/d5/d98/encryptor_8cc_source.html index 19b2881e1e..3543ce23f8 100644 --- a/docs/d5/d98/encryptor_8cc_source.html +++ b/docs/d5/d98/encryptor_8cc_source.html @@ -307,7 +307,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
        const uint8_t * Buffer() const
        Definition: buffer_writer.h:59
        Status Initialize(MuxerListener *muxer_listener, KeySource::TrackType track_type, Codec codec, KeySource *key_source, bool webm_subsample_encryption)
        Definition: encryptor.cc:61
        -
        static bool GenerateRandomIv(FourCC protection_scheme, std::vector< uint8_t > *iv)
        Definition: aes_cryptor.cc:109
        +
        static bool GenerateRandomIv(FourCC protection_scheme, std::vector< uint8_t > *iv)
        Definition: aes_cryptor.cc:107
        Class to parse a vp9 bit stream.
        Definition: vp9_parser.h:20
        Status EncryptFrame(scoped_refptr< MediaSample > sample, bool encrypt_frame)
        Definition: encryptor.cc:76
        @@ -317,7 +317,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 085672ba1e..9d3f54bcf6 100644 --- a/docs/d5/d9b/vp__codec__configuration__record_8h_source.html +++ b/docs/d5/d9b/vp__codec__configuration__record_8h_source.html @@ -224,7 +224,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d5/d9d/structshaka_1_1media_1_1H265ReferencePictureListModifications.html b/docs/d5/d9d/structshaka_1_1media_1_1H265ReferencePictureListModifications.html index 582ad498fe..0de9385f0e 100644 --- a/docs/d5/d9d/structshaka_1_1media_1_1H265ReferencePictureListModifications.html +++ b/docs/d5/d9d/structshaka_1_1media_1_1H265ReferencePictureListModifications.html @@ -119,7 +119,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 0f5382b96a..f2f569649b 100644 --- a/docs/d5/da4/aes__encryptor_8cc_source.html +++ b/docs/d5/da4/aes__encryptor_8cc_source.html @@ -292,12 +292,12 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
        AesEncryptor(ConstantIvFlag constant_iv_flag)
        const std::vector< uint8_t > & iv() const
        Definition: aes_cryptor.h:81
        -
        bool SetIv(const std::vector< uint8_t > &iv)
        Definition: aes_cryptor.cc:69
        +
        bool SetIv(const std::vector< uint8_t > &iv)
        Definition: aes_cryptor.cc:67
        diff --git a/docs/d5/dad/structshaka_1_1media_1_1H265ReferencePictureSet.html b/docs/d5/dad/structshaka_1_1media_1_1H265ReferencePictureSet.html index 1fa81308cc..7850dfca73 100644 --- a/docs/d5/dad/structshaka_1_1media_1_1H265ReferencePictureSet.html +++ b/docs/d5/dad/structshaka_1_1media_1_1H265ReferencePictureSet.html @@ -127,7 +127,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 aa1a2d2432..7c0992eb55 100644 --- a/docs/d5/db1/classshaka_1_1media_1_1StreamInfo.html +++ b/docs/d5/db1/classshaka_1_1media_1_1StreamInfo.html @@ -235,7 +235,7 @@ class base::RefCountedThre 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 2e27a14b4e..b0974a3a9b 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 @@ -161,7 +161,7 @@ const
        diff --git a/docs/d5/dba/ts__packet_8cc_source.html b/docs/d5/dba/ts__packet_8cc_source.html index 4bced689b6..1dfcbc2be5 100644 --- a/docs/d5/dba/ts__packet_8cc_source.html +++ b/docs/d5/dba/ts__packet_8cc_source.html @@ -304,7 +304,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d5/dc1/webm__webvtt__parser_8cc_source.html b/docs/d5/dc1/webm__webvtt__parser_8cc_source.html index 9838eee10c..83ce4abc8b 100644 --- a/docs/d5/dc1/webm__webvtt__parser_8cc_source.html +++ b/docs/d5/dc1/webm__webvtt__parser_8cc_source.html @@ -171,7 +171,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 173bce0a79..8305c6dc7b 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 @@ -117,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 77e17e09dd..a7ad434e66 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 @@ -182,7 +182,7 @@ Additional Inherited Members diff --git a/docs/d5/dcf/rsa__key_8h_source.html b/docs/d5/dcf/rsa__key_8h_source.html index 191ac4ba5d..d0dca4edfc 100644 --- a/docs/d5/dcf/rsa__key_8h_source.html +++ b/docs/d5/dcf/rsa__key_8h_source.html @@ -155,17 +155,17 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
        83 
        84 #endif // MEDIA_BASE_RSA_KEY_H_
        Rsa public key, used for signature verification and encryption.
        Definition: rsa_key.h:53
        -
        bool Encrypt(const std::string &clear_message, std::string *encrypted_message)
        Definition: rsa_key.cc:185
        -
        bool Decrypt(const std::string &encrypted_message, std::string *decrypted_message)
        Definition: rsa_key.cc:102
        +
        bool Encrypt(const std::string &clear_message, std::string *encrypted_message)
        Definition: rsa_key.cc:176
        +
        bool Decrypt(const std::string &encrypted_message, std::string *decrypted_message)
        Definition: rsa_key.cc:101
        Rsa private key, used for message signing and decryption.
        Definition: rsa_key.h:24
        -
        bool VerifySignature(const std::string &message, const std::string &signature)
        Definition: rsa_key.cc:210
        -
        static RsaPublicKey * Create(const std::string &serialized_key)
        Definition: rsa_key.cc:180
        -
        bool GenerateSignature(const std::string &message, std::string *signature)
        Definition: rsa_key.cc:130
        -
        static RsaPrivateKey * Create(const std::string &serialized_key)
        Definition: rsa_key.cc:97
        +
        bool VerifySignature(const std::string &message, const std::string &signature)
        Definition: rsa_key.cc:200
        +
        static RsaPublicKey * Create(const std::string &serialized_key)
        Definition: rsa_key.cc:171
        +
        bool GenerateSignature(const std::string &message, std::string *signature)
        Definition: rsa_key.cc:127
        +
        static RsaPrivateKey * Create(const std::string &serialized_key)
        Definition: rsa_key.cc:96
        diff --git a/docs/d5/dda/ts__section__psi_8h_source.html b/docs/d5/dda/ts__section__psi_8h_source.html index bd08eb7647..b5a9794724 100644 --- a/docs/d5/dda/ts__section__psi_8h_source.html +++ b/docs/d5/dda/ts__section__psi_8h_source.html @@ -151,7 +151,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d5/de0/bit__reader_8cc_source.html b/docs/d5/de0/bit__reader_8cc_source.html index 7d7d36df2a..58159eaedc 100644 --- a/docs/d5/de0/bit__reader_8cc_source.html +++ b/docs/d5/de0/bit__reader_8cc_source.html @@ -199,7 +199,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 505c82d81e..bfd4d4af4b 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 @@ -122,7 +122,7 @@ class PesPacketGeneratorTe

        Detailed Description

        Generates PesPackets from MediaSamples. Methods are virtual for mocking.

        -

        Definition at line 32 of file pes_packet_generator.h.

        +

        Definition at line 31 of file pes_packet_generator.h.

        Member Function Documentation

        @@ -307,7 +307,7 @@ class PesPacketGeneratorTe
        diff --git a/docs/d5/dec/classshaka_1_1media_1_1WebMParserClient.html b/docs/d5/dec/classshaka_1_1media_1_1WebMParserClient.html index 21e68ec9c7..bcc3f61b43 100644 --- a/docs/d5/dec/classshaka_1_1media_1_1WebMParserClient.html +++ b/docs/d5/dec/classshaka_1_1media_1_1WebMParserClient.html @@ -151,7 +151,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 982878f8f7..5f5461c78f 100644 --- a/docs/d5/dec/decoder__configuration__record_8cc_source.html +++ b/docs/d5/dec/decoder__configuration__record_8cc_source.html @@ -120,7 +120,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 6e62aa9a36..a7db2b4da5 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 @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d5/def/ts__section__pmt_8h_source.html b/docs/d5/def/ts__section__pmt_8h_source.html index 36c2b785f1..b4f846bdcf 100644 --- a/docs/d5/def/ts__section__pmt_8h_source.html +++ b/docs/d5/def/ts__section__pmt_8h_source.html @@ -133,7 +133,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d5/dfa/classshaka_1_1media_1_1HlsNotifyMuxerListener.html b/docs/d5/dfa/classshaka_1_1media_1_1HlsNotifyMuxerListener.html index a24aed10af..97bfd498a0 100644 --- a/docs/d5/dfa/classshaka_1_1media_1_1HlsNotifyMuxerListener.html +++ b/docs/d5/dfa/classshaka_1_1media_1_1HlsNotifyMuxerListener.html @@ -535,7 +535,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 7b1c666fee..f92c11456e 100644 --- a/docs/d5/dfa/classshaka_1_1media_1_1MediaParser-members.html +++ b/docs/d5/dfa/classshaka_1_1media_1_1MediaParser-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d5/dfc/file_8cc_source.html b/docs/d5/dfc/file_8cc_source.html index 22164b6f49..24f414867a 100644 --- a/docs/d5/dfc/file_8cc_source.html +++ b/docs/d5/dfc/file_8cc_source.html @@ -376,7 +376,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 482d407cc2..1b4797debd 100644 --- a/docs/d6/d03/classshaka_1_1media_1_1AesCbcDecryptor-members.html +++ b/docs/d6/d03/classshaka_1_1media_1_1AesCbcDecryptor-members.html @@ -116,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/d09/aes__pattern__cryptor_8h_source.html b/docs/d6/d09/aes__pattern__cryptor_8h_source.html index 98f065724b..2bfa350a14 100644 --- a/docs/d6/d09/aes__pattern__cryptor_8h_source.html +++ b/docs/d6/d09/aes__pattern__cryptor_8h_source.html @@ -149,7 +149,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/d16/text__stream__info_8cc_source.html b/docs/d6/d16/text__stream__info_8cc_source.html index 7a32ec754c..8fad51369c 100644 --- a/docs/d6/d16/text__stream__info_8cc_source.html +++ b/docs/d6/d16/text__stream__info_8cc_source.html @@ -124,7 +124,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/d17/es__parser__h264_8cc_source.html b/docs/d6/d17/es__parser__h264_8cc_source.html index 74720452a3..6d20301d49 100644 --- a/docs/d6/d17/es__parser__h264_8cc_source.html +++ b/docs/d6/d17/es__parser__h264_8cc_source.html @@ -261,7 +261,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 b588dadd29..f3d86eeebe 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 @@ -200,7 +200,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 20c0a314da..375b3af366 100644 --- a/docs/d6/d1a/ts__packet__writer__util_8cc_source.html +++ b/docs/d6/d1a/ts__packet__writer__util_8cc_source.html @@ -255,7 +255,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/d26/structshaka_1_1media_1_1VideoStreamInfoParameters.html b/docs/d6/d26/structshaka_1_1media_1_1VideoStreamInfoParameters.html index 42fca32cf3..110af44de7 100644 --- a/docs/d6/d26/structshaka_1_1media_1_1VideoStreamInfoParameters.html +++ b/docs/d6/d26/structshaka_1_1media_1_1VideoStreamInfoParameters.html @@ -146,7 +146,7 @@ bool is_encrypted diff --git a/docs/d6/d2e/mpd__notifier__util_8cc_source.html b/docs/d6/d2e/mpd__notifier__util_8cc_source.html index 020e0f49e4..63d4b5f4df 100644 --- a/docs/d6/d2e/mpd__notifier__util_8cc_source.html +++ b/docs/d6/d2e/mpd__notifier__util_8cc_source.html @@ -162,15 +162,15 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
        73 }
        74 
        75 } // namespace shaka
        -
        This class generates DASH MPDs (Media Presentation Descriptions).
        Definition: mpd_builder.h:58
        +
        This class generates DASH MPDs (Media Presentation Descriptions).
        Definition: mpd_builder.h:57
        std::string Uint8VectorToBase64(const std::vector< uint8_t > &input)
        Converts uint8 vector into base64 encoded string.
        -
        virtual bool ToString(std::string *output)
        Definition: mpd_builder.cc:428
        +
        virtual bool ToString(std::string *output)
        Definition: mpd_builder.cc:427
        ContentType GetContentType(const MediaInfo &media_info)
        bool WriteMpdToFile(const std::string &output_path, MpdBuilder *mpd_builder)
        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 9695673fe1..2de2218ba3 100644 --- a/docs/d6/d32/classshaka_1_1media_1_1TextTrack-members.html +++ b/docs/d6/d32/classshaka_1_1media_1_1TextTrack-members.html @@ -98,7 +98,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/d35/webm__content__encodings_8cc_source.html b/docs/d6/d35/webm__content__encodings_8cc_source.html index 03641614cd..f8e51c89b1 100644 --- a/docs/d6/d35/webm__content__encodings_8cc_source.html +++ b/docs/d6/d35/webm__content__encodings_8cc_source.html @@ -120,7 +120,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/d3b/chunk__info__iterator_8cc_source.html b/docs/d6/d3b/chunk__info__iterator_8cc_source.html index d96d1f1bcb..40df470e47 100644 --- a/docs/d6/d3b/chunk__info__iterator_8cc_source.html +++ b/docs/d6/d3b/chunk__info__iterator_8cc_source.html @@ -171,7 +171,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/d41/encrypting__fragmenter_8cc_source.html b/docs/d6/d41/encrypting__fragmenter_8cc_source.html index 8850b7d150..24c211df57 100644 --- a/docs/d6/d41/encrypting__fragmenter_8cc_source.html +++ b/docs/d6/d41/encrypting__fragmenter_8cc_source.html @@ -499,7 +499,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 7d7d4537ef..9dd95c418a 100644 --- a/docs/d6/d4e/webm_2multi__segment__segmenter_8cc_source.html +++ b/docs/d6/d4e/webm_2multi__segment__segmenter_8cc_source.html @@ -188,7 +188,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/d55/aes__cryptor_8cc_source.html b/docs/d6/d55/aes__cryptor_8cc_source.html index 93f311a973..7941ba1ad5 100644 --- a/docs/d6/d55/aes__cryptor_8cc_source.html +++ b/docs/d6/d55/aes__cryptor_8cc_source.html @@ -95,143 +95,139 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
        6 
        7 #include "packager/media/base/aes_cryptor.h"
        8 
        -
        9 #include <string>
        -
        10 #include <vector>
        -
        11 
        -
        12 #include <openssl/aes.h>
        -
        13 #include <openssl/err.h>
        -
        14 #include <openssl/rand.h>
        +
        9 #include <openssl/aes.h>
        +
        10 #include <openssl/err.h>
        +
        11 #include <openssl/rand.h>
        +
        12 
        +
        13 #include <string>
        +
        14 #include <vector>
        15 
        16 #include "packager/base/logging.h"
        -
        17 #include "packager/base/stl_util.h"
        -
        18 
        -
        19 namespace {
        -
        20 
        -
        21 // According to ISO/IEC 23001-7:2016 CENC spec, IV should be either
        -
        22 // 64-bit (8-byte) or 128-bit (16-byte).
        -
        23 bool IsIvSizeValid(size_t iv_size) {
        -
        24  return iv_size == 8 || iv_size == 16;
        -
        25 }
        -
        26 
        -
        27 } // namespace
        -
        28 
        -
        29 namespace shaka {
        -
        30 namespace media {
        -
        31 
        -
        32 AesCryptor::AesCryptor(ConstantIvFlag constant_iv_flag)
        -
        33  : aes_key_(new AES_KEY),
        -
        34  constant_iv_flag_(constant_iv_flag),
        -
        35  num_crypt_bytes_(0) {}
        -
        36 
        -
        37 AesCryptor::~AesCryptor() {}
        -
        38 
        -
        39 bool AesCryptor::Crypt(const std::vector<uint8_t>& text,
        -
        40  std::vector<uint8_t>* crypt_text) {
        -
        41  // Save text size to make it work for in-place conversion, since the
        -
        42  // next statement will update the text size.
        -
        43  const size_t text_size = text.size();
        -
        44  crypt_text->resize(text_size + NumPaddingBytes(text_size));
        -
        45  size_t crypt_text_size = crypt_text->size();
        -
        46  if (!Crypt(text.data(), text_size, crypt_text->data(), &crypt_text_size)) {
        -
        47  return false;
        -
        48  }
        -
        49  DCHECK_LE(crypt_text_size, crypt_text->size());
        -
        50  crypt_text->resize(crypt_text_size);
        -
        51  return true;
        -
        52 }
        -
        53 
        -
        54 bool AesCryptor::Crypt(const std::string& text, std::string* crypt_text) {
        -
        55  // Save text size to make it work for in-place conversion, since the
        -
        56  // next statement will update the text size.
        -
        57  const size_t text_size = text.size();
        -
        58  crypt_text->resize(text_size + NumPaddingBytes(text_size));
        -
        59  size_t crypt_text_size = crypt_text->size();
        -
        60  if (!Crypt(reinterpret_cast<const uint8_t*>(text.data()), text_size,
        -
        61  reinterpret_cast<uint8_t*>(string_as_array(crypt_text)),
        -
        62  &crypt_text_size))
        -
        63  return false;
        -
        64  DCHECK_LE(crypt_text_size, crypt_text->size());
        -
        65  crypt_text->resize(crypt_text_size);
        -
        66  return true;
        -
        67 }
        -
        68 
        -
        69 bool AesCryptor::SetIv(const std::vector<uint8_t>& iv) {
        -
        70  if (!IsIvSizeValid(iv.size())) {
        -
        71  LOG(ERROR) << "Invalid IV size: " << iv.size();
        -
        72  return false;
        -
        73  }
        -
        74  iv_ = iv;
        -
        75  num_crypt_bytes_ = 0;
        -
        76  SetIvInternal();
        -
        77  return true;
        -
        78 }
        -
        79 
        - -
        81  if (constant_iv_flag_ == kUseConstantIv)
        -
        82  return;
        -
        83 
        -
        84  uint64_t increment = 0;
        -
        85  // As recommended in ISO/IEC 23001-7:2016 CENC spec, for 64-bit (8-byte)
        -
        86  // IV_Sizes, initialization vectors for subsequent samples can be created by
        -
        87  // incrementing the initialization vector of the previous sample.
        -
        88  // For 128-bit (16-byte) IV_Sizes, initialization vectors for subsequent
        -
        89  // samples should be created by adding the block count of the previous sample
        -
        90  // to the initialization vector of the previous sample.
        -
        91  // There is no official recommendation of how IV for next sample should be
        -
        92  // generated for CBC mode. We use the same generation algorithm as CTR here.
        -
        93  if (iv_.size() == 8) {
        -
        94  increment = 1;
        -
        95  } else {
        -
        96  DCHECK_EQ(16u, iv_.size());
        -
        97  increment = (num_crypt_bytes_ + AES_BLOCK_SIZE - 1) / AES_BLOCK_SIZE;
        -
        98  }
        -
        99 
        -
        100  for (int i = iv_.size() - 1; increment > 0 && i >= 0; --i) {
        -
        101  increment += iv_[i];
        -
        102  iv_[i] = increment & 0xFF;
        -
        103  increment >>= 8;
        -
        104  }
        -
        105  num_crypt_bytes_ = 0;
        -
        106  SetIvInternal();
        -
        107 }
        -
        108 
        -
        109 bool AesCryptor::GenerateRandomIv(FourCC protection_scheme,
        -
        110  std::vector<uint8_t>* iv) {
        -
        111  // ISO/IEC 23001-7:2016 10.1 and 10.3 For 'cenc' and 'cens'
        -
        112  // default_Per_Sample_IV_Size and Per_Sample_IV_Size SHOULD be 8-bytes.
        -
        113  // There is no official guideline on the iv size for 'cbc1' and 'cbcs',
        -
        114  // but 16-byte provides better security.
        -
        115  const size_t iv_size =
        -
        116  (protection_scheme == FOURCC_cenc || protection_scheme == FOURCC_cens)
        -
        117  ? 8
        -
        118  : 16;
        -
        119  iv->resize(iv_size);
        -
        120  if (RAND_bytes(iv->data(), iv_size) != 1) {
        -
        121  LOG(ERROR) << "RAND_bytes failed with error: "
        -
        122  << ERR_error_string(ERR_get_error(), NULL);
        -
        123  return false;
        -
        124  }
        -
        125  return true;
        -
        126 }
        -
        127 
        -
        128 size_t AesCryptor::NumPaddingBytes(size_t size) const {
        -
        129  // No padding by default.
        -
        130  return 0;
        -
        131 }
        -
        132 
        -
        133 } // namespace media
        -
        134 } // namespace shaka
        -
        135 
        -
        136 
        - -
        AesCryptor(ConstantIvFlag constant_iv_flag)
        Definition: aes_cryptor.cc:32
        +
        17 
        +
        18 namespace {
        +
        19 
        +
        20 // According to ISO/IEC 23001-7:2016 CENC spec, IV should be either
        +
        21 // 64-bit (8-byte) or 128-bit (16-byte).
        +
        22 bool IsIvSizeValid(size_t iv_size) {
        +
        23  return iv_size == 8 || iv_size == 16;
        +
        24 }
        +
        25 
        +
        26 } // namespace
        +
        27 
        +
        28 namespace shaka {
        +
        29 namespace media {
        +
        30 
        +
        31 AesCryptor::AesCryptor(ConstantIvFlag constant_iv_flag)
        +
        32  : aes_key_(new AES_KEY),
        +
        33  constant_iv_flag_(constant_iv_flag),
        +
        34  num_crypt_bytes_(0) {}
        +
        35 
        +
        36 AesCryptor::~AesCryptor() {}
        +
        37 
        +
        38 bool AesCryptor::Crypt(const std::vector<uint8_t>& text,
        +
        39  std::vector<uint8_t>* crypt_text) {
        +
        40  // Save text size to make it work for in-place conversion, since the
        +
        41  // next statement will update the text size.
        +
        42  const size_t text_size = text.size();
        +
        43  crypt_text->resize(text_size + NumPaddingBytes(text_size));
        +
        44  size_t crypt_text_size = crypt_text->size();
        +
        45  if (!Crypt(text.data(), text_size, crypt_text->data(), &crypt_text_size)) {
        +
        46  return false;
        +
        47  }
        +
        48  DCHECK_LE(crypt_text_size, crypt_text->size());
        +
        49  crypt_text->resize(crypt_text_size);
        +
        50  return true;
        +
        51 }
        +
        52 
        +
        53 bool AesCryptor::Crypt(const std::string& text, std::string* crypt_text) {
        +
        54  // Save text size to make it work for in-place conversion, since the
        +
        55  // next statement will update the text size.
        +
        56  const size_t text_size = text.size();
        +
        57  crypt_text->resize(text_size + NumPaddingBytes(text_size));
        +
        58  size_t crypt_text_size = crypt_text->size();
        +
        59  if (!Crypt(reinterpret_cast<const uint8_t*>(text.data()), text_size,
        +
        60  reinterpret_cast<uint8_t*>(&(*crypt_text)[0]), &crypt_text_size))
        +
        61  return false;
        +
        62  DCHECK_LE(crypt_text_size, crypt_text->size());
        +
        63  crypt_text->resize(crypt_text_size);
        +
        64  return true;
        +
        65 }
        +
        66 
        +
        67 bool AesCryptor::SetIv(const std::vector<uint8_t>& iv) {
        +
        68  if (!IsIvSizeValid(iv.size())) {
        +
        69  LOG(ERROR) << "Invalid IV size: " << iv.size();
        +
        70  return false;
        +
        71  }
        +
        72  iv_ = iv;
        +
        73  num_crypt_bytes_ = 0;
        +
        74  SetIvInternal();
        +
        75  return true;
        +
        76 }
        +
        77 
        + +
        79  if (constant_iv_flag_ == kUseConstantIv)
        +
        80  return;
        +
        81 
        +
        82  uint64_t increment = 0;
        +
        83  // As recommended in ISO/IEC 23001-7:2016 CENC spec, for 64-bit (8-byte)
        +
        84  // IV_Sizes, initialization vectors for subsequent samples can be created by
        +
        85  // incrementing the initialization vector of the previous sample.
        +
        86  // For 128-bit (16-byte) IV_Sizes, initialization vectors for subsequent
        +
        87  // samples should be created by adding the block count of the previous sample
        +
        88  // to the initialization vector of the previous sample.
        +
        89  // There is no official recommendation of how IV for next sample should be
        +
        90  // generated for CBC mode. We use the same generation algorithm as CTR here.
        +
        91  if (iv_.size() == 8) {
        +
        92  increment = 1;
        +
        93  } else {
        +
        94  DCHECK_EQ(16u, iv_.size());
        +
        95  increment = (num_crypt_bytes_ + AES_BLOCK_SIZE - 1) / AES_BLOCK_SIZE;
        +
        96  }
        +
        97 
        +
        98  for (int i = iv_.size() - 1; increment > 0 && i >= 0; --i) {
        +
        99  increment += iv_[i];
        +
        100  iv_[i] = increment & 0xFF;
        +
        101  increment >>= 8;
        +
        102  }
        +
        103  num_crypt_bytes_ = 0;
        +
        104  SetIvInternal();
        +
        105 }
        +
        106 
        +
        107 bool AesCryptor::GenerateRandomIv(FourCC protection_scheme,
        +
        108  std::vector<uint8_t>* iv) {
        +
        109  // ISO/IEC 23001-7:2016 10.1 and 10.3 For 'cenc' and 'cens'
        +
        110  // default_Per_Sample_IV_Size and Per_Sample_IV_Size SHOULD be 8-bytes.
        +
        111  // There is no official guideline on the iv size for 'cbc1' and 'cbcs',
        +
        112  // but 16-byte provides better security.
        +
        113  const size_t iv_size =
        +
        114  (protection_scheme == FOURCC_cenc || protection_scheme == FOURCC_cens)
        +
        115  ? 8
        +
        116  : 16;
        +
        117  iv->resize(iv_size);
        +
        118  if (RAND_bytes(iv->data(), iv_size) != 1) {
        +
        119  LOG(ERROR) << "RAND_bytes failed with error: "
        +
        120  << ERR_error_string(ERR_get_error(), NULL);
        +
        121  return false;
        +
        122  }
        +
        123  return true;
        +
        124 }
        +
        125 
        +
        126 size_t AesCryptor::NumPaddingBytes(size_t size) const {
        +
        127  // No padding by default.
        +
        128  return 0;
        +
        129 }
        +
        130 
        +
        131 } // namespace media
        +
        132 } // namespace shaka
        + +
        AesCryptor(ConstantIvFlag constant_iv_flag)
        Definition: aes_cryptor.cc:31
        const std::vector< uint8_t > & iv() const
        Definition: aes_cryptor.h:81
        -
        static bool GenerateRandomIv(FourCC protection_scheme, std::vector< uint8_t > *iv)
        Definition: aes_cryptor.cc:109
        -
        bool SetIv(const std::vector< uint8_t > &iv)
        Definition: aes_cryptor.cc:69
        +
        static bool GenerateRandomIv(FourCC protection_scheme, std::vector< uint8_t > *iv)
        Definition: aes_cryptor.cc:107
        +
        bool SetIv(const std::vector< uint8_t > &iv)
        Definition: aes_cryptor.cc:67
        diff --git a/docs/d6/d57/classshaka_1_1media_1_1AVCDecoderConfigurationRecord.html b/docs/d6/d57/classshaka_1_1media_1_1AVCDecoderConfigurationRecord.html index f8d5902ec0..240c214095 100644 --- a/docs/d6/d57/classshaka_1_1media_1_1AVCDecoderConfigurationRecord.html +++ b/docs/d6/d57/classshaka_1_1media_1_1AVCDecoderConfigurationRecord.html @@ -244,7 +244,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 113d69bdd7..c70f5a4de0 100644 --- a/docs/d6/d59/protection__system__specific__info_8h_source.html +++ b/docs/d6/d59/protection__system__specific__info_8h_source.html @@ -163,7 +163,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 1b8ef9eec6..227b0e3f5c 100644 --- a/docs/d6/d60/classshaka_1_1media_1_1VPCodecConfigurationRecord-members.html +++ b/docs/d6/d60/classshaka_1_1media_1_1VPCodecConfigurationRecord-members.html @@ -134,7 +134,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/d6c/h26x__bit__reader_8cc_source.html b/docs/d6/d6c/h26x__bit__reader_8cc_source.html index 6288882c21..4b91428d41 100644 --- a/docs/d6/d6c/h26x__bit__reader_8cc_source.html +++ b/docs/d6/d6c/h26x__bit__reader_8cc_source.html @@ -259,7 +259,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/d6e/ts__section__pes_8cc_source.html b/docs/d6/d6e/ts__section__pes_8cc_source.html index 6a92eb6273..369b6ddc46 100644 --- a/docs/d6/d6e/ts__section__pes_8cc_source.html +++ b/docs/d6/d6e/ts__section__pes_8cc_source.html @@ -405,7 +405,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/d71/scoped__xml__ptr_8h_source.html b/docs/d6/d71/scoped__xml__ptr_8h_source.html index 0442dd9200..c9a17da2ae 100644 --- a/docs/d6/d71/scoped__xml__ptr_8h_source.html +++ b/docs/d6/d71/scoped__xml__ptr_8h_source.html @@ -132,7 +132,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/d77/dash__iop__mpd__notifier_8h_source.html b/docs/d6/d77/dash__iop__mpd__notifier_8h_source.html index 16176d19e3..549c186bb4 100644 --- a/docs/d6/d77/dash__iop__mpd__notifier_8h_source.html +++ b/docs/d6/d77/dash__iop__mpd__notifier_8h_source.html @@ -193,24 +193,24 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
        114 } // namespace shaka
        115 
        116 #endif // MPD_BASE_DASH_IOP_MPD_NOTIFIER_H_
        - -
        bool NotifyNewSegment(uint32_t id, uint64_t start_time, uint64_t duration, uint64_t size) override
        -
        bool NotifyEncryptionUpdate(uint32_t container_id, const std::string &drm_uuid, const std::vector< uint8_t > &new_key_id, const std::vector< uint8_t > &new_pssh) override
        - -
        This class generates DASH MPDs (Media Presentation Descriptions).
        Definition: mpd_builder.h:58
        + +
        bool NotifyNewSegment(uint32_t id, uint64_t start_time, uint64_t duration, uint64_t size) override
        +
        bool NotifyEncryptionUpdate(uint32_t container_id, const std::string &drm_uuid, const std::vector< uint8_t > &new_key_id, const std::vector< uint8_t > &new_pssh) override
        + +
        This class generates DASH MPDs (Media Presentation Descriptions).
        Definition: mpd_builder.h:57
        -
        bool NotifySampleDuration(uint32_t container_id, uint32_t sample_duration) override
        +
        bool NotifySampleDuration(uint32_t container_id, uint32_t sample_duration) override
        DashProfile dash_profile() const
        Definition: mpd_notifier.h:108
        -
        bool AddContentProtectionElement(uint32_t id, const ContentProtectionElement &content_protection_element) override
        +
        bool AddContentProtectionElement(uint32_t id, const ContentProtectionElement &content_protection_element) override
        Defines Mpd Options.
        Definition: mpd_options.h:15
        - -
        bool NotifyNewContainer(const MediaInfo &media_info, uint32_t *id) override
        + +
        bool NotifyNewContainer(const MediaInfo &media_info, uint32_t *id) override
        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 62e9412d88..c381247862 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 @@ -173,7 +173,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 e918c5f089..456df3929a 100644 --- a/docs/d6/d7b/webm__tracks__parser_8h_source.html +++ b/docs/d6/d7b/webm__tracks__parser_8h_source.html @@ -201,7 +201,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 02da8ae53f..30b91c70e7 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 @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/d86/bandwidth__estimator_8cc_source.html b/docs/d6/d86/bandwidth__estimator_8cc_source.html index abd38b989a..7f4eb0c933 100644 --- a/docs/d6/d86/bandwidth__estimator_8cc_source.html +++ b/docs/d6/d86/bandwidth__estimator_8cc_source.html @@ -154,7 +154,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/d8a/vp9__parser_8cc_source.html b/docs/d6/d8a/vp9__parser_8cc_source.html index f75fc16a6b..44fba99072 100644 --- a/docs/d6/d8a/vp9__parser_8cc_source.html +++ b/docs/d6/d8a/vp9__parser_8cc_source.html @@ -660,7 +660,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 3168578066..4f4e88f910 100644 --- a/docs/d6/d8f/classshaka_1_1xml_1_1RepresentationBaseXmlNode-members.html +++ b/docs/d6/d8f/classshaka_1_1xml_1_1RepresentationBaseXmlNode-members.html @@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/d9b/h264__parser_8h_source.html b/docs/d6/d9b/h264__parser_8h_source.html index 3551d201ff..59f1f2b18a 100644 --- a/docs/d6/d9b/h264__parser_8h_source.html +++ b/docs/d6/d9b/h264__parser_8h_source.html @@ -100,346 +100,347 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
        11 #include <stdlib.h>
        12 
        13 #include <map>
        -
        14 
        -
        15 #include "packager/media/codecs/h26x_bit_reader.h"
        -
        16 #include "packager/media/codecs/nalu_reader.h"
        -
        17 
        -
        18 namespace shaka {
        -
        19 namespace media {
        -
        20 
        -
        21 // On success, |coded_width| and |coded_height| contains coded resolution after
        -
        22 // cropping; |pixel_width:pixel_height| contains pixel aspect ratio, 1:1 is
        -
        23 // assigned if it is not present in SPS.
        -
        24 struct H264Sps;
        -
        25 bool ExtractResolutionFromSps(const H264Sps& sps,
        -
        26  uint32_t* coded_width,
        -
        27  uint32_t* coded_height,
        -
        28  uint32_t* pixel_width,
        -
        29  uint32_t* pixel_height);
        -
        30 
        -
        31 enum {
        -
        32  kH264ScalingList4x4Length = 16,
        -
        33  kH264ScalingList8x8Length = 64,
        -
        34 };
        -
        35 
        -
        36 struct H264Sps {
        -
        37  H264Sps();
        -
        38 
        -
        39  int profile_idc;
        -
        40  bool constraint_set0_flag;
        -
        41  bool constraint_set1_flag;
        -
        42  bool constraint_set2_flag;
        -
        43  bool constraint_set3_flag;
        -
        44  bool constraint_set4_flag;
        -
        45  bool constraint_set5_flag;
        -
        46  int level_idc;
        -
        47  int seq_parameter_set_id;
        -
        48 
        -
        49  int chroma_format_idc;
        -
        50  bool separate_colour_plane_flag;
        -
        51  int bit_depth_luma_minus8;
        -
        52  int bit_depth_chroma_minus8;
        -
        53  bool qpprime_y_zero_transform_bypass_flag;
        -
        54 
        -
        55  bool seq_scaling_matrix_present_flag;
        -
        56  int scaling_list4x4[6][kH264ScalingList4x4Length];
        -
        57  int scaling_list8x8[6][kH264ScalingList8x8Length];
        -
        58 
        -
        59  int log2_max_frame_num_minus4;
        -
        60  int pic_order_cnt_type;
        -
        61  int log2_max_pic_order_cnt_lsb_minus4;
        -
        62  bool delta_pic_order_always_zero_flag;
        -
        63  int offset_for_non_ref_pic;
        -
        64  int offset_for_top_to_bottom_field;
        -
        65  int num_ref_frames_in_pic_order_cnt_cycle;
        -
        66  int expected_delta_per_pic_order_cnt_cycle; // calculated
        -
        67  int offset_for_ref_frame[255];
        -
        68  int max_num_ref_frames;
        -
        69  bool gaps_in_frame_num_value_allowed_flag;
        -
        70  int pic_width_in_mbs_minus1;
        -
        71  int pic_height_in_map_units_minus1;
        -
        72  bool frame_mbs_only_flag;
        -
        73  bool mb_adaptive_frame_field_flag;
        -
        74  bool direct_8x8_inference_flag;
        -
        75  bool frame_cropping_flag;
        -
        76  int frame_crop_left_offset;
        -
        77  int frame_crop_right_offset;
        -
        78  int frame_crop_top_offset;
        -
        79  int frame_crop_bottom_offset;
        -
        80 
        -
        81  bool vui_parameters_present_flag;
        -
        82  int sar_width; // Set to 0 when not specified.
        -
        83  int sar_height; // Set to 0 when not specified.
        -
        84  bool bitstream_restriction_flag;
        -
        85  int max_num_reorder_frames;
        -
        86  int max_dec_frame_buffering;
        -
        87 
        -
        88  int chroma_array_type;
        -
        89 };
        -
        90 
        -
        91 struct H264Pps {
        -
        92  H264Pps();
        -
        93 
        -
        94  int pic_parameter_set_id;
        -
        95  int seq_parameter_set_id;
        -
        96  bool entropy_coding_mode_flag;
        -
        97  bool bottom_field_pic_order_in_frame_present_flag;
        -
        98  int num_slice_groups_minus1;
        -
        99  int num_ref_idx_l0_default_active_minus1;
        -
        100  int num_ref_idx_l1_default_active_minus1;
        -
        101  bool weighted_pred_flag;
        -
        102  int weighted_bipred_idc;
        -
        103  int pic_init_qp_minus26;
        -
        104  int pic_init_qs_minus26;
        -
        105  int chroma_qp_index_offset;
        -
        106  bool deblocking_filter_control_present_flag;
        -
        107  bool constrained_intra_pred_flag;
        -
        108  bool redundant_pic_cnt_present_flag;
        -
        109  bool transform_8x8_mode_flag;
        -
        110 
        -
        111  bool pic_scaling_matrix_present_flag;
        -
        112  int scaling_list4x4[6][kH264ScalingList4x4Length];
        -
        113  int scaling_list8x8[6][kH264ScalingList8x8Length];
        -
        114 
        -
        115  int second_chroma_qp_index_offset;
        -
        116 };
        -
        117 
        - -
        119  int modification_of_pic_nums_idc;
        -
        120  union {
        -
        121  int abs_diff_pic_num_minus1;
        -
        122  int long_term_pic_num;
        -
        123  };
        -
        124 };
        -
        125 
        - -
        127  bool luma_weight_flag;
        -
        128  bool chroma_weight_flag;
        -
        129  int luma_weight[32];
        -
        130  int luma_offset[32];
        -
        131  int chroma_weight[32][2];
        -
        132  int chroma_offset[32][2];
        -
        133 };
        -
        134 
        - -
        136  int memory_mgmnt_control_operation;
        -
        137  int difference_of_pic_nums_minus1;
        -
        138  int long_term_pic_num;
        -
        139  int long_term_frame_idx;
        -
        140  int max_long_term_frame_idx_plus1;
        -
        141 };
        -
        142 
        - -
        144  H264SliceHeader();
        -
        145 
        -
        146  enum {
        -
        147  kRefListSize = 32,
        -
        148  kRefListModSize = kRefListSize
        -
        149  };
        -
        150 
        -
        151  enum Type {
        -
        152  kPSlice = 0,
        -
        153  kBSlice = 1,
        -
        154  kISlice = 2,
        -
        155  kSPSlice = 3,
        -
        156  kSISlice = 4,
        -
        157  };
        -
        158 
        -
        159  bool IsPSlice() const;
        -
        160  bool IsBSlice() const;
        -
        161  bool IsISlice() const;
        -
        162  bool IsSPSlice() const;
        -
        163  bool IsSISlice() const;
        -
        164 
        -
        165  bool idr_pic_flag; // from NAL header
        -
        166  int nal_ref_idc; // from NAL header
        -
        167  const uint8_t* nalu_data; // from NAL header
        -
        168  off_t nalu_size; // from NAL header
        -
        169  off_t header_bit_size; // calculated
        -
        170 
        -
        171  int first_mb_in_slice;
        -
        172  int slice_type;
        -
        173  int pic_parameter_set_id;
        -
        174  int colour_plane_id;
        -
        175  int frame_num;
        -
        176  bool field_pic_flag;
        -
        177  bool bottom_field_flag;
        -
        178  int idr_pic_id;
        -
        179  int pic_order_cnt_lsb;
        -
        180  int delta_pic_order_cnt_bottom;
        -
        181  int delta_pic_order_cnt[2];
        -
        182  int redundant_pic_cnt;
        -
        183  bool direct_spatial_mv_pred_flag;
        -
        184 
        -
        185  bool num_ref_idx_active_override_flag;
        -
        186  int num_ref_idx_l0_active_minus1;
        -
        187  int num_ref_idx_l1_active_minus1;
        -
        188  bool ref_pic_list_modification_flag_l0;
        -
        189  bool ref_pic_list_modification_flag_l1;
        -
        190  H264ModificationOfPicNum ref_list_l0_modifications[kRefListModSize];
        -
        191  H264ModificationOfPicNum ref_list_l1_modifications[kRefListModSize];
        -
        192 
        -
        193  int luma_log2_weight_denom;
        -
        194  int chroma_log2_weight_denom;
        -
        195 
        -
        196  bool luma_weight_l0_flag;
        -
        197  bool chroma_weight_l0_flag;
        -
        198  H264WeightingFactors pred_weight_table_l0;
        -
        199 
        -
        200  bool luma_weight_l1_flag;
        -
        201  bool chroma_weight_l1_flag;
        -
        202  H264WeightingFactors pred_weight_table_l1;
        -
        203 
        -
        204  bool no_output_of_prior_pics_flag;
        -
        205  bool long_term_reference_flag;
        -
        206 
        -
        207  bool adaptive_ref_pic_marking_mode_flag;
        -
        208  H264DecRefPicMarking ref_pic_marking[kRefListSize];
        -
        209 
        -
        210  int cabac_init_idc;
        -
        211  int slice_qp_delta;
        -
        212  bool sp_for_switch_flag;
        -
        213  int slice_qs_delta;
        -
        214  int disable_deblocking_filter_idc;
        -
        215  int slice_alpha_c0_offset_div2;
        -
        216  int slice_beta_offset_div2;
        -
        217 };
        -
        218 
        - -
        220  int recovery_frame_cnt;
        -
        221  bool exact_match_flag;
        -
        222  bool broken_link_flag;
        -
        223  int changing_slice_group_idc;
        -
        224 };
        -
        225 
        - -
        227  H264SEIMessage();
        -
        228 
        -
        229  enum Type {
        -
        230  kSEIRecoveryPoint = 6,
        -
        231  };
        -
        232 
        -
        233  int type;
        -
        234  int payload_size;
        -
        235  union {
        -
        236  // Placeholder; in future more supported types will contribute to more
        -
        237  // union members here.
        -
        238  H264SEIRecoveryPoint recovery_point;
        -
        239  };
        -
        240 };
        -
        241 
        -
        242 // Class to parse an Annex-B H.264 stream,
        -
        243 // as specified in chapters 7 and Annex B of the H.264 spec.
        -
        244 class H264Parser {
        -
        245  public:
        -
        246  enum Result {
        -
        247  kOk,
        -
        248  kInvalidStream, // error in stream
        -
        249  kUnsupportedStream, // stream not supported by the parser
        -
        250  kEOStream, // end of stream
        -
        251  };
        -
        252 
        -
        253  H264Parser();
        -
        254  ~H264Parser();
        -
        255 
        -
        256  // NALU-specific parsing functions.
        -
        257 
        -
        258  // SPSes and PPSes are owned by the parser class and the memory for their
        -
        259  // structures is managed here, not by the caller, as they are reused
        -
        260  // across NALUs.
        -
        261  //
        -
        262  // Parse an SPS/PPS NALU and save their data in the parser, returning id
        -
        263  // of the parsed structure in |*pps_id|/|*sps_id|.
        -
        264  // To get a pointer to a given SPS/PPS structure, use GetSps()/GetPps(),
        -
        265  // passing the returned |*sps_id|/|*pps_id| as parameter.
        -
        266  Result ParseSps(const Nalu& nalu, int* sps_id);
        -
        267  Result ParsePps(const Nalu& nalu, int* pps_id);
        -
        268 
        -
        269  // Return a pointer to SPS/PPS with given |sps_id|/|pps_id| or NULL if not
        -
        270  // present.
        -
        271  const H264Sps* GetSps(int sps_id);
        -
        272  const H264Pps* GetPps(int pps_id);
        -
        273 
        -
        274  // Slice headers and SEI messages are not used across NALUs by the parser
        -
        275  // and can be discarded after current NALU, so the parser does not store
        -
        276  // them, nor does it manage their memory.
        -
        277  // The caller has to provide and manage it instead.
        -
        278 
        -
        279  // Parse a slice header, returning it in |*shdr|. |*nalu| must be set to
        -
        280  // the NALU returned from AdvanceToNextNALU() and corresponding to |*shdr|.
        -
        281  Result ParseSliceHeader(const Nalu& nalu, H264SliceHeader* shdr);
        -
        282 
        -
        283  // Parse a SEI message, returning it in |*sei_msg|, provided and managed
        -
        284  // by the caller.
        -
        285  Result ParseSEI(const Nalu& nalu, H264SEIMessage* sei_msg);
        -
        286 
        -
        287  private:
        -
        288  // Parse scaling lists (see spec).
        -
        289  Result ParseScalingList(H26xBitReader* br,
        -
        290  int size,
        -
        291  int* scaling_list,
        -
        292  bool* use_default);
        -
        293  Result ParseSpsScalingLists(H26xBitReader* br, H264Sps* sps);
        -
        294  Result ParsePpsScalingLists(H26xBitReader* br,
        -
        295  const H264Sps& sps,
        -
        296  H264Pps* pps);
        -
        297 
        -
        298  // Parse optional VUI parameters in SPS (see spec).
        -
        299  Result ParseVUIParameters(H26xBitReader* br, H264Sps* sps);
        -
        300  // Set |hrd_parameters_present| to true only if they are present.
        -
        301  Result ParseAndIgnoreHRDParameters(H26xBitReader* br,
        -
        302  bool* hrd_parameters_present);
        -
        303 
        -
        304  // Parse reference picture lists' modifications (see spec).
        -
        305  Result ParseRefPicListModifications(H26xBitReader* br, H264SliceHeader* shdr);
        -
        306  Result ParseRefPicListModification(H26xBitReader* br,
        -
        307  int num_ref_idx_active_minus1,
        -
        308  H264ModificationOfPicNum* ref_list_mods);
        -
        309 
        -
        310  // Parse prediction weight table (see spec).
        -
        311  Result ParsePredWeightTable(H26xBitReader* br,
        -
        312  const H264Sps& sps,
        -
        313  H264SliceHeader* shdr);
        -
        314 
        -
        315  // Parse weighting factors (see spec).
        -
        316  Result ParseWeightingFactors(H26xBitReader* br,
        -
        317  int num_ref_idx_active_minus1,
        -
        318  int chroma_array_type,
        -
        319  int luma_log2_weight_denom,
        -
        320  int chroma_log2_weight_denom,
        -
        321  H264WeightingFactors* w_facts);
        -
        322 
        -
        323  // Parse decoded reference picture marking information (see spec).
        -
        324  Result ParseDecRefPicMarking(H26xBitReader* br, H264SliceHeader* shdr);
        -
        325 
        -
        326  // PPSes and SPSes stored for future reference.
        -
        327  typedef std::map<int, H264Sps*> SpsById;
        -
        328  typedef std::map<int, H264Pps*> PpsById;
        -
        329  SpsById active_SPSes_;
        -
        330  PpsById active_PPSes_;
        -
        331 
        -
        332  DISALLOW_COPY_AND_ASSIGN(H264Parser);
        -
        333 };
        -
        334 
        -
        335 } // namespace media
        -
        336 } // namespace shaka
        -
        337 
        -
        338 #endif // MEDIA_CODECS_H264_PARSER_H_
        - - - - - - - - +
        14 #include <memory>
        +
        15 
        +
        16 #include "packager/media/codecs/h26x_bit_reader.h"
        +
        17 #include "packager/media/codecs/nalu_reader.h"
        +
        18 
        +
        19 namespace shaka {
        +
        20 namespace media {
        +
        21 
        +
        22 // On success, |coded_width| and |coded_height| contains coded resolution after
        +
        23 // cropping; |pixel_width:pixel_height| contains pixel aspect ratio, 1:1 is
        +
        24 // assigned if it is not present in SPS.
        +
        25 struct H264Sps;
        +
        26 bool ExtractResolutionFromSps(const H264Sps& sps,
        +
        27  uint32_t* coded_width,
        +
        28  uint32_t* coded_height,
        +
        29  uint32_t* pixel_width,
        +
        30  uint32_t* pixel_height);
        +
        31 
        +
        32 enum {
        +
        33  kH264ScalingList4x4Length = 16,
        +
        34  kH264ScalingList8x8Length = 64,
        +
        35 };
        +
        36 
        +
        37 struct H264Sps {
        +
        38  H264Sps();
        +
        39 
        +
        40  int profile_idc;
        +
        41  bool constraint_set0_flag;
        +
        42  bool constraint_set1_flag;
        +
        43  bool constraint_set2_flag;
        +
        44  bool constraint_set3_flag;
        +
        45  bool constraint_set4_flag;
        +
        46  bool constraint_set5_flag;
        +
        47  int level_idc;
        +
        48  int seq_parameter_set_id;
        +
        49 
        +
        50  int chroma_format_idc;
        +
        51  bool separate_colour_plane_flag;
        +
        52  int bit_depth_luma_minus8;
        +
        53  int bit_depth_chroma_minus8;
        +
        54  bool qpprime_y_zero_transform_bypass_flag;
        +
        55 
        +
        56  bool seq_scaling_matrix_present_flag;
        +
        57  int scaling_list4x4[6][kH264ScalingList4x4Length];
        +
        58  int scaling_list8x8[6][kH264ScalingList8x8Length];
        +
        59 
        +
        60  int log2_max_frame_num_minus4;
        +
        61  int pic_order_cnt_type;
        +
        62  int log2_max_pic_order_cnt_lsb_minus4;
        +
        63  bool delta_pic_order_always_zero_flag;
        +
        64  int offset_for_non_ref_pic;
        +
        65  int offset_for_top_to_bottom_field;
        +
        66  int num_ref_frames_in_pic_order_cnt_cycle;
        +
        67  int expected_delta_per_pic_order_cnt_cycle; // calculated
        +
        68  int offset_for_ref_frame[255];
        +
        69  int max_num_ref_frames;
        +
        70  bool gaps_in_frame_num_value_allowed_flag;
        +
        71  int pic_width_in_mbs_minus1;
        +
        72  int pic_height_in_map_units_minus1;
        +
        73  bool frame_mbs_only_flag;
        +
        74  bool mb_adaptive_frame_field_flag;
        +
        75  bool direct_8x8_inference_flag;
        +
        76  bool frame_cropping_flag;
        +
        77  int frame_crop_left_offset;
        +
        78  int frame_crop_right_offset;
        +
        79  int frame_crop_top_offset;
        +
        80  int frame_crop_bottom_offset;
        +
        81 
        +
        82  bool vui_parameters_present_flag;
        +
        83  int sar_width; // Set to 0 when not specified.
        +
        84  int sar_height; // Set to 0 when not specified.
        +
        85  bool bitstream_restriction_flag;
        +
        86  int max_num_reorder_frames;
        +
        87  int max_dec_frame_buffering;
        +
        88 
        +
        89  int chroma_array_type;
        +
        90 };
        +
        91 
        +
        92 struct H264Pps {
        +
        93  H264Pps();
        +
        94 
        +
        95  int pic_parameter_set_id;
        +
        96  int seq_parameter_set_id;
        +
        97  bool entropy_coding_mode_flag;
        +
        98  bool bottom_field_pic_order_in_frame_present_flag;
        +
        99  int num_slice_groups_minus1;
        +
        100  int num_ref_idx_l0_default_active_minus1;
        +
        101  int num_ref_idx_l1_default_active_minus1;
        +
        102  bool weighted_pred_flag;
        +
        103  int weighted_bipred_idc;
        +
        104  int pic_init_qp_minus26;
        +
        105  int pic_init_qs_minus26;
        +
        106  int chroma_qp_index_offset;
        +
        107  bool deblocking_filter_control_present_flag;
        +
        108  bool constrained_intra_pred_flag;
        +
        109  bool redundant_pic_cnt_present_flag;
        +
        110  bool transform_8x8_mode_flag;
        +
        111 
        +
        112  bool pic_scaling_matrix_present_flag;
        +
        113  int scaling_list4x4[6][kH264ScalingList4x4Length];
        +
        114  int scaling_list8x8[6][kH264ScalingList8x8Length];
        +
        115 
        +
        116  int second_chroma_qp_index_offset;
        +
        117 };
        +
        118 
        + +
        120  int modification_of_pic_nums_idc;
        +
        121  union {
        +
        122  int abs_diff_pic_num_minus1;
        +
        123  int long_term_pic_num;
        +
        124  };
        +
        125 };
        +
        126 
        + +
        128  bool luma_weight_flag;
        +
        129  bool chroma_weight_flag;
        +
        130  int luma_weight[32];
        +
        131  int luma_offset[32];
        +
        132  int chroma_weight[32][2];
        +
        133  int chroma_offset[32][2];
        +
        134 };
        +
        135 
        + +
        137  int memory_mgmnt_control_operation;
        +
        138  int difference_of_pic_nums_minus1;
        +
        139  int long_term_pic_num;
        +
        140  int long_term_frame_idx;
        +
        141  int max_long_term_frame_idx_plus1;
        +
        142 };
        +
        143 
        + +
        145  H264SliceHeader();
        +
        146 
        +
        147  enum {
        +
        148  kRefListSize = 32,
        +
        149  kRefListModSize = kRefListSize
        +
        150  };
        +
        151 
        +
        152  enum Type {
        +
        153  kPSlice = 0,
        +
        154  kBSlice = 1,
        +
        155  kISlice = 2,
        +
        156  kSPSlice = 3,
        +
        157  kSISlice = 4,
        +
        158  };
        +
        159 
        +
        160  bool IsPSlice() const;
        +
        161  bool IsBSlice() const;
        +
        162  bool IsISlice() const;
        +
        163  bool IsSPSlice() const;
        +
        164  bool IsSISlice() const;
        +
        165 
        +
        166  bool idr_pic_flag; // from NAL header
        +
        167  int nal_ref_idc; // from NAL header
        +
        168  const uint8_t* nalu_data; // from NAL header
        +
        169  off_t nalu_size; // from NAL header
        +
        170  off_t header_bit_size; // calculated
        +
        171 
        +
        172  int first_mb_in_slice;
        +
        173  int slice_type;
        +
        174  int pic_parameter_set_id;
        +
        175  int colour_plane_id;
        +
        176  int frame_num;
        +
        177  bool field_pic_flag;
        +
        178  bool bottom_field_flag;
        +
        179  int idr_pic_id;
        +
        180  int pic_order_cnt_lsb;
        +
        181  int delta_pic_order_cnt_bottom;
        +
        182  int delta_pic_order_cnt[2];
        +
        183  int redundant_pic_cnt;
        +
        184  bool direct_spatial_mv_pred_flag;
        +
        185 
        +
        186  bool num_ref_idx_active_override_flag;
        +
        187  int num_ref_idx_l0_active_minus1;
        +
        188  int num_ref_idx_l1_active_minus1;
        +
        189  bool ref_pic_list_modification_flag_l0;
        +
        190  bool ref_pic_list_modification_flag_l1;
        +
        191  H264ModificationOfPicNum ref_list_l0_modifications[kRefListModSize];
        +
        192  H264ModificationOfPicNum ref_list_l1_modifications[kRefListModSize];
        +
        193 
        +
        194  int luma_log2_weight_denom;
        +
        195  int chroma_log2_weight_denom;
        +
        196 
        +
        197  bool luma_weight_l0_flag;
        +
        198  bool chroma_weight_l0_flag;
        +
        199  H264WeightingFactors pred_weight_table_l0;
        +
        200 
        +
        201  bool luma_weight_l1_flag;
        +
        202  bool chroma_weight_l1_flag;
        +
        203  H264WeightingFactors pred_weight_table_l1;
        +
        204 
        +
        205  bool no_output_of_prior_pics_flag;
        +
        206  bool long_term_reference_flag;
        +
        207 
        +
        208  bool adaptive_ref_pic_marking_mode_flag;
        +
        209  H264DecRefPicMarking ref_pic_marking[kRefListSize];
        +
        210 
        +
        211  int cabac_init_idc;
        +
        212  int slice_qp_delta;
        +
        213  bool sp_for_switch_flag;
        +
        214  int slice_qs_delta;
        +
        215  int disable_deblocking_filter_idc;
        +
        216  int slice_alpha_c0_offset_div2;
        +
        217  int slice_beta_offset_div2;
        +
        218 };
        +
        219 
        + +
        221  int recovery_frame_cnt;
        +
        222  bool exact_match_flag;
        +
        223  bool broken_link_flag;
        +
        224  int changing_slice_group_idc;
        +
        225 };
        +
        226 
        + +
        228  H264SEIMessage();
        +
        229 
        +
        230  enum Type {
        +
        231  kSEIRecoveryPoint = 6,
        +
        232  };
        +
        233 
        +
        234  int type;
        +
        235  int payload_size;
        +
        236  union {
        +
        237  // Placeholder; in future more supported types will contribute to more
        +
        238  // union members here.
        +
        239  H264SEIRecoveryPoint recovery_point;
        +
        240  };
        +
        241 };
        +
        242 
        +
        243 // Class to parse an Annex-B H.264 stream,
        +
        244 // as specified in chapters 7 and Annex B of the H.264 spec.
        +
        245 class H264Parser {
        +
        246  public:
        +
        247  enum Result {
        +
        248  kOk,
        +
        249  kInvalidStream, // error in stream
        +
        250  kUnsupportedStream, // stream not supported by the parser
        +
        251  kEOStream, // end of stream
        +
        252  };
        +
        253 
        +
        254  H264Parser();
        +
        255  ~H264Parser();
        +
        256 
        +
        257  // NALU-specific parsing functions.
        +
        258 
        +
        259  // SPSes and PPSes are owned by the parser class and the memory for their
        +
        260  // structures is managed here, not by the caller, as they are reused
        +
        261  // across NALUs.
        +
        262  //
        +
        263  // Parse an SPS/PPS NALU and save their data in the parser, returning id
        +
        264  // of the parsed structure in |*pps_id|/|*sps_id|.
        +
        265  // To get a pointer to a given SPS/PPS structure, use GetSps()/GetPps(),
        +
        266  // passing the returned |*sps_id|/|*pps_id| as parameter.
        +
        267  Result ParseSps(const Nalu& nalu, int* sps_id);
        +
        268  Result ParsePps(const Nalu& nalu, int* pps_id);
        +
        269 
        +
        270  // Return a pointer to SPS/PPS with given |sps_id|/|pps_id| or NULL if not
        +
        271  // present.
        +
        272  const H264Sps* GetSps(int sps_id);
        +
        273  const H264Pps* GetPps(int pps_id);
        +
        274 
        +
        275  // Slice headers and SEI messages are not used across NALUs by the parser
        +
        276  // and can be discarded after current NALU, so the parser does not store
        +
        277  // them, nor does it manage their memory.
        +
        278  // The caller has to provide and manage it instead.
        +
        279 
        +
        280  // Parse a slice header, returning it in |*shdr|. |*nalu| must be set to
        +
        281  // the NALU returned from AdvanceToNextNALU() and corresponding to |*shdr|.
        +
        282  Result ParseSliceHeader(const Nalu& nalu, H264SliceHeader* shdr);
        +
        283 
        +
        284  // Parse a SEI message, returning it in |*sei_msg|, provided and managed
        +
        285  // by the caller.
        +
        286  Result ParseSEI(const Nalu& nalu, H264SEIMessage* sei_msg);
        +
        287 
        +
        288  private:
        +
        289  // Parse scaling lists (see spec).
        +
        290  Result ParseScalingList(H26xBitReader* br,
        +
        291  int size,
        +
        292  int* scaling_list,
        +
        293  bool* use_default);
        +
        294  Result ParseSpsScalingLists(H26xBitReader* br, H264Sps* sps);
        +
        295  Result ParsePpsScalingLists(H26xBitReader* br,
        +
        296  const H264Sps& sps,
        +
        297  H264Pps* pps);
        +
        298 
        +
        299  // Parse optional VUI parameters in SPS (see spec).
        +
        300  Result ParseVUIParameters(H26xBitReader* br, H264Sps* sps);
        +
        301  // Set |hrd_parameters_present| to true only if they are present.
        +
        302  Result ParseAndIgnoreHRDParameters(H26xBitReader* br,
        +
        303  bool* hrd_parameters_present);
        +
        304 
        +
        305  // Parse reference picture lists' modifications (see spec).
        +
        306  Result ParseRefPicListModifications(H26xBitReader* br, H264SliceHeader* shdr);
        +
        307  Result ParseRefPicListModification(H26xBitReader* br,
        +
        308  int num_ref_idx_active_minus1,
        +
        309  H264ModificationOfPicNum* ref_list_mods);
        +
        310 
        +
        311  // Parse prediction weight table (see spec).
        +
        312  Result ParsePredWeightTable(H26xBitReader* br,
        +
        313  const H264Sps& sps,
        +
        314  H264SliceHeader* shdr);
        +
        315 
        +
        316  // Parse weighting factors (see spec).
        +
        317  Result ParseWeightingFactors(H26xBitReader* br,
        +
        318  int num_ref_idx_active_minus1,
        +
        319  int chroma_array_type,
        +
        320  int luma_log2_weight_denom,
        +
        321  int chroma_log2_weight_denom,
        +
        322  H264WeightingFactors* w_facts);
        +
        323 
        +
        324  // Parse decoded reference picture marking information (see spec).
        +
        325  Result ParseDecRefPicMarking(H26xBitReader* br, H264SliceHeader* shdr);
        +
        326 
        +
        327  // PPSes and SPSes stored for future reference.
        +
        328  typedef std::map<int, std::unique_ptr<H264Sps>> SpsById;
        +
        329  typedef std::map<int, std::unique_ptr<H264Pps>> PpsById;
        +
        330  SpsById active_SPSes_;
        +
        331  PpsById active_PPSes_;
        +
        332 
        +
        333  DISALLOW_COPY_AND_ASSIGN(H264Parser);
        +
        334 };
        +
        335 
        +
        336 } // namespace media
        +
        337 } // namespace shaka
        +
        338 
        +
        339 #endif // MEDIA_CODECS_H264_PARSER_H_
        + + + + + + + + - + diff --git a/docs/d6/d9f/hls__flags_8cc_source.html b/docs/d6/d9f/hls__flags_8cc_source.html index 943749244a..239c498d5a 100644 --- a/docs/d6/d9f/hls__flags_8cc_source.html +++ b/docs/d6/d9f/hls__flags_8cc_source.html @@ -107,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/da0/ts__section__pat_8h_source.html b/docs/d6/da0/ts__section__pat_8h_source.html index f29cc17ccc..09cc75822b 100644 --- a/docs/d6/da0/ts__section__pat_8h_source.html +++ b/docs/d6/da0/ts__section__pat_8h_source.html @@ -135,7 +135,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/da3/mpd__builder_8h_source.html b/docs/d6/da3/mpd__builder_8h_source.html index c5b5fb1b1b..8a7ed7b0a5 100644 --- a/docs/d6/da3/mpd__builder_8h_source.html +++ b/docs/d6/da3/mpd__builder_8h_source.html @@ -111,430 +111,427 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
        25 #include "packager/base/atomic_sequence_num.h"
        26 #include "packager/base/callback.h"
        27 #include "packager/base/gtest_prod_util.h"
        -
        28 #include "packager/base/stl_util.h"
        -
        29 #include "packager/base/time/clock.h"
        -
        30 #include "packager/base/time/time.h"
        -
        31 #include "packager/mpd/base/bandwidth_estimator.h"
        -
        32 #include "packager/mpd/base/content_protection_element.h"
        -
        33 #include "packager/mpd/base/media_info.pb.h"
        -
        34 #include "packager/mpd/base/mpd_options.h"
        -
        35 #include "packager/mpd/base/segment_info.h"
        -
        36 #include "packager/mpd/base/xml/scoped_xml_ptr.h"
        -
        37 
        -
        38 // TODO(rkuroiwa): For classes with |id_|, consider removing the field and let
        -
        39 // the MPD (XML) generation functions take care of assigning an ID to each
        -
        40 // element.
        -
        41 namespace shaka {
        -
        42 
        -
        43 namespace media {
        -
        44 class File;
        -
        45 } // namespace media
        -
        46 
        -
        47 class AdaptationSet;
        -
        48 class Representation;
        -
        49 
        -
        50 namespace xml {
        -
        51 
        -
        52 class XmlNode;
        -
        53 class RepresentationXmlNode;
        -
        54 
        -
        55 } // namespace xml
        -
        56 
        -
        58 class MpdBuilder {
        -
        59  public:
        -
        60  enum MpdType {
        -
        61  kStatic = 0,
        -
        62  kDynamic
        -
        63  };
        -
        64 
        -
        68  MpdBuilder(MpdType type, const MpdOptions& mpd_options);
        -
        69  virtual ~MpdBuilder();
        -
        70 
        -
        73  void AddBaseUrl(const std::string& base_url);
        -
        74 
        -
        79  virtual AdaptationSet* AddAdaptationSet(const std::string& lang);
        -
        80 
        -
        85  bool WriteMpdToFile(media::File* output_file);
        -
        86 
        -
        90  virtual bool ToString(std::string* output);
        -
        91 
        -
        93  MpdType type() const { return type_; }
        -
        94 
        -
        100  static void MakePathsRelativeToMpd(const std::string& mpd_path,
        -
        101  MediaInfo* media_info);
        -
        102 
        -
        103  // Inject a |clock| that returns the current time.
        -
        105  void InjectClockForTesting(std::unique_ptr<base::Clock> clock) {
        -
        106  clock_ = std::move(clock);
        -
        107  }
        -
        108 
        -
        109  private:
        -
        110  // DynamicMpdBuilderTest needs to set availabilityStartTime so that the test
        -
        111  // doesn't need to depend on current time.
        -
        112  friend class DynamicMpdBuilderTest;
        -
        113 
        -
        114  bool ToStringImpl(std::string* output);
        -
        115 
        -
        116  // This is a helper method for writing out MPDs, called from WriteMpdToFile()
        -
        117  // and ToString().
        -
        118  template <typename OutputType>
        -
        119  bool WriteMpdToOutput(OutputType* output);
        -
        120 
        -
        121  // Returns the document pointer to the MPD. This must be freed by the caller
        -
        122  // using appropriate xmlDocPtr freeing function.
        -
        123  // On failure, this returns NULL.
        -
        124  xmlDocPtr GenerateMpd();
        -
        125 
        -
        126  // Set MPD attributes common to all profiles. Uses non-zero |mpd_options_| to
        -
        127  // set attributes for the MPD.
        -
        128  void AddCommonMpdInfo(xml::XmlNode* mpd_node);
        -
        129 
        -
        130  // Adds 'static' MPD attributes and elements to |mpd_node|. This assumes that
        -
        131  // the first child element is a Period element.
        -
        132  void AddStaticMpdInfo(xml::XmlNode* mpd_node);
        -
        133 
        -
        134  // Same as AddStaticMpdInfo() but for 'dynamic' MPDs.
        -
        135  void AddDynamicMpdInfo(xml::XmlNode* mpd_node);
        -
        136 
        -
        137  float GetStaticMpdDuration(xml::XmlNode* mpd_node);
        -
        138 
        -
        139  // Set MPD attributes for dynamic profile MPD. Uses non-zero |mpd_options_| as
        -
        140  // well as various calculations to set attributes for the MPD.
        -
        141  void SetDynamicMpdAttributes(xml::XmlNode* mpd_node);
        -
        142 
        -
        143  // Gets the earliest, normalized segment timestamp. Returns true if
        -
        144  // successful, false otherwise.
        -
        145  bool GetEarliestTimestamp(double* timestamp_seconds);
        -
        146 
        -
        147  MpdType type_;
        -
        148  MpdOptions mpd_options_;
        -
        149  std::list<AdaptationSet*> adaptation_sets_;
        -
        150  STLElementDeleter<std::list<AdaptationSet*> > adaptation_sets_deleter_;
        -
        151 
        -
        152  std::list<std::string> base_urls_;
        -
        153  std::string availability_start_time_;
        -
        154 
        -
        155  base::AtomicSequenceNumber adaptation_set_counter_;
        -
        156  base::AtomicSequenceNumber representation_counter_;
        -
        157 
        -
        158  // By default, this returns the current time. This can be injected for
        -
        159  // testing.
        -
        160  std::unique_ptr<base::Clock> clock_;
        -
        161 
        -
        162  DISALLOW_COPY_AND_ASSIGN(MpdBuilder);
        -
        163 };
        -
        164 
        - -
        168  public:
        -
        169  // The role for this AdaptationSet. These values are used to add a Role
        -
        170  // element to the AdaptationSet with schemeIdUri=urn:mpeg:dash:role:2011.
        -
        171  // See ISO/IEC 23009-1:2012 section 5.8.5.5.
        -
        172  enum Role {
        -
        173  kRoleCaption,
        -
        174  kRoleSubtitle,
        -
        175  kRoleMain,
        -
        176  kRoleAlternate,
        -
        177  kRoleSupplementary,
        -
        178  kRoleCommentary,
        -
        179  kRoleDub
        -
        180  };
        +
        28 #include "packager/base/time/clock.h"
        +
        29 #include "packager/base/time/time.h"
        +
        30 #include "packager/mpd/base/bandwidth_estimator.h"
        +
        31 #include "packager/mpd/base/content_protection_element.h"
        +
        32 #include "packager/mpd/base/media_info.pb.h"
        +
        33 #include "packager/mpd/base/mpd_options.h"
        +
        34 #include "packager/mpd/base/segment_info.h"
        +
        35 #include "packager/mpd/base/xml/scoped_xml_ptr.h"
        +
        36 
        +
        37 // TODO(rkuroiwa): For classes with |id_|, consider removing the field and let
        +
        38 // the MPD (XML) generation functions take care of assigning an ID to each
        +
        39 // element.
        +
        40 namespace shaka {
        +
        41 
        +
        42 namespace media {
        +
        43 class File;
        +
        44 } // namespace media
        +
        45 
        +
        46 class AdaptationSet;
        +
        47 class Representation;
        +
        48 
        +
        49 namespace xml {
        +
        50 
        +
        51 class XmlNode;
        +
        52 class RepresentationXmlNode;
        +
        53 
        +
        54 } // namespace xml
        +
        55 
        +
        57 class MpdBuilder {
        +
        58  public:
        +
        59  enum MpdType {
        +
        60  kStatic = 0,
        +
        61  kDynamic
        +
        62  };
        +
        63 
        +
        67  MpdBuilder(MpdType type, const MpdOptions& mpd_options);
        +
        68  virtual ~MpdBuilder();
        +
        69 
        +
        72  void AddBaseUrl(const std::string& base_url);
        +
        73 
        +
        78  virtual AdaptationSet* AddAdaptationSet(const std::string& lang);
        +
        79 
        +
        84  bool WriteMpdToFile(media::File* output_file);
        +
        85 
        +
        89  virtual bool ToString(std::string* output);
        +
        90 
        +
        92  MpdType type() const { return type_; }
        +
        93 
        +
        99  static void MakePathsRelativeToMpd(const std::string& mpd_path,
        +
        100  MediaInfo* media_info);
        +
        101 
        +
        102  // Inject a |clock| that returns the current time.
        +
        104  void InjectClockForTesting(std::unique_ptr<base::Clock> clock) {
        +
        105  clock_ = std::move(clock);
        +
        106  }
        +
        107 
        +
        108  private:
        +
        109  // DynamicMpdBuilderTest needs to set availabilityStartTime so that the test
        +
        110  // doesn't need to depend on current time.
        +
        111  friend class DynamicMpdBuilderTest;
        +
        112 
        +
        113  bool ToStringImpl(std::string* output);
        +
        114 
        +
        115  // This is a helper method for writing out MPDs, called from WriteMpdToFile()
        +
        116  // and ToString().
        +
        117  template <typename OutputType>
        +
        118  bool WriteMpdToOutput(OutputType* output);
        +
        119 
        +
        120  // Returns the document pointer to the MPD. This must be freed by the caller
        +
        121  // using appropriate xmlDocPtr freeing function.
        +
        122  // On failure, this returns NULL.
        +
        123  xmlDocPtr GenerateMpd();
        +
        124 
        +
        125  // Set MPD attributes common to all profiles. Uses non-zero |mpd_options_| to
        +
        126  // set attributes for the MPD.
        +
        127  void AddCommonMpdInfo(xml::XmlNode* mpd_node);
        +
        128 
        +
        129  // Adds 'static' MPD attributes and elements to |mpd_node|. This assumes that
        +
        130  // the first child element is a Period element.
        +
        131  void AddStaticMpdInfo(xml::XmlNode* mpd_node);
        +
        132 
        +
        133  // Same as AddStaticMpdInfo() but for 'dynamic' MPDs.
        +
        134  void AddDynamicMpdInfo(xml::XmlNode* mpd_node);
        +
        135 
        +
        136  float GetStaticMpdDuration(xml::XmlNode* mpd_node);
        +
        137 
        +
        138  // Set MPD attributes for dynamic profile MPD. Uses non-zero |mpd_options_| as
        +
        139  // well as various calculations to set attributes for the MPD.
        +
        140  void SetDynamicMpdAttributes(xml::XmlNode* mpd_node);
        +
        141 
        +
        142  // Gets the earliest, normalized segment timestamp. Returns true if
        +
        143  // successful, false otherwise.
        +
        144  bool GetEarliestTimestamp(double* timestamp_seconds);
        +
        145 
        +
        146  MpdType type_;
        +
        147  MpdOptions mpd_options_;
        +
        148  std::list<std::unique_ptr<AdaptationSet>> adaptation_sets_;
        +
        149 
        +
        150  std::list<std::string> base_urls_;
        +
        151  std::string availability_start_time_;
        +
        152 
        +
        153  base::AtomicSequenceNumber adaptation_set_counter_;
        +
        154  base::AtomicSequenceNumber representation_counter_;
        +
        155 
        +
        156  // By default, this returns the current time. This can be injected for
        +
        157  // testing.
        +
        158  std::unique_ptr<base::Clock> clock_;
        +
        159 
        +
        160  DISALLOW_COPY_AND_ASSIGN(MpdBuilder);
        +
        161 };
        +
        162 
        + +
        166  public:
        +
        167  // The role for this AdaptationSet. These values are used to add a Role
        +
        168  // element to the AdaptationSet with schemeIdUri=urn:mpeg:dash:role:2011.
        +
        169  // See ISO/IEC 23009-1:2012 section 5.8.5.5.
        +
        170  enum Role {
        +
        171  kRoleCaption,
        +
        172  kRoleSubtitle,
        +
        173  kRoleMain,
        +
        174  kRoleAlternate,
        +
        175  kRoleSupplementary,
        +
        176  kRoleCommentary,
        +
        177  kRoleDub
        +
        178  };
        +
        179 
        +
        180  virtual ~AdaptationSet();
        181 
        -
        182  virtual ~AdaptationSet();
        -
        183 
        -
        190  virtual Representation* AddRepresentation(const MediaInfo& media_info);
        -
        191 
        -
        201  virtual void AddContentProtectionElement(
        -
        202  const ContentProtectionElement& element);
        -
        203 
        -
        215  virtual void UpdateContentProtectionPssh(const std::string& drm_uuid,
        -
        216  const std::string& pssh);
        -
        217 
        -
        222  virtual void AddRole(Role role);
        -
        223 
        -
        228  xml::scoped_xml_ptr<xmlNode> GetXml();
        -
        229 
        -
        235  virtual void ForceSetSegmentAlignment(bool segment_alignment);
        -
        236 
        -
        242  virtual void SetGroup(int group_number);
        -
        243 
        -
        245  virtual int Group() const;
        -
        246 
        -
        247  // Must be unique in the Period.
        -
        248  uint32_t id() const { return id_; }
        -
        249 
        -
        261  void OnNewSegmentForRepresentation(uint32_t representation_id,
        -
        262  uint64_t start_time,
        -
        263  uint64_t duration);
        -
        264 
        -
        277  void OnSetFrameRateForRepresentation(uint32_t representation_id,
        -
        278  uint32_t frame_duration,
        -
        279  uint32_t timescale);
        -
        280 
        -
        281  protected:
        -
        289  AdaptationSet(uint32_t adaptation_set_id,
        -
        290  const std::string& lang,
        -
        291  const MpdOptions& mpd_options,
        -
        292  MpdBuilder::MpdType mpd_type,
        -
        293  base::AtomicSequenceNumber* representation_counter);
        -
        294 
        -
        295  private:
        -
        296  friend class MpdBuilder;
        -
        297  template <MpdBuilder::MpdType type>
        -
        298  friend class MpdBuilderTest;
        -
        299 
        -
        300  // kSegmentAlignmentUnknown means that it is uncertain if the
        -
        301  // (sub)segments are aligned or not.
        -
        302  // kSegmentAlignmentTrue means that it is certain that the all the (current)
        -
        303  // segments added to the adaptation set are aligned.
        -
        304  // kSegmentAlignmentFalse means that it is it is certain that some segments
        -
        305  // are not aligned. This is useful to disable the computation for
        -
        306  // segment alignment, once it is certain that some segments are not aligned.
        -
        307  enum SegmentAligmentStatus {
        -
        308  kSegmentAlignmentUnknown,
        -
        309  kSegmentAlignmentTrue,
        -
        310  kSegmentAlignmentFalse
        -
        311  };
        -
        312 
        -
        313  // This maps Representations (IDs) to a list of start times of the segments.
        -
        314  // e.g.
        -
        315  // If Representation 1 has start time 0, 100, 200 and Representation 2 has
        -
        316  // start times 0, 200, 400, then the map contains:
        -
        317  // 1 -> [0, 100, 200]
        -
        318  // 2 -> [0, 200, 400]
        -
        319  typedef std::map<uint32_t, std::list<uint64_t> > RepresentationTimeline;
        -
        320 
        -
        321  // Gets the earliest, normalized segment timestamp. Returns true if
        -
        322  // successful, false otherwise.
        -
        323  bool GetEarliestTimestamp(double* timestamp_seconds);
        -
        324 
        -
        332  void CheckLiveSegmentAlignment(uint32_t representation_id,
        -
        333  uint64_t start_time,
        -
        334  uint64_t duration);
        -
        335 
        -
        336  // Checks representation_segment_start_times_ and sets segments_aligned_.
        -
        337  // Use this for VOD, do not use for Live.
        -
        338  void CheckVodSegmentAlignment();
        -
        339 
        -
        340  // Records the framerate of a Representation.
        -
        341  void RecordFrameRate(uint32_t frame_duration, uint32_t timescale);
        -
        342 
        -
        343  std::list<ContentProtectionElement> content_protection_elements_;
        -
        344  std::list<Representation*> representations_;
        -
        345  STLElementDeleter<std::list<Representation*> > representations_deleter_;
        -
        346 
        -
        347  base::AtomicSequenceNumber* const representation_counter_;
        -
        348 
        -
        349  const uint32_t id_;
        -
        350  const std::string lang_;
        -
        351  const MpdOptions& mpd_options_;
        -
        352  const MpdBuilder::MpdType mpd_type_;
        -
        353 
        -
        354  // The group attribute for the AdaptationSet. If the value is negative,
        -
        355  // no group number is specified.
        -
        356  // Note that group 0 is a special group number.
        -
        357  int group_;
        -
        358 
        -
        359  // Video widths and heights of Representations. Note that this is a set; if
        -
        360  // there is only 1 resolution, then @width & @height should be set, otherwise
        -
        361  // @maxWidth & @maxHeight should be set for DASH IOP.
        -
        362  std::set<uint32_t> video_widths_;
        -
        363  std::set<uint32_t> video_heights_;
        -
        364 
        -
        365  // Video representations' frame rates.
        -
        366  // The frame rate notation for MPD is <integer>/<integer> (where the
        -
        367  // denominator is optional). This means the frame rate could be non-whole
        -
        368  // rational value, therefore the key is of type double.
        -
        369  // Value is <integer>/<integer> in string form.
        -
        370  // So, key == CalculatedValue(value)
        -
        371  std::map<double, std::string> video_frame_rates_;
        -
        372 
        -
        373  // contentType attribute of AdaptationSet.
        -
        374  // Determined by examining the MediaInfo passed to AddRepresentation().
        -
        375  std::string content_type_;
        -
        376 
        -
        377  // This does not have to be a set, it could be a list or vector because all we
        -
        378  // really care is whether there is more than one entry.
        -
        379  // Contains one entry if all the Representations have the same picture aspect
        -
        380  // ratio (@par attribute for AdaptationSet).
        -
        381  // There will be more than one entry if there are multiple picture aspect
        -
        382  // ratios.
        -
        383  // The @par attribute should only be set if there is exactly one entry
        -
        384  // in this set.
        -
        385  std::set<std::string> picture_aspect_ratio_;
        +
        188  virtual Representation* AddRepresentation(const MediaInfo& media_info);
        +
        189 
        +
        199  virtual void AddContentProtectionElement(
        +
        200  const ContentProtectionElement& element);
        +
        201 
        +
        213  virtual void UpdateContentProtectionPssh(const std::string& drm_uuid,
        +
        214  const std::string& pssh);
        +
        215 
        +
        220  virtual void AddRole(Role role);
        +
        221 
        +
        226  xml::scoped_xml_ptr<xmlNode> GetXml();
        +
        227 
        +
        233  virtual void ForceSetSegmentAlignment(bool segment_alignment);
        +
        234 
        +
        240  virtual void SetGroup(int group_number);
        +
        241 
        +
        243  virtual int Group() const;
        +
        244 
        +
        245  // Must be unique in the Period.
        +
        246  uint32_t id() const { return id_; }
        +
        247 
        +
        259  void OnNewSegmentForRepresentation(uint32_t representation_id,
        +
        260  uint64_t start_time,
        +
        261  uint64_t duration);
        +
        262 
        +
        275  void OnSetFrameRateForRepresentation(uint32_t representation_id,
        +
        276  uint32_t frame_duration,
        +
        277  uint32_t timescale);
        +
        278 
        +
        279  protected:
        +
        287  AdaptationSet(uint32_t adaptation_set_id,
        +
        288  const std::string& lang,
        +
        289  const MpdOptions& mpd_options,
        +
        290  MpdBuilder::MpdType mpd_type,
        +
        291  base::AtomicSequenceNumber* representation_counter);
        +
        292 
        +
        293  private:
        +
        294  friend class MpdBuilder;
        +
        295  template <MpdBuilder::MpdType type>
        +
        296  friend class MpdBuilderTest;
        +
        297 
        +
        298  // kSegmentAlignmentUnknown means that it is uncertain if the
        +
        299  // (sub)segments are aligned or not.
        +
        300  // kSegmentAlignmentTrue means that it is certain that the all the (current)
        +
        301  // segments added to the adaptation set are aligned.
        +
        302  // kSegmentAlignmentFalse means that it is it is certain that some segments
        +
        303  // are not aligned. This is useful to disable the computation for
        +
        304  // segment alignment, once it is certain that some segments are not aligned.
        +
        305  enum SegmentAligmentStatus {
        +
        306  kSegmentAlignmentUnknown,
        +
        307  kSegmentAlignmentTrue,
        +
        308  kSegmentAlignmentFalse
        +
        309  };
        +
        310 
        +
        311  // This maps Representations (IDs) to a list of start times of the segments.
        +
        312  // e.g.
        +
        313  // If Representation 1 has start time 0, 100, 200 and Representation 2 has
        +
        314  // start times 0, 200, 400, then the map contains:
        +
        315  // 1 -> [0, 100, 200]
        +
        316  // 2 -> [0, 200, 400]
        +
        317  typedef std::map<uint32_t, std::list<uint64_t> > RepresentationTimeline;
        +
        318 
        +
        319  // Gets the earliest, normalized segment timestamp. Returns true if
        +
        320  // successful, false otherwise.
        +
        321  bool GetEarliestTimestamp(double* timestamp_seconds);
        +
        322 
        +
        330  void CheckLiveSegmentAlignment(uint32_t representation_id,
        +
        331  uint64_t start_time,
        +
        332  uint64_t duration);
        +
        333 
        +
        334  // Checks representation_segment_start_times_ and sets segments_aligned_.
        +
        335  // Use this for VOD, do not use for Live.
        +
        336  void CheckVodSegmentAlignment();
        +
        337 
        +
        338  // Records the framerate of a Representation.
        +
        339  void RecordFrameRate(uint32_t frame_duration, uint32_t timescale);
        +
        340 
        +
        341  std::list<ContentProtectionElement> content_protection_elements_;
        +
        342  std::list<std::unique_ptr<Representation>> representations_;
        +
        343 
        +
        344  base::AtomicSequenceNumber* const representation_counter_;
        +
        345 
        +
        346  const uint32_t id_;
        +
        347  const std::string lang_;
        +
        348  const MpdOptions& mpd_options_;
        +
        349  const MpdBuilder::MpdType mpd_type_;
        +
        350 
        +
        351  // The group attribute for the AdaptationSet. If the value is negative,
        +
        352  // no group number is specified.
        +
        353  // Note that group 0 is a special group number.
        +
        354  int group_;
        +
        355 
        +
        356  // Video widths and heights of Representations. Note that this is a set; if
        +
        357  // there is only 1 resolution, then @width & @height should be set, otherwise
        +
        358  // @maxWidth & @maxHeight should be set for DASH IOP.
        +
        359  std::set<uint32_t> video_widths_;
        +
        360  std::set<uint32_t> video_heights_;
        +
        361 
        +
        362  // Video representations' frame rates.
        +
        363  // The frame rate notation for MPD is <integer>/<integer> (where the
        +
        364  // denominator is optional). This means the frame rate could be non-whole
        +
        365  // rational value, therefore the key is of type double.
        +
        366  // Value is <integer>/<integer> in string form.
        +
        367  // So, key == CalculatedValue(value)
        +
        368  std::map<double, std::string> video_frame_rates_;
        +
        369 
        +
        370  // contentType attribute of AdaptationSet.
        +
        371  // Determined by examining the MediaInfo passed to AddRepresentation().
        +
        372  std::string content_type_;
        +
        373 
        +
        374  // This does not have to be a set, it could be a list or vector because all we
        +
        375  // really care is whether there is more than one entry.
        +
        376  // Contains one entry if all the Representations have the same picture aspect
        +
        377  // ratio (@par attribute for AdaptationSet).
        +
        378  // There will be more than one entry if there are multiple picture aspect
        +
        379  // ratios.
        +
        380  // The @par attribute should only be set if there is exactly one entry
        +
        381  // in this set.
        +
        382  std::set<std::string> picture_aspect_ratio_;
        +
        383 
        +
        384  // The roles of this AdaptationSet.
        +
        385  std::set<Role> roles_;
        386 
        -
        387  // The roles of this AdaptationSet.
        -
        388  std::set<Role> roles_;
        -
        389 
        -
        390  // True iff all the segments are aligned.
        -
        391  SegmentAligmentStatus segments_aligned_;
        -
        392  bool force_set_segment_alignment_;
        -
        393 
        -
        394  // Keeps track of segment start times of Representations.
        -
        395  // For VOD, this will not be cleared, all the segment start times are
        -
        396  // stored in this. This should not out-of-memory for a reasonable length
        -
        397  // video and reasonable subsegment length.
        -
        398  // For Live, the entries are deleted (see CheckLiveSegmentAlignment()
        -
        399  // implementation comment) because storing the entire timeline is not
        -
        400  // reasonable and may cause an out-of-memory problem.
        -
        401  RepresentationTimeline representation_segment_start_times_;
        +
        387  // True iff all the segments are aligned.
        +
        388  SegmentAligmentStatus segments_aligned_;
        +
        389  bool force_set_segment_alignment_;
        +
        390 
        +
        391  // Keeps track of segment start times of Representations.
        +
        392  // For VOD, this will not be cleared, all the segment start times are
        +
        393  // stored in this. This should not out-of-memory for a reasonable length
        +
        394  // video and reasonable subsegment length.
        +
        395  // For Live, the entries are deleted (see CheckLiveSegmentAlignment()
        +
        396  // implementation comment) because storing the entire timeline is not
        +
        397  // reasonable and may cause an out-of-memory problem.
        +
        398  RepresentationTimeline representation_segment_start_times_;
        +
        399 
        +
        400  DISALLOW_COPY_AND_ASSIGN(AdaptationSet);
        +
        401 };
        402 
        -
        403  DISALLOW_COPY_AND_ASSIGN(AdaptationSet);
        -
        404 };
        -
        405 
        - -
        407  public:
        - - -
        410 
        -
        415  virtual void OnNewSegmentForRepresentation(uint64_t start_time,
        -
        416  uint64_t duration) = 0;
        -
        417 
        -
        422  virtual void OnSetFrameRateForRepresentation(uint32_t frame_duration,
        -
        423  uint32_t timescale) = 0;
        -
        424 };
        -
        425 
        - -
        429  public:
        -
        430  enum SuppressFlag {
        -
        431  kSuppressWidth = 1,
        -
        432  kSuppressHeight = 2,
        -
        433  kSuppressFrameRate = 4,
        -
        434  };
        -
        435 
        -
        436  virtual ~Representation();
        -
        437 
        -
        441  bool Init();
        -
        442 
        -
        453  virtual void AddContentProtectionElement(
        -
        454  const ContentProtectionElement& element);
        -
        455 
        -
        467  virtual void UpdateContentProtectionPssh(const std::string& drm_uuid,
        -
        468  const std::string& pssh);
        -
        469 
        -
        478  virtual void AddNewSegment(uint64_t start_time,
        -
        479  uint64_t duration,
        -
        480  uint64_t size);
        -
        481 
        -
        487  virtual void SetSampleDuration(uint32_t sample_duration);
        + +
        404  public:
        + + +
        407 
        +
        412  virtual void OnNewSegmentForRepresentation(uint64_t start_time,
        +
        413  uint64_t duration) = 0;
        +
        414 
        +
        419  virtual void OnSetFrameRateForRepresentation(uint32_t frame_duration,
        +
        420  uint32_t timescale) = 0;
        +
        421 };
        +
        422 
        + +
        426  public:
        +
        427  enum SuppressFlag {
        +
        428  kSuppressWidth = 1,
        +
        429  kSuppressHeight = 2,
        +
        430  kSuppressFrameRate = 4,
        +
        431  };
        +
        432 
        +
        433  virtual ~Representation();
        +
        434 
        +
        438  bool Init();
        +
        439 
        +
        450  virtual void AddContentProtectionElement(
        +
        451  const ContentProtectionElement& element);
        +
        452 
        +
        464  virtual void UpdateContentProtectionPssh(const std::string& drm_uuid,
        +
        465  const std::string& pssh);
        +
        466 
        +
        475  virtual void AddNewSegment(uint64_t start_time,
        +
        476  uint64_t duration,
        +
        477  uint64_t size);
        +
        478 
        +
        484  virtual void SetSampleDuration(uint32_t sample_duration);
        +
        485 
        +
        487  xml::scoped_xml_ptr<xmlNode> GetXml();
        488 
        -
        490  xml::scoped_xml_ptr<xmlNode> GetXml();
        -
        491 
        -
        500  void SuppressOnce(SuppressFlag flag);
        +
        497  void SuppressOnce(SuppressFlag flag);
        +
        498 
        +
        500  uint32_t id() const { return id_; }
        501 
        -
        503  uint32_t id() const { return id_; }
        -
        504 
        -
        505  protected:
        - -
        515  const MediaInfo& media_info,
        -
        516  const MpdOptions& mpd_options,
        -
        517  uint32_t representation_id,
        -
        518  std::unique_ptr<RepresentationStateChangeListener> state_change_listener);
        -
        519 
        -
        520  private:
        -
        521  friend class AdaptationSet;
        -
        522  template <MpdBuilder::MpdType type>
        -
        523  friend class MpdBuilderTest;
        -
        524 
        -
        525  bool AddLiveInfo(xml::RepresentationXmlNode* representation);
        -
        526 
        -
        527  // Returns true if |media_info_| has required fields to generate a valid
        -
        528  // Representation. Otherwise returns false.
        -
        529  bool HasRequiredMediaInfoFields();
        -
        530 
        -
        531  // Return false if the segment should be considered a new segment. True if the
        -
        532  // segment is contiguous.
        -
        533  bool IsContiguous(uint64_t start_time,
        -
        534  uint64_t duration,
        -
        535  uint64_t size) const;
        -
        536 
        -
        537  // Remove elements from |segment_infos_| if
        -
        538  // mpd_options_.time_shift_buffer_depth is specified. Increments
        -
        539  // |start_number_| by the number of segments removed.
        -
        540  void SlideWindow();
        -
        541 
        -
        542  // Note: Because 'mimeType' is a required field for a valid MPD, these return
        -
        543  // strings.
        -
        544  std::string GetVideoMimeType() const;
        -
        545  std::string GetAudioMimeType() const;
        -
        546  std::string GetTextMimeType() const;
        -
        547 
        -
        548  // Gets the earliest, normalized segment timestamp. Returns true if
        -
        549  // successful, false otherwise.
        -
        550  bool GetEarliestTimestamp(double* timestamp_seconds);
        -
        551 
        -
        552  // Init() checks that only one of VideoInfo, AudioInfo, or TextInfo is set. So
        -
        553  // any logic using this can assume only one set.
        -
        554  MediaInfo media_info_;
        -
        555  std::list<ContentProtectionElement> content_protection_elements_;
        -
        556  std::list<SegmentInfo> segment_infos_;
        -
        557 
        -
        558  const uint32_t id_;
        -
        559  std::string mime_type_;
        -
        560  std::string codecs_;
        -
        561  BandwidthEstimator bandwidth_estimator_;
        -
        562  const MpdOptions& mpd_options_;
        -
        563 
        -
        564  // startNumber attribute for SegmentTemplate.
        -
        565  // Starts from 1.
        -
        566  uint32_t start_number_;
        -
        567 
        -
        568  // If this is not null, then Representation is responsible for calling the
        -
        569  // right methods at right timings.
        -
        570  std::unique_ptr<RepresentationStateChangeListener> state_change_listener_;
        +
        502  protected:
        + +
        512  const MediaInfo& media_info,
        +
        513  const MpdOptions& mpd_options,
        +
        514  uint32_t representation_id,
        +
        515  std::unique_ptr<RepresentationStateChangeListener> state_change_listener);
        +
        516 
        +
        517  private:
        +
        518  friend class AdaptationSet;
        +
        519  template <MpdBuilder::MpdType type>
        +
        520  friend class MpdBuilderTest;
        +
        521 
        +
        522  bool AddLiveInfo(xml::RepresentationXmlNode* representation);
        +
        523 
        +
        524  // Returns true if |media_info_| has required fields to generate a valid
        +
        525  // Representation. Otherwise returns false.
        +
        526  bool HasRequiredMediaInfoFields();
        +
        527 
        +
        528  // Return false if the segment should be considered a new segment. True if the
        +
        529  // segment is contiguous.
        +
        530  bool IsContiguous(uint64_t start_time,
        +
        531  uint64_t duration,
        +
        532  uint64_t size) const;
        +
        533 
        +
        534  // Remove elements from |segment_infos_| if
        +
        535  // mpd_options_.time_shift_buffer_depth is specified. Increments
        +
        536  // |start_number_| by the number of segments removed.
        +
        537  void SlideWindow();
        +
        538 
        +
        539  // Note: Because 'mimeType' is a required field for a valid MPD, these return
        +
        540  // strings.
        +
        541  std::string GetVideoMimeType() const;
        +
        542  std::string GetAudioMimeType() const;
        +
        543  std::string GetTextMimeType() const;
        +
        544 
        +
        545  // Gets the earliest, normalized segment timestamp. Returns true if
        +
        546  // successful, false otherwise.
        +
        547  bool GetEarliestTimestamp(double* timestamp_seconds);
        +
        548 
        +
        549  // Init() checks that only one of VideoInfo, AudioInfo, or TextInfo is set. So
        +
        550  // any logic using this can assume only one set.
        +
        551  MediaInfo media_info_;
        +
        552  std::list<ContentProtectionElement> content_protection_elements_;
        +
        553  std::list<SegmentInfo> segment_infos_;
        +
        554 
        +
        555  const uint32_t id_;
        +
        556  std::string mime_type_;
        +
        557  std::string codecs_;
        +
        558  BandwidthEstimator bandwidth_estimator_;
        +
        559  const MpdOptions& mpd_options_;
        +
        560 
        +
        561  // startNumber attribute for SegmentTemplate.
        +
        562  // Starts from 1.
        +
        563  uint32_t start_number_;
        +
        564 
        +
        565  // If this is not null, then Representation is responsible for calling the
        +
        566  // right methods at right timings.
        +
        567  std::unique_ptr<RepresentationStateChangeListener> state_change_listener_;
        +
        568 
        +
        569  // Bit vector for tracking witch attributes should not be output.
        +
        570  int output_suppression_flags_;
        571 
        -
        572  // Bit vector for tracking witch attributes should not be output.
        -
        573  int output_suppression_flags_;
        +
        572  DISALLOW_COPY_AND_ASSIGN(Representation);
        +
        573 };
        574 
        -
        575  DISALLOW_COPY_AND_ASSIGN(Representation);
        -
        576 };
        -
        577 
        -
        578 } // namespace shaka
        -
        579 
        -
        580 #endif // MPD_BASE_MPD_BUILDER_H_
        -
        void OnSetFrameRateForRepresentation(uint32_t representation_id, uint32_t frame_duration, uint32_t timescale)
        Definition: mpd_builder.cc:868
        +
        575 } // namespace shaka
        +
        576 
        +
        577 #endif // MPD_BASE_MPD_BUILDER_H_
        +
        void OnSetFrameRateForRepresentation(uint32_t representation_id, uint32_t frame_duration, uint32_t timescale)
        Definition: mpd_builder.cc:865
        RepresentationType in MPD.
        Definition: xml_node.h:129
        -
        virtual void AddNewSegment(uint64_t start_time, uint64_t duration, uint64_t size)
        +
        virtual void AddNewSegment(uint64_t start_time, uint64_t duration, uint64_t size)
        virtual void OnSetFrameRateForRepresentation(uint32_t frame_duration, uint32_t timescale)=0
        - -
        bool WriteMpdToFile(media::File *output_file)
        Definition: mpd_builder.cc:423
        -
        Representation(const MediaInfo &media_info, const MpdOptions &mpd_options, uint32_t representation_id, std::unique_ptr< RepresentationStateChangeListener > state_change_listener)
        -
        AdaptationSet(uint32_t adaptation_set_id, const std::string &lang, const MpdOptions &mpd_options, MpdBuilder::MpdType mpd_type, base::AtomicSequenceNumber *representation_counter)
        Definition: mpd_builder.cc:674
        - -
        virtual void SetSampleDuration(uint32_t sample_duration)
        -
        virtual Representation * AddRepresentation(const MediaInfo &media_info)
        Definition: mpd_builder.cc:693
        -
        This class generates DASH MPDs (Media Presentation Descriptions).
        Definition: mpd_builder.h:58
        -
        uint32_t id() const
        Definition: mpd_builder.h:503
        + +
        bool WriteMpdToFile(media::File *output_file)
        Definition: mpd_builder.cc:422
        +
        Representation(const MediaInfo &media_info, const MpdOptions &mpd_options, uint32_t representation_id, std::unique_ptr< RepresentationStateChangeListener > state_change_listener)
        +
        AdaptationSet(uint32_t adaptation_set_id, const std::string &lang, const MpdOptions &mpd_options, MpdBuilder::MpdType mpd_type, base::AtomicSequenceNumber *representation_counter)
        Definition: mpd_builder.cc:671
        + +
        virtual void SetSampleDuration(uint32_t sample_duration)
        +
        virtual Representation * AddRepresentation(const MediaInfo &media_info)
        Definition: mpd_builder.cc:689
        +
        This class generates DASH MPDs (Media Presentation Descriptions).
        Definition: mpd_builder.h:57
        +
        uint32_t id() const
        Definition: mpd_builder.h:500
        Define an abstract file interface.
        Definition: file.h:24
        -
        virtual void AddContentProtectionElement(const ContentProtectionElement &element)
        Definition: mpd_builder.cc:737
        +
        virtual void AddContentProtectionElement(const ContentProtectionElement &element)
        Definition: mpd_builder.cc:733
        -
        virtual void AddRole(Role role)
        Definition: mpd_builder.cc:749
        -
        void AddBaseUrl(const std::string &base_url)
        Definition: mpd_builder.cc:409
        -
        virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
        Definition: mpd_builder.cc:743
        -
        MpdType type() const
        Definition: mpd_builder.h:93
        -
        virtual void SetGroup(int group_number)
        Definition: mpd_builder.cc:842
        -
        xml::scoped_xml_ptr< xmlNode > GetXml()
        - -
        virtual bool ToString(std::string *output)
        Definition: mpd_builder.cc:428
        -
        virtual void ForceSetSegmentAlignment(bool segment_alignment)
        Definition: mpd_builder.cc:836
        -
        static void MakePathsRelativeToMpd(const std::string &mpd_path, MediaInfo *media_info)
        Definition: mpd_builder.cc:646
        +
        virtual void AddRole(Role role)
        Definition: mpd_builder.cc:745
        +
        void AddBaseUrl(const std::string &base_url)
        Definition: mpd_builder.cc:408
        +
        virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
        Definition: mpd_builder.cc:739
        +
        MpdType type() const
        Definition: mpd_builder.h:92
        +
        virtual void SetGroup(int group_number)
        Definition: mpd_builder.cc:839
        +
        xml::scoped_xml_ptr< xmlNode > GetXml()
        + +
        virtual bool ToString(std::string *output)
        Definition: mpd_builder.cc:427
        +
        virtual void ForceSetSegmentAlignment(bool segment_alignment)
        Definition: mpd_builder.cc:833
        +
        static void MakePathsRelativeToMpd(const std::string &mpd_path, MediaInfo *media_info)
        Definition: mpd_builder.cc:643
        MpdBuilder(MpdType type, const MpdOptions &mpd_options)
        Definition: mpd_builder.cc:401
        -
        xml::scoped_xml_ptr< xmlNode > GetXml()
        Definition: mpd_builder.cc:759
        -
        virtual void AddContentProtectionElement(const ContentProtectionElement &element)
        - -
        virtual AdaptationSet * AddAdaptationSet(const std::string &lang)
        Definition: mpd_builder.cc:413
        -
        virtual int Group() const
        Definition: mpd_builder.cc:846
        +
        xml::scoped_xml_ptr< xmlNode > GetXml()
        Definition: mpd_builder.cc:755
        +
        virtual void AddContentProtectionElement(const ContentProtectionElement &element)
        + +
        virtual AdaptationSet * AddAdaptationSet(const std::string &lang)
        Definition: mpd_builder.cc:412
        +
        virtual int Group() const
        Definition: mpd_builder.cc:843
        Defines Mpd Options.
        Definition: mpd_options.h:15
        -
        void OnNewSegmentForRepresentation(uint32_t representation_id, uint64_t start_time, uint64_t duration)
        Definition: mpd_builder.cc:857
        -
        void InjectClockForTesting(std::unique_ptr< base::Clock > clock)
        This is for testing.
        Definition: mpd_builder.h:105
        -
        virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
        +
        void OnNewSegmentForRepresentation(uint32_t representation_id, uint64_t start_time, uint64_t duration)
        Definition: mpd_builder.cc:854
        +
        void InjectClockForTesting(std::unique_ptr< base::Clock > clock)
        This is for testing.
        Definition: mpd_builder.h:104
        +
        virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
        virtual void OnNewSegmentForRepresentation(uint64_t start_time, uint64_t duration)=0
        -
        void SuppressOnce(SuppressFlag flag)
        +
        void SuppressOnce(SuppressFlag flag)
        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 29e33afca1..c55aacdef4 100644 --- a/docs/d6/da4/classshaka_1_1media_1_1AVCDecoderConfigurationRecord-members.html +++ b/docs/d6/da4/classshaka_1_1media_1_1AVCDecoderConfigurationRecord-members.html @@ -119,7 +119,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 cd197ed089..60e5299e00 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 @@ -98,7 +98,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/da9/classshaka_1_1media_1_1BitReader.html b/docs/d6/da9/classshaka_1_1media_1_1BitReader.html index 9a0c8da69c..97189fb68d 100644 --- a/docs/d6/da9/classshaka_1_1media_1_1BitReader.html +++ b/docs/d6/da9/classshaka_1_1media_1_1BitReader.html @@ -365,7 +365,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 8ba0b7e49a..97c0c808d4 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 @@ -185,7 +185,7 @@ Additional Inherited Members diff --git a/docs/d6/db1/classshaka_1_1media_1_1MediaStream-members.html b/docs/d6/db1/classshaka_1_1media_1_1MediaStream-members.html index c1a522ba9f..3311077057 100644 --- a/docs/d6/db1/classshaka_1_1media_1_1MediaStream-members.html +++ b/docs/d6/db1/classshaka_1_1media_1_1MediaStream-members.html @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/db1/classshaka_1_1media_1_1VideoStreamInfo.html b/docs/d6/db1/classshaka_1_1media_1_1VideoStreamInfo.html index b5fa48586a..5a6a256d83 100644 --- a/docs/d6/db1/classshaka_1_1media_1_1VideoStreamInfo.html +++ b/docs/d6/db1/classshaka_1_1media_1_1VideoStreamInfo.html @@ -307,7 +307,7 @@ void set_language (con -

        Definition at line 50 of file video_stream_info.cc.

        +

        Definition at line 49 of file video_stream_info.cc.

        @@ -336,7 +336,7 @@ void set_language (con

        Implements shaka::media::StreamInfo.

        -

        Definition at line 68 of file video_stream_info.cc.

        +

        Definition at line 67 of file video_stream_info.cc.

        @@ -418,7 +418,7 @@ void set_language (con

        Reimplemented from shaka::media::StreamInfo.

        -

        Definition at line 75 of file video_stream_info.cc.

        +

        Definition at line 74 of file video_stream_info.cc.

        @@ -429,7 +429,7 @@ void set_language (con 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 cfb9eb0045..96584e19dd 100644 --- a/docs/d6/db1/structshaka_1_1media_1_1VideoStreamInfoParameters-members.html +++ b/docs/d6/db1/structshaka_1_1media_1_1VideoStreamInfoParameters-members.html @@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 530ac5230c..9165a09ff5 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 @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 fb0148f8a2..b7fcd10f04 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 @@ -107,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/dc8/mkv__writer_8cc_source.html b/docs/d6/dc8/mkv__writer_8cc_source.html index b3d0e6a3d9..cc9e6ec089 100644 --- a/docs/d6/dc8/mkv__writer_8cc_source.html +++ b/docs/d6/dc8/mkv__writer_8cc_source.html @@ -195,7 +195,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 7c56bbdefb..02bc586f40 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 @@ -250,7 +250,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 efc5b45f2a..2fb567a716 100644 --- a/docs/d6/dcc/classshaka_1_1media_1_1VP9Parser-members.html +++ b/docs/d6/dcc/classshaka_1_1media_1_1VP9Parser-members.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 49557682fb..c26d135be2 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 @@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/dcf/classshaka_1_1media_1_1mp2t_1_1EsParserAdts.html b/docs/d6/dcf/classshaka_1_1media_1_1mp2t_1_1EsParserAdts.html index 09cba13bb1..b0a685f42f 100644 --- a/docs/d6/dcf/classshaka_1_1media_1_1mp2t_1_1EsParserAdts.html +++ b/docs/d6/dcf/classshaka_1_1media_1_1mp2t_1_1EsParserAdts.html @@ -148,7 +148,7 @@ const scoped_refptr
        diff --git a/docs/d6/dd0/structshaka_1_1media_1_1H264SEIMessage.html b/docs/d6/dd0/structshaka_1_1media_1_1H264SEIMessage.html index 4ffef991b2..8d96088c00 100644 --- a/docs/d6/dd0/structshaka_1_1media_1_1H264SEIMessage.html +++ b/docs/d6/dd0/structshaka_1_1media_1_1H264SEIMessage.html @@ -119,7 +119,7 @@ union {

        Detailed Description

        -

        Definition at line 226 of file h264_parser.h.

        +

        Definition at line 227 of file h264_parser.h.


        The documentation for this struct was generated from the following files:
        • media/codecs/h264_parser.h
        • media/codecs/h264_parser.cc
        • @@ -127,7 +127,7 @@ union { 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 8bb6b32eba..56928fe67b 100644 --- a/docs/d6/dde/structshaka_1_1media_1_1H265VuiParameters-members.html +++ b/docs/d6/dde/structshaka_1_1media_1_1H265VuiParameters-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 1c5560bb35..87f1ffcf54 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 @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 2db7abab84..c89c5e2038 100644 --- a/docs/d6/de7/structshaka_1_1media_1_1VPxFrameInfo-members.html +++ b/docs/d6/de7/structshaka_1_1media_1_1VPxFrameInfo-members.html @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/de8/local__file_8cc_source.html b/docs/d6/de8/local__file_8cc_source.html index 8a2234827b..4b0bd4f096 100644 --- a/docs/d6/de8/local__file_8cc_source.html +++ b/docs/d6/de8/local__file_8cc_source.html @@ -211,7 +211,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/de8/network__util_8h_source.html b/docs/d6/de8/network__util_8h_source.html index ca5d06c1db..e61b49a390 100644 --- a/docs/d6/de8/network__util_8h_source.html +++ b/docs/d6/de8/network__util_8h_source.html @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/de9/ts__segmenter_8cc_source.html b/docs/d6/de9/ts__segmenter_8cc_source.html index ba2261d2a2..affe73e434 100644 --- a/docs/d6/de9/ts__segmenter_8cc_source.html +++ b/docs/d6/de9/ts__segmenter_8cc_source.html @@ -288,7 +288,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
          199 } // namespace shaka
          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:53
          Status AddSample(scoped_refptr< MediaSample > sample)
          Definition: ts_segmenter.cc:88
          @@ -297,7 +297,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
          virtual Status GetKey(TrackType track_type, EncryptionKey *key)=0
          TsSegmenter(const MuxerOptions &options, MuxerListener *listener)
          Definition: ts_segmenter.cc:27
          -
          static bool GenerateRandomIv(FourCC protection_scheme, std::vector< uint8_t > *iv)
          Definition: aes_cryptor.cc:109
          +
          static bool GenerateRandomIv(FourCC protection_scheme, std::vector< uint8_t > *iv)
          Definition: aes_cryptor.cc:107
          void InjectPesPacketGeneratorForTesting(std::unique_ptr< PesPacketGenerator > generator)
          Only for testing.
          void SetTsWriterFileOpenedForTesting(bool value)
          Only for testing.
          void InjectTsWriterForTesting(std::unique_ptr< TsWriter > writer)
          Only for testing.
          @@ -313,7 +313,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/ded/ts__packet_8h_source.html b/docs/d6/ded/ts__packet_8h_source.html index 3ee4a195ed..887c620ada 100644 --- a/docs/d6/ded/ts__packet_8h_source.html +++ b/docs/d6/ded/ts__packet_8h_source.html @@ -169,7 +169,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/def/sync__sample__iterator_8cc_source.html b/docs/d6/def/sync__sample__iterator_8cc_source.html index e4a4b73013..e06dc6abf1 100644 --- a/docs/d6/def/sync__sample__iterator_8cc_source.html +++ b/docs/d6/def/sync__sample__iterator_8cc_source.html @@ -140,7 +140,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d6/dff/classshaka_1_1media_1_1Nalu.html b/docs/d6/dff/classshaka_1_1media_1_1Nalu.html index a4fc212071..e35a91bb83 100644 --- a/docs/d6/dff/classshaka_1_1media_1_1Nalu.html +++ b/docs/d6/dff/classshaka_1_1media_1_1Nalu.html @@ -243,7 +243,7 @@ bool can_start_access_unit 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 fa6134abdc..ba02b3368c 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 @@ -194,7 +194,7 @@ Additional Inherited Members 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 9b84787979..93d6055642 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 @@ -182,7 +182,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 093ce73641..9ea83dcb9f 100644 --- a/docs/d7/d0b/muxer__listener__test__helper_8h_source.html +++ b/docs/d7/d0b/muxer__listener__test__helper_8h_source.html @@ -206,7 +206,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d7/d12/media__parser_8h_source.html b/docs/d7/d12/media__parser_8h_source.html index 44288e7b15..1a83c141d2 100644 --- a/docs/d7/d12/media__parser_8h_source.html +++ b/docs/d7/d12/media__parser_8h_source.html @@ -149,7 +149,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d7/d15/mpd__notifier_8h_source.html b/docs/d7/d15/mpd__notifier_8h_source.html index f83887b27f..e5349de695 100644 --- a/docs/d7/d15/mpd__notifier_8h_source.html +++ b/docs/d7/d15/mpd__notifier_8h_source.html @@ -169,7 +169,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 c6075f7c83..8a54124068 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 @@ -117,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d7/d22/libcrypto__threading_8h_source.html b/docs/d7/d22/libcrypto__threading_8h_source.html index 5a7f73cb06..b7650a25ee 100644 --- a/docs/d7/d22/libcrypto__threading_8h_source.html +++ b/docs/d7/d22/libcrypto__threading_8h_source.html @@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 5a3de76dd9..b3f6e1e598 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 @@ -177,7 +177,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 7bc723deda..3e07a88784 100644 --- a/docs/d7/d29/structshaka_1_1media_1_1H265Sps-members.html +++ b/docs/d7/d29/structshaka_1_1media_1_1H265Sps-members.html @@ -146,7 +146,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 8328099e74..1fca280cb2 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 4d736f1193..5432ae81dd 100644 --- a/docs/d7/d36/classshaka_1_1media_1_1ContentEncoding-members.html +++ b/docs/d7/d36/classshaka_1_1media_1_1ContentEncoding-members.html @@ -132,7 +132,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 de4a8e248c..f505b986ff 100644 --- a/docs/d7/d42/protection__system__specific__info_8cc_source.html +++ b/docs/d7/d42/protection__system__specific__info_8cc_source.html @@ -219,7 +219,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 5eabf90f85..7e7b76131d 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 @@ -188,7 +188,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 c27dfd80b1..9c886dee57 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 @@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 12cbf3249e..8c168ab9c1 100644 --- a/docs/d7/d46/classshaka_1_1media_1_1WebMListParser-members.html +++ b/docs/d7/d46/classshaka_1_1media_1_1WebMListParser-members.html @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 e3a3d077b7..73f5902825 100644 --- a/docs/d7/d54/classshaka_1_1media_1_1H26xByteToUnitStreamConverter-members.html +++ b/docs/d7/d54/classshaka_1_1media_1_1H26xByteToUnitStreamConverter-members.html @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d7/d59/classshaka_1_1media_1_1DecryptorSource.html b/docs/d7/d59/classshaka_1_1media_1_1DecryptorSource.html index df46563876..4bbc1364ba 100644 --- a/docs/d7/d59/classshaka_1_1media_1_1DecryptorSource.html +++ b/docs/d7/d59/classshaka_1_1media_1_1DecryptorSource.html @@ -111,7 +111,7 @@ bool DecryptSampleBuffer

          Detailed Description

          DecryptorSource wraps KeySource and is responsible for decryptor management.

          -

          Definition at line 21 of file decryptor_source.h.

          +

          Definition at line 22 of file decryptor_source.h.


          The documentation for this class was generated from the following files:
          • media/base/decryptor_source.h
          • media/base/decryptor_source.cc
          • @@ -119,7 +119,7 @@ bool DecryptSampleBuffer diff --git a/docs/d7/d6d/classshaka_1_1media_1_1MediaSample.html b/docs/d7/d6d/classshaka_1_1media_1_1MediaSample.html index 2ce0c4e5fe..6826c44ffd 100644 --- a/docs/d7/d6d/classshaka_1_1media_1_1MediaSample.html +++ b/docs/d7/d6d/classshaka_1_1media_1_1MediaSample.html @@ -411,7 +411,7 @@ class base::RefCountedThre 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 536b11619c..7610afa55c 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 @@ -117,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 69c4d8826e..affc68f318 100644 --- a/docs/d7/d78/structshaka_1_1media_1_1H264SEIMessage-members.html +++ b/docs/d7/d78/structshaka_1_1media_1_1H264SEIMessage-members.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d7/d7a/classshaka_1_1media_1_1UdpFile.html b/docs/d7/d7a/classshaka_1_1media_1_1UdpFile.html index 426e3fa94a..94d724cd93 100644 --- a/docs/d7/d7a/classshaka_1_1media_1_1UdpFile.html +++ b/docs/d7/d7a/classshaka_1_1media_1_1UdpFile.html @@ -463,7 +463,7 @@ Additional Inherited Members diff --git a/docs/d7/d7c/vlog__flags_8h_source.html b/docs/d7/d7c/vlog__flags_8h_source.html index 7d55582bfa..a849d399bd 100644 --- a/docs/d7/d7c/vlog__flags_8h_source.html +++ b/docs/d7/d7c/vlog__flags_8h_source.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d7/d87/video__stream__info_8h_source.html b/docs/d7/d87/video__stream__info_8h_source.html index 04f1a1bfa0..af65371936 100644 --- a/docs/d7/d87/video__stream__info_8h_source.html +++ b/docs/d7/d87/video__stream__info_8h_source.html @@ -153,16 +153,16 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
            75 
            76 #endif // MEDIA_BASE_VIDEO_STREAM_INFO_H_
            Abstract class holds stream information.
            Definition: stream_info.h:53
            -
            bool IsValidConfig() const override
            +
            bool IsValidConfig() const override
            Holds video stream information.
            -
            std::string ToString() const override
            -
            VideoStreamInfo(int track_id, uint32_t time_scale, uint64_t duration, Codec codec, const std::string &codec_string, const uint8_t *codec_config, size_t codec_config_size, uint16_t width, uint16_t height, uint32_t pixel_width, uint32_t pixel_height, int16_t trick_play_rate, uint8_t nalu_length_size, const std::string &language, bool is_encrypted)
            +
            std::string ToString() const override
            +
            VideoStreamInfo(int track_id, uint32_t time_scale, uint64_t duration, Codec codec, const std::string &codec_string, const uint8_t *codec_config, size_t codec_config_size, uint16_t width, uint16_t height, uint32_t pixel_width, uint32_t pixel_height, int16_t trick_play_rate, uint8_t nalu_length_size, const std::string &language, bool is_encrypted)
            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 9da8c9ea0d..57396a4f64 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 @@ -112,7 +112,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 50e28eb0a3..06282ad6a5 100644 --- a/docs/d7/d9d/progress__listener_8h_source.html +++ b/docs/d7/d9d/progress__listener_8h_source.html @@ -127,7 +127,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d7/da4/track__run__iterator_8h_source.html b/docs/d7/da4/track__run__iterator_8h_source.html index 2d3a891481..4ffcf9feaf 100644 --- a/docs/d7/da4/track__run__iterator_8h_source.html +++ b/docs/d7/da4/track__run__iterator_8h_source.html @@ -195,7 +195,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 4d3527c8cc..b26147ff0c 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 @@ -173,7 +173,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 a2261b831e..db0fa29a06 100644 --- a/docs/d7/db0/mpd__writer_8h_source.html +++ b/docs/d7/db0/mpd__writer_8h_source.html @@ -183,7 +183,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 2073f49c93..f1db51832e 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 166cbe7938..e09f50a9b2 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 @@ -182,7 +182,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 580dd4b380..14663fb4e8 100644 --- a/docs/d7/dc6/byte__queue_8h_source.html +++ b/docs/d7/dc6/byte__queue_8h_source.html @@ -146,7 +146,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d7/dd0/mpd__notifier__util_8h_source.html b/docs/d7/dd0/mpd__notifier__util_8h_source.html index 18c5a8eb5a..169c82ae6e 100644 --- a/docs/d7/dd0/mpd__notifier__util_8h_source.html +++ b/docs/d7/dd0/mpd__notifier__util_8h_source.html @@ -128,7 +128,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d7/dd4/request__signer_8h_source.html b/docs/d7/dd4/request__signer_8h_source.html index 9cf2aa16f8..5597607a0f 100644 --- a/docs/d7/dd4/request__signer_8h_source.html +++ b/docs/d7/dd4/request__signer_8h_source.html @@ -179,7 +179,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 d1978410dc..22b14c4164 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 @@ -285,7 +285,7 @@ track_id, const scoped_refptr
            diff --git a/docs/d7/dd6/key__source_8cc_source.html b/docs/d7/dd6/key__source_8cc_source.html index 6105750cbd..1f5154bdf4 100644 --- a/docs/d7/dd6/key__source_8cc_source.html +++ b/docs/d7/dd6/key__source_8cc_source.html @@ -142,7 +142,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d7/dda/classshaka_1_1media_1_1ByteQueue.html b/docs/d7/dda/classshaka_1_1media_1_1ByteQueue.html index 53cd115bb8..de4159203e 100644 --- a/docs/d7/dda/classshaka_1_1media_1_1ByteQueue.html +++ b/docs/d7/dda/classshaka_1_1media_1_1ByteQueue.html @@ -177,7 +177,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 7d4cda2e56..4e8693986f 100644 --- a/docs/d7/ddd/classshaka_1_1media_1_1RsaRequestSigner.html +++ b/docs/d7/ddd/classshaka_1_1media_1_1RsaRequestSigner.html @@ -182,7 +182,7 @@ Additional Inherited Members diff --git a/docs/d7/de0/classshaka_1_1media_1_1HttpKeyFetcher.html b/docs/d7/de0/classshaka_1_1media_1_1HttpKeyFetcher.html index 0d26a1eaf7..651945ebad 100644 --- a/docs/d7/de0/classshaka_1_1media_1_1HttpKeyFetcher.html +++ b/docs/d7/de0/classshaka_1_1media_1_1HttpKeyFetcher.html @@ -311,7 +311,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 9c7f98043c..7285e9eb31 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 @@ -120,7 +120,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 da1d0b8c6e..9177cc4d8f 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 @@ -134,7 +134,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d7/dee/mpd__generator_8cc_source.html b/docs/d7/dee/mpd__generator_8cc_source.html index 23b8789dca..646ba23054 100644 --- a/docs/d7/dee/mpd__generator_8cc_source.html +++ b/docs/d7/dee/mpd__generator_8cc_source.html @@ -232,7 +232,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d7/def/mp4__media__parser_8cc_source.html b/docs/d7/def/mp4__media__parser_8cc_source.html index 75bbab2056..b5b54e70c9 100644 --- a/docs/d7/def/mp4__media__parser_8cc_source.html +++ b/docs/d7/def/mp4__media__parser_8cc_source.html @@ -850,13 +850,13 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
            KeySource is responsible for encryption key acquisition.
            Definition: key_source.h:30
            static scoped_refptr< MediaSample > CopyFrom(const uint8_t *data, size_t size, bool is_key_frame)
            Definition: media_sample.cc:45
            void Init(const InitCB &init_cb, const NewSampleCB &new_sample_cb, KeySource *decryption_key_source) override
            -
            DecryptorSource wraps KeySource and is responsible for decryptor management.
            +
            DecryptorSource wraps KeySource and is responsible for decryptor management.
            static bool StartBox(const uint8_t *buf, const size_t buf_size, FourCC *type, uint64_t *box_size, bool *err) WARN_UNUSED_RESULT
            Definition: box_reader.cc:55
            static BoxReader * ReadBox(const uint8_t *buf, const size_t buf_size, bool *err)
            Definition: box_reader.cc:37
            diff --git a/docs/d7/df9/byte__queue_8cc_source.html b/docs/d7/df9/byte__queue_8cc_source.html index 32b52ed400..962e024001 100644 --- a/docs/d7/df9/byte__queue_8cc_source.html +++ b/docs/d7/df9/byte__queue_8cc_source.html @@ -182,7 +182,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d8/d08/classshaka_1_1media_1_1H264ByteToUnitStreamConverter.html b/docs/d8/d08/classshaka_1_1media_1_1H264ByteToUnitStreamConverter.html index 9912573a41..3ae5237c0a 100644 --- a/docs/d8/d08/classshaka_1_1media_1_1H264ByteToUnitStreamConverter.html +++ b/docs/d8/d08/classshaka_1_1media_1_1H264ByteToUnitStreamConverter.html @@ -171,7 +171,7 @@ static const size_t kUnitS 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 c26efb8401..d506a1ba0d 100644 --- a/docs/d8/d08/classshaka_1_1media_1_1WebMClusterParser-members.html +++ b/docs/d8/d08/classshaka_1_1media_1_1WebMClusterParser-members.html @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 b31065d9ff..8386021cef 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 @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 1c660b07e3..38e8f02fa5 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 @@ -119,7 +119,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d8/d0d/media__sample_8cc_source.html b/docs/d8/d0d/media__sample_8cc_source.html index 605dc85c57..63121c4f66 100644 --- a/docs/d8/d0d/media__sample_8cc_source.html +++ b/docs/d8/d0d/media__sample_8cc_source.html @@ -195,7 +195,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 7f2b900ec5..33892c41b2 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 @@ -112,7 +112,7 @@ uint32_t sample_delta< diff --git a/docs/d8/d12/structshaka_1_1media_1_1mp4_1_1PrivFrame-members.html b/docs/d8/d12/structshaka_1_1media_1_1mp4_1_1PrivFrame-members.html index 33feb75318..1ce3a42068 100644 --- a/docs/d8/d12/structshaka_1_1media_1_1mp4_1_1PrivFrame-members.html +++ b/docs/d8/d12/structshaka_1_1media_1_1mp4_1_1PrivFrame-members.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 9c511a7d43..f19a1d8e3e 100644 --- a/docs/d8/d13/classshaka_1_1media_1_1BitReader-members.html +++ b/docs/d8/d13/classshaka_1_1media_1_1BitReader-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d8/d14/classshaka_1_1media_1_1VP8Parser.html b/docs/d8/d14/classshaka_1_1media_1_1VP8Parser.html index ab7b616ba5..2de56bcce9 100644 --- a/docs/d8/d14/classshaka_1_1media_1_1VP8Parser.html +++ b/docs/d8/d14/classshaka_1_1media_1_1VP8Parser.html @@ -235,7 +235,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 2e284e064d..31766bd725 100644 --- a/docs/d8/d16/structshaka_1_1media_1_1MuxerOptions-members.html +++ b/docs/d8/d16/structshaka_1_1media_1_1MuxerOptions-members.html @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d8/d19/bandwidth__estimator_8h_source.html b/docs/d8/d19/bandwidth__estimator_8h_source.html index 38de7e8079..f440cbd086 100644 --- a/docs/d8/d19/bandwidth__estimator_8h_source.html +++ b/docs/d8/d19/bandwidth__estimator_8h_source.html @@ -133,7 +133,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 e301069556..d7e7f0ac41 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 @@ -173,7 +173,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 5c0dee2632..e729dfc668 100644 --- a/docs/d8/d23/structshaka_1_1media_1_1SubsampleEntry-members.html +++ b/docs/d8/d23/structshaka_1_1media_1_1SubsampleEntry-members.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d8/d28/es__parser__h265_8h_source.html b/docs/d8/d28/es__parser__h265_8h_source.html index 093fbb0da9..811785b497 100644 --- a/docs/d8/d28/es__parser__h265_8h_source.html +++ b/docs/d8/d28/es__parser__h265_8h_source.html @@ -153,7 +153,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 17d2e424a5..92c9150845 100644 --- a/docs/d8/d33/webm__content__encodings__client_8h_source.html +++ b/docs/d8/d33/webm__content__encodings__client_8h_source.html @@ -98,49 +98,48 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
            9 #include <vector>
            10 
            11 #include "packager/base/callback.h"
            -
            12 #include "packager/base/compiler_specific.h"
            -
            13 #include "packager/media/formats/webm/webm_content_encodings.h"
            -
            14 #include "packager/media/formats/webm/webm_parser.h"
            -
            15 
            -
            16 namespace shaka {
            -
            17 namespace media {
            -
            18 
            -
            19 typedef std::vector<ContentEncoding*> ContentEncodings;
            -
            20 
            - -
            23  public:
            - -
            25  ~WebMContentEncodingsClient() override;
            -
            26 
            -
            27  const ContentEncodings& content_encodings() const;
            -
            28 
            -
            30  WebMParserClient* OnListStart(int id) override;
            -
            31  bool OnListEnd(int id) override;
            -
            32  bool OnUInt(int id, int64_t val) override;
            -
            33  bool OnBinary(int id, const uint8_t* data, int size) override;
            -
            34 
            -
            35  private:
            -
            36  std::unique_ptr<ContentEncoding> cur_content_encoding_;
            -
            37  bool content_encryption_encountered_;
            -
            38  ContentEncodings content_encodings_;
            -
            39 
            -
            40  // |content_encodings_| is ready. For debugging purpose.
            -
            41  bool content_encodings_ready_;
            -
            42 
            -
            43  DISALLOW_COPY_AND_ASSIGN(WebMContentEncodingsClient);
            -
            44 };
            -
            45 
            -
            46 } // namespace media
            -
            47 } // namespace shaka
            -
            48 
            -
            49 #endif // MEDIA_FORMATS_WEBM_WEBM_CONTENT_ENCODINGS_CLIENT_H_
            -
            Parser for WebM ContentEncodings element.
            -
            WebMParserClient * OnListStart(int id) override
            WebMParserClient methods.
            +
            12 #include "packager/media/formats/webm/webm_content_encodings.h"
            +
            13 #include "packager/media/formats/webm/webm_parser.h"
            +
            14 
            +
            15 namespace shaka {
            +
            16 namespace media {
            +
            17 
            +
            18 typedef std::vector<std::unique_ptr<ContentEncoding>> ContentEncodings;
            +
            19 
            + +
            22  public:
            + +
            24  ~WebMContentEncodingsClient() override;
            +
            25 
            +
            26  const ContentEncodings& content_encodings() const;
            +
            27 
            +
            29  WebMParserClient* OnListStart(int id) override;
            +
            30  bool OnListEnd(int id) override;
            +
            31  bool OnUInt(int id, int64_t val) override;
            +
            32  bool OnBinary(int id, const uint8_t* data, int size) override;
            +
            33 
            +
            34  private:
            +
            35  std::unique_ptr<ContentEncoding> cur_content_encoding_;
            +
            36  bool content_encryption_encountered_;
            +
            37  ContentEncodings content_encodings_;
            +
            38 
            +
            39  // |content_encodings_| is ready. For debugging purpose.
            +
            40  bool content_encodings_ready_;
            +
            41 
            +
            42  DISALLOW_COPY_AND_ASSIGN(WebMContentEncodingsClient);
            +
            43 };
            +
            44 
            +
            45 } // namespace media
            +
            46 } // namespace shaka
            +
            47 
            +
            48 #endif // MEDIA_FORMATS_WEBM_WEBM_CONTENT_ENCODINGS_CLIENT_H_
            +
            Parser for WebM ContentEncodings element.
            +
            WebMParserClient * OnListStart(int id) override
            WebMParserClient methods.
            diff --git a/docs/d8/d3e/classshaka_1_1media_1_1StreamDescriptorCompareFn.html b/docs/d8/d3e/classshaka_1_1media_1_1StreamDescriptorCompareFn.html index b4f8c5fd66..7d68515d0f 100644 --- a/docs/d8/d3e/classshaka_1_1media_1_1StreamDescriptorCompareFn.html +++ b/docs/d8/d3e/classshaka_1_1media_1_1StreamDescriptorCompareFn.html @@ -109,7 +109,7 @@ bool operator() (const diff --git a/docs/d8/d4d/aes__decryptor_8h_source.html b/docs/d8/d4d/aes__decryptor_8h_source.html index 92a2fa439a..17608c3f32 100644 --- a/docs/d8/d4d/aes__decryptor_8h_source.html +++ b/docs/d8/d4d/aes__decryptor_8h_source.html @@ -147,7 +147,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 3336461d39..97ff481b93 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 @@ -206,7 +206,7 @@ Additional Inherited Members diff --git a/docs/d8/d5c/classshaka_1_1media_1_1MediaStream.html b/docs/d8/d5c/classshaka_1_1media_1_1MediaStream.html index 08ae63ef7c..b20058ea35 100644 --- a/docs/d8/d5c/classshaka_1_1media_1_1MediaStream.html +++ b/docs/d8/d5c/classshaka_1_1media_1_1MediaStream.html @@ -225,7 +225,7 @@ const scoped_refptr< 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 86298bfb20..fb34ff6f64 100644 --- a/docs/d8/d6a/classshaka_1_1media_1_1ClusterBuilder-members.html +++ b/docs/d8/d6a/classshaka_1_1media_1_1ClusterBuilder-members.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 b73ba676fa..61ea90cf0e 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 @@ -173,7 +173,7 @@ Additional Inherited Members 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 014055eb9c..92df806811 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 @@ -114,7 +114,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d8/d74/classshaka_1_1media_1_1TracksBuilder.html b/docs/d8/d74/classshaka_1_1media_1_1TracksBuilder.html index 86e0660438..695c36be01 100644 --- a/docs/d8/d74/classshaka_1_1media_1_1TracksBuilder.html +++ b/docs/d8/d74/classshaka_1_1media_1_1TracksBuilder.html @@ -123,7 +123,7 @@ std::vector< uint8_t >  diff --git a/docs/d8/d86/classshaka_1_1media_1_1WebMTracksParser.html b/docs/d8/d86/classshaka_1_1media_1_1WebMTracksParser.html index a8ec87fe2b..d66d727795 100644 --- a/docs/d8/d86/classshaka_1_1media_1_1WebMTracksParser.html +++ b/docs/d8/d86/classshaka_1_1media_1_1WebMTracksParser.html @@ -225,7 +225,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 451eaae201..9f0f0717a7 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 @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d8/d8e/classshaka_1_1AdaptationSet.html b/docs/d8/d8e/classshaka_1_1AdaptationSet.html index 6df16bd758..0063b89610 100644 --- a/docs/d8/d8e/classshaka_1_1AdaptationSet.html +++ b/docs/d8/d8e/classshaka_1_1AdaptationSet.html @@ -167,7 +167,7 @@ template<MpdBuilder::MpdType type>

            Detailed Description

            AdaptationSet class provides methods to add Representations and <ContentProtection> elements to the AdaptationSet element.

            -

            Definition at line 167 of file mpd_builder.h.

            +

            Definition at line 165 of file mpd_builder.h.

            Constructor & Destructor Documentation

            @@ -229,7 +229,7 @@ template<MpdBuilder::MpdType type> -

            Definition at line 674 of file mpd_builder.cc.

            +

            Definition at line 671 of file mpd_builder.cc.

            @@ -263,7 +263,7 @@ template<MpdBuilder::MpdType type> -

            Definition at line 737 of file mpd_builder.cc.

            +

            Definition at line 733 of file mpd_builder.cc.

            @@ -297,7 +297,7 @@ template<MpdBuilder::MpdType type>
            Returns
            On success, returns a pointer to Representation. Otherwise returns NULL. The returned pointer is owned by the AdaptationSet instance.
            -

            Definition at line 693 of file mpd_builder.cc.

            +

            Definition at line 689 of file mpd_builder.cc.

            @@ -330,7 +330,7 @@ template<MpdBuilder::MpdType type> -

            Definition at line 749 of file mpd_builder.cc.

            +

            Definition at line 745 of file mpd_builder.cc.

            @@ -363,7 +363,7 @@ template<MpdBuilder::MpdType type> -

            Definition at line 836 of file mpd_builder.cc.

            +

            Definition at line 833 of file mpd_builder.cc.

            @@ -382,7 +382,7 @@ template<MpdBuilder::MpdType type>

            Makes a copy of AdaptationSet xml element with its child Representation and ContentProtection elements.

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

            Definition at line 759 of file mpd_builder.cc.

            +

            Definition at line 755 of file mpd_builder.cc.

            @@ -408,7 +408,7 @@ template<MpdBuilder::MpdType type>
            Returns
            Returns the value for group. If not set, returns a negative value.
            -

            Definition at line 846 of file mpd_builder.cc.

            +

            Definition at line 843 of file mpd_builder.cc.

            @@ -451,7 +451,7 @@ template<MpdBuilder::MpdType type> -

            Definition at line 857 of file mpd_builder.cc.

            +

            Definition at line 854 of file mpd_builder.cc.

            @@ -493,7 +493,7 @@ template<MpdBuilder::MpdType type> -

            Definition at line 868 of file mpd_builder.cc.

            +

            Definition at line 865 of file mpd_builder.cc.

            @@ -526,7 +526,7 @@ template<MpdBuilder::MpdType type> -

            Definition at line 842 of file mpd_builder.cc.

            +

            Definition at line 839 of file mpd_builder.cc.

            @@ -571,7 +571,7 @@ template<MpdBuilder::MpdType type>
            Attention
            This might get removed once DASH IF IOP specification makes a a clear guideline on how to handle key rotation. Also to get this working with shaka-player, this method DOES NOT update the PSSH element. Instead, it removes the element regardless of the content of pssh.
            -

            Definition at line 743 of file mpd_builder.cc.

            +

            Definition at line 739 of file mpd_builder.cc.

            @@ -582,7 +582,7 @@ template<MpdBuilder::MpdType type> 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 a8803f09e9..343418811b 100644 --- a/docs/d8/d91/classshaka_1_1media_1_1AesCtrEncryptor-members.html +++ b/docs/d8/d91/classshaka_1_1media_1_1AesCtrEncryptor-members.html @@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 37064c198e..ef398badd5 100644 --- a/docs/d8/d92/classshaka_1_1media_1_1AesRequestSigner-members.html +++ b/docs/d8/d92/classshaka_1_1media_1_1AesRequestSigner-members.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 d9c39d496d..1ba02bc8e8 100644 --- a/docs/d8/d92/structshaka_1_1media_1_1H264DecRefPicMarking-members.html +++ b/docs/d8/d92/structshaka_1_1media_1_1H264DecRefPicMarking-members.html @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 0ba2b716c8..68cba3310f 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 @@ -112,7 +112,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d8/d94/adts__constants_8cc_source.html b/docs/d8/d94/adts__constants_8cc_source.html index fe473e2117..aad07d2dcb 100644 --- a/docs/d8/d94/adts__constants_8cc_source.html +++ b/docs/d8/d94/adts__constants_8cc_source.html @@ -116,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d8/d94/pes__packet_8h_source.html b/docs/d8/d94/pes__packet_8h_source.html index 8e9c28bf34..cc207f44f3 100644 --- a/docs/d8/d94/pes__packet_8h_source.html +++ b/docs/d8/d94/pes__packet_8h_source.html @@ -159,7 +159,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 203ae49e22..d132bcd918 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 @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d8/d9a/fragmenter_8cc_source.html b/docs/d8/d9a/fragmenter_8cc_source.html index d075e660c7..0c8cd4c4df 100644 --- a/docs/d8/d9a/fragmenter_8cc_source.html +++ b/docs/d8/d9a/fragmenter_8cc_source.html @@ -300,7 +300,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d8/d9c/webm__tracks__parser_8cc_source.html b/docs/d8/d9c/webm__tracks__parser_8cc_source.html index 9db6140307..3f84581cbf 100644 --- a/docs/d8/d9c/webm__tracks__parser_8cc_source.html +++ b/docs/d8/d9c/webm__tracks__parser_8cc_source.html @@ -430,9 +430,9 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
            341 } // namespace shaka
            int64_t GetAudioDefaultDuration(const double timecode_scale_in_us) const
            -
            void Reset()
            Reset this object's state so it can process a new video track element.
            +
            void Reset()
            Reset this object's state so it can process a new video track element.
            int Parse(const uint8_t *buf, int size)
            Definition: webm_parser.cc:719
            -
            scoped_refptr< VideoStreamInfo > GetVideoStreamInfo(int64_t track_num, const std::string &codec_id, const std::vector< uint8_t > &codec_private, bool is_encrypted)
            +
            scoped_refptr< VideoStreamInfo > GetVideoStreamInfo(int64_t track_num, const std::string &codec_id, const std::vector< uint8_t > &codec_private, bool is_encrypted)
            int Parse(const uint8_t *buf, int size)
            void Reset()
            Reset this object's state so it can process a new audio track element.
            @@ -440,7 +440,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d8/d9f/udp__file_8h_source.html b/docs/d8/d9f/udp__file_8h_source.html index 4b43a6df55..c51fb0d5c3 100644 --- a/docs/d8/d9f/udp__file_8h_source.html +++ b/docs/d8/d9f/udp__file_8h_source.html @@ -147,7 +147,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 ccf09d69a4..2ffd87c854 100644 --- a/docs/d8/da3/classshaka_1_1media_1_1DecryptorSource-members.html +++ b/docs/d8/da3/classshaka_1_1media_1_1DecryptorSource-members.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 94661912dd..fc92feeec2 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 @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 1f7178d5ce..ea89cdcef3 100644 --- a/docs/d8/da6/classshaka_1_1media_1_1NaluReader-members.html +++ b/docs/d8/da6/classshaka_1_1media_1_1NaluReader-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d8/daa/stream__info_8h_source.html b/docs/d8/daa/stream__info_8h_source.html index f8d38f2443..c1456b68b3 100644 --- a/docs/d8/daa/stream__info_8h_source.html +++ b/docs/d8/daa/stream__info_8h_source.html @@ -205,7 +205,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d8/daf/namespaceshaka.html b/docs/d8/daf/namespaceshaka.html index 7cfe67dc55..af8b79e4a1 100644 --- a/docs/d8/daf/namespaceshaka.html +++ b/docs/d8/daf/namespaceshaka.html @@ -566,7 +566,7 @@ const char kPsshElementNam 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 242eead571..112c5f9ebf 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 @@ -259,7 +259,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 3789663095..83759de705 100644 --- a/docs/d8/db9/classshaka_1_1media_1_1WebMContentEncodingsClient-members.html +++ b/docs/d8/db9/classshaka_1_1media_1_1WebMContentEncodingsClient-members.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 691aa3c3f2..b381f4a2f8 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 @@ -118,7 +118,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 7939cdebba..cab5cd0556 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 @@ -173,7 +173,7 @@ Additional Inherited Members diff --git a/docs/d8/dca/ts__writer_8h_source.html b/docs/d8/dca/ts__writer_8h_source.html index 123e2870f7..544de8731b 100644 --- a/docs/d8/dca/ts__writer_8h_source.html +++ b/docs/d8/dca/ts__writer_8h_source.html @@ -162,7 +162,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 47c025bc98..68c87b16a4 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 @@ -98,7 +98,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 2673a20160..c8169703d6 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 @@ -117,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 ff333c84ff..355c28de53 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 @@ -129,7 +129,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 ec9fa9fed1..41b4b73a7a 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 @@ -135,7 +135,7 @@ std::vector< uint8_t >  diff --git a/docs/d8/de1/classshaka_1_1SimpleMpdNotifier.html b/docs/d8/de1/classshaka_1_1SimpleMpdNotifier.html index aa26b0f1fd..40f29e1df2 100644 --- a/docs/d8/de1/classshaka_1_1SimpleMpdNotifier.html +++ b/docs/d8/de1/classshaka_1_1SimpleMpdNotifier.html @@ -187,7 +187,7 @@ class SimpleMpdNotifierTes

            Implements shaka::MpdNotifier.

            -

            Definition at line 115 of file simple_mpd_notifier.cc.

            +

            Definition at line 116 of file simple_mpd_notifier.cc.

            @@ -215,7 +215,7 @@ class SimpleMpdNotifierTes

            Implements shaka::MpdNotifier.

            -

            Definition at line 128 of file simple_mpd_notifier.cc.

            +

            Definition at line 129 of file simple_mpd_notifier.cc.

            @@ -244,7 +244,7 @@ class SimpleMpdNotifierTes

            Implements shaka::MpdNotifier.

            -

            Definition at line 34 of file simple_mpd_notifier.cc.

            +

            Definition at line 35 of file simple_mpd_notifier.cc.

            @@ -305,7 +305,7 @@ class SimpleMpdNotifierTes

            Implements shaka::MpdNotifier.

            -

            Definition at line 99 of file simple_mpd_notifier.cc.

            +

            Definition at line 100 of file simple_mpd_notifier.cc.

            @@ -352,7 +352,7 @@ class SimpleMpdNotifierTes

            Implements shaka::MpdNotifier.

            -

            Definition at line 38 of file simple_mpd_notifier.cc.

            +

            Definition at line 39 of file simple_mpd_notifier.cc.

            @@ -413,7 +413,7 @@ class SimpleMpdNotifierTes

            Implements shaka::MpdNotifier.

            -

            Definition at line 85 of file simple_mpd_notifier.cc.

            +

            Definition at line 86 of file simple_mpd_notifier.cc.

            @@ -460,7 +460,7 @@ class SimpleMpdNotifierTes

            Implements shaka::MpdNotifier.

            -

            Definition at line 73 of file simple_mpd_notifier.cc.

            +

            Definition at line 74 of file simple_mpd_notifier.cc.

            @@ -471,7 +471,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 86612cbc96..9620ba1b14 100644 --- a/docs/d8/de6/webm__crypto__helpers_8h_source.html +++ b/docs/d8/de6/webm__crypto__helpers_8h_source.html @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 0e414a25cb..b7304bb914 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 @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 bfd1718f8f..43909cf19a 100644 --- a/docs/d8/dee/classshaka_1_1media_1_1AudioTimestampHelper-members.html +++ b/docs/d8/dee/classshaka_1_1media_1_1AudioTimestampHelper-members.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 dc8f8a8fa0..bcaa4523da 100644 --- a/docs/d8/dee/classshaka_1_1media_1_1VPxParser-members.html +++ b/docs/d8/dee/classshaka_1_1media_1_1VPxParser-members.html @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 c768e6045f..b848191751 100644 --- a/docs/d8/df0/webm_2single__segment__segmenter_8cc_source.html +++ b/docs/d8/df0/webm_2single__segment__segmenter_8cc_source.html @@ -181,7 +181,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 c59fffe8fc..9c6f227c20 100644 --- a/docs/d8/df7/classshaka_1_1media_1_1SegmentTestBase-members.html +++ b/docs/d8/df7/classshaka_1_1media_1_1SegmentTestBase-members.html @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 e7dc4ca433..477fcae2d6 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 @@ -147,7 +147,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 8103e9dc91..58bf1d43cd 100644 --- a/docs/d9/d00/structshaka_1_1media_1_1OnMediaEndParameters-members.html +++ b/docs/d9/d00/structshaka_1_1media_1_1OnMediaEndParameters-members.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 bc0f8cfc41..109fbbca84 100644 --- a/docs/d9/d01/mp4_2single__segment__segmenter_8h_source.html +++ b/docs/d9/d01/mp4_2single__segment__segmenter_8h_source.html @@ -140,7 +140,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d9/d08/mock__mpd__builder_8h_source.html b/docs/d9/d08/mock__mpd__builder_8h_source.html index 2fdc991d11..658943b685 100644 --- a/docs/d9/d08/mock__mpd__builder_8h_source.html +++ b/docs/d9/d08/mock__mpd__builder_8h_source.html @@ -156,31 +156,31 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
            67 } // namespace shaka
            68 
            69 #endif // MPD_BASE_MOCK_MPD_BUILDER_H_
            -
            virtual void AddNewSegment(uint64_t start_time, uint64_t duration, uint64_t size)
            +
            virtual void AddNewSegment(uint64_t start_time, uint64_t duration, uint64_t size)
            - -
            virtual void SetSampleDuration(uint32_t sample_duration)
            -
            virtual Representation * AddRepresentation(const MediaInfo &media_info)
            Definition: mpd_builder.cc:693
            -
            This class generates DASH MPDs (Media Presentation Descriptions).
            Definition: mpd_builder.h:58
            + +
            virtual void SetSampleDuration(uint32_t sample_duration)
            +
            virtual Representation * AddRepresentation(const MediaInfo &media_info)
            Definition: mpd_builder.cc:689
            +
            This class generates DASH MPDs (Media Presentation Descriptions).
            Definition: mpd_builder.h:57
            -
            virtual void AddContentProtectionElement(const ContentProtectionElement &element)
            Definition: mpd_builder.cc:737
            +
            virtual void AddContentProtectionElement(const ContentProtectionElement &element)
            Definition: mpd_builder.cc:733
            -
            virtual void AddRole(Role role)
            Definition: mpd_builder.cc:749
            -
            virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
            Definition: mpd_builder.cc:743
            -
            MpdType type() const
            Definition: mpd_builder.h:93
            -
            virtual void SetGroup(int group_number)
            Definition: mpd_builder.cc:842
            -
            virtual bool ToString(std::string *output)
            Definition: mpd_builder.cc:428
            -
            virtual void ForceSetSegmentAlignment(bool segment_alignment)
            Definition: mpd_builder.cc:836
            -
            virtual void AddContentProtectionElement(const ContentProtectionElement &element)
            - -
            virtual AdaptationSet * AddAdaptationSet(const std::string &lang)
            Definition: mpd_builder.cc:413
            -
            virtual int Group() const
            Definition: mpd_builder.cc:846
            +
            virtual void AddRole(Role role)
            Definition: mpd_builder.cc:745
            +
            virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
            Definition: mpd_builder.cc:739
            +
            MpdType type() const
            Definition: mpd_builder.h:92
            +
            virtual void SetGroup(int group_number)
            Definition: mpd_builder.cc:839
            +
            virtual bool ToString(std::string *output)
            Definition: mpd_builder.cc:427
            +
            virtual void ForceSetSegmentAlignment(bool segment_alignment)
            Definition: mpd_builder.cc:833
            +
            virtual void AddContentProtectionElement(const ContentProtectionElement &element)
            + +
            virtual AdaptationSet * AddAdaptationSet(const std::string &lang)
            Definition: mpd_builder.cc:412
            +
            virtual int Group() const
            Definition: mpd_builder.cc:843
            -
            virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
            +
            virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
            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 da9d9d91af..087e0c07b2 100644 --- a/docs/d9/d0b/classshaka_1_1media_1_1HlsNotifyMuxerListener-members.html +++ b/docs/d9/d0b/classshaka_1_1media_1_1HlsNotifyMuxerListener-members.html @@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d9/d0c/classshaka_1_1media_1_1RsaPublicKey.html b/docs/d9/d0c/classshaka_1_1media_1_1RsaPublicKey.html index 478335a052..ed2a537682 100644 --- a/docs/d9/d0c/classshaka_1_1media_1_1RsaPublicKey.html +++ b/docs/d9/d0c/classshaka_1_1media_1_1RsaPublicKey.html @@ -141,7 +141,7 @@ Static Public Member Functions

            Create an RsaPublicKey object using a DER encoded PKCS#1 RSAPublicKey.

            Returns
            The created RsaPrivateKey object on success, NULL otherwise.
            -

            Definition at line 180 of file rsa_key.cc.

            +

            Definition at line 171 of file rsa_key.cc.

            @@ -177,7 +177,7 @@ Static Public Member Functions
            Returns
            true if successful, false otherwise.
            -

            Definition at line 185 of file rsa_key.cc.

            +

            Definition at line 176 of file rsa_key.cc.

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

            Verify RSASSA-PSS signature.

            Returns
            true if verification succeeds, false otherwise.
            -

            Definition at line 210 of file rsa_key.cc.

            +

            Definition at line 200 of file rsa_key.cc.

            @@ -218,7 +218,7 @@ Static Public Member Functions diff --git a/docs/d9/d13/classshaka_1_1media_1_1BufferReader.html b/docs/d9/d13/classshaka_1_1media_1_1BufferReader.html index 08860ed33c..442ec3dfac 100644 --- a/docs/d9/d13/classshaka_1_1media_1_1BufferReader.html +++ b/docs/d9/d13/classshaka_1_1media_1_1BufferReader.html @@ -276,7 +276,7 @@ bool ReadNBytesInto8s diff --git a/docs/d9/d15/key__rotation__fragmenter_8cc_source.html b/docs/d9/d15/key__rotation__fragmenter_8cc_source.html index 4ff1e44782..91f75a7dc5 100644 --- a/docs/d9/d15/key__rotation__fragmenter_8cc_source.html +++ b/docs/d9/d15/key__rotation__fragmenter_8cc_source.html @@ -231,7 +231,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
            virtual Status GetCryptoPeriodKey(uint32_t crypto_period_index, TrackType track_type, EncryptionKey *key)=0
            const std::vector< uint8_t > & iv() const
            Definition: aes_cryptor.h:81
            -
            static bool GenerateRandomIv(FourCC protection_scheme, std::vector< uint8_t > *iv)
            Definition: aes_cryptor.cc:109
            +
            static bool GenerateRandomIv(FourCC protection_scheme, std::vector< uint8_t > *iv)
            Definition: aes_cryptor.cc:107
            EncryptingFragmenter generates MP4 fragments with sample encrypted.
            @@ -244,7 +244,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 7d780c7978..8aa2e2a2b8 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 @@ -180,7 +180,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 ca2358ce6d..5a53953ba1 100644 --- a/docs/d9/d26/classshaka_1_1media_1_1AesEncryptor-members.html +++ b/docs/d9/d26/classshaka_1_1media_1_1AesEncryptor-members.html @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 fd8e8a9254..d8e333b884 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 @@ -203,7 +203,7 @@ void set_progress_target
            Returns
            OK on success, an error status otherwise.
            -

            Definition at line 322 of file segmenter.cc.

            +

            Definition at line 320 of file segmenter.cc.

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

            Definition at line 380 of file segmenter.cc.

            +

            Definition at line 378 of file segmenter.cc.

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

            Definition at line 166 of file segmenter.cc.

            +

            Definition at line 165 of file segmenter.cc.

            @@ -430,7 +430,7 @@ void set_progress_target 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 80d678663f..db6ae4c8b7 100644 --- a/docs/d9/d36/classshaka_1_1media_1_1TracksBuilder-members.html +++ b/docs/d9/d36/classshaka_1_1media_1_1TracksBuilder-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d9/d3a/classshaka_1_1media_1_1File-members.html b/docs/d9/d3a/classshaka_1_1media_1_1File-members.html index 4bdaa5ee3a..b6ac278985 100644 --- a/docs/d9/d3a/classshaka_1_1media_1_1File-members.html +++ b/docs/d9/d3a/classshaka_1_1media_1_1File-members.html @@ -116,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d9/d3b/webm__content__encodings_8h_source.html b/docs/d9/d3b/webm__content__encodings_8h_source.html index 8bcae58b13..c58c0f9370 100644 --- a/docs/d9/d3b/webm__content__encodings_8h_source.html +++ b/docs/d9/d3b/webm__content__encodings_8h_source.html @@ -178,7 +178,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 07b139f15e..d96e8e266c 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 @@ -166,7 +166,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 9c8f1f25e0..21a6797bb6 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 @@ -173,7 +173,7 @@ Additional Inherited Members 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 7f0df56998..ddfb509410 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 @@ -320,7 +320,7 @@ Public Member Functions diff --git a/docs/d9/d66/classshaka_1_1media_1_1mp2t_1_1EsParserAdts-members.html b/docs/d9/d66/classshaka_1_1media_1_1mp2t_1_1EsParserAdts-members.html index c1afb201f3..6ce8d8d810 100644 --- a/docs/d9/d66/classshaka_1_1media_1_1mp2t_1_1EsParserAdts-members.html +++ b/docs/d9/d66/classshaka_1_1media_1_1mp2t_1_1EsParserAdts-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d9/d67/structshaka_1_1media_1_1H265VuiParameters.html b/docs/d9/d67/structshaka_1_1media_1_1H265VuiParameters.html index 2b20074754..bb4eb02fea 100644 --- a/docs/d9/d67/structshaka_1_1media_1_1H265VuiParameters.html +++ b/docs/d9/d67/structshaka_1_1media_1_1H265VuiParameters.html @@ -131,7 +131,7 @@ int min_spatial_segmentati 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 53955ec9e5..0c90ac1b0e 100644 --- a/docs/d9/d6a/structshaka_1_1media_1_1H264SliceHeader-members.html +++ b/docs/d9/d6a/structshaka_1_1media_1_1H264SliceHeader-members.html @@ -154,7 +154,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d9/d76/ts__muxer_8cc_source.html b/docs/d9/d76/ts__muxer_8cc_source.html index fa93dc1bae..fb36235177 100644 --- a/docs/d9/d76/ts__muxer_8cc_source.html +++ b/docs/d9/d76/ts__muxer_8cc_source.html @@ -155,7 +155,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 7e1244d59b..ee6418ee75 100644 --- a/docs/d9/d81/classshaka_1_1media_1_1ClosureThread-members.html +++ b/docs/d9/d81/classshaka_1_1media_1_1ClosureThread-members.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d9/d86/limits_8h_source.html b/docs/d9/d86/limits_8h_source.html index a8832db5f0..7d3a0b4a25 100644 --- a/docs/d9/d86/limits_8h_source.html +++ b/docs/d9/d86/limits_8h_source.html @@ -141,7 +141,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d9/d87/classshaka_1_1media_1_1WebMContentEncodingsClient.html b/docs/d9/d87/classshaka_1_1media_1_1WebMContentEncodingsClient.html index c2afde558e..e626998a52 100644 --- a/docs/d9/d87/classshaka_1_1media_1_1WebMContentEncodingsClient.html +++ b/docs/d9/d87/classshaka_1_1media_1_1WebMContentEncodingsClient.html @@ -144,7 +144,7 @@ Additional Inherited Members

            Detailed Description

            Parser for WebM ContentEncodings element.

            -

            Definition at line 22 of file webm_content_encodings_client.h.

            +

            Definition at line 21 of file webm_content_encodings_client.h.


            The documentation for this class was generated from the following files:
            • media/formats/webm/webm_content_encodings_client.h
            • media/formats/webm/webm_content_encodings_client.cc
            • @@ -152,7 +152,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 6163811422..4eb374b44b 100644 --- a/docs/d9/d8c/classshaka_1_1media_1_1AesRequestSigner.html +++ b/docs/d9/d8c/classshaka_1_1media_1_1AesRequestSigner.html @@ -188,7 +188,7 @@ Additional Inherited Members diff --git a/docs/d9/d90/classshaka_1_1media_1_1ProtectionSystemSpecificInfo-members.html b/docs/d9/d90/classshaka_1_1media_1_1ProtectionSystemSpecificInfo-members.html index 01c8d37022..24414d56d9 100644 --- a/docs/d9/d90/classshaka_1_1media_1_1ProtectionSystemSpecificInfo-members.html +++ b/docs/d9/d90/classshaka_1_1media_1_1ProtectionSystemSpecificInfo-members.html @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d9/d90/text__track_8h_source.html b/docs/d9/d90/text__track_8h_source.html index a300a97f4a..9128311d71 100644 --- a/docs/d9/d90/text__track_8h_source.html +++ b/docs/d9/d90/text__track_8h_source.html @@ -134,7 +134,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d9/d93/media__stream_8h_source.html b/docs/d9/d93/media__stream_8h_source.html index 6e5b1e5a73..2527d2710a 100644 --- a/docs/d9/d93/media__stream_8h_source.html +++ b/docs/d9/d93/media__stream_8h_source.html @@ -170,7 +170,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d9/da4/stream__descriptor_8h_source.html b/docs/d9/da4/stream__descriptor_8h_source.html index e91e63d2e1..8f6fa148a0 100644 --- a/docs/d9/da4/stream__descriptor_8h_source.html +++ b/docs/d9/da4/stream__descriptor_8h_source.html @@ -144,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d9/da5/classshaka_1_1media_1_1MpdNotifyMuxerListener.html b/docs/d9/da5/classshaka_1_1media_1_1MpdNotifyMuxerListener.html index 9bb78229ee..3380838161 100644 --- a/docs/d9/da5/classshaka_1_1media_1_1MpdNotifyMuxerListener.html +++ b/docs/d9/da5/classshaka_1_1media_1_1MpdNotifyMuxerListener.html @@ -513,7 +513,7 @@ Additional Inherited Members diff --git a/docs/d9/da6/structshaka_1_1media_1_1Cue-members.html b/docs/d9/da6/structshaka_1_1media_1_1Cue-members.html index 96b5b6fe9b..62ce502d48 100644 --- a/docs/d9/da6/structshaka_1_1media_1_1Cue-members.html +++ b/docs/d9/da6/structshaka_1_1media_1_1Cue-members.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 74ddfffe44..9a971c3163 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 @@ -116,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 afa83d2b8e..d12c90c96c 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 @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d9/db9/content__protection__element_8cc_source.html b/docs/d9/db9/content__protection__element_8cc_source.html index e10091fe23..eb09ebf149 100644 --- a/docs/d9/db9/content__protection__element_8cc_source.html +++ b/docs/d9/db9/content__protection__element_8cc_source.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d9/db9/muxer_8cc_source.html b/docs/d9/db9/muxer_8cc_source.html index 0c814192e6..a6b2e6e86a 100644 --- a/docs/d9/db9/muxer_8cc_source.html +++ b/docs/d9/db9/muxer_8cc_source.html @@ -220,7 +220,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d9/dbd/classshaka_1_1media_1_1MemoryFile.html b/docs/d9/dbd/classshaka_1_1media_1_1MemoryFile.html index 6dd15c454e..73ac94c517 100644 --- a/docs/d9/dbd/classshaka_1_1media_1_1MemoryFile.html +++ b/docs/d9/dbd/classshaka_1_1media_1_1MemoryFile.html @@ -485,7 +485,7 @@ bool  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 db2c7f943f..223af9042a 100644 --- a/docs/d9/dc4/classshaka_1_1media_1_1BufferReader-members.html +++ b/docs/d9/dc4/classshaka_1_1media_1_1BufferReader-members.html @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 d96ff4e3df..77141a1568 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 @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d9/dc8/webm__constants_8cc_source.html b/docs/d9/dc8/webm__constants_8cc_source.html index 5b4a24f56a..043fba97ee 100644 --- a/docs/d9/dc8/webm__constants_8cc_source.html +++ b/docs/d9/dc8/webm__constants_8cc_source.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d9/dcc/webm__video__client_8h_source.html b/docs/d9/dcc/webm__video__client_8h_source.html index bc9d7f2003..96af956c6a 100644 --- a/docs/d9/dcc/webm__video__client_8h_source.html +++ b/docs/d9/dcc/webm__video__client_8h_source.html @@ -142,14 +142,14 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              61 } // namespace shaka
              62 
              63 #endif // MEDIA_FORMATS_WEBM_WEBM_VIDEO_CLIENT_H_
              -
              void Reset()
              Reset this object's state so it can process a new video track element.
              +
              void Reset()
              Reset this object's state so it can process a new video track element.
              Helper class used to parse a Video element inside a TrackEntry element.
              -
              scoped_refptr< VideoStreamInfo > GetVideoStreamInfo(int64_t track_num, const std::string &codec_id, const std::vector< uint8_t > &codec_private, bool is_encrypted)
              +
              scoped_refptr< VideoStreamInfo > GetVideoStreamInfo(int64_t track_num, const std::string &codec_id, const std::vector< uint8_t > &codec_private, bool is_encrypted)
              diff --git a/docs/d9/de3/muxer__listener__internal_8cc_source.html b/docs/d9/de3/muxer__listener__internal_8cc_source.html index 7dbd3f7574..9fe9384172 100644 --- a/docs/d9/de3/muxer__listener__internal_8cc_source.html +++ b/docs/d9/de3/muxer__listener__internal_8cc_source.html @@ -348,7 +348,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d9/de6/classshaka_1_1media_1_1LocalFile.html b/docs/d9/de6/classshaka_1_1media_1_1LocalFile.html index 281b9069d7..c5dc3d9736 100644 --- a/docs/d9/de6/classshaka_1_1media_1_1LocalFile.html +++ b/docs/d9/de6/classshaka_1_1media_1_1LocalFile.html @@ -502,7 +502,7 @@ bool  diff --git a/docs/d9/dea/classshaka_1_1media_1_1FixedKeySource-members.html b/docs/d9/dea/classshaka_1_1media_1_1FixedKeySource-members.html index 6f8e61a521..4f6c55e115 100644 --- a/docs/d9/dea/classshaka_1_1media_1_1FixedKeySource-members.html +++ b/docs/d9/dea/classshaka_1_1media_1_1FixedKeySource-members.html @@ -116,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 1e747f7b0a..90247cb78d 100644 --- a/docs/d9/ded/aac__audio__specific__config_8cc_source.html +++ b/docs/d9/ded/aac__audio__specific__config_8cc_source.html @@ -358,7 +358,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 251ca96e05..75bfaee534 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/d9/df9/classshaka_1_1media_1_1OffsetByteQueue.html b/docs/d9/df9/classshaka_1_1media_1_1OffsetByteQueue.html index 4fbd2f0f97..09996318f7 100644 --- a/docs/d9/df9/classshaka_1_1media_1_1OffsetByteQueue.html +++ b/docs/d9/df9/classshaka_1_1media_1_1OffsetByteQueue.html @@ -242,7 +242,7 @@ false if max_offset > diff --git a/docs/d9/dff/structshaka_1_1media_1_1H264ModificationOfPicNum.html b/docs/d9/dff/structshaka_1_1media_1_1H264ModificationOfPicNum.html index 30d54604d5..2e10051e49 100644 --- a/docs/d9/dff/structshaka_1_1media_1_1H264ModificationOfPicNum.html +++ b/docs/d9/dff/structshaka_1_1media_1_1H264ModificationOfPicNum.html @@ -112,14 +112,14 @@ union {

              Detailed Description

              -

              Definition at line 118 of file h264_parser.h.

              +

              Definition at line 119 of file h264_parser.h.


              The documentation for this struct was generated from the following file: diff --git a/docs/da/d04/audio__stream__info_8cc_source.html b/docs/da/d04/audio__stream__info_8cc_source.html index 525f52fa08..c56dacc489 100644 --- a/docs/da/d04/audio__stream__info_8cc_source.html +++ b/docs/da/d04/audio__stream__info_8cc_source.html @@ -223,7 +223,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 225e267d94..4dfabe4421 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 @@ -146,7 +146,7 @@ uint32_t pid () 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 13c3937e1a..3d3bffb27f 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 @@ -120,7 +120,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 bd4419666b..3b965b4881 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 @@ -141,7 +141,7 @@ virtual void Reset ()= diff --git a/docs/da/d22/key__rotation__fragmenter_8h_source.html b/docs/da/d22/key__rotation__fragmenter_8h_source.html index 61e6c13122..c64a3c8f1f 100644 --- a/docs/da/d22/key__rotation__fragmenter_8h_source.html +++ b/docs/da/d22/key__rotation__fragmenter_8h_source.html @@ -156,7 +156,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 e1e37955fd..9b3bd57b16 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 @@ -164,7 +164,7 @@ const scoped_refptr
              diff --git a/docs/da/d23/ts__muxer_8h_source.html b/docs/da/d23/ts__muxer_8h_source.html index db11965622..85b69f18de 100644 --- a/docs/da/d23/ts__muxer_8h_source.html +++ b/docs/da/d23/ts__muxer_8h_source.html @@ -137,7 +137,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/da/d24/h265__parser_8h_source.html b/docs/da/d24/h265__parser_8h_source.html index 224a0b5c3a..7e31b7c3af 100644 --- a/docs/da/d24/h265__parser_8h_source.html +++ b/docs/da/d24/h265__parser_8h_source.html @@ -419,8 +419,8 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              342  bool sub_pic_hdr_params_present_flag,
              343  H26xBitReader* br);
              344 
              -
              345  typedef std::map<int, H265Sps*> SpsById;
              -
              346  typedef std::map<int, H265Pps*> PpsById;
              +
              345  typedef std::map<int, std::unique_ptr<H265Sps>> SpsById;
              +
              346  typedef std::map<int, std::unique_ptr<H265Pps>> PpsById;
              347 
              348  SpsById active_spses_;
              349  PpsById active_ppses_;
              @@ -434,23 +434,23 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              357 #endif // MEDIA_CODECS_H265_PARSER_H_
              -
              Result ParseSliceHeader(const Nalu &nalu, H265SliceHeader *slice_header)
              Definition: h265_parser.cc:187
              +
              Result ParseSliceHeader(const Nalu &nalu, H265SliceHeader *slice_header)
              Definition: h265_parser.cc:183
              -
              Result ParsePps(const Nalu &nalu, int *pps_id)
              Definition: h265_parser.cc:404
              +
              Result ParsePps(const Nalu &nalu, int *pps_id)
              Definition: h265_parser.cc:400
              -
              const H265Sps * GetSps(int sps_id)
              Definition: h265_parser.cc:634
              +
              const H265Sps * GetSps(int sps_id)
              Definition: h265_parser.cc:628
              -
              const H265Pps * GetPps(int pps_id)
              Definition: h265_parser.cc:630
              +
              const H265Pps * GetPps(int pps_id)
              Definition: h265_parser.cc:624
              -
              Result ParseSps(const Nalu &nalu, int *sps_id)
              Definition: h265_parser.cc:513
              +
              Result ParseSps(const Nalu &nalu, int *sps_id)
              Definition: h265_parser.cc:508
              diff --git a/docs/da/d2a/text__stream__info_8h_source.html b/docs/da/d2a/text__stream__info_8h_source.html index dbb385f0d8..7b9181409b 100644 --- a/docs/da/d2a/text__stream__info_8h_source.html +++ b/docs/da/d2a/text__stream__info_8h_source.html @@ -136,7 +136,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 45b5d2f88e..60e9e4772c 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 @@ -117,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 9f034896b0..f8cfcab5b0 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 @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 2c92d307a4..1d008be00f 100644 --- a/docs/da/d41/mp4_2multi__segment__segmenter_8h_source.html +++ b/docs/da/d41/mp4_2multi__segment__segmenter_8h_source.html @@ -143,7 +143,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/da/d43/structshaka_1_1ContentProtectionElement.html b/docs/da/d43/structshaka_1_1ContentProtectionElement.html index ec5ce194a1..b41d8d6f97 100644 --- a/docs/da/d43/structshaka_1_1ContentProtectionElement.html +++ b/docs/da/d43/structshaka_1_1ContentProtectionElement.html @@ -123,7 +123,7 @@ std::vector< El diff --git a/docs/da/d4e/classshaka_1_1media_1_1AudioStreamInfo.html b/docs/da/d4e/classshaka_1_1media_1_1AudioStreamInfo.html index 882e7f6d71..b911ea0ad6 100644 --- a/docs/da/d4e/classshaka_1_1media_1_1AudioStreamInfo.html +++ b/docs/da/d4e/classshaka_1_1media_1_1AudioStreamInfo.html @@ -313,7 +313,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 1f6d39d871..2f915ef4ab 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 @@ -182,7 +182,7 @@ Additional Inherited Members diff --git a/docs/da/d53/es__parser__h265_8cc_source.html b/docs/da/d53/es__parser__h265_8cc_source.html index 1fada0743c..235ae9865b 100644 --- a/docs/da/d53/es__parser__h265_8cc_source.html +++ b/docs/da/d53/es__parser__h265_8cc_source.html @@ -259,7 +259,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 8bddfc2760..d8134ffd74 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 @@ -185,7 +185,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 01bcbde0bc..b0d76035ba 100644 --- a/docs/da/d5c/widevine__key__source_8h_source.html +++ b/docs/da/d5c/widevine__key__source_8h_source.html @@ -142,7 +142,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              67  ClosureThread key_production_thread_;
              68 
              69  private:
              -
              70  typedef std::map<TrackType, EncryptionKey*> EncryptionKeyMap;
              +
              70  typedef std::map<TrackType, std::unique_ptr<EncryptionKey>> EncryptionKeyMap;
              71  class RefCountedEncryptionKeyMap;
              @@ -207,22 +207,22 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              132 } // namespace shaka
              133 
              134 #endif // MEDIA_BASE_WIDEVINE_KEY_SOURCE_H_
              -
              Status FetchKeys(const std::vector< uint8_t > &pssh_box) override
              -
              Status GetCryptoPeriodKey(uint32_t crypto_period_index, TrackType track_type, EncryptionKey *key) override
              -
              Status GetKey(TrackType track_type, EncryptionKey *key) override
              +
              Status FetchKeys(const std::vector< uint8_t > &pssh_box) override
              +
              Status GetCryptoPeriodKey(uint32_t crypto_period_index, TrackType track_type, EncryptionKey *key) override
              +
              Status GetKey(TrackType track_type, EncryptionKey *key) override
              -
              void set_key_fetcher(std::unique_ptr< KeyFetcher > key_fetcher)
              -
              WidevineKeySource(const std::string &server_url, bool add_common_pssh)
              +
              void set_key_fetcher(std::unique_ptr< KeyFetcher > key_fetcher)
              +
              WidevineKeySource(const std::string &server_url, bool add_common_pssh)
              -
              void set_signer(std::unique_ptr< RequestSigner > signer)
              +
              void set_signer(std::unique_ptr< RequestSigner > signer)
              KeySource is responsible for encryption key acquisition.
              Definition: key_source.h:30
              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 bc392ff2e0..e4325dfc26 100644 --- a/docs/da/d5e/classshaka_1_1media_1_1H264VideoSliceHeaderParser-members.html +++ b/docs/da/d5e/classshaka_1_1media_1_1H264VideoSliceHeaderParser-members.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 4f52cf5d64..bee8e5beb5 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 @@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/da/d64/classshaka_1_1media_1_1mp2t_1_1H264ProgramMapTableWriter-members.html b/docs/da/d64/classshaka_1_1media_1_1mp2t_1_1H264ProgramMapTableWriter-members.html index 093c7071bc..b18a7910a9 100644 --- a/docs/da/d64/classshaka_1_1media_1_1mp2t_1_1H264ProgramMapTableWriter-members.html +++ b/docs/da/d64/classshaka_1_1media_1_1mp2t_1_1H264ProgramMapTableWriter-members.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 b0b6f5bf65..eb41ddc1a8 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 @@ -120,7 +120,7 @@ int16_t roll_distance< diff --git a/docs/da/d7a/fixed__key__encryption__flags_8h_source.html b/docs/da/d7a/fixed__key__encryption__flags_8h_source.html index ce693195fc..4774dcd349 100644 --- a/docs/da/d7a/fixed__key__encryption__flags_8h_source.html +++ b/docs/da/d7a/fixed__key__encryption__flags_8h_source.html @@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 ed4f31e557..12cbec9557 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 @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/da/d88/mp4__muxer_8cc_source.html b/docs/da/d88/mp4__muxer_8cc_source.html index c9db36c45b..9c52e5725b 100644 --- a/docs/da/d88/mp4__muxer_8cc_source.html +++ b/docs/da/d88/mp4__muxer_8cc_source.html @@ -503,7 +503,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 f3126f5b5a..62038e4f9c 100644 --- a/docs/da/d8b/classshaka_1_1media_1_1WebMMediaParser-members.html +++ b/docs/da/d8b/classshaka_1_1media_1_1WebMMediaParser-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/da/d8e/container__names_8cc_source.html b/docs/da/d8e/container__names_8cc_source.html index fa8565d04a..06524e3072 100644 --- a/docs/da/d8e/container__names_8cc_source.html +++ b/docs/da/d8e/container__names_8cc_source.html @@ -1863,7 +1863,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 fb8cddcddd..60bafe16e1 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 @@ -98,7 +98,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 2b0f7b4c34..e370590b98 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 @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/da/d9f/classshaka_1_1MpdNotifierFactory-members.html b/docs/da/d9f/classshaka_1_1MpdNotifierFactory-members.html index 4cacd305b5..6e15fcfd8c 100644 --- a/docs/da/d9f/classshaka_1_1MpdNotifierFactory-members.html +++ b/docs/da/d9f/classshaka_1_1MpdNotifierFactory-members.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 339445b863..3f7abe3e23 100644 --- a/docs/da/d9f/classshaka_1_1media_1_1MockMuxerListener-members.html +++ b/docs/da/d9f/classshaka_1_1media_1_1MockMuxerListener-members.html @@ -117,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 ecfea2f772..25806da0c5 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 @@ -145,7 +145,7 @@ static const int kPacketSi diff --git a/docs/da/db2/classshaka_1_1Representation-members.html b/docs/da/db2/classshaka_1_1Representation-members.html index 2d1e62d80e..e2eaf9a088 100644 --- a/docs/da/db2/classshaka_1_1Representation-members.html +++ b/docs/da/db2/classshaka_1_1Representation-members.html @@ -112,7 +112,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 5eed1aba4b..9707f8ff6c 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 @@ -182,7 +182,7 @@ Additional Inherited Members diff --git a/docs/da/dc3/status_8cc_source.html b/docs/da/dc3/status_8cc_source.html index a05398adfa..9105a34136 100644 --- a/docs/da/dc3/status_8cc_source.html +++ b/docs/da/dc3/status_8cc_source.html @@ -168,7 +168,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 cd6ceabcf2..c14e022acc 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 @@ -215,7 +215,7 @@ Additional Inherited Members diff --git a/docs/da/dcb/es__descriptor_8h_source.html b/docs/da/dcb/es__descriptor_8h_source.html index 0abe3f2436..1f94454305 100644 --- a/docs/da/dcb/es__descriptor_8h_source.html +++ b/docs/da/dcb/es__descriptor_8h_source.html @@ -183,7 +183,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 a98105c100..64c95c6e1b 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 @@ -173,7 +173,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 55e33f1ee5..2b68cfb240 100644 --- a/docs/da/dd0/webm__info__parser_8h_source.html +++ b/docs/da/dd0/webm__info__parser_8h_source.html @@ -138,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/da/dd1/fragmenter_8h_source.html b/docs/da/dd1/fragmenter_8h_source.html index 559d3df492..424f39e622 100644 --- a/docs/da/dd1/fragmenter_8h_source.html +++ b/docs/da/dd1/fragmenter_8h_source.html @@ -205,7 +205,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 1fa4357905..9916b01724 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 @@ -107,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 7c74129162..17a1298679 100644 --- a/docs/da/dd6/classshaka_1_1media_1_1H264ByteToUnitStreamConverter-members.html +++ b/docs/da/dd6/classshaka_1_1media_1_1H264ByteToUnitStreamConverter-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 9597bf30b6..a2f6ae44fc 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 @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 4fc7fbf262..51bf2bcc73 100644 --- a/docs/da/dda/structshaka_1_1media_1_1H264SEIRecoveryPoint-members.html +++ b/docs/da/dda/structshaka_1_1media_1_1H264SEIRecoveryPoint-members.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/da/ddd/classshaka_1_1media_1_1WidevineKeySource.html b/docs/da/ddd/classshaka_1_1media_1_1WidevineKeySource.html index ad311f7839..111af25c22 100644 --- a/docs/da/ddd/classshaka_1_1media_1_1WidevineKeySource.html +++ b/docs/da/ddd/classshaka_1_1media_1_1WidevineKeySource.html @@ -195,7 +195,7 @@ static std::string 137 of file widevine_key_source.cc.

              +

              Definition at line 134 of file widevine_key_source.cc.

              @@ -232,7 +232,7 @@ static std::string shaka::media::KeySource.

              -

              Definition at line 176 of file widevine_key_source.cc.

              +

              Definition at line 172 of file widevine_key_source.cc.

              @@ -268,7 +268,7 @@ static std::string shaka::media::KeySource.

              -

              Definition at line 203 of file widevine_key_source.cc.

              +

              Definition at line 199 of file widevine_key_source.cc.

              @@ -304,7 +304,7 @@ static std::string shaka::media::KeySource.

              -

              Definition at line 224 of file widevine_key_source.cc.

              +

              Definition at line 220 of file widevine_key_source.cc.

              @@ -341,7 +341,7 @@ static std::string 
              Returns
              OK on success, an error status otherwise.
              -

              Definition at line 165 of file widevine_key_source.cc.

              +

              Definition at line 161 of file widevine_key_source.cc.

              @@ -395,7 +395,7 @@ static std::string shaka::media::KeySource.

              -

              Definition at line 259 of file widevine_key_source.cc.

              +

              Definition at line 252 of file widevine_key_source.cc.

              @@ -442,7 +442,7 @@ static std::string shaka::media::KeySource.

              -

              Definition at line 233 of file widevine_key_source.cc.

              +

              Definition at line 229 of file widevine_key_source.cc.

              @@ -489,7 +489,7 @@ static std::string shaka::media::KeySource.

              -

              Definition at line 243 of file widevine_key_source.cc.

              +

              Definition at line 239 of file widevine_key_source.cc.

              @@ -514,7 +514,7 @@ static std::string 285 of file widevine_key_source.cc.

              +

              Definition at line 278 of file widevine_key_source.cc.

              @@ -539,7 +539,7 @@ static std::string 281 of file widevine_key_source.cc.

              +

              Definition at line 274 of file widevine_key_source.cc.

              @@ -550,7 +550,7 @@ static std::string  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 87f9a433e1..63fe0a27a0 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 @@ -116,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/da/de2/mock__mpd__builder_8cc_source.html b/docs/da/de2/mock__mpd__builder_8cc_source.html index ae5570749b..f6020fcba8 100644 --- a/docs/da/de2/mock__mpd__builder_8cc_source.html +++ b/docs/da/de2/mock__mpd__builder_8cc_source.html @@ -123,7 +123,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/da/de4/classshaka_1_1media_1_1WebMClusterParser.html b/docs/da/de4/classshaka_1_1media_1_1WebMClusterParser.html index d972fe299f..bd436c37ed 100644 --- a/docs/da/de4/classshaka_1_1media_1_1WebMClusterParser.html +++ b/docs/da/de4/classshaka_1_1media_1_1WebMClusterParser.html @@ -365,7 +365,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 2e146cb653..e4adfc9967 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 33157d45d4..3be3eec80f 100644 --- a/docs/da/de8/classshaka_1_1media_1_1AudioStreamInfo-members.html +++ b/docs/da/de8/classshaka_1_1media_1_1AudioStreamInfo-members.html @@ -126,7 +126,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 11559b311c..0ecdbdef0c 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 @@ -179,7 +179,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 a36958ca24..8f2cb8eed3 100644 --- a/docs/da/df0/classshaka_1_1media_1_1H264VideoSliceHeaderParser.html +++ b/docs/da/df0/classshaka_1_1media_1_1H264VideoSliceHeaderParser.html @@ -152,7 +152,7 @@ int64_t  diff --git a/docs/da/df4/aes__decryptor_8cc_source.html b/docs/da/df4/aes__decryptor_8cc_source.html index c434512e24..5fc9d73711 100644 --- a/docs/da/df4/aes__decryptor_8cc_source.html +++ b/docs/da/df4/aes__decryptor_8cc_source.html @@ -254,11 +254,11 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              AesCbcDecryptor(CbcPaddingScheme padding_scheme)
              const std::vector< uint8_t > & iv() const
              Definition: aes_cryptor.h:81
              bool InitializeWithIv(const std::vector< uint8_t > &key, const std::vector< uint8_t > &iv) override
              -
              bool SetIv(const std::vector< uint8_t > &iv)
              Definition: aes_cryptor.cc:69
              +
              bool SetIv(const std::vector< uint8_t > &iv)
              Definition: aes_cryptor.cc:67
              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 af4d4cbabe..e1ae679fde 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 @@ -191,7 +191,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 34deedb375..785f0063b0 100644 --- a/docs/da/df9/classshaka_1_1media_1_1AesPatternCryptor-members.html +++ b/docs/da/df9/classshaka_1_1media_1_1AesPatternCryptor-members.html @@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/db/d05/structshaka_1_1media_1_1H265SliceHeader.html b/docs/db/d05/structshaka_1_1media_1_1H265SliceHeader.html index 9bd9033112..9c8ea26eb0 100644 --- a/docs/db/d05/structshaka_1_1media_1_1H265SliceHeader.html +++ b/docs/db/d05/structshaka_1_1media_1_1H265SliceHeader.html @@ -236,7 +236,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 e5577e72ff..3f937b018b 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 @@ -176,7 +176,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 6b0a8d9ff4..252fde1ee0 100644 --- a/docs/db/d14/classshaka_1_1media_1_1H265Parser-members.html +++ b/docs/db/d14/classshaka_1_1media_1_1H265Parser-members.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 ffd2722700..a33c7c1733 100644 --- a/docs/db/d14/structshaka_1_1media_1_1H264WeightingFactors-members.html +++ b/docs/db/d14/structshaka_1_1media_1_1H264WeightingFactors-members.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 e5b5385694..dd8dc50476 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 @@ -175,7 +175,7 @@ uint32_t flags 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 54a960a727..4acf3d1c89 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 @@ -179,7 +179,7 @@ FourCC protection_scheme 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 f9666b9831..0017c43f3c 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 @@ -143,7 +143,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/db/d31/track__run__iterator_8cc_source.html b/docs/db/d31/track__run__iterator_8cc_source.html index f508bd4ee6..678db9b9b6 100644 --- a/docs/db/d31/track__run__iterator_8cc_source.html +++ b/docs/db/d31/track__run__iterator_8cc_source.html @@ -767,7 +767,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 facc9cc02c..7f61315f5f 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 @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 b178c23d99..12a9e00ffa 100644 --- a/docs/db/d3b/classshaka_1_1media_1_1VideoSliceHeaderParser-members.html +++ b/docs/db/d3b/classshaka_1_1media_1_1VideoSliceHeaderParser-members.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 bad0e7ec69..48307c6a61 100644 --- a/docs/db/d45/mpd__notify__muxer__listener_8h_source.html +++ b/docs/db/d45/mpd__notify__muxer__listener_8h_source.html @@ -189,7 +189,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/db/d4b/classshaka_1_1MockAdaptationSet.html b/docs/db/d4b/classshaka_1_1MockAdaptationSet.html index d5da5e9973..1208b632fd 100644 --- a/docs/db/d4b/classshaka_1_1MockAdaptationSet.html +++ b/docs/db/d4b/classshaka_1_1MockAdaptationSet.html @@ -183,7 +183,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 8b4fca88b3..b7a6322785 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 @@ -225,7 +225,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 1d15cdd6c6..e254ff0460 100644 --- a/docs/db/d51/mp2t__media__parser_8h_source.html +++ b/docs/db/d51/mp2t__media__parser_8h_source.html @@ -128,7 +128,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              41  bool Parse(const uint8_t* buf, int size) override WARN_UNUSED_RESULT;
              43 
              44  private:
              -
              45  typedef std::map<int, PidState*> PidMap;
              +
              45  typedef std::map<int, std::unique_ptr<PidState>> PidMap;
              46 
              47  // Callback invoked to register a Program Map Table.
              48  // Note: Does nothing if the PID is already registered.
              @@ -182,17 +182,17 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              98 #endif
              base::Callback< void(const std::vector< scoped_refptr< StreamInfo > > &stream_info)> InitCB
              Definition: media_parser.h:34
              -
              void Init(const InitCB &init_cb, const NewSampleCB &new_sample_cb, KeySource *decryption_key_source) override
              +
              void Init(const InitCB &init_cb, const NewSampleCB &new_sample_cb, KeySource *decryption_key_source) override
              -
              bool Flush() override WARN_UNUSED_RESULT
              +
              bool Flush() override WARN_UNUSED_RESULT
              base::Callback< bool(uint32_t track_id, const scoped_refptr< MediaSample > &media_sample)> NewSampleCB
              Definition: media_parser.h:43
              KeySource is responsible for encryption key acquisition.
              Definition: key_source.h:30
              -
              bool Parse(const uint8_t *buf, int size) override WARN_UNUSED_RESULT
              +
              bool Parse(const uint8_t *buf, int size) override WARN_UNUSED_RESULT
              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 e9c1292712..58178b5bfc 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 @@ -144,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/db/d5a/classshaka_1_1media_1_1VP9Parser.html b/docs/db/d5a/classshaka_1_1media_1_1VP9Parser.html index 5d0edf78fc..2c5601ff89 100644 --- a/docs/db/d5a/classshaka_1_1media_1_1VP9Parser.html +++ b/docs/db/d5a/classshaka_1_1media_1_1VP9Parser.html @@ -238,7 +238,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 5814bd4cb3..b399111c4e 100644 --- a/docs/db/d60/mpd__options_8h_source.html +++ b/docs/db/d60/mpd__options_8h_source.html @@ -126,7 +126,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/db/d64/webvtt__media__parser_8h_source.html b/docs/db/d64/webvtt__media__parser_8h_source.html index 9bf156f9f5..c57d6dde97 100644 --- a/docs/db/d64/webvtt__media__parser_8h_source.html +++ b/docs/db/d64/webvtt__media__parser_8h_source.html @@ -181,7 +181,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 878a710343..52efa5b23c 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 @@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/db/d71/http__key__fetcher_8h_source.html b/docs/db/d71/http__key__fetcher_8h_source.html index 39d8135624..894d3e0c5c 100644 --- a/docs/db/d71/http__key__fetcher_8h_source.html +++ b/docs/db/d71/http__key__fetcher_8h_source.html @@ -150,7 +150,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 df3102601d..170d7e74f9 100644 --- a/docs/db/d74/classshaka_1_1media_1_1HEVCDecoderConfigurationRecord-members.html +++ b/docs/db/d74/classshaka_1_1media_1_1HEVCDecoderConfigurationRecord-members.html @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 938cfe9ffe..4f4b161ecb 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 @@ -130,7 +130,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 6268ee8d79..9719111949 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 @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/db/d7e/muxer__options_8cc_source.html b/docs/db/d7e/muxer__options_8cc_source.html index 69fc45b64f..d427d2c945 100644 --- a/docs/db/d7e/muxer__options_8cc_source.html +++ b/docs/db/d7e/muxer__options_8cc_source.html @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 93a2c6814b..7292a96446 100644 --- a/docs/db/d84/classshaka_1_1media_1_1AACAudioSpecificConfig-members.html +++ b/docs/db/d84/classshaka_1_1media_1_1AACAudioSpecificConfig-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/db/d86/classshaka_1_1media_1_1NaluReader.html b/docs/db/d86/classshaka_1_1media_1_1NaluReader.html index 8fdd30173b..766c11ac56 100644 --- a/docs/db/d86/classshaka_1_1media_1_1NaluReader.html +++ b/docs/db/d86/classshaka_1_1media_1_1NaluReader.html @@ -228,7 +228,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 958072ac9c..2a28a4206b 100644 --- a/docs/db/d8f/mp4__muxer_8h_source.html +++ b/docs/db/d8f/mp4__muxer_8h_source.html @@ -173,7 +173,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/db/d94/classshaka_1_1media_1_1ClusterBuilder.html b/docs/db/d94/classshaka_1_1media_1_1ClusterBuilder.html index f880be43e2..20678035d9 100644 --- a/docs/db/d94/classshaka_1_1media_1_1ClusterBuilder.html +++ b/docs/db/d94/classshaka_1_1media_1_1ClusterBuilder.html @@ -125,7 +125,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 bd66080870..c7d91808ac 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 @@ -339,7 +339,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 2125073c07..384a9f8064 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 @@ -185,7 +185,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 2e936b43d1..06d5fecc65 100644 --- a/docs/db/d96/wvm__media__parser_8h_source.html +++ b/docs/db/d96/wvm__media__parser_8h_source.html @@ -362,7 +362,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/db/da4/classBandwidthEstimator-members.html b/docs/db/da4/classBandwidthEstimator-members.html index 5d7a6eca56..05ca15d231 100644 --- a/docs/db/da4/classBandwidthEstimator-members.html +++ b/docs/db/da4/classBandwidthEstimator-members.html @@ -97,7 +97,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/db/da6/memory__file_8h_source.html b/docs/db/da6/memory__file_8h_source.html index 91476fe987..3ad7535c7b 100644 --- a/docs/db/da6/memory__file_8h_source.html +++ b/docs/db/da6/memory__file_8h_source.html @@ -154,7 +154,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/db/dab/classshaka_1_1media_1_1TextStreamInfo.html b/docs/db/dab/classshaka_1_1media_1_1TextStreamInfo.html index 89358ae63c..76317c8a70 100644 --- a/docs/db/dab/classshaka_1_1media_1_1TextStreamInfo.html +++ b/docs/db/dab/classshaka_1_1media_1_1TextStreamInfo.html @@ -282,7 +282,7 @@ void set_language (con diff --git a/docs/db/dae/classshaka_1_1media_1_1WebMInfoParser.html b/docs/db/dae/classshaka_1_1media_1_1WebMInfoParser.html index 79c82ce4fc..3cfcf5287f 100644 --- a/docs/db/dae/classshaka_1_1media_1_1WebMInfoParser.html +++ b/docs/db/dae/classshaka_1_1media_1_1WebMInfoParser.html @@ -175,7 +175,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 e09a57b7a5..d654f90484 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 174e72ab52..780d2b876e 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 @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/db/db8/structshaka_1_1media_1_1OnMediaEndParameters.html b/docs/db/db8/structshaka_1_1media_1_1OnMediaEndParameters.html index 23774b1820..b0e5541dfa 100644 --- a/docs/db/db8/structshaka_1_1media_1_1OnMediaEndParameters.html +++ b/docs/db/db8/structshaka_1_1media_1_1OnMediaEndParameters.html @@ -130,7 +130,7 @@ uint64_t file_size 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 65de90bfd3..cb14c9df6f 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 @@ -197,7 +197,7 @@ Additional Inherited Members diff --git a/docs/db/dcb/classshaka_1_1media_1_1VPxParser.html b/docs/db/dcb/classshaka_1_1media_1_1VPxParser.html index aefdfb2cc6..b05194b97f 100644 --- a/docs/db/dcb/classshaka_1_1media_1_1VPxParser.html +++ b/docs/db/dcb/classshaka_1_1media_1_1VPxParser.html @@ -205,7 +205,7 @@ Protected Member Functions diff --git a/docs/db/dcc/classshaka_1_1media_1_1webm_1_1Encryptor-members.html b/docs/db/dcc/classshaka_1_1media_1_1webm_1_1Encryptor-members.html index 0db7480f17..ad21769754 100644 --- a/docs/db/dcc/classshaka_1_1media_1_1webm_1_1Encryptor-members.html +++ b/docs/db/dcc/classshaka_1_1media_1_1webm_1_1Encryptor-members.html @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/db/dcd/classshaka_1_1MpdWriter.html b/docs/db/dcd/classshaka_1_1MpdWriter.html index 7e906c0cba..da82731aa8 100644 --- a/docs/db/dcd/classshaka_1_1MpdWriter.html +++ b/docs/db/dcd/classshaka_1_1MpdWriter.html @@ -123,7 +123,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 0b35b6057f..a868128cea 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/db/dd0/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener.html b/docs/db/dd0/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener.html index 25c5a1a36d..1b9456620a 100644 --- a/docs/db/dd0/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener.html +++ b/docs/db/dd0/classshaka_1_1media_1_1VodMediaInfoDumpMuxerListener.html @@ -531,7 +531,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 a091501560..e43688a6c6 100644 --- a/docs/db/dd2/chunk__info__iterator_8h_source.html +++ b/docs/db/dd2/chunk__info__iterator_8h_source.html @@ -161,7 +161,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/db/dd9/sync__sample__iterator_8h_source.html b/docs/db/dd9/sync__sample__iterator_8h_source.html index 1d5fcb2921..7a4c844824 100644 --- a/docs/db/dd9/sync__sample__iterator_8h_source.html +++ b/docs/db/dd9/sync__sample__iterator_8h_source.html @@ -140,7 +140,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/db/dde/h265__parser_8cc_source.html b/docs/db/dde/h265__parser_8cc_source.html index d7d0562552..bb933ce637 100644 --- a/docs/db/dde/h265__parser_8cc_source.html +++ b/docs/db/dde/h265__parser_8cc_source.html @@ -99,1129 +99,1123 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              10 #include <algorithm>
              11 
              12 #include "packager/base/logging.h"
              -
              13 #include "packager/base/stl_util.h"
              -
              14 #include "packager/media/base/macros.h"
              -
              15 #include "packager/media/codecs/nalu_reader.h"
              -
              16 
              -
              17 #define TRUE_OR_RETURN(a) \
              -
              18  do { \
              -
              19  if (!(a)) { \
              -
              20  DVLOG(1) << "Failure while processing " << #a; \
              -
              21  return kInvalidStream; \
              -
              22  } \
              -
              23  } while (0)
              -
              24 
              -
              25 #define OK_OR_RETURN(a) \
              -
              26  do { \
              -
              27  Result status = (a); \
              -
              28  if (status != kOk) \
              -
              29  return status; \
              -
              30  } while (false)
              -
              31 
              -
              32 namespace shaka {
              -
              33 namespace media {
              -
              34 
              -
              35 namespace {
              -
              36 int GetNumPicTotalCurr(const H265SliceHeader& slice_header,
              -
              37  const H265Sps& sps) {
              -
              38  int num_pic_total_curr = 0;
              -
              39  const H265ReferencePictureSet& ref_pic_set =
              -
              40  slice_header.short_term_ref_pic_set_sps_flag
              -
              41  ? sps.st_ref_pic_sets[slice_header.short_term_ref_pic_set_idx]
              -
              42  : slice_header.st_ref_pic_set;
              -
              43 
              -
              44  for (int i = 0; i < ref_pic_set.num_negative_pics; i++) {
              -
              45  if (ref_pic_set.used_by_curr_pic_s0[i])
              -
              46  num_pic_total_curr++;
              -
              47  }
              -
              48  for (int i = 0; i < ref_pic_set.num_positive_pics; i++) {
              -
              49  if (ref_pic_set.used_by_curr_pic_s1[i])
              -
              50  num_pic_total_curr++;
              -
              51  }
              -
              52 
              -
              53  return num_pic_total_curr + slice_header.used_by_curr_pic_lt;
              -
              54 }
              -
              55 
              -
              56 void GetAspectRatioInfo(const H265Sps& sps,
              -
              57  uint32_t* pixel_width,
              -
              58  uint32_t* pixel_height) {
              -
              59  // The default value is 0; so if this is not in the SPS, it will correctly
              -
              60  // assume unspecified.
              -
              61  int aspect_ratio_idc = sps.vui_parameters.aspect_ratio_idc;
              -
              62 
              -
              63  // Table E.1
              -
              64  switch (aspect_ratio_idc) {
              -
              65  case 1: *pixel_width = 1; *pixel_height = 1; break;
              -
              66  case 2: *pixel_width = 12; *pixel_height = 11; break;
              -
              67  case 3: *pixel_width = 10; *pixel_height = 11; break;
              -
              68  case 4: *pixel_width = 16; *pixel_height = 11; break;
              -
              69  case 5: *pixel_width = 40; *pixel_height = 33; break;
              -
              70  case 6: *pixel_width = 24; *pixel_height = 11; break;
              -
              71  case 7: *pixel_width = 20; *pixel_height = 11; break;
              -
              72  case 8: *pixel_width = 32; *pixel_height = 11; break;
              -
              73  case 9: *pixel_width = 80; *pixel_height = 33; break;
              -
              74  case 10: *pixel_width = 18; *pixel_height = 11; break;
              -
              75  case 11: *pixel_width = 15; *pixel_height = 11; break;
              -
              76  case 12: *pixel_width = 64; *pixel_height = 33; break;
              -
              77  case 13: *pixel_width = 160; *pixel_height = 99; break;
              -
              78  case 14: *pixel_width = 4; *pixel_height = 3; break;
              -
              79  case 15: *pixel_width = 3; *pixel_height = 2; break;
              -
              80  case 16: *pixel_width = 2; *pixel_height = 1; break;
              -
              81 
              -
              82  case 255:
              -
              83  *pixel_width = sps.vui_parameters.sar_width;
              -
              84  *pixel_height = sps.vui_parameters.sar_height;
              -
              85  break;
              -
              86 
              -
              87  default:
              -
              88  // Section E.3.1 specifies that other values should be interpreted as 0.
              -
              89  LOG(WARNING) << "Unknown aspect_ratio_idc " << aspect_ratio_idc;
              -
              90  FALLTHROUGH_INTENDED;
              -
              91  case 0:
              -
              92  // Unlike the spec, assume 1:1 if not specified.
              -
              93  *pixel_width = 1;
              -
              94  *pixel_height = 1;
              -
              95  break;
              -
              96  }
              -
              97 }
              -
              98 } // namespace
              -
              99 
              -
              100 bool ExtractResolutionFromSps(const H265Sps& sps,
              -
              101  uint32_t* coded_width,
              -
              102  uint32_t* coded_height,
              -
              103  uint32_t* pixel_width,
              -
              104  uint32_t* pixel_height) {
              -
              105  int crop_x = 0;
              -
              106  int crop_y = 0;
              -
              107  if (sps.conformance_window_flag) {
              -
              108  int sub_width_c = 0;
              -
              109  int sub_height_c = 0;
              -
              110 
              -
              111  // Table 6-1
              -
              112  switch (sps.chroma_format_idc) {
              -
              113  case 0: // Monochrome
              -
              114  sub_width_c = 1;
              -
              115  sub_height_c = 1;
              -
              116  break;
              -
              117  case 1: // 4:2:0
              -
              118  sub_width_c = 2;
              -
              119  sub_height_c = 2;
              -
              120  break;
              -
              121  case 2: // 4:2:2
              -
              122  sub_width_c = 2;
              -
              123  sub_height_c = 1;
              -
              124  break;
              -
              125  case 3: // 4:4:4
              -
              126  sub_width_c = 1;
              -
              127  sub_height_c = 1;
              -
              128  break;
              -
              129  default:
              -
              130  LOG(ERROR) << "Unexpected chroma_format_idc " << sps.chroma_format_idc;
              -
              131  return false;
              -
              132  }
              -
              133 
              -
              134  // Formula D-28, D-29
              -
              135  crop_x =
              -
              136  sub_width_c * (sps.conf_win_right_offset + sps.conf_win_left_offset);
              -
              137  crop_y =
              -
              138  sub_height_c * (sps.conf_win_bottom_offset + sps.conf_win_top_offset);
              -
              139  }
              -
              140 
              -
              141  // Formula D-28, D-29
              -
              142  *coded_width = sps.pic_width_in_luma_samples - crop_x;
              -
              143  *coded_height = sps.pic_height_in_luma_samples - crop_y;
              -
              144  GetAspectRatioInfo(sps, pixel_width, pixel_height);
              -
              145  return true;
              -
              146 }
              -
              147 
              -
              148 H265Pps::H265Pps() {}
              -
              149 H265Pps::~H265Pps() {}
              -
              150 
              -
              151 H265Sps::H265Sps() {}
              -
              152 H265Sps::~H265Sps() {}
              -
              153 
              -
              154 int H265Sps::GetPicSizeInCtbsY() const {
              -
              155  int min_cb_log2_size_y = log2_min_luma_coding_block_size_minus3 + 3;
              -
              156  int ctb_log2_size_y =
              -
              157  min_cb_log2_size_y + log2_diff_max_min_luma_coding_block_size;
              -
              158  int ctb_size_y = 1 << ctb_log2_size_y;
              -
              159 
              -
              160  // Round-up division.
              -
              161  int pic_width_in_ctbs_y = (pic_width_in_luma_samples - 1) / ctb_size_y + 1;
              -
              162  int pic_height_in_ctbs_y = (pic_height_in_luma_samples - 1) / ctb_size_y + 1;
              -
              163  return pic_width_in_ctbs_y * pic_height_in_ctbs_y;
              -
              164 }
              -
              165 
              -
              166 int H265Sps::GetChromaArrayType() const {
              -
              167  if (!separate_colour_plane_flag)
              -
              168  return chroma_format_idc;
              -
              169  else
              -
              170  return 0;
              -
              171 }
              -
              172 
              -
              173 H265ReferencePictureListModifications::H265ReferencePictureListModifications() {
              -
              174 }
              -
              175 H265ReferencePictureListModifications::
              -
              176  ~H265ReferencePictureListModifications() {}
              -
              177 
              -
              178 H265SliceHeader::H265SliceHeader() {}
              -
              179 H265SliceHeader::~H265SliceHeader() {}
              -
              180 
              -
              181 H265Parser::H265Parser() {}
              -
              182 H265Parser::~H265Parser() {
              -
              183  STLDeleteValues(&active_spses_);
              -
              184  STLDeleteValues(&active_ppses_);
              -
              185 }
              -
              186 
              -
              187 H265Parser::Result H265Parser::ParseSliceHeader(const Nalu& nalu,
              -
              188  H265SliceHeader* slice_header) {
              -
              189  DCHECK(nalu.is_video_slice());
              -
              190  *slice_header = H265SliceHeader();
              -
              191 
              -
              192  // Parses whole element.
              -
              193  H26xBitReader reader;
              -
              194  reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size());
              -
              195  H26xBitReader* br = &reader;
              -
              196 
              -
              197  TRUE_OR_RETURN(br->ReadBool(&slice_header->first_slice_segment_in_pic_flag));
              -
              198  if (nalu.type() >= Nalu::H265_BLA_W_LP &&
              -
              199  nalu.type() <= Nalu::H265_RSV_IRAP_VCL23) {
              -
              200  TRUE_OR_RETURN(br->ReadBool(&slice_header->no_output_of_prior_pics_flag));
              -
              201  }
              +
              13 #include "packager/media/base/macros.h"
              +
              14 #include "packager/media/codecs/nalu_reader.h"
              +
              15 
              +
              16 #define TRUE_OR_RETURN(a) \
              +
              17  do { \
              +
              18  if (!(a)) { \
              +
              19  DVLOG(1) << "Failure while processing " << #a; \
              +
              20  return kInvalidStream; \
              +
              21  } \
              +
              22  } while (0)
              +
              23 
              +
              24 #define OK_OR_RETURN(a) \
              +
              25  do { \
              +
              26  Result status = (a); \
              +
              27  if (status != kOk) \
              +
              28  return status; \
              +
              29  } while (false)
              +
              30 
              +
              31 namespace shaka {
              +
              32 namespace media {
              +
              33 
              +
              34 namespace {
              +
              35 int GetNumPicTotalCurr(const H265SliceHeader& slice_header,
              +
              36  const H265Sps& sps) {
              +
              37  int num_pic_total_curr = 0;
              +
              38  const H265ReferencePictureSet& ref_pic_set =
              +
              39  slice_header.short_term_ref_pic_set_sps_flag
              +
              40  ? sps.st_ref_pic_sets[slice_header.short_term_ref_pic_set_idx]
              +
              41  : slice_header.st_ref_pic_set;
              +
              42 
              +
              43  for (int i = 0; i < ref_pic_set.num_negative_pics; i++) {
              +
              44  if (ref_pic_set.used_by_curr_pic_s0[i])
              +
              45  num_pic_total_curr++;
              +
              46  }
              +
              47  for (int i = 0; i < ref_pic_set.num_positive_pics; i++) {
              +
              48  if (ref_pic_set.used_by_curr_pic_s1[i])
              +
              49  num_pic_total_curr++;
              +
              50  }
              +
              51 
              +
              52  return num_pic_total_curr + slice_header.used_by_curr_pic_lt;
              +
              53 }
              +
              54 
              +
              55 void GetAspectRatioInfo(const H265Sps& sps,
              +
              56  uint32_t* pixel_width,
              +
              57  uint32_t* pixel_height) {
              +
              58  // The default value is 0; so if this is not in the SPS, it will correctly
              +
              59  // assume unspecified.
              +
              60  int aspect_ratio_idc = sps.vui_parameters.aspect_ratio_idc;
              +
              61 
              +
              62  // Table E.1
              +
              63  switch (aspect_ratio_idc) {
              +
              64  case 1: *pixel_width = 1; *pixel_height = 1; break;
              +
              65  case 2: *pixel_width = 12; *pixel_height = 11; break;
              +
              66  case 3: *pixel_width = 10; *pixel_height = 11; break;
              +
              67  case 4: *pixel_width = 16; *pixel_height = 11; break;
              +
              68  case 5: *pixel_width = 40; *pixel_height = 33; break;
              +
              69  case 6: *pixel_width = 24; *pixel_height = 11; break;
              +
              70  case 7: *pixel_width = 20; *pixel_height = 11; break;
              +
              71  case 8: *pixel_width = 32; *pixel_height = 11; break;
              +
              72  case 9: *pixel_width = 80; *pixel_height = 33; break;
              +
              73  case 10: *pixel_width = 18; *pixel_height = 11; break;
              +
              74  case 11: *pixel_width = 15; *pixel_height = 11; break;
              +
              75  case 12: *pixel_width = 64; *pixel_height = 33; break;
              +
              76  case 13: *pixel_width = 160; *pixel_height = 99; break;
              +
              77  case 14: *pixel_width = 4; *pixel_height = 3; break;
              +
              78  case 15: *pixel_width = 3; *pixel_height = 2; break;
              +
              79  case 16: *pixel_width = 2; *pixel_height = 1; break;
              +
              80 
              +
              81  case 255:
              +
              82  *pixel_width = sps.vui_parameters.sar_width;
              +
              83  *pixel_height = sps.vui_parameters.sar_height;
              +
              84  break;
              +
              85 
              +
              86  default:
              +
              87  // Section E.3.1 specifies that other values should be interpreted as 0.
              +
              88  LOG(WARNING) << "Unknown aspect_ratio_idc " << aspect_ratio_idc;
              +
              89  FALLTHROUGH_INTENDED;
              +
              90  case 0:
              +
              91  // Unlike the spec, assume 1:1 if not specified.
              +
              92  *pixel_width = 1;
              +
              93  *pixel_height = 1;
              +
              94  break;
              +
              95  }
              +
              96 }
              +
              97 } // namespace
              +
              98 
              +
              99 bool ExtractResolutionFromSps(const H265Sps& sps,
              +
              100  uint32_t* coded_width,
              +
              101  uint32_t* coded_height,
              +
              102  uint32_t* pixel_width,
              +
              103  uint32_t* pixel_height) {
              +
              104  int crop_x = 0;
              +
              105  int crop_y = 0;
              +
              106  if (sps.conformance_window_flag) {
              +
              107  int sub_width_c = 0;
              +
              108  int sub_height_c = 0;
              +
              109 
              +
              110  // Table 6-1
              +
              111  switch (sps.chroma_format_idc) {
              +
              112  case 0: // Monochrome
              +
              113  sub_width_c = 1;
              +
              114  sub_height_c = 1;
              +
              115  break;
              +
              116  case 1: // 4:2:0
              +
              117  sub_width_c = 2;
              +
              118  sub_height_c = 2;
              +
              119  break;
              +
              120  case 2: // 4:2:2
              +
              121  sub_width_c = 2;
              +
              122  sub_height_c = 1;
              +
              123  break;
              +
              124  case 3: // 4:4:4
              +
              125  sub_width_c = 1;
              +
              126  sub_height_c = 1;
              +
              127  break;
              +
              128  default:
              +
              129  LOG(ERROR) << "Unexpected chroma_format_idc " << sps.chroma_format_idc;
              +
              130  return false;
              +
              131  }
              +
              132 
              +
              133  // Formula D-28, D-29
              +
              134  crop_x =
              +
              135  sub_width_c * (sps.conf_win_right_offset + sps.conf_win_left_offset);
              +
              136  crop_y =
              +
              137  sub_height_c * (sps.conf_win_bottom_offset + sps.conf_win_top_offset);
              +
              138  }
              +
              139 
              +
              140  // Formula D-28, D-29
              +
              141  *coded_width = sps.pic_width_in_luma_samples - crop_x;
              +
              142  *coded_height = sps.pic_height_in_luma_samples - crop_y;
              +
              143  GetAspectRatioInfo(sps, pixel_width, pixel_height);
              +
              144  return true;
              +
              145 }
              +
              146 
              +
              147 H265Pps::H265Pps() {}
              +
              148 H265Pps::~H265Pps() {}
              +
              149 
              +
              150 H265Sps::H265Sps() {}
              +
              151 H265Sps::~H265Sps() {}
              +
              152 
              +
              153 int H265Sps::GetPicSizeInCtbsY() const {
              +
              154  int min_cb_log2_size_y = log2_min_luma_coding_block_size_minus3 + 3;
              +
              155  int ctb_log2_size_y =
              +
              156  min_cb_log2_size_y + log2_diff_max_min_luma_coding_block_size;
              +
              157  int ctb_size_y = 1 << ctb_log2_size_y;
              +
              158 
              +
              159  // Round-up division.
              +
              160  int pic_width_in_ctbs_y = (pic_width_in_luma_samples - 1) / ctb_size_y + 1;
              +
              161  int pic_height_in_ctbs_y = (pic_height_in_luma_samples - 1) / ctb_size_y + 1;
              +
              162  return pic_width_in_ctbs_y * pic_height_in_ctbs_y;
              +
              163 }
              +
              164 
              +
              165 int H265Sps::GetChromaArrayType() const {
              +
              166  if (!separate_colour_plane_flag)
              +
              167  return chroma_format_idc;
              +
              168  else
              +
              169  return 0;
              +
              170 }
              +
              171 
              +
              172 H265ReferencePictureListModifications::H265ReferencePictureListModifications() {
              +
              173 }
              +
              174 H265ReferencePictureListModifications::
              +
              175  ~H265ReferencePictureListModifications() {}
              +
              176 
              +
              177 H265SliceHeader::H265SliceHeader() {}
              +
              178 H265SliceHeader::~H265SliceHeader() {}
              +
              179 
              +
              180 H265Parser::H265Parser() {}
              +
              181 H265Parser::~H265Parser() {}
              +
              182 
              +
              183 H265Parser::Result H265Parser::ParseSliceHeader(const Nalu& nalu,
              +
              184  H265SliceHeader* slice_header) {
              +
              185  DCHECK(nalu.is_video_slice());
              +
              186  *slice_header = H265SliceHeader();
              +
              187 
              +
              188  // Parses whole element.
              +
              189  H26xBitReader reader;
              +
              190  reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size());
              +
              191  H26xBitReader* br = &reader;
              +
              192 
              +
              193  TRUE_OR_RETURN(br->ReadBool(&slice_header->first_slice_segment_in_pic_flag));
              +
              194  if (nalu.type() >= Nalu::H265_BLA_W_LP &&
              +
              195  nalu.type() <= Nalu::H265_RSV_IRAP_VCL23) {
              +
              196  TRUE_OR_RETURN(br->ReadBool(&slice_header->no_output_of_prior_pics_flag));
              +
              197  }
              +
              198 
              +
              199  TRUE_OR_RETURN(br->ReadUE(&slice_header->pic_parameter_set_id));
              +
              200  const H265Pps* pps = GetPps(slice_header->pic_parameter_set_id);
              +
              201  TRUE_OR_RETURN(pps);
              202 
              -
              203  TRUE_OR_RETURN(br->ReadUE(&slice_header->pic_parameter_set_id));
              -
              204  const H265Pps* pps = GetPps(slice_header->pic_parameter_set_id);
              -
              205  TRUE_OR_RETURN(pps);
              -
              206 
              -
              207  const H265Sps* sps = GetSps(pps->seq_parameter_set_id);
              -
              208  TRUE_OR_RETURN(sps);
              -
              209 
              -
              210  if (!slice_header->first_slice_segment_in_pic_flag) {
              -
              211  if (pps->dependent_slice_segments_enabled_flag) {
              -
              212  TRUE_OR_RETURN(br->ReadBool(&slice_header->dependent_slice_segment_flag));
              -
              213  }
              -
              214  const int bit_length = ceil(log2(sps->GetPicSizeInCtbsY()));
              -
              215  TRUE_OR_RETURN(br->ReadBits(bit_length, &slice_header->segment_address));
              -
              216  }
              -
              217 
              -
              218  if (!slice_header->dependent_slice_segment_flag) {
              -
              219  TRUE_OR_RETURN(br->SkipBits(pps->num_extra_slice_header_bits));
              -
              220  TRUE_OR_RETURN(br->ReadUE(&slice_header->slice_type));
              -
              221  if (pps->output_flag_present_flag) {
              -
              222  TRUE_OR_RETURN(br->ReadBool(&slice_header->pic_output_flag));
              -
              223  }
              -
              224  if (sps->separate_colour_plane_flag) {
              -
              225  TRUE_OR_RETURN(br->ReadBits(2, &slice_header->colour_plane_id));
              -
              226  }
              -
              227 
              -
              228  if (nalu.type() != Nalu::H265_IDR_W_RADL &&
              -
              229  nalu.type() != Nalu::H265_IDR_N_LP) {
              -
              230  TRUE_OR_RETURN(br->ReadBits(sps->log2_max_pic_order_cnt_lsb_minus4 + 4,
              -
              231  &slice_header->slice_pic_order_cnt_lsb));
              -
              232 
              -
              233  TRUE_OR_RETURN(
              -
              234  br->ReadBool(&slice_header->short_term_ref_pic_set_sps_flag));
              -
              235  if (!slice_header->short_term_ref_pic_set_sps_flag) {
              -
              236  OK_OR_RETURN(ParseReferencePictureSet(
              -
              237  sps->num_short_term_ref_pic_sets, sps->num_short_term_ref_pic_sets,
              -
              238  sps->st_ref_pic_sets, br, &slice_header->st_ref_pic_set));
              -
              239  } else if (sps->num_short_term_ref_pic_sets > 1) {
              -
              240  TRUE_OR_RETURN(
              -
              241  br->ReadBits(ceil(log2(sps->num_short_term_ref_pic_sets)),
              -
              242  &slice_header->short_term_ref_pic_set_idx));
              -
              243  }
              -
              244 
              -
              245  if (sps->long_term_ref_pic_present_flag) {
              -
              246  if (sps->num_long_term_ref_pics > 0) {
              -
              247  TRUE_OR_RETURN(br->ReadUE(&slice_header->num_long_term_sps));
              -
              248  }
              -
              249  TRUE_OR_RETURN(br->ReadUE(&slice_header->num_long_term_pics));
              -
              250 
              -
              251  const int pic_count =
              -
              252  slice_header->num_long_term_sps + slice_header->num_long_term_pics;
              -
              253  slice_header->long_term_pics_info.resize(pic_count);
              -
              254  for (int i = 0; i < pic_count; i++) {
              -
              255  if (i < slice_header->num_long_term_sps) {
              -
              256  int lt_idx_sps = 0;
              -
              257  if (sps->num_long_term_ref_pics > 1) {
              -
              258  TRUE_OR_RETURN(br->ReadBits(
              -
              259  ceil(log2(sps->num_long_term_ref_pics)), &lt_idx_sps));
              -
              260  }
              -
              261  if (sps->used_by_curr_pic_lt_flag[lt_idx_sps])
              -
              262  slice_header->used_by_curr_pic_lt++;
              -
              263  } else {
              -
              264  TRUE_OR_RETURN(br->SkipBits(sps->log2_max_pic_order_cnt_lsb_minus4 +
              -
              265  4)); // poc_lsb_lt
              -
              266  bool used_by_curr_pic_lt_flag;
              -
              267  TRUE_OR_RETURN(br->ReadBool(&used_by_curr_pic_lt_flag));
              -
              268  if (used_by_curr_pic_lt_flag)
              -
              269  slice_header->used_by_curr_pic_lt++;
              -
              270  }
              -
              271  TRUE_OR_RETURN(br->ReadBool(&slice_header->long_term_pics_info[i]
              -
              272  .delta_poc_msb_present_flag));
              -
              273  if (slice_header->long_term_pics_info[i].delta_poc_msb_present_flag) {
              -
              274  TRUE_OR_RETURN(br->ReadUE(
              -
              275  &slice_header->long_term_pics_info[i].delta_poc_msb_cycle_lt));
              -
              276  }
              -
              277  }
              -
              278  }
              -
              279 
              -
              280  if (sps->temporal_mvp_enabled_flag) {
              -
              281  TRUE_OR_RETURN(
              -
              282  br->ReadBool(&slice_header->slice_temporal_mvp_enabled_flag));
              -
              283  }
              -
              284  }
              -
              285 
              -
              286  if (nalu.nuh_layer_id() != 0) {
              -
              287  NOTIMPLEMENTED() << "Multi-layer streams are not supported.";
              -
              288  return kUnsupportedStream;
              -
              289  }
              -
              290 
              -
              291  if (sps->sample_adaptive_offset_enabled_flag) {
              -
              292  TRUE_OR_RETURN(br->ReadBool(&slice_header->slice_sao_luma_flag));
              -
              293  if (sps->GetChromaArrayType() != 0) {
              -
              294  TRUE_OR_RETURN(br->ReadBool(&slice_header->slice_sao_chroma_flag));
              -
              295  }
              -
              296  }
              -
              297 
              -
              298  slice_header->num_ref_idx_l0_active_minus1 =
              -
              299  pps->num_ref_idx_l0_default_active_minus1;
              -
              300  slice_header->num_ref_idx_l1_active_minus1 =
              -
              301  pps->num_ref_idx_l1_default_active_minus1;
              -
              302  if (slice_header->slice_type == kPSlice ||
              -
              303  slice_header->slice_type == kBSlice) {
              -
              304  TRUE_OR_RETURN(
              -
              305  br->ReadBool(&slice_header->num_ref_idx_active_override_flag));
              -
              306  if (slice_header->num_ref_idx_active_override_flag) {
              -
              307  TRUE_OR_RETURN(br->ReadUE(&slice_header->num_ref_idx_l0_active_minus1));
              -
              308  if (slice_header->slice_type == kBSlice) {
              -
              309  TRUE_OR_RETURN(
              -
              310  br->ReadUE(&slice_header->num_ref_idx_l1_active_minus1));
              -
              311  }
              -
              312  }
              -
              313 
              -
              314  const int num_pic_total_curr = GetNumPicTotalCurr(*slice_header, *sps);
              -
              315  if (pps->lists_modification_present_flag && num_pic_total_curr > 1) {
              -
              316  OK_OR_RETURN(SkipReferencePictureListModification(
              -
              317  *slice_header, *pps, num_pic_total_curr, br));
              +
              203  const H265Sps* sps = GetSps(pps->seq_parameter_set_id);
              +
              204  TRUE_OR_RETURN(sps);
              +
              205 
              +
              206  if (!slice_header->first_slice_segment_in_pic_flag) {
              +
              207  if (pps->dependent_slice_segments_enabled_flag) {
              +
              208  TRUE_OR_RETURN(br->ReadBool(&slice_header->dependent_slice_segment_flag));
              +
              209  }
              +
              210  const int bit_length = ceil(log2(sps->GetPicSizeInCtbsY()));
              +
              211  TRUE_OR_RETURN(br->ReadBits(bit_length, &slice_header->segment_address));
              +
              212  }
              +
              213 
              +
              214  if (!slice_header->dependent_slice_segment_flag) {
              +
              215  TRUE_OR_RETURN(br->SkipBits(pps->num_extra_slice_header_bits));
              +
              216  TRUE_OR_RETURN(br->ReadUE(&slice_header->slice_type));
              +
              217  if (pps->output_flag_present_flag) {
              +
              218  TRUE_OR_RETURN(br->ReadBool(&slice_header->pic_output_flag));
              +
              219  }
              +
              220  if (sps->separate_colour_plane_flag) {
              +
              221  TRUE_OR_RETURN(br->ReadBits(2, &slice_header->colour_plane_id));
              +
              222  }
              +
              223 
              +
              224  if (nalu.type() != Nalu::H265_IDR_W_RADL &&
              +
              225  nalu.type() != Nalu::H265_IDR_N_LP) {
              +
              226  TRUE_OR_RETURN(br->ReadBits(sps->log2_max_pic_order_cnt_lsb_minus4 + 4,
              +
              227  &slice_header->slice_pic_order_cnt_lsb));
              +
              228 
              +
              229  TRUE_OR_RETURN(
              +
              230  br->ReadBool(&slice_header->short_term_ref_pic_set_sps_flag));
              +
              231  if (!slice_header->short_term_ref_pic_set_sps_flag) {
              +
              232  OK_OR_RETURN(ParseReferencePictureSet(
              +
              233  sps->num_short_term_ref_pic_sets, sps->num_short_term_ref_pic_sets,
              +
              234  sps->st_ref_pic_sets, br, &slice_header->st_ref_pic_set));
              +
              235  } else if (sps->num_short_term_ref_pic_sets > 1) {
              +
              236  TRUE_OR_RETURN(
              +
              237  br->ReadBits(ceil(log2(sps->num_short_term_ref_pic_sets)),
              +
              238  &slice_header->short_term_ref_pic_set_idx));
              +
              239  }
              +
              240 
              +
              241  if (sps->long_term_ref_pic_present_flag) {
              +
              242  if (sps->num_long_term_ref_pics > 0) {
              +
              243  TRUE_OR_RETURN(br->ReadUE(&slice_header->num_long_term_sps));
              +
              244  }
              +
              245  TRUE_OR_RETURN(br->ReadUE(&slice_header->num_long_term_pics));
              +
              246 
              +
              247  const int pic_count =
              +
              248  slice_header->num_long_term_sps + slice_header->num_long_term_pics;
              +
              249  slice_header->long_term_pics_info.resize(pic_count);
              +
              250  for (int i = 0; i < pic_count; i++) {
              +
              251  if (i < slice_header->num_long_term_sps) {
              +
              252  int lt_idx_sps = 0;
              +
              253  if (sps->num_long_term_ref_pics > 1) {
              +
              254  TRUE_OR_RETURN(br->ReadBits(
              +
              255  ceil(log2(sps->num_long_term_ref_pics)), &lt_idx_sps));
              +
              256  }
              +
              257  if (sps->used_by_curr_pic_lt_flag[lt_idx_sps])
              +
              258  slice_header->used_by_curr_pic_lt++;
              +
              259  } else {
              +
              260  TRUE_OR_RETURN(br->SkipBits(sps->log2_max_pic_order_cnt_lsb_minus4 +
              +
              261  4)); // poc_lsb_lt
              +
              262  bool used_by_curr_pic_lt_flag;
              +
              263  TRUE_OR_RETURN(br->ReadBool(&used_by_curr_pic_lt_flag));
              +
              264  if (used_by_curr_pic_lt_flag)
              +
              265  slice_header->used_by_curr_pic_lt++;
              +
              266  }
              +
              267  TRUE_OR_RETURN(br->ReadBool(&slice_header->long_term_pics_info[i]
              +
              268  .delta_poc_msb_present_flag));
              +
              269  if (slice_header->long_term_pics_info[i].delta_poc_msb_present_flag) {
              +
              270  TRUE_OR_RETURN(br->ReadUE(
              +
              271  &slice_header->long_term_pics_info[i].delta_poc_msb_cycle_lt));
              +
              272  }
              +
              273  }
              +
              274  }
              +
              275 
              +
              276  if (sps->temporal_mvp_enabled_flag) {
              +
              277  TRUE_OR_RETURN(
              +
              278  br->ReadBool(&slice_header->slice_temporal_mvp_enabled_flag));
              +
              279  }
              +
              280  }
              +
              281 
              +
              282  if (nalu.nuh_layer_id() != 0) {
              +
              283  NOTIMPLEMENTED() << "Multi-layer streams are not supported.";
              +
              284  return kUnsupportedStream;
              +
              285  }
              +
              286 
              +
              287  if (sps->sample_adaptive_offset_enabled_flag) {
              +
              288  TRUE_OR_RETURN(br->ReadBool(&slice_header->slice_sao_luma_flag));
              +
              289  if (sps->GetChromaArrayType() != 0) {
              +
              290  TRUE_OR_RETURN(br->ReadBool(&slice_header->slice_sao_chroma_flag));
              +
              291  }
              +
              292  }
              +
              293 
              +
              294  slice_header->num_ref_idx_l0_active_minus1 =
              +
              295  pps->num_ref_idx_l0_default_active_minus1;
              +
              296  slice_header->num_ref_idx_l1_active_minus1 =
              +
              297  pps->num_ref_idx_l1_default_active_minus1;
              +
              298  if (slice_header->slice_type == kPSlice ||
              +
              299  slice_header->slice_type == kBSlice) {
              +
              300  TRUE_OR_RETURN(
              +
              301  br->ReadBool(&slice_header->num_ref_idx_active_override_flag));
              +
              302  if (slice_header->num_ref_idx_active_override_flag) {
              +
              303  TRUE_OR_RETURN(br->ReadUE(&slice_header->num_ref_idx_l0_active_minus1));
              +
              304  if (slice_header->slice_type == kBSlice) {
              +
              305  TRUE_OR_RETURN(
              +
              306  br->ReadUE(&slice_header->num_ref_idx_l1_active_minus1));
              +
              307  }
              +
              308  }
              +
              309 
              +
              310  const int num_pic_total_curr = GetNumPicTotalCurr(*slice_header, *sps);
              +
              311  if (pps->lists_modification_present_flag && num_pic_total_curr > 1) {
              +
              312  OK_OR_RETURN(SkipReferencePictureListModification(
              +
              313  *slice_header, *pps, num_pic_total_curr, br));
              +
              314  }
              +
              315 
              +
              316  if (slice_header->slice_type == kBSlice) {
              +
              317  TRUE_OR_RETURN(br->ReadBool(&slice_header->mvd_l1_zero_flag));
              318  }
              -
              319 
              -
              320  if (slice_header->slice_type == kBSlice) {
              -
              321  TRUE_OR_RETURN(br->ReadBool(&slice_header->mvd_l1_zero_flag));
              -
              322  }
              -
              323  if (pps->cabac_init_present_flag) {
              -
              324  TRUE_OR_RETURN(br->ReadBool(&slice_header->cabac_init_flag));
              -
              325  }
              -
              326  if (slice_header->slice_temporal_mvp_enabled_flag) {
              -
              327  if (slice_header->slice_type == kBSlice) {
              -
              328  TRUE_OR_RETURN(br->ReadBool(&slice_header->collocated_from_l0));
              -
              329  }
              -
              330  bool l0_greater_than_0 = slice_header->num_ref_idx_l0_active_minus1 > 0;
              -
              331  bool l1_greater_than_0 = slice_header->num_ref_idx_l1_active_minus1 > 0;
              -
              332  if (slice_header->collocated_from_l0 ? l0_greater_than_0
              -
              333  : l1_greater_than_0) {
              -
              334  TRUE_OR_RETURN(br->ReadUE(&slice_header->collocated_ref_idx));
              -
              335  }
              -
              336  }
              -
              337 
              -
              338  if ((pps->weighted_pred_flag && slice_header->slice_type == kPSlice) ||
              -
              339  (pps->weighted_bipred_flag && slice_header->slice_type == kBSlice)) {
              -
              340  OK_OR_RETURN(SkipPredictionWeightTable(
              -
              341  slice_header->slice_type == kBSlice, *sps, *slice_header, br));
              -
              342  }
              -
              343  TRUE_OR_RETURN(br->ReadUE(&slice_header->five_minus_max_num_merge_cand));
              -
              344  }
              -
              345 
              -
              346  TRUE_OR_RETURN(br->ReadSE(&slice_header->slice_qp_delta));
              -
              347  if (pps->slice_chroma_qp_offsets_present_flag) {
              -
              348  TRUE_OR_RETURN(br->ReadSE(&slice_header->slice_cb_qp_offset));
              -
              349  TRUE_OR_RETURN(br->ReadSE(&slice_header->slice_cr_qp_offset));
              -
              350  }
              -
              351 
              -
              352  if (pps->chroma_qp_offset_list_enabled_flag) {
              +
              319  if (pps->cabac_init_present_flag) {
              +
              320  TRUE_OR_RETURN(br->ReadBool(&slice_header->cabac_init_flag));
              +
              321  }
              +
              322  if (slice_header->slice_temporal_mvp_enabled_flag) {
              +
              323  if (slice_header->slice_type == kBSlice) {
              +
              324  TRUE_OR_RETURN(br->ReadBool(&slice_header->collocated_from_l0));
              +
              325  }
              +
              326  bool l0_greater_than_0 = slice_header->num_ref_idx_l0_active_minus1 > 0;
              +
              327  bool l1_greater_than_0 = slice_header->num_ref_idx_l1_active_minus1 > 0;
              +
              328  if (slice_header->collocated_from_l0 ? l0_greater_than_0
              +
              329  : l1_greater_than_0) {
              +
              330  TRUE_OR_RETURN(br->ReadUE(&slice_header->collocated_ref_idx));
              +
              331  }
              +
              332  }
              +
              333 
              +
              334  if ((pps->weighted_pred_flag && slice_header->slice_type == kPSlice) ||
              +
              335  (pps->weighted_bipred_flag && slice_header->slice_type == kBSlice)) {
              +
              336  OK_OR_RETURN(SkipPredictionWeightTable(
              +
              337  slice_header->slice_type == kBSlice, *sps, *slice_header, br));
              +
              338  }
              +
              339  TRUE_OR_RETURN(br->ReadUE(&slice_header->five_minus_max_num_merge_cand));
              +
              340  }
              +
              341 
              +
              342  TRUE_OR_RETURN(br->ReadSE(&slice_header->slice_qp_delta));
              +
              343  if (pps->slice_chroma_qp_offsets_present_flag) {
              +
              344  TRUE_OR_RETURN(br->ReadSE(&slice_header->slice_cb_qp_offset));
              +
              345  TRUE_OR_RETURN(br->ReadSE(&slice_header->slice_cr_qp_offset));
              +
              346  }
              +
              347 
              +
              348  if (pps->chroma_qp_offset_list_enabled_flag) {
              +
              349  TRUE_OR_RETURN(
              +
              350  br->ReadBool(&slice_header->cu_chroma_qp_offset_enabled_flag));
              +
              351  }
              +
              352  if (pps->deblocking_filter_override_enabled_flag) {
              353  TRUE_OR_RETURN(
              -
              354  br->ReadBool(&slice_header->cu_chroma_qp_offset_enabled_flag));
              +
              354  br->ReadBool(&slice_header->deblocking_filter_override_flag));
              355  }
              -
              356  if (pps->deblocking_filter_override_enabled_flag) {
              +
              356  if (slice_header->deblocking_filter_override_flag) {
              357  TRUE_OR_RETURN(
              -
              358  br->ReadBool(&slice_header->deblocking_filter_override_flag));
              -
              359  }
              -
              360  if (slice_header->deblocking_filter_override_flag) {
              -
              361  TRUE_OR_RETURN(
              -
              362  br->ReadBool(&slice_header->slice_deblocking_filter_disabled_flag));
              -
              363  if (!slice_header->slice_deblocking_filter_disabled_flag) {
              -
              364  TRUE_OR_RETURN(br->ReadSE(&slice_header->slice_beta_offset_div2));
              -
              365  TRUE_OR_RETURN(br->ReadSE(&slice_header->slice_tc_offset_div2));
              -
              366  }
              -
              367  }
              -
              368  if (pps->loop_filter_across_slices_enabled_flag &&
              -
              369  (slice_header->slice_sao_luma_flag ||
              -
              370  slice_header->slice_sao_chroma_flag ||
              -
              371  !slice_header->slice_deblocking_filter_disabled_flag)) {
              -
              372  TRUE_OR_RETURN(br->ReadBool(
              -
              373  &slice_header->slice_loop_filter_across_slices_enabled_flag));
              -
              374  }
              -
              375  }
              -
              376 
              -
              377  if (pps->tiles_enabled_flag || pps->entropy_coding_sync_enabled_flag) {
              -
              378  TRUE_OR_RETURN(br->ReadUE(&slice_header->num_entry_point_offsets));
              -
              379  if (slice_header->num_entry_point_offsets > 0) {
              -
              380  TRUE_OR_RETURN(br->ReadUE(&slice_header->offset_len_minus1));
              -
              381  slice_header->entry_point_offset_minus1.resize(
              -
              382  slice_header->num_entry_point_offsets);
              -
              383  for (int i = 0; i < slice_header->num_entry_point_offsets; i++) {
              -
              384  TRUE_OR_RETURN(
              -
              385  br->ReadBits(slice_header->offset_len_minus1 + 1,
              -
              386  &slice_header->entry_point_offset_minus1[i]));
              -
              387  }
              -
              388  }
              -
              389  }
              -
              390 
              -
              391  if (pps->slice_segment_header_extension_present_flag) {
              -
              392  int extension_length;
              -
              393  TRUE_OR_RETURN(br->ReadUE(&extension_length));
              -
              394  TRUE_OR_RETURN(br->SkipBits(extension_length * 8));
              -
              395  }
              +
              358  br->ReadBool(&slice_header->slice_deblocking_filter_disabled_flag));
              +
              359  if (!slice_header->slice_deblocking_filter_disabled_flag) {
              +
              360  TRUE_OR_RETURN(br->ReadSE(&slice_header->slice_beta_offset_div2));
              +
              361  TRUE_OR_RETURN(br->ReadSE(&slice_header->slice_tc_offset_div2));
              +
              362  }
              +
              363  }
              +
              364  if (pps->loop_filter_across_slices_enabled_flag &&
              +
              365  (slice_header->slice_sao_luma_flag ||
              +
              366  slice_header->slice_sao_chroma_flag ||
              +
              367  !slice_header->slice_deblocking_filter_disabled_flag)) {
              +
              368  TRUE_OR_RETURN(br->ReadBool(
              +
              369  &slice_header->slice_loop_filter_across_slices_enabled_flag));
              +
              370  }
              +
              371  }
              +
              372 
              +
              373  if (pps->tiles_enabled_flag || pps->entropy_coding_sync_enabled_flag) {
              +
              374  TRUE_OR_RETURN(br->ReadUE(&slice_header->num_entry_point_offsets));
              +
              375  if (slice_header->num_entry_point_offsets > 0) {
              +
              376  TRUE_OR_RETURN(br->ReadUE(&slice_header->offset_len_minus1));
              +
              377  slice_header->entry_point_offset_minus1.resize(
              +
              378  slice_header->num_entry_point_offsets);
              +
              379  for (int i = 0; i < slice_header->num_entry_point_offsets; i++) {
              +
              380  TRUE_OR_RETURN(
              +
              381  br->ReadBits(slice_header->offset_len_minus1 + 1,
              +
              382  &slice_header->entry_point_offset_minus1[i]));
              +
              383  }
              +
              384  }
              +
              385  }
              +
              386 
              +
              387  if (pps->slice_segment_header_extension_present_flag) {
              +
              388  int extension_length;
              +
              389  TRUE_OR_RETURN(br->ReadUE(&extension_length));
              +
              390  TRUE_OR_RETURN(br->SkipBits(extension_length * 8));
              +
              391  }
              +
              392 
              +
              393  size_t epb = br->NumEmulationPreventionBytesRead();
              +
              394  slice_header->header_bit_size =
              +
              395  (nalu.payload_size() - epb) * 8 - br->NumBitsLeft();
              396 
              -
              397  size_t epb = br->NumEmulationPreventionBytesRead();
              -
              398  slice_header->header_bit_size =
              -
              399  (nalu.payload_size() - epb) * 8 - br->NumBitsLeft();
              -
              400 
              -
              401  return kOk;
              -
              402 }
              -
              403 
              -
              404 H265Parser::Result H265Parser::ParsePps(const Nalu& nalu, int* pps_id) {
              -
              405  DCHECK_EQ(Nalu::H265_PPS, nalu.type());
              -
              406 
              -
              407  // Reads most of the element, not reading the extension data.
              -
              408  H26xBitReader reader;
              -
              409  reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size());
              -
              410  H26xBitReader* br = &reader;
              -
              411 
              -
              412  *pps_id = -1;
              -
              413  std::unique_ptr<H265Pps> pps(new H265Pps);
              -
              414 
              -
              415  TRUE_OR_RETURN(br->ReadUE(&pps->pic_parameter_set_id));
              -
              416  TRUE_OR_RETURN(br->ReadUE(&pps->seq_parameter_set_id));
              -
              417 
              -
              418  TRUE_OR_RETURN(br->ReadBool(&pps->dependent_slice_segments_enabled_flag));
              -
              419  TRUE_OR_RETURN(br->ReadBool(&pps->output_flag_present_flag));
              -
              420  TRUE_OR_RETURN(br->ReadBits(3, &pps->num_extra_slice_header_bits));
              -
              421  TRUE_OR_RETURN(br->ReadBool(&pps->sign_data_hiding_enabled_flag));
              -
              422  TRUE_OR_RETURN(br->ReadBool(&pps->cabac_init_present_flag));
              -
              423 
              -
              424  TRUE_OR_RETURN(br->ReadUE(&pps->num_ref_idx_l0_default_active_minus1));
              -
              425  TRUE_OR_RETURN(br->ReadUE(&pps->num_ref_idx_l1_default_active_minus1));
              -
              426  TRUE_OR_RETURN(br->ReadSE(&pps->init_qp_minus26));
              -
              427  TRUE_OR_RETURN(br->ReadBool(&pps->constrained_intra_pred_flag));
              -
              428  TRUE_OR_RETURN(br->ReadBool(&pps->transform_skip_enabled_flag));
              -
              429 
              -
              430  TRUE_OR_RETURN(br->ReadBool(&pps->cu_qp_delta_enabled_flag));
              -
              431  if (pps->cu_qp_delta_enabled_flag)
              -
              432  TRUE_OR_RETURN(br->ReadUE(&pps->diff_cu_qp_delta_depth));
              -
              433  TRUE_OR_RETURN(br->ReadSE(&pps->cb_qp_offset));
              -
              434  TRUE_OR_RETURN(br->ReadSE(&pps->cr_qp_offset));
              -
              435 
              -
              436  TRUE_OR_RETURN(br->ReadBool(&pps->slice_chroma_qp_offsets_present_flag));
              -
              437  TRUE_OR_RETURN(br->ReadBool(&pps->weighted_pred_flag));
              -
              438  TRUE_OR_RETURN(br->ReadBool(&pps->weighted_bipred_flag));
              -
              439  TRUE_OR_RETURN(br->ReadBool(&pps->transquant_bypass_enabled_flag));
              -
              440  TRUE_OR_RETURN(br->ReadBool(&pps->tiles_enabled_flag));
              -
              441  TRUE_OR_RETURN(br->ReadBool(&pps->entropy_coding_sync_enabled_flag));
              -
              442 
              -
              443  if (pps->tiles_enabled_flag) {
              -
              444  TRUE_OR_RETURN(br->ReadUE(&pps->num_tile_columns_minus1));
              -
              445  TRUE_OR_RETURN(br->ReadUE(&pps->num_tile_rows_minus1));
              -
              446  TRUE_OR_RETURN(br->ReadBool(&pps->uniform_spacing_flag));
              -
              447  if (!pps->uniform_spacing_flag) {
              -
              448  pps->column_width_minus1.resize(pps->num_tile_columns_minus1);
              -
              449  for (int i = 0; i < pps->num_tile_columns_minus1; i++) {
              -
              450  TRUE_OR_RETURN(br->ReadUE(&pps->column_width_minus1[i]));
              +
              397  return kOk;
              +
              398 }
              +
              399 
              +
              400 H265Parser::Result H265Parser::ParsePps(const Nalu& nalu, int* pps_id) {
              +
              401  DCHECK_EQ(Nalu::H265_PPS, nalu.type());
              +
              402 
              +
              403  // Reads most of the element, not reading the extension data.
              +
              404  H26xBitReader reader;
              +
              405  reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size());
              +
              406  H26xBitReader* br = &reader;
              +
              407 
              +
              408  *pps_id = -1;
              +
              409  std::unique_ptr<H265Pps> pps(new H265Pps);
              +
              410 
              +
              411  TRUE_OR_RETURN(br->ReadUE(&pps->pic_parameter_set_id));
              +
              412  TRUE_OR_RETURN(br->ReadUE(&pps->seq_parameter_set_id));
              +
              413 
              +
              414  TRUE_OR_RETURN(br->ReadBool(&pps->dependent_slice_segments_enabled_flag));
              +
              415  TRUE_OR_RETURN(br->ReadBool(&pps->output_flag_present_flag));
              +
              416  TRUE_OR_RETURN(br->ReadBits(3, &pps->num_extra_slice_header_bits));
              +
              417  TRUE_OR_RETURN(br->ReadBool(&pps->sign_data_hiding_enabled_flag));
              +
              418  TRUE_OR_RETURN(br->ReadBool(&pps->cabac_init_present_flag));
              +
              419 
              +
              420  TRUE_OR_RETURN(br->ReadUE(&pps->num_ref_idx_l0_default_active_minus1));
              +
              421  TRUE_OR_RETURN(br->ReadUE(&pps->num_ref_idx_l1_default_active_minus1));
              +
              422  TRUE_OR_RETURN(br->ReadSE(&pps->init_qp_minus26));
              +
              423  TRUE_OR_RETURN(br->ReadBool(&pps->constrained_intra_pred_flag));
              +
              424  TRUE_OR_RETURN(br->ReadBool(&pps->transform_skip_enabled_flag));
              +
              425 
              +
              426  TRUE_OR_RETURN(br->ReadBool(&pps->cu_qp_delta_enabled_flag));
              +
              427  if (pps->cu_qp_delta_enabled_flag)
              +
              428  TRUE_OR_RETURN(br->ReadUE(&pps->diff_cu_qp_delta_depth));
              +
              429  TRUE_OR_RETURN(br->ReadSE(&pps->cb_qp_offset));
              +
              430  TRUE_OR_RETURN(br->ReadSE(&pps->cr_qp_offset));
              +
              431 
              +
              432  TRUE_OR_RETURN(br->ReadBool(&pps->slice_chroma_qp_offsets_present_flag));
              +
              433  TRUE_OR_RETURN(br->ReadBool(&pps->weighted_pred_flag));
              +
              434  TRUE_OR_RETURN(br->ReadBool(&pps->weighted_bipred_flag));
              +
              435  TRUE_OR_RETURN(br->ReadBool(&pps->transquant_bypass_enabled_flag));
              +
              436  TRUE_OR_RETURN(br->ReadBool(&pps->tiles_enabled_flag));
              +
              437  TRUE_OR_RETURN(br->ReadBool(&pps->entropy_coding_sync_enabled_flag));
              +
              438 
              +
              439  if (pps->tiles_enabled_flag) {
              +
              440  TRUE_OR_RETURN(br->ReadUE(&pps->num_tile_columns_minus1));
              +
              441  TRUE_OR_RETURN(br->ReadUE(&pps->num_tile_rows_minus1));
              +
              442  TRUE_OR_RETURN(br->ReadBool(&pps->uniform_spacing_flag));
              +
              443  if (!pps->uniform_spacing_flag) {
              +
              444  pps->column_width_minus1.resize(pps->num_tile_columns_minus1);
              +
              445  for (int i = 0; i < pps->num_tile_columns_minus1; i++) {
              +
              446  TRUE_OR_RETURN(br->ReadUE(&pps->column_width_minus1[i]));
              +
              447  }
              +
              448  pps->row_height_minus1.resize(pps->num_tile_rows_minus1);
              +
              449  for (int i = 0; i < pps->num_tile_rows_minus1; i++) {
              +
              450  TRUE_OR_RETURN(br->ReadUE(&pps->row_height_minus1[i]));
              451  }
              -
              452  pps->row_height_minus1.resize(pps->num_tile_rows_minus1);
              -
              453  for (int i = 0; i < pps->num_tile_rows_minus1; i++) {
              -
              454  TRUE_OR_RETURN(br->ReadUE(&pps->row_height_minus1[i]));
              -
              455  }
              -
              456  }
              -
              457  TRUE_OR_RETURN(br->ReadBool(&pps->loop_filter_across_tiles_enabled_flag));
              -
              458  }
              -
              459 
              -
              460  TRUE_OR_RETURN(br->ReadBool(&pps->loop_filter_across_slices_enabled_flag));
              -
              461  TRUE_OR_RETURN(br->ReadBool(&pps->deblocking_filter_control_present_flag));
              -
              462  if (pps->deblocking_filter_control_present_flag) {
              -
              463  TRUE_OR_RETURN(br->ReadBool(&pps->deblocking_filter_override_enabled_flag));
              -
              464  TRUE_OR_RETURN(br->ReadBool(&pps->deblocking_filter_disabled_flag));
              -
              465  if (!pps->deblocking_filter_disabled_flag) {
              -
              466  TRUE_OR_RETURN(br->ReadSE(&pps->beta_offset_div2));
              -
              467  TRUE_OR_RETURN(br->ReadSE(&pps->tc_offset_div2));
              -
              468  }
              -
              469  }
              -
              470 
              -
              471  TRUE_OR_RETURN(br->ReadBool(&pps->scaling_list_data_present_flag));
              -
              472  if (pps->scaling_list_data_present_flag) {
              -
              473  OK_OR_RETURN(SkipScalingListData(br));
              -
              474  }
              -
              475 
              -
              476  TRUE_OR_RETURN(br->ReadBool(&pps->lists_modification_present_flag));
              -
              477  TRUE_OR_RETURN(br->ReadUE(&pps->log2_parallel_merge_level_minus2));
              -
              478 
              -
              479  TRUE_OR_RETURN(
              -
              480  br->ReadBool(&pps->slice_segment_header_extension_present_flag));
              -
              481 
              -
              482  bool pps_extension_present_flag;
              -
              483  bool pps_range_extension_flag = false;
              -
              484  TRUE_OR_RETURN(br->ReadBool(&pps_extension_present_flag));
              -
              485  if (pps_extension_present_flag) {
              -
              486  TRUE_OR_RETURN(br->ReadBool(&pps_range_extension_flag));
              -
              487  // pps_multilayer_extension_flag, pps_3d_extension_flag, pps_extension_5bits
              -
              488  TRUE_OR_RETURN(br->SkipBits(1 + 1 + 5));
              -
              489  }
              -
              490 
              -
              491  if (pps_range_extension_flag) {
              -
              492  if (pps->transform_skip_enabled_flag) {
              -
              493  // log2_max_transform_skip_block_size_minus2
              -
              494  int ignored;
              -
              495  TRUE_OR_RETURN(br->ReadUE(&ignored));
              -
              496  }
              -
              497 
              -
              498  TRUE_OR_RETURN(br->SkipBits(1)); // cross_component_prediction_enabled_flag
              -
              499  TRUE_OR_RETURN(br->ReadBool(&pps->chroma_qp_offset_list_enabled_flag));
              -
              500  // Incomplete
              -
              501  }
              -
              502 
              -
              503  // Ignore remaining extension data.
              +
              452  }
              +
              453  TRUE_OR_RETURN(br->ReadBool(&pps->loop_filter_across_tiles_enabled_flag));
              +
              454  }
              +
              455 
              +
              456  TRUE_OR_RETURN(br->ReadBool(&pps->loop_filter_across_slices_enabled_flag));
              +
              457  TRUE_OR_RETURN(br->ReadBool(&pps->deblocking_filter_control_present_flag));
              +
              458  if (pps->deblocking_filter_control_present_flag) {
              +
              459  TRUE_OR_RETURN(br->ReadBool(&pps->deblocking_filter_override_enabled_flag));
              +
              460  TRUE_OR_RETURN(br->ReadBool(&pps->deblocking_filter_disabled_flag));
              +
              461  if (!pps->deblocking_filter_disabled_flag) {
              +
              462  TRUE_OR_RETURN(br->ReadSE(&pps->beta_offset_div2));
              +
              463  TRUE_OR_RETURN(br->ReadSE(&pps->tc_offset_div2));
              +
              464  }
              +
              465  }
              +
              466 
              +
              467  TRUE_OR_RETURN(br->ReadBool(&pps->scaling_list_data_present_flag));
              +
              468  if (pps->scaling_list_data_present_flag) {
              +
              469  OK_OR_RETURN(SkipScalingListData(br));
              +
              470  }
              +
              471 
              +
              472  TRUE_OR_RETURN(br->ReadBool(&pps->lists_modification_present_flag));
              +
              473  TRUE_OR_RETURN(br->ReadUE(&pps->log2_parallel_merge_level_minus2));
              +
              474 
              +
              475  TRUE_OR_RETURN(
              +
              476  br->ReadBool(&pps->slice_segment_header_extension_present_flag));
              +
              477 
              +
              478  bool pps_extension_present_flag;
              +
              479  bool pps_range_extension_flag = false;
              +
              480  TRUE_OR_RETURN(br->ReadBool(&pps_extension_present_flag));
              +
              481  if (pps_extension_present_flag) {
              +
              482  TRUE_OR_RETURN(br->ReadBool(&pps_range_extension_flag));
              +
              483  // pps_multilayer_extension_flag, pps_3d_extension_flag, pps_extension_5bits
              +
              484  TRUE_OR_RETURN(br->SkipBits(1 + 1 + 5));
              +
              485  }
              +
              486 
              +
              487  if (pps_range_extension_flag) {
              +
              488  if (pps->transform_skip_enabled_flag) {
              +
              489  // log2_max_transform_skip_block_size_minus2
              +
              490  int ignored;
              +
              491  TRUE_OR_RETURN(br->ReadUE(&ignored));
              +
              492  }
              +
              493 
              +
              494  TRUE_OR_RETURN(br->SkipBits(1)); // cross_component_prediction_enabled_flag
              +
              495  TRUE_OR_RETURN(br->ReadBool(&pps->chroma_qp_offset_list_enabled_flag));
              +
              496  // Incomplete
              +
              497  }
              +
              498 
              +
              499  // Ignore remaining extension data.
              +
              500 
              +
              501  // This will replace any existing PPS instance.
              +
              502  *pps_id = pps->pic_parameter_set_id;
              +
              503  active_ppses_[*pps_id] = std::move(pps);
              504 
              -
              505  // This will replace any existing PPS instance.
              -
              506  *pps_id = pps->pic_parameter_set_id;
              -
              507  delete active_ppses_[*pps_id];
              -
              508  active_ppses_[*pps_id] = pps.release();
              -
              509 
              -
              510  return kOk;
              -
              511 }
              -
              512 
              -
              513 H265Parser::Result H265Parser::ParseSps(const Nalu& nalu, int* sps_id) {
              -
              514  DCHECK_EQ(Nalu::H265_SPS, nalu.type());
              +
              505  return kOk;
              +
              506 }
              +
              507 
              +
              508 H265Parser::Result H265Parser::ParseSps(const Nalu& nalu, int* sps_id) {
              +
              509  DCHECK_EQ(Nalu::H265_SPS, nalu.type());
              +
              510 
              +
              511  // Reads most of the element, not reading the extension data.
              +
              512  H26xBitReader reader;
              +
              513  reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size());
              +
              514  H26xBitReader* br = &reader;
              515 
              -
              516  // Reads most of the element, not reading the extension data.
              -
              517  H26xBitReader reader;
              -
              518  reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size());
              -
              519  H26xBitReader* br = &reader;
              -
              520 
              -
              521  *sps_id = -1;
              -
              522 
              -
              523  std::unique_ptr<H265Sps> sps(new H265Sps);
              -
              524 
              -
              525  TRUE_OR_RETURN(br->ReadBits(4, &sps->video_parameter_set_id));
              -
              526  TRUE_OR_RETURN(br->ReadBits(3, &sps->max_sub_layers_minus1));
              -
              527  TRUE_OR_RETURN(br->ReadBool(&sps->temporal_id_nesting_flag));
              -
              528 
              -
              529  OK_OR_RETURN(SkipProfileTierLevel(true, sps->max_sub_layers_minus1, br));
              -
              530 
              -
              531  TRUE_OR_RETURN(br->ReadUE(&sps->seq_parameter_set_id));
              -
              532  TRUE_OR_RETURN(br->ReadUE(&sps->chroma_format_idc));
              -
              533  if (sps->chroma_format_idc == 3) {
              -
              534  TRUE_OR_RETURN(br->ReadBool(&sps->separate_colour_plane_flag));
              -
              535  }
              -
              536  TRUE_OR_RETURN(br->ReadUE(&sps->pic_width_in_luma_samples));
              -
              537  TRUE_OR_RETURN(br->ReadUE(&sps->pic_height_in_luma_samples));
              -
              538 
              -
              539  TRUE_OR_RETURN(br->ReadBool(&sps->conformance_window_flag));
              -
              540  if (sps->conformance_window_flag) {
              -
              541  TRUE_OR_RETURN(br->ReadUE(&sps->conf_win_left_offset));
              -
              542  TRUE_OR_RETURN(br->ReadUE(&sps->conf_win_right_offset));
              -
              543  TRUE_OR_RETURN(br->ReadUE(&sps->conf_win_top_offset));
              -
              544  TRUE_OR_RETURN(br->ReadUE(&sps->conf_win_bottom_offset));
              -
              545  }
              -
              546 
              -
              547  TRUE_OR_RETURN(br->ReadUE(&sps->bit_depth_luma_minus8));
              -
              548  TRUE_OR_RETURN(br->ReadUE(&sps->bit_depth_chroma_minus8));
              -
              549  TRUE_OR_RETURN(br->ReadUE(&sps->log2_max_pic_order_cnt_lsb_minus4));
              -
              550 
              -
              551  TRUE_OR_RETURN(br->ReadBool(&sps->sub_layer_ordering_info_present_flag));
              -
              552  int start = sps->sub_layer_ordering_info_present_flag
              -
              553  ? 0
              -
              554  : sps->max_sub_layers_minus1;
              -
              555  for (int i = start; i <= sps->max_sub_layers_minus1; i++) {
              -
              556  TRUE_OR_RETURN(br->ReadUE(&sps->max_dec_pic_buffering_minus1[i]));
              -
              557  TRUE_OR_RETURN(br->ReadUE(&sps->max_num_reorder_pics[i]));
              -
              558  TRUE_OR_RETURN(br->ReadUE(&sps->max_latency_increase_plus1[i]));
              -
              559  }
              -
              560 
              -
              561  TRUE_OR_RETURN(br->ReadUE(&sps->log2_min_luma_coding_block_size_minus3));
              -
              562  TRUE_OR_RETURN(br->ReadUE(&sps->log2_diff_max_min_luma_coding_block_size));
              -
              563  TRUE_OR_RETURN(br->ReadUE(&sps->log2_min_luma_transform_block_size_minus2));
              -
              564  TRUE_OR_RETURN(br->ReadUE(&sps->log2_diff_max_min_luma_transform_block_size));
              -
              565  TRUE_OR_RETURN(br->ReadUE(&sps->max_transform_hierarchy_depth_inter));
              -
              566  TRUE_OR_RETURN(br->ReadUE(&sps->max_transform_hierarchy_depth_intra));
              -
              567 
              -
              568  TRUE_OR_RETURN(br->ReadBool(&sps->scaling_list_enabled_flag));
              -
              569  if (sps->scaling_list_enabled_flag) {
              -
              570  TRUE_OR_RETURN(br->ReadBool(&sps->scaling_list_data_present_flag));
              -
              571  if (sps->scaling_list_data_present_flag) {
              -
              572  OK_OR_RETURN(SkipScalingListData(br));
              -
              573  }
              -
              574  }
              -
              575 
              -
              576  TRUE_OR_RETURN(br->ReadBool(&sps->amp_enabled_flag));
              -
              577  TRUE_OR_RETURN(br->ReadBool(&sps->sample_adaptive_offset_enabled_flag));
              -
              578  TRUE_OR_RETURN(br->ReadBool(&sps->pcm_enabled_flag));
              -
              579  if (sps->pcm_enabled_flag) {
              -
              580  TRUE_OR_RETURN(br->ReadBits(4, &sps->pcm_sample_bit_depth_luma_minus1));
              -
              581  TRUE_OR_RETURN(br->ReadBits(4, &sps->pcm_sample_bit_depth_chroma_minus1));
              -
              582  TRUE_OR_RETURN(
              -
              583  br->ReadUE(&sps->log2_min_pcm_luma_coding_block_size_minus3));
              -
              584  TRUE_OR_RETURN(
              -
              585  br->ReadUE(&sps->log2_diff_max_min_pcm_luma_coding_block_size));
              -
              586  TRUE_OR_RETURN(br->ReadBool(&sps->pcm_loop_filter_disabled_flag));
              -
              587  }
              -
              588 
              -
              589  TRUE_OR_RETURN(br->ReadUE(&sps->num_short_term_ref_pic_sets));
              -
              590  sps->st_ref_pic_sets.resize(sps->num_short_term_ref_pic_sets);
              -
              591  for (int i = 0; i < sps->num_short_term_ref_pic_sets; i++) {
              -
              592  OK_OR_RETURN(ParseReferencePictureSet(sps->num_short_term_ref_pic_sets, i,
              -
              593  sps->st_ref_pic_sets, br,
              -
              594  &sps->st_ref_pic_sets[i]));
              -
              595  }
              -
              596 
              -
              597  TRUE_OR_RETURN(br->ReadBool(&sps->long_term_ref_pic_present_flag));
              -
              598  if (sps->long_term_ref_pic_present_flag) {
              -
              599  TRUE_OR_RETURN(br->ReadUE(&sps->num_long_term_ref_pics));
              -
              600  sps->lt_ref_pic_poc_lsb.resize(sps->num_long_term_ref_pics);
              -
              601  sps->used_by_curr_pic_lt_flag.resize(sps->num_long_term_ref_pics);
              -
              602  for (int i = 0; i < sps->num_long_term_ref_pics; i++) {
              -
              603  TRUE_OR_RETURN(br->ReadBits(sps->log2_max_pic_order_cnt_lsb_minus4 + 4,
              -
              604  &sps->lt_ref_pic_poc_lsb[i]));
              -
              605  bool temp;
              -
              606  TRUE_OR_RETURN(br->ReadBool(&temp));
              -
              607  sps->used_by_curr_pic_lt_flag[i] = temp;
              -
              608  }
              -
              609  }
              -
              610 
              -
              611  TRUE_OR_RETURN(br->ReadBool(&sps->temporal_mvp_enabled_flag));
              -
              612  TRUE_OR_RETURN(br->ReadBool(&sps->strong_intra_smoothing_enabled_flag));
              -
              613 
              -
              614  TRUE_OR_RETURN(br->ReadBool(&sps->vui_parameters_present));
              -
              615  if (sps->vui_parameters_present) {
              -
              616  OK_OR_RETURN(ParseVuiParameters(sps->max_sub_layers_minus1, br,
              -
              617  &sps->vui_parameters));
              -
              618  }
              -
              619 
              -
              620  // Ignore remaining extension data.
              -
              621 
              -
              622  // This will replace any existing SPS instance.
              -
              623  *sps_id = sps->seq_parameter_set_id;
              -
              624  delete active_spses_[*sps_id];
              -
              625  active_spses_[*sps_id] = sps.release();
              -
              626 
              -
              627  return kOk;
              -
              628 }
              -
              629 
              -
              630 const H265Pps* H265Parser::GetPps(int pps_id) {
              -
              631  return active_ppses_[pps_id];
              -
              632 }
              -
              633 
              -
              634 const H265Sps* H265Parser::GetSps(int sps_id) {
              -
              635  return active_spses_[sps_id];
              -
              636 }
              +
              516  *sps_id = -1;
              +
              517 
              +
              518  std::unique_ptr<H265Sps> sps(new H265Sps);
              +
              519 
              +
              520  TRUE_OR_RETURN(br->ReadBits(4, &sps->video_parameter_set_id));
              +
              521  TRUE_OR_RETURN(br->ReadBits(3, &sps->max_sub_layers_minus1));
              +
              522  TRUE_OR_RETURN(br->ReadBool(&sps->temporal_id_nesting_flag));
              +
              523 
              +
              524  OK_OR_RETURN(SkipProfileTierLevel(true, sps->max_sub_layers_minus1, br));
              +
              525 
              +
              526  TRUE_OR_RETURN(br->ReadUE(&sps->seq_parameter_set_id));
              +
              527  TRUE_OR_RETURN(br->ReadUE(&sps->chroma_format_idc));
              +
              528  if (sps->chroma_format_idc == 3) {
              +
              529  TRUE_OR_RETURN(br->ReadBool(&sps->separate_colour_plane_flag));
              +
              530  }
              +
              531  TRUE_OR_RETURN(br->ReadUE(&sps->pic_width_in_luma_samples));
              +
              532  TRUE_OR_RETURN(br->ReadUE(&sps->pic_height_in_luma_samples));
              +
              533 
              +
              534  TRUE_OR_RETURN(br->ReadBool(&sps->conformance_window_flag));
              +
              535  if (sps->conformance_window_flag) {
              +
              536  TRUE_OR_RETURN(br->ReadUE(&sps->conf_win_left_offset));
              +
              537  TRUE_OR_RETURN(br->ReadUE(&sps->conf_win_right_offset));
              +
              538  TRUE_OR_RETURN(br->ReadUE(&sps->conf_win_top_offset));
              +
              539  TRUE_OR_RETURN(br->ReadUE(&sps->conf_win_bottom_offset));
              +
              540  }
              +
              541 
              +
              542  TRUE_OR_RETURN(br->ReadUE(&sps->bit_depth_luma_minus8));
              +
              543  TRUE_OR_RETURN(br->ReadUE(&sps->bit_depth_chroma_minus8));
              +
              544  TRUE_OR_RETURN(br->ReadUE(&sps->log2_max_pic_order_cnt_lsb_minus4));
              +
              545 
              +
              546  TRUE_OR_RETURN(br->ReadBool(&sps->sub_layer_ordering_info_present_flag));
              +
              547  int start = sps->sub_layer_ordering_info_present_flag
              +
              548  ? 0
              +
              549  : sps->max_sub_layers_minus1;
              +
              550  for (int i = start; i <= sps->max_sub_layers_minus1; i++) {
              +
              551  TRUE_OR_RETURN(br->ReadUE(&sps->max_dec_pic_buffering_minus1[i]));
              +
              552  TRUE_OR_RETURN(br->ReadUE(&sps->max_num_reorder_pics[i]));
              +
              553  TRUE_OR_RETURN(br->ReadUE(&sps->max_latency_increase_plus1[i]));
              +
              554  }
              +
              555 
              +
              556  TRUE_OR_RETURN(br->ReadUE(&sps->log2_min_luma_coding_block_size_minus3));
              +
              557  TRUE_OR_RETURN(br->ReadUE(&sps->log2_diff_max_min_luma_coding_block_size));
              +
              558  TRUE_OR_RETURN(br->ReadUE(&sps->log2_min_luma_transform_block_size_minus2));
              +
              559  TRUE_OR_RETURN(br->ReadUE(&sps->log2_diff_max_min_luma_transform_block_size));
              +
              560  TRUE_OR_RETURN(br->ReadUE(&sps->max_transform_hierarchy_depth_inter));
              +
              561  TRUE_OR_RETURN(br->ReadUE(&sps->max_transform_hierarchy_depth_intra));
              +
              562 
              +
              563  TRUE_OR_RETURN(br->ReadBool(&sps->scaling_list_enabled_flag));
              +
              564  if (sps->scaling_list_enabled_flag) {
              +
              565  TRUE_OR_RETURN(br->ReadBool(&sps->scaling_list_data_present_flag));
              +
              566  if (sps->scaling_list_data_present_flag) {
              +
              567  OK_OR_RETURN(SkipScalingListData(br));
              +
              568  }
              +
              569  }
              +
              570 
              +
              571  TRUE_OR_RETURN(br->ReadBool(&sps->amp_enabled_flag));
              +
              572  TRUE_OR_RETURN(br->ReadBool(&sps->sample_adaptive_offset_enabled_flag));
              +
              573  TRUE_OR_RETURN(br->ReadBool(&sps->pcm_enabled_flag));
              +
              574  if (sps->pcm_enabled_flag) {
              +
              575  TRUE_OR_RETURN(br->ReadBits(4, &sps->pcm_sample_bit_depth_luma_minus1));
              +
              576  TRUE_OR_RETURN(br->ReadBits(4, &sps->pcm_sample_bit_depth_chroma_minus1));
              +
              577  TRUE_OR_RETURN(
              +
              578  br->ReadUE(&sps->log2_min_pcm_luma_coding_block_size_minus3));
              +
              579  TRUE_OR_RETURN(
              +
              580  br->ReadUE(&sps->log2_diff_max_min_pcm_luma_coding_block_size));
              +
              581  TRUE_OR_RETURN(br->ReadBool(&sps->pcm_loop_filter_disabled_flag));
              +
              582  }
              +
              583 
              +
              584  TRUE_OR_RETURN(br->ReadUE(&sps->num_short_term_ref_pic_sets));
              +
              585  sps->st_ref_pic_sets.resize(sps->num_short_term_ref_pic_sets);
              +
              586  for (int i = 0; i < sps->num_short_term_ref_pic_sets; i++) {
              +
              587  OK_OR_RETURN(ParseReferencePictureSet(sps->num_short_term_ref_pic_sets, i,
              +
              588  sps->st_ref_pic_sets, br,
              +
              589  &sps->st_ref_pic_sets[i]));
              +
              590  }
              +
              591 
              +
              592  TRUE_OR_RETURN(br->ReadBool(&sps->long_term_ref_pic_present_flag));
              +
              593  if (sps->long_term_ref_pic_present_flag) {
              +
              594  TRUE_OR_RETURN(br->ReadUE(&sps->num_long_term_ref_pics));
              +
              595  sps->lt_ref_pic_poc_lsb.resize(sps->num_long_term_ref_pics);
              +
              596  sps->used_by_curr_pic_lt_flag.resize(sps->num_long_term_ref_pics);
              +
              597  for (int i = 0; i < sps->num_long_term_ref_pics; i++) {
              +
              598  TRUE_OR_RETURN(br->ReadBits(sps->log2_max_pic_order_cnt_lsb_minus4 + 4,
              +
              599  &sps->lt_ref_pic_poc_lsb[i]));
              +
              600  bool temp;
              +
              601  TRUE_OR_RETURN(br->ReadBool(&temp));
              +
              602  sps->used_by_curr_pic_lt_flag[i] = temp;
              +
              603  }
              +
              604  }
              +
              605 
              +
              606  TRUE_OR_RETURN(br->ReadBool(&sps->temporal_mvp_enabled_flag));
              +
              607  TRUE_OR_RETURN(br->ReadBool(&sps->strong_intra_smoothing_enabled_flag));
              +
              608 
              +
              609  TRUE_OR_RETURN(br->ReadBool(&sps->vui_parameters_present));
              +
              610  if (sps->vui_parameters_present) {
              +
              611  OK_OR_RETURN(ParseVuiParameters(sps->max_sub_layers_minus1, br,
              +
              612  &sps->vui_parameters));
              +
              613  }
              +
              614 
              +
              615  // Ignore remaining extension data.
              +
              616 
              +
              617  // This will replace any existing SPS instance.
              +
              618  *sps_id = sps->seq_parameter_set_id;
              +
              619  active_spses_[*sps_id] = std::move(sps);
              +
              620 
              +
              621  return kOk;
              +
              622 }
              +
              623 
              +
              624 const H265Pps* H265Parser::GetPps(int pps_id) {
              +
              625  return active_ppses_[pps_id].get();
              +
              626 }
              +
              627 
              +
              628 const H265Sps* H265Parser::GetSps(int sps_id) {
              +
              629  return active_spses_[sps_id].get();
              +
              630 }
              +
              631 
              +
              632 H265Parser::Result H265Parser::ParseVuiParameters(int max_num_sub_layers_minus1,
              +
              633  H26xBitReader* br,
              +
              634  H265VuiParameters* vui) {
              +
              635  // Reads whole element but ignores most of it.
              +
              636  int ignored;
              637 
              -
              638 H265Parser::Result H265Parser::ParseVuiParameters(int max_num_sub_layers_minus1,
              -
              639  H26xBitReader* br,
              -
              640  H265VuiParameters* vui) {
              -
              641  // Reads whole element but ignores most of it.
              -
              642  int ignored;
              -
              643 
              -
              644  TRUE_OR_RETURN(br->ReadBool(&vui->aspect_ratio_info_present_flag));
              -
              645  if (vui->aspect_ratio_info_present_flag) {
              -
              646  TRUE_OR_RETURN(br->ReadBits(8, &vui->aspect_ratio_idc));
              -
              647  if (vui->aspect_ratio_idc == H265VuiParameters::kExtendedSar) {
              -
              648  TRUE_OR_RETURN(br->ReadBits(16, &vui->sar_width));
              -
              649  TRUE_OR_RETURN(br->ReadBits(16, &vui->sar_height));
              -
              650  }
              +
              638  TRUE_OR_RETURN(br->ReadBool(&vui->aspect_ratio_info_present_flag));
              +
              639  if (vui->aspect_ratio_info_present_flag) {
              +
              640  TRUE_OR_RETURN(br->ReadBits(8, &vui->aspect_ratio_idc));
              +
              641  if (vui->aspect_ratio_idc == H265VuiParameters::kExtendedSar) {
              +
              642  TRUE_OR_RETURN(br->ReadBits(16, &vui->sar_width));
              +
              643  TRUE_OR_RETURN(br->ReadBits(16, &vui->sar_height));
              +
              644  }
              +
              645  }
              +
              646 
              +
              647  bool overscan_info_present_flag;
              +
              648  TRUE_OR_RETURN(br->ReadBool(&overscan_info_present_flag));
              +
              649  if (overscan_info_present_flag) {
              +
              650  TRUE_OR_RETURN(br->SkipBits(1)); // overscan_appropriate_flag
              651  }
              652 
              -
              653  bool overscan_info_present_flag;
              -
              654  TRUE_OR_RETURN(br->ReadBool(&overscan_info_present_flag));
              -
              655  if (overscan_info_present_flag) {
              -
              656  TRUE_OR_RETURN(br->SkipBits(1)); // overscan_appropriate_flag
              -
              657  }
              +
              653  bool video_signal_type_present_flag;
              +
              654  TRUE_OR_RETURN(br->ReadBool(&video_signal_type_present_flag));
              +
              655  if (video_signal_type_present_flag) {
              +
              656  TRUE_OR_RETURN(br->SkipBits(3)); // video_format
              +
              657  TRUE_OR_RETURN(br->SkipBits(1)); // video_full_range_flag
              658 
              -
              659  bool video_signal_type_present_flag;
              -
              660  TRUE_OR_RETURN(br->ReadBool(&video_signal_type_present_flag));
              -
              661  if (video_signal_type_present_flag) {
              -
              662  TRUE_OR_RETURN(br->SkipBits(3)); // video_format
              -
              663  TRUE_OR_RETURN(br->SkipBits(1)); // video_full_range_flag
              -
              664 
              -
              665  bool colour_description_present_flag;
              -
              666  TRUE_OR_RETURN(br->ReadBool(&colour_description_present_flag));
              -
              667  if (colour_description_present_flag) {
              -
              668  // colour_primaries, transfer_characteristics, matrix_coeffs
              -
              669  TRUE_OR_RETURN(br->SkipBits(8 + 8 + 8));
              -
              670  }
              -
              671  }
              -
              672 
              -
              673  bool chroma_loc_info_present_flag;
              -
              674  TRUE_OR_RETURN(br->ReadBool(&chroma_loc_info_present_flag));
              -
              675  if (chroma_loc_info_present_flag) {
              -
              676  // chroma_sample_log_type_top_field, chroma_sample_log_type_bottom_field
              -
              677  TRUE_OR_RETURN(br->ReadUE(&ignored));
              -
              678  TRUE_OR_RETURN(br->ReadUE(&ignored));
              -
              679  }
              -
              680 
              -
              681  // neutral_chroma_indication_flag, field_seq_flag,
              -
              682  // frame_field_info_present_flag.
              -
              683  TRUE_OR_RETURN(br->SkipBits(3));
              -
              684 
              -
              685  bool default_display_window_flag;
              -
              686  TRUE_OR_RETURN(br->ReadBool(&default_display_window_flag));
              -
              687  if (default_display_window_flag) {
              -
              688  TRUE_OR_RETURN(br->ReadUE(&ignored)); // def_disp_win_left_offset
              -
              689  TRUE_OR_RETURN(br->ReadUE(&ignored)); // def_disp_win_right_offset
              -
              690  TRUE_OR_RETURN(br->ReadUE(&ignored)); // def_disp_win_top_offset
              -
              691  TRUE_OR_RETURN(br->ReadUE(&ignored)); // def_disp_win_bottom_offset
              -
              692  }
              +
              659  bool colour_description_present_flag;
              +
              660  TRUE_OR_RETURN(br->ReadBool(&colour_description_present_flag));
              +
              661  if (colour_description_present_flag) {
              +
              662  // colour_primaries, transfer_characteristics, matrix_coeffs
              +
              663  TRUE_OR_RETURN(br->SkipBits(8 + 8 + 8));
              +
              664  }
              +
              665  }
              +
              666 
              +
              667  bool chroma_loc_info_present_flag;
              +
              668  TRUE_OR_RETURN(br->ReadBool(&chroma_loc_info_present_flag));
              +
              669  if (chroma_loc_info_present_flag) {
              +
              670  // chroma_sample_log_type_top_field, chroma_sample_log_type_bottom_field
              +
              671  TRUE_OR_RETURN(br->ReadUE(&ignored));
              +
              672  TRUE_OR_RETURN(br->ReadUE(&ignored));
              +
              673  }
              +
              674 
              +
              675  // neutral_chroma_indication_flag, field_seq_flag,
              +
              676  // frame_field_info_present_flag.
              +
              677  TRUE_OR_RETURN(br->SkipBits(3));
              +
              678 
              +
              679  bool default_display_window_flag;
              +
              680  TRUE_OR_RETURN(br->ReadBool(&default_display_window_flag));
              +
              681  if (default_display_window_flag) {
              +
              682  TRUE_OR_RETURN(br->ReadUE(&ignored)); // def_disp_win_left_offset
              +
              683  TRUE_OR_RETURN(br->ReadUE(&ignored)); // def_disp_win_right_offset
              +
              684  TRUE_OR_RETURN(br->ReadUE(&ignored)); // def_disp_win_top_offset
              +
              685  TRUE_OR_RETURN(br->ReadUE(&ignored)); // def_disp_win_bottom_offset
              +
              686  }
              +
              687 
              +
              688  bool vui_timing_info_present_flag;
              +
              689  TRUE_OR_RETURN(br->ReadBool(&vui_timing_info_present_flag));
              +
              690  if (vui_timing_info_present_flag) {
              +
              691  // vui_num_units_in_tick, vui_time_scale
              +
              692  TRUE_OR_RETURN(br->SkipBits(32 + 32));
              693 
              -
              694  bool vui_timing_info_present_flag;
              -
              695  TRUE_OR_RETURN(br->ReadBool(&vui_timing_info_present_flag));
              -
              696  if (vui_timing_info_present_flag) {
              -
              697  // vui_num_units_in_tick, vui_time_scale
              -
              698  TRUE_OR_RETURN(br->SkipBits(32 + 32));
              -
              699 
              -
              700  bool vui_poc_proportional_to_timing_flag;
              -
              701  TRUE_OR_RETURN(br->ReadBool(&vui_poc_proportional_to_timing_flag));
              -
              702  if (vui_poc_proportional_to_timing_flag) {
              -
              703  // vui_num_ticks_poc_diff_one_minus1
              -
              704  TRUE_OR_RETURN(br->ReadUE(&ignored));
              +
              694  bool vui_poc_proportional_to_timing_flag;
              +
              695  TRUE_OR_RETURN(br->ReadBool(&vui_poc_proportional_to_timing_flag));
              +
              696  if (vui_poc_proportional_to_timing_flag) {
              +
              697  // vui_num_ticks_poc_diff_one_minus1
              +
              698  TRUE_OR_RETURN(br->ReadUE(&ignored));
              +
              699  }
              +
              700 
              +
              701  bool vui_hdr_parameters_present_flag;
              +
              702  TRUE_OR_RETURN(br->ReadBool(&vui_hdr_parameters_present_flag));
              +
              703  if (vui_hdr_parameters_present_flag) {
              +
              704  OK_OR_RETURN(SkipHrdParameters(max_num_sub_layers_minus1, br));
              705  }
              -
              706 
              -
              707  bool vui_hdr_parameters_present_flag;
              -
              708  TRUE_OR_RETURN(br->ReadBool(&vui_hdr_parameters_present_flag));
              -
              709  if (vui_hdr_parameters_present_flag) {
              -
              710  OK_OR_RETURN(SkipHrdParameters(max_num_sub_layers_minus1, br));
              -
              711  }
              -
              712  }
              +
              706  }
              +
              707 
              +
              708  TRUE_OR_RETURN(br->ReadBool(&vui->bitstream_restriction_flag));
              +
              709  if (vui->bitstream_restriction_flag) {
              +
              710  // tiles_fixed_structure_flag, motion_vectors_over_pic_boundaries_flag,
              +
              711  // restricted_ref_pic_lists_flag.
              +
              712  TRUE_OR_RETURN(br->SkipBits(3));
              713 
              -
              714  TRUE_OR_RETURN(br->ReadBool(&vui->bitstream_restriction_flag));
              -
              715  if (vui->bitstream_restriction_flag) {
              -
              716  // tiles_fixed_structure_flag, motion_vectors_over_pic_boundaries_flag,
              -
              717  // restricted_ref_pic_lists_flag.
              -
              718  TRUE_OR_RETURN(br->SkipBits(3));
              -
              719 
              -
              720  TRUE_OR_RETURN(br->ReadUE(&vui->min_spatial_segmentation_idc));
              -
              721  TRUE_OR_RETURN(br->ReadUE(&ignored)); // max_bytes_per_pic_denom
              -
              722  TRUE_OR_RETURN(br->ReadUE(&ignored)); // max_bits_per_min_cu_denum
              -
              723  TRUE_OR_RETURN(br->ReadUE(&ignored)); // log2_max_mv_length_horizontal
              -
              724  TRUE_OR_RETURN(br->ReadUE(&ignored)); // log2_max_mv_length_vertical
              -
              725  }
              -
              726 
              -
              727  return kOk;
              -
              728 }
              -
              729 
              -
              730 H265Parser::Result H265Parser::ParseReferencePictureSet(
              -
              731  int num_short_term_ref_pic_sets,
              -
              732  int st_rps_idx,
              -
              733  const std::vector<H265ReferencePictureSet>& ref_pic_sets,
              -
              734  H26xBitReader* br,
              -
              735  H265ReferencePictureSet* out_ref_pic_set) {
              -
              736  // Parses and processess a short-term reference picture set. This needs to
              -
              737  // be done since the size of this element may be dependent on previous
              -
              738  // reference picture sets.
              -
              739 
              -
              740  bool inter_ref_pic_set_prediction = false;
              -
              741  if (st_rps_idx != 0) {
              -
              742  TRUE_OR_RETURN(br->ReadBool(&inter_ref_pic_set_prediction));
              -
              743  }
              -
              744 
              -
              745  if (inter_ref_pic_set_prediction) {
              -
              746  int delta_idx = 1;
              -
              747  if (st_rps_idx == num_short_term_ref_pic_sets) {
              -
              748  TRUE_OR_RETURN(br->ReadUE(&delta_idx));
              -
              749  delta_idx++;
              -
              750  TRUE_OR_RETURN(delta_idx <= st_rps_idx);
              -
              751  }
              -
              752 
              -
              753  int ref_rps_idx = st_rps_idx - delta_idx;
              -
              754  DCHECK_LE(0, ref_rps_idx);
              -
              755  DCHECK_LT(ref_rps_idx, st_rps_idx);
              -
              756 
              -
              757  bool delta_rps_sign;
              -
              758  int abs_delta_rps_minus1;
              -
              759  TRUE_OR_RETURN(br->ReadBool(&delta_rps_sign));
              -
              760  TRUE_OR_RETURN(br->ReadUE(&abs_delta_rps_minus1));
              -
              761  int delta_rps =
              -
              762  delta_rps_sign ? -(abs_delta_rps_minus1 + 1) : abs_delta_rps_minus1 + 1;
              -
              763 
              -
              764  int ref_num_delta_pocs = ref_pic_sets[ref_rps_idx].num_delta_pocs;
              -
              765  std::vector<bool> used_by_curr_pic(ref_num_delta_pocs + 1);
              -
              766  std::vector<bool> use_delta(ref_num_delta_pocs + 1);
              -
              767  for (int j = 0; j <= ref_num_delta_pocs; j++) {
              -
              768  bool temp;
              -
              769  TRUE_OR_RETURN(br->ReadBool(&temp));
              -
              770  used_by_curr_pic[j] = temp;
              -
              771 
              -
              772  if (!used_by_curr_pic[j]) {
              -
              773  TRUE_OR_RETURN(br->ReadBool(&temp));
              -
              774  use_delta[j] = temp;
              -
              775  } else {
              -
              776  use_delta[j] = true;
              -
              777  }
              -
              778  }
              -
              779 
              -
              780  int ref_num_positive_pics = ref_pic_sets[ref_rps_idx].num_positive_pics;
              -
              781  int ref_num_negative_pics = ref_pic_sets[ref_rps_idx].num_negative_pics;
              -
              782  int i;
              -
              783 
              -
              784  // Update list 0.
              -
              785  {
              -
              786  i = 0;
              -
              787  for (int j = ref_num_positive_pics - 1; j >= 0; j--) {
              -
              788  int d_poc = ref_pic_sets[ref_rps_idx].delta_poc_s1[j] + delta_rps;
              -
              789  if (d_poc < 0 && use_delta[ref_num_negative_pics + j]) {
              -
              790  out_ref_pic_set->delta_poc_s0[i] = d_poc;
              -
              791  out_ref_pic_set->used_by_curr_pic_s0[i] =
              -
              792  used_by_curr_pic[ref_num_negative_pics + j];
              -
              793  i++;
              -
              794  }
              +
              714  TRUE_OR_RETURN(br->ReadUE(&vui->min_spatial_segmentation_idc));
              +
              715  TRUE_OR_RETURN(br->ReadUE(&ignored)); // max_bytes_per_pic_denom
              +
              716  TRUE_OR_RETURN(br->ReadUE(&ignored)); // max_bits_per_min_cu_denum
              +
              717  TRUE_OR_RETURN(br->ReadUE(&ignored)); // log2_max_mv_length_horizontal
              +
              718  TRUE_OR_RETURN(br->ReadUE(&ignored)); // log2_max_mv_length_vertical
              +
              719  }
              +
              720 
              +
              721  return kOk;
              +
              722 }
              +
              723 
              +
              724 H265Parser::Result H265Parser::ParseReferencePictureSet(
              +
              725  int num_short_term_ref_pic_sets,
              +
              726  int st_rps_idx,
              +
              727  const std::vector<H265ReferencePictureSet>& ref_pic_sets,
              +
              728  H26xBitReader* br,
              +
              729  H265ReferencePictureSet* out_ref_pic_set) {
              +
              730  // Parses and processess a short-term reference picture set. This needs to
              +
              731  // be done since the size of this element may be dependent on previous
              +
              732  // reference picture sets.
              +
              733 
              +
              734  bool inter_ref_pic_set_prediction = false;
              +
              735  if (st_rps_idx != 0) {
              +
              736  TRUE_OR_RETURN(br->ReadBool(&inter_ref_pic_set_prediction));
              +
              737  }
              +
              738 
              +
              739  if (inter_ref_pic_set_prediction) {
              +
              740  int delta_idx = 1;
              +
              741  if (st_rps_idx == num_short_term_ref_pic_sets) {
              +
              742  TRUE_OR_RETURN(br->ReadUE(&delta_idx));
              +
              743  delta_idx++;
              +
              744  TRUE_OR_RETURN(delta_idx <= st_rps_idx);
              +
              745  }
              +
              746 
              +
              747  int ref_rps_idx = st_rps_idx - delta_idx;
              +
              748  DCHECK_LE(0, ref_rps_idx);
              +
              749  DCHECK_LT(ref_rps_idx, st_rps_idx);
              +
              750 
              +
              751  bool delta_rps_sign;
              +
              752  int abs_delta_rps_minus1;
              +
              753  TRUE_OR_RETURN(br->ReadBool(&delta_rps_sign));
              +
              754  TRUE_OR_RETURN(br->ReadUE(&abs_delta_rps_minus1));
              +
              755  int delta_rps =
              +
              756  delta_rps_sign ? -(abs_delta_rps_minus1 + 1) : abs_delta_rps_minus1 + 1;
              +
              757 
              +
              758  int ref_num_delta_pocs = ref_pic_sets[ref_rps_idx].num_delta_pocs;
              +
              759  std::vector<bool> used_by_curr_pic(ref_num_delta_pocs + 1);
              +
              760  std::vector<bool> use_delta(ref_num_delta_pocs + 1);
              +
              761  for (int j = 0; j <= ref_num_delta_pocs; j++) {
              +
              762  bool temp;
              +
              763  TRUE_OR_RETURN(br->ReadBool(&temp));
              +
              764  used_by_curr_pic[j] = temp;
              +
              765 
              +
              766  if (!used_by_curr_pic[j]) {
              +
              767  TRUE_OR_RETURN(br->ReadBool(&temp));
              +
              768  use_delta[j] = temp;
              +
              769  } else {
              +
              770  use_delta[j] = true;
              +
              771  }
              +
              772  }
              +
              773 
              +
              774  int ref_num_positive_pics = ref_pic_sets[ref_rps_idx].num_positive_pics;
              +
              775  int ref_num_negative_pics = ref_pic_sets[ref_rps_idx].num_negative_pics;
              +
              776  int i;
              +
              777 
              +
              778  // Update list 0.
              +
              779  {
              +
              780  i = 0;
              +
              781  for (int j = ref_num_positive_pics - 1; j >= 0; j--) {
              +
              782  int d_poc = ref_pic_sets[ref_rps_idx].delta_poc_s1[j] + delta_rps;
              +
              783  if (d_poc < 0 && use_delta[ref_num_negative_pics + j]) {
              +
              784  out_ref_pic_set->delta_poc_s0[i] = d_poc;
              +
              785  out_ref_pic_set->used_by_curr_pic_s0[i] =
              +
              786  used_by_curr_pic[ref_num_negative_pics + j];
              +
              787  i++;
              +
              788  }
              +
              789  }
              +
              790  if (delta_rps < 0 && use_delta[ref_num_delta_pocs]) {
              +
              791  out_ref_pic_set->delta_poc_s0[i] = delta_rps;
              +
              792  out_ref_pic_set->used_by_curr_pic_s0[i] =
              +
              793  used_by_curr_pic[ref_num_delta_pocs];
              +
              794  i++;
              795  }
              -
              796  if (delta_rps < 0 && use_delta[ref_num_delta_pocs]) {
              -
              797  out_ref_pic_set->delta_poc_s0[i] = delta_rps;
              -
              798  out_ref_pic_set->used_by_curr_pic_s0[i] =
              -
              799  used_by_curr_pic[ref_num_delta_pocs];
              -
              800  i++;
              -
              801  }
              -
              802  for (int j = 0; j < ref_num_negative_pics; j++) {
              -
              803  int d_poc = ref_pic_sets[ref_rps_idx].delta_poc_s0[j] + delta_rps;
              -
              804  if (d_poc < 0 && use_delta[j]) {
              -
              805  out_ref_pic_set->delta_poc_s0[i] = d_poc;
              -
              806  out_ref_pic_set->used_by_curr_pic_s0[i] = used_by_curr_pic[j];
              -
              807  i++;
              -
              808  }
              -
              809  }
              -
              810  out_ref_pic_set->num_negative_pics = i;
              -
              811  }
              -
              812 
              -
              813  // Update list 1.
              -
              814  {
              -
              815  i = 0;
              -
              816  for (int j = ref_num_negative_pics - 1; j >= 0; j--) {
              -
              817  int d_poc = ref_pic_sets[ref_rps_idx].delta_poc_s0[j] + delta_rps;
              -
              818  if (d_poc > 0 && use_delta[j]) {
              -
              819  out_ref_pic_set->delta_poc_s1[i] = d_poc;
              -
              820  out_ref_pic_set->used_by_curr_pic_s1[i] = used_by_curr_pic[j];
              -
              821  i++;
              -
              822  }
              +
              796  for (int j = 0; j < ref_num_negative_pics; j++) {
              +
              797  int d_poc = ref_pic_sets[ref_rps_idx].delta_poc_s0[j] + delta_rps;
              +
              798  if (d_poc < 0 && use_delta[j]) {
              +
              799  out_ref_pic_set->delta_poc_s0[i] = d_poc;
              +
              800  out_ref_pic_set->used_by_curr_pic_s0[i] = used_by_curr_pic[j];
              +
              801  i++;
              +
              802  }
              +
              803  }
              +
              804  out_ref_pic_set->num_negative_pics = i;
              +
              805  }
              +
              806 
              +
              807  // Update list 1.
              +
              808  {
              +
              809  i = 0;
              +
              810  for (int j = ref_num_negative_pics - 1; j >= 0; j--) {
              +
              811  int d_poc = ref_pic_sets[ref_rps_idx].delta_poc_s0[j] + delta_rps;
              +
              812  if (d_poc > 0 && use_delta[j]) {
              +
              813  out_ref_pic_set->delta_poc_s1[i] = d_poc;
              +
              814  out_ref_pic_set->used_by_curr_pic_s1[i] = used_by_curr_pic[j];
              +
              815  i++;
              +
              816  }
              +
              817  }
              +
              818  if (delta_rps > 0 && use_delta[ref_num_delta_pocs]) {
              +
              819  out_ref_pic_set->delta_poc_s1[i] = delta_rps;
              +
              820  out_ref_pic_set->used_by_curr_pic_s1[i] =
              +
              821  used_by_curr_pic[ref_num_delta_pocs];
              +
              822  i++;
              823  }
              -
              824  if (delta_rps > 0 && use_delta[ref_num_delta_pocs]) {
              -
              825  out_ref_pic_set->delta_poc_s1[i] = delta_rps;
              -
              826  out_ref_pic_set->used_by_curr_pic_s1[i] =
              -
              827  used_by_curr_pic[ref_num_delta_pocs];
              -
              828  i++;
              -
              829  }
              -
              830  for (int j = 0; j < ref_num_positive_pics; j++) {
              -
              831  int d_poc = ref_pic_sets[ref_rps_idx].delta_poc_s1[j] + delta_rps;
              -
              832  if (d_poc > 0 && use_delta[ref_num_negative_pics + j]) {
              -
              833  out_ref_pic_set->delta_poc_s1[i] = d_poc;
              -
              834  out_ref_pic_set->used_by_curr_pic_s1[i] =
              -
              835  used_by_curr_pic[ref_num_negative_pics + j];
              -
              836  i++;
              -
              837  }
              -
              838  }
              -
              839  out_ref_pic_set->num_positive_pics = i;
              -
              840  }
              -
              841  } else {
              -
              842  TRUE_OR_RETURN(br->ReadUE(&out_ref_pic_set->num_negative_pics));
              -
              843  TRUE_OR_RETURN(br->ReadUE(&out_ref_pic_set->num_positive_pics));
              -
              844 
              -
              845  int prev_poc = 0;
              -
              846  for (int i = 0; i < out_ref_pic_set->num_negative_pics; i++) {
              -
              847  int delta_poc_s0_minus1;
              -
              848  TRUE_OR_RETURN(br->ReadUE(&delta_poc_s0_minus1));
              -
              849  out_ref_pic_set->delta_poc_s0[i] = prev_poc - (delta_poc_s0_minus1 + 1);
              -
              850  prev_poc = out_ref_pic_set->delta_poc_s0[i];
              -
              851 
              -
              852  TRUE_OR_RETURN(br->ReadBool(&out_ref_pic_set->used_by_curr_pic_s0[i]));
              -
              853  }
              -
              854 
              -
              855  prev_poc = 0;
              -
              856  for (int i = 0; i < out_ref_pic_set->num_positive_pics; i++) {
              -
              857  int delta_poc_s1_minus1;
              -
              858  TRUE_OR_RETURN(br->ReadUE(&delta_poc_s1_minus1));
              -
              859  out_ref_pic_set->delta_poc_s1[i] = prev_poc + delta_poc_s1_minus1 + 1;
              -
              860  prev_poc = out_ref_pic_set->delta_poc_s1[i];
              -
              861 
              -
              862  TRUE_OR_RETURN(br->ReadBool(&out_ref_pic_set->used_by_curr_pic_s1[i]));
              -
              863  }
              -
              864  }
              -
              865 
              -
              866  out_ref_pic_set->num_delta_pocs =
              -
              867  out_ref_pic_set->num_positive_pics + out_ref_pic_set->num_negative_pics;
              -
              868  return kOk;
              -
              869 }
              -
              870 
              -
              871 H265Parser::Result H265Parser::SkipReferencePictureListModification(
              -
              872  const H265SliceHeader& slice_header,
              -
              873  const H265Pps& pps,
              -
              874  int num_pic_total_curr,
              -
              875  H26xBitReader* br) {
              -
              876  // Reads whole element but ignores it all.
              -
              877 
              -
              878  bool ref_pic_list_modification_flag_l0;
              -
              879  TRUE_OR_RETURN(br->ReadBool(&ref_pic_list_modification_flag_l0));
              -
              880  if (ref_pic_list_modification_flag_l0) {
              -
              881  for (int i = 0; i <= pps.num_ref_idx_l0_default_active_minus1; i++) {
              -
              882  TRUE_OR_RETURN(br->SkipBits(ceil(log2(num_pic_total_curr))));
              -
              883  }
              -
              884  }
              -
              885 
              -
              886  if (slice_header.slice_type == kBSlice) {
              -
              887  bool ref_pic_list_modification_flag_l1;
              -
              888  TRUE_OR_RETURN(br->ReadBool(&ref_pic_list_modification_flag_l1));
              -
              889  if (ref_pic_list_modification_flag_l1) {
              -
              890  for (int i = 0; i <= pps.num_ref_idx_l1_default_active_minus1; i++) {
              -
              891  TRUE_OR_RETURN(br->SkipBits(ceil(log2(num_pic_total_curr))));
              -
              892  }
              -
              893  }
              -
              894  }
              -
              895 
              -
              896  return kOk;
              -
              897 }
              -
              898 
              -
              899 H265Parser::Result H265Parser::SkipPredictionWeightTablePart(
              -
              900  int num_ref_idx_minus1,
              -
              901  int chroma_array_type,
              -
              902  H26xBitReader* br) {
              -
              903  // Reads whole element, ignores it.
              -
              904  int ignored;
              -
              905  std::vector<bool> luma_weight_flag(num_ref_idx_minus1 + 1);
              -
              906  std::vector<bool> chroma_weight_flag(num_ref_idx_minus1 + 1);
              -
              907 
              -
              908  for (int i = 0; i <= num_ref_idx_minus1; i++) {
              -
              909  bool temp;
              -
              910  TRUE_OR_RETURN(br->ReadBool(&temp));
              -
              911  luma_weight_flag[i] = temp;
              -
              912  }
              -
              913  if (chroma_array_type != 0) {
              -
              914  for (int i = 0; i <= num_ref_idx_minus1; i++) {
              -
              915  bool temp;
              -
              916  TRUE_OR_RETURN(br->ReadBool(&temp));
              -
              917  chroma_weight_flag[i] = temp;
              +
              824  for (int j = 0; j < ref_num_positive_pics; j++) {
              +
              825  int d_poc = ref_pic_sets[ref_rps_idx].delta_poc_s1[j] + delta_rps;
              +
              826  if (d_poc > 0 && use_delta[ref_num_negative_pics + j]) {
              +
              827  out_ref_pic_set->delta_poc_s1[i] = d_poc;
              +
              828  out_ref_pic_set->used_by_curr_pic_s1[i] =
              +
              829  used_by_curr_pic[ref_num_negative_pics + j];
              +
              830  i++;
              +
              831  }
              +
              832  }
              +
              833  out_ref_pic_set->num_positive_pics = i;
              +
              834  }
              +
              835  } else {
              +
              836  TRUE_OR_RETURN(br->ReadUE(&out_ref_pic_set->num_negative_pics));
              +
              837  TRUE_OR_RETURN(br->ReadUE(&out_ref_pic_set->num_positive_pics));
              +
              838 
              +
              839  int prev_poc = 0;
              +
              840  for (int i = 0; i < out_ref_pic_set->num_negative_pics; i++) {
              +
              841  int delta_poc_s0_minus1;
              +
              842  TRUE_OR_RETURN(br->ReadUE(&delta_poc_s0_minus1));
              +
              843  out_ref_pic_set->delta_poc_s0[i] = prev_poc - (delta_poc_s0_minus1 + 1);
              +
              844  prev_poc = out_ref_pic_set->delta_poc_s0[i];
              +
              845 
              +
              846  TRUE_OR_RETURN(br->ReadBool(&out_ref_pic_set->used_by_curr_pic_s0[i]));
              +
              847  }
              +
              848 
              +
              849  prev_poc = 0;
              +
              850  for (int i = 0; i < out_ref_pic_set->num_positive_pics; i++) {
              +
              851  int delta_poc_s1_minus1;
              +
              852  TRUE_OR_RETURN(br->ReadUE(&delta_poc_s1_minus1));
              +
              853  out_ref_pic_set->delta_poc_s1[i] = prev_poc + delta_poc_s1_minus1 + 1;
              +
              854  prev_poc = out_ref_pic_set->delta_poc_s1[i];
              +
              855 
              +
              856  TRUE_OR_RETURN(br->ReadBool(&out_ref_pic_set->used_by_curr_pic_s1[i]));
              +
              857  }
              +
              858  }
              +
              859 
              +
              860  out_ref_pic_set->num_delta_pocs =
              +
              861  out_ref_pic_set->num_positive_pics + out_ref_pic_set->num_negative_pics;
              +
              862  return kOk;
              +
              863 }
              +
              864 
              +
              865 H265Parser::Result H265Parser::SkipReferencePictureListModification(
              +
              866  const H265SliceHeader& slice_header,
              +
              867  const H265Pps& pps,
              +
              868  int num_pic_total_curr,
              +
              869  H26xBitReader* br) {
              +
              870  // Reads whole element but ignores it all.
              +
              871 
              +
              872  bool ref_pic_list_modification_flag_l0;
              +
              873  TRUE_OR_RETURN(br->ReadBool(&ref_pic_list_modification_flag_l0));
              +
              874  if (ref_pic_list_modification_flag_l0) {
              +
              875  for (int i = 0; i <= pps.num_ref_idx_l0_default_active_minus1; i++) {
              +
              876  TRUE_OR_RETURN(br->SkipBits(ceil(log2(num_pic_total_curr))));
              +
              877  }
              +
              878  }
              +
              879 
              +
              880  if (slice_header.slice_type == kBSlice) {
              +
              881  bool ref_pic_list_modification_flag_l1;
              +
              882  TRUE_OR_RETURN(br->ReadBool(&ref_pic_list_modification_flag_l1));
              +
              883  if (ref_pic_list_modification_flag_l1) {
              +
              884  for (int i = 0; i <= pps.num_ref_idx_l1_default_active_minus1; i++) {
              +
              885  TRUE_OR_RETURN(br->SkipBits(ceil(log2(num_pic_total_curr))));
              +
              886  }
              +
              887  }
              +
              888  }
              +
              889 
              +
              890  return kOk;
              +
              891 }
              +
              892 
              +
              893 H265Parser::Result H265Parser::SkipPredictionWeightTablePart(
              +
              894  int num_ref_idx_minus1,
              +
              895  int chroma_array_type,
              +
              896  H26xBitReader* br) {
              +
              897  // Reads whole element, ignores it.
              +
              898  int ignored;
              +
              899  std::vector<bool> luma_weight_flag(num_ref_idx_minus1 + 1);
              +
              900  std::vector<bool> chroma_weight_flag(num_ref_idx_minus1 + 1);
              +
              901 
              +
              902  for (int i = 0; i <= num_ref_idx_minus1; i++) {
              +
              903  bool temp;
              +
              904  TRUE_OR_RETURN(br->ReadBool(&temp));
              +
              905  luma_weight_flag[i] = temp;
              +
              906  }
              +
              907  if (chroma_array_type != 0) {
              +
              908  for (int i = 0; i <= num_ref_idx_minus1; i++) {
              +
              909  bool temp;
              +
              910  TRUE_OR_RETURN(br->ReadBool(&temp));
              +
              911  chroma_weight_flag[i] = temp;
              +
              912  }
              +
              913  }
              +
              914  for (int i = 0; i <= num_ref_idx_minus1; i++) {
              +
              915  if (luma_weight_flag[i]) {
              +
              916  TRUE_OR_RETURN(br->ReadSE(&ignored)); // delta_luma_weight_l#
              +
              917  TRUE_OR_RETURN(br->ReadSE(&ignored)); // luma_offset_l#
              918  }
              -
              919  }
              -
              920  for (int i = 0; i <= num_ref_idx_minus1; i++) {
              -
              921  if (luma_weight_flag[i]) {
              -
              922  TRUE_OR_RETURN(br->ReadSE(&ignored)); // delta_luma_weight_l#
              -
              923  TRUE_OR_RETURN(br->ReadSE(&ignored)); // luma_offset_l#
              +
              919  if (chroma_weight_flag[i]) {
              +
              920  for (int j = 0; j < 2; j++) {
              +
              921  TRUE_OR_RETURN(br->ReadSE(&ignored)); // delta_chroma_weight_l#
              +
              922  TRUE_OR_RETURN(br->ReadSE(&ignored)); // delta_chroma_offset_l#
              +
              923  }
              924  }
              -
              925  if (chroma_weight_flag[i]) {
              -
              926  for (int j = 0; j < 2; j++) {
              -
              927  TRUE_OR_RETURN(br->ReadSE(&ignored)); // delta_chroma_weight_l#
              -
              928  TRUE_OR_RETURN(br->ReadSE(&ignored)); // delta_chroma_offset_l#
              -
              929  }
              -
              930  }
              -
              931  }
              -
              932 
              -
              933  return kOk;
              -
              934 }
              -
              935 
              -
              936 H265Parser::Result H265Parser::SkipPredictionWeightTable(
              -
              937  bool is_b_slice,
              -
              938  const H265Sps& sps,
              -
              939  const H265SliceHeader& slice_header,
              -
              940  H26xBitReader* br) {
              -
              941  // Reads whole element, ignores it.
              -
              942  int ignored;
              -
              943  int chroma_array_type = sps.GetChromaArrayType();
              -
              944 
              -
              945  TRUE_OR_RETURN(br->ReadUE(&ignored)); // luma_log2_weight_denom
              -
              946  if (chroma_array_type != 0) {
              -
              947  TRUE_OR_RETURN(br->ReadSE(&ignored)); // delta_chroma_log2_weight_denom
              +
              925  }
              +
              926 
              +
              927  return kOk;
              +
              928 }
              +
              929 
              +
              930 H265Parser::Result H265Parser::SkipPredictionWeightTable(
              +
              931  bool is_b_slice,
              +
              932  const H265Sps& sps,
              +
              933  const H265SliceHeader& slice_header,
              +
              934  H26xBitReader* br) {
              +
              935  // Reads whole element, ignores it.
              +
              936  int ignored;
              +
              937  int chroma_array_type = sps.GetChromaArrayType();
              +
              938 
              +
              939  TRUE_OR_RETURN(br->ReadUE(&ignored)); // luma_log2_weight_denom
              +
              940  if (chroma_array_type != 0) {
              +
              941  TRUE_OR_RETURN(br->ReadSE(&ignored)); // delta_chroma_log2_weight_denom
              +
              942  }
              +
              943  OK_OR_RETURN(SkipPredictionWeightTablePart(
              +
              944  slice_header.num_ref_idx_l0_active_minus1, chroma_array_type, br));
              +
              945  if (is_b_slice) {
              +
              946  OK_OR_RETURN(SkipPredictionWeightTablePart(
              +
              947  slice_header.num_ref_idx_l1_active_minus1, chroma_array_type, br));
              948  }
              -
              949  OK_OR_RETURN(SkipPredictionWeightTablePart(
              -
              950  slice_header.num_ref_idx_l0_active_minus1, chroma_array_type, br));
              -
              951  if (is_b_slice) {
              -
              952  OK_OR_RETURN(SkipPredictionWeightTablePart(
              -
              953  slice_header.num_ref_idx_l1_active_minus1, chroma_array_type, br));
              -
              954  }
              -
              955 
              -
              956  return kOk;
              -
              957 }
              +
              949 
              +
              950  return kOk;
              +
              951 }
              +
              952 
              +
              953 H265Parser::Result H265Parser::SkipProfileTierLevel(
              +
              954  bool profile_present,
              +
              955  int max_num_sub_layers_minus1,
              +
              956  H26xBitReader* br) {
              +
              957  // Reads whole element, ignores it.
              958 
              -
              959 H265Parser::Result H265Parser::SkipProfileTierLevel(
              -
              960  bool profile_present,
              -
              961  int max_num_sub_layers_minus1,
              -
              962  H26xBitReader* br) {
              -
              963  // Reads whole element, ignores it.
              -
              964 
              -
              965  if (profile_present) {
              -
              966  // general_profile_space, general_tier_flag, general_profile_idc
              -
              967  // general_profile_compativility_flag
              -
              968  // general_progressive_source_flag
              -
              969  // general_interlaced_source_flag
              -
              970  // general_non_packed_constraint_flag
              -
              971  // general_frame_only_constraint_flag
              -
              972  // 44-bits of other flags
              -
              973  TRUE_OR_RETURN(br->SkipBits(2 + 1 + 5 + 32 + 4 + 44));
              -
              974  }
              -
              975 
              -
              976  TRUE_OR_RETURN(br->SkipBits(8)); // general_level_idc
              -
              977 
              -
              978  std::vector<bool> sub_layer_profile_present(max_num_sub_layers_minus1);
              -
              979  std::vector<bool> sub_layer_level_present(max_num_sub_layers_minus1);
              -
              980  for (int i = 0; i < max_num_sub_layers_minus1; i++) {
              -
              981  bool profile, level;
              -
              982  TRUE_OR_RETURN(br->ReadBool(&profile));
              -
              983  TRUE_OR_RETURN(br->ReadBool(&level));
              -
              984  sub_layer_profile_present[i] = profile;
              -
              985  sub_layer_level_present[i] = level;
              -
              986  }
              -
              987 
              -
              988  if (max_num_sub_layers_minus1 > 0) {
              -
              989  for (int i = max_num_sub_layers_minus1; i < 8; i++)
              -
              990  TRUE_OR_RETURN(br->SkipBits(2)); // reserved_zero_2bits
              -
              991  }
              -
              992 
              -
              993  for (int i = 0; i < max_num_sub_layers_minus1; i++) {
              -
              994  if (sub_layer_profile_present[i]) {
              -
              995  // sub_layer_profile_space, sub_layer_tier_flag, sub_layer_profile_idc
              -
              996  // sub_layer_profile_compatibility
              -
              997  // sub_layer_reserved_zero_43bits
              -
              998  // sub_layer_reserved_zero_bit
              -
              999  TRUE_OR_RETURN(br->SkipBits(2 + 1 + 5 + 32 + 4 + 43 + 1));
              -
              1000  }
              -
              1001  if (sub_layer_level_present[i]) {
              -
              1002  TRUE_OR_RETURN(br->SkipBits(8));
              -
              1003  }
              -
              1004  }
              -
              1005 
              -
              1006  return kOk;
              -
              1007 }
              -
              1008 
              -
              1009 H265Parser::Result H265Parser::SkipScalingListData(H26xBitReader* br) {
              -
              1010  // Reads whole element, ignores it.
              -
              1011  int ignored;
              -
              1012  for (int size_id = 0; size_id < 4; size_id++) {
              -
              1013  for (int matrix_id = 0; matrix_id < 6;
              -
              1014  matrix_id += ((size_id == 3) ? 3 : 1)) {
              -
              1015  bool scaling_list_pred_mode;
              -
              1016  TRUE_OR_RETURN(br->ReadBool(&scaling_list_pred_mode));
              -
              1017  if (!scaling_list_pred_mode) {
              -
              1018  // scaling_list_pred_matrix_id_delta
              -
              1019  TRUE_OR_RETURN(br->ReadUE(&ignored));
              -
              1020  } else {
              -
              1021  int coefNum = std::min(64, (1 << (4 + (size_id << 1))));
              -
              1022  if (size_id > 1) {
              -
              1023  TRUE_OR_RETURN(br->ReadSE(&ignored)); // scaling_list_dc_coef_minus8
              -
              1024  }
              -
              1025 
              -
              1026  for (int i = 0; i < coefNum; i++) {
              -
              1027  TRUE_OR_RETURN(br->ReadSE(&ignored)); // scaling_list_delta_coef
              -
              1028  }
              -
              1029  }
              -
              1030  }
              -
              1031  }
              -
              1032 
              -
              1033  return kOk;
              -
              1034 }
              -
              1035 
              -
              1036 H265Parser::Result H265Parser::SkipHrdParameters(int max_num_sub_layers_minus1,
              -
              1037  H26xBitReader* br) {
              -
              1038  // common_inf_present_flag is always 1 when parsing vui_parameters.
              -
              1039  const bool common_inf_present_flag = true;
              -
              1040 
              -
              1041  int ignored;
              -
              1042  bool nal_hdr_parameters_present_flag;
              -
              1043  bool vcl_hdr_parameters_present_flag;
              -
              1044  bool sub_pic_hdr_params_present_flag = false;
              -
              1045  if (common_inf_present_flag) {
              -
              1046  TRUE_OR_RETURN(br->ReadBool(&nal_hdr_parameters_present_flag));
              -
              1047  TRUE_OR_RETURN(br->ReadBool(&vcl_hdr_parameters_present_flag));
              -
              1048  if (nal_hdr_parameters_present_flag || vcl_hdr_parameters_present_flag) {
              -
              1049  TRUE_OR_RETURN(br->ReadBool(&sub_pic_hdr_params_present_flag));
              -
              1050  if (sub_pic_hdr_params_present_flag) {
              -
              1051  // tick_divisor_minus2, du_cpb_removal_delay_increment_length_minus1,
              -
              1052  // sub_pic_cpb_params_in_pic_timing_sei_flag
              -
              1053  // dpb_output_delay_du_length_minus1
              -
              1054  TRUE_OR_RETURN(br->SkipBits(8 + 5 + 1 + 5));
              -
              1055  }
              -
              1056 
              -
              1057  // bit_rate_scale, cpb_size_scale
              -
              1058  TRUE_OR_RETURN(br->SkipBits(4 + 4));
              -
              1059  if (sub_pic_hdr_params_present_flag)
              -
              1060  TRUE_OR_RETURN(br->SkipBits(4)); // cpb_size_du_scale
              +
              959  if (profile_present) {
              +
              960  // general_profile_space, general_tier_flag, general_profile_idc
              +
              961  // general_profile_compativility_flag
              +
              962  // general_progressive_source_flag
              +
              963  // general_interlaced_source_flag
              +
              964  // general_non_packed_constraint_flag
              +
              965  // general_frame_only_constraint_flag
              +
              966  // 44-bits of other flags
              +
              967  TRUE_OR_RETURN(br->SkipBits(2 + 1 + 5 + 32 + 4 + 44));
              +
              968  }
              +
              969 
              +
              970  TRUE_OR_RETURN(br->SkipBits(8)); // general_level_idc
              +
              971 
              +
              972  std::vector<bool> sub_layer_profile_present(max_num_sub_layers_minus1);
              +
              973  std::vector<bool> sub_layer_level_present(max_num_sub_layers_minus1);
              +
              974  for (int i = 0; i < max_num_sub_layers_minus1; i++) {
              +
              975  bool profile, level;
              +
              976  TRUE_OR_RETURN(br->ReadBool(&profile));
              +
              977  TRUE_OR_RETURN(br->ReadBool(&level));
              +
              978  sub_layer_profile_present[i] = profile;
              +
              979  sub_layer_level_present[i] = level;
              +
              980  }
              +
              981 
              +
              982  if (max_num_sub_layers_minus1 > 0) {
              +
              983  for (int i = max_num_sub_layers_minus1; i < 8; i++)
              +
              984  TRUE_OR_RETURN(br->SkipBits(2)); // reserved_zero_2bits
              +
              985  }
              +
              986 
              +
              987  for (int i = 0; i < max_num_sub_layers_minus1; i++) {
              +
              988  if (sub_layer_profile_present[i]) {
              +
              989  // sub_layer_profile_space, sub_layer_tier_flag, sub_layer_profile_idc
              +
              990  // sub_layer_profile_compatibility
              +
              991  // sub_layer_reserved_zero_43bits
              +
              992  // sub_layer_reserved_zero_bit
              +
              993  TRUE_OR_RETURN(br->SkipBits(2 + 1 + 5 + 32 + 4 + 43 + 1));
              +
              994  }
              +
              995  if (sub_layer_level_present[i]) {
              +
              996  TRUE_OR_RETURN(br->SkipBits(8));
              +
              997  }
              +
              998  }
              +
              999 
              +
              1000  return kOk;
              +
              1001 }
              +
              1002 
              +
              1003 H265Parser::Result H265Parser::SkipScalingListData(H26xBitReader* br) {
              +
              1004  // Reads whole element, ignores it.
              +
              1005  int ignored;
              +
              1006  for (int size_id = 0; size_id < 4; size_id++) {
              +
              1007  for (int matrix_id = 0; matrix_id < 6;
              +
              1008  matrix_id += ((size_id == 3) ? 3 : 1)) {
              +
              1009  bool scaling_list_pred_mode;
              +
              1010  TRUE_OR_RETURN(br->ReadBool(&scaling_list_pred_mode));
              +
              1011  if (!scaling_list_pred_mode) {
              +
              1012  // scaling_list_pred_matrix_id_delta
              +
              1013  TRUE_OR_RETURN(br->ReadUE(&ignored));
              +
              1014  } else {
              +
              1015  int coefNum = std::min(64, (1 << (4 + (size_id << 1))));
              +
              1016  if (size_id > 1) {
              +
              1017  TRUE_OR_RETURN(br->ReadSE(&ignored)); // scaling_list_dc_coef_minus8
              +
              1018  }
              +
              1019 
              +
              1020  for (int i = 0; i < coefNum; i++) {
              +
              1021  TRUE_OR_RETURN(br->ReadSE(&ignored)); // scaling_list_delta_coef
              +
              1022  }
              +
              1023  }
              +
              1024  }
              +
              1025  }
              +
              1026 
              +
              1027  return kOk;
              +
              1028 }
              +
              1029 
              +
              1030 H265Parser::Result H265Parser::SkipHrdParameters(int max_num_sub_layers_minus1,
              +
              1031  H26xBitReader* br) {
              +
              1032  // common_inf_present_flag is always 1 when parsing vui_parameters.
              +
              1033  const bool common_inf_present_flag = true;
              +
              1034 
              +
              1035  int ignored;
              +
              1036  bool nal_hdr_parameters_present_flag;
              +
              1037  bool vcl_hdr_parameters_present_flag;
              +
              1038  bool sub_pic_hdr_params_present_flag = false;
              +
              1039  if (common_inf_present_flag) {
              +
              1040  TRUE_OR_RETURN(br->ReadBool(&nal_hdr_parameters_present_flag));
              +
              1041  TRUE_OR_RETURN(br->ReadBool(&vcl_hdr_parameters_present_flag));
              +
              1042  if (nal_hdr_parameters_present_flag || vcl_hdr_parameters_present_flag) {
              +
              1043  TRUE_OR_RETURN(br->ReadBool(&sub_pic_hdr_params_present_flag));
              +
              1044  if (sub_pic_hdr_params_present_flag) {
              +
              1045  // tick_divisor_minus2, du_cpb_removal_delay_increment_length_minus1,
              +
              1046  // sub_pic_cpb_params_in_pic_timing_sei_flag
              +
              1047  // dpb_output_delay_du_length_minus1
              +
              1048  TRUE_OR_RETURN(br->SkipBits(8 + 5 + 1 + 5));
              +
              1049  }
              +
              1050 
              +
              1051  // bit_rate_scale, cpb_size_scale
              +
              1052  TRUE_OR_RETURN(br->SkipBits(4 + 4));
              +
              1053  if (sub_pic_hdr_params_present_flag)
              +
              1054  TRUE_OR_RETURN(br->SkipBits(4)); // cpb_size_du_scale
              +
              1055 
              +
              1056  // initial_cpb_removal_delay_length_minus1,
              +
              1057  // au_cpb_removal_delay_length_minus1, dpb_output_delay_length_minus1
              +
              1058  TRUE_OR_RETURN(br->SkipBits(5 + 5 + 5));
              +
              1059  }
              +
              1060  }
              1061 
              -
              1062  // initial_cpb_removal_delay_length_minus1,
              -
              1063  // au_cpb_removal_delay_length_minus1, dpb_output_delay_length_minus1
              -
              1064  TRUE_OR_RETURN(br->SkipBits(5 + 5 + 5));
              -
              1065  }
              -
              1066  }
              -
              1067 
              -
              1068  for (int i = 0; i <= max_num_sub_layers_minus1; i++) {
              -
              1069  bool fixed_pic_rate_general_flag;
              -
              1070  bool fixed_pic_rate_within_cvs_flag = true;
              -
              1071  bool low_delay_hdr_flag = false;
              -
              1072  int cpb_cnt_minus1 = 0;
              -
              1073  TRUE_OR_RETURN(br->ReadBool(&fixed_pic_rate_general_flag));
              -
              1074  if (!fixed_pic_rate_general_flag)
              -
              1075  TRUE_OR_RETURN(br->ReadBool(&fixed_pic_rate_within_cvs_flag));
              -
              1076  if (fixed_pic_rate_within_cvs_flag)
              -
              1077  TRUE_OR_RETURN(br->ReadUE(&ignored)); // elemental_duration_ic_tc_minus1
              -
              1078  else
              -
              1079  TRUE_OR_RETURN(br->ReadBool(&low_delay_hdr_flag));
              -
              1080  if (!low_delay_hdr_flag)
              -
              1081  TRUE_OR_RETURN(br->ReadUE(&cpb_cnt_minus1));
              -
              1082 
              -
              1083  if (nal_hdr_parameters_present_flag) {
              -
              1084  OK_OR_RETURN(SkipSubLayerHrdParameters(
              -
              1085  cpb_cnt_minus1, sub_pic_hdr_params_present_flag, br));
              -
              1086  }
              -
              1087  if (vcl_hdr_parameters_present_flag) {
              -
              1088  OK_OR_RETURN(SkipSubLayerHrdParameters(
              -
              1089  cpb_cnt_minus1, sub_pic_hdr_params_present_flag, br));
              -
              1090  }
              -
              1091  }
              -
              1092 
              -
              1093  return kOk;
              -
              1094 }
              -
              1095 
              -
              1096 H265Parser::Result H265Parser::SkipSubLayerHrdParameters(
              -
              1097  int cpb_cnt_minus1,
              -
              1098  bool sub_pic_hdr_params_present_flag,
              -
              1099  H26xBitReader* br) {
              -
              1100  int ignored;
              -
              1101  for (int i = 0; i <= cpb_cnt_minus1; i++) {
              -
              1102  TRUE_OR_RETURN(br->ReadUE(&ignored)); // bit_rate_value_minus1
              -
              1103  TRUE_OR_RETURN(br->ReadUE(&ignored)); // cpb_size_value_minus1
              -
              1104  if (sub_pic_hdr_params_present_flag) {
              -
              1105  TRUE_OR_RETURN(br->ReadUE(&ignored)); // cpb_size_du_value_minus1
              -
              1106  TRUE_OR_RETURN(br->ReadUE(&ignored)); // bit_rate_du_value_minus1
              -
              1107  }
              +
              1062  for (int i = 0; i <= max_num_sub_layers_minus1; i++) {
              +
              1063  bool fixed_pic_rate_general_flag;
              +
              1064  bool fixed_pic_rate_within_cvs_flag = true;
              +
              1065  bool low_delay_hdr_flag = false;
              +
              1066  int cpb_cnt_minus1 = 0;
              +
              1067  TRUE_OR_RETURN(br->ReadBool(&fixed_pic_rate_general_flag));
              +
              1068  if (!fixed_pic_rate_general_flag)
              +
              1069  TRUE_OR_RETURN(br->ReadBool(&fixed_pic_rate_within_cvs_flag));
              +
              1070  if (fixed_pic_rate_within_cvs_flag)
              +
              1071  TRUE_OR_RETURN(br->ReadUE(&ignored)); // elemental_duration_ic_tc_minus1
              +
              1072  else
              +
              1073  TRUE_OR_RETURN(br->ReadBool(&low_delay_hdr_flag));
              +
              1074  if (!low_delay_hdr_flag)
              +
              1075  TRUE_OR_RETURN(br->ReadUE(&cpb_cnt_minus1));
              +
              1076 
              +
              1077  if (nal_hdr_parameters_present_flag) {
              +
              1078  OK_OR_RETURN(SkipSubLayerHrdParameters(
              +
              1079  cpb_cnt_minus1, sub_pic_hdr_params_present_flag, br));
              +
              1080  }
              +
              1081  if (vcl_hdr_parameters_present_flag) {
              +
              1082  OK_OR_RETURN(SkipSubLayerHrdParameters(
              +
              1083  cpb_cnt_minus1, sub_pic_hdr_params_present_flag, br));
              +
              1084  }
              +
              1085  }
              +
              1086 
              +
              1087  return kOk;
              +
              1088 }
              +
              1089 
              +
              1090 H265Parser::Result H265Parser::SkipSubLayerHrdParameters(
              +
              1091  int cpb_cnt_minus1,
              +
              1092  bool sub_pic_hdr_params_present_flag,
              +
              1093  H26xBitReader* br) {
              +
              1094  int ignored;
              +
              1095  for (int i = 0; i <= cpb_cnt_minus1; i++) {
              +
              1096  TRUE_OR_RETURN(br->ReadUE(&ignored)); // bit_rate_value_minus1
              +
              1097  TRUE_OR_RETURN(br->ReadUE(&ignored)); // cpb_size_value_minus1
              +
              1098  if (sub_pic_hdr_params_present_flag) {
              +
              1099  TRUE_OR_RETURN(br->ReadUE(&ignored)); // cpb_size_du_value_minus1
              +
              1100  TRUE_OR_RETURN(br->ReadUE(&ignored)); // bit_rate_du_value_minus1
              +
              1101  }
              +
              1102 
              +
              1103  TRUE_OR_RETURN(br->SkipBits(1)); // cbr_flag
              +
              1104  }
              +
              1105 
              +
              1106  return kOk;
              +
              1107 }
              1108 
              -
              1109  TRUE_OR_RETURN(br->SkipBits(1)); // cbr_flag
              -
              1110  }
              -
              1111 
              -
              1112  return kOk;
              -
              1113 }
              -
              1114 
              -
              1115 } // namespace media
              -
              1116 } // namespace shaka
              +
              1109 } // namespace media
              +
              1110 } // namespace shaka
              uint64_t payload_size() const
              Size of this Nalu minus header_size().
              Definition: nalu_reader.h:101
              -
              Result ParseSliceHeader(const Nalu &nalu, H265SliceHeader *slice_header)
              Definition: h265_parser.cc:187
              +
              Result ParseSliceHeader(const Nalu &nalu, H265SliceHeader *slice_header)
              Definition: h265_parser.cc:183
              -
              Result ParsePps(const Nalu &nalu, int *pps_id)
              Definition: h265_parser.cc:404
              +
              Result ParsePps(const Nalu &nalu, int *pps_id)
              Definition: h265_parser.cc:400
              int type() const
              Definition: nalu_reader.h:112
              uint64_t header_size() const
              The size of the header, e.g. 1 for H.264.
              Definition: nalu_reader.h:99
              -
              const H265Sps * GetSps(int sps_id)
              Definition: h265_parser.cc:634
              -
              const H265Pps * GetPps(int pps_id)
              Definition: h265_parser.cc:630
              +
              const H265Sps * GetSps(int sps_id)
              Definition: h265_parser.cc:628
              +
              const H265Pps * GetPps(int pps_id)
              Definition: h265_parser.cc:624
              -
              Result ParseSps(const Nalu &nalu, int *sps_id)
              Definition: h265_parser.cc:513
              +
              Result ParseSps(const Nalu &nalu, int *sps_id)
              Definition: h265_parser.cc:508
              const uint8_t * data() const
              This is the pointer to the Nalu data, pointing to the header.
              Definition: nalu_reader.h:96
              diff --git a/docs/db/dec/audio__timestamp__helper_8cc_source.html b/docs/db/dec/audio__timestamp__helper_8cc_source.html index 9f665daed0..e5ee91cfa7 100644 --- a/docs/db/dec/audio__timestamp__helper_8cc_source.html +++ b/docs/db/dec/audio__timestamp__helper_8cc_source.html @@ -165,7 +165,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/db/dee/pes__packet_8cc_source.html b/docs/db/dee/pes__packet_8cc_source.html index b2d1789ac0..500bf46e21 100644 --- a/docs/db/dee/pes__packet_8cc_source.html +++ b/docs/db/dee/pes__packet_8cc_source.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 9fcfa90271..069ea2bb9e 100644 --- a/docs/db/df2/structshaka_1_1media_1_1H265SliceHeader-members.html +++ b/docs/db/df2/structshaka_1_1media_1_1H265SliceHeader-members.html @@ -139,7 +139,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 749ae4865a..c58c21d235 100644 --- a/docs/db/df6/classshaka_1_1media_1_1Cluster-members.html +++ b/docs/db/df6/classshaka_1_1media_1_1Cluster-members.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/db/df6/muxer_8h_source.html b/docs/db/df6/muxer_8h_source.html index 00b3ee048b..764983dd1d 100644 --- a/docs/db/df6/muxer_8h_source.html +++ b/docs/db/df6/muxer_8h_source.html @@ -212,7 +212,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/db/df8/classshaka_1_1media_1_1H265ByteToUnitStreamConverter.html b/docs/db/df8/classshaka_1_1media_1_1H265ByteToUnitStreamConverter.html index fa63606ddb..00078e0684 100644 --- a/docs/db/df8/classshaka_1_1media_1_1H265ByteToUnitStreamConverter.html +++ b/docs/db/df8/classshaka_1_1media_1_1H265ByteToUnitStreamConverter.html @@ -171,7 +171,7 @@ static const size_t kUnitS diff --git a/docs/db/dfb/mpd__utils_8cc_source.html b/docs/db/dfb/mpd__utils_8cc_source.html index d2717aa068..d832ecfb68 100644 --- a/docs/db/dfb/mpd__utils_8cc_source.html +++ b/docs/db/dfb/mpd__utils_8cc_source.html @@ -437,14 +437,14 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              348 
              349 
              350 } // namespace shaka
              - +
              void AddContentProtectionElements(const MediaInfo &media_info, Representation *parent)
              Definition: mpd_utils.cc:339
              bool HexToUUID(const std::string &data, std::string *uuid_format)
              Definition: mpd_utils.cc:174
              - + 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 3adad95862..8f394a78c3 100644 --- a/docs/db/dfc/mpd__notify__muxer__listener_8cc_source.html +++ b/docs/db/dfc/mpd__notify__muxer__listener_8cc_source.html @@ -274,7 +274,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 d0b5117f98..d6ff233e99 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 @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dc/d02/classshaka_1_1media_1_1IoCache-members.html b/docs/dc/d02/classshaka_1_1media_1_1IoCache-members.html index 8ae8d90b23..65083f6c72 100644 --- a/docs/dc/d02/classshaka_1_1media_1_1IoCache-members.html +++ b/docs/dc/d02/classshaka_1_1media_1_1IoCache-members.html @@ -107,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 4a66275cf7..0005f26d8f 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 @@ -138,7 +138,7 @@ static const uint8_t kElem 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 ffd8fb4706..17194456ac 100644 --- a/docs/dc/d06/classshaka_1_1media_1_1StreamInfo-members.html +++ b/docs/dc/d06/classshaka_1_1media_1_1StreamInfo-members.html @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 7945f915f4..9ee942926a 100644 --- a/docs/dc/d0b/classshaka_1_1media_1_1ESDescriptor-members.html +++ b/docs/dc/d0b/classshaka_1_1media_1_1ESDescriptor-members.html @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dc/d16/classshaka_1_1media_1_1SeekHead.html b/docs/dc/d16/classshaka_1_1media_1_1SeekHead.html index 2a544f42a8..4741b2066b 100644 --- a/docs/dc/d16/classshaka_1_1media_1_1SeekHead.html +++ b/docs/dc/d16/classshaka_1_1media_1_1SeekHead.html @@ -148,7 +148,7 @@ void set_tracks_pos (u 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 4ce9e1a1bd..863ee05d6a 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 @@ -256,7 +256,7 @@ track_id, const scoped_refptr
              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 686b5d2862..6a6b7f699b 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 @@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dc/d19/box_8h_source.html b/docs/dc/d19/box_8h_source.html index 69e5348615..a9dc10f9ea 100644 --- a/docs/dc/d19/box_8h_source.html +++ b/docs/dc/d19/box_8h_source.html @@ -184,7 +184,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dc/d22/dash__iop__mpd__notifier_8cc_source.html b/docs/dc/d22/dash__iop__mpd__notifier_8cc_source.html index 5ace8a5a25..8e7c5758b3 100644 --- a/docs/dc/d22/dash__iop__mpd__notifier_8cc_source.html +++ b/docs/dc/d22/dash__iop__mpd__notifier_8cc_source.html @@ -95,306 +95,307 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              6 
              7 #include "packager/mpd/base/dash_iop_mpd_notifier.h"
              8 
              -
              9 #include "packager/mpd/base/media_info.pb.h"
              -
              10 #include "packager/mpd/base/mpd_notifier_util.h"
              -
              11 #include "packager/mpd/base/mpd_utils.h"
              -
              12 
              -
              13 namespace shaka {
              -
              14 
              -
              15 namespace {
              -
              16 
              -
              17 const int kStartingGroupId = 1;
              -
              18 
              -
              19 // The easiest way to check whether two protobufs are equal, is to compare the
              -
              20 // serialized version.
              -
              21 bool ProtectedContentEq(
              -
              22  const MediaInfo::ProtectedContent& content_protection1,
              -
              23  const MediaInfo::ProtectedContent& content_protection2) {
              -
              24  return content_protection1.SerializeAsString() ==
              -
              25  content_protection2.SerializeAsString();
              -
              26 }
              -
              27 
              -
              28 std::set<std::string> GetUUIDs(
              -
              29  const MediaInfo::ProtectedContent& protected_content) {
              -
              30  std::set<std::string> uuids;
              -
              31  for (int i = 0; i < protected_content.content_protection_entry().size();
              -
              32  ++i) {
              -
              33  const MediaInfo::ProtectedContent::ContentProtectionEntry& entry =
              -
              34  protected_content.content_protection_entry(i);
              -
              35  uuids.insert(entry.uuid());
              -
              36  }
              -
              37  return uuids;
              -
              38 }
              -
              39 
              -
              40 } // namespace
              -
              41 
              -
              42 DashIopMpdNotifier::DashIopMpdNotifier(
              -
              43  DashProfile dash_profile,
              -
              44  const MpdOptions& mpd_options,
              -
              45  const std::vector<std::string>& base_urls,
              -
              46  const std::string& output_path)
              -
              47  : MpdNotifier(dash_profile),
              -
              48  output_path_(output_path),
              -
              49  mpd_builder_(new MpdBuilder(dash_profile == kLiveProfile
              -
              50  ? MpdBuilder::kDynamic
              -
              51  : MpdBuilder::kStatic,
              -
              52  mpd_options)),
              -
              53  next_group_id_(kStartingGroupId) {
              -
              54  DCHECK(dash_profile == kLiveProfile || dash_profile == kOnDemandProfile);
              -
              55  for (size_t i = 0; i < base_urls.size(); ++i)
              -
              56  mpd_builder_->AddBaseUrl(base_urls[i]);
              -
              57 }
              -
              58 
              -
              59 DashIopMpdNotifier::~DashIopMpdNotifier() {}
              -
              60 
              - -
              62  return true;
              -
              63 }
              -
              64 
              -
              65 bool DashIopMpdNotifier::NotifyNewContainer(const MediaInfo& media_info,
              -
              66  uint32_t* container_id) {
              -
              67  DCHECK(container_id);
              -
              68 
              -
              69  ContentType content_type = GetContentType(media_info);
              -
              70  if (content_type == kContentTypeUnknown)
              -
              71  return false;
              -
              72 
              -
              73  base::AutoLock auto_lock(lock_);
              -
              74  const std::string key = GetAdaptationSetKey(media_info);
              -
              75  AdaptationSet* adaptation_set = GetAdaptationSetForMediaInfo(key, media_info);
              -
              76  DCHECK(adaptation_set);
              -
              77  if (media_info.has_text_info()) {
              -
              78  // IOP requires all AdaptationSets to have (sub)segmentAlignment set to
              -
              79  // true, so carelessly set it to true.
              -
              80  // In practice it doesn't really make sense to adapt between text tracks.
              -
              81  adaptation_set->ForceSetSegmentAlignment(true);
              -
              82  }
              -
              83 
              -
              84  MediaInfo adjusted_media_info(media_info);
              -
              85  MpdBuilder::MakePathsRelativeToMpd(output_path_, &adjusted_media_info);
              -
              86  Representation* representation =
              -
              87  adaptation_set->AddRepresentation(adjusted_media_info);
              -
              88  if (!representation)
              -
              89  return false;
              -
              90 
              -
              91  representation_id_to_adaptation_set_[representation->id()] = adaptation_set;
              -
              92 
              -
              93  SetGroupId(key, adaptation_set);
              -
              94 
              -
              95  *container_id = representation->id();
              -
              96  DCHECK(!ContainsKey(representation_map_, representation->id()));
              -
              97  representation_map_[representation->id()] = representation;
              -
              98  return true;
              -
              99 }
              -
              100 
              -
              101 bool DashIopMpdNotifier::NotifySampleDuration(uint32_t container_id,
              -
              102  uint32_t sample_duration) {
              -
              103  base::AutoLock auto_lock(lock_);
              -
              104  RepresentationMap::iterator it = representation_map_.find(container_id);
              -
              105  if (it == representation_map_.end()) {
              -
              106  LOG(ERROR) << "Unexpected container_id: " << container_id;
              -
              107  return false;
              -
              108  }
              -
              109  it->second->SetSampleDuration(sample_duration);
              -
              110  return true;
              -
              111 }
              -
              112 
              -
              113 bool DashIopMpdNotifier::NotifyNewSegment(uint32_t container_id,
              -
              114  uint64_t start_time,
              -
              115  uint64_t duration,
              -
              116  uint64_t size) {
              -
              117  base::AutoLock auto_lock(lock_);
              -
              118  RepresentationMap::iterator it = representation_map_.find(container_id);
              -
              119  if (it == representation_map_.end()) {
              -
              120  LOG(ERROR) << "Unexpected container_id: " << container_id;
              -
              121  return false;
              -
              122  }
              -
              123  it->second->AddNewSegment(start_time, duration, size);
              -
              124  return true;
              -
              125 }
              -
              126 
              - -
              128  uint32_t container_id,
              -
              129  const std::string& drm_uuid,
              -
              130  const std::vector<uint8_t>& new_key_id,
              -
              131  const std::vector<uint8_t>& new_pssh) {
              -
              132  base::AutoLock auto_lock(lock_);
              -
              133  RepresentationMap::iterator it = representation_map_.find(container_id);
              -
              134  if (it == representation_map_.end()) {
              -
              135  LOG(ERROR) << "Unexpected container_id: " << container_id;
              -
              136  return false;
              -
              137  }
              -
              138 
              -
              139  AdaptationSet* adaptation_set_for_representation =
              -
              140  representation_id_to_adaptation_set_[it->second->id()];
              -
              141  adaptation_set_for_representation->UpdateContentProtectionPssh(
              -
              142  drm_uuid, Uint8VectorToBase64(new_pssh));
              -
              143  return true;
              -
              144 }
              -
              145 
              - -
              147  uint32_t container_id,
              -
              148  const ContentProtectionElement& content_protection_element) {
              -
              149  // Intentionally not implemented because if a Representation gets a new
              -
              150  // <ContentProtection> element, then it might require moving the
              -
              151  // Representation out of the AdaptationSet. There's no logic to do that
              -
              152  // yet.
              -
              153  return false;
              -
              154 }
              -
              155 
              - -
              157  base::AutoLock auto_lock(lock_);
              -
              158  return WriteMpdToFile(output_path_, mpd_builder_.get());
              -
              159 }
              -
              160 
              -
              161 AdaptationSet* DashIopMpdNotifier::GetAdaptationSetForMediaInfo(
              -
              162  const std::string& key,
              -
              163  const MediaInfo& media_info) {
              -
              164  std::list<AdaptationSet*>& adaptation_sets = adaptation_set_list_map_[key];
              -
              165  if (adaptation_sets.empty())
              -
              166  return NewAdaptationSet(media_info, &adaptation_sets);
              -
              167 
              -
              168  const bool has_protected_content = media_info.has_protected_content();
              -
              169 
              -
              170  for (std::list<AdaptationSet*>::const_iterator adaptation_set_it =
              -
              171  adaptation_sets.begin();
              -
              172  adaptation_set_it != adaptation_sets.end(); ++adaptation_set_it) {
              -
              173  ProtectedContentMap::const_iterator protected_content_it =
              -
              174  protected_content_map_.find((*adaptation_set_it)->id());
              -
              175 
              -
              176  // If the AdaptationSet ID is not registered in the map, then it is clear
              -
              177  // content (or encrypted but doesn't need <ContentProtection> element
              -
              178  // possibly because the player knows how to handle it).
              -
              179  if (protected_content_it == protected_content_map_.end()) {
              -
              180  // Can reuse the AdaptationSet without content protection.
              -
              181  if (!has_protected_content)
              -
              182  return *adaptation_set_it;
              -
              183  continue;
              -
              184  }
              -
              185 
              -
              186  if (ProtectedContentEq(protected_content_it->second,
              -
              187  media_info.protected_content())) {
              -
              188  // Content protection info matches. Reuse the AdaptationSet.
              -
              189  return *adaptation_set_it;
              -
              190  }
              -
              191  }
              -
              192 
              -
              193  // None of the adaptation sets match with the new content protection.
              -
              194  // Need a new one.
              -
              195  return NewAdaptationSet(media_info, &adaptation_sets);
              -
              196 }
              -
              197 
              -
              198 // Get all the UUIDs of the AdaptationSet. If another AdaptationSet has the
              -
              199 // same UUIDs then those should be groupable.
              -
              200 void DashIopMpdNotifier::SetGroupId(const std::string& key,
              -
              201  AdaptationSet* adaptation_set) {
              -
              202  if (adaptation_set->Group() >= 0) // @group already assigned.
              -
              203  return;
              -
              204 
              -
              205  ProtectedContentMap::const_iterator protected_content_it =
              -
              206  protected_content_map_.find(adaptation_set->id());
              -
              207  // Clear contents should be in one AdaptationSet, so no need to assign
              -
              208  // @group.
              -
              209  if (protected_content_it == protected_content_map_.end()) {
              -
              210  DVLOG(1) << "No content protection set for AdaptationSet@id="
              -
              211  << adaptation_set->id();
              -
              212  return;
              -
              213  }
              -
              214 
              -
              215  // Get all the UUIDs of the ContentProtections in AdaptationSet.
              -
              216  std::set<std::string> adaptation_set_uuids =
              -
              217  GetUUIDs(protected_content_it->second);
              -
              218 
              -
              219  std::list<AdaptationSet*>& same_type_adapatation_sets =
              -
              220  adaptation_set_list_map_[key];
              -
              221  DCHECK(!same_type_adapatation_sets.empty())
              -
              222  << "same_type_adapatation_sets should not be null, it should at least "
              -
              223  "contain adaptation_set";
              -
              224 
              -
              225  for (std::list<AdaptationSet*>::iterator adaptation_set_it =
              -
              226  same_type_adapatation_sets.begin();
              -
              227  adaptation_set_it != same_type_adapatation_sets.end();
              -
              228  ++adaptation_set_it) {
              -
              229  const uint32_t loop_adaptation_set_id = (*adaptation_set_it)->id();
              -
              230  if (loop_adaptation_set_id == adaptation_set->id() ||
              -
              231  !ContainsKey(protected_content_map_, loop_adaptation_set_id)) {
              -
              232  continue;
              -
              233  }
              -
              234 
              -
              235  const MediaInfo::ProtectedContent& loop_protected_content =
              -
              236  protected_content_map_[loop_adaptation_set_id];
              -
              237  if (static_cast<int>(adaptation_set_uuids.size()) !=
              -
              238  loop_protected_content.content_protection_entry().size()) {
              -
              239  // Different number of UUIDs, cannot be grouped.
              -
              240  continue;
              -
              241  }
              -
              242 
              -
              243  if (adaptation_set_uuids == GetUUIDs(loop_protected_content)) {
              -
              244  AdaptationSet& uuid_match_adaptation_set = **adaptation_set_it;
              -
              245  // They match. These AdaptationSets can be in the same group. Break out.
              -
              246  if (uuid_match_adaptation_set.Group() >= 0) {
              -
              247  adaptation_set->SetGroup(uuid_match_adaptation_set.Group());
              -
              248  } else {
              -
              249  const int group_id = next_group_id_++;
              -
              250  uuid_match_adaptation_set.SetGroup(group_id);
              -
              251  adaptation_set->SetGroup(group_id);
              -
              252  }
              -
              253  break;
              -
              254  }
              -
              255  }
              -
              256 }
              -
              257 
              -
              258 AdaptationSet* DashIopMpdNotifier::NewAdaptationSet(
              -
              259  const MediaInfo& media_info,
              -
              260  std::list<AdaptationSet*>* adaptation_sets) {
              -
              261  std::string language = GetLanguage(media_info);
              -
              262  AdaptationSet* new_adaptation_set = mpd_builder_->AddAdaptationSet(language);
              -
              263  if (media_info.has_protected_content()) {
              -
              264  DCHECK(!ContainsKey(protected_content_map_, new_adaptation_set->id()));
              -
              265  protected_content_map_[new_adaptation_set->id()] =
              -
              266  media_info.protected_content();
              -
              267  AddContentProtectionElements(media_info, new_adaptation_set);
              -
              268  }
              -
              269  adaptation_sets->push_back(new_adaptation_set);
              -
              270 
              -
              271  if (media_info.has_video_info()) {
              -
              272  // Because 'lang' is ignored for videos, |adaptation_sets| must have
              -
              273  // all the video AdaptationSets.
              -
              274  if (adaptation_sets->size() > 2) {
              -
              275  new_adaptation_set->AddRole(AdaptationSet::kRoleMain);
              -
              276  } else if (adaptation_sets->size() == 2) {
              -
              277  // Set "main" Role for both AdaptatoinSets.
              -
              278  (*adaptation_sets->begin())->AddRole(AdaptationSet::kRoleMain);
              -
              279  new_adaptation_set->AddRole(AdaptationSet::kRoleMain);
              -
              280  }
              -
              281  }
              -
              282  return new_adaptation_set;
              -
              283 }
              -
              284 
              -
              285 } // namespace shaka
              - -
              bool NotifyNewSegment(uint32_t id, uint64_t start_time, uint64_t duration, uint64_t size) override
              -
              bool NotifyEncryptionUpdate(uint32_t container_id, const std::string &drm_uuid, const std::vector< uint8_t > &new_key_id, const std::vector< uint8_t > &new_pssh) override
              - -
              virtual Representation * AddRepresentation(const MediaInfo &media_info)
              Definition: mpd_builder.cc:693
              -
              uint32_t id() const
              Definition: mpd_builder.h:503
              +
              9 #include "packager/base/stl_util.h"
              +
              10 #include "packager/mpd/base/media_info.pb.h"
              +
              11 #include "packager/mpd/base/mpd_notifier_util.h"
              +
              12 #include "packager/mpd/base/mpd_utils.h"
              +
              13 
              +
              14 namespace shaka {
              +
              15 
              +
              16 namespace {
              +
              17 
              +
              18 const int kStartingGroupId = 1;
              +
              19 
              +
              20 // The easiest way to check whether two protobufs are equal, is to compare the
              +
              21 // serialized version.
              +
              22 bool ProtectedContentEq(
              +
              23  const MediaInfo::ProtectedContent& content_protection1,
              +
              24  const MediaInfo::ProtectedContent& content_protection2) {
              +
              25  return content_protection1.SerializeAsString() ==
              +
              26  content_protection2.SerializeAsString();
              +
              27 }
              +
              28 
              +
              29 std::set<std::string> GetUUIDs(
              +
              30  const MediaInfo::ProtectedContent& protected_content) {
              +
              31  std::set<std::string> uuids;
              +
              32  for (int i = 0; i < protected_content.content_protection_entry().size();
              +
              33  ++i) {
              +
              34  const MediaInfo::ProtectedContent::ContentProtectionEntry& entry =
              +
              35  protected_content.content_protection_entry(i);
              +
              36  uuids.insert(entry.uuid());
              +
              37  }
              +
              38  return uuids;
              +
              39 }
              +
              40 
              +
              41 } // namespace
              +
              42 
              +
              43 DashIopMpdNotifier::DashIopMpdNotifier(
              +
              44  DashProfile dash_profile,
              +
              45  const MpdOptions& mpd_options,
              +
              46  const std::vector<std::string>& base_urls,
              +
              47  const std::string& output_path)
              +
              48  : MpdNotifier(dash_profile),
              +
              49  output_path_(output_path),
              +
              50  mpd_builder_(new MpdBuilder(dash_profile == kLiveProfile
              +
              51  ? MpdBuilder::kDynamic
              +
              52  : MpdBuilder::kStatic,
              +
              53  mpd_options)),
              +
              54  next_group_id_(kStartingGroupId) {
              +
              55  DCHECK(dash_profile == kLiveProfile || dash_profile == kOnDemandProfile);
              +
              56  for (size_t i = 0; i < base_urls.size(); ++i)
              +
              57  mpd_builder_->AddBaseUrl(base_urls[i]);
              +
              58 }
              +
              59 
              +
              60 DashIopMpdNotifier::~DashIopMpdNotifier() {}
              +
              61 
              + +
              63  return true;
              +
              64 }
              +
              65 
              +
              66 bool DashIopMpdNotifier::NotifyNewContainer(const MediaInfo& media_info,
              +
              67  uint32_t* container_id) {
              +
              68  DCHECK(container_id);
              +
              69 
              +
              70  ContentType content_type = GetContentType(media_info);
              +
              71  if (content_type == kContentTypeUnknown)
              +
              72  return false;
              +
              73 
              +
              74  base::AutoLock auto_lock(lock_);
              +
              75  const std::string key = GetAdaptationSetKey(media_info);
              +
              76  AdaptationSet* adaptation_set = GetAdaptationSetForMediaInfo(key, media_info);
              +
              77  DCHECK(adaptation_set);
              +
              78  if (media_info.has_text_info()) {
              +
              79  // IOP requires all AdaptationSets to have (sub)segmentAlignment set to
              +
              80  // true, so carelessly set it to true.
              +
              81  // In practice it doesn't really make sense to adapt between text tracks.
              +
              82  adaptation_set->ForceSetSegmentAlignment(true);
              +
              83  }
              +
              84 
              +
              85  MediaInfo adjusted_media_info(media_info);
              +
              86  MpdBuilder::MakePathsRelativeToMpd(output_path_, &adjusted_media_info);
              +
              87  Representation* representation =
              +
              88  adaptation_set->AddRepresentation(adjusted_media_info);
              +
              89  if (!representation)
              +
              90  return false;
              +
              91 
              +
              92  representation_id_to_adaptation_set_[representation->id()] = adaptation_set;
              +
              93 
              +
              94  SetGroupId(key, adaptation_set);
              +
              95 
              +
              96  *container_id = representation->id();
              +
              97  DCHECK(!ContainsKey(representation_map_, representation->id()));
              +
              98  representation_map_[representation->id()] = representation;
              +
              99  return true;
              +
              100 }
              +
              101 
              +
              102 bool DashIopMpdNotifier::NotifySampleDuration(uint32_t container_id,
              +
              103  uint32_t sample_duration) {
              +
              104  base::AutoLock auto_lock(lock_);
              +
              105  RepresentationMap::iterator it = representation_map_.find(container_id);
              +
              106  if (it == representation_map_.end()) {
              +
              107  LOG(ERROR) << "Unexpected container_id: " << container_id;
              +
              108  return false;
              +
              109  }
              +
              110  it->second->SetSampleDuration(sample_duration);
              +
              111  return true;
              +
              112 }
              +
              113 
              +
              114 bool DashIopMpdNotifier::NotifyNewSegment(uint32_t container_id,
              +
              115  uint64_t start_time,
              +
              116  uint64_t duration,
              +
              117  uint64_t size) {
              +
              118  base::AutoLock auto_lock(lock_);
              +
              119  RepresentationMap::iterator it = representation_map_.find(container_id);
              +
              120  if (it == representation_map_.end()) {
              +
              121  LOG(ERROR) << "Unexpected container_id: " << container_id;
              +
              122  return false;
              +
              123  }
              +
              124  it->second->AddNewSegment(start_time, duration, size);
              +
              125  return true;
              +
              126 }
              +
              127 
              + +
              129  uint32_t container_id,
              +
              130  const std::string& drm_uuid,
              +
              131  const std::vector<uint8_t>& new_key_id,
              +
              132  const std::vector<uint8_t>& new_pssh) {
              +
              133  base::AutoLock auto_lock(lock_);
              +
              134  RepresentationMap::iterator it = representation_map_.find(container_id);
              +
              135  if (it == representation_map_.end()) {
              +
              136  LOG(ERROR) << "Unexpected container_id: " << container_id;
              +
              137  return false;
              +
              138  }
              +
              139 
              +
              140  AdaptationSet* adaptation_set_for_representation =
              +
              141  representation_id_to_adaptation_set_[it->second->id()];
              +
              142  adaptation_set_for_representation->UpdateContentProtectionPssh(
              +
              143  drm_uuid, Uint8VectorToBase64(new_pssh));
              +
              144  return true;
              +
              145 }
              +
              146 
              + +
              148  uint32_t container_id,
              +
              149  const ContentProtectionElement& content_protection_element) {
              +
              150  // Intentionally not implemented because if a Representation gets a new
              +
              151  // <ContentProtection> element, then it might require moving the
              +
              152  // Representation out of the AdaptationSet. There's no logic to do that
              +
              153  // yet.
              +
              154  return false;
              +
              155 }
              +
              156 
              + +
              158  base::AutoLock auto_lock(lock_);
              +
              159  return WriteMpdToFile(output_path_, mpd_builder_.get());
              +
              160 }
              +
              161 
              +
              162 AdaptationSet* DashIopMpdNotifier::GetAdaptationSetForMediaInfo(
              +
              163  const std::string& key,
              +
              164  const MediaInfo& media_info) {
              +
              165  std::list<AdaptationSet*>& adaptation_sets = adaptation_set_list_map_[key];
              +
              166  if (adaptation_sets.empty())
              +
              167  return NewAdaptationSet(media_info, &adaptation_sets);
              +
              168 
              +
              169  const bool has_protected_content = media_info.has_protected_content();
              +
              170 
              +
              171  for (std::list<AdaptationSet*>::const_iterator adaptation_set_it =
              +
              172  adaptation_sets.begin();
              +
              173  adaptation_set_it != adaptation_sets.end(); ++adaptation_set_it) {
              +
              174  ProtectedContentMap::const_iterator protected_content_it =
              +
              175  protected_content_map_.find((*adaptation_set_it)->id());
              +
              176 
              +
              177  // If the AdaptationSet ID is not registered in the map, then it is clear
              +
              178  // content (or encrypted but doesn't need <ContentProtection> element
              +
              179  // possibly because the player knows how to handle it).
              +
              180  if (protected_content_it == protected_content_map_.end()) {
              +
              181  // Can reuse the AdaptationSet without content protection.
              +
              182  if (!has_protected_content)
              +
              183  return *adaptation_set_it;
              +
              184  continue;
              +
              185  }
              +
              186 
              +
              187  if (ProtectedContentEq(protected_content_it->second,
              +
              188  media_info.protected_content())) {
              +
              189  // Content protection info matches. Reuse the AdaptationSet.
              +
              190  return *adaptation_set_it;
              +
              191  }
              +
              192  }
              +
              193 
              +
              194  // None of the adaptation sets match with the new content protection.
              +
              195  // Need a new one.
              +
              196  return NewAdaptationSet(media_info, &adaptation_sets);
              +
              197 }
              +
              198 
              +
              199 // Get all the UUIDs of the AdaptationSet. If another AdaptationSet has the
              +
              200 // same UUIDs then those should be groupable.
              +
              201 void DashIopMpdNotifier::SetGroupId(const std::string& key,
              +
              202  AdaptationSet* adaptation_set) {
              +
              203  if (adaptation_set->Group() >= 0) // @group already assigned.
              +
              204  return;
              +
              205 
              +
              206  ProtectedContentMap::const_iterator protected_content_it =
              +
              207  protected_content_map_.find(adaptation_set->id());
              +
              208  // Clear contents should be in one AdaptationSet, so no need to assign
              +
              209  // @group.
              +
              210  if (protected_content_it == protected_content_map_.end()) {
              +
              211  DVLOG(1) << "No content protection set for AdaptationSet@id="
              +
              212  << adaptation_set->id();
              +
              213  return;
              +
              214  }
              +
              215 
              +
              216  // Get all the UUIDs of the ContentProtections in AdaptationSet.
              +
              217  std::set<std::string> adaptation_set_uuids =
              +
              218  GetUUIDs(protected_content_it->second);
              +
              219 
              +
              220  std::list<AdaptationSet*>& same_type_adapatation_sets =
              +
              221  adaptation_set_list_map_[key];
              +
              222  DCHECK(!same_type_adapatation_sets.empty())
              +
              223  << "same_type_adapatation_sets should not be null, it should at least "
              +
              224  "contain adaptation_set";
              +
              225 
              +
              226  for (std::list<AdaptationSet*>::iterator adaptation_set_it =
              +
              227  same_type_adapatation_sets.begin();
              +
              228  adaptation_set_it != same_type_adapatation_sets.end();
              +
              229  ++adaptation_set_it) {
              +
              230  const uint32_t loop_adaptation_set_id = (*adaptation_set_it)->id();
              +
              231  if (loop_adaptation_set_id == adaptation_set->id() ||
              +
              232  !ContainsKey(protected_content_map_, loop_adaptation_set_id)) {
              +
              233  continue;
              +
              234  }
              +
              235 
              +
              236  const MediaInfo::ProtectedContent& loop_protected_content =
              +
              237  protected_content_map_[loop_adaptation_set_id];
              +
              238  if (static_cast<int>(adaptation_set_uuids.size()) !=
              +
              239  loop_protected_content.content_protection_entry().size()) {
              +
              240  // Different number of UUIDs, cannot be grouped.
              +
              241  continue;
              +
              242  }
              +
              243 
              +
              244  if (adaptation_set_uuids == GetUUIDs(loop_protected_content)) {
              +
              245  AdaptationSet& uuid_match_adaptation_set = **adaptation_set_it;
              +
              246  // They match. These AdaptationSets can be in the same group. Break out.
              +
              247  if (uuid_match_adaptation_set.Group() >= 0) {
              +
              248  adaptation_set->SetGroup(uuid_match_adaptation_set.Group());
              +
              249  } else {
              +
              250  const int group_id = next_group_id_++;
              +
              251  uuid_match_adaptation_set.SetGroup(group_id);
              +
              252  adaptation_set->SetGroup(group_id);
              +
              253  }
              +
              254  break;
              +
              255  }
              +
              256  }
              +
              257 }
              +
              258 
              +
              259 AdaptationSet* DashIopMpdNotifier::NewAdaptationSet(
              +
              260  const MediaInfo& media_info,
              +
              261  std::list<AdaptationSet*>* adaptation_sets) {
              +
              262  std::string language = GetLanguage(media_info);
              +
              263  AdaptationSet* new_adaptation_set = mpd_builder_->AddAdaptationSet(language);
              +
              264  if (media_info.has_protected_content()) {
              +
              265  DCHECK(!ContainsKey(protected_content_map_, new_adaptation_set->id()));
              +
              266  protected_content_map_[new_adaptation_set->id()] =
              +
              267  media_info.protected_content();
              +
              268  AddContentProtectionElements(media_info, new_adaptation_set);
              +
              269  }
              +
              270  adaptation_sets->push_back(new_adaptation_set);
              +
              271 
              +
              272  if (media_info.has_video_info()) {
              +
              273  // Because 'lang' is ignored for videos, |adaptation_sets| must have
              +
              274  // all the video AdaptationSets.
              +
              275  if (adaptation_sets->size() > 2) {
              +
              276  new_adaptation_set->AddRole(AdaptationSet::kRoleMain);
              +
              277  } else if (adaptation_sets->size() == 2) {
              +
              278  // Set "main" Role for both AdaptatoinSets.
              +
              279  (*adaptation_sets->begin())->AddRole(AdaptationSet::kRoleMain);
              +
              280  new_adaptation_set->AddRole(AdaptationSet::kRoleMain);
              +
              281  }
              +
              282  }
              +
              283  return new_adaptation_set;
              +
              284 }
              +
              285 
              +
              286 } // namespace shaka
              + +
              bool NotifyNewSegment(uint32_t id, uint64_t start_time, uint64_t duration, uint64_t size) override
              +
              bool NotifyEncryptionUpdate(uint32_t container_id, const std::string &drm_uuid, const std::vector< uint8_t > &new_key_id, const std::vector< uint8_t > &new_pssh) override
              + +
              virtual Representation * AddRepresentation(const MediaInfo &media_info)
              Definition: mpd_builder.cc:689
              +
              uint32_t id() const
              Definition: mpd_builder.h:500
              -
              bool NotifySampleDuration(uint32_t container_id, uint32_t sample_duration) override
              +
              bool NotifySampleDuration(uint32_t container_id, uint32_t sample_duration) override
              void AddContentProtectionElements(const MediaInfo &media_info, Representation *parent)
              Definition: mpd_utils.cc:339
              -
              virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
              Definition: mpd_builder.cc:743
              +
              virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
              Definition: mpd_builder.cc:739
              std::string Uint8VectorToBase64(const std::vector< uint8_t > &input)
              Converts uint8 vector into base64 encoded string.
              -
              virtual void ForceSetSegmentAlignment(bool segment_alignment)
              Definition: mpd_builder.cc:836
              -
              bool AddContentProtectionElement(uint32_t id, const ContentProtectionElement &content_protection_element) override
              -
              static void MakePathsRelativeToMpd(const std::string &mpd_path, MediaInfo *media_info)
              Definition: mpd_builder.cc:646
              - +
              virtual void ForceSetSegmentAlignment(bool segment_alignment)
              Definition: mpd_builder.cc:833
              +
              bool AddContentProtectionElement(uint32_t id, const ContentProtectionElement &content_protection_element) override
              +
              static void MakePathsRelativeToMpd(const std::string &mpd_path, MediaInfo *media_info)
              Definition: mpd_builder.cc:643
              +
              ContentType GetContentType(const MediaInfo &media_info)
              - +
              bool WriteMpdToFile(const std::string &output_path, MpdBuilder *mpd_builder)
              -
              bool NotifyNewContainer(const MediaInfo &media_info, uint32_t *id) override
              +
              bool NotifyNewContainer(const MediaInfo &media_info, uint32_t *id) override
              diff --git a/docs/dc/d3b/fixed__key__encryption__flags_8cc_source.html b/docs/dc/d3b/fixed__key__encryption__flags_8cc_source.html index 4fbf530958..21b6f453a1 100644 --- a/docs/dc/d3b/fixed__key__encryption__flags_8cc_source.html +++ b/docs/dc/d3b/fixed__key__encryption__flags_8cc_source.html @@ -166,7 +166,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dc/d3c/webm__cluster__parser_8h_source.html b/docs/dc/d3c/webm__cluster__parser_8h_source.html index 00ab91d94b..80cdddfca6 100644 --- a/docs/dc/d3c/webm__cluster__parser_8h_source.html +++ b/docs/dc/d3c/webm__cluster__parser_8h_source.html @@ -301,7 +301,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dc/d3f/key__source_8h_source.html b/docs/dc/d3f/key__source_8h_source.html index f58cf42ad9..ee75ad68fd 100644 --- a/docs/dc/d3f/key__source_8h_source.html +++ b/docs/dc/d3f/key__source_8h_source.html @@ -168,7 +168,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 f3c80549d0..f7154fb99b 100644 --- a/docs/dc/d40/classshaka_1_1xml_1_1XmlNode-members.html +++ b/docs/dc/d40/classshaka_1_1xml_1_1XmlNode-members.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dc/d41/classshaka_1_1media_1_1BufferWriter.html b/docs/dc/d41/classshaka_1_1media_1_1BufferWriter.html index 6152fb8330..0a83dd03d0 100644 --- a/docs/dc/d41/classshaka_1_1media_1_1BufferWriter.html +++ b/docs/dc/d41/classshaka_1_1media_1_1BufferWriter.html @@ -301,7 +301,7 @@ void AppendInt (int64_ 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 17433c229d..0929624761 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 e3086a0061..262298dfdf 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 @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 6ed669543c..cf3e12dd3e 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 @@ -219,14 +219,14 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); -
              const H265Sps * GetSps(int sps_id)
              Definition: h265_parser.cc:634
              +
              const H265Sps * GetSps(int sps_id)
              Definition: h265_parser.cc:628
              -
              Result ParseSps(const Nalu &nalu, int *sps_id)
              Definition: h265_parser.cc:513
              +
              Result ParseSps(const Nalu &nalu, int *sps_id)
              Definition: h265_parser.cc:508
              const uint8_t * data() const
              This is the pointer to the Nalu data, pointing to the header.
              Definition: nalu_reader.h:96
              diff --git a/docs/dc/d52/decoding__time__iterator_8h_source.html b/docs/dc/d52/decoding__time__iterator_8h_source.html index 9f5647d2a0..1fbb5cc97c 100644 --- a/docs/dc/d52/decoding__time__iterator_8h_source.html +++ b/docs/dc/d52/decoding__time__iterator_8h_source.html @@ -147,7 +147,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dc/d53/webm_2segmenter_8cc_source.html b/docs/dc/d53/webm_2segmenter_8cc_source.html index def8250b3a..8f38f4a315 100644 --- a/docs/dc/d53/webm_2segmenter_8cc_source.html +++ b/docs/dc/d53/webm_2segmenter_8cc_source.html @@ -531,13 +531,13 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              442 } // namespace shaka
              Abstract class holds stream information.
              Definition: stream_info.h:53
              -
              Status Initialize(const std::vector< MediaStream * > &streams, MuxerListener *muxer_listener, ProgressListener *progress_listener, KeySource *encryption_key_source, uint32_t max_sd_pixels, double clear_lead_in_seconds, double crypto_period_duration_in_seconds, FourCC protection_scheme)
              Definition: segmenter.cc:166
              -
              void UpdateProgress(uint64_t progress)
              Update segmentation progress using ProgressListener.
              Definition: segmenter.cc:389
              +
              Status Initialize(const std::vector< MediaStream * > &streams, MuxerListener *muxer_listener, ProgressListener *progress_listener, KeySource *encryption_key_source, uint32_t max_sd_pixels, double clear_lead_in_seconds, double crypto_period_duration_in_seconds, FourCC protection_scheme)
              Definition: segmenter.cc:165
              +
              void UpdateProgress(uint64_t progress)
              Update segmentation progress using ProgressListener.
              Definition: segmenter.cc:387
              virtual void OnSampleDurationReady(uint32_t sample_duration)=0
              Class for parsing or writing VP codec configuration record.
              virtual void OnEncryptionStart()=0
              -
              Status AddSample(const MediaStream *stream, scoped_refptr< MediaSample > sample)
              Definition: segmenter.cc:322
              +
              Status AddSample(const MediaStream *stream, scoped_refptr< MediaSample > sample)
              Definition: segmenter.cc:320
              This class listens to progress updates events.
              mkvmuxer::int64 Position() const override
              Definition: mkv_writer.cc:71
              @@ -551,13 +551,13 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              KeySource is responsible for encryption key acquisition.
              Definition: key_source.h:30
              -
              double GetDuration() const
              Definition: segmenter.cc:380
              +
              double GetDuration() const
              Definition: segmenter.cc:378
              Holds video stream information.
              diff --git a/docs/dc/d54/structshaka_1_1media_1_1H264DecRefPicMarking.html b/docs/dc/d54/structshaka_1_1media_1_1H264DecRefPicMarking.html index 5a69e29875..ded63d7a34 100644 --- a/docs/dc/d54/structshaka_1_1media_1_1H264DecRefPicMarking.html +++ b/docs/dc/d54/structshaka_1_1media_1_1H264DecRefPicMarking.html @@ -114,14 +114,14 @@ int max_long_term_frame_id

              Detailed Description

              -

              Definition at line 135 of file h264_parser.h.

              +

              Definition at line 136 of file h264_parser.h.


              The documentation for this struct was generated from the following file: diff --git a/docs/dc/d58/webm__media__parser_8h_source.html b/docs/dc/d58/webm__media__parser_8h_source.html index f581256e65..08d0b46da2 100644 --- a/docs/dc/d58/webm__media__parser_8h_source.html +++ b/docs/dc/d58/webm__media__parser_8h_source.html @@ -179,7 +179,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dc/d5c/classshaka_1_1MockMpdNotifier.html b/docs/dc/d5c/classshaka_1_1MockMpdNotifier.html index 51dc6888c9..ce3f6ab88b 100644 --- a/docs/dc/d5c/classshaka_1_1MockMpdNotifier.html +++ b/docs/dc/d5c/classshaka_1_1MockMpdNotifier.html @@ -160,7 +160,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 09d5e50155..3c04773766 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 @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 03e85d2cbf..75e7b4ef91 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 @@ -121,7 +121,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 2f600081ac..b21322d4df 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 @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dc/d73/classshaka_1_1media_1_1MockMuxerListener.html b/docs/dc/d73/classshaka_1_1media_1_1MockMuxerListener.html index c522faa82f..291f0308ea 100644 --- a/docs/dc/d73/classshaka_1_1media_1_1MockMuxerListener.html +++ b/docs/dc/d73/classshaka_1_1media_1_1MockMuxerListener.html @@ -157,7 +157,7 @@ Additional Inherited Members diff --git a/docs/dc/d7b/closure__thread_8cc_source.html b/docs/dc/d7b/closure__thread_8cc_source.html index 8602dcaa11..751d4bdcfc 100644 --- a/docs/dc/d7b/closure__thread_8cc_source.html +++ b/docs/dc/d7b/closure__thread_8cc_source.html @@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dc/d7b/h264__parser_8cc_source.html b/docs/dc/d7b/h264__parser_8cc_source.html index 8e1156cae4..2ccffa8d64 100644 --- a/docs/dc/d7b/h264__parser_8cc_source.html +++ b/docs/dc/d7b/h264__parser_8cc_source.html @@ -95,1176 +95,1170 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              6 
              7 #include <memory>
              8 #include "packager/base/logging.h"
              -
              9 #include "packager/base/stl_util.h"
              -
              10 #include "packager/media/base/buffer_reader.h"
              -
              11 
              -
              12 namespace shaka {
              -
              13 namespace media {
              -
              14 
              -
              15 // Implemented according to ISO/IEC 14496-10:2005 7.4.2.1 Sequence parameter set
              -
              16 // RBSP semantics.
              -
              17 bool ExtractResolutionFromSps(const H264Sps& sps,
              -
              18  uint32_t* coded_width,
              -
              19  uint32_t* coded_height,
              -
              20  uint32_t* pixel_width,
              -
              21  uint32_t* pixel_height) {
              -
              22  int crop_x = 0;
              -
              23  int crop_y = 0;
              -
              24  if (sps.frame_cropping_flag) {
              -
              25  int sub_width_c = 0;
              -
              26  int sub_height_c = 0;
              -
              27  // Table 6-1.
              -
              28  switch (sps.chroma_format_idc) {
              -
              29  case 0: // monochrome
              -
              30  // SubWidthC and SubHeightC are not defined for monochrome. For ease of
              -
              31  // computation afterwards, assign both to 1.
              -
              32  sub_width_c = 1;
              -
              33  sub_height_c = 1;
              -
              34  break;
              -
              35  case 1: // 4:2:0
              -
              36  sub_width_c = 2;
              -
              37  sub_height_c = 2;
              -
              38  break;
              -
              39  case 2: // 4:2:2
              -
              40  sub_width_c = 2;
              -
              41  sub_height_c = 1;
              -
              42  break;
              -
              43  case 3: // 4:4:4
              -
              44  sub_width_c = 1;
              -
              45  sub_height_c = 1;
              -
              46  break;
              -
              47  default:
              -
              48  LOG(ERROR) << "Unexpected chroma_format_idc " << sps.chroma_format_idc;
              -
              49  return false;
              -
              50  }
              -
              51 
              -
              52  // Formula 7-16, 7-17, 7-18, 7-19.
              -
              53  int crop_unit_x = sub_width_c;
              -
              54  int crop_unit_y = sub_height_c * (2 - (sps.frame_mbs_only_flag ? 1 : 0));
              -
              55  crop_x = crop_unit_x *
              -
              56  (sps.frame_crop_left_offset + sps.frame_crop_right_offset);
              -
              57  crop_y = crop_unit_y *
              -
              58  (sps.frame_crop_top_offset + sps.frame_crop_bottom_offset);
              -
              59  }
              -
              60 
              -
              61  // Formula 7-10, 7-11.
              -
              62  int pic_width_in_mbs = sps.pic_width_in_mbs_minus1 + 1;
              -
              63  *coded_width = pic_width_in_mbs * 16 - crop_x;
              -
              64 
              -
              65  // Formula 7-13, 7-15.
              -
              66  int pic_height_in_mbs = (2 - (sps.frame_mbs_only_flag ? 1 : 0)) *
              -
              67  (sps.pic_height_in_map_units_minus1 + 1);
              -
              68  *coded_height = pic_height_in_mbs * 16 - crop_y;
              -
              69 
              -
              70  // 0 means it wasn't in the SPS and therefore assume 1.
              -
              71  *pixel_width = sps.sar_width == 0 ? 1 : sps.sar_width;
              -
              72  *pixel_height = sps.sar_height == 0 ? 1 : sps.sar_height;
              -
              73  DVLOG(2) << "Found coded_width: " << *coded_width
              -
              74  << " coded_height: " << *coded_height
              -
              75  << " pixel_width: " << *pixel_width
              -
              76  << " pixel_height: " << *pixel_height;
              -
              77  return true;
              -
              78 }
              -
              79 
              -
              80 bool H264SliceHeader::IsPSlice() const {
              -
              81  return (slice_type % 5 == kPSlice);
              -
              82 }
              -
              83 
              -
              84 bool H264SliceHeader::IsBSlice() const {
              -
              85  return (slice_type % 5 == kBSlice);
              -
              86 }
              -
              87 
              -
              88 bool H264SliceHeader::IsISlice() const {
              -
              89  return (slice_type % 5 == kISlice);
              -
              90 }
              -
              91 
              -
              92 bool H264SliceHeader::IsSPSlice() const {
              -
              93  return (slice_type % 5 == kSPSlice);
              -
              94 }
              -
              95 
              -
              96 bool H264SliceHeader::IsSISlice() const {
              -
              97  return (slice_type % 5 == kSISlice);
              -
              98 }
              -
              99 
              -
              100 H264Sps::H264Sps() {
              -
              101  memset(this, 0, sizeof(*this));
              -
              102 }
              -
              103 
              -
              104 H264Pps::H264Pps() {
              -
              105  memset(this, 0, sizeof(*this));
              -
              106 }
              -
              107 
              -
              108 H264SliceHeader::H264SliceHeader() {
              -
              109  memset(this, 0, sizeof(*this));
              -
              110 }
              -
              111 
              -
              112 H264SEIMessage::H264SEIMessage() {
              -
              113  memset(this, 0, sizeof(*this));
              -
              114 }
              -
              115 
              -
              116 #define READ_BITS_OR_RETURN(num_bits, out) \
              -
              117  do { \
              -
              118  if (!br->ReadBits(num_bits, (out))) { \
              -
              119  DVLOG(1) \
              -
              120  << "Error in stream: unexpected EOS while trying to read " #out; \
              -
              121  return kInvalidStream; \
              -
              122  } \
              -
              123  } while (0)
              -
              124 
              -
              125 #define READ_BOOL_OR_RETURN(out) \
              -
              126  do { \
              -
              127  int _out; \
              -
              128  if (!br->ReadBits(1, &_out)) { \
              -
              129  DVLOG(1) \
              -
              130  << "Error in stream: unexpected EOS while trying to read " #out; \
              -
              131  return kInvalidStream; \
              -
              132  } \
              -
              133  *(out) = _out != 0; \
              -
              134  } while (0)
              -
              135 
              -
              136 #define READ_UE_OR_RETURN(out) \
              -
              137  do { \
              -
              138  if (!br->ReadUE(out)) { \
              -
              139  DVLOG(1) << "Error in stream: invalid value while trying to read " #out; \
              -
              140  return kInvalidStream; \
              -
              141  } \
              -
              142  } while (0)
              -
              143 
              -
              144 #define READ_SE_OR_RETURN(out) \
              -
              145  do { \
              -
              146  if (!br->ReadSE(out)) { \
              -
              147  DVLOG(1) << "Error in stream: invalid value while trying to read " #out; \
              -
              148  return kInvalidStream; \
              -
              149  } \
              -
              150  } while (0)
              -
              151 
              -
              152 #define IN_RANGE_OR_RETURN(val, min, max) \
              -
              153  do { \
              -
              154  if ((val) < (min) || (val) > (max)) { \
              -
              155  DVLOG(1) << "Error in stream: invalid value, expected " #val " to be" \
              -
              156  << " in range [" << (min) << ":" << (max) << "]" \
              -
              157  << " found " << (val) << " instead"; \
              -
              158  return kInvalidStream; \
              -
              159  } \
              -
              160  } while (0)
              -
              161 
              -
              162 #define TRUE_OR_RETURN(a) \
              -
              163  do { \
              -
              164  if (!(a)) { \
              -
              165  DVLOG(1) << "Error in stream: invalid value, expected " << #a; \
              -
              166  return kInvalidStream; \
              -
              167  } \
              -
              168  } while (0)
              -
              169 
              -
              170 enum AspectRatioIdc {
              -
              171  kExtendedSar = 255,
              -
              172 };
              -
              173 
              -
              174 // ISO 14496 part 10
              -
              175 // VUI parameters: Table E-1 "Meaning of sample aspect ratio indicator"
              -
              176 static const int kTableSarWidth[] = {
              -
              177  0, 1, 12, 10, 16, 40, 24, 20, 32, 80, 18, 15, 64, 160, 4, 3, 2
              -
              178 };
              -
              179 static const int kTableSarHeight[] = {
              -
              180  0, 1, 11, 11, 11, 33, 11, 11, 11, 33, 11, 11, 33, 99, 3, 2, 1
              -
              181 };
              -
              182 static_assert(arraysize(kTableSarWidth) == arraysize(kTableSarHeight),
              -
              183  "sar_tables_must_have_same_size");
              -
              184 
              -
              185 H264Parser::H264Parser() {}
              -
              186 
              -
              187 H264Parser::~H264Parser() {
              -
              188  STLDeleteValues(&active_SPSes_);
              -
              189  STLDeleteValues(&active_PPSes_);
              +
              9 #include "packager/media/base/buffer_reader.h"
              +
              10 
              +
              11 namespace shaka {
              +
              12 namespace media {
              +
              13 
              +
              14 // Implemented according to ISO/IEC 14496-10:2005 7.4.2.1 Sequence parameter set
              +
              15 // RBSP semantics.
              +
              16 bool ExtractResolutionFromSps(const H264Sps& sps,
              +
              17  uint32_t* coded_width,
              +
              18  uint32_t* coded_height,
              +
              19  uint32_t* pixel_width,
              +
              20  uint32_t* pixel_height) {
              +
              21  int crop_x = 0;
              +
              22  int crop_y = 0;
              +
              23  if (sps.frame_cropping_flag) {
              +
              24  int sub_width_c = 0;
              +
              25  int sub_height_c = 0;
              +
              26  // Table 6-1.
              +
              27  switch (sps.chroma_format_idc) {
              +
              28  case 0: // monochrome
              +
              29  // SubWidthC and SubHeightC are not defined for monochrome. For ease of
              +
              30  // computation afterwards, assign both to 1.
              +
              31  sub_width_c = 1;
              +
              32  sub_height_c = 1;
              +
              33  break;
              +
              34  case 1: // 4:2:0
              +
              35  sub_width_c = 2;
              +
              36  sub_height_c = 2;
              +
              37  break;
              +
              38  case 2: // 4:2:2
              +
              39  sub_width_c = 2;
              +
              40  sub_height_c = 1;
              +
              41  break;
              +
              42  case 3: // 4:4:4
              +
              43  sub_width_c = 1;
              +
              44  sub_height_c = 1;
              +
              45  break;
              +
              46  default:
              +
              47  LOG(ERROR) << "Unexpected chroma_format_idc " << sps.chroma_format_idc;
              +
              48  return false;
              +
              49  }
              +
              50 
              +
              51  // Formula 7-16, 7-17, 7-18, 7-19.
              +
              52  int crop_unit_x = sub_width_c;
              +
              53  int crop_unit_y = sub_height_c * (2 - (sps.frame_mbs_only_flag ? 1 : 0));
              +
              54  crop_x = crop_unit_x *
              +
              55  (sps.frame_crop_left_offset + sps.frame_crop_right_offset);
              +
              56  crop_y = crop_unit_y *
              +
              57  (sps.frame_crop_top_offset + sps.frame_crop_bottom_offset);
              +
              58  }
              +
              59 
              +
              60  // Formula 7-10, 7-11.
              +
              61  int pic_width_in_mbs = sps.pic_width_in_mbs_minus1 + 1;
              +
              62  *coded_width = pic_width_in_mbs * 16 - crop_x;
              +
              63 
              +
              64  // Formula 7-13, 7-15.
              +
              65  int pic_height_in_mbs = (2 - (sps.frame_mbs_only_flag ? 1 : 0)) *
              +
              66  (sps.pic_height_in_map_units_minus1 + 1);
              +
              67  *coded_height = pic_height_in_mbs * 16 - crop_y;
              +
              68 
              +
              69  // 0 means it wasn't in the SPS and therefore assume 1.
              +
              70  *pixel_width = sps.sar_width == 0 ? 1 : sps.sar_width;
              +
              71  *pixel_height = sps.sar_height == 0 ? 1 : sps.sar_height;
              +
              72  DVLOG(2) << "Found coded_width: " << *coded_width
              +
              73  << " coded_height: " << *coded_height
              +
              74  << " pixel_width: " << *pixel_width
              +
              75  << " pixel_height: " << *pixel_height;
              +
              76  return true;
              +
              77 }
              +
              78 
              +
              79 bool H264SliceHeader::IsPSlice() const {
              +
              80  return (slice_type % 5 == kPSlice);
              +
              81 }
              +
              82 
              +
              83 bool H264SliceHeader::IsBSlice() const {
              +
              84  return (slice_type % 5 == kBSlice);
              +
              85 }
              +
              86 
              +
              87 bool H264SliceHeader::IsISlice() const {
              +
              88  return (slice_type % 5 == kISlice);
              +
              89 }
              +
              90 
              +
              91 bool H264SliceHeader::IsSPSlice() const {
              +
              92  return (slice_type % 5 == kSPSlice);
              +
              93 }
              +
              94 
              +
              95 bool H264SliceHeader::IsSISlice() const {
              +
              96  return (slice_type % 5 == kSISlice);
              +
              97 }
              +
              98 
              +
              99 H264Sps::H264Sps() {
              +
              100  memset(this, 0, sizeof(*this));
              +
              101 }
              +
              102 
              +
              103 H264Pps::H264Pps() {
              +
              104  memset(this, 0, sizeof(*this));
              +
              105 }
              +
              106 
              +
              107 H264SliceHeader::H264SliceHeader() {
              +
              108  memset(this, 0, sizeof(*this));
              +
              109 }
              +
              110 
              +
              111 H264SEIMessage::H264SEIMessage() {
              +
              112  memset(this, 0, sizeof(*this));
              +
              113 }
              +
              114 
              +
              115 #define READ_BITS_OR_RETURN(num_bits, out) \
              +
              116  do { \
              +
              117  if (!br->ReadBits(num_bits, (out))) { \
              +
              118  DVLOG(1) \
              +
              119  << "Error in stream: unexpected EOS while trying to read " #out; \
              +
              120  return kInvalidStream; \
              +
              121  } \
              +
              122  } while (0)
              +
              123 
              +
              124 #define READ_BOOL_OR_RETURN(out) \
              +
              125  do { \
              +
              126  int _out; \
              +
              127  if (!br->ReadBits(1, &_out)) { \
              +
              128  DVLOG(1) \
              +
              129  << "Error in stream: unexpected EOS while trying to read " #out; \
              +
              130  return kInvalidStream; \
              +
              131  } \
              +
              132  *(out) = _out != 0; \
              +
              133  } while (0)
              +
              134 
              +
              135 #define READ_UE_OR_RETURN(out) \
              +
              136  do { \
              +
              137  if (!br->ReadUE(out)) { \
              +
              138  DVLOG(1) << "Error in stream: invalid value while trying to read " #out; \
              +
              139  return kInvalidStream; \
              +
              140  } \
              +
              141  } while (0)
              +
              142 
              +
              143 #define READ_SE_OR_RETURN(out) \
              +
              144  do { \
              +
              145  if (!br->ReadSE(out)) { \
              +
              146  DVLOG(1) << "Error in stream: invalid value while trying to read " #out; \
              +
              147  return kInvalidStream; \
              +
              148  } \
              +
              149  } while (0)
              +
              150 
              +
              151 #define IN_RANGE_OR_RETURN(val, min, max) \
              +
              152  do { \
              +
              153  if ((val) < (min) || (val) > (max)) { \
              +
              154  DVLOG(1) << "Error in stream: invalid value, expected " #val " to be" \
              +
              155  << " in range [" << (min) << ":" << (max) << "]" \
              +
              156  << " found " << (val) << " instead"; \
              +
              157  return kInvalidStream; \
              +
              158  } \
              +
              159  } while (0)
              +
              160 
              +
              161 #define TRUE_OR_RETURN(a) \
              +
              162  do { \
              +
              163  if (!(a)) { \
              +
              164  DVLOG(1) << "Error in stream: invalid value, expected " << #a; \
              +
              165  return kInvalidStream; \
              +
              166  } \
              +
              167  } while (0)
              +
              168 
              +
              169 enum AspectRatioIdc {
              +
              170  kExtendedSar = 255,
              +
              171 };
              +
              172 
              +
              173 // ISO 14496 part 10
              +
              174 // VUI parameters: Table E-1 "Meaning of sample aspect ratio indicator"
              +
              175 static const int kTableSarWidth[] = {
              +
              176  0, 1, 12, 10, 16, 40, 24, 20, 32, 80, 18, 15, 64, 160, 4, 3, 2
              +
              177 };
              +
              178 static const int kTableSarHeight[] = {
              +
              179  0, 1, 11, 11, 11, 33, 11, 11, 11, 33, 11, 11, 33, 99, 3, 2, 1
              +
              180 };
              +
              181 static_assert(arraysize(kTableSarWidth) == arraysize(kTableSarHeight),
              +
              182  "sar_tables_must_have_same_size");
              +
              183 
              +
              184 H264Parser::H264Parser() {}
              +
              185 
              +
              186 H264Parser::~H264Parser() {}
              +
              187 
              +
              188 const H264Pps* H264Parser::GetPps(int pps_id) {
              +
              189  return active_PPSes_[pps_id].get();
              190 }
              191 
              -
              192 const H264Pps* H264Parser::GetPps(int pps_id) {
              -
              193  return active_PPSes_[pps_id];
              +
              192 const H264Sps* H264Parser::GetSps(int sps_id) {
              +
              193  return active_SPSes_[sps_id].get();
              194 }
              195 
              -
              196 const H264Sps* H264Parser::GetSps(int sps_id) {
              -
              197  return active_SPSes_[sps_id];
              -
              198 }
              +
              196 // Default scaling lists (per spec).
              +
              197 static const int kDefault4x4Intra[kH264ScalingList4x4Length] = {
              +
              198  6, 13, 13, 20, 20, 20, 28, 28, 28, 28, 32, 32, 32, 37, 37, 42, };
              199 
              -
              200 // Default scaling lists (per spec).
              -
              201 static const int kDefault4x4Intra[kH264ScalingList4x4Length] = {
              -
              202  6, 13, 13, 20, 20, 20, 28, 28, 28, 28, 32, 32, 32, 37, 37, 42, };
              -
              203 
              -
              204 static const int kDefault4x4Inter[kH264ScalingList4x4Length] = {
              -
              205  10, 14, 14, 20, 20, 20, 24, 24, 24, 24, 27, 27, 27, 30, 30, 34, };
              -
              206 
              -
              207 static const int kDefault8x8Intra[kH264ScalingList8x8Length] = {
              -
              208  6, 10, 10, 13, 11, 13, 16, 16, 16, 16, 18, 18, 18, 18, 18, 23,
              -
              209  23, 23, 23, 23, 23, 25, 25, 25, 25, 25, 25, 25, 27, 27, 27, 27,
              -
              210  27, 27, 27, 27, 29, 29, 29, 29, 29, 29, 29, 31, 31, 31, 31, 31,
              -
              211  31, 33, 33, 33, 33, 33, 36, 36, 36, 36, 38, 38, 38, 40, 40, 42, };
              -
              212 
              -
              213 static const int kDefault8x8Inter[kH264ScalingList8x8Length] = {
              -
              214  9, 13, 13, 15, 13, 15, 17, 17, 17, 17, 19, 19, 19, 19, 19, 21,
              -
              215  21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 24, 24, 24, 24,
              -
              216  24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 27, 27, 27, 27, 27,
              -
              217  27, 28, 28, 28, 28, 28, 30, 30, 30, 30, 32, 32, 32, 33, 33, 35, };
              -
              218 
              -
              219 static inline void DefaultScalingList4x4(
              -
              220  int i,
              -
              221  int scaling_list4x4[][kH264ScalingList4x4Length]) {
              -
              222  DCHECK_LT(i, 6);
              -
              223 
              -
              224  if (i < 3)
              -
              225  memcpy(scaling_list4x4[i], kDefault4x4Intra, sizeof(kDefault4x4Intra));
              -
              226  else if (i < 6)
              -
              227  memcpy(scaling_list4x4[i], kDefault4x4Inter, sizeof(kDefault4x4Inter));
              -
              228 }
              -
              229 
              -
              230 static inline void DefaultScalingList8x8(
              -
              231  int i,
              -
              232  int scaling_list8x8[][kH264ScalingList8x8Length]) {
              -
              233  DCHECK_LT(i, 6);
              -
              234 
              -
              235  if (i % 2 == 0)
              -
              236  memcpy(scaling_list8x8[i], kDefault8x8Intra, sizeof(kDefault8x8Intra));
              -
              237  else
              -
              238  memcpy(scaling_list8x8[i], kDefault8x8Inter, sizeof(kDefault8x8Inter));
              -
              239 }
              -
              240 
              -
              241 static void FallbackScalingList4x4(
              -
              242  int i,
              -
              243  const int default_scaling_list_intra[],
              -
              244  const int default_scaling_list_inter[],
              -
              245  int scaling_list4x4[][kH264ScalingList4x4Length]) {
              -
              246  static const int kScalingList4x4ByteSize =
              -
              247  sizeof(scaling_list4x4[0][0]) * kH264ScalingList4x4Length;
              -
              248 
              -
              249  switch (i) {
              -
              250  case 0:
              -
              251  memcpy(scaling_list4x4[i], default_scaling_list_intra,
              -
              252  kScalingList4x4ByteSize);
              +
              200 static const int kDefault4x4Inter[kH264ScalingList4x4Length] = {
              +
              201  10, 14, 14, 20, 20, 20, 24, 24, 24, 24, 27, 27, 27, 30, 30, 34, };
              +
              202 
              +
              203 static const int kDefault8x8Intra[kH264ScalingList8x8Length] = {
              +
              204  6, 10, 10, 13, 11, 13, 16, 16, 16, 16, 18, 18, 18, 18, 18, 23,
              +
              205  23, 23, 23, 23, 23, 25, 25, 25, 25, 25, 25, 25, 27, 27, 27, 27,
              +
              206  27, 27, 27, 27, 29, 29, 29, 29, 29, 29, 29, 31, 31, 31, 31, 31,
              +
              207  31, 33, 33, 33, 33, 33, 36, 36, 36, 36, 38, 38, 38, 40, 40, 42, };
              +
              208 
              +
              209 static const int kDefault8x8Inter[kH264ScalingList8x8Length] = {
              +
              210  9, 13, 13, 15, 13, 15, 17, 17, 17, 17, 19, 19, 19, 19, 19, 21,
              +
              211  21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 24, 24, 24, 24,
              +
              212  24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 27, 27, 27, 27, 27,
              +
              213  27, 28, 28, 28, 28, 28, 30, 30, 30, 30, 32, 32, 32, 33, 33, 35, };
              +
              214 
              +
              215 static inline void DefaultScalingList4x4(
              +
              216  int i,
              +
              217  int scaling_list4x4[][kH264ScalingList4x4Length]) {
              +
              218  DCHECK_LT(i, 6);
              +
              219 
              +
              220  if (i < 3)
              +
              221  memcpy(scaling_list4x4[i], kDefault4x4Intra, sizeof(kDefault4x4Intra));
              +
              222  else if (i < 6)
              +
              223  memcpy(scaling_list4x4[i], kDefault4x4Inter, sizeof(kDefault4x4Inter));
              +
              224 }
              +
              225 
              +
              226 static inline void DefaultScalingList8x8(
              +
              227  int i,
              +
              228  int scaling_list8x8[][kH264ScalingList8x8Length]) {
              +
              229  DCHECK_LT(i, 6);
              +
              230 
              +
              231  if (i % 2 == 0)
              +
              232  memcpy(scaling_list8x8[i], kDefault8x8Intra, sizeof(kDefault8x8Intra));
              +
              233  else
              +
              234  memcpy(scaling_list8x8[i], kDefault8x8Inter, sizeof(kDefault8x8Inter));
              +
              235 }
              +
              236 
              +
              237 static void FallbackScalingList4x4(
              +
              238  int i,
              +
              239  const int default_scaling_list_intra[],
              +
              240  const int default_scaling_list_inter[],
              +
              241  int scaling_list4x4[][kH264ScalingList4x4Length]) {
              +
              242  static const int kScalingList4x4ByteSize =
              +
              243  sizeof(scaling_list4x4[0][0]) * kH264ScalingList4x4Length;
              +
              244 
              +
              245  switch (i) {
              +
              246  case 0:
              +
              247  memcpy(scaling_list4x4[i], default_scaling_list_intra,
              +
              248  kScalingList4x4ByteSize);
              +
              249  break;
              +
              250 
              +
              251  case 1:
              +
              252  memcpy(scaling_list4x4[i], scaling_list4x4[0], kScalingList4x4ByteSize);
              253  break;
              254 
              -
              255  case 1:
              -
              256  memcpy(scaling_list4x4[i], scaling_list4x4[0], kScalingList4x4ByteSize);
              +
              255  case 2:
              +
              256  memcpy(scaling_list4x4[i], scaling_list4x4[1], kScalingList4x4ByteSize);
              257  break;
              258 
              -
              259  case 2:
              -
              260  memcpy(scaling_list4x4[i], scaling_list4x4[1], kScalingList4x4ByteSize);
              -
              261  break;
              -
              262 
              -
              263  case 3:
              -
              264  memcpy(scaling_list4x4[i], default_scaling_list_inter,
              -
              265  kScalingList4x4ByteSize);
              +
              259  case 3:
              +
              260  memcpy(scaling_list4x4[i], default_scaling_list_inter,
              +
              261  kScalingList4x4ByteSize);
              +
              262  break;
              +
              263 
              +
              264  case 4:
              +
              265  memcpy(scaling_list4x4[i], scaling_list4x4[3], kScalingList4x4ByteSize);
              266  break;
              267 
              -
              268  case 4:
              -
              269  memcpy(scaling_list4x4[i], scaling_list4x4[3], kScalingList4x4ByteSize);
              +
              268  case 5:
              +
              269  memcpy(scaling_list4x4[i], scaling_list4x4[4], kScalingList4x4ByteSize);
              270  break;
              271 
              -
              272  case 5:
              -
              273  memcpy(scaling_list4x4[i], scaling_list4x4[4], kScalingList4x4ByteSize);
              +
              272  default:
              +
              273  NOTREACHED();
              274  break;
              -
              275 
              -
              276  default:
              -
              277  NOTREACHED();
              -
              278  break;
              -
              279  }
              -
              280 }
              -
              281 
              -
              282 static void FallbackScalingList8x8(
              -
              283  int i,
              -
              284  const int default_scaling_list_intra[],
              -
              285  const int default_scaling_list_inter[],
              -
              286  int scaling_list8x8[][kH264ScalingList8x8Length]) {
              -
              287  static const int kScalingList8x8ByteSize =
              -
              288  sizeof(scaling_list8x8[0][0]) * kH264ScalingList8x8Length;
              -
              289 
              -
              290  switch (i) {
              -
              291  case 0:
              -
              292  memcpy(scaling_list8x8[i], default_scaling_list_intra,
              -
              293  kScalingList8x8ByteSize);
              -
              294  break;
              -
              295 
              -
              296  case 1:
              -
              297  memcpy(scaling_list8x8[i], default_scaling_list_inter,
              -
              298  kScalingList8x8ByteSize);
              +
              275  }
              +
              276 }
              +
              277 
              +
              278 static void FallbackScalingList8x8(
              +
              279  int i,
              +
              280  const int default_scaling_list_intra[],
              +
              281  const int default_scaling_list_inter[],
              +
              282  int scaling_list8x8[][kH264ScalingList8x8Length]) {
              +
              283  static const int kScalingList8x8ByteSize =
              +
              284  sizeof(scaling_list8x8[0][0]) * kH264ScalingList8x8Length;
              +
              285 
              +
              286  switch (i) {
              +
              287  case 0:
              +
              288  memcpy(scaling_list8x8[i], default_scaling_list_intra,
              +
              289  kScalingList8x8ByteSize);
              +
              290  break;
              +
              291 
              +
              292  case 1:
              +
              293  memcpy(scaling_list8x8[i], default_scaling_list_inter,
              +
              294  kScalingList8x8ByteSize);
              +
              295  break;
              +
              296 
              +
              297  case 2:
              +
              298  memcpy(scaling_list8x8[i], scaling_list8x8[0], kScalingList8x8ByteSize);
              299  break;
              300 
              -
              301  case 2:
              -
              302  memcpy(scaling_list8x8[i], scaling_list8x8[0], kScalingList8x8ByteSize);
              +
              301  case 3:
              +
              302  memcpy(scaling_list8x8[i], scaling_list8x8[1], kScalingList8x8ByteSize);
              303  break;
              304 
              -
              305  case 3:
              -
              306  memcpy(scaling_list8x8[i], scaling_list8x8[1], kScalingList8x8ByteSize);
              +
              305  case 4:
              +
              306  memcpy(scaling_list8x8[i], scaling_list8x8[2], kScalingList8x8ByteSize);
              307  break;
              308 
              -
              309  case 4:
              -
              310  memcpy(scaling_list8x8[i], scaling_list8x8[2], kScalingList8x8ByteSize);
              +
              309  case 5:
              +
              310  memcpy(scaling_list8x8[i], scaling_list8x8[3], kScalingList8x8ByteSize);
              311  break;
              312 
              -
              313  case 5:
              -
              314  memcpy(scaling_list8x8[i], scaling_list8x8[3], kScalingList8x8ByteSize);
              +
              313  default:
              +
              314  NOTREACHED();
              315  break;
              -
              316 
              -
              317  default:
              -
              318  NOTREACHED();
              -
              319  break;
              -
              320  }
              -
              321 }
              -
              322 
              -
              323 H264Parser::Result H264Parser::ParseScalingList(H26xBitReader* br,
              -
              324  int size,
              -
              325  int* scaling_list,
              -
              326  bool* use_default) {
              -
              327  // See chapter 7.3.2.1.1.1.
              -
              328  int last_scale = 8;
              -
              329  int next_scale = 8;
              -
              330  int delta_scale;
              -
              331 
              -
              332  *use_default = false;
              -
              333 
              -
              334  for (int j = 0; j < size; ++j) {
              -
              335  if (next_scale != 0) {
              -
              336  READ_SE_OR_RETURN(&delta_scale);
              -
              337  IN_RANGE_OR_RETURN(delta_scale, -128, 127);
              -
              338  next_scale = (last_scale + delta_scale + 256) & 0xff;
              -
              339 
              -
              340  if (j == 0 && next_scale == 0) {
              -
              341  *use_default = true;
              -
              342  return kOk;
              -
              343  }
              -
              344  }
              +
              316  }
              +
              317 }
              +
              318 
              +
              319 H264Parser::Result H264Parser::ParseScalingList(H26xBitReader* br,
              +
              320  int size,
              +
              321  int* scaling_list,
              +
              322  bool* use_default) {
              +
              323  // See chapter 7.3.2.1.1.1.
              +
              324  int last_scale = 8;
              +
              325  int next_scale = 8;
              +
              326  int delta_scale;
              +
              327 
              +
              328  *use_default = false;
              +
              329 
              +
              330  for (int j = 0; j < size; ++j) {
              +
              331  if (next_scale != 0) {
              +
              332  READ_SE_OR_RETURN(&delta_scale);
              +
              333  IN_RANGE_OR_RETURN(delta_scale, -128, 127);
              +
              334  next_scale = (last_scale + delta_scale + 256) & 0xff;
              +
              335 
              +
              336  if (j == 0 && next_scale == 0) {
              +
              337  *use_default = true;
              +
              338  return kOk;
              +
              339  }
              +
              340  }
              +
              341 
              +
              342  scaling_list[j] = (next_scale == 0) ? last_scale : next_scale;
              +
              343  last_scale = scaling_list[j];
              +
              344  }
              345 
              -
              346  scaling_list[j] = (next_scale == 0) ? last_scale : next_scale;
              -
              347  last_scale = scaling_list[j];
              -
              348  }
              -
              349 
              -
              350  return kOk;
              -
              351 }
              -
              352 
              -
              353 H264Parser::Result H264Parser::ParseSpsScalingLists(H26xBitReader* br,
              -
              354  H264Sps* sps) {
              -
              355  // See 7.4.2.1.1.
              -
              356  bool seq_scaling_list_present_flag;
              -
              357  bool use_default;
              -
              358  Result res;
              +
              346  return kOk;
              +
              347 }
              +
              348 
              +
              349 H264Parser::Result H264Parser::ParseSpsScalingLists(H26xBitReader* br,
              +
              350  H264Sps* sps) {
              +
              351  // See 7.4.2.1.1.
              +
              352  bool seq_scaling_list_present_flag;
              +
              353  bool use_default;
              +
              354  Result res;
              +
              355 
              +
              356  // Parse scaling_list4x4.
              +
              357  for (int i = 0; i < 6; ++i) {
              +
              358  READ_BOOL_OR_RETURN(&seq_scaling_list_present_flag);
              359 
              -
              360  // Parse scaling_list4x4.
              -
              361  for (int i = 0; i < 6; ++i) {
              -
              362  READ_BOOL_OR_RETURN(&seq_scaling_list_present_flag);
              -
              363 
              -
              364  if (seq_scaling_list_present_flag) {
              -
              365  res = ParseScalingList(br,
              -
              366  arraysize(sps->scaling_list4x4[i]),
              -
              367  sps->scaling_list4x4[i],
              -
              368  &use_default);
              -
              369  if (res != kOk)
              -
              370  return res;
              -
              371 
              -
              372  if (use_default)
              -
              373  DefaultScalingList4x4(i, sps->scaling_list4x4);
              -
              374 
              -
              375  } else {
              -
              376  FallbackScalingList4x4(
              -
              377  i, kDefault4x4Intra, kDefault4x4Inter, sps->scaling_list4x4);
              -
              378  }
              -
              379  }
              +
              360  if (seq_scaling_list_present_flag) {
              +
              361  res = ParseScalingList(br,
              +
              362  arraysize(sps->scaling_list4x4[i]),
              +
              363  sps->scaling_list4x4[i],
              +
              364  &use_default);
              +
              365  if (res != kOk)
              +
              366  return res;
              +
              367 
              +
              368  if (use_default)
              +
              369  DefaultScalingList4x4(i, sps->scaling_list4x4);
              +
              370 
              +
              371  } else {
              +
              372  FallbackScalingList4x4(
              +
              373  i, kDefault4x4Intra, kDefault4x4Inter, sps->scaling_list4x4);
              +
              374  }
              +
              375  }
              +
              376 
              +
              377  // Parse scaling_list8x8.
              +
              378  for (int i = 0; i < ((sps->chroma_format_idc != 3) ? 2 : 6); ++i) {
              +
              379  READ_BOOL_OR_RETURN(&seq_scaling_list_present_flag);
              380 
              -
              381  // Parse scaling_list8x8.
              -
              382  for (int i = 0; i < ((sps->chroma_format_idc != 3) ? 2 : 6); ++i) {
              -
              383  READ_BOOL_OR_RETURN(&seq_scaling_list_present_flag);
              -
              384 
              -
              385  if (seq_scaling_list_present_flag) {
              -
              386  res = ParseScalingList(br,
              -
              387  arraysize(sps->scaling_list8x8[i]),
              -
              388  sps->scaling_list8x8[i],
              -
              389  &use_default);
              -
              390  if (res != kOk)
              -
              391  return res;
              -
              392 
              -
              393  if (use_default)
              -
              394  DefaultScalingList8x8(i, sps->scaling_list8x8);
              -
              395 
              -
              396  } else {
              -
              397  FallbackScalingList8x8(
              -
              398  i, kDefault8x8Intra, kDefault8x8Inter, sps->scaling_list8x8);
              -
              399  }
              -
              400  }
              -
              401 
              -
              402  return kOk;
              -
              403 }
              -
              404 
              -
              405 H264Parser::Result H264Parser::ParsePpsScalingLists(H26xBitReader* br,
              -
              406  const H264Sps& sps,
              -
              407  H264Pps* pps) {
              -
              408  // See 7.4.2.2.
              -
              409  bool pic_scaling_list_present_flag;
              -
              410  bool use_default;
              -
              411  Result res;
              -
              412 
              -
              413  for (int i = 0; i < 6; ++i) {
              -
              414  READ_BOOL_OR_RETURN(&pic_scaling_list_present_flag);
              -
              415 
              -
              416  if (pic_scaling_list_present_flag) {
              -
              417  res = ParseScalingList(br,
              -
              418  arraysize(pps->scaling_list4x4[i]),
              -
              419  pps->scaling_list4x4[i],
              -
              420  &use_default);
              -
              421  if (res != kOk)
              -
              422  return res;
              -
              423 
              -
              424  if (use_default)
              -
              425  DefaultScalingList4x4(i, pps->scaling_list4x4);
              -
              426 
              -
              427  } else {
              -
              428  if (sps.seq_scaling_matrix_present_flag) {
              -
              429  // Table 7-2 fallback rule A in spec.
              -
              430  FallbackScalingList4x4(
              -
              431  i, kDefault4x4Intra, kDefault4x4Inter, pps->scaling_list4x4);
              -
              432  } else {
              -
              433  // Table 7-2 fallback rule B in spec.
              -
              434  FallbackScalingList4x4(i,
              -
              435  sps.scaling_list4x4[0],
              -
              436  sps.scaling_list4x4[3],
              -
              437  pps->scaling_list4x4);
              -
              438  }
              -
              439  }
              -
              440  }
              +
              381  if (seq_scaling_list_present_flag) {
              +
              382  res = ParseScalingList(br,
              +
              383  arraysize(sps->scaling_list8x8[i]),
              +
              384  sps->scaling_list8x8[i],
              +
              385  &use_default);
              +
              386  if (res != kOk)
              +
              387  return res;
              +
              388 
              +
              389  if (use_default)
              +
              390  DefaultScalingList8x8(i, sps->scaling_list8x8);
              +
              391 
              +
              392  } else {
              +
              393  FallbackScalingList8x8(
              +
              394  i, kDefault8x8Intra, kDefault8x8Inter, sps->scaling_list8x8);
              +
              395  }
              +
              396  }
              +
              397 
              +
              398  return kOk;
              +
              399 }
              +
              400 
              +
              401 H264Parser::Result H264Parser::ParsePpsScalingLists(H26xBitReader* br,
              +
              402  const H264Sps& sps,
              +
              403  H264Pps* pps) {
              +
              404  // See 7.4.2.2.
              +
              405  bool pic_scaling_list_present_flag;
              +
              406  bool use_default;
              +
              407  Result res;
              +
              408 
              +
              409  for (int i = 0; i < 6; ++i) {
              +
              410  READ_BOOL_OR_RETURN(&pic_scaling_list_present_flag);
              +
              411 
              +
              412  if (pic_scaling_list_present_flag) {
              +
              413  res = ParseScalingList(br,
              +
              414  arraysize(pps->scaling_list4x4[i]),
              +
              415  pps->scaling_list4x4[i],
              +
              416  &use_default);
              +
              417  if (res != kOk)
              +
              418  return res;
              +
              419 
              +
              420  if (use_default)
              +
              421  DefaultScalingList4x4(i, pps->scaling_list4x4);
              +
              422 
              +
              423  } else {
              +
              424  if (sps.seq_scaling_matrix_present_flag) {
              +
              425  // Table 7-2 fallback rule A in spec.
              +
              426  FallbackScalingList4x4(
              +
              427  i, kDefault4x4Intra, kDefault4x4Inter, pps->scaling_list4x4);
              +
              428  } else {
              +
              429  // Table 7-2 fallback rule B in spec.
              +
              430  FallbackScalingList4x4(i,
              +
              431  sps.scaling_list4x4[0],
              +
              432  sps.scaling_list4x4[3],
              +
              433  pps->scaling_list4x4);
              +
              434  }
              +
              435  }
              +
              436  }
              +
              437 
              +
              438  if (pps->transform_8x8_mode_flag) {
              +
              439  for (int i = 0; i < ((sps.chroma_format_idc != 3) ? 2 : 6); ++i) {
              +
              440  READ_BOOL_OR_RETURN(&pic_scaling_list_present_flag);
              441 
              -
              442  if (pps->transform_8x8_mode_flag) {
              -
              443  for (int i = 0; i < ((sps.chroma_format_idc != 3) ? 2 : 6); ++i) {
              -
              444  READ_BOOL_OR_RETURN(&pic_scaling_list_present_flag);
              -
              445 
              -
              446  if (pic_scaling_list_present_flag) {
              -
              447  res = ParseScalingList(br,
              -
              448  arraysize(pps->scaling_list8x8[i]),
              -
              449  pps->scaling_list8x8[i],
              -
              450  &use_default);
              -
              451  if (res != kOk)
              -
              452  return res;
              -
              453 
              -
              454  if (use_default)
              -
              455  DefaultScalingList8x8(i, pps->scaling_list8x8);
              -
              456 
              -
              457  } else {
              -
              458  if (sps.seq_scaling_matrix_present_flag) {
              -
              459  // Table 7-2 fallback rule A in spec.
              -
              460  FallbackScalingList8x8(
              -
              461  i, kDefault8x8Intra, kDefault8x8Inter, pps->scaling_list8x8);
              -
              462  } else {
              -
              463  // Table 7-2 fallback rule B in spec.
              -
              464  FallbackScalingList8x8(i,
              -
              465  sps.scaling_list8x8[0],
              -
              466  sps.scaling_list8x8[1],
              -
              467  pps->scaling_list8x8);
              -
              468  }
              -
              469  }
              -
              470  }
              -
              471  }
              -
              472  return kOk;
              -
              473 }
              -
              474 
              -
              475 H264Parser::Result H264Parser::ParseAndIgnoreHRDParameters(
              -
              476  H26xBitReader* br, bool* hrd_parameters_present) {
              -
              477  int data;
              -
              478  READ_BOOL_OR_RETURN(&data); // {nal,vcl}_hrd_parameters_present_flag
              -
              479  if (!data)
              -
              480  return kOk;
              -
              481 
              -
              482  *hrd_parameters_present = true;
              -
              483 
              -
              484  int cpb_cnt_minus1;
              -
              485  READ_UE_OR_RETURN(&cpb_cnt_minus1);
              -
              486  IN_RANGE_OR_RETURN(cpb_cnt_minus1, 0, 31);
              -
              487  READ_BITS_OR_RETURN(8, &data); // bit_rate_scale, cpb_size_scale
              -
              488  for (int i = 0; i <= cpb_cnt_minus1; ++i) {
              -
              489  READ_UE_OR_RETURN(&data); // bit_rate_value_minus1[i]
              -
              490  READ_UE_OR_RETURN(&data); // cpb_size_value_minus1[i]
              -
              491  READ_BOOL_OR_RETURN(&data); // cbr_flag
              -
              492  }
              -
              493  READ_BITS_OR_RETURN(20, &data); // cpb/dpb delays, etc.
              -
              494 
              -
              495  return kOk;
              -
              496 }
              -
              497 
              -
              498 H264Parser::Result H264Parser::ParseVUIParameters(H26xBitReader* br,
              -
              499  H264Sps* sps) {
              -
              500  bool aspect_ratio_info_present_flag;
              -
              501  READ_BOOL_OR_RETURN(&aspect_ratio_info_present_flag);
              -
              502  if (aspect_ratio_info_present_flag) {
              -
              503  int aspect_ratio_idc;
              -
              504  READ_BITS_OR_RETURN(8, &aspect_ratio_idc);
              -
              505  if (aspect_ratio_idc == kExtendedSar) {
              -
              506  READ_BITS_OR_RETURN(16, &sps->sar_width);
              -
              507  READ_BITS_OR_RETURN(16, &sps->sar_height);
              -
              508  } else {
              -
              509  const int max_aspect_ratio_idc = arraysize(kTableSarWidth) - 1;
              -
              510  IN_RANGE_OR_RETURN(aspect_ratio_idc, 0, max_aspect_ratio_idc);
              -
              511  sps->sar_width = kTableSarWidth[aspect_ratio_idc];
              -
              512  sps->sar_height = kTableSarHeight[aspect_ratio_idc];
              -
              513  }
              -
              514  }
              -
              515 
              -
              516  int data;
              -
              517  // Read and ignore overscan and video signal type info.
              -
              518  READ_BOOL_OR_RETURN(&data); // overscan_info_present_flag
              -
              519  if (data)
              -
              520  READ_BOOL_OR_RETURN(&data); // overscan_appropriate_flag
              -
              521 
              -
              522  READ_BOOL_OR_RETURN(&data); // video_signal_type_present_flag
              -
              523  if (data) {
              -
              524  READ_BITS_OR_RETURN(3, &data); // video_format
              -
              525  READ_BOOL_OR_RETURN(&data); // video_full_range_flag
              -
              526  READ_BOOL_OR_RETURN(&data); // colour_description_present_flag
              -
              527  if (data)
              -
              528  READ_BITS_OR_RETURN(24, &data); // color description syntax elements
              -
              529  }
              -
              530 
              -
              531  READ_BOOL_OR_RETURN(&data); // chroma_loc_info_present_flag
              -
              532  if (data) {
              -
              533  READ_UE_OR_RETURN(&data); // chroma_sample_loc_type_top_field
              -
              534  READ_UE_OR_RETURN(&data); // chroma_sample_loc_type_bottom_field
              -
              535  }
              -
              536 
              -
              537  // Read and ignore timing info.
              -
              538  READ_BOOL_OR_RETURN(&data); // timing_info_present_flag
              -
              539  if (data) {
              -
              540  READ_BITS_OR_RETURN(16, &data); // num_units_in_tick
              -
              541  READ_BITS_OR_RETURN(16, &data); // num_units_in_tick
              -
              542  READ_BITS_OR_RETURN(16, &data); // time_scale
              -
              543  READ_BITS_OR_RETURN(16, &data); // time_scale
              -
              544  READ_BOOL_OR_RETURN(&data); // fixed_frame_rate_flag
              -
              545  }
              -
              546 
              -
              547  // Read and ignore NAL HRD parameters, if present.
              -
              548  bool hrd_parameters_present = false;
              -
              549  Result res = ParseAndIgnoreHRDParameters(br, &hrd_parameters_present);
              -
              550  if (res != kOk)
              -
              551  return res;
              -
              552 
              -
              553  // Read and ignore VCL HRD parameters, if present.
              -
              554  res = ParseAndIgnoreHRDParameters(br, &hrd_parameters_present);
              -
              555  if (res != kOk)
              -
              556  return res;
              -
              557 
              -
              558  if (hrd_parameters_present) // One of NAL or VCL params present is enough.
              -
              559  READ_BOOL_OR_RETURN(&data); // low_delay_hrd_flag
              -
              560 
              -
              561  READ_BOOL_OR_RETURN(&data); // pic_struct_present_flag
              -
              562  READ_BOOL_OR_RETURN(&sps->bitstream_restriction_flag);
              -
              563  if (sps->bitstream_restriction_flag) {
              -
              564  READ_BOOL_OR_RETURN(&data); // motion_vectors_over_pic_boundaries_flag
              -
              565  READ_UE_OR_RETURN(&data); // max_bytes_per_pic_denom
              -
              566  READ_UE_OR_RETURN(&data); // max_bits_per_mb_denom
              -
              567  READ_UE_OR_RETURN(&data); // log2_max_mv_length_horizontal
              -
              568  READ_UE_OR_RETURN(&data); // log2_max_mv_length_vertical
              -
              569  READ_UE_OR_RETURN(&sps->max_num_reorder_frames);
              -
              570  READ_UE_OR_RETURN(&sps->max_dec_frame_buffering);
              -
              571  TRUE_OR_RETURN(sps->max_dec_frame_buffering >= sps->max_num_ref_frames);
              -
              572  IN_RANGE_OR_RETURN(
              -
              573  sps->max_num_reorder_frames, 0, sps->max_dec_frame_buffering);
              -
              574  }
              -
              575 
              -
              576  return kOk;
              -
              577 }
              -
              578 
              -
              579 static void FillDefaultSeqScalingLists(H264Sps* sps) {
              -
              580  for (int i = 0; i < 6; ++i)
              -
              581  for (int j = 0; j < kH264ScalingList4x4Length; ++j)
              -
              582  sps->scaling_list4x4[i][j] = 16;
              -
              583 
              -
              584  for (int i = 0; i < 6; ++i)
              -
              585  for (int j = 0; j < kH264ScalingList8x8Length; ++j)
              -
              586  sps->scaling_list8x8[i][j] = 16;
              -
              587 }
              -
              588 
              -
              589 H264Parser::Result H264Parser::ParseSps(const Nalu& nalu, int* sps_id) {
              -
              590  // See 7.4.2.1.
              -
              591  int data;
              -
              592  Result res;
              -
              593  H26xBitReader reader;
              -
              594  reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size());
              -
              595  H26xBitReader* br = &reader;
              +
              442  if (pic_scaling_list_present_flag) {
              +
              443  res = ParseScalingList(br,
              +
              444  arraysize(pps->scaling_list8x8[i]),
              +
              445  pps->scaling_list8x8[i],
              +
              446  &use_default);
              +
              447  if (res != kOk)
              +
              448  return res;
              +
              449 
              +
              450  if (use_default)
              +
              451  DefaultScalingList8x8(i, pps->scaling_list8x8);
              +
              452 
              +
              453  } else {
              +
              454  if (sps.seq_scaling_matrix_present_flag) {
              +
              455  // Table 7-2 fallback rule A in spec.
              +
              456  FallbackScalingList8x8(
              +
              457  i, kDefault8x8Intra, kDefault8x8Inter, pps->scaling_list8x8);
              +
              458  } else {
              +
              459  // Table 7-2 fallback rule B in spec.
              +
              460  FallbackScalingList8x8(i,
              +
              461  sps.scaling_list8x8[0],
              +
              462  sps.scaling_list8x8[1],
              +
              463  pps->scaling_list8x8);
              +
              464  }
              +
              465  }
              +
              466  }
              +
              467  }
              +
              468  return kOk;
              +
              469 }
              +
              470 
              +
              471 H264Parser::Result H264Parser::ParseAndIgnoreHRDParameters(
              +
              472  H26xBitReader* br, bool* hrd_parameters_present) {
              +
              473  int data;
              +
              474  READ_BOOL_OR_RETURN(&data); // {nal,vcl}_hrd_parameters_present_flag
              +
              475  if (!data)
              +
              476  return kOk;
              +
              477 
              +
              478  *hrd_parameters_present = true;
              +
              479 
              +
              480  int cpb_cnt_minus1;
              +
              481  READ_UE_OR_RETURN(&cpb_cnt_minus1);
              +
              482  IN_RANGE_OR_RETURN(cpb_cnt_minus1, 0, 31);
              +
              483  READ_BITS_OR_RETURN(8, &data); // bit_rate_scale, cpb_size_scale
              +
              484  for (int i = 0; i <= cpb_cnt_minus1; ++i) {
              +
              485  READ_UE_OR_RETURN(&data); // bit_rate_value_minus1[i]
              +
              486  READ_UE_OR_RETURN(&data); // cpb_size_value_minus1[i]
              +
              487  READ_BOOL_OR_RETURN(&data); // cbr_flag
              +
              488  }
              +
              489  READ_BITS_OR_RETURN(20, &data); // cpb/dpb delays, etc.
              +
              490 
              +
              491  return kOk;
              +
              492 }
              +
              493 
              +
              494 H264Parser::Result H264Parser::ParseVUIParameters(H26xBitReader* br,
              +
              495  H264Sps* sps) {
              +
              496  bool aspect_ratio_info_present_flag;
              +
              497  READ_BOOL_OR_RETURN(&aspect_ratio_info_present_flag);
              +
              498  if (aspect_ratio_info_present_flag) {
              +
              499  int aspect_ratio_idc;
              +
              500  READ_BITS_OR_RETURN(8, &aspect_ratio_idc);
              +
              501  if (aspect_ratio_idc == kExtendedSar) {
              +
              502  READ_BITS_OR_RETURN(16, &sps->sar_width);
              +
              503  READ_BITS_OR_RETURN(16, &sps->sar_height);
              +
              504  } else {
              +
              505  const int max_aspect_ratio_idc = arraysize(kTableSarWidth) - 1;
              +
              506  IN_RANGE_OR_RETURN(aspect_ratio_idc, 0, max_aspect_ratio_idc);
              +
              507  sps->sar_width = kTableSarWidth[aspect_ratio_idc];
              +
              508  sps->sar_height = kTableSarHeight[aspect_ratio_idc];
              +
              509  }
              +
              510  }
              +
              511 
              +
              512  int data;
              +
              513  // Read and ignore overscan and video signal type info.
              +
              514  READ_BOOL_OR_RETURN(&data); // overscan_info_present_flag
              +
              515  if (data)
              +
              516  READ_BOOL_OR_RETURN(&data); // overscan_appropriate_flag
              +
              517 
              +
              518  READ_BOOL_OR_RETURN(&data); // video_signal_type_present_flag
              +
              519  if (data) {
              +
              520  READ_BITS_OR_RETURN(3, &data); // video_format
              +
              521  READ_BOOL_OR_RETURN(&data); // video_full_range_flag
              +
              522  READ_BOOL_OR_RETURN(&data); // colour_description_present_flag
              +
              523  if (data)
              +
              524  READ_BITS_OR_RETURN(24, &data); // color description syntax elements
              +
              525  }
              +
              526 
              +
              527  READ_BOOL_OR_RETURN(&data); // chroma_loc_info_present_flag
              +
              528  if (data) {
              +
              529  READ_UE_OR_RETURN(&data); // chroma_sample_loc_type_top_field
              +
              530  READ_UE_OR_RETURN(&data); // chroma_sample_loc_type_bottom_field
              +
              531  }
              +
              532 
              +
              533  // Read and ignore timing info.
              +
              534  READ_BOOL_OR_RETURN(&data); // timing_info_present_flag
              +
              535  if (data) {
              +
              536  READ_BITS_OR_RETURN(16, &data); // num_units_in_tick
              +
              537  READ_BITS_OR_RETURN(16, &data); // num_units_in_tick
              +
              538  READ_BITS_OR_RETURN(16, &data); // time_scale
              +
              539  READ_BITS_OR_RETURN(16, &data); // time_scale
              +
              540  READ_BOOL_OR_RETURN(&data); // fixed_frame_rate_flag
              +
              541  }
              +
              542 
              +
              543  // Read and ignore NAL HRD parameters, if present.
              +
              544  bool hrd_parameters_present = false;
              +
              545  Result res = ParseAndIgnoreHRDParameters(br, &hrd_parameters_present);
              +
              546  if (res != kOk)
              +
              547  return res;
              +
              548 
              +
              549  // Read and ignore VCL HRD parameters, if present.
              +
              550  res = ParseAndIgnoreHRDParameters(br, &hrd_parameters_present);
              +
              551  if (res != kOk)
              +
              552  return res;
              +
              553 
              +
              554  if (hrd_parameters_present) // One of NAL or VCL params present is enough.
              +
              555  READ_BOOL_OR_RETURN(&data); // low_delay_hrd_flag
              +
              556 
              +
              557  READ_BOOL_OR_RETURN(&data); // pic_struct_present_flag
              +
              558  READ_BOOL_OR_RETURN(&sps->bitstream_restriction_flag);
              +
              559  if (sps->bitstream_restriction_flag) {
              +
              560  READ_BOOL_OR_RETURN(&data); // motion_vectors_over_pic_boundaries_flag
              +
              561  READ_UE_OR_RETURN(&data); // max_bytes_per_pic_denom
              +
              562  READ_UE_OR_RETURN(&data); // max_bits_per_mb_denom
              +
              563  READ_UE_OR_RETURN(&data); // log2_max_mv_length_horizontal
              +
              564  READ_UE_OR_RETURN(&data); // log2_max_mv_length_vertical
              +
              565  READ_UE_OR_RETURN(&sps->max_num_reorder_frames);
              +
              566  READ_UE_OR_RETURN(&sps->max_dec_frame_buffering);
              +
              567  TRUE_OR_RETURN(sps->max_dec_frame_buffering >= sps->max_num_ref_frames);
              +
              568  IN_RANGE_OR_RETURN(
              +
              569  sps->max_num_reorder_frames, 0, sps->max_dec_frame_buffering);
              +
              570  }
              +
              571 
              +
              572  return kOk;
              +
              573 }
              +
              574 
              +
              575 static void FillDefaultSeqScalingLists(H264Sps* sps) {
              +
              576  for (int i = 0; i < 6; ++i)
              +
              577  for (int j = 0; j < kH264ScalingList4x4Length; ++j)
              +
              578  sps->scaling_list4x4[i][j] = 16;
              +
              579 
              +
              580  for (int i = 0; i < 6; ++i)
              +
              581  for (int j = 0; j < kH264ScalingList8x8Length; ++j)
              +
              582  sps->scaling_list8x8[i][j] = 16;
              +
              583 }
              +
              584 
              +
              585 H264Parser::Result H264Parser::ParseSps(const Nalu& nalu, int* sps_id) {
              +
              586  // See 7.4.2.1.
              +
              587  int data;
              +
              588  Result res;
              +
              589  H26xBitReader reader;
              +
              590  reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size());
              +
              591  H26xBitReader* br = &reader;
              +
              592 
              +
              593  *sps_id = -1;
              +
              594 
              +
              595  std::unique_ptr<H264Sps> sps(new H264Sps());
              596 
              -
              597  *sps_id = -1;
              -
              598 
              -
              599  std::unique_ptr<H264Sps> sps(new H264Sps());
              -
              600 
              -
              601  READ_BITS_OR_RETURN(8, &sps->profile_idc);
              -
              602  READ_BOOL_OR_RETURN(&sps->constraint_set0_flag);
              -
              603  READ_BOOL_OR_RETURN(&sps->constraint_set1_flag);
              -
              604  READ_BOOL_OR_RETURN(&sps->constraint_set2_flag);
              -
              605  READ_BOOL_OR_RETURN(&sps->constraint_set3_flag);
              -
              606  READ_BOOL_OR_RETURN(&sps->constraint_set4_flag);
              -
              607  READ_BOOL_OR_RETURN(&sps->constraint_set5_flag);
              -
              608  READ_BITS_OR_RETURN(2, &data); // reserved_zero_2bits
              -
              609  READ_BITS_OR_RETURN(8, &sps->level_idc);
              -
              610  READ_UE_OR_RETURN(&sps->seq_parameter_set_id);
              -
              611  TRUE_OR_RETURN(sps->seq_parameter_set_id < 32);
              -
              612 
              -
              613  if (sps->profile_idc == 100 || sps->profile_idc == 110 ||
              -
              614  sps->profile_idc == 122 || sps->profile_idc == 244 ||
              -
              615  sps->profile_idc == 44 || sps->profile_idc == 83 ||
              -
              616  sps->profile_idc == 86 || sps->profile_idc == 118 ||
              -
              617  sps->profile_idc == 128) {
              -
              618  READ_UE_OR_RETURN(&sps->chroma_format_idc);
              -
              619  TRUE_OR_RETURN(sps->chroma_format_idc < 4);
              -
              620 
              -
              621  if (sps->chroma_format_idc == 3)
              -
              622  READ_BOOL_OR_RETURN(&sps->separate_colour_plane_flag);
              -
              623 
              -
              624  READ_UE_OR_RETURN(&sps->bit_depth_luma_minus8);
              -
              625  TRUE_OR_RETURN(sps->bit_depth_luma_minus8 < 7);
              -
              626 
              -
              627  READ_UE_OR_RETURN(&sps->bit_depth_chroma_minus8);
              -
              628  TRUE_OR_RETURN(sps->bit_depth_chroma_minus8 < 7);
              -
              629 
              -
              630  READ_BOOL_OR_RETURN(&sps->qpprime_y_zero_transform_bypass_flag);
              -
              631  READ_BOOL_OR_RETURN(&sps->seq_scaling_matrix_present_flag);
              -
              632 
              -
              633  if (sps->seq_scaling_matrix_present_flag) {
              -
              634  DVLOG(4) << "Scaling matrix present";
              -
              635  res = ParseSpsScalingLists(br, sps.get());
              -
              636  if (res != kOk)
              -
              637  return res;
              -
              638  } else {
              -
              639  FillDefaultSeqScalingLists(sps.get());
              -
              640  }
              -
              641  } else {
              -
              642  sps->chroma_format_idc = 1;
              -
              643  FillDefaultSeqScalingLists(sps.get());
              -
              644  }
              -
              645 
              -
              646  if (sps->separate_colour_plane_flag)
              -
              647  sps->chroma_array_type = 0;
              -
              648  else
              -
              649  sps->chroma_array_type = sps->chroma_format_idc;
              -
              650 
              -
              651  READ_UE_OR_RETURN(&sps->log2_max_frame_num_minus4);
              -
              652  TRUE_OR_RETURN(sps->log2_max_frame_num_minus4 < 13);
              -
              653 
              -
              654  READ_UE_OR_RETURN(&sps->pic_order_cnt_type);
              -
              655  TRUE_OR_RETURN(sps->pic_order_cnt_type < 3);
              -
              656 
              -
              657  sps->expected_delta_per_pic_order_cnt_cycle = 0;
              -
              658  if (sps->pic_order_cnt_type == 0) {
              -
              659  READ_UE_OR_RETURN(&sps->log2_max_pic_order_cnt_lsb_minus4);
              -
              660  TRUE_OR_RETURN(sps->log2_max_pic_order_cnt_lsb_minus4 < 13);
              -
              661  } else if (sps->pic_order_cnt_type == 1) {
              -
              662  READ_BOOL_OR_RETURN(&sps->delta_pic_order_always_zero_flag);
              -
              663  READ_SE_OR_RETURN(&sps->offset_for_non_ref_pic);
              -
              664  READ_SE_OR_RETURN(&sps->offset_for_top_to_bottom_field);
              -
              665  READ_UE_OR_RETURN(&sps->num_ref_frames_in_pic_order_cnt_cycle);
              -
              666  TRUE_OR_RETURN(sps->num_ref_frames_in_pic_order_cnt_cycle < 255);
              -
              667 
              -
              668  for (int i = 0; i < sps->num_ref_frames_in_pic_order_cnt_cycle; ++i) {
              -
              669  READ_SE_OR_RETURN(&sps->offset_for_ref_frame[i]);
              -
              670  sps->expected_delta_per_pic_order_cnt_cycle +=
              -
              671  sps->offset_for_ref_frame[i];
              -
              672  }
              -
              673  }
              -
              674 
              -
              675  READ_UE_OR_RETURN(&sps->max_num_ref_frames);
              -
              676  READ_BOOL_OR_RETURN(&sps->gaps_in_frame_num_value_allowed_flag);
              -
              677 
              -
              678  READ_UE_OR_RETURN(&sps->pic_width_in_mbs_minus1);
              -
              679  READ_UE_OR_RETURN(&sps->pic_height_in_map_units_minus1);
              +
              597  READ_BITS_OR_RETURN(8, &sps->profile_idc);
              +
              598  READ_BOOL_OR_RETURN(&sps->constraint_set0_flag);
              +
              599  READ_BOOL_OR_RETURN(&sps->constraint_set1_flag);
              +
              600  READ_BOOL_OR_RETURN(&sps->constraint_set2_flag);
              +
              601  READ_BOOL_OR_RETURN(&sps->constraint_set3_flag);
              +
              602  READ_BOOL_OR_RETURN(&sps->constraint_set4_flag);
              +
              603  READ_BOOL_OR_RETURN(&sps->constraint_set5_flag);
              +
              604  READ_BITS_OR_RETURN(2, &data); // reserved_zero_2bits
              +
              605  READ_BITS_OR_RETURN(8, &sps->level_idc);
              +
              606  READ_UE_OR_RETURN(&sps->seq_parameter_set_id);
              +
              607  TRUE_OR_RETURN(sps->seq_parameter_set_id < 32);
              +
              608 
              +
              609  if (sps->profile_idc == 100 || sps->profile_idc == 110 ||
              +
              610  sps->profile_idc == 122 || sps->profile_idc == 244 ||
              +
              611  sps->profile_idc == 44 || sps->profile_idc == 83 ||
              +
              612  sps->profile_idc == 86 || sps->profile_idc == 118 ||
              +
              613  sps->profile_idc == 128) {
              +
              614  READ_UE_OR_RETURN(&sps->chroma_format_idc);
              +
              615  TRUE_OR_RETURN(sps->chroma_format_idc < 4);
              +
              616 
              +
              617  if (sps->chroma_format_idc == 3)
              +
              618  READ_BOOL_OR_RETURN(&sps->separate_colour_plane_flag);
              +
              619 
              +
              620  READ_UE_OR_RETURN(&sps->bit_depth_luma_minus8);
              +
              621  TRUE_OR_RETURN(sps->bit_depth_luma_minus8 < 7);
              +
              622 
              +
              623  READ_UE_OR_RETURN(&sps->bit_depth_chroma_minus8);
              +
              624  TRUE_OR_RETURN(sps->bit_depth_chroma_minus8 < 7);
              +
              625 
              +
              626  READ_BOOL_OR_RETURN(&sps->qpprime_y_zero_transform_bypass_flag);
              +
              627  READ_BOOL_OR_RETURN(&sps->seq_scaling_matrix_present_flag);
              +
              628 
              +
              629  if (sps->seq_scaling_matrix_present_flag) {
              +
              630  DVLOG(4) << "Scaling matrix present";
              +
              631  res = ParseSpsScalingLists(br, sps.get());
              +
              632  if (res != kOk)
              +
              633  return res;
              +
              634  } else {
              +
              635  FillDefaultSeqScalingLists(sps.get());
              +
              636  }
              +
              637  } else {
              +
              638  sps->chroma_format_idc = 1;
              +
              639  FillDefaultSeqScalingLists(sps.get());
              +
              640  }
              +
              641 
              +
              642  if (sps->separate_colour_plane_flag)
              +
              643  sps->chroma_array_type = 0;
              +
              644  else
              +
              645  sps->chroma_array_type = sps->chroma_format_idc;
              +
              646 
              +
              647  READ_UE_OR_RETURN(&sps->log2_max_frame_num_minus4);
              +
              648  TRUE_OR_RETURN(sps->log2_max_frame_num_minus4 < 13);
              +
              649 
              +
              650  READ_UE_OR_RETURN(&sps->pic_order_cnt_type);
              +
              651  TRUE_OR_RETURN(sps->pic_order_cnt_type < 3);
              +
              652 
              +
              653  sps->expected_delta_per_pic_order_cnt_cycle = 0;
              +
              654  if (sps->pic_order_cnt_type == 0) {
              +
              655  READ_UE_OR_RETURN(&sps->log2_max_pic_order_cnt_lsb_minus4);
              +
              656  TRUE_OR_RETURN(sps->log2_max_pic_order_cnt_lsb_minus4 < 13);
              +
              657  } else if (sps->pic_order_cnt_type == 1) {
              +
              658  READ_BOOL_OR_RETURN(&sps->delta_pic_order_always_zero_flag);
              +
              659  READ_SE_OR_RETURN(&sps->offset_for_non_ref_pic);
              +
              660  READ_SE_OR_RETURN(&sps->offset_for_top_to_bottom_field);
              +
              661  READ_UE_OR_RETURN(&sps->num_ref_frames_in_pic_order_cnt_cycle);
              +
              662  TRUE_OR_RETURN(sps->num_ref_frames_in_pic_order_cnt_cycle < 255);
              +
              663 
              +
              664  for (int i = 0; i < sps->num_ref_frames_in_pic_order_cnt_cycle; ++i) {
              +
              665  READ_SE_OR_RETURN(&sps->offset_for_ref_frame[i]);
              +
              666  sps->expected_delta_per_pic_order_cnt_cycle +=
              +
              667  sps->offset_for_ref_frame[i];
              +
              668  }
              +
              669  }
              +
              670 
              +
              671  READ_UE_OR_RETURN(&sps->max_num_ref_frames);
              +
              672  READ_BOOL_OR_RETURN(&sps->gaps_in_frame_num_value_allowed_flag);
              +
              673 
              +
              674  READ_UE_OR_RETURN(&sps->pic_width_in_mbs_minus1);
              +
              675  READ_UE_OR_RETURN(&sps->pic_height_in_map_units_minus1);
              +
              676 
              +
              677  READ_BOOL_OR_RETURN(&sps->frame_mbs_only_flag);
              +
              678  if (!sps->frame_mbs_only_flag)
              +
              679  READ_BOOL_OR_RETURN(&sps->mb_adaptive_frame_field_flag);
              680 
              -
              681  READ_BOOL_OR_RETURN(&sps->frame_mbs_only_flag);
              -
              682  if (!sps->frame_mbs_only_flag)
              -
              683  READ_BOOL_OR_RETURN(&sps->mb_adaptive_frame_field_flag);
              -
              684 
              -
              685  READ_BOOL_OR_RETURN(&sps->direct_8x8_inference_flag);
              -
              686 
              -
              687  READ_BOOL_OR_RETURN(&sps->frame_cropping_flag);
              -
              688  if (sps->frame_cropping_flag) {
              -
              689  READ_UE_OR_RETURN(&sps->frame_crop_left_offset);
              -
              690  READ_UE_OR_RETURN(&sps->frame_crop_right_offset);
              -
              691  READ_UE_OR_RETURN(&sps->frame_crop_top_offset);
              -
              692  READ_UE_OR_RETURN(&sps->frame_crop_bottom_offset);
              -
              693  }
              -
              694 
              -
              695  READ_BOOL_OR_RETURN(&sps->vui_parameters_present_flag);
              -
              696  if (sps->vui_parameters_present_flag) {
              -
              697  DVLOG(4) << "VUI parameters present";
              -
              698  res = ParseVUIParameters(br, sps.get());
              -
              699  if (res != kOk)
              -
              700  return res;
              -
              701  }
              +
              681  READ_BOOL_OR_RETURN(&sps->direct_8x8_inference_flag);
              +
              682 
              +
              683  READ_BOOL_OR_RETURN(&sps->frame_cropping_flag);
              +
              684  if (sps->frame_cropping_flag) {
              +
              685  READ_UE_OR_RETURN(&sps->frame_crop_left_offset);
              +
              686  READ_UE_OR_RETURN(&sps->frame_crop_right_offset);
              +
              687  READ_UE_OR_RETURN(&sps->frame_crop_top_offset);
              +
              688  READ_UE_OR_RETURN(&sps->frame_crop_bottom_offset);
              +
              689  }
              +
              690 
              +
              691  READ_BOOL_OR_RETURN(&sps->vui_parameters_present_flag);
              +
              692  if (sps->vui_parameters_present_flag) {
              +
              693  DVLOG(4) << "VUI parameters present";
              +
              694  res = ParseVUIParameters(br, sps.get());
              +
              695  if (res != kOk)
              +
              696  return res;
              +
              697  }
              +
              698 
              +
              699  // If an SPS with the same id already exists, replace it.
              +
              700  *sps_id = sps->seq_parameter_set_id;
              +
              701  active_SPSes_[*sps_id] = std::move(sps);
              702 
              -
              703  // If an SPS with the same id already exists, replace it.
              -
              704  *sps_id = sps->seq_parameter_set_id;
              -
              705  delete active_SPSes_[*sps_id];
              -
              706  active_SPSes_[*sps_id] = sps.release();
              -
              707 
              -
              708  return kOk;
              -
              709 }
              -
              710 
              -
              711 H264Parser::Result H264Parser::ParsePps(const Nalu& nalu, int* pps_id) {
              -
              712  // See 7.4.2.2.
              -
              713  const H264Sps* sps;
              -
              714  Result res;
              -
              715  H26xBitReader reader;
              -
              716  reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size());
              -
              717  H26xBitReader* br = &reader;
              -
              718 
              -
              719  *pps_id = -1;
              -
              720 
              -
              721  std::unique_ptr<H264Pps> pps(new H264Pps());
              -
              722 
              -
              723  READ_UE_OR_RETURN(&pps->pic_parameter_set_id);
              -
              724  READ_UE_OR_RETURN(&pps->seq_parameter_set_id);
              -
              725  TRUE_OR_RETURN(pps->seq_parameter_set_id < 32);
              -
              726 
              -
              727  sps = GetSps(pps->seq_parameter_set_id);
              -
              728  TRUE_OR_RETURN(sps);
              -
              729 
              -
              730  READ_BOOL_OR_RETURN(&pps->entropy_coding_mode_flag);
              -
              731  READ_BOOL_OR_RETURN(&pps->bottom_field_pic_order_in_frame_present_flag);
              -
              732 
              -
              733  READ_UE_OR_RETURN(&pps->num_slice_groups_minus1);
              -
              734  if (pps->num_slice_groups_minus1 > 1) {
              -
              735  DVLOG(1) << "Slice groups not supported";
              -
              736  return kUnsupportedStream;
              -
              737  }
              -
              738 
              -
              739  READ_UE_OR_RETURN(&pps->num_ref_idx_l0_default_active_minus1);
              -
              740  TRUE_OR_RETURN(pps->num_ref_idx_l0_default_active_minus1 < 32);
              -
              741 
              -
              742  READ_UE_OR_RETURN(&pps->num_ref_idx_l1_default_active_minus1);
              -
              743  TRUE_OR_RETURN(pps->num_ref_idx_l1_default_active_minus1 < 32);
              -
              744 
              -
              745  READ_BOOL_OR_RETURN(&pps->weighted_pred_flag);
              -
              746  READ_BITS_OR_RETURN(2, &pps->weighted_bipred_idc);
              -
              747  TRUE_OR_RETURN(pps->weighted_bipred_idc < 3);
              -
              748 
              -
              749  READ_SE_OR_RETURN(&pps->pic_init_qp_minus26);
              -
              750  IN_RANGE_OR_RETURN(pps->pic_init_qp_minus26, -26, 25);
              -
              751 
              -
              752  READ_SE_OR_RETURN(&pps->pic_init_qs_minus26);
              -
              753  IN_RANGE_OR_RETURN(pps->pic_init_qs_minus26, -26, 25);
              -
              754 
              -
              755  READ_SE_OR_RETURN(&pps->chroma_qp_index_offset);
              -
              756  IN_RANGE_OR_RETURN(pps->chroma_qp_index_offset, -12, 12);
              -
              757  pps->second_chroma_qp_index_offset = pps->chroma_qp_index_offset;
              -
              758 
              -
              759  READ_BOOL_OR_RETURN(&pps->deblocking_filter_control_present_flag);
              -
              760  READ_BOOL_OR_RETURN(&pps->constrained_intra_pred_flag);
              -
              761  READ_BOOL_OR_RETURN(&pps->redundant_pic_cnt_present_flag);
              -
              762 
              -
              763  if (br->HasMoreRBSPData()) {
              -
              764  READ_BOOL_OR_RETURN(&pps->transform_8x8_mode_flag);
              -
              765  READ_BOOL_OR_RETURN(&pps->pic_scaling_matrix_present_flag);
              -
              766 
              -
              767  if (pps->pic_scaling_matrix_present_flag) {
              -
              768  DVLOG(4) << "Picture scaling matrix present";
              -
              769  res = ParsePpsScalingLists(br, *sps, pps.get());
              -
              770  if (res != kOk)
              -
              771  return res;
              -
              772  }
              -
              773 
              -
              774  READ_SE_OR_RETURN(&pps->second_chroma_qp_index_offset);
              -
              775  }
              -
              776 
              -
              777  // If a PPS with the same id already exists, replace it.
              -
              778  *pps_id = pps->pic_parameter_set_id;
              -
              779  delete active_PPSes_[*pps_id];
              -
              780  active_PPSes_[*pps_id] = pps.release();
              -
              781 
              -
              782  return kOk;
              -
              783 }
              +
              703  return kOk;
              +
              704 }
              +
              705 
              +
              706 H264Parser::Result H264Parser::ParsePps(const Nalu& nalu, int* pps_id) {
              +
              707  // See 7.4.2.2.
              +
              708  const H264Sps* sps;
              +
              709  Result res;
              +
              710  H26xBitReader reader;
              +
              711  reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size());
              +
              712  H26xBitReader* br = &reader;
              +
              713 
              +
              714  *pps_id = -1;
              +
              715 
              +
              716  std::unique_ptr<H264Pps> pps(new H264Pps());
              +
              717 
              +
              718  READ_UE_OR_RETURN(&pps->pic_parameter_set_id);
              +
              719  READ_UE_OR_RETURN(&pps->seq_parameter_set_id);
              +
              720  TRUE_OR_RETURN(pps->seq_parameter_set_id < 32);
              +
              721 
              +
              722  sps = GetSps(pps->seq_parameter_set_id);
              +
              723  TRUE_OR_RETURN(sps);
              +
              724 
              +
              725  READ_BOOL_OR_RETURN(&pps->entropy_coding_mode_flag);
              +
              726  READ_BOOL_OR_RETURN(&pps->bottom_field_pic_order_in_frame_present_flag);
              +
              727 
              +
              728  READ_UE_OR_RETURN(&pps->num_slice_groups_minus1);
              +
              729  if (pps->num_slice_groups_minus1 > 1) {
              +
              730  DVLOG(1) << "Slice groups not supported";
              +
              731  return kUnsupportedStream;
              +
              732  }
              +
              733 
              +
              734  READ_UE_OR_RETURN(&pps->num_ref_idx_l0_default_active_minus1);
              +
              735  TRUE_OR_RETURN(pps->num_ref_idx_l0_default_active_minus1 < 32);
              +
              736 
              +
              737  READ_UE_OR_RETURN(&pps->num_ref_idx_l1_default_active_minus1);
              +
              738  TRUE_OR_RETURN(pps->num_ref_idx_l1_default_active_minus1 < 32);
              +
              739 
              +
              740  READ_BOOL_OR_RETURN(&pps->weighted_pred_flag);
              +
              741  READ_BITS_OR_RETURN(2, &pps->weighted_bipred_idc);
              +
              742  TRUE_OR_RETURN(pps->weighted_bipred_idc < 3);
              +
              743 
              +
              744  READ_SE_OR_RETURN(&pps->pic_init_qp_minus26);
              +
              745  IN_RANGE_OR_RETURN(pps->pic_init_qp_minus26, -26, 25);
              +
              746 
              +
              747  READ_SE_OR_RETURN(&pps->pic_init_qs_minus26);
              +
              748  IN_RANGE_OR_RETURN(pps->pic_init_qs_minus26, -26, 25);
              +
              749 
              +
              750  READ_SE_OR_RETURN(&pps->chroma_qp_index_offset);
              +
              751  IN_RANGE_OR_RETURN(pps->chroma_qp_index_offset, -12, 12);
              +
              752  pps->second_chroma_qp_index_offset = pps->chroma_qp_index_offset;
              +
              753 
              +
              754  READ_BOOL_OR_RETURN(&pps->deblocking_filter_control_present_flag);
              +
              755  READ_BOOL_OR_RETURN(&pps->constrained_intra_pred_flag);
              +
              756  READ_BOOL_OR_RETURN(&pps->redundant_pic_cnt_present_flag);
              +
              757 
              +
              758  if (br->HasMoreRBSPData()) {
              +
              759  READ_BOOL_OR_RETURN(&pps->transform_8x8_mode_flag);
              +
              760  READ_BOOL_OR_RETURN(&pps->pic_scaling_matrix_present_flag);
              +
              761 
              +
              762  if (pps->pic_scaling_matrix_present_flag) {
              +
              763  DVLOG(4) << "Picture scaling matrix present";
              +
              764  res = ParsePpsScalingLists(br, *sps, pps.get());
              +
              765  if (res != kOk)
              +
              766  return res;
              +
              767  }
              +
              768 
              +
              769  READ_SE_OR_RETURN(&pps->second_chroma_qp_index_offset);
              +
              770  }
              +
              771 
              +
              772  // If a PPS with the same id already exists, replace it.
              +
              773  *pps_id = pps->pic_parameter_set_id;
              +
              774  active_PPSes_[*pps_id] = std::move(pps);
              +
              775 
              +
              776  return kOk;
              +
              777 }
              +
              778 
              +
              779 H264Parser::Result H264Parser::ParseRefPicListModification(
              +
              780  H26xBitReader* br,
              +
              781  int num_ref_idx_active_minus1,
              +
              782  H264ModificationOfPicNum* ref_list_mods) {
              +
              783  H264ModificationOfPicNum* pic_num_mod;
              784 
              -
              785 H264Parser::Result H264Parser::ParseRefPicListModification(
              -
              786  H26xBitReader* br,
              -
              787  int num_ref_idx_active_minus1,
              -
              788  H264ModificationOfPicNum* ref_list_mods) {
              -
              789  H264ModificationOfPicNum* pic_num_mod;
              -
              790 
              -
              791  if (num_ref_idx_active_minus1 >= 32)
              -
              792  return kInvalidStream;
              -
              793 
              -
              794  for (int i = 0; i < 32; ++i) {
              -
              795  pic_num_mod = &ref_list_mods[i];
              -
              796  READ_UE_OR_RETURN(&pic_num_mod->modification_of_pic_nums_idc);
              -
              797  TRUE_OR_RETURN(pic_num_mod->modification_of_pic_nums_idc < 4);
              +
              785  if (num_ref_idx_active_minus1 >= 32)
              +
              786  return kInvalidStream;
              +
              787 
              +
              788  for (int i = 0; i < 32; ++i) {
              +
              789  pic_num_mod = &ref_list_mods[i];
              +
              790  READ_UE_OR_RETURN(&pic_num_mod->modification_of_pic_nums_idc);
              +
              791  TRUE_OR_RETURN(pic_num_mod->modification_of_pic_nums_idc < 4);
              +
              792 
              +
              793  switch (pic_num_mod->modification_of_pic_nums_idc) {
              +
              794  case 0:
              +
              795  case 1:
              +
              796  READ_UE_OR_RETURN(&pic_num_mod->abs_diff_pic_num_minus1);
              +
              797  break;
              798 
              -
              799  switch (pic_num_mod->modification_of_pic_nums_idc) {
              -
              800  case 0:
              -
              801  case 1:
              -
              802  READ_UE_OR_RETURN(&pic_num_mod->abs_diff_pic_num_minus1);
              -
              803  break;
              -
              804 
              -
              805  case 2:
              -
              806  READ_UE_OR_RETURN(&pic_num_mod->long_term_pic_num);
              -
              807  break;
              +
              799  case 2:
              +
              800  READ_UE_OR_RETURN(&pic_num_mod->long_term_pic_num);
              +
              801  break;
              +
              802 
              +
              803  case 3:
              +
              804  // Per spec, list cannot be empty.
              +
              805  if (i == 0)
              +
              806  return kInvalidStream;
              +
              807  return kOk;
              808 
              -
              809  case 3:
              -
              810  // Per spec, list cannot be empty.
              -
              811  if (i == 0)
              -
              812  return kInvalidStream;
              -
              813  return kOk;
              -
              814 
              -
              815  default:
              -
              816  return kInvalidStream;
              -
              817  }
              -
              818  }
              +
              809  default:
              +
              810  return kInvalidStream;
              +
              811  }
              +
              812  }
              +
              813 
              +
              814  // If we got here, we didn't get loop end marker prematurely,
              +
              815  // so make sure it is there for our client.
              +
              816  int modification_of_pic_nums_idc;
              +
              817  READ_UE_OR_RETURN(&modification_of_pic_nums_idc);
              +
              818  TRUE_OR_RETURN(modification_of_pic_nums_idc == 3);
              819 
              -
              820  // If we got here, we didn't get loop end marker prematurely,
              -
              821  // so make sure it is there for our client.
              -
              822  int modification_of_pic_nums_idc;
              -
              823  READ_UE_OR_RETURN(&modification_of_pic_nums_idc);
              -
              824  TRUE_OR_RETURN(modification_of_pic_nums_idc == 3);
              -
              825 
              -
              826  return kOk;
              -
              827 }
              -
              828 
              -
              829 H264Parser::Result H264Parser::ParseRefPicListModifications(
              -
              830  H26xBitReader* br, H264SliceHeader* shdr) {
              -
              831  Result res;
              -
              832 
              -
              833  if (!shdr->IsISlice() && !shdr->IsSISlice()) {
              -
              834  READ_BOOL_OR_RETURN(&shdr->ref_pic_list_modification_flag_l0);
              -
              835  if (shdr->ref_pic_list_modification_flag_l0) {
              -
              836  res = ParseRefPicListModification(br, shdr->num_ref_idx_l0_active_minus1,
              -
              837  shdr->ref_list_l0_modifications);
              -
              838  if (res != kOk)
              -
              839  return res;
              -
              840  }
              -
              841  }
              -
              842 
              -
              843  if (shdr->IsBSlice()) {
              -
              844  READ_BOOL_OR_RETURN(&shdr->ref_pic_list_modification_flag_l1);
              -
              845  if (shdr->ref_pic_list_modification_flag_l1) {
              -
              846  res = ParseRefPicListModification(br, shdr->num_ref_idx_l1_active_minus1,
              -
              847  shdr->ref_list_l1_modifications);
              -
              848  if (res != kOk)
              -
              849  return res;
              -
              850  }
              -
              851  }
              -
              852 
              -
              853  return kOk;
              -
              854 }
              -
              855 
              -
              856 H264Parser::Result H264Parser::ParseWeightingFactors(
              -
              857  H26xBitReader* br,
              -
              858  int num_ref_idx_active_minus1,
              -
              859  int chroma_array_type,
              -
              860  int luma_log2_weight_denom,
              -
              861  int chroma_log2_weight_denom,
              -
              862  H264WeightingFactors* w_facts) {
              -
              863  int def_luma_weight = 1 << luma_log2_weight_denom;
              -
              864  int def_chroma_weight = 1 << chroma_log2_weight_denom;
              +
              820  return kOk;
              +
              821 }
              +
              822 
              +
              823 H264Parser::Result H264Parser::ParseRefPicListModifications(
              +
              824  H26xBitReader* br, H264SliceHeader* shdr) {
              +
              825  Result res;
              +
              826 
              +
              827  if (!shdr->IsISlice() && !shdr->IsSISlice()) {
              +
              828  READ_BOOL_OR_RETURN(&shdr->ref_pic_list_modification_flag_l0);
              +
              829  if (shdr->ref_pic_list_modification_flag_l0) {
              +
              830  res = ParseRefPicListModification(br, shdr->num_ref_idx_l0_active_minus1,
              +
              831  shdr->ref_list_l0_modifications);
              +
              832  if (res != kOk)
              +
              833  return res;
              +
              834  }
              +
              835  }
              +
              836 
              +
              837  if (shdr->IsBSlice()) {
              +
              838  READ_BOOL_OR_RETURN(&shdr->ref_pic_list_modification_flag_l1);
              +
              839  if (shdr->ref_pic_list_modification_flag_l1) {
              +
              840  res = ParseRefPicListModification(br, shdr->num_ref_idx_l1_active_minus1,
              +
              841  shdr->ref_list_l1_modifications);
              +
              842  if (res != kOk)
              +
              843  return res;
              +
              844  }
              +
              845  }
              +
              846 
              +
              847  return kOk;
              +
              848 }
              +
              849 
              +
              850 H264Parser::Result H264Parser::ParseWeightingFactors(
              +
              851  H26xBitReader* br,
              +
              852  int num_ref_idx_active_minus1,
              +
              853  int chroma_array_type,
              +
              854  int luma_log2_weight_denom,
              +
              855  int chroma_log2_weight_denom,
              +
              856  H264WeightingFactors* w_facts) {
              +
              857  int def_luma_weight = 1 << luma_log2_weight_denom;
              +
              858  int def_chroma_weight = 1 << chroma_log2_weight_denom;
              +
              859 
              +
              860  for (int i = 0; i < num_ref_idx_active_minus1 + 1; ++i) {
              +
              861  READ_BOOL_OR_RETURN(&w_facts->luma_weight_flag);
              +
              862  if (w_facts->luma_weight_flag) {
              +
              863  READ_SE_OR_RETURN(&w_facts->luma_weight[i]);
              +
              864  IN_RANGE_OR_RETURN(w_facts->luma_weight[i], -128, 127);
              865 
              -
              866  for (int i = 0; i < num_ref_idx_active_minus1 + 1; ++i) {
              -
              867  READ_BOOL_OR_RETURN(&w_facts->luma_weight_flag);
              -
              868  if (w_facts->luma_weight_flag) {
              -
              869  READ_SE_OR_RETURN(&w_facts->luma_weight[i]);
              -
              870  IN_RANGE_OR_RETURN(w_facts->luma_weight[i], -128, 127);
              -
              871 
              -
              872  READ_SE_OR_RETURN(&w_facts->luma_offset[i]);
              -
              873  IN_RANGE_OR_RETURN(w_facts->luma_offset[i], -128, 127);
              -
              874  } else {
              -
              875  w_facts->luma_weight[i] = def_luma_weight;
              -
              876  w_facts->luma_offset[i] = 0;
              -
              877  }
              -
              878 
              -
              879  if (chroma_array_type != 0) {
              -
              880  READ_BOOL_OR_RETURN(&w_facts->chroma_weight_flag);
              -
              881  if (w_facts->chroma_weight_flag) {
              -
              882  for (int j = 0; j < 2; ++j) {
              -
              883  READ_SE_OR_RETURN(&w_facts->chroma_weight[i][j]);
              -
              884  IN_RANGE_OR_RETURN(w_facts->chroma_weight[i][j], -128, 127);
              -
              885 
              -
              886  READ_SE_OR_RETURN(&w_facts->chroma_offset[i][j]);
              -
              887  IN_RANGE_OR_RETURN(w_facts->chroma_offset[i][j], -128, 127);
              -
              888  }
              -
              889  } else {
              -
              890  for (int j = 0; j < 2; ++j) {
              -
              891  w_facts->chroma_weight[i][j] = def_chroma_weight;
              -
              892  w_facts->chroma_offset[i][j] = 0;
              -
              893  }
              -
              894  }
              -
              895  }
              -
              896  }
              -
              897 
              -
              898  return kOk;
              -
              899 }
              +
              866  READ_SE_OR_RETURN(&w_facts->luma_offset[i]);
              +
              867  IN_RANGE_OR_RETURN(w_facts->luma_offset[i], -128, 127);
              +
              868  } else {
              +
              869  w_facts->luma_weight[i] = def_luma_weight;
              +
              870  w_facts->luma_offset[i] = 0;
              +
              871  }
              +
              872 
              +
              873  if (chroma_array_type != 0) {
              +
              874  READ_BOOL_OR_RETURN(&w_facts->chroma_weight_flag);
              +
              875  if (w_facts->chroma_weight_flag) {
              +
              876  for (int j = 0; j < 2; ++j) {
              +
              877  READ_SE_OR_RETURN(&w_facts->chroma_weight[i][j]);
              +
              878  IN_RANGE_OR_RETURN(w_facts->chroma_weight[i][j], -128, 127);
              +
              879 
              +
              880  READ_SE_OR_RETURN(&w_facts->chroma_offset[i][j]);
              +
              881  IN_RANGE_OR_RETURN(w_facts->chroma_offset[i][j], -128, 127);
              +
              882  }
              +
              883  } else {
              +
              884  for (int j = 0; j < 2; ++j) {
              +
              885  w_facts->chroma_weight[i][j] = def_chroma_weight;
              +
              886  w_facts->chroma_offset[i][j] = 0;
              +
              887  }
              +
              888  }
              +
              889  }
              +
              890  }
              +
              891 
              +
              892  return kOk;
              +
              893 }
              +
              894 
              +
              895 H264Parser::Result H264Parser::ParsePredWeightTable(H26xBitReader* br,
              +
              896  const H264Sps& sps,
              +
              897  H264SliceHeader* shdr) {
              +
              898  READ_UE_OR_RETURN(&shdr->luma_log2_weight_denom);
              +
              899  TRUE_OR_RETURN(shdr->luma_log2_weight_denom < 8);
              900 
              -
              901 H264Parser::Result H264Parser::ParsePredWeightTable(H26xBitReader* br,
              -
              902  const H264Sps& sps,
              -
              903  H264SliceHeader* shdr) {
              -
              904  READ_UE_OR_RETURN(&shdr->luma_log2_weight_denom);
              -
              905  TRUE_OR_RETURN(shdr->luma_log2_weight_denom < 8);
              -
              906 
              -
              907  if (sps.chroma_array_type != 0)
              -
              908  READ_UE_OR_RETURN(&shdr->chroma_log2_weight_denom);
              -
              909  TRUE_OR_RETURN(shdr->chroma_log2_weight_denom < 8);
              -
              910 
              -
              911  Result res = ParseWeightingFactors(br,
              -
              912  shdr->num_ref_idx_l0_active_minus1,
              -
              913  sps.chroma_array_type,
              -
              914  shdr->luma_log2_weight_denom,
              -
              915  shdr->chroma_log2_weight_denom,
              -
              916  &shdr->pred_weight_table_l0);
              -
              917  if (res != kOk)
              -
              918  return res;
              -
              919 
              -
              920  if (shdr->IsBSlice()) {
              -
              921  res = ParseWeightingFactors(br,
              -
              922  shdr->num_ref_idx_l1_active_minus1,
              -
              923  sps.chroma_array_type,
              -
              924  shdr->luma_log2_weight_denom,
              -
              925  shdr->chroma_log2_weight_denom,
              -
              926  &shdr->pred_weight_table_l1);
              -
              927  if (res != kOk)
              -
              928  return res;
              -
              929  }
              -
              930 
              -
              931  return kOk;
              -
              932 }
              -
              933 
              -
              934 H264Parser::Result H264Parser::ParseDecRefPicMarking(H26xBitReader* br,
              -
              935  H264SliceHeader* shdr) {
              -
              936  if (shdr->idr_pic_flag) {
              -
              937  READ_BOOL_OR_RETURN(&shdr->no_output_of_prior_pics_flag);
              -
              938  READ_BOOL_OR_RETURN(&shdr->long_term_reference_flag);
              -
              939  } else {
              -
              940  READ_BOOL_OR_RETURN(&shdr->adaptive_ref_pic_marking_mode_flag);
              +
              901  if (sps.chroma_array_type != 0)
              +
              902  READ_UE_OR_RETURN(&shdr->chroma_log2_weight_denom);
              +
              903  TRUE_OR_RETURN(shdr->chroma_log2_weight_denom < 8);
              +
              904 
              +
              905  Result res = ParseWeightingFactors(br,
              +
              906  shdr->num_ref_idx_l0_active_minus1,
              +
              907  sps.chroma_array_type,
              +
              908  shdr->luma_log2_weight_denom,
              +
              909  shdr->chroma_log2_weight_denom,
              +
              910  &shdr->pred_weight_table_l0);
              +
              911  if (res != kOk)
              +
              912  return res;
              +
              913 
              +
              914  if (shdr->IsBSlice()) {
              +
              915  res = ParseWeightingFactors(br,
              +
              916  shdr->num_ref_idx_l1_active_minus1,
              +
              917  sps.chroma_array_type,
              +
              918  shdr->luma_log2_weight_denom,
              +
              919  shdr->chroma_log2_weight_denom,
              +
              920  &shdr->pred_weight_table_l1);
              +
              921  if (res != kOk)
              +
              922  return res;
              +
              923  }
              +
              924 
              +
              925  return kOk;
              +
              926 }
              +
              927 
              +
              928 H264Parser::Result H264Parser::ParseDecRefPicMarking(H26xBitReader* br,
              +
              929  H264SliceHeader* shdr) {
              +
              930  if (shdr->idr_pic_flag) {
              +
              931  READ_BOOL_OR_RETURN(&shdr->no_output_of_prior_pics_flag);
              +
              932  READ_BOOL_OR_RETURN(&shdr->long_term_reference_flag);
              +
              933  } else {
              +
              934  READ_BOOL_OR_RETURN(&shdr->adaptive_ref_pic_marking_mode_flag);
              +
              935 
              +
              936  H264DecRefPicMarking* marking;
              +
              937  if (shdr->adaptive_ref_pic_marking_mode_flag) {
              +
              938  size_t i;
              +
              939  for (i = 0; i < arraysize(shdr->ref_pic_marking); ++i) {
              +
              940  marking = &shdr->ref_pic_marking[i];
              941 
              -
              942  H264DecRefPicMarking* marking;
              -
              943  if (shdr->adaptive_ref_pic_marking_mode_flag) {
              -
              944  size_t i;
              -
              945  for (i = 0; i < arraysize(shdr->ref_pic_marking); ++i) {
              -
              946  marking = &shdr->ref_pic_marking[i];
              -
              947 
              -
              948  READ_UE_OR_RETURN(&marking->memory_mgmnt_control_operation);
              -
              949  if (marking->memory_mgmnt_control_operation == 0)
              -
              950  break;
              -
              951 
              -
              952  if (marking->memory_mgmnt_control_operation == 1 ||
              -
              953  marking->memory_mgmnt_control_operation == 3)
              -
              954  READ_UE_OR_RETURN(&marking->difference_of_pic_nums_minus1);
              -
              955 
              -
              956  if (marking->memory_mgmnt_control_operation == 2)
              -
              957  READ_UE_OR_RETURN(&marking->long_term_pic_num);
              -
              958 
              -
              959  if (marking->memory_mgmnt_control_operation == 3 ||
              -
              960  marking->memory_mgmnt_control_operation == 6)
              -
              961  READ_UE_OR_RETURN(&marking->long_term_frame_idx);
              -
              962 
              -
              963  if (marking->memory_mgmnt_control_operation == 4)
              -
              964  READ_UE_OR_RETURN(&marking->max_long_term_frame_idx_plus1);
              -
              965 
              -
              966  if (marking->memory_mgmnt_control_operation > 6)
              -
              967  return kInvalidStream;
              -
              968  }
              -
              969 
              -
              970  if (i == arraysize(shdr->ref_pic_marking)) {
              -
              971  DVLOG(1) << "Ran out of dec ref pic marking fields";
              -
              972  return kUnsupportedStream;
              -
              973  }
              -
              974  }
              -
              975  }
              -
              976 
              -
              977  return kOk;
              -
              978 }
              -
              979 
              -
              980 H264Parser::Result H264Parser::ParseSliceHeader(const Nalu& nalu,
              -
              981  H264SliceHeader* shdr) {
              -
              982  // See 7.4.3.
              -
              983  const H264Sps* sps;
              -
              984  const H264Pps* pps;
              -
              985  Result res;
              -
              986  H26xBitReader reader;
              -
              987  reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size());
              -
              988  H26xBitReader* br = &reader;
              -
              989 
              -
              990  memset(shdr, 0, sizeof(*shdr));
              -
              991 
              -
              992  shdr->idr_pic_flag = (nalu.type() == 5);
              -
              993  shdr->nal_ref_idc = nalu.ref_idc();
              -
              994  shdr->nalu_data = nalu.data() + nalu.header_size();
              -
              995  shdr->nalu_size = nalu.payload_size();
              +
              942  READ_UE_OR_RETURN(&marking->memory_mgmnt_control_operation);
              +
              943  if (marking->memory_mgmnt_control_operation == 0)
              +
              944  break;
              +
              945 
              +
              946  if (marking->memory_mgmnt_control_operation == 1 ||
              +
              947  marking->memory_mgmnt_control_operation == 3)
              +
              948  READ_UE_OR_RETURN(&marking->difference_of_pic_nums_minus1);
              +
              949 
              +
              950  if (marking->memory_mgmnt_control_operation == 2)
              +
              951  READ_UE_OR_RETURN(&marking->long_term_pic_num);
              +
              952 
              +
              953  if (marking->memory_mgmnt_control_operation == 3 ||
              +
              954  marking->memory_mgmnt_control_operation == 6)
              +
              955  READ_UE_OR_RETURN(&marking->long_term_frame_idx);
              +
              956 
              +
              957  if (marking->memory_mgmnt_control_operation == 4)
              +
              958  READ_UE_OR_RETURN(&marking->max_long_term_frame_idx_plus1);
              +
              959 
              +
              960  if (marking->memory_mgmnt_control_operation > 6)
              +
              961  return kInvalidStream;
              +
              962  }
              +
              963 
              +
              964  if (i == arraysize(shdr->ref_pic_marking)) {
              +
              965  DVLOG(1) << "Ran out of dec ref pic marking fields";
              +
              966  return kUnsupportedStream;
              +
              967  }
              +
              968  }
              +
              969  }
              +
              970 
              +
              971  return kOk;
              +
              972 }
              +
              973 
              +
              974 H264Parser::Result H264Parser::ParseSliceHeader(const Nalu& nalu,
              +
              975  H264SliceHeader* shdr) {
              +
              976  // See 7.4.3.
              +
              977  const H264Sps* sps;
              +
              978  const H264Pps* pps;
              +
              979  Result res;
              +
              980  H26xBitReader reader;
              +
              981  reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size());
              +
              982  H26xBitReader* br = &reader;
              +
              983 
              +
              984  memset(shdr, 0, sizeof(*shdr));
              +
              985 
              +
              986  shdr->idr_pic_flag = (nalu.type() == 5);
              +
              987  shdr->nal_ref_idc = nalu.ref_idc();
              +
              988  shdr->nalu_data = nalu.data() + nalu.header_size();
              +
              989  shdr->nalu_size = nalu.payload_size();
              +
              990 
              +
              991  READ_UE_OR_RETURN(&shdr->first_mb_in_slice);
              +
              992  READ_UE_OR_RETURN(&shdr->slice_type);
              +
              993  TRUE_OR_RETURN(shdr->slice_type < 10);
              +
              994 
              +
              995  READ_UE_OR_RETURN(&shdr->pic_parameter_set_id);
              996 
              -
              997  READ_UE_OR_RETURN(&shdr->first_mb_in_slice);
              -
              998  READ_UE_OR_RETURN(&shdr->slice_type);
              -
              999  TRUE_OR_RETURN(shdr->slice_type < 10);
              -
              1000 
              -
              1001  READ_UE_OR_RETURN(&shdr->pic_parameter_set_id);
              +
              997  pps = GetPps(shdr->pic_parameter_set_id);
              +
              998  TRUE_OR_RETURN(pps);
              +
              999 
              +
              1000  sps = GetSps(pps->seq_parameter_set_id);
              +
              1001  TRUE_OR_RETURN(sps);
              1002 
              -
              1003  pps = GetPps(shdr->pic_parameter_set_id);
              -
              1004  TRUE_OR_RETURN(pps);
              -
              1005 
              -
              1006  sps = GetSps(pps->seq_parameter_set_id);
              -
              1007  TRUE_OR_RETURN(sps);
              -
              1008 
              -
              1009  if (sps->separate_colour_plane_flag) {
              -
              1010  DVLOG(1) << "Interlaced streams not supported";
              -
              1011  return kUnsupportedStream;
              -
              1012  }
              -
              1013 
              -
              1014  READ_BITS_OR_RETURN(sps->log2_max_frame_num_minus4 + 4, &shdr->frame_num);
              -
              1015  if (!sps->frame_mbs_only_flag) {
              -
              1016  READ_BOOL_OR_RETURN(&shdr->field_pic_flag);
              -
              1017  if (shdr->field_pic_flag) {
              -
              1018  DVLOG(1) << "Interlaced streams not supported";
              -
              1019  return kUnsupportedStream;
              -
              1020  }
              -
              1021  }
              -
              1022 
              -
              1023  if (shdr->idr_pic_flag)
              -
              1024  READ_UE_OR_RETURN(&shdr->idr_pic_id);
              -
              1025 
              -
              1026  if (sps->pic_order_cnt_type == 0) {
              -
              1027  READ_BITS_OR_RETURN(sps->log2_max_pic_order_cnt_lsb_minus4 + 4,
              -
              1028  &shdr->pic_order_cnt_lsb);
              -
              1029  if (pps->bottom_field_pic_order_in_frame_present_flag &&
              -
              1030  !shdr->field_pic_flag)
              -
              1031  READ_SE_OR_RETURN(&shdr->delta_pic_order_cnt_bottom);
              -
              1032  }
              -
              1033 
              -
              1034  if (sps->pic_order_cnt_type == 1 && !sps->delta_pic_order_always_zero_flag) {
              -
              1035  READ_SE_OR_RETURN(&shdr->delta_pic_order_cnt[0]);
              -
              1036  if (pps->bottom_field_pic_order_in_frame_present_flag &&
              -
              1037  !shdr->field_pic_flag)
              -
              1038  READ_SE_OR_RETURN(&shdr->delta_pic_order_cnt[1]);
              -
              1039  }
              -
              1040 
              -
              1041  if (pps->redundant_pic_cnt_present_flag) {
              -
              1042  READ_UE_OR_RETURN(&shdr->redundant_pic_cnt);
              -
              1043  TRUE_OR_RETURN(shdr->redundant_pic_cnt < 128);
              -
              1044  }
              -
              1045 
              -
              1046  if (shdr->IsBSlice())
              -
              1047  READ_BOOL_OR_RETURN(&shdr->direct_spatial_mv_pred_flag);
              -
              1048 
              -
              1049  if (shdr->IsPSlice() || shdr->IsSPSlice() || shdr->IsBSlice()) {
              -
              1050  READ_BOOL_OR_RETURN(&shdr->num_ref_idx_active_override_flag);
              -
              1051  if (shdr->num_ref_idx_active_override_flag) {
              -
              1052  READ_UE_OR_RETURN(&shdr->num_ref_idx_l0_active_minus1);
              -
              1053  if (shdr->IsBSlice())
              -
              1054  READ_UE_OR_RETURN(&shdr->num_ref_idx_l1_active_minus1);
              -
              1055  } else {
              -
              1056  shdr->num_ref_idx_l0_active_minus1 =
              -
              1057  pps->num_ref_idx_l0_default_active_minus1;
              -
              1058  if (shdr->IsBSlice()) {
              -
              1059  shdr->num_ref_idx_l1_active_minus1 =
              -
              1060  pps->num_ref_idx_l1_default_active_minus1;
              -
              1061  }
              -
              1062  }
              -
              1063  }
              -
              1064  if (shdr->field_pic_flag) {
              -
              1065  TRUE_OR_RETURN(shdr->num_ref_idx_l0_active_minus1 < 32);
              -
              1066  TRUE_OR_RETURN(shdr->num_ref_idx_l1_active_minus1 < 32);
              -
              1067  } else {
              -
              1068  TRUE_OR_RETURN(shdr->num_ref_idx_l0_active_minus1 < 16);
              -
              1069  TRUE_OR_RETURN(shdr->num_ref_idx_l1_active_minus1 < 16);
              -
              1070  }
              -
              1071 
              -
              1072  if (nalu.type() == Nalu::H264_CodedSliceExtension) {
              -
              1073  return kUnsupportedStream;
              -
              1074  } else {
              -
              1075  res = ParseRefPicListModifications(br, shdr);
              -
              1076  if (res != kOk)
              -
              1077  return res;
              -
              1078  }
              -
              1079 
              -
              1080  if ((pps->weighted_pred_flag && (shdr->IsPSlice() || shdr->IsSPSlice())) ||
              -
              1081  (pps->weighted_bipred_idc == 1 && shdr->IsBSlice())) {
              -
              1082  res = ParsePredWeightTable(br, *sps, shdr);
              +
              1003  if (sps->separate_colour_plane_flag) {
              +
              1004  DVLOG(1) << "Interlaced streams not supported";
              +
              1005  return kUnsupportedStream;
              +
              1006  }
              +
              1007 
              +
              1008  READ_BITS_OR_RETURN(sps->log2_max_frame_num_minus4 + 4, &shdr->frame_num);
              +
              1009  if (!sps->frame_mbs_only_flag) {
              +
              1010  READ_BOOL_OR_RETURN(&shdr->field_pic_flag);
              +
              1011  if (shdr->field_pic_flag) {
              +
              1012  DVLOG(1) << "Interlaced streams not supported";
              +
              1013  return kUnsupportedStream;
              +
              1014  }
              +
              1015  }
              +
              1016 
              +
              1017  if (shdr->idr_pic_flag)
              +
              1018  READ_UE_OR_RETURN(&shdr->idr_pic_id);
              +
              1019 
              +
              1020  if (sps->pic_order_cnt_type == 0) {
              +
              1021  READ_BITS_OR_RETURN(sps->log2_max_pic_order_cnt_lsb_minus4 + 4,
              +
              1022  &shdr->pic_order_cnt_lsb);
              +
              1023  if (pps->bottom_field_pic_order_in_frame_present_flag &&
              +
              1024  !shdr->field_pic_flag)
              +
              1025  READ_SE_OR_RETURN(&shdr->delta_pic_order_cnt_bottom);
              +
              1026  }
              +
              1027 
              +
              1028  if (sps->pic_order_cnt_type == 1 && !sps->delta_pic_order_always_zero_flag) {
              +
              1029  READ_SE_OR_RETURN(&shdr->delta_pic_order_cnt[0]);
              +
              1030  if (pps->bottom_field_pic_order_in_frame_present_flag &&
              +
              1031  !shdr->field_pic_flag)
              +
              1032  READ_SE_OR_RETURN(&shdr->delta_pic_order_cnt[1]);
              +
              1033  }
              +
              1034 
              +
              1035  if (pps->redundant_pic_cnt_present_flag) {
              +
              1036  READ_UE_OR_RETURN(&shdr->redundant_pic_cnt);
              +
              1037  TRUE_OR_RETURN(shdr->redundant_pic_cnt < 128);
              +
              1038  }
              +
              1039 
              +
              1040  if (shdr->IsBSlice())
              +
              1041  READ_BOOL_OR_RETURN(&shdr->direct_spatial_mv_pred_flag);
              +
              1042 
              +
              1043  if (shdr->IsPSlice() || shdr->IsSPSlice() || shdr->IsBSlice()) {
              +
              1044  READ_BOOL_OR_RETURN(&shdr->num_ref_idx_active_override_flag);
              +
              1045  if (shdr->num_ref_idx_active_override_flag) {
              +
              1046  READ_UE_OR_RETURN(&shdr->num_ref_idx_l0_active_minus1);
              +
              1047  if (shdr->IsBSlice())
              +
              1048  READ_UE_OR_RETURN(&shdr->num_ref_idx_l1_active_minus1);
              +
              1049  } else {
              +
              1050  shdr->num_ref_idx_l0_active_minus1 =
              +
              1051  pps->num_ref_idx_l0_default_active_minus1;
              +
              1052  if (shdr->IsBSlice()) {
              +
              1053  shdr->num_ref_idx_l1_active_minus1 =
              +
              1054  pps->num_ref_idx_l1_default_active_minus1;
              +
              1055  }
              +
              1056  }
              +
              1057  }
              +
              1058  if (shdr->field_pic_flag) {
              +
              1059  TRUE_OR_RETURN(shdr->num_ref_idx_l0_active_minus1 < 32);
              +
              1060  TRUE_OR_RETURN(shdr->num_ref_idx_l1_active_minus1 < 32);
              +
              1061  } else {
              +
              1062  TRUE_OR_RETURN(shdr->num_ref_idx_l0_active_minus1 < 16);
              +
              1063  TRUE_OR_RETURN(shdr->num_ref_idx_l1_active_minus1 < 16);
              +
              1064  }
              +
              1065 
              +
              1066  if (nalu.type() == Nalu::H264_CodedSliceExtension) {
              +
              1067  return kUnsupportedStream;
              +
              1068  } else {
              +
              1069  res = ParseRefPicListModifications(br, shdr);
              +
              1070  if (res != kOk)
              +
              1071  return res;
              +
              1072  }
              +
              1073 
              +
              1074  if ((pps->weighted_pred_flag && (shdr->IsPSlice() || shdr->IsSPSlice())) ||
              +
              1075  (pps->weighted_bipred_idc == 1 && shdr->IsBSlice())) {
              +
              1076  res = ParsePredWeightTable(br, *sps, shdr);
              +
              1077  if (res != kOk)
              +
              1078  return res;
              +
              1079  }
              +
              1080 
              +
              1081  if (nalu.ref_idc() != 0) {
              +
              1082  res = ParseDecRefPicMarking(br, shdr);
              1083  if (res != kOk)
              1084  return res;
              1085  }
              1086 
              -
              1087  if (nalu.ref_idc() != 0) {
              -
              1088  res = ParseDecRefPicMarking(br, shdr);
              -
              1089  if (res != kOk)
              -
              1090  return res;
              +
              1087  if (pps->entropy_coding_mode_flag && !shdr->IsISlice() &&
              +
              1088  !shdr->IsSISlice()) {
              +
              1089  READ_UE_OR_RETURN(&shdr->cabac_init_idc);
              +
              1090  TRUE_OR_RETURN(shdr->cabac_init_idc < 3);
              1091  }
              1092 
              -
              1093  if (pps->entropy_coding_mode_flag && !shdr->IsISlice() &&
              -
              1094  !shdr->IsSISlice()) {
              -
              1095  READ_UE_OR_RETURN(&shdr->cabac_init_idc);
              -
              1096  TRUE_OR_RETURN(shdr->cabac_init_idc < 3);
              -
              1097  }
              -
              1098 
              -
              1099  READ_SE_OR_RETURN(&shdr->slice_qp_delta);
              +
              1093  READ_SE_OR_RETURN(&shdr->slice_qp_delta);
              +
              1094 
              +
              1095  if (shdr->IsSPSlice() || shdr->IsSISlice()) {
              +
              1096  if (shdr->IsSPSlice())
              +
              1097  READ_BOOL_OR_RETURN(&shdr->sp_for_switch_flag);
              +
              1098  READ_SE_OR_RETURN(&shdr->slice_qs_delta);
              +
              1099  }
              1100 
              -
              1101  if (shdr->IsSPSlice() || shdr->IsSISlice()) {
              -
              1102  if (shdr->IsSPSlice())
              -
              1103  READ_BOOL_OR_RETURN(&shdr->sp_for_switch_flag);
              -
              1104  READ_SE_OR_RETURN(&shdr->slice_qs_delta);
              -
              1105  }
              -
              1106 
              -
              1107  if (pps->deblocking_filter_control_present_flag) {
              -
              1108  READ_UE_OR_RETURN(&shdr->disable_deblocking_filter_idc);
              -
              1109  TRUE_OR_RETURN(shdr->disable_deblocking_filter_idc < 3);
              -
              1110 
              -
              1111  if (shdr->disable_deblocking_filter_idc != 1) {
              -
              1112  READ_SE_OR_RETURN(&shdr->slice_alpha_c0_offset_div2);
              -
              1113  IN_RANGE_OR_RETURN(shdr->slice_alpha_c0_offset_div2, -6, 6);
              -
              1114 
              -
              1115  READ_SE_OR_RETURN(&shdr->slice_beta_offset_div2);
              -
              1116  IN_RANGE_OR_RETURN(shdr->slice_beta_offset_div2, -6, 6);
              -
              1117  }
              -
              1118  }
              -
              1119 
              -
              1120  if (pps->num_slice_groups_minus1 > 0) {
              -
              1121  DVLOG(1) << "Slice groups not supported";
              -
              1122  return kUnsupportedStream;
              -
              1123  }
              +
              1101  if (pps->deblocking_filter_control_present_flag) {
              +
              1102  READ_UE_OR_RETURN(&shdr->disable_deblocking_filter_idc);
              +
              1103  TRUE_OR_RETURN(shdr->disable_deblocking_filter_idc < 3);
              +
              1104 
              +
              1105  if (shdr->disable_deblocking_filter_idc != 1) {
              +
              1106  READ_SE_OR_RETURN(&shdr->slice_alpha_c0_offset_div2);
              +
              1107  IN_RANGE_OR_RETURN(shdr->slice_alpha_c0_offset_div2, -6, 6);
              +
              1108 
              +
              1109  READ_SE_OR_RETURN(&shdr->slice_beta_offset_div2);
              +
              1110  IN_RANGE_OR_RETURN(shdr->slice_beta_offset_div2, -6, 6);
              +
              1111  }
              +
              1112  }
              +
              1113 
              +
              1114  if (pps->num_slice_groups_minus1 > 0) {
              +
              1115  DVLOG(1) << "Slice groups not supported";
              +
              1116  return kUnsupportedStream;
              +
              1117  }
              +
              1118 
              +
              1119  size_t epb = br->NumEmulationPreventionBytesRead();
              +
              1120  shdr->header_bit_size = (shdr->nalu_size - epb) * 8 - br->NumBitsLeft();
              +
              1121 
              +
              1122  return kOk;
              +
              1123 }
              1124 
              -
              1125  size_t epb = br->NumEmulationPreventionBytesRead();
              -
              1126  shdr->header_bit_size = (shdr->nalu_size - epb) * 8 - br->NumBitsLeft();
              -
              1127 
              -
              1128  return kOk;
              -
              1129 }
              -
              1130 
              -
              1131 H264Parser::Result H264Parser::ParseSEI(const Nalu& nalu,
              -
              1132  H264SEIMessage* sei_msg) {
              -
              1133  int byte;
              -
              1134  H26xBitReader reader;
              -
              1135  reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size());
              -
              1136  H26xBitReader* br = &reader;
              -
              1137 
              -
              1138  memset(sei_msg, 0, sizeof(*sei_msg));
              -
              1139 
              -
              1140  READ_BITS_OR_RETURN(8, &byte);
              -
              1141  while (byte == 0xff) {
              -
              1142  sei_msg->type += 255;
              -
              1143  READ_BITS_OR_RETURN(8, &byte);
              -
              1144  }
              -
              1145  sei_msg->type += byte;
              -
              1146 
              -
              1147  READ_BITS_OR_RETURN(8, &byte);
              -
              1148  while (byte == 0xff) {
              -
              1149  sei_msg->payload_size += 255;
              -
              1150  READ_BITS_OR_RETURN(8, &byte);
              -
              1151  }
              -
              1152  sei_msg->payload_size += byte;
              -
              1153 
              -
              1154  DVLOG(4) << "Found SEI message type: " << sei_msg->type
              -
              1155  << " payload size: " << sei_msg->payload_size;
              -
              1156 
              -
              1157  switch (sei_msg->type) {
              -
              1158  case H264SEIMessage::kSEIRecoveryPoint:
              -
              1159  READ_UE_OR_RETURN(&sei_msg->recovery_point.recovery_frame_cnt);
              -
              1160  READ_BOOL_OR_RETURN(&sei_msg->recovery_point.exact_match_flag);
              -
              1161  READ_BOOL_OR_RETURN(&sei_msg->recovery_point.broken_link_flag);
              -
              1162  READ_BITS_OR_RETURN(2, &sei_msg->recovery_point.changing_slice_group_idc);
              -
              1163  break;
              -
              1164 
              -
              1165  default:
              -
              1166  DVLOG(4) << "Unsupported SEI message";
              -
              1167  break;
              -
              1168  }
              -
              1169 
              -
              1170  return kOk;
              -
              1171 }
              -
              1172 
              -
              1173 } // namespace media
              -
              1174 } // namespace shaka
              +
              1125 H264Parser::Result H264Parser::ParseSEI(const Nalu& nalu,
              +
              1126  H264SEIMessage* sei_msg) {
              +
              1127  int byte;
              +
              1128  H26xBitReader reader;
              +
              1129  reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size());
              +
              1130  H26xBitReader* br = &reader;
              +
              1131 
              +
              1132  memset(sei_msg, 0, sizeof(*sei_msg));
              +
              1133 
              +
              1134  READ_BITS_OR_RETURN(8, &byte);
              +
              1135  while (byte == 0xff) {
              +
              1136  sei_msg->type += 255;
              +
              1137  READ_BITS_OR_RETURN(8, &byte);
              +
              1138  }
              +
              1139  sei_msg->type += byte;
              +
              1140 
              +
              1141  READ_BITS_OR_RETURN(8, &byte);
              +
              1142  while (byte == 0xff) {
              +
              1143  sei_msg->payload_size += 255;
              +
              1144  READ_BITS_OR_RETURN(8, &byte);
              +
              1145  }
              +
              1146  sei_msg->payload_size += byte;
              +
              1147 
              +
              1148  DVLOG(4) << "Found SEI message type: " << sei_msg->type
              +
              1149  << " payload size: " << sei_msg->payload_size;
              +
              1150 
              +
              1151  switch (sei_msg->type) {
              +
              1152  case H264SEIMessage::kSEIRecoveryPoint:
              +
              1153  READ_UE_OR_RETURN(&sei_msg->recovery_point.recovery_frame_cnt);
              +
              1154  READ_BOOL_OR_RETURN(&sei_msg->recovery_point.exact_match_flag);
              +
              1155  READ_BOOL_OR_RETURN(&sei_msg->recovery_point.broken_link_flag);
              +
              1156  READ_BITS_OR_RETURN(2, &sei_msg->recovery_point.changing_slice_group_idc);
              +
              1157  break;
              +
              1158 
              +
              1159  default:
              +
              1160  DVLOG(4) << "Unsupported SEI message";
              +
              1161  break;
              +
              1162  }
              +
              1163 
              +
              1164  return kOk;
              +
              1165 }
              +
              1166 
              +
              1167 } // namespace media
              +
              1168 } // namespace shaka
              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 30648c30d8..28b9c8c9cc 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 @@ -114,7 +114,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 538ee5c440..a25f47122b 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 @@ -182,7 +182,7 @@ Additional Inherited Members 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 dc9d2e3228..8bbc674a97 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 @@ -185,7 +185,7 @@ Additional Inherited Members diff --git a/docs/dc/da1/classshaka_1_1MpdBuilder.html b/docs/dc/da1/classshaka_1_1MpdBuilder.html index 5fecd304f1..77905e68bd 100644 --- a/docs/dc/da1/classshaka_1_1MpdBuilder.html +++ b/docs/dc/da1/classshaka_1_1MpdBuilder.html @@ -151,7 +151,7 @@ class DynamicMpdBuilderTes

              Detailed Description

              This class generates DASH MPDs (Media Presentation Descriptions).

              -

              Definition at line 58 of file mpd_builder.h.

              +

              Definition at line 57 of file mpd_builder.h.

              Constructor & Destructor Documentation

              @@ -219,7 +219,7 @@ class DynamicMpdBuilderTes
              Returns
              The new adaptation set, which is owned by this instance.
              -

              Definition at line 413 of file mpd_builder.cc.

              +

              Definition at line 412 of file mpd_builder.cc.

              @@ -244,7 +244,7 @@ class DynamicMpdBuilderTes -

              Definition at line 409 of file mpd_builder.cc.

              +

              Definition at line 408 of file mpd_builder.cc.

              @@ -288,7 +288,7 @@ class DynamicMpdBuilderTes -

              Definition at line 646 of file mpd_builder.cc.

              +

              Definition at line 643 of file mpd_builder.cc.

              @@ -322,7 +322,7 @@ class DynamicMpdBuilderTes
              Returns
              true on success, false otherwise.
              -

              Definition at line 428 of file mpd_builder.cc.

              +

              Definition at line 427 of file mpd_builder.cc.

              @@ -348,7 +348,7 @@ class DynamicMpdBuilderTes
              Returns
              The mpd type.
              -

              Definition at line 93 of file mpd_builder.h.

              +

              Definition at line 92 of file mpd_builder.h.

              @@ -374,7 +374,7 @@ class DynamicMpdBuilderTes
              Returns
              true on success, false otherwise.
              -

              Definition at line 423 of file mpd_builder.cc.

              +

              Definition at line 422 of file mpd_builder.cc.

              @@ -385,7 +385,7 @@ class DynamicMpdBuilderTes diff --git a/docs/dc/da6/classshaka_1_1media_1_1ContentEncoding.html b/docs/dc/da6/classshaka_1_1media_1_1ContentEncoding.html index a78833825a..609bc102f1 100644 --- a/docs/dc/da6/classshaka_1_1media_1_1ContentEncoding.html +++ b/docs/dc/da6/classshaka_1_1media_1_1ContentEncoding.html @@ -208,7 +208,7 @@ Static Public Attributes diff --git a/docs/dc/dbd/structshaka_1_1media_1_1FileCloser-members.html b/docs/dc/dbd/structshaka_1_1media_1_1FileCloser-members.html index 91b5bcc2be..d574eba856 100644 --- a/docs/dc/dbd/structshaka_1_1media_1_1FileCloser-members.html +++ b/docs/dc/dbd/structshaka_1_1media_1_1FileCloser-members.html @@ -97,7 +97,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dc/dbf/box__buffer_8h_source.html b/docs/dc/dbf/box__buffer_8h_source.html index 48ca3fa391..6838d0a589 100644 --- a/docs/dc/dbf/box__buffer_8h_source.html +++ b/docs/dc/dbf/box__buffer_8h_source.html @@ -294,7 +294,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 39c260ac89..6b4519ba17 100644 --- a/docs/dc/dc1/classshaka_1_1xml_1_1RepresentationXmlNode-members.html +++ b/docs/dc/dc1/classshaka_1_1xml_1_1RepresentationXmlNode-members.html @@ -117,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dc/dca/classshaka_1_1media_1_1WebMListParser.html b/docs/dc/dca/classshaka_1_1media_1_1WebMListParser.html index 947869c022..4e94c27922 100644 --- a/docs/dc/dca/classshaka_1_1media_1_1WebMListParser.html +++ b/docs/dc/dca/classshaka_1_1media_1_1WebMListParser.html @@ -210,7 +210,7 @@ void  diff --git a/docs/dc/dd9/rsa__key_8cc_source.html b/docs/dc/dd9/rsa__key_8cc_source.html index ce20a258ba..fd01f67daf 100644 --- a/docs/dc/dd9/rsa__key_8cc_source.html +++ b/docs/dc/dd9/rsa__key_8cc_source.html @@ -114,243 +114,233 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              25 
              26 #include "packager/base/logging.h"
              27 #include "packager/base/sha1.h"
              -
              28 #include "packager/base/stl_util.h"
              -
              29 
              -
              30 namespace {
              -
              31 
              -
              32 const size_t kPssSaltLength = 20u;
              -
              33 
              -
              34 // Serialize rsa key from DER encoded PKCS#1 RSAPrivateKey.
              -
              35 RSA* DeserializeRsaKey(const std::string& serialized_key,
              -
              36  bool deserialize_private_key) {
              -
              37  if (serialized_key.empty()) {
              -
              38  LOG(ERROR) << "Serialized RSA Key is empty.";
              -
              39  return NULL;
              -
              40  }
              -
              41 
              -
              42  BIO* bio = BIO_new_mem_buf(const_cast<char*>(serialized_key.data()),
              -
              43  serialized_key.size());
              -
              44  if (bio == NULL) {
              -
              45  LOG(ERROR) << "BIO_new_mem_buf returned NULL.";
              -
              46  return NULL;
              -
              47  }
              -
              48  RSA* rsa_key = deserialize_private_key ? d2i_RSAPrivateKey_bio(bio, NULL)
              -
              49  : d2i_RSAPublicKey_bio(bio, NULL);
              -
              50  BIO_free(bio);
              -
              51  return rsa_key;
              -
              52 }
              -
              53 
              -
              54 RSA* DeserializeRsaPrivateKey(const std::string& serialized_key) {
              -
              55  RSA* rsa_key = DeserializeRsaKey(serialized_key, true);
              -
              56  if (!rsa_key) {
              -
              57  LOG(ERROR) << "Private RSA key deserialization failure.";
              -
              58  return NULL;
              -
              59  }
              -
              60  if (RSA_check_key(rsa_key) != 1) {
              -
              61  LOG(ERROR) << "Invalid RSA Private key: " << ERR_error_string(
              -
              62  ERR_get_error(), NULL);
              -
              63  RSA_free(rsa_key);
              -
              64  return NULL;
              -
              65  }
              -
              66  return rsa_key;
              -
              67 }
              -
              68 
              -
              69 RSA* DeserializeRsaPublicKey(const std::string& serialized_key) {
              -
              70  RSA* rsa_key = DeserializeRsaKey(serialized_key, false);
              -
              71  if (!rsa_key) {
              -
              72  LOG(ERROR) << "Private RSA key deserialization failure.";
              -
              73  return NULL;
              -
              74  }
              -
              75  if (RSA_size(rsa_key) <= 0) {
              -
              76  LOG(ERROR) << "Invalid RSA Public key: " << ERR_error_string(
              -
              77  ERR_get_error(), NULL);
              -
              78  RSA_free(rsa_key);
              -
              79  return NULL;
              -
              80  }
              -
              81  return rsa_key;
              -
              82 }
              -
              83 
              -
              84 } // namespace
              -
              85 
              -
              86 namespace shaka {
              -
              87 namespace media {
              -
              88 
              -
              89 RsaPrivateKey::RsaPrivateKey(RSA* rsa_key) : rsa_key_(rsa_key) {
              -
              90  DCHECK(rsa_key);
              -
              91 }
              -
              92 RsaPrivateKey::~RsaPrivateKey() {
              -
              93  if (rsa_key_ != NULL)
              -
              94  RSA_free(rsa_key_);
              -
              95 }
              -
              96 
              -
              97 RsaPrivateKey* RsaPrivateKey::Create(const std::string& serialized_key) {
              -
              98  RSA* rsa_key = DeserializeRsaPrivateKey(serialized_key);
              -
              99  return rsa_key == NULL ? NULL : new RsaPrivateKey(rsa_key);
              -
              100 }
              -
              101 
              -
              102 bool RsaPrivateKey::Decrypt(const std::string& encrypted_message,
              -
              103  std::string* decrypted_message) {
              -
              104  DCHECK(decrypted_message);
              -
              105 
              -
              106  size_t rsa_size = RSA_size(rsa_key_);
              -
              107  if (encrypted_message.size() != rsa_size) {
              -
              108  LOG(ERROR) << "Encrypted RSA message has the wrong size (expected "
              -
              109  << rsa_size << ", actual " << encrypted_message.size() << ").";
              -
              110  return false;
              -
              111  }
              -
              112 
              -
              113  decrypted_message->resize(rsa_size);
              -
              114  int decrypted_size = RSA_private_decrypt(
              -
              115  rsa_size,
              -
              116  reinterpret_cast<const uint8_t*>(encrypted_message.data()),
              -
              117  reinterpret_cast<uint8_t*>(string_as_array(decrypted_message)),
              -
              118  rsa_key_,
              -
              119  RSA_PKCS1_OAEP_PADDING);
              -
              120 
              -
              121  if (decrypted_size == -1) {
              -
              122  LOG(ERROR) << "RSA private decrypt failure: " << ERR_error_string(
              -
              123  ERR_get_error(), NULL);
              -
              124  return false;
              -
              125  }
              -
              126  decrypted_message->resize(decrypted_size);
              -
              127  return true;
              -
              128 }
              -
              129 
              -
              130 bool RsaPrivateKey::GenerateSignature(const std::string& message,
              -
              131  std::string* signature) {
              -
              132  DCHECK(signature);
              -
              133  if (message.empty()) {
              -
              134  LOG(ERROR) << "Message to be signed is empty.";
              -
              135  return false;
              -
              136  }
              -
              137 
              -
              138  std::string message_digest = base::SHA1HashString(message);
              -
              139 
              -
              140  // Add PSS padding.
              -
              141  size_t rsa_size = RSA_size(rsa_key_);
              -
              142  std::vector<uint8_t> padded_digest(rsa_size);
              -
              143  if (!RSA_padding_add_PKCS1_PSS_mgf1(
              -
              144  rsa_key_,
              -
              145  &padded_digest[0],
              -
              146  reinterpret_cast<uint8_t*>(string_as_array(&message_digest)),
              -
              147  EVP_sha1(),
              -
              148  EVP_sha1(),
              -
              149  kPssSaltLength)) {
              -
              150  LOG(ERROR) << "RSA padding failure: " << ERR_error_string(ERR_get_error(),
              -
              151  NULL);
              -
              152  return false;
              -
              153  }
              +
              28 
              +
              29 namespace {
              +
              30 
              +
              31 const size_t kPssSaltLength = 20u;
              +
              32 
              +
              33 // Serialize rsa key from DER encoded PKCS#1 RSAPrivateKey.
              +
              34 RSA* DeserializeRsaKey(const std::string& serialized_key,
              +
              35  bool deserialize_private_key) {
              +
              36  if (serialized_key.empty()) {
              +
              37  LOG(ERROR) << "Serialized RSA Key is empty.";
              +
              38  return NULL;
              +
              39  }
              +
              40 
              +
              41  BIO* bio = BIO_new_mem_buf(const_cast<char*>(serialized_key.data()),
              +
              42  serialized_key.size());
              +
              43  if (bio == NULL) {
              +
              44  LOG(ERROR) << "BIO_new_mem_buf returned NULL.";
              +
              45  return NULL;
              +
              46  }
              +
              47  RSA* rsa_key = deserialize_private_key ? d2i_RSAPrivateKey_bio(bio, NULL)
              +
              48  : d2i_RSAPublicKey_bio(bio, NULL);
              +
              49  BIO_free(bio);
              +
              50  return rsa_key;
              +
              51 }
              +
              52 
              +
              53 RSA* DeserializeRsaPrivateKey(const std::string& serialized_key) {
              +
              54  RSA* rsa_key = DeserializeRsaKey(serialized_key, true);
              +
              55  if (!rsa_key) {
              +
              56  LOG(ERROR) << "Private RSA key deserialization failure.";
              +
              57  return NULL;
              +
              58  }
              +
              59  if (RSA_check_key(rsa_key) != 1) {
              +
              60  LOG(ERROR) << "Invalid RSA Private key: " << ERR_error_string(
              +
              61  ERR_get_error(), NULL);
              +
              62  RSA_free(rsa_key);
              +
              63  return NULL;
              +
              64  }
              +
              65  return rsa_key;
              +
              66 }
              +
              67 
              +
              68 RSA* DeserializeRsaPublicKey(const std::string& serialized_key) {
              +
              69  RSA* rsa_key = DeserializeRsaKey(serialized_key, false);
              +
              70  if (!rsa_key) {
              +
              71  LOG(ERROR) << "Private RSA key deserialization failure.";
              +
              72  return NULL;
              +
              73  }
              +
              74  if (RSA_size(rsa_key) <= 0) {
              +
              75  LOG(ERROR) << "Invalid RSA Public key: " << ERR_error_string(
              +
              76  ERR_get_error(), NULL);
              +
              77  RSA_free(rsa_key);
              +
              78  return NULL;
              +
              79  }
              +
              80  return rsa_key;
              +
              81 }
              +
              82 
              +
              83 } // namespace
              +
              84 
              +
              85 namespace shaka {
              +
              86 namespace media {
              +
              87 
              +
              88 RsaPrivateKey::RsaPrivateKey(RSA* rsa_key) : rsa_key_(rsa_key) {
              +
              89  DCHECK(rsa_key);
              +
              90 }
              +
              91 RsaPrivateKey::~RsaPrivateKey() {
              +
              92  if (rsa_key_ != NULL)
              +
              93  RSA_free(rsa_key_);
              +
              94 }
              +
              95 
              +
              96 RsaPrivateKey* RsaPrivateKey::Create(const std::string& serialized_key) {
              +
              97  RSA* rsa_key = DeserializeRsaPrivateKey(serialized_key);
              +
              98  return rsa_key == NULL ? NULL : new RsaPrivateKey(rsa_key);
              +
              99 }
              +
              100 
              +
              101 bool RsaPrivateKey::Decrypt(const std::string& encrypted_message,
              +
              102  std::string* decrypted_message) {
              +
              103  DCHECK(decrypted_message);
              +
              104 
              +
              105  size_t rsa_size = RSA_size(rsa_key_);
              +
              106  if (encrypted_message.size() != rsa_size) {
              +
              107  LOG(ERROR) << "Encrypted RSA message has the wrong size (expected "
              +
              108  << rsa_size << ", actual " << encrypted_message.size() << ").";
              +
              109  return false;
              +
              110  }
              +
              111 
              +
              112  decrypted_message->resize(rsa_size);
              +
              113  int decrypted_size = RSA_private_decrypt(
              +
              114  rsa_size, reinterpret_cast<const uint8_t*>(encrypted_message.data()),
              +
              115  reinterpret_cast<uint8_t*>(&(*decrypted_message)[0]), rsa_key_,
              +
              116  RSA_PKCS1_OAEP_PADDING);
              +
              117 
              +
              118  if (decrypted_size == -1) {
              +
              119  LOG(ERROR) << "RSA private decrypt failure: " << ERR_error_string(
              +
              120  ERR_get_error(), NULL);
              +
              121  return false;
              +
              122  }
              +
              123  decrypted_message->resize(decrypted_size);
              +
              124  return true;
              +
              125 }
              +
              126 
              +
              127 bool RsaPrivateKey::GenerateSignature(const std::string& message,
              +
              128  std::string* signature) {
              +
              129  DCHECK(signature);
              +
              130  if (message.empty()) {
              +
              131  LOG(ERROR) << "Message to be signed is empty.";
              +
              132  return false;
              +
              133  }
              +
              134 
              +
              135  std::string message_digest = base::SHA1HashString(message);
              +
              136 
              +
              137  // Add PSS padding.
              +
              138  size_t rsa_size = RSA_size(rsa_key_);
              +
              139  std::vector<uint8_t> padded_digest(rsa_size);
              +
              140  if (!RSA_padding_add_PKCS1_PSS_mgf1(
              +
              141  rsa_key_, &padded_digest[0],
              +
              142  reinterpret_cast<uint8_t*>(&message_digest[0]), EVP_sha1(),
              +
              143  EVP_sha1(), kPssSaltLength)) {
              +
              144  LOG(ERROR) << "RSA padding failure: " << ERR_error_string(ERR_get_error(),
              +
              145  NULL);
              +
              146  return false;
              +
              147  }
              +
              148 
              +
              149  // Encrypt PSS padded digest.
              +
              150  signature->resize(rsa_size);
              +
              151  int signature_size = RSA_private_encrypt(
              +
              152  padded_digest.size(), &padded_digest[0],
              +
              153  reinterpret_cast<uint8_t*>(&(*signature)[0]), rsa_key_, RSA_NO_PADDING);
              154 
              -
              155  // Encrypt PSS padded digest.
              -
              156  signature->resize(rsa_size);
              -
              157  int signature_size = RSA_private_encrypt(
              -
              158  padded_digest.size(),
              -
              159  &padded_digest[0],
              -
              160  reinterpret_cast<uint8_t*>(string_as_array(signature)),
              -
              161  rsa_key_,
              -
              162  RSA_NO_PADDING);
              -
              163 
              -
              164  if (signature_size != static_cast<int>(rsa_size)) {
              -
              165  LOG(ERROR) << "RSA private encrypt failure: " << ERR_error_string(
              -
              166  ERR_get_error(), NULL);
              -
              167  return false;
              -
              168  }
              -
              169  return true;
              -
              170 }
              -
              171 
              -
              172 RsaPublicKey::RsaPublicKey(RSA* rsa_key) : rsa_key_(rsa_key) {
              -
              173  DCHECK(rsa_key);
              +
              155  if (signature_size != static_cast<int>(rsa_size)) {
              +
              156  LOG(ERROR) << "RSA private encrypt failure: " << ERR_error_string(
              +
              157  ERR_get_error(), NULL);
              +
              158  return false;
              +
              159  }
              +
              160  return true;
              +
              161 }
              +
              162 
              +
              163 RsaPublicKey::RsaPublicKey(RSA* rsa_key) : rsa_key_(rsa_key) {
              +
              164  DCHECK(rsa_key);
              +
              165 }
              +
              166 RsaPublicKey::~RsaPublicKey() {
              +
              167  if (rsa_key_ != NULL)
              +
              168  RSA_free(rsa_key_);
              +
              169 }
              +
              170 
              +
              171 RsaPublicKey* RsaPublicKey::Create(const std::string& serialized_key) {
              +
              172  RSA* rsa_key = DeserializeRsaPublicKey(serialized_key);
              +
              173  return rsa_key == NULL ? NULL : new RsaPublicKey(rsa_key);
              174 }
              -
              175 RsaPublicKey::~RsaPublicKey() {
              -
              176  if (rsa_key_ != NULL)
              -
              177  RSA_free(rsa_key_);
              -
              178 }
              -
              179 
              -
              180 RsaPublicKey* RsaPublicKey::Create(const std::string& serialized_key) {
              -
              181  RSA* rsa_key = DeserializeRsaPublicKey(serialized_key);
              -
              182  return rsa_key == NULL ? NULL : new RsaPublicKey(rsa_key);
              -
              183 }
              -
              184 
              -
              185 bool RsaPublicKey::Encrypt(const std::string& clear_message,
              -
              186  std::string* encrypted_message) {
              -
              187  DCHECK(encrypted_message);
              -
              188  if (clear_message.empty()) {
              -
              189  LOG(ERROR) << "Message to be encrypted is empty.";
              -
              190  return false;
              -
              191  }
              -
              192 
              -
              193  size_t rsa_size = RSA_size(rsa_key_);
              -
              194  encrypted_message->resize(rsa_size);
              -
              195  int encrypted_size = RSA_public_encrypt(
              -
              196  clear_message.size(),
              -
              197  reinterpret_cast<const uint8_t*>(clear_message.data()),
              -
              198  reinterpret_cast<uint8_t*>(string_as_array(encrypted_message)),
              -
              199  rsa_key_,
              -
              200  RSA_PKCS1_OAEP_PADDING);
              -
              201 
              -
              202  if (encrypted_size != static_cast<int>(rsa_size)) {
              -
              203  LOG(ERROR) << "RSA public encrypt failure: " << ERR_error_string(
              -
              204  ERR_get_error(), NULL);
              -
              205  return false;
              -
              206  }
              -
              207  return true;
              -
              208 }
              -
              209 
              -
              210 bool RsaPublicKey::VerifySignature(const std::string& message,
              -
              211  const std::string& signature) {
              -
              212  if (message.empty()) {
              -
              213  LOG(ERROR) << "Signed message is empty.";
              -
              214  return false;
              -
              215  }
              -
              216 
              -
              217  size_t rsa_size = RSA_size(rsa_key_);
              -
              218  if (signature.size() != rsa_size) {
              -
              219  LOG(ERROR) << "Message signature is of the wrong size (expected "
              -
              220  << rsa_size << ", actual " << signature.size() << ").";
              -
              221  return false;
              -
              222  }
              -
              223 
              -
              224  // Decrypt the signature.
              -
              225  std::vector<uint8_t> padded_digest(signature.size());
              -
              226  int decrypted_size =
              -
              227  RSA_public_decrypt(signature.size(),
              -
              228  reinterpret_cast<const uint8_t*>(signature.data()),
              -
              229  &padded_digest[0],
              -
              230  rsa_key_,
              -
              231  RSA_NO_PADDING);
              -
              232 
              -
              233  if (decrypted_size != static_cast<int>(rsa_size)) {
              -
              234  LOG(ERROR) << "RSA public decrypt failure: " << ERR_error_string(
              -
              235  ERR_get_error(), NULL);
              -
              236  return false;
              -
              237  }
              -
              238 
              -
              239  std::string message_digest = base::SHA1HashString(message);
              +
              175 
              +
              176 bool RsaPublicKey::Encrypt(const std::string& clear_message,
              +
              177  std::string* encrypted_message) {
              +
              178  DCHECK(encrypted_message);
              +
              179  if (clear_message.empty()) {
              +
              180  LOG(ERROR) << "Message to be encrypted is empty.";
              +
              181  return false;
              +
              182  }
              +
              183 
              +
              184  size_t rsa_size = RSA_size(rsa_key_);
              +
              185  encrypted_message->resize(rsa_size);
              +
              186  int encrypted_size =
              +
              187  RSA_public_encrypt(clear_message.size(),
              +
              188  reinterpret_cast<const uint8_t*>(clear_message.data()),
              +
              189  reinterpret_cast<uint8_t*>(&(*encrypted_message)[0]),
              +
              190  rsa_key_, RSA_PKCS1_OAEP_PADDING);
              +
              191 
              +
              192  if (encrypted_size != static_cast<int>(rsa_size)) {
              +
              193  LOG(ERROR) << "RSA public encrypt failure: " << ERR_error_string(
              +
              194  ERR_get_error(), NULL);
              +
              195  return false;
              +
              196  }
              +
              197  return true;
              +
              198 }
              +
              199 
              +
              200 bool RsaPublicKey::VerifySignature(const std::string& message,
              +
              201  const std::string& signature) {
              +
              202  if (message.empty()) {
              +
              203  LOG(ERROR) << "Signed message is empty.";
              +
              204  return false;
              +
              205  }
              +
              206 
              +
              207  size_t rsa_size = RSA_size(rsa_key_);
              +
              208  if (signature.size() != rsa_size) {
              +
              209  LOG(ERROR) << "Message signature is of the wrong size (expected "
              +
              210  << rsa_size << ", actual " << signature.size() << ").";
              +
              211  return false;
              +
              212  }
              +
              213 
              +
              214  // Decrypt the signature.
              +
              215  std::vector<uint8_t> padded_digest(signature.size());
              +
              216  int decrypted_size =
              +
              217  RSA_public_decrypt(signature.size(),
              +
              218  reinterpret_cast<const uint8_t*>(signature.data()),
              +
              219  &padded_digest[0],
              +
              220  rsa_key_,
              +
              221  RSA_NO_PADDING);
              +
              222 
              +
              223  if (decrypted_size != static_cast<int>(rsa_size)) {
              +
              224  LOG(ERROR) << "RSA public decrypt failure: " << ERR_error_string(
              +
              225  ERR_get_error(), NULL);
              +
              226  return false;
              +
              227  }
              +
              228 
              +
              229  std::string message_digest = base::SHA1HashString(message);
              +
              230 
              +
              231  // Verify PSS padding.
              +
              232  return RSA_verify_PKCS1_PSS_mgf1(
              +
              233  rsa_key_,
              +
              234  reinterpret_cast<const uint8_t*>(message_digest.data()),
              +
              235  EVP_sha1(),
              +
              236  EVP_sha1(),
              +
              237  &padded_digest[0],
              +
              238  kPssSaltLength) != 0;
              +
              239 }
              240 
              -
              241  // Verify PSS padding.
              -
              242  return RSA_verify_PKCS1_PSS_mgf1(
              -
              243  rsa_key_,
              -
              244  reinterpret_cast<const uint8_t*>(message_digest.data()),
              -
              245  EVP_sha1(),
              -
              246  EVP_sha1(),
              -
              247  &padded_digest[0],
              -
              248  kPssSaltLength) != 0;
              -
              249 }
              -
              250 
              -
              251 } // namespace media
              -
              252 } // namespace shaka
              +
              241 } // namespace media
              +
              242 } // namespace shaka
              Rsa public key, used for signature verification and encryption.
              Definition: rsa_key.h:53
              -
              bool Encrypt(const std::string &clear_message, std::string *encrypted_message)
              Definition: rsa_key.cc:185
              -
              bool Decrypt(const std::string &encrypted_message, std::string *decrypted_message)
              Definition: rsa_key.cc:102
              +
              bool Encrypt(const std::string &clear_message, std::string *encrypted_message)
              Definition: rsa_key.cc:176
              +
              bool Decrypt(const std::string &encrypted_message, std::string *decrypted_message)
              Definition: rsa_key.cc:101
              Rsa private key, used for message signing and decryption.
              Definition: rsa_key.h:24
              -
              bool VerifySignature(const std::string &message, const std::string &signature)
              Definition: rsa_key.cc:210
              -
              static RsaPublicKey * Create(const std::string &serialized_key)
              Definition: rsa_key.cc:180
              -
              bool GenerateSignature(const std::string &message, std::string *signature)
              Definition: rsa_key.cc:130
              -
              static RsaPrivateKey * Create(const std::string &serialized_key)
              Definition: rsa_key.cc:97
              +
              bool VerifySignature(const std::string &message, const std::string &signature)
              Definition: rsa_key.cc:200
              +
              static RsaPublicKey * Create(const std::string &serialized_key)
              Definition: rsa_key.cc:171
              +
              bool GenerateSignature(const std::string &message, std::string *signature)
              Definition: rsa_key.cc:127
              +
              static RsaPrivateKey * Create(const std::string &serialized_key)
              Definition: rsa_key.cc:96
              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 ace8071ab3..11a306dd90 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 @@ -179,7 +179,7 @@ Additional Inherited Members diff --git a/docs/dc/ddf/udp__file__posix_8cc_source.html b/docs/dc/ddf/udp__file__posix_8cc_source.html index 0c6a81a4e9..cefc257aaf 100644 --- a/docs/dc/ddf/udp__file__posix_8cc_source.html +++ b/docs/dc/ddf/udp__file__posix_8cc_source.html @@ -322,7 +322,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dc/de1/structshaka_1_1SegmentInfo.html b/docs/dc/de1/structshaka_1_1SegmentInfo.html index acfa0b1255..9c73555353 100644 --- a/docs/dc/de1/structshaka_1_1SegmentInfo.html +++ b/docs/dc/de1/structshaka_1_1SegmentInfo.html @@ -118,7 +118,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 e5e612cc4c..2a5ba7fbe7 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 @@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 013264e56c..06146037d9 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 @@ -135,7 +135,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dc/dec/ts__section__pmt_8cc_source.html b/docs/dc/dec/ts__section__pmt_8cc_source.html index 254f2cb831..565c9b6300 100644 --- a/docs/dc/dec/ts__section__pmt_8cc_source.html +++ b/docs/dc/dec/ts__section__pmt_8cc_source.html @@ -207,7 +207,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dc/df0/classshaka_1_1media_1_1ClosureThread.html b/docs/dc/df0/classshaka_1_1media_1_1ClosureThread.html index 6852ea2db8..6d108fdc97 100644 --- a/docs/dc/df0/classshaka_1_1media_1_1ClosureThread.html +++ b/docs/dc/df0/classshaka_1_1media_1_1ClosureThread.html @@ -179,7 +179,7 @@ void  diff --git a/docs/dc/df2/classshaka_1_1media_1_1WebVttMediaParser.html b/docs/dc/df2/classshaka_1_1media_1_1WebVttMediaParser.html index 9c9d416015..7e64ef94fc 100644 --- a/docs/dc/df2/classshaka_1_1media_1_1WebVttMediaParser.html +++ b/docs/dc/df2/classshaka_1_1media_1_1WebVttMediaParser.html @@ -256,7 +256,7 @@ track_id, const scoped_refptr
              diff --git a/docs/dc/df3/classshaka_1_1media_1_1mp4_1_1EncryptingFragmenter.html b/docs/dc/df3/classshaka_1_1media_1_1mp4_1_1EncryptingFragmenter.html index 51dbc2a5d1..feea1117ad 100644 --- a/docs/dc/df3/classshaka_1_1media_1_1mp4_1_1EncryptingFragmenter.html +++ b/docs/dc/df3/classshaka_1_1media_1_1mp4_1_1EncryptingFragmenter.html @@ -405,7 +405,7 @@ void set_encryption_key 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 4df1e59290..2ff5cf132c 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 @@ -128,7 +128,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 74c408c092..2944f0ce72 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 @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dc/df8/closure__thread_8h_source.html b/docs/dc/df8/closure__thread_8h_source.html index dbb5666e77..f6ce12483d 100644 --- a/docs/dc/df8/closure__thread_8h_source.html +++ b/docs/dc/df8/closure__thread_8h_source.html @@ -127,7 +127,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 eb436db1fa..b7fa96bf0a 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 @@ -180,7 +180,7 @@ uint32_t flags diff --git a/docs/dd/d11/mpd__builder_8cc_source.html b/docs/dd/d11/mpd__builder_8cc_source.html index 77b63865d7..e7e2011f54 100644 --- a/docs/dd/d11/mpd__builder_8cc_source.html +++ b/docs/dd/d11/mpd__builder_8cc_source.html @@ -490,1025 +490,1021 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              401 MpdBuilder::MpdBuilder(MpdType type, const MpdOptions& mpd_options)
              402  : type_(type),
              403  mpd_options_(mpd_options),
              -
              404  adaptation_sets_deleter_(&adaptation_sets_),
              -
              405  clock_(new base::DefaultClock()) {}
              -
              406 
              -
              407 MpdBuilder::~MpdBuilder() {}
              -
              408 
              -
              409 void MpdBuilder::AddBaseUrl(const std::string& base_url) {
              -
              410  base_urls_.push_back(base_url);
              -
              411 }
              -
              412 
              -
              413 AdaptationSet* MpdBuilder::AddAdaptationSet(const std::string& lang) {
              -
              414  std::unique_ptr<AdaptationSet> adaptation_set(
              -
              415  new AdaptationSet(adaptation_set_counter_.GetNext(), lang, mpd_options_,
              -
              416  type_, &representation_counter_));
              -
              417 
              -
              418  DCHECK(adaptation_set);
              -
              419  adaptation_sets_.push_back(adaptation_set.get());
              -
              420  return adaptation_set.release();
              -
              421 }
              -
              422 
              - -
              424  DCHECK(output_file);
              -
              425  return WriteMpdToOutput(output_file);
              -
              426 }
              -
              427 
              -
              428 bool MpdBuilder::ToString(std::string* output) {
              -
              429  DCHECK(output);
              -
              430  return WriteMpdToOutput(output);
              -
              431 }
              -
              432 template <typename OutputType>
              -
              433 bool MpdBuilder::WriteMpdToOutput(OutputType* output) {
              -
              434  static LibXmlInitializer lib_xml_initializer;
              -
              435 
              -
              436  xml::scoped_xml_ptr<xmlDoc> doc(GenerateMpd());
              -
              437  if (!doc.get())
              -
              438  return false;
              -
              439 
              -
              440  static const int kNiceFormat = 1;
              -
              441  int doc_str_size = 0;
              -
              442  xmlChar* doc_str = NULL;
              -
              443  xmlDocDumpFormatMemoryEnc(doc.get(), &doc_str, &doc_str_size, "UTF-8",
              -
              444  kNiceFormat);
              -
              445 
              -
              446  bool result = WriteXmlCharArrayToOutput(doc_str, doc_str_size, output);
              -
              447  xmlFree(doc_str);
              -
              448 
              -
              449  // Cleanup, free the doc.
              -
              450  doc.reset();
              -
              451  return result;
              -
              452 }
              -
              453 
              -
              454 xmlDocPtr MpdBuilder::GenerateMpd() {
              -
              455  // Setup nodes.
              -
              456  static const char kXmlVersion[] = "1.0";
              -
              457  xml::scoped_xml_ptr<xmlDoc> doc(xmlNewDoc(BAD_CAST kXmlVersion));
              -
              458  XmlNode mpd("MPD");
              -
              459 
              -
              460  // Iterate thru AdaptationSets and add them to one big Period element.
              -
              461  XmlNode period("Period");
              -
              462 
              -
              463  // Always set id=0 for now. Since this class can only generate one Period
              -
              464  // at the moment, just use a constant.
              -
              465  // Required for 'dynamic' MPDs.
              -
              466  period.SetId(0);
              -
              467  std::list<AdaptationSet*>::iterator adaptation_sets_it =
              -
              468  adaptation_sets_.begin();
              -
              469  for (; adaptation_sets_it != adaptation_sets_.end(); ++adaptation_sets_it) {
              -
              470  xml::scoped_xml_ptr<xmlNode> child((*adaptation_sets_it)->GetXml());
              -
              471  if (!child.get() || !period.AddChild(std::move(child)))
              -
              472  return NULL;
              -
              473  }
              -
              474 
              -
              475  // Add baseurls to MPD.
              -
              476  std::list<std::string>::const_iterator base_urls_it = base_urls_.begin();
              -
              477  for (; base_urls_it != base_urls_.end(); ++base_urls_it) {
              -
              478  XmlNode base_url("BaseURL");
              -
              479  base_url.SetContent(*base_urls_it);
              -
              480 
              -
              481  if (!mpd.AddChild(base_url.PassScopedPtr()))
              -
              482  return NULL;
              -
              483  }
              -
              484 
              -
              485  if (type_ == kDynamic) {
              -
              486  // This is the only Period and it is a regular period.
              -
              487  period.SetStringAttribute("start", "PT0S");
              -
              488  }
              -
              489 
              -
              490  if (!mpd.AddChild(period.PassScopedPtr()))
              -
              491  return NULL;
              -
              492 
              -
              493  AddMpdNameSpaceInfo(&mpd);
              -
              494  AddCommonMpdInfo(&mpd);
              -
              495  switch (type_) {
              -
              496  case kStatic:
              -
              497  AddStaticMpdInfo(&mpd);
              -
              498  break;
              -
              499  case kDynamic:
              -
              500  AddDynamicMpdInfo(&mpd);
              -
              501  break;
              -
              502  default:
              -
              503  NOTREACHED() << "Unknown MPD type: " << type_;
              -
              504  break;
              -
              505  }
              -
              506 
              -
              507  DCHECK(doc);
              -
              508  const std::string version = GetPackagerVersion();
              -
              509  if (!version.empty()) {
              -
              510  std::string version_string =
              -
              511  base::StringPrintf("Generated with %s version %s",
              -
              512  GetPackagerProjectUrl().c_str(), version.c_str());
              -
              513  xml::scoped_xml_ptr<xmlNode> comment(
              -
              514  xmlNewDocComment(doc.get(), BAD_CAST version_string.c_str()));
              -
              515  xmlDocSetRootElement(doc.get(), comment.get());
              -
              516  xmlAddSibling(comment.release(), mpd.Release());
              -
              517  } else {
              -
              518  xmlDocSetRootElement(doc.get(), mpd.Release());
              -
              519  }
              -
              520  return doc.release();
              -
              521 }
              -
              522 
              -
              523 void MpdBuilder::AddCommonMpdInfo(XmlNode* mpd_node) {
              -
              524  if (Positive(mpd_options_.min_buffer_time)) {
              -
              525  mpd_node->SetStringAttribute(
              -
              526  "minBufferTime", SecondsToXmlDuration(mpd_options_.min_buffer_time));
              -
              527  } else {
              -
              528  LOG(ERROR) << "minBufferTime value not specified.";
              -
              529  // TODO(tinskip): Propagate error.
              -
              530  }
              -
              531 }
              -
              532 
              -
              533 void MpdBuilder::AddStaticMpdInfo(XmlNode* mpd_node) {
              -
              534  DCHECK(mpd_node);
              -
              535  DCHECK_EQ(MpdBuilder::kStatic, type_);
              -
              536 
              -
              537  static const char kStaticMpdType[] = "static";
              -
              538  static const char kStaticMpdProfile[] =
              -
              539  "urn:mpeg:dash:profile:isoff-on-demand:2011";
              -
              540  mpd_node->SetStringAttribute("type", kStaticMpdType);
              -
              541  mpd_node->SetStringAttribute("profiles", kStaticMpdProfile);
              -
              542  mpd_node->SetStringAttribute(
              -
              543  "mediaPresentationDuration",
              -
              544  SecondsToXmlDuration(GetStaticMpdDuration(mpd_node)));
              -
              545 }
              -
              546 
              -
              547 void MpdBuilder::AddDynamicMpdInfo(XmlNode* mpd_node) {
              -
              548  DCHECK(mpd_node);
              -
              549  DCHECK_EQ(MpdBuilder::kDynamic, type_);
              -
              550 
              -
              551  static const char kDynamicMpdType[] = "dynamic";
              -
              552  static const char kDynamicMpdProfile[] =
              -
              553  "urn:mpeg:dash:profile:isoff-live:2011";
              -
              554  mpd_node->SetStringAttribute("type", kDynamicMpdType);
              -
              555  mpd_node->SetStringAttribute("profiles", kDynamicMpdProfile);
              -
              556 
              -
              557  // No offset from NOW.
              -
              558  mpd_node->SetStringAttribute("publishTime",
              -
              559  XmlDateTimeNowWithOffset(0, clock_.get()));
              -
              560 
              -
              561  // 'availabilityStartTime' is required for dynamic profile. Calculate if
              -
              562  // not already calculated.
              -
              563  if (availability_start_time_.empty()) {
              -
              564  double earliest_presentation_time;
              -
              565  if (GetEarliestTimestamp(&earliest_presentation_time)) {
              -
              566  availability_start_time_ =
              -
              567  XmlDateTimeNowWithOffset(mpd_options_.availability_time_offset -
              -
              568  std::ceil(earliest_presentation_time),
              -
              569  clock_.get());
              -
              570  } else {
              -
              571  LOG(ERROR) << "Could not determine the earliest segment presentation "
              -
              572  "time for availabilityStartTime calculation.";
              -
              573  // TODO(tinskip). Propagate an error.
              -
              574  }
              -
              575  }
              -
              576  if (!availability_start_time_.empty())
              -
              577  mpd_node->SetStringAttribute("availabilityStartTime",
              -
              578  availability_start_time_);
              -
              579 
              -
              580  if (Positive(mpd_options_.minimum_update_period)) {
              -
              581  mpd_node->SetStringAttribute(
              -
              582  "minimumUpdatePeriod",
              -
              583  SecondsToXmlDuration(mpd_options_.minimum_update_period));
              -
              584  } else {
              -
              585  LOG(WARNING) << "The profile is dynamic but no minimumUpdatePeriod "
              -
              586  "specified.";
              -
              587  }
              -
              588 
              -
              589  SetIfPositive("timeShiftBufferDepth", mpd_options_.time_shift_buffer_depth,
              -
              590  mpd_node);
              -
              591  SetIfPositive("suggestedPresentationDelay",
              -
              592  mpd_options_.suggested_presentation_delay, mpd_node);
              -
              593 }
              -
              594 
              -
              595 float MpdBuilder::GetStaticMpdDuration(XmlNode* mpd_node) {
              -
              596  DCHECK(mpd_node);
              -
              597  DCHECK_EQ(MpdBuilder::kStatic, type_);
              -
              598 
              -
              599  xmlNodePtr period_node = FindPeriodNode(mpd_node);
              -
              600  DCHECK(period_node) << "Period element must be a child of mpd_node.";
              -
              601  DCHECK(IsPeriodNode(period_node));
              -
              602 
              -
              603  // Attribute mediaPresentationDuration must be present for 'static' MPD. So
              -
              604  // setting "PT0S" is required even if none of the representaions have duration
              -
              605  // attribute.
              -
              606  float max_duration = 0.0f;
              -
              607  for (xmlNodePtr adaptation_set = xmlFirstElementChild(period_node);
              -
              608  adaptation_set; adaptation_set = xmlNextElementSibling(adaptation_set)) {
              -
              609  for (xmlNodePtr representation = xmlFirstElementChild(adaptation_set);
              -
              610  representation;
              -
              611  representation = xmlNextElementSibling(representation)) {
              -
              612  float duration = 0.0f;
              -
              613  if (GetDurationAttribute(representation, &duration)) {
              -
              614  max_duration = max_duration > duration ? max_duration : duration;
              -
              615 
              -
              616  // 'duration' attribute is there only to help generate MPD, not
              -
              617  // necessary for MPD, remove the attribute.
              -
              618  xmlUnsetProp(representation, BAD_CAST "duration");
              -
              619  }
              -
              620  }
              -
              621  }
              -
              622 
              -
              623  return max_duration;
              -
              624 }
              -
              625 
              -
              626 bool MpdBuilder::GetEarliestTimestamp(double* timestamp_seconds) {
              -
              627  DCHECK(timestamp_seconds);
              -
              628 
              -
              629  double earliest_timestamp(-1);
              -
              630  for (std::list<AdaptationSet*>::const_iterator iter =
              -
              631  adaptation_sets_.begin();
              -
              632  iter != adaptation_sets_.end(); ++iter) {
              -
              633  double timestamp;
              -
              634  if ((*iter)->GetEarliestTimestamp(&timestamp) &&
              -
              635  ((earliest_timestamp < 0) || (timestamp < earliest_timestamp))) {
              -
              636  earliest_timestamp = timestamp;
              -
              637  }
              -
              638  }
              -
              639  if (earliest_timestamp < 0)
              -
              640  return false;
              -
              641 
              -
              642  *timestamp_seconds = earliest_timestamp;
              -
              643  return true;
              -
              644 }
              -
              645 
              -
              646 void MpdBuilder::MakePathsRelativeToMpd(const std::string& mpd_path,
              -
              647  MediaInfo* media_info) {
              -
              648  DCHECK(media_info);
              -
              649  const std::string kFileProtocol("file://");
              -
              650  std::string mpd_file_path = (mpd_path.find(kFileProtocol) == 0)
              -
              651  ? mpd_path.substr(kFileProtocol.size())
              -
              652  : mpd_path;
              -
              653 
              -
              654  if (!mpd_file_path.empty()) {
              -
              655  std::string mpd_dir(FilePath::FromUTF8Unsafe(mpd_file_path)
              -
              656  .DirName().AsEndingWithSeparator().AsUTF8Unsafe());
              -
              657  if (!mpd_dir.empty()) {
              -
              658  if (media_info->has_media_file_name()) {
              -
              659  media_info->set_media_file_name(
              -
              660  MakePathRelative(media_info->media_file_name(), mpd_dir));
              -
              661  }
              -
              662  if (media_info->has_init_segment_name()) {
              -
              663  media_info->set_init_segment_name(
              -
              664  MakePathRelative(media_info->init_segment_name(), mpd_dir));
              -
              665  }
              -
              666  if (media_info->has_segment_template()) {
              -
              667  media_info->set_segment_template(
              -
              668  MakePathRelative(media_info->segment_template(), mpd_dir));
              -
              669  }
              -
              670  }
              -
              671  }
              -
              672 }
              -
              673 
              -
              674 AdaptationSet::AdaptationSet(uint32_t adaptation_set_id,
              -
              675  const std::string& lang,
              -
              676  const MpdOptions& mpd_options,
              -
              677  MpdBuilder::MpdType mpd_type,
              -
              678  base::AtomicSequenceNumber* counter)
              -
              679  : representations_deleter_(&representations_),
              -
              680  representation_counter_(counter),
              -
              681  id_(adaptation_set_id),
              -
              682  lang_(lang),
              -
              683  mpd_options_(mpd_options),
              -
              684  mpd_type_(mpd_type),
              -
              685  group_(kAdaptationSetGroupNotSet),
              -
              686  segments_aligned_(kSegmentAlignmentUnknown),
              -
              687  force_set_segment_alignment_(false) {
              -
              688  DCHECK(counter);
              -
              689 }
              -
              690 
              -
              691 AdaptationSet::~AdaptationSet() {}
              -
              692 
              -
              693 Representation* AdaptationSet::AddRepresentation(const MediaInfo& media_info) {
              -
              694  const uint32_t representation_id = representation_counter_->GetNext();
              -
              695  // Note that AdaptationSet outlive Representation, so this object
              -
              696  // will die before AdaptationSet.
              -
              697  std::unique_ptr<RepresentationStateChangeListener> listener(
              -
              698  new RepresentationStateChangeListenerImpl(representation_id, this));
              -
              699  std::unique_ptr<Representation> representation(new Representation(
              -
              700  media_info, mpd_options_, representation_id, std::move(listener)));
              -
              701 
              -
              702  if (!representation->Init())
              -
              703  return NULL;
              -
              704 
              -
              705  // For videos, record the width, height, and the frame rate to calculate the
              -
              706  // max {width,height,framerate} required for DASH IOP.
              -
              707  if (media_info.has_video_info()) {
              -
              708  const MediaInfo::VideoInfo& video_info = media_info.video_info();
              -
              709  DCHECK(video_info.has_width());
              -
              710  DCHECK(video_info.has_height());
              -
              711  video_widths_.insert(video_info.width());
              -
              712  video_heights_.insert(video_info.height());
              -
              713 
              -
              714  if (video_info.has_time_scale() && video_info.has_frame_duration())
              -
              715  RecordFrameRate(video_info.frame_duration(), video_info.time_scale());
              -
              716 
              -
              717  AddPictureAspectRatio(video_info, &picture_aspect_ratio_);
              -
              718  }
              -
              719 
              -
              720  if (media_info.has_video_info()) {
              -
              721  content_type_ = "video";
              -
              722  } else if (media_info.has_audio_info()) {
              -
              723  content_type_ = "audio";
              -
              724  } else if (media_info.has_text_info()) {
              -
              725  content_type_ = "text";
              -
              726 
              -
              727  if (media_info.text_info().has_type() &&
              -
              728  (media_info.text_info().type() != MediaInfo::TextInfo::UNKNOWN)) {
              -
              729  roles_.insert(MediaInfoTextTypeToRole(media_info.text_info().type()));
              -
              730  }
              -
              731  }
              +
              404  clock_(new base::DefaultClock()) {}
              +
              405 
              +
              406 MpdBuilder::~MpdBuilder() {}
              +
              407 
              +
              408 void MpdBuilder::AddBaseUrl(const std::string& base_url) {
              +
              409  base_urls_.push_back(base_url);
              +
              410 }
              +
              411 
              +
              412 AdaptationSet* MpdBuilder::AddAdaptationSet(const std::string& lang) {
              +
              413  std::unique_ptr<AdaptationSet> adaptation_set(
              +
              414  new AdaptationSet(adaptation_set_counter_.GetNext(), lang, mpd_options_,
              +
              415  type_, &representation_counter_));
              +
              416 
              +
              417  DCHECK(adaptation_set);
              +
              418  adaptation_sets_.push_back(std::move(adaptation_set));
              +
              419  return adaptation_sets_.back().get();
              +
              420 }
              +
              421 
              + +
              423  DCHECK(output_file);
              +
              424  return WriteMpdToOutput(output_file);
              +
              425 }
              +
              426 
              +
              427 bool MpdBuilder::ToString(std::string* output) {
              +
              428  DCHECK(output);
              +
              429  return WriteMpdToOutput(output);
              +
              430 }
              +
              431 template <typename OutputType>
              +
              432 bool MpdBuilder::WriteMpdToOutput(OutputType* output) {
              +
              433  static LibXmlInitializer lib_xml_initializer;
              +
              434 
              +
              435  xml::scoped_xml_ptr<xmlDoc> doc(GenerateMpd());
              +
              436  if (!doc.get())
              +
              437  return false;
              +
              438 
              +
              439  static const int kNiceFormat = 1;
              +
              440  int doc_str_size = 0;
              +
              441  xmlChar* doc_str = NULL;
              +
              442  xmlDocDumpFormatMemoryEnc(doc.get(), &doc_str, &doc_str_size, "UTF-8",
              +
              443  kNiceFormat);
              +
              444 
              +
              445  bool result = WriteXmlCharArrayToOutput(doc_str, doc_str_size, output);
              +
              446  xmlFree(doc_str);
              +
              447 
              +
              448  // Cleanup, free the doc.
              +
              449  doc.reset();
              +
              450  return result;
              +
              451 }
              +
              452 
              +
              453 xmlDocPtr MpdBuilder::GenerateMpd() {
              +
              454  // Setup nodes.
              +
              455  static const char kXmlVersion[] = "1.0";
              +
              456  xml::scoped_xml_ptr<xmlDoc> doc(xmlNewDoc(BAD_CAST kXmlVersion));
              +
              457  XmlNode mpd("MPD");
              +
              458 
              +
              459  // Iterate thru AdaptationSets and add them to one big Period element.
              +
              460  XmlNode period("Period");
              +
              461 
              +
              462  // Always set id=0 for now. Since this class can only generate one Period
              +
              463  // at the moment, just use a constant.
              +
              464  // Required for 'dynamic' MPDs.
              +
              465  period.SetId(0);
              +
              466  for (const std::unique_ptr<AdaptationSet>& adaptation_set :
              +
              467  adaptation_sets_) {
              +
              468  xml::scoped_xml_ptr<xmlNode> child(adaptation_set->GetXml());
              +
              469  if (!child.get() || !period.AddChild(std::move(child)))
              +
              470  return NULL;
              +
              471  }
              +
              472 
              +
              473  // Add baseurls to MPD.
              +
              474  std::list<std::string>::const_iterator base_urls_it = base_urls_.begin();
              +
              475  for (; base_urls_it != base_urls_.end(); ++base_urls_it) {
              +
              476  XmlNode base_url("BaseURL");
              +
              477  base_url.SetContent(*base_urls_it);
              +
              478 
              +
              479  if (!mpd.AddChild(base_url.PassScopedPtr()))
              +
              480  return NULL;
              +
              481  }
              +
              482 
              +
              483  if (type_ == kDynamic) {
              +
              484  // This is the only Period and it is a regular period.
              +
              485  period.SetStringAttribute("start", "PT0S");
              +
              486  }
              +
              487 
              +
              488  if (!mpd.AddChild(period.PassScopedPtr()))
              +
              489  return NULL;
              +
              490 
              +
              491  AddMpdNameSpaceInfo(&mpd);
              +
              492  AddCommonMpdInfo(&mpd);
              +
              493  switch (type_) {
              +
              494  case kStatic:
              +
              495  AddStaticMpdInfo(&mpd);
              +
              496  break;
              +
              497  case kDynamic:
              +
              498  AddDynamicMpdInfo(&mpd);
              +
              499  break;
              +
              500  default:
              +
              501  NOTREACHED() << "Unknown MPD type: " << type_;
              +
              502  break;
              +
              503  }
              +
              504 
              +
              505  DCHECK(doc);
              +
              506  const std::string version = GetPackagerVersion();
              +
              507  if (!version.empty()) {
              +
              508  std::string version_string =
              +
              509  base::StringPrintf("Generated with %s version %s",
              +
              510  GetPackagerProjectUrl().c_str(), version.c_str());
              +
              511  xml::scoped_xml_ptr<xmlNode> comment(
              +
              512  xmlNewDocComment(doc.get(), BAD_CAST version_string.c_str()));
              +
              513  xmlDocSetRootElement(doc.get(), comment.get());
              +
              514  xmlAddSibling(comment.release(), mpd.Release());
              +
              515  } else {
              +
              516  xmlDocSetRootElement(doc.get(), mpd.Release());
              +
              517  }
              +
              518  return doc.release();
              +
              519 }
              +
              520 
              +
              521 void MpdBuilder::AddCommonMpdInfo(XmlNode* mpd_node) {
              +
              522  if (Positive(mpd_options_.min_buffer_time)) {
              +
              523  mpd_node->SetStringAttribute(
              +
              524  "minBufferTime", SecondsToXmlDuration(mpd_options_.min_buffer_time));
              +
              525  } else {
              +
              526  LOG(ERROR) << "minBufferTime value not specified.";
              +
              527  // TODO(tinskip): Propagate error.
              +
              528  }
              +
              529 }
              +
              530 
              +
              531 void MpdBuilder::AddStaticMpdInfo(XmlNode* mpd_node) {
              +
              532  DCHECK(mpd_node);
              +
              533  DCHECK_EQ(MpdBuilder::kStatic, type_);
              +
              534 
              +
              535  static const char kStaticMpdType[] = "static";
              +
              536  static const char kStaticMpdProfile[] =
              +
              537  "urn:mpeg:dash:profile:isoff-on-demand:2011";
              +
              538  mpd_node->SetStringAttribute("type", kStaticMpdType);
              +
              539  mpd_node->SetStringAttribute("profiles", kStaticMpdProfile);
              +
              540  mpd_node->SetStringAttribute(
              +
              541  "mediaPresentationDuration",
              +
              542  SecondsToXmlDuration(GetStaticMpdDuration(mpd_node)));
              +
              543 }
              +
              544 
              +
              545 void MpdBuilder::AddDynamicMpdInfo(XmlNode* mpd_node) {
              +
              546  DCHECK(mpd_node);
              +
              547  DCHECK_EQ(MpdBuilder::kDynamic, type_);
              +
              548 
              +
              549  static const char kDynamicMpdType[] = "dynamic";
              +
              550  static const char kDynamicMpdProfile[] =
              +
              551  "urn:mpeg:dash:profile:isoff-live:2011";
              +
              552  mpd_node->SetStringAttribute("type", kDynamicMpdType);
              +
              553  mpd_node->SetStringAttribute("profiles", kDynamicMpdProfile);
              +
              554 
              +
              555  // No offset from NOW.
              +
              556  mpd_node->SetStringAttribute("publishTime",
              +
              557  XmlDateTimeNowWithOffset(0, clock_.get()));
              +
              558 
              +
              559  // 'availabilityStartTime' is required for dynamic profile. Calculate if
              +
              560  // not already calculated.
              +
              561  if (availability_start_time_.empty()) {
              +
              562  double earliest_presentation_time;
              +
              563  if (GetEarliestTimestamp(&earliest_presentation_time)) {
              +
              564  availability_start_time_ =
              +
              565  XmlDateTimeNowWithOffset(mpd_options_.availability_time_offset -
              +
              566  std::ceil(earliest_presentation_time),
              +
              567  clock_.get());
              +
              568  } else {
              +
              569  LOG(ERROR) << "Could not determine the earliest segment presentation "
              +
              570  "time for availabilityStartTime calculation.";
              +
              571  // TODO(tinskip). Propagate an error.
              +
              572  }
              +
              573  }
              +
              574  if (!availability_start_time_.empty())
              +
              575  mpd_node->SetStringAttribute("availabilityStartTime",
              +
              576  availability_start_time_);
              +
              577 
              +
              578  if (Positive(mpd_options_.minimum_update_period)) {
              +
              579  mpd_node->SetStringAttribute(
              +
              580  "minimumUpdatePeriod",
              +
              581  SecondsToXmlDuration(mpd_options_.minimum_update_period));
              +
              582  } else {
              +
              583  LOG(WARNING) << "The profile is dynamic but no minimumUpdatePeriod "
              +
              584  "specified.";
              +
              585  }
              +
              586 
              +
              587  SetIfPositive("timeShiftBufferDepth", mpd_options_.time_shift_buffer_depth,
              +
              588  mpd_node);
              +
              589  SetIfPositive("suggestedPresentationDelay",
              +
              590  mpd_options_.suggested_presentation_delay, mpd_node);
              +
              591 }
              +
              592 
              +
              593 float MpdBuilder::GetStaticMpdDuration(XmlNode* mpd_node) {
              +
              594  DCHECK(mpd_node);
              +
              595  DCHECK_EQ(MpdBuilder::kStatic, type_);
              +
              596 
              +
              597  xmlNodePtr period_node = FindPeriodNode(mpd_node);
              +
              598  DCHECK(period_node) << "Period element must be a child of mpd_node.";
              +
              599  DCHECK(IsPeriodNode(period_node));
              +
              600 
              +
              601  // Attribute mediaPresentationDuration must be present for 'static' MPD. So
              +
              602  // setting "PT0S" is required even if none of the representaions have duration
              +
              603  // attribute.
              +
              604  float max_duration = 0.0f;
              +
              605  for (xmlNodePtr adaptation_set = xmlFirstElementChild(period_node);
              +
              606  adaptation_set; adaptation_set = xmlNextElementSibling(adaptation_set)) {
              +
              607  for (xmlNodePtr representation = xmlFirstElementChild(adaptation_set);
              +
              608  representation;
              +
              609  representation = xmlNextElementSibling(representation)) {
              +
              610  float duration = 0.0f;
              +
              611  if (GetDurationAttribute(representation, &duration)) {
              +
              612  max_duration = max_duration > duration ? max_duration : duration;
              +
              613 
              +
              614  // 'duration' attribute is there only to help generate MPD, not
              +
              615  // necessary for MPD, remove the attribute.
              +
              616  xmlUnsetProp(representation, BAD_CAST "duration");
              +
              617  }
              +
              618  }
              +
              619  }
              +
              620 
              +
              621  return max_duration;
              +
              622 }
              +
              623 
              +
              624 bool MpdBuilder::GetEarliestTimestamp(double* timestamp_seconds) {
              +
              625  DCHECK(timestamp_seconds);
              +
              626 
              +
              627  double earliest_timestamp(-1);
              +
              628  for (const std::unique_ptr<AdaptationSet>& adaptation_set :
              +
              629  adaptation_sets_) {
              +
              630  double timestamp;
              +
              631  if (adaptation_set->GetEarliestTimestamp(&timestamp) &&
              +
              632  ((earliest_timestamp < 0) || (timestamp < earliest_timestamp))) {
              +
              633  earliest_timestamp = timestamp;
              +
              634  }
              +
              635  }
              +
              636  if (earliest_timestamp < 0)
              +
              637  return false;
              +
              638 
              +
              639  *timestamp_seconds = earliest_timestamp;
              +
              640  return true;
              +
              641 }
              +
              642 
              +
              643 void MpdBuilder::MakePathsRelativeToMpd(const std::string& mpd_path,
              +
              644  MediaInfo* media_info) {
              +
              645  DCHECK(media_info);
              +
              646  const std::string kFileProtocol("file://");
              +
              647  std::string mpd_file_path = (mpd_path.find(kFileProtocol) == 0)
              +
              648  ? mpd_path.substr(kFileProtocol.size())
              +
              649  : mpd_path;
              +
              650 
              +
              651  if (!mpd_file_path.empty()) {
              +
              652  std::string mpd_dir(FilePath::FromUTF8Unsafe(mpd_file_path)
              +
              653  .DirName().AsEndingWithSeparator().AsUTF8Unsafe());
              +
              654  if (!mpd_dir.empty()) {
              +
              655  if (media_info->has_media_file_name()) {
              +
              656  media_info->set_media_file_name(
              +
              657  MakePathRelative(media_info->media_file_name(), mpd_dir));
              +
              658  }
              +
              659  if (media_info->has_init_segment_name()) {
              +
              660  media_info->set_init_segment_name(
              +
              661  MakePathRelative(media_info->init_segment_name(), mpd_dir));
              +
              662  }
              +
              663  if (media_info->has_segment_template()) {
              +
              664  media_info->set_segment_template(
              +
              665  MakePathRelative(media_info->segment_template(), mpd_dir));
              +
              666  }
              +
              667  }
              +
              668  }
              +
              669 }
              +
              670 
              +
              671 AdaptationSet::AdaptationSet(uint32_t adaptation_set_id,
              +
              672  const std::string& lang,
              +
              673  const MpdOptions& mpd_options,
              +
              674  MpdBuilder::MpdType mpd_type,
              +
              675  base::AtomicSequenceNumber* counter)
              +
              676  : representation_counter_(counter),
              +
              677  id_(adaptation_set_id),
              +
              678  lang_(lang),
              +
              679  mpd_options_(mpd_options),
              +
              680  mpd_type_(mpd_type),
              +
              681  group_(kAdaptationSetGroupNotSet),
              +
              682  segments_aligned_(kSegmentAlignmentUnknown),
              +
              683  force_set_segment_alignment_(false) {
              +
              684  DCHECK(counter);
              +
              685 }
              +
              686 
              +
              687 AdaptationSet::~AdaptationSet() {}
              +
              688 
              +
              689 Representation* AdaptationSet::AddRepresentation(const MediaInfo& media_info) {
              +
              690  const uint32_t representation_id = representation_counter_->GetNext();
              +
              691  // Note that AdaptationSet outlive Representation, so this object
              +
              692  // will die before AdaptationSet.
              +
              693  std::unique_ptr<RepresentationStateChangeListener> listener(
              +
              694  new RepresentationStateChangeListenerImpl(representation_id, this));
              +
              695  std::unique_ptr<Representation> representation(new Representation(
              +
              696  media_info, mpd_options_, representation_id, std::move(listener)));
              +
              697 
              +
              698  if (!representation->Init())
              +
              699  return NULL;
              +
              700 
              +
              701  // For videos, record the width, height, and the frame rate to calculate the
              +
              702  // max {width,height,framerate} required for DASH IOP.
              +
              703  if (media_info.has_video_info()) {
              +
              704  const MediaInfo::VideoInfo& video_info = media_info.video_info();
              +
              705  DCHECK(video_info.has_width());
              +
              706  DCHECK(video_info.has_height());
              +
              707  video_widths_.insert(video_info.width());
              +
              708  video_heights_.insert(video_info.height());
              +
              709 
              +
              710  if (video_info.has_time_scale() && video_info.has_frame_duration())
              +
              711  RecordFrameRate(video_info.frame_duration(), video_info.time_scale());
              +
              712 
              +
              713  AddPictureAspectRatio(video_info, &picture_aspect_ratio_);
              +
              714  }
              +
              715 
              +
              716  if (media_info.has_video_info()) {
              +
              717  content_type_ = "video";
              +
              718  } else if (media_info.has_audio_info()) {
              +
              719  content_type_ = "audio";
              +
              720  } else if (media_info.has_text_info()) {
              +
              721  content_type_ = "text";
              +
              722 
              +
              723  if (media_info.text_info().has_type() &&
              +
              724  (media_info.text_info().type() != MediaInfo::TextInfo::UNKNOWN)) {
              +
              725  roles_.insert(MediaInfoTextTypeToRole(media_info.text_info().type()));
              +
              726  }
              +
              727  }
              +
              728 
              +
              729  representations_.push_back(std::move(representation));
              +
              730  return representations_.back().get();
              +
              731 }
              732 
              -
              733  representations_.push_back(representation.get());
              -
              734  return representation.release();
              -
              735 }
              -
              736 
              - -
              738  const ContentProtectionElement& content_protection_element) {
              -
              739  content_protection_elements_.push_back(content_protection_element);
              -
              740  RemoveDuplicateAttributes(&content_protection_elements_.back());
              -
              741 }
              -
              742 
              -
              743 void AdaptationSet::UpdateContentProtectionPssh(const std::string& drm_uuid,
              -
              744  const std::string& pssh) {
              -
              745  UpdateContentProtectionPsshHelper(drm_uuid, pssh,
              -
              746  &content_protection_elements_);
              + +
              734  const ContentProtectionElement& content_protection_element) {
              +
              735  content_protection_elements_.push_back(content_protection_element);
              +
              736  RemoveDuplicateAttributes(&content_protection_elements_.back());
              +
              737 }
              +
              738 
              +
              739 void AdaptationSet::UpdateContentProtectionPssh(const std::string& drm_uuid,
              +
              740  const std::string& pssh) {
              +
              741  UpdateContentProtectionPsshHelper(drm_uuid, pssh,
              +
              742  &content_protection_elements_);
              +
              743 }
              +
              744 
              +
              745 void AdaptationSet::AddRole(Role role) {
              +
              746  roles_.insert(role);
              747 }
              748 
              -
              749 void AdaptationSet::AddRole(Role role) {
              -
              750  roles_.insert(role);
              -
              751 }
              -
              752 
              -
              753 // Creates a copy of <AdaptationSet> xml element, iterate thru all the
              -
              754 // <Representation> (child) elements and add them to the copy.
              -
              755 // Set all the attributes first and then add the children elements so that flags
              -
              756 // can be passed to Representation to avoid setting redundant attributes. For
              -
              757 // example, if AdaptationSet@width is set, then Representation@width is
              -
              758 // redundant and should not be set.
              -
              759 xml::scoped_xml_ptr<xmlNode> AdaptationSet::GetXml() {
              -
              760  AdaptationSetXmlNode adaptation_set;
              +
              749 // Creates a copy of <AdaptationSet> xml element, iterate thru all the
              +
              750 // <Representation> (child) elements and add them to the copy.
              +
              751 // Set all the attributes first and then add the children elements so that flags
              +
              752 // can be passed to Representation to avoid setting redundant attributes. For
              +
              753 // example, if AdaptationSet@width is set, then Representation@width is
              +
              754 // redundant and should not be set.
              +
              755 xml::scoped_xml_ptr<xmlNode> AdaptationSet::GetXml() {
              +
              756  AdaptationSetXmlNode adaptation_set;
              +
              757 
              +
              758  bool suppress_representation_width = false;
              +
              759  bool suppress_representation_height = false;
              +
              760  bool suppress_representation_frame_rate = false;
              761 
              -
              762  bool suppress_representation_width = false;
              -
              763  bool suppress_representation_height = false;
              -
              764  bool suppress_representation_frame_rate = false;
              -
              765 
              -
              766  adaptation_set.SetId(id_);
              -
              767  adaptation_set.SetStringAttribute("contentType", content_type_);
              -
              768  if (!lang_.empty() && lang_ != "und") {
              -
              769  adaptation_set.SetStringAttribute("lang", LanguageToShortestForm(lang_));
              -
              770  }
              -
              771 
              -
              772  // Note that std::{set,map} are ordered, so the last element is the max value.
              -
              773  if (video_widths_.size() == 1) {
              -
              774  suppress_representation_width = true;
              -
              775  adaptation_set.SetIntegerAttribute("width", *video_widths_.begin());
              -
              776  } else if (video_widths_.size() > 1) {
              -
              777  adaptation_set.SetIntegerAttribute("maxWidth", *video_widths_.rbegin());
              -
              778  }
              -
              779  if (video_heights_.size() == 1) {
              -
              780  suppress_representation_height = true;
              -
              781  adaptation_set.SetIntegerAttribute("height", *video_heights_.begin());
              -
              782  } else if (video_heights_.size() > 1) {
              -
              783  adaptation_set.SetIntegerAttribute("maxHeight", *video_heights_.rbegin());
              -
              784  }
              -
              785 
              -
              786  if (video_frame_rates_.size() == 1) {
              -
              787  suppress_representation_frame_rate = true;
              -
              788  adaptation_set.SetStringAttribute("frameRate",
              -
              789  video_frame_rates_.begin()->second);
              -
              790  } else if (video_frame_rates_.size() > 1) {
              -
              791  adaptation_set.SetStringAttribute("maxFrameRate",
              -
              792  video_frame_rates_.rbegin()->second);
              -
              793  }
              -
              794 
              -
              795  // Note: must be checked before checking segments_aligned_ (below). So that
              -
              796  // segments_aligned_ is set before checking below.
              -
              797  if (mpd_type_ == MpdBuilder::kStatic) {
              -
              798  CheckVodSegmentAlignment();
              -
              799  }
              -
              800 
              -
              801  if (segments_aligned_ == kSegmentAlignmentTrue) {
              -
              802  adaptation_set.SetStringAttribute(mpd_type_ == MpdBuilder::kStatic
              -
              803  ? "subsegmentAlignment"
              -
              804  : "segmentAlignment",
              -
              805  "true");
              -
              806  }
              -
              807 
              -
              808  if (picture_aspect_ratio_.size() == 1)
              -
              809  adaptation_set.SetStringAttribute("par", *picture_aspect_ratio_.begin());
              -
              810 
              -
              811  if (group_ >= 0)
              -
              812  adaptation_set.SetIntegerAttribute("group", group_);
              -
              813 
              -
              814  if (!adaptation_set.AddContentProtectionElements(
              -
              815  content_protection_elements_)) {
              -
              816  return xml::scoped_xml_ptr<xmlNode>();
              -
              817  }
              -
              818  for (AdaptationSet::Role role : roles_)
              -
              819  adaptation_set.AddRoleElement("urn:mpeg:dash:role:2011", RoleToText(role));
              -
              820 
              -
              821  for (Representation* representation : representations_) {
              -
              822  if (suppress_representation_width)
              -
              823  representation->SuppressOnce(Representation::kSuppressWidth);
              -
              824  if (suppress_representation_height)
              -
              825  representation->SuppressOnce(Representation::kSuppressHeight);
              -
              826  if (suppress_representation_frame_rate)
              -
              827  representation->SuppressOnce(Representation::kSuppressFrameRate);
              -
              828  xml::scoped_xml_ptr<xmlNode> child(representation->GetXml());
              -
              829  if (!child || !adaptation_set.AddChild(std::move(child)))
              -
              830  return xml::scoped_xml_ptr<xmlNode>();
              -
              831  }
              +
              762  adaptation_set.SetId(id_);
              +
              763  adaptation_set.SetStringAttribute("contentType", content_type_);
              +
              764  if (!lang_.empty() && lang_ != "und") {
              +
              765  adaptation_set.SetStringAttribute("lang", LanguageToShortestForm(lang_));
              +
              766  }
              +
              767 
              +
              768  // Note that std::{set,map} are ordered, so the last element is the max value.
              +
              769  if (video_widths_.size() == 1) {
              +
              770  suppress_representation_width = true;
              +
              771  adaptation_set.SetIntegerAttribute("width", *video_widths_.begin());
              +
              772  } else if (video_widths_.size() > 1) {
              +
              773  adaptation_set.SetIntegerAttribute("maxWidth", *video_widths_.rbegin());
              +
              774  }
              +
              775  if (video_heights_.size() == 1) {
              +
              776  suppress_representation_height = true;
              +
              777  adaptation_set.SetIntegerAttribute("height", *video_heights_.begin());
              +
              778  } else if (video_heights_.size() > 1) {
              +
              779  adaptation_set.SetIntegerAttribute("maxHeight", *video_heights_.rbegin());
              +
              780  }
              +
              781 
              +
              782  if (video_frame_rates_.size() == 1) {
              +
              783  suppress_representation_frame_rate = true;
              +
              784  adaptation_set.SetStringAttribute("frameRate",
              +
              785  video_frame_rates_.begin()->second);
              +
              786  } else if (video_frame_rates_.size() > 1) {
              +
              787  adaptation_set.SetStringAttribute("maxFrameRate",
              +
              788  video_frame_rates_.rbegin()->second);
              +
              789  }
              +
              790 
              +
              791  // Note: must be checked before checking segments_aligned_ (below). So that
              +
              792  // segments_aligned_ is set before checking below.
              +
              793  if (mpd_type_ == MpdBuilder::kStatic) {
              +
              794  CheckVodSegmentAlignment();
              +
              795  }
              +
              796 
              +
              797  if (segments_aligned_ == kSegmentAlignmentTrue) {
              +
              798  adaptation_set.SetStringAttribute(mpd_type_ == MpdBuilder::kStatic
              +
              799  ? "subsegmentAlignment"
              +
              800  : "segmentAlignment",
              +
              801  "true");
              +
              802  }
              +
              803 
              +
              804  if (picture_aspect_ratio_.size() == 1)
              +
              805  adaptation_set.SetStringAttribute("par", *picture_aspect_ratio_.begin());
              +
              806 
              +
              807  if (group_ >= 0)
              +
              808  adaptation_set.SetIntegerAttribute("group", group_);
              +
              809 
              +
              810  if (!adaptation_set.AddContentProtectionElements(
              +
              811  content_protection_elements_)) {
              +
              812  return xml::scoped_xml_ptr<xmlNode>();
              +
              813  }
              +
              814  for (AdaptationSet::Role role : roles_)
              +
              815  adaptation_set.AddRoleElement("urn:mpeg:dash:role:2011", RoleToText(role));
              +
              816 
              +
              817  for (const std::unique_ptr<Representation>& representation :
              +
              818  representations_) {
              +
              819  if (suppress_representation_width)
              +
              820  representation->SuppressOnce(Representation::kSuppressWidth);
              +
              821  if (suppress_representation_height)
              +
              822  representation->SuppressOnce(Representation::kSuppressHeight);
              +
              823  if (suppress_representation_frame_rate)
              +
              824  representation->SuppressOnce(Representation::kSuppressFrameRate);
              +
              825  xml::scoped_xml_ptr<xmlNode> child(representation->GetXml());
              +
              826  if (!child || !adaptation_set.AddChild(std::move(child)))
              +
              827  return xml::scoped_xml_ptr<xmlNode>();
              +
              828  }
              +
              829 
              +
              830  return adaptation_set.PassScopedPtr();
              +
              831 }
              832 
              -
              833  return adaptation_set.PassScopedPtr();
              -
              834 }
              -
              835 
              -
              836 void AdaptationSet::ForceSetSegmentAlignment(bool segment_alignment) {
              -
              837  segments_aligned_ =
              -
              838  segment_alignment ? kSegmentAlignmentTrue : kSegmentAlignmentFalse;
              -
              839  force_set_segment_alignment_ = true;
              -
              840 }
              -
              841 
              -
              842 void AdaptationSet::SetGroup(int group_number) {
              -
              843  group_ = group_number;
              -
              844 }
              -
              845 
              -
              846 int AdaptationSet::Group() const {
              -
              847  return group_;
              -
              848 }
              -
              849 
              -
              850 // Check segmentAlignment for Live here. Storing all start_time and duration
              -
              851 // will out-of-memory because there's no way of knowing when it will end.
              -
              852 // VOD subsegmentAlignment check is *not* done here because it is possible
              -
              853 // that some Representations might not have been added yet (e.g. a thread is
              -
              854 // assigned per muxer so one might run faster than others).
              -
              855 // To be clear, for Live, all Representations should be added before a
              -
              856 // segment is added.
              -
              857 void AdaptationSet::OnNewSegmentForRepresentation(uint32_t representation_id,
              -
              858  uint64_t start_time,
              -
              859  uint64_t duration) {
              -
              860  if (mpd_type_ == MpdBuilder::kDynamic) {
              -
              861  CheckLiveSegmentAlignment(representation_id, start_time, duration);
              -
              862  } else {
              -
              863  representation_segment_start_times_[representation_id].push_back(
              -
              864  start_time);
              -
              865  }
              -
              866 }
              -
              867 
              - -
              869  uint32_t representation_id,
              -
              870  uint32_t frame_duration,
              -
              871  uint32_t timescale) {
              -
              872  RecordFrameRate(frame_duration, timescale);
              -
              873 }
              +
              833 void AdaptationSet::ForceSetSegmentAlignment(bool segment_alignment) {
              +
              834  segments_aligned_ =
              +
              835  segment_alignment ? kSegmentAlignmentTrue : kSegmentAlignmentFalse;
              +
              836  force_set_segment_alignment_ = true;
              +
              837 }
              +
              838 
              +
              839 void AdaptationSet::SetGroup(int group_number) {
              +
              840  group_ = group_number;
              +
              841 }
              +
              842 
              +
              843 int AdaptationSet::Group() const {
              +
              844  return group_;
              +
              845 }
              +
              846 
              +
              847 // Check segmentAlignment for Live here. Storing all start_time and duration
              +
              848 // will out-of-memory because there's no way of knowing when it will end.
              +
              849 // VOD subsegmentAlignment check is *not* done here because it is possible
              +
              850 // that some Representations might not have been added yet (e.g. a thread is
              +
              851 // assigned per muxer so one might run faster than others).
              +
              852 // To be clear, for Live, all Representations should be added before a
              +
              853 // segment is added.
              +
              854 void AdaptationSet::OnNewSegmentForRepresentation(uint32_t representation_id,
              +
              855  uint64_t start_time,
              +
              856  uint64_t duration) {
              +
              857  if (mpd_type_ == MpdBuilder::kDynamic) {
              +
              858  CheckLiveSegmentAlignment(representation_id, start_time, duration);
              +
              859  } else {
              +
              860  representation_segment_start_times_[representation_id].push_back(
              +
              861  start_time);
              +
              862  }
              +
              863 }
              +
              864 
              + +
              866  uint32_t representation_id,
              +
              867  uint32_t frame_duration,
              +
              868  uint32_t timescale) {
              +
              869  RecordFrameRate(frame_duration, timescale);
              +
              870 }
              +
              871 
              +
              872 bool AdaptationSet::GetEarliestTimestamp(double* timestamp_seconds) {
              +
              873  DCHECK(timestamp_seconds);
              874 
              -
              875 bool AdaptationSet::GetEarliestTimestamp(double* timestamp_seconds) {
              -
              876  DCHECK(timestamp_seconds);
              -
              877 
              -
              878  double earliest_timestamp(-1);
              -
              879  for (std::list<Representation*>::const_iterator iter =
              -
              880  representations_.begin();
              -
              881  iter != representations_.end(); ++iter) {
              -
              882  double timestamp;
              -
              883  if ((*iter)->GetEarliestTimestamp(&timestamp) &&
              -
              884  ((earliest_timestamp < 0) || (timestamp < earliest_timestamp))) {
              -
              885  earliest_timestamp = timestamp;
              -
              886  }
              -
              887  }
              -
              888  if (earliest_timestamp < 0)
              -
              889  return false;
              +
              875  double earliest_timestamp(-1);
              +
              876  for (const std::unique_ptr<Representation>& representation :
              +
              877  representations_) {
              +
              878  double timestamp;
              +
              879  if (representation->GetEarliestTimestamp(&timestamp) &&
              +
              880  ((earliest_timestamp < 0) || (timestamp < earliest_timestamp))) {
              +
              881  earliest_timestamp = timestamp;
              +
              882  }
              +
              883  }
              +
              884  if (earliest_timestamp < 0)
              +
              885  return false;
              +
              886 
              +
              887  *timestamp_seconds = earliest_timestamp;
              +
              888  return true;
              +
              889 }
              890 
              -
              891  *timestamp_seconds = earliest_timestamp;
              -
              892  return true;
              -
              893 }
              -
              894 
              -
              895 // This implementation assumes that each representations' segments' are
              -
              896 // contiguous.
              -
              897 // Also assumes that all Representations are added before this is called.
              -
              898 // This checks whether the first elements of the lists in
              -
              899 // representation_segment_start_times_ are aligned.
              -
              900 // For example, suppose this method was just called with args rep_id=2
              -
              901 // start_time=1.
              -
              902 // 1 -> [1, 100, 200]
              -
              903 // 2 -> [1]
              -
              904 // The timestamps of the first elements match, so this flags
              -
              905 // segments_aligned_=true.
              -
              906 // Also since the first segment start times match, the first element of all the
              -
              907 // lists are removed, so the map of lists becomes:
              -
              908 // 1 -> [100, 200]
              -
              909 // 2 -> []
              -
              910 // Note that there could be false positives.
              -
              911 // e.g. just got rep_id=3 start_time=1 duration=300, and the duration of the
              -
              912 // whole AdaptationSet is 300.
              -
              913 // 1 -> [1, 100, 200]
              -
              914 // 2 -> [1, 90, 100]
              -
              915 // 3 -> [1]
              -
              916 // They are not aligned but this will be marked as aligned.
              -
              917 // But since this is unlikely to happen in the packager (and to save
              -
              918 // computation), this isn't handled at the moment.
              -
              919 void AdaptationSet::CheckLiveSegmentAlignment(uint32_t representation_id,
              -
              920  uint64_t start_time,
              -
              921  uint64_t /* duration */) {
              -
              922  if (segments_aligned_ == kSegmentAlignmentFalse ||
              -
              923  force_set_segment_alignment_) {
              -
              924  return;
              -
              925  }
              -
              926 
              -
              927  std::list<uint64_t>& representation_start_times =
              -
              928  representation_segment_start_times_[representation_id];
              -
              929  representation_start_times.push_back(start_time);
              -
              930  // There's no way to detemine whether the segments are aligned if some
              -
              931  // representations do not have any segments.
              -
              932  if (representation_segment_start_times_.size() != representations_.size())
              -
              933  return;
              -
              934 
              -
              935  DCHECK(!representation_start_times.empty());
              -
              936  const uint64_t expected_start_time = representation_start_times.front();
              -
              937  for (RepresentationTimeline::const_iterator it =
              -
              938  representation_segment_start_times_.begin();
              -
              939  it != representation_segment_start_times_.end(); ++it) {
              -
              940  // If there are no entries in a list, then there is no way for the
              -
              941  // segment alignment status to change.
              -
              942  // Note that it can be empty because entries get deleted below.
              -
              943  if (it->second.empty())
              -
              944  return;
              -
              945 
              -
              946  if (expected_start_time != it->second.front()) {
              -
              947  // Flag as false and clear the start times data, no need to keep it
              -
              948  // around.
              -
              949  segments_aligned_ = kSegmentAlignmentFalse;
              -
              950  representation_segment_start_times_.clear();
              -
              951  return;
              -
              952  }
              -
              953  }
              -
              954  segments_aligned_ = kSegmentAlignmentTrue;
              -
              955 
              -
              956  for (RepresentationTimeline::iterator it =
              -
              957  representation_segment_start_times_.begin();
              -
              958  it != representation_segment_start_times_.end(); ++it) {
              -
              959  it->second.pop_front();
              -
              960  }
              -
              961 }
              -
              962 
              -
              963 // Make sure all segements start times match for all Representations.
              -
              964 // This assumes that the segments are contiguous.
              -
              965 void AdaptationSet::CheckVodSegmentAlignment() {
              -
              966  if (segments_aligned_ == kSegmentAlignmentFalse ||
              -
              967  force_set_segment_alignment_) {
              -
              968  return;
              -
              969  }
              -
              970  if (representation_segment_start_times_.empty())
              -
              971  return;
              -
              972  if (representation_segment_start_times_.size() == 1) {
              -
              973  segments_aligned_ = kSegmentAlignmentTrue;
              -
              974  return;
              -
              975  }
              -
              976 
              -
              977  // This is not the most efficient implementation to compare the values
              -
              978  // because expected_time_line is compared against all other time lines, but
              -
              979  // probably the most readable.
              -
              980  const std::list<uint64_t>& expected_time_line =
              -
              981  representation_segment_start_times_.begin()->second;
              -
              982 
              -
              983  bool all_segment_time_line_same_length = true;
              -
              984  // Note that the first entry is skipped because it is expected_time_line.
              -
              985  RepresentationTimeline::const_iterator it =
              -
              986  representation_segment_start_times_.begin();
              -
              987  for (++it; it != representation_segment_start_times_.end(); ++it) {
              -
              988  const std::list<uint64_t>& other_time_line = it->second;
              -
              989  if (expected_time_line.size() != other_time_line.size()) {
              -
              990  all_segment_time_line_same_length = false;
              -
              991  }
              -
              992 
              -
              993  const std::list<uint64_t>* longer_list = &other_time_line;
              -
              994  const std::list<uint64_t>* shorter_list = &expected_time_line;
              -
              995  if (expected_time_line.size() > other_time_line.size()) {
              -
              996  shorter_list = &other_time_line;
              -
              997  longer_list = &expected_time_line;
              -
              998  }
              -
              999 
              -
              1000  if (!std::equal(shorter_list->begin(), shorter_list->end(),
              -
              1001  longer_list->begin())) {
              -
              1002  // Some segments are definitely unaligned.
              -
              1003  segments_aligned_ = kSegmentAlignmentFalse;
              -
              1004  representation_segment_start_times_.clear();
              -
              1005  return;
              -
              1006  }
              -
              1007  }
              -
              1008 
              -
              1009  // TODO(rkuroiwa): The right way to do this is to also check the durations.
              -
              1010  // For example:
              -
              1011  // (a) 3 4 5
              -
              1012  // (b) 3 4 5 6
              -
              1013  // could be true or false depending on the length of the third segment of (a).
              -
              1014  // i.e. if length of the third segment is 2, then this is not aligned.
              -
              1015  if (!all_segment_time_line_same_length) {
              -
              1016  segments_aligned_ = kSegmentAlignmentUnknown;
              -
              1017  return;
              -
              1018  }
              -
              1019 
              -
              1020  segments_aligned_ = kSegmentAlignmentTrue;
              -
              1021 }
              -
              1022 
              -
              1023 // Since all AdaptationSet cares about is the maxFrameRate, representation_id
              -
              1024 // is not passed to this method.
              -
              1025 void AdaptationSet::RecordFrameRate(uint32_t frame_duration,
              -
              1026  uint32_t timescale) {
              -
              1027  if (frame_duration == 0) {
              -
              1028  LOG(ERROR) << "Frame duration is 0 and cannot be set.";
              -
              1029  return;
              -
              1030  }
              -
              1031  video_frame_rates_[static_cast<double>(timescale) / frame_duration] =
              -
              1032  base::IntToString(timescale) + "/" + base::IntToString(frame_duration);
              -
              1033 }
              -
              1034 
              - -
              1036  const MediaInfo& media_info,
              -
              1037  const MpdOptions& mpd_options,
              -
              1038  uint32_t id,
              -
              1039  std::unique_ptr<RepresentationStateChangeListener> state_change_listener)
              -
              1040  : media_info_(media_info),
              -
              1041  id_(id),
              -
              1042  bandwidth_estimator_(BandwidthEstimator::kUseAllBlocks),
              -
              1043  mpd_options_(mpd_options),
              -
              1044  start_number_(1),
              -
              1045  state_change_listener_(std::move(state_change_listener)),
              -
              1046  output_suppression_flags_(0) {}
              -
              1047 
              -
              1048 Representation::~Representation() {}
              -
              1049 
              - -
              1051  if (!AtLeastOneTrue(media_info_.has_video_info(),
              -
              1052  media_info_.has_audio_info(),
              -
              1053  media_info_.has_text_info())) {
              -
              1054  // This is an error. Segment information can be in AdaptationSet, Period, or
              -
              1055  // MPD but the interface does not provide a way to set them.
              -
              1056  // See 5.3.9.1 ISO 23009-1:2012 for segment info.
              -
              1057  LOG(ERROR) << "Representation needs one of video, audio, or text.";
              -
              1058  return false;
              -
              1059  }
              -
              1060 
              -
              1061  if (MoreThanOneTrue(media_info_.has_video_info(),
              -
              1062  media_info_.has_audio_info(),
              -
              1063  media_info_.has_text_info())) {
              -
              1064  LOG(ERROR) << "Only one of VideoInfo, AudioInfo, or TextInfo can be set.";
              -
              1065  return false;
              -
              1066  }
              -
              1067 
              -
              1068  if (media_info_.container_type() == MediaInfo::CONTAINER_UNKNOWN) {
              -
              1069  LOG(ERROR) << "'container_type' in MediaInfo cannot be CONTAINER_UNKNOWN.";
              -
              1070  return false;
              -
              1071  }
              -
              1072 
              -
              1073  if (media_info_.has_video_info()) {
              -
              1074  mime_type_ = GetVideoMimeType();
              -
              1075  if (!HasRequiredVideoFields(media_info_.video_info())) {
              -
              1076  LOG(ERROR) << "Missing required fields to create a video Representation.";
              -
              1077  return false;
              -
              1078  }
              -
              1079  } else if (media_info_.has_audio_info()) {
              -
              1080  mime_type_ = GetAudioMimeType();
              -
              1081  } else if (media_info_.has_text_info()) {
              -
              1082  mime_type_ = GetTextMimeType();
              -
              1083  }
              -
              1084 
              -
              1085  if (mime_type_.empty())
              -
              1086  return false;
              +
              891 // This implementation assumes that each representations' segments' are
              +
              892 // contiguous.
              +
              893 // Also assumes that all Representations are added before this is called.
              +
              894 // This checks whether the first elements of the lists in
              +
              895 // representation_segment_start_times_ are aligned.
              +
              896 // For example, suppose this method was just called with args rep_id=2
              +
              897 // start_time=1.
              +
              898 // 1 -> [1, 100, 200]
              +
              899 // 2 -> [1]
              +
              900 // The timestamps of the first elements match, so this flags
              +
              901 // segments_aligned_=true.
              +
              902 // Also since the first segment start times match, the first element of all the
              +
              903 // lists are removed, so the map of lists becomes:
              +
              904 // 1 -> [100, 200]
              +
              905 // 2 -> []
              +
              906 // Note that there could be false positives.
              +
              907 // e.g. just got rep_id=3 start_time=1 duration=300, and the duration of the
              +
              908 // whole AdaptationSet is 300.
              +
              909 // 1 -> [1, 100, 200]
              +
              910 // 2 -> [1, 90, 100]
              +
              911 // 3 -> [1]
              +
              912 // They are not aligned but this will be marked as aligned.
              +
              913 // But since this is unlikely to happen in the packager (and to save
              +
              914 // computation), this isn't handled at the moment.
              +
              915 void AdaptationSet::CheckLiveSegmentAlignment(uint32_t representation_id,
              +
              916  uint64_t start_time,
              +
              917  uint64_t /* duration */) {
              +
              918  if (segments_aligned_ == kSegmentAlignmentFalse ||
              +
              919  force_set_segment_alignment_) {
              +
              920  return;
              +
              921  }
              +
              922 
              +
              923  std::list<uint64_t>& representation_start_times =
              +
              924  representation_segment_start_times_[representation_id];
              +
              925  representation_start_times.push_back(start_time);
              +
              926  // There's no way to detemine whether the segments are aligned if some
              +
              927  // representations do not have any segments.
              +
              928  if (representation_segment_start_times_.size() != representations_.size())
              +
              929  return;
              +
              930 
              +
              931  DCHECK(!representation_start_times.empty());
              +
              932  const uint64_t expected_start_time = representation_start_times.front();
              +
              933  for (RepresentationTimeline::const_iterator it =
              +
              934  representation_segment_start_times_.begin();
              +
              935  it != representation_segment_start_times_.end(); ++it) {
              +
              936  // If there are no entries in a list, then there is no way for the
              +
              937  // segment alignment status to change.
              +
              938  // Note that it can be empty because entries get deleted below.
              +
              939  if (it->second.empty())
              +
              940  return;
              +
              941 
              +
              942  if (expected_start_time != it->second.front()) {
              +
              943  // Flag as false and clear the start times data, no need to keep it
              +
              944  // around.
              +
              945  segments_aligned_ = kSegmentAlignmentFalse;
              +
              946  representation_segment_start_times_.clear();
              +
              947  return;
              +
              948  }
              +
              949  }
              +
              950  segments_aligned_ = kSegmentAlignmentTrue;
              +
              951 
              +
              952  for (RepresentationTimeline::iterator it =
              +
              953  representation_segment_start_times_.begin();
              +
              954  it != representation_segment_start_times_.end(); ++it) {
              +
              955  it->second.pop_front();
              +
              956  }
              +
              957 }
              +
              958 
              +
              959 // Make sure all segements start times match for all Representations.
              +
              960 // This assumes that the segments are contiguous.
              +
              961 void AdaptationSet::CheckVodSegmentAlignment() {
              +
              962  if (segments_aligned_ == kSegmentAlignmentFalse ||
              +
              963  force_set_segment_alignment_) {
              +
              964  return;
              +
              965  }
              +
              966  if (representation_segment_start_times_.empty())
              +
              967  return;
              +
              968  if (representation_segment_start_times_.size() == 1) {
              +
              969  segments_aligned_ = kSegmentAlignmentTrue;
              +
              970  return;
              +
              971  }
              +
              972 
              +
              973  // This is not the most efficient implementation to compare the values
              +
              974  // because expected_time_line is compared against all other time lines, but
              +
              975  // probably the most readable.
              +
              976  const std::list<uint64_t>& expected_time_line =
              +
              977  representation_segment_start_times_.begin()->second;
              +
              978 
              +
              979  bool all_segment_time_line_same_length = true;
              +
              980  // Note that the first entry is skipped because it is expected_time_line.
              +
              981  RepresentationTimeline::const_iterator it =
              +
              982  representation_segment_start_times_.begin();
              +
              983  for (++it; it != representation_segment_start_times_.end(); ++it) {
              +
              984  const std::list<uint64_t>& other_time_line = it->second;
              +
              985  if (expected_time_line.size() != other_time_line.size()) {
              +
              986  all_segment_time_line_same_length = false;
              +
              987  }
              +
              988 
              +
              989  const std::list<uint64_t>* longer_list = &other_time_line;
              +
              990  const std::list<uint64_t>* shorter_list = &expected_time_line;
              +
              991  if (expected_time_line.size() > other_time_line.size()) {
              +
              992  shorter_list = &other_time_line;
              +
              993  longer_list = &expected_time_line;
              +
              994  }
              +
              995 
              +
              996  if (!std::equal(shorter_list->begin(), shorter_list->end(),
              +
              997  longer_list->begin())) {
              +
              998  // Some segments are definitely unaligned.
              +
              999  segments_aligned_ = kSegmentAlignmentFalse;
              +
              1000  representation_segment_start_times_.clear();
              +
              1001  return;
              +
              1002  }
              +
              1003  }
              +
              1004 
              +
              1005  // TODO(rkuroiwa): The right way to do this is to also check the durations.
              +
              1006  // For example:
              +
              1007  // (a) 3 4 5
              +
              1008  // (b) 3 4 5 6
              +
              1009  // could be true or false depending on the length of the third segment of (a).
              +
              1010  // i.e. if length of the third segment is 2, then this is not aligned.
              +
              1011  if (!all_segment_time_line_same_length) {
              +
              1012  segments_aligned_ = kSegmentAlignmentUnknown;
              +
              1013  return;
              +
              1014  }
              +
              1015 
              +
              1016  segments_aligned_ = kSegmentAlignmentTrue;
              +
              1017 }
              +
              1018 
              +
              1019 // Since all AdaptationSet cares about is the maxFrameRate, representation_id
              +
              1020 // is not passed to this method.
              +
              1021 void AdaptationSet::RecordFrameRate(uint32_t frame_duration,
              +
              1022  uint32_t timescale) {
              +
              1023  if (frame_duration == 0) {
              +
              1024  LOG(ERROR) << "Frame duration is 0 and cannot be set.";
              +
              1025  return;
              +
              1026  }
              +
              1027  video_frame_rates_[static_cast<double>(timescale) / frame_duration] =
              +
              1028  base::IntToString(timescale) + "/" + base::IntToString(frame_duration);
              +
              1029 }
              +
              1030 
              + +
              1032  const MediaInfo& media_info,
              +
              1033  const MpdOptions& mpd_options,
              +
              1034  uint32_t id,
              +
              1035  std::unique_ptr<RepresentationStateChangeListener> state_change_listener)
              +
              1036  : media_info_(media_info),
              +
              1037  id_(id),
              +
              1038  bandwidth_estimator_(BandwidthEstimator::kUseAllBlocks),
              +
              1039  mpd_options_(mpd_options),
              +
              1040  start_number_(1),
              +
              1041  state_change_listener_(std::move(state_change_listener)),
              +
              1042  output_suppression_flags_(0) {}
              +
              1043 
              +
              1044 Representation::~Representation() {}
              +
              1045 
              + +
              1047  if (!AtLeastOneTrue(media_info_.has_video_info(),
              +
              1048  media_info_.has_audio_info(),
              +
              1049  media_info_.has_text_info())) {
              +
              1050  // This is an error. Segment information can be in AdaptationSet, Period, or
              +
              1051  // MPD but the interface does not provide a way to set them.
              +
              1052  // See 5.3.9.1 ISO 23009-1:2012 for segment info.
              +
              1053  LOG(ERROR) << "Representation needs one of video, audio, or text.";
              +
              1054  return false;
              +
              1055  }
              +
              1056 
              +
              1057  if (MoreThanOneTrue(media_info_.has_video_info(),
              +
              1058  media_info_.has_audio_info(),
              +
              1059  media_info_.has_text_info())) {
              +
              1060  LOG(ERROR) << "Only one of VideoInfo, AudioInfo, or TextInfo can be set.";
              +
              1061  return false;
              +
              1062  }
              +
              1063 
              +
              1064  if (media_info_.container_type() == MediaInfo::CONTAINER_UNKNOWN) {
              +
              1065  LOG(ERROR) << "'container_type' in MediaInfo cannot be CONTAINER_UNKNOWN.";
              +
              1066  return false;
              +
              1067  }
              +
              1068 
              +
              1069  if (media_info_.has_video_info()) {
              +
              1070  mime_type_ = GetVideoMimeType();
              +
              1071  if (!HasRequiredVideoFields(media_info_.video_info())) {
              +
              1072  LOG(ERROR) << "Missing required fields to create a video Representation.";
              +
              1073  return false;
              +
              1074  }
              +
              1075  } else if (media_info_.has_audio_info()) {
              +
              1076  mime_type_ = GetAudioMimeType();
              +
              1077  } else if (media_info_.has_text_info()) {
              +
              1078  mime_type_ = GetTextMimeType();
              +
              1079  }
              +
              1080 
              +
              1081  if (mime_type_.empty())
              +
              1082  return false;
              +
              1083 
              +
              1084  codecs_ = GetCodecs(media_info_);
              +
              1085  return true;
              +
              1086 }
              1087 
              -
              1088  codecs_ = GetCodecs(media_info_);
              -
              1089  return true;
              -
              1090 }
              -
              1091 
              - -
              1093  const ContentProtectionElement& content_protection_element) {
              -
              1094  content_protection_elements_.push_back(content_protection_element);
              -
              1095  RemoveDuplicateAttributes(&content_protection_elements_.back());
              -
              1096 }
              -
              1097 
              -
              1098 void Representation::UpdateContentProtectionPssh(const std::string& drm_uuid,
              -
              1099  const std::string& pssh) {
              -
              1100  UpdateContentProtectionPsshHelper(drm_uuid, pssh,
              -
              1101  &content_protection_elements_);
              -
              1102 }
              -
              1103 
              -
              1104 void Representation::AddNewSegment(uint64_t start_time,
              -
              1105  uint64_t duration,
              -
              1106  uint64_t size) {
              -
              1107  if (start_time == 0 && duration == 0) {
              -
              1108  LOG(WARNING) << "Got segment with start_time and duration == 0. Ignoring.";
              -
              1109  return;
              -
              1110  }
              -
              1111 
              -
              1112  if (state_change_listener_)
              -
              1113  state_change_listener_->OnNewSegmentForRepresentation(start_time, duration);
              -
              1114  if (IsContiguous(start_time, duration, size)) {
              -
              1115  ++segment_infos_.back().repeat;
              -
              1116  } else {
              -
              1117  SegmentInfo s = {start_time, duration, /* Not repeat. */ 0};
              -
              1118  segment_infos_.push_back(s);
              -
              1119  }
              -
              1120 
              -
              1121  bandwidth_estimator_.AddBlock(
              -
              1122  size, static_cast<double>(duration) / media_info_.reference_time_scale());
              + +
              1089  const ContentProtectionElement& content_protection_element) {
              +
              1090  content_protection_elements_.push_back(content_protection_element);
              +
              1091  RemoveDuplicateAttributes(&content_protection_elements_.back());
              +
              1092 }
              +
              1093 
              +
              1094 void Representation::UpdateContentProtectionPssh(const std::string& drm_uuid,
              +
              1095  const std::string& pssh) {
              +
              1096  UpdateContentProtectionPsshHelper(drm_uuid, pssh,
              +
              1097  &content_protection_elements_);
              +
              1098 }
              +
              1099 
              +
              1100 void Representation::AddNewSegment(uint64_t start_time,
              +
              1101  uint64_t duration,
              +
              1102  uint64_t size) {
              +
              1103  if (start_time == 0 && duration == 0) {
              +
              1104  LOG(WARNING) << "Got segment with start_time and duration == 0. Ignoring.";
              +
              1105  return;
              +
              1106  }
              +
              1107 
              +
              1108  if (state_change_listener_)
              +
              1109  state_change_listener_->OnNewSegmentForRepresentation(start_time, duration);
              +
              1110  if (IsContiguous(start_time, duration, size)) {
              +
              1111  ++segment_infos_.back().repeat;
              +
              1112  } else {
              +
              1113  SegmentInfo s = {start_time, duration, /* Not repeat. */ 0};
              +
              1114  segment_infos_.push_back(s);
              +
              1115  }
              +
              1116 
              +
              1117  bandwidth_estimator_.AddBlock(
              +
              1118  size, static_cast<double>(duration) / media_info_.reference_time_scale());
              +
              1119 
              +
              1120  SlideWindow();
              +
              1121  DCHECK_GE(segment_infos_.size(), 1u);
              +
              1122 }
              1123 
              -
              1124  SlideWindow();
              -
              1125  DCHECK_GE(segment_infos_.size(), 1u);
              -
              1126 }
              -
              1127 
              -
              1128 void Representation::SetSampleDuration(uint32_t sample_duration) {
              -
              1129  if (media_info_.has_video_info()) {
              -
              1130  media_info_.mutable_video_info()->set_frame_duration(sample_duration);
              -
              1131  if (state_change_listener_) {
              -
              1132  state_change_listener_->OnSetFrameRateForRepresentation(
              -
              1133  sample_duration, media_info_.video_info().time_scale());
              -
              1134  }
              -
              1135  }
              -
              1136 }
              -
              1137 
              -
              1138 // Uses info in |media_info_| and |content_protection_elements_| to create a
              -
              1139 // "Representation" node.
              -
              1140 // MPD schema has strict ordering. The following must be done in order.
              -
              1141 // AddVideoInfo() (possibly adds FramePacking elements), AddAudioInfo() (Adds
              -
              1142 // AudioChannelConfig elements), AddContentProtectionElements*(), and
              -
              1143 // AddVODOnlyInfo() (Adds segment info).
              -
              1144 xml::scoped_xml_ptr<xmlNode> Representation::GetXml() {
              -
              1145  if (!HasRequiredMediaInfoFields()) {
              -
              1146  LOG(ERROR) << "MediaInfo missing required fields.";
              -
              1147  return xml::scoped_xml_ptr<xmlNode>();
              -
              1148  }
              +
              1124 void Representation::SetSampleDuration(uint32_t sample_duration) {
              +
              1125  if (media_info_.has_video_info()) {
              +
              1126  media_info_.mutable_video_info()->set_frame_duration(sample_duration);
              +
              1127  if (state_change_listener_) {
              +
              1128  state_change_listener_->OnSetFrameRateForRepresentation(
              +
              1129  sample_duration, media_info_.video_info().time_scale());
              +
              1130  }
              +
              1131  }
              +
              1132 }
              +
              1133 
              +
              1134 // Uses info in |media_info_| and |content_protection_elements_| to create a
              +
              1135 // "Representation" node.
              +
              1136 // MPD schema has strict ordering. The following must be done in order.
              +
              1137 // AddVideoInfo() (possibly adds FramePacking elements), AddAudioInfo() (Adds
              +
              1138 // AudioChannelConfig elements), AddContentProtectionElements*(), and
              +
              1139 // AddVODOnlyInfo() (Adds segment info).
              +
              1140 xml::scoped_xml_ptr<xmlNode> Representation::GetXml() {
              +
              1141  if (!HasRequiredMediaInfoFields()) {
              +
              1142  LOG(ERROR) << "MediaInfo missing required fields.";
              +
              1143  return xml::scoped_xml_ptr<xmlNode>();
              +
              1144  }
              +
              1145 
              +
              1146  const uint64_t bandwidth = media_info_.has_bandwidth()
              +
              1147  ? media_info_.bandwidth()
              +
              1148  : bandwidth_estimator_.Estimate();
              1149 
              -
              1150  const uint64_t bandwidth = media_info_.has_bandwidth()
              -
              1151  ? media_info_.bandwidth()
              -
              1152  : bandwidth_estimator_.Estimate();
              -
              1153 
              -
              1154  DCHECK(!(HasVODOnlyFields(media_info_) && HasLiveOnlyFields(media_info_)));
              -
              1155 
              -
              1156  RepresentationXmlNode representation;
              -
              1157  // Mandatory fields for Representation.
              -
              1158  representation.SetId(id_);
              -
              1159  representation.SetIntegerAttribute("bandwidth", bandwidth);
              -
              1160  if (!codecs_.empty())
              -
              1161  representation.SetStringAttribute("codecs", codecs_);
              -
              1162  representation.SetStringAttribute("mimeType", mime_type_);
              -
              1163 
              -
              1164  const bool has_video_info = media_info_.has_video_info();
              -
              1165  const bool has_audio_info = media_info_.has_audio_info();
              -
              1166 
              -
              1167  if (has_video_info &&
              -
              1168  !representation.AddVideoInfo(
              -
              1169  media_info_.video_info(),
              -
              1170  !(output_suppression_flags_ & kSuppressWidth),
              -
              1171  !(output_suppression_flags_ & kSuppressHeight),
              -
              1172  !(output_suppression_flags_ & kSuppressFrameRate))) {
              -
              1173  LOG(ERROR) << "Failed to add video info to Representation XML.";
              -
              1174  return xml::scoped_xml_ptr<xmlNode>();
              -
              1175  }
              -
              1176 
              -
              1177  if (has_audio_info &&
              -
              1178  !representation.AddAudioInfo(media_info_.audio_info())) {
              -
              1179  LOG(ERROR) << "Failed to add audio info to Representation XML.";
              -
              1180  return xml::scoped_xml_ptr<xmlNode>();
              -
              1181  }
              -
              1182 
              -
              1183  if (!representation.AddContentProtectionElements(
              -
              1184  content_protection_elements_)) {
              -
              1185  return xml::scoped_xml_ptr<xmlNode>();
              -
              1186  }
              -
              1187 
              -
              1188  if (HasVODOnlyFields(media_info_) &&
              -
              1189  !representation.AddVODOnlyInfo(media_info_)) {
              -
              1190  LOG(ERROR) << "Failed to add VOD segment info.";
              -
              1191  return xml::scoped_xml_ptr<xmlNode>();
              -
              1192  }
              -
              1193 
              -
              1194  if (HasLiveOnlyFields(media_info_) &&
              -
              1195  !representation.AddLiveOnlyInfo(media_info_, segment_infos_,
              -
              1196  start_number_)) {
              -
              1197  LOG(ERROR) << "Failed to add Live info.";
              -
              1198  return xml::scoped_xml_ptr<xmlNode>();
              -
              1199  }
              -
              1200  // TODO(rkuroiwa): It is likely that all representations have the exact same
              -
              1201  // SegmentTemplate. Optimize and propagate the tag up to AdaptationSet level.
              +
              1150  DCHECK(!(HasVODOnlyFields(media_info_) && HasLiveOnlyFields(media_info_)));
              +
              1151 
              +
              1152  RepresentationXmlNode representation;
              +
              1153  // Mandatory fields for Representation.
              +
              1154  representation.SetId(id_);
              +
              1155  representation.SetIntegerAttribute("bandwidth", bandwidth);
              +
              1156  if (!codecs_.empty())
              +
              1157  representation.SetStringAttribute("codecs", codecs_);
              +
              1158  representation.SetStringAttribute("mimeType", mime_type_);
              +
              1159 
              +
              1160  const bool has_video_info = media_info_.has_video_info();
              +
              1161  const bool has_audio_info = media_info_.has_audio_info();
              +
              1162 
              +
              1163  if (has_video_info &&
              +
              1164  !representation.AddVideoInfo(
              +
              1165  media_info_.video_info(),
              +
              1166  !(output_suppression_flags_ & kSuppressWidth),
              +
              1167  !(output_suppression_flags_ & kSuppressHeight),
              +
              1168  !(output_suppression_flags_ & kSuppressFrameRate))) {
              +
              1169  LOG(ERROR) << "Failed to add video info to Representation XML.";
              +
              1170  return xml::scoped_xml_ptr<xmlNode>();
              +
              1171  }
              +
              1172 
              +
              1173  if (has_audio_info &&
              +
              1174  !representation.AddAudioInfo(media_info_.audio_info())) {
              +
              1175  LOG(ERROR) << "Failed to add audio info to Representation XML.";
              +
              1176  return xml::scoped_xml_ptr<xmlNode>();
              +
              1177  }
              +
              1178 
              +
              1179  if (!representation.AddContentProtectionElements(
              +
              1180  content_protection_elements_)) {
              +
              1181  return xml::scoped_xml_ptr<xmlNode>();
              +
              1182  }
              +
              1183 
              +
              1184  if (HasVODOnlyFields(media_info_) &&
              +
              1185  !representation.AddVODOnlyInfo(media_info_)) {
              +
              1186  LOG(ERROR) << "Failed to add VOD segment info.";
              +
              1187  return xml::scoped_xml_ptr<xmlNode>();
              +
              1188  }
              +
              1189 
              +
              1190  if (HasLiveOnlyFields(media_info_) &&
              +
              1191  !representation.AddLiveOnlyInfo(media_info_, segment_infos_,
              +
              1192  start_number_)) {
              +
              1193  LOG(ERROR) << "Failed to add Live info.";
              +
              1194  return xml::scoped_xml_ptr<xmlNode>();
              +
              1195  }
              +
              1196  // TODO(rkuroiwa): It is likely that all representations have the exact same
              +
              1197  // SegmentTemplate. Optimize and propagate the tag up to AdaptationSet level.
              +
              1198 
              +
              1199  output_suppression_flags_ = 0;
              +
              1200  return representation.PassScopedPtr();
              +
              1201 }
              1202 
              -
              1203  output_suppression_flags_ = 0;
              -
              1204  return representation.PassScopedPtr();
              +
              1203 void Representation::SuppressOnce(SuppressFlag flag) {
              +
              1204  output_suppression_flags_ |= flag;
              1205 }
              1206 
              -
              1207 void Representation::SuppressOnce(SuppressFlag flag) {
              -
              1208  output_suppression_flags_ |= flag;
              -
              1209 }
              -
              1210 
              -
              1211 bool Representation::HasRequiredMediaInfoFields() {
              -
              1212  if (HasVODOnlyFields(media_info_) && HasLiveOnlyFields(media_info_)) {
              -
              1213  LOG(ERROR) << "MediaInfo cannot have both VOD and Live fields.";
              -
              1214  return false;
              -
              1215  }
              -
              1216 
              -
              1217  if (!media_info_.has_container_type()) {
              -
              1218  LOG(ERROR) << "MediaInfo missing required field: container_type.";
              -
              1219  return false;
              -
              1220  }
              -
              1221 
              -
              1222  if (HasVODOnlyFields(media_info_) && !media_info_.has_bandwidth()) {
              -
              1223  LOG(ERROR) << "Missing 'bandwidth' field. MediaInfo requires bandwidth for "
              -
              1224  "static profile for generating a valid MPD.";
              -
              1225  return false;
              -
              1226  }
              +
              1207 bool Representation::HasRequiredMediaInfoFields() {
              +
              1208  if (HasVODOnlyFields(media_info_) && HasLiveOnlyFields(media_info_)) {
              +
              1209  LOG(ERROR) << "MediaInfo cannot have both VOD and Live fields.";
              +
              1210  return false;
              +
              1211  }
              +
              1212 
              +
              1213  if (!media_info_.has_container_type()) {
              +
              1214  LOG(ERROR) << "MediaInfo missing required field: container_type.";
              +
              1215  return false;
              +
              1216  }
              +
              1217 
              +
              1218  if (HasVODOnlyFields(media_info_) && !media_info_.has_bandwidth()) {
              +
              1219  LOG(ERROR) << "Missing 'bandwidth' field. MediaInfo requires bandwidth for "
              +
              1220  "static profile for generating a valid MPD.";
              +
              1221  return false;
              +
              1222  }
              +
              1223 
              +
              1224  VLOG_IF(3, HasLiveOnlyFields(media_info_) && !media_info_.has_bandwidth())
              +
              1225  << "MediaInfo missing field 'bandwidth'. Using estimated from "
              +
              1226  "segment size.";
              1227 
              -
              1228  VLOG_IF(3, HasLiveOnlyFields(media_info_) && !media_info_.has_bandwidth())
              -
              1229  << "MediaInfo missing field 'bandwidth'. Using estimated from "
              -
              1230  "segment size.";
              -
              1231 
              -
              1232  return true;
              -
              1233 }
              -
              1234 
              -
              1235 bool Representation::IsContiguous(uint64_t start_time,
              -
              1236  uint64_t duration,
              -
              1237  uint64_t size) const {
              -
              1238  if (segment_infos_.empty())
              -
              1239  return false;
              -
              1240 
              -
              1241  // Contiguous segment.
              -
              1242  const SegmentInfo& previous = segment_infos_.back();
              -
              1243  const uint64_t previous_segment_end_time =
              -
              1244  previous.start_time + previous.duration * (previous.repeat + 1);
              -
              1245  if (previous_segment_end_time == start_time &&
              -
              1246  segment_infos_.back().duration == duration) {
              -
              1247  return true;
              -
              1248  }
              -
              1249 
              -
              1250  // No out of order segments.
              -
              1251  const uint64_t previous_segment_start_time =
              -
              1252  previous.start_time + previous.duration * previous.repeat;
              -
              1253  if (previous_segment_start_time >= start_time) {
              -
              1254  LOG(ERROR) << "Segments should not be out of order segment. Adding segment "
              -
              1255  "with start_time == "
              -
              1256  << start_time << " but the previous segment starts at "
              -
              1257  << previous.start_time << ".";
              -
              1258  return false;
              -
              1259  }
              -
              1260 
              -
              1261  // A gap since previous.
              -
              1262  const uint64_t kRoundingErrorGrace = 5;
              -
              1263  if (previous_segment_end_time + kRoundingErrorGrace < start_time) {
              -
              1264  LOG(WARNING) << "Found a gap of size "
              -
              1265  << (start_time - previous_segment_end_time)
              -
              1266  << " > kRoundingErrorGrace (" << kRoundingErrorGrace
              -
              1267  << "). The new segment starts at " << start_time
              -
              1268  << " but the previous segment ends at "
              -
              1269  << previous_segment_end_time << ".";
              -
              1270  return false;
              -
              1271  }
              -
              1272 
              -
              1273  // No overlapping segments.
              -
              1274  if (start_time < previous_segment_end_time - kRoundingErrorGrace) {
              -
              1275  LOG(WARNING)
              -
              1276  << "Segments should not be overlapping. The new segment starts at "
              -
              1277  << start_time << " but the previous segment ends at "
              -
              1278  << previous_segment_end_time << ".";
              -
              1279  return false;
              -
              1280  }
              +
              1228  return true;
              +
              1229 }
              +
              1230 
              +
              1231 bool Representation::IsContiguous(uint64_t start_time,
              +
              1232  uint64_t duration,
              +
              1233  uint64_t size) const {
              +
              1234  if (segment_infos_.empty())
              +
              1235  return false;
              +
              1236 
              +
              1237  // Contiguous segment.
              +
              1238  const SegmentInfo& previous = segment_infos_.back();
              +
              1239  const uint64_t previous_segment_end_time =
              +
              1240  previous.start_time + previous.duration * (previous.repeat + 1);
              +
              1241  if (previous_segment_end_time == start_time &&
              +
              1242  segment_infos_.back().duration == duration) {
              +
              1243  return true;
              +
              1244  }
              +
              1245 
              +
              1246  // No out of order segments.
              +
              1247  const uint64_t previous_segment_start_time =
              +
              1248  previous.start_time + previous.duration * previous.repeat;
              +
              1249  if (previous_segment_start_time >= start_time) {
              +
              1250  LOG(ERROR) << "Segments should not be out of order segment. Adding segment "
              +
              1251  "with start_time == "
              +
              1252  << start_time << " but the previous segment starts at "
              +
              1253  << previous.start_time << ".";
              +
              1254  return false;
              +
              1255  }
              +
              1256 
              +
              1257  // A gap since previous.
              +
              1258  const uint64_t kRoundingErrorGrace = 5;
              +
              1259  if (previous_segment_end_time + kRoundingErrorGrace < start_time) {
              +
              1260  LOG(WARNING) << "Found a gap of size "
              +
              1261  << (start_time - previous_segment_end_time)
              +
              1262  << " > kRoundingErrorGrace (" << kRoundingErrorGrace
              +
              1263  << "). The new segment starts at " << start_time
              +
              1264  << " but the previous segment ends at "
              +
              1265  << previous_segment_end_time << ".";
              +
              1266  return false;
              +
              1267  }
              +
              1268 
              +
              1269  // No overlapping segments.
              +
              1270  if (start_time < previous_segment_end_time - kRoundingErrorGrace) {
              +
              1271  LOG(WARNING)
              +
              1272  << "Segments should not be overlapping. The new segment starts at "
              +
              1273  << start_time << " but the previous segment ends at "
              +
              1274  << previous_segment_end_time << ".";
              +
              1275  return false;
              +
              1276  }
              +
              1277 
              +
              1278  // Within rounding error grace but technically not contiguous in terms of MPD.
              +
              1279  return false;
              +
              1280 }
              1281 
              -
              1282  // Within rounding error grace but technically not contiguous in terms of MPD.
              -
              1283  return false;
              -
              1284 }
              -
              1285 
              -
              1286 void Representation::SlideWindow() {
              -
              1287  DCHECK(!segment_infos_.empty());
              -
              1288  if (mpd_options_.time_shift_buffer_depth <= 0.0)
              -
              1289  return;
              -
              1290 
              -
              1291  const uint32_t time_scale = GetTimeScale(media_info_);
              -
              1292  DCHECK_GT(time_scale, 0u);
              -
              1293 
              -
              1294  uint64_t time_shift_buffer_depth =
              -
              1295  static_cast<uint64_t>(mpd_options_.time_shift_buffer_depth * time_scale);
              -
              1296 
              -
              1297  // The start time of the latest segment is considered the current_play_time,
              -
              1298  // and this should guarantee that the latest segment will stay in the list.
              -
              1299  const uint64_t current_play_time = LatestSegmentStartTime(segment_infos_);
              -
              1300  if (current_play_time <= time_shift_buffer_depth)
              -
              1301  return;
              -
              1302 
              -
              1303  const uint64_t timeshift_limit = current_play_time - time_shift_buffer_depth;
              -
              1304 
              -
              1305  // First remove all the SegmentInfos that are completely out of range, by
              -
              1306  // looking at the very last segment's end time.
              -
              1307  std::list<SegmentInfo>::iterator first = segment_infos_.begin();
              -
              1308  std::list<SegmentInfo>::iterator last = first;
              -
              1309  size_t num_segments_removed = 0;
              -
              1310  for (; last != segment_infos_.end(); ++last) {
              -
              1311  const uint64_t last_segment_end_time = LastSegmentEndTime(*last);
              -
              1312  if (timeshift_limit < last_segment_end_time)
              -
              1313  break;
              -
              1314  num_segments_removed += last->repeat + 1;
              -
              1315  }
              -
              1316  segment_infos_.erase(first, last);
              -
              1317  start_number_ += num_segments_removed;
              +
              1282 void Representation::SlideWindow() {
              +
              1283  DCHECK(!segment_infos_.empty());
              +
              1284  if (mpd_options_.time_shift_buffer_depth <= 0.0)
              +
              1285  return;
              +
              1286 
              +
              1287  const uint32_t time_scale = GetTimeScale(media_info_);
              +
              1288  DCHECK_GT(time_scale, 0u);
              +
              1289 
              +
              1290  uint64_t time_shift_buffer_depth =
              +
              1291  static_cast<uint64_t>(mpd_options_.time_shift_buffer_depth * time_scale);
              +
              1292 
              +
              1293  // The start time of the latest segment is considered the current_play_time,
              +
              1294  // and this should guarantee that the latest segment will stay in the list.
              +
              1295  const uint64_t current_play_time = LatestSegmentStartTime(segment_infos_);
              +
              1296  if (current_play_time <= time_shift_buffer_depth)
              +
              1297  return;
              +
              1298 
              +
              1299  const uint64_t timeshift_limit = current_play_time - time_shift_buffer_depth;
              +
              1300 
              +
              1301  // First remove all the SegmentInfos that are completely out of range, by
              +
              1302  // looking at the very last segment's end time.
              +
              1303  std::list<SegmentInfo>::iterator first = segment_infos_.begin();
              +
              1304  std::list<SegmentInfo>::iterator last = first;
              +
              1305  size_t num_segments_removed = 0;
              +
              1306  for (; last != segment_infos_.end(); ++last) {
              +
              1307  const uint64_t last_segment_end_time = LastSegmentEndTime(*last);
              +
              1308  if (timeshift_limit < last_segment_end_time)
              +
              1309  break;
              +
              1310  num_segments_removed += last->repeat + 1;
              +
              1311  }
              +
              1312  segment_infos_.erase(first, last);
              +
              1313  start_number_ += num_segments_removed;
              +
              1314 
              +
              1315  // Now some segment in the first SegmentInfo should be left in the list.
              +
              1316  SegmentInfo* first_segment_info = &segment_infos_.front();
              +
              1317  DCHECK_LE(timeshift_limit, LastSegmentEndTime(*first_segment_info));
              1318 
              -
              1319  // Now some segment in the first SegmentInfo should be left in the list.
              -
              1320  SegmentInfo* first_segment_info = &segment_infos_.front();
              -
              1321  DCHECK_LE(timeshift_limit, LastSegmentEndTime(*first_segment_info));
              -
              1322 
              -
              1323  // Identify which segments should still be in the SegmentInfo.
              -
              1324  const int repeat_index =
              -
              1325  SearchTimedOutRepeatIndex(timeshift_limit, *first_segment_info);
              -
              1326  CHECK_GE(repeat_index, 0);
              -
              1327  if (repeat_index == 0)
              -
              1328  return;
              -
              1329 
              -
              1330  first_segment_info->start_time = first_segment_info->start_time +
              -
              1331  first_segment_info->duration * repeat_index;
              +
              1319  // Identify which segments should still be in the SegmentInfo.
              +
              1320  const int repeat_index =
              +
              1321  SearchTimedOutRepeatIndex(timeshift_limit, *first_segment_info);
              +
              1322  CHECK_GE(repeat_index, 0);
              +
              1323  if (repeat_index == 0)
              +
              1324  return;
              +
              1325 
              +
              1326  first_segment_info->start_time = first_segment_info->start_time +
              +
              1327  first_segment_info->duration * repeat_index;
              +
              1328 
              +
              1329  first_segment_info->repeat = first_segment_info->repeat - repeat_index;
              +
              1330  start_number_ += repeat_index;
              +
              1331 }
              1332 
              -
              1333  first_segment_info->repeat = first_segment_info->repeat - repeat_index;
              -
              1334  start_number_ += repeat_index;
              +
              1333 std::string Representation::GetVideoMimeType() const {
              +
              1334  return GetMimeType("video", media_info_.container_type());
              1335 }
              1336 
              -
              1337 std::string Representation::GetVideoMimeType() const {
              -
              1338  return GetMimeType("video", media_info_.container_type());
              +
              1337 std::string Representation::GetAudioMimeType() const {
              +
              1338  return GetMimeType("audio", media_info_.container_type());
              1339 }
              1340 
              -
              1341 std::string Representation::GetAudioMimeType() const {
              -
              1342  return GetMimeType("audio", media_info_.container_type());
              -
              1343 }
              -
              1344 
              -
              1345 std::string Representation::GetTextMimeType() const {
              -
              1346  CHECK(media_info_.has_text_info());
              -
              1347  if (media_info_.text_info().format() == "ttml") {
              -
              1348  switch (media_info_.container_type()) {
              -
              1349  case MediaInfo::CONTAINER_TEXT:
              -
              1350  return "application/ttml+xml";
              -
              1351  case MediaInfo::CONTAINER_MP4:
              -
              1352  return "application/mp4";
              -
              1353  default:
              -
              1354  LOG(ERROR) << "Failed to determine MIME type for TTML container: "
              -
              1355  << media_info_.container_type();
              -
              1356  return "";
              -
              1357  }
              -
              1358  }
              -
              1359  if (media_info_.text_info().format() == "vtt") {
              -
              1360  if (media_info_.container_type() == MediaInfo::CONTAINER_TEXT) {
              -
              1361  return "text/vtt";
              -
              1362  }
              -
              1363  LOG(ERROR) << "Failed to determine MIME type for VTT container: "
              -
              1364  << media_info_.container_type();
              -
              1365  return "";
              -
              1366  }
              -
              1367 
              -
              1368  LOG(ERROR) << "Cannot determine MIME type for format: "
              -
              1369  << media_info_.text_info().format()
              -
              1370  << " container: " << media_info_.container_type();
              -
              1371  return "";
              -
              1372 }
              -
              1373 
              -
              1374 bool Representation::GetEarliestTimestamp(double* timestamp_seconds) {
              -
              1375  DCHECK(timestamp_seconds);
              -
              1376 
              -
              1377  if (segment_infos_.empty())
              -
              1378  return false;
              -
              1379 
              -
              1380  *timestamp_seconds = static_cast<double>(segment_infos_.begin()->start_time) /
              -
              1381  GetTimeScale(media_info_);
              -
              1382  return true;
              -
              1383 }
              -
              1384 
              -
              1385 } // namespace shaka
              -
              void OnSetFrameRateForRepresentation(uint32_t representation_id, uint32_t frame_duration, uint32_t timescale)
              Definition: mpd_builder.cc:868
              -
              virtual void AddNewSegment(uint64_t start_time, uint64_t duration, uint64_t size)
              - -
              bool WriteMpdToFile(media::File *output_file)
              Definition: mpd_builder.cc:423
              -
              Representation(const MediaInfo &media_info, const MpdOptions &mpd_options, uint32_t representation_id, std::unique_ptr< RepresentationStateChangeListener > state_change_listener)
              -
              AdaptationSet(uint32_t adaptation_set_id, const std::string &lang, const MpdOptions &mpd_options, MpdBuilder::MpdType mpd_type, base::AtomicSequenceNumber *representation_counter)
              Definition: mpd_builder.cc:674
              - -
              virtual void SetSampleDuration(uint32_t sample_duration)
              -
              virtual Representation * AddRepresentation(const MediaInfo &media_info)
              Definition: mpd_builder.cc:693
              +
              1341 std::string Representation::GetTextMimeType() const {
              +
              1342  CHECK(media_info_.has_text_info());
              +
              1343  if (media_info_.text_info().format() == "ttml") {
              +
              1344  switch (media_info_.container_type()) {
              +
              1345  case MediaInfo::CONTAINER_TEXT:
              +
              1346  return "application/ttml+xml";
              +
              1347  case MediaInfo::CONTAINER_MP4:
              +
              1348  return "application/mp4";
              +
              1349  default:
              +
              1350  LOG(ERROR) << "Failed to determine MIME type for TTML container: "
              +
              1351  << media_info_.container_type();
              +
              1352  return "";
              +
              1353  }
              +
              1354  }
              +
              1355  if (media_info_.text_info().format() == "vtt") {
              +
              1356  if (media_info_.container_type() == MediaInfo::CONTAINER_TEXT) {
              +
              1357  return "text/vtt";
              +
              1358  }
              +
              1359  LOG(ERROR) << "Failed to determine MIME type for VTT container: "
              +
              1360  << media_info_.container_type();
              +
              1361  return "";
              +
              1362  }
              +
              1363 
              +
              1364  LOG(ERROR) << "Cannot determine MIME type for format: "
              +
              1365  << media_info_.text_info().format()
              +
              1366  << " container: " << media_info_.container_type();
              +
              1367  return "";
              +
              1368 }
              +
              1369 
              +
              1370 bool Representation::GetEarliestTimestamp(double* timestamp_seconds) {
              +
              1371  DCHECK(timestamp_seconds);
              +
              1372 
              +
              1373  if (segment_infos_.empty())
              +
              1374  return false;
              +
              1375 
              +
              1376  *timestamp_seconds = static_cast<double>(segment_infos_.begin()->start_time) /
              +
              1377  GetTimeScale(media_info_);
              +
              1378  return true;
              +
              1379 }
              +
              1380 
              +
              1381 } // namespace shaka
              +
              void OnSetFrameRateForRepresentation(uint32_t representation_id, uint32_t frame_duration, uint32_t timescale)
              Definition: mpd_builder.cc:865
              +
              virtual void AddNewSegment(uint64_t start_time, uint64_t duration, uint64_t size)
              + +
              bool WriteMpdToFile(media::File *output_file)
              Definition: mpd_builder.cc:422
              +
              Representation(const MediaInfo &media_info, const MpdOptions &mpd_options, uint32_t representation_id, std::unique_ptr< RepresentationStateChangeListener > state_change_listener)
              +
              AdaptationSet(uint32_t adaptation_set_id, const std::string &lang, const MpdOptions &mpd_options, MpdBuilder::MpdType mpd_type, base::AtomicSequenceNumber *representation_counter)
              Definition: mpd_builder.cc:671
              + +
              virtual void SetSampleDuration(uint32_t sample_duration)
              +
              virtual Representation * AddRepresentation(const MediaInfo &media_info)
              Definition: mpd_builder.cc:689
              std::string LanguageToShortestForm(const std::string &language)
              Define an abstract file interface.
              Definition: file.h:24
              -
              virtual void AddContentProtectionElement(const ContentProtectionElement &element)
              Definition: mpd_builder.cc:737
              +
              virtual void AddContentProtectionElement(const ContentProtectionElement &element)
              Definition: mpd_builder.cc:733
              -
              virtual void AddRole(Role role)
              Definition: mpd_builder.cc:749
              -
              void AddBaseUrl(const std::string &base_url)
              Definition: mpd_builder.cc:409
              -
              virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
              Definition: mpd_builder.cc:743
              -
              virtual void SetGroup(int group_number)
              Definition: mpd_builder.cc:842
              -
              xml::scoped_xml_ptr< xmlNode > GetXml()
              -
              virtual bool ToString(std::string *output)
              Definition: mpd_builder.cc:428
              -
              virtual void ForceSetSegmentAlignment(bool segment_alignment)
              Definition: mpd_builder.cc:836
              -
              static void MakePathsRelativeToMpd(const std::string &mpd_path, MediaInfo *media_info)
              Definition: mpd_builder.cc:646
              +
              virtual void AddRole(Role role)
              Definition: mpd_builder.cc:745
              +
              void AddBaseUrl(const std::string &base_url)
              Definition: mpd_builder.cc:408
              +
              virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
              Definition: mpd_builder.cc:739
              +
              virtual void SetGroup(int group_number)
              Definition: mpd_builder.cc:839
              +
              xml::scoped_xml_ptr< xmlNode > GetXml()
              +
              virtual bool ToString(std::string *output)
              Definition: mpd_builder.cc:427
              +
              virtual void ForceSetSegmentAlignment(bool segment_alignment)
              Definition: mpd_builder.cc:833
              +
              static void MakePathsRelativeToMpd(const std::string &mpd_path, MediaInfo *media_info)
              Definition: mpd_builder.cc:643
              MpdBuilder(MpdType type, const MpdOptions &mpd_options)
              Definition: mpd_builder.cc:401
              -
              xml::scoped_xml_ptr< xmlNode > GetXml()
              Definition: mpd_builder.cc:759
              -
              virtual void AddContentProtectionElement(const ContentProtectionElement &element)
              - -
              virtual AdaptationSet * AddAdaptationSet(const std::string &lang)
              Definition: mpd_builder.cc:413
              -
              virtual int Group() const
              Definition: mpd_builder.cc:846
              +
              xml::scoped_xml_ptr< xmlNode > GetXml()
              Definition: mpd_builder.cc:755
              +
              virtual void AddContentProtectionElement(const ContentProtectionElement &element)
              + +
              virtual AdaptationSet * AddAdaptationSet(const std::string &lang)
              Definition: mpd_builder.cc:412
              +
              virtual int Group() const
              Definition: mpd_builder.cc:843
              Defines Mpd Options.
              Definition: mpd_options.h:15
              -
              void OnNewSegmentForRepresentation(uint32_t representation_id, uint64_t start_time, uint64_t duration)
              Definition: mpd_builder.cc:857
              -
              virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
              +
              void OnNewSegmentForRepresentation(uint32_t representation_id, uint64_t start_time, uint64_t duration)
              Definition: mpd_builder.cc:854
              +
              virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
              -
              void SuppressOnce(SuppressFlag flag)
              +
              void SuppressOnce(SuppressFlag flag)
              diff --git a/docs/dd/d12/mpd__writer_8cc_source.html b/docs/dd/d12/mpd__writer_8cc_source.html index 86b63d81eb..dd70d630f4 100644 --- a/docs/dd/d12/mpd__writer_8cc_source.html +++ b/docs/dd/d12/mpd__writer_8cc_source.html @@ -216,12 +216,12 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              127 }
              128 
              129 } // namespace shaka
              -
              static void MakePathsRelativeToMpd(const std::string &mpd_path, MediaInfo *media_info)
              Definition: mpd_builder.cc:646
              +
              static void MakePathsRelativeToMpd(const std::string &mpd_path, MediaInfo *media_info)
              Definition: mpd_builder.cc:643
              static bool ReadFileToString(const char *file_name, std::string *contents)
              Definition: file.cc:185
              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 e0ca25b69b..210b24b3d2 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 @@ -188,7 +188,7 @@ Additional Inherited Members diff --git a/docs/dd/d17/classshaka_1_1media_1_1Demuxer.html b/docs/dd/d17/classshaka_1_1media_1_1Demuxer.html index b4c3f08517..c102c88ac5 100644 --- a/docs/dd/d17/classshaka_1_1media_1_1Demuxer.html +++ b/docs/dd/d17/classshaka_1_1media_1_1Demuxer.html @@ -113,8 +113,9 @@ Public Member Functions   void Cancel ()   -const std::vector< MediaStream * > & streams () -  +const std::vector
              +< std::unique_ptr< MediaStream > > & streams () +  MediaContainerName container_name ()   @@ -151,7 +152,7 @@ Public Member Functions -

              Definition at line 37 of file demuxer.cc.

              +

              Definition at line 36 of file demuxer.cc.

              @@ -170,7 +171,7 @@ Public Member Functions

              Cancel a demuxing job in progress. Will cause Run to exit with an error status of type CANCELLED.

              -

              Definition at line 232 of file demuxer.cc.

              +

              Definition at line 222 of file demuxer.cc.

              @@ -196,7 +197,7 @@ Public Member Functions
              Returns
              Container name (type). Value is CONTAINER_UNKNOWN if the demuxer is not initialized.
              -

              Definition at line 72 of file demuxer.h.

              +

              Definition at line 74 of file demuxer.h.

              @@ -215,7 +216,7 @@ Public Member Functions

              Initialize the Demuxer. Calling other public methods of this class without this method returning OK, results in an undefined behavior. This method primes the demuxer by parsing portions of the media file to extract stream information.

              Returns
              OK on success.
              -

              Definition at line 56 of file demuxer.cc.

              +

              Definition at line 54 of file demuxer.cc.

              @@ -233,7 +234,7 @@ Public Member Functions

              Drive the remuxing from demuxer side (push). Read the file and push the Data to Muxer until Eof.

              -

              Definition at line 173 of file demuxer.cc.

              +

              Definition at line 167 of file demuxer.cc.

              @@ -258,11 +259,11 @@ Public Member Functions -

              Definition at line 52 of file demuxer.cc.

              +

              Definition at line 50 of file demuxer.cc.

              - +
              @@ -270,7 +271,7 @@ Public Member Functions
              - + @@ -295,7 +296,7 @@ Public Member Functions diff --git a/docs/dd/d18/es__parser__adts_8h_source.html b/docs/dd/d18/es__parser__adts_8h_source.html index 9c44c695cb..3128e40be9 100644 --- a/docs/dd/d18/es__parser__adts_8h_source.html +++ b/docs/dd/d18/es__parser__adts_8h_source.html @@ -172,7 +172,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dd/d19/video__stream__info_8cc_source.html b/docs/dd/d19/video__stream__info_8cc_source.html index 97a9549971..9f393bf59e 100644 --- a/docs/dd/d19/video__stream__info_8cc_source.html +++ b/docs/dd/d19/video__stream__info_8cc_source.html @@ -96,91 +96,90 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              7 #include "packager/media/base/video_stream_info.h"
              8 
              9 #include "packager/base/logging.h"
              -
              10 #include "packager/base/stl_util.h"
              -
              11 #include "packager/base/strings/string_number_conversions.h"
              -
              12 #include "packager/base/strings/string_util.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 VideoCodecToString(Codec codec) {
              -
              21  switch (codec) {
              -
              22  case kCodecH264:
              -
              23  return "H264";
              -
              24  case kCodecHEV1:
              -
              25  return "HEV1";
              -
              26  case kCodecHVC1:
              -
              27  return "HVC1";
              -
              28  case kCodecVC1:
              -
              29  return "VC1";
              -
              30  case kCodecMPEG2:
              -
              31  return "MPEG2";
              -
              32  case kCodecMPEG4:
              -
              33  return "MPEG4";
              -
              34  case kCodecTheora:
              -
              35  return "Theora";
              -
              36  case kCodecVP8:
              -
              37  return "VP8";
              -
              38  case kCodecVP9:
              -
              39  return "VP9";
              -
              40  case kCodecVP10:
              -
              41  return "VP10";
              -
              42  default:
              -
              43  NOTIMPLEMENTED() << "Unknown Video Codec: " << codec;
              -
              44  return "UnknownCodec";
              -
              45  }
              -
              46 }
              -
              47 
              -
              48 } // namespace
              -
              49 
              - -
              51  int track_id, uint32_t time_scale, uint64_t duration, Codec codec,
              -
              52  const std::string& codec_string, const uint8_t* codec_config,
              -
              53  size_t codec_config_size, uint16_t width, uint16_t height,
              -
              54  uint32_t pixel_width, uint32_t pixel_height, int16_t trick_play_rate,
              -
              55  uint8_t nalu_length_size, const std::string& language, bool is_encrypted)
              -
              56  : StreamInfo(kStreamVideo, track_id, time_scale, duration, codec,
              -
              57  codec_string, codec_config, codec_config_size, language,
              -
              58  is_encrypted),
              -
              59  width_(width),
              -
              60  height_(height),
              -
              61  pixel_width_(pixel_width),
              -
              62  pixel_height_(pixel_height),
              -
              63  trick_play_rate_(trick_play_rate),
              -
              64  nalu_length_size_(nalu_length_size) {}
              -
              65 
              -
              66 VideoStreamInfo::~VideoStreamInfo() {}
              -
              67 
              - -
              69  return codec() != kUnknownCodec && width_ > 0 &&
              -
              70  width_ <= limits::kMaxDimension && height_ > 0 &&
              -
              71  height_ <= limits::kMaxDimension &&
              -
              72  (nalu_length_size_ <= 2 || nalu_length_size_ == 4);
              -
              73 }
              -
              74 
              -
              75 std::string VideoStreamInfo::ToString() const {
              -
              76  return base::StringPrintf(
              -
              77  "%s codec: %s\n width: %d\n height: %d\n pixel_aspect_ratio: %d:%d\n "
              -
              78  "trick_play_rate: %d\n nalu_length_size: %d\n",
              -
              79  StreamInfo::ToString().c_str(), VideoCodecToString(codec()).c_str(),
              -
              80  width_, height_, pixel_width_, pixel_height_, trick_play_rate_,
              -
              81  nalu_length_size_);
              -
              82 }
              -
              83 
              -
              84 } // namespace media
              -
              85 } // namespace shaka
              +
              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 kCodecHEV1:
              +
              24  return "HEV1";
              +
              25  case kCodecHVC1:
              +
              26  return "HVC1";
              +
              27  case kCodecVC1:
              +
              28  return "VC1";
              +
              29  case kCodecMPEG2:
              +
              30  return "MPEG2";
              +
              31  case kCodecMPEG4:
              +
              32  return "MPEG4";
              +
              33  case kCodecTheora:
              +
              34  return "Theora";
              +
              35  case kCodecVP8:
              +
              36  return "VP8";
              +
              37  case kCodecVP9:
              +
              38  return "VP9";
              +
              39  case kCodecVP10:
              +
              40  return "VP10";
              +
              41  default:
              +
              42  NOTIMPLEMENTED() << "Unknown Video Codec: " << codec;
              +
              43  return "UnknownCodec";
              +
              44  }
              +
              45 }
              +
              46 
              +
              47 } // namespace
              +
              48 
              + +
              50  int track_id, uint32_t time_scale, uint64_t duration, Codec codec,
              +
              51  const std::string& codec_string, const uint8_t* codec_config,
              +
              52  size_t codec_config_size, uint16_t width, uint16_t height,
              +
              53  uint32_t pixel_width, uint32_t pixel_height, int16_t trick_play_rate,
              +
              54  uint8_t nalu_length_size, const std::string& language, bool is_encrypted)
              +
              55  : StreamInfo(kStreamVideo, track_id, time_scale, duration, codec,
              +
              56  codec_string, codec_config, codec_config_size, language,
              +
              57  is_encrypted),
              +
              58  width_(width),
              +
              59  height_(height),
              +
              60  pixel_width_(pixel_width),
              +
              61  pixel_height_(pixel_height),
              +
              62  trick_play_rate_(trick_play_rate),
              +
              63  nalu_length_size_(nalu_length_size) {}
              +
              64 
              +
              65 VideoStreamInfo::~VideoStreamInfo() {}
              +
              66 
              + +
              68  return codec() != kUnknownCodec && width_ > 0 &&
              +
              69  width_ <= limits::kMaxDimension && height_ > 0 &&
              +
              70  height_ <= limits::kMaxDimension &&
              +
              71  (nalu_length_size_ <= 2 || nalu_length_size_ == 4);
              +
              72 }
              +
              73 
              +
              74 std::string VideoStreamInfo::ToString() const {
              +
              75  return base::StringPrintf(
              +
              76  "%s codec: %s\n width: %d\n height: %d\n pixel_aspect_ratio: %d:%d\n "
              +
              77  "trick_play_rate: %d\n nalu_length_size: %d\n",
              +
              78  StreamInfo::ToString().c_str(), VideoCodecToString(codec()).c_str(),
              +
              79  width_, height_, pixel_width_, pixel_height_, trick_play_rate_,
              +
              80  nalu_length_size_);
              +
              81 }
              +
              82 
              +
              83 } // namespace media
              +
              84 } // namespace shaka
              Abstract class holds stream information.
              Definition: stream_info.h:53
              -
              bool IsValidConfig() const override
              +
              bool IsValidConfig() const override
              virtual std::string ToString() const
              Definition: stream_info.cc:37
              -
              std::string ToString() const override
              -
              VideoStreamInfo(int track_id, uint32_t time_scale, uint64_t duration, Codec codec, const std::string &codec_string, const uint8_t *codec_config, size_t codec_config_size, uint16_t width, uint16_t height, uint32_t pixel_width, uint32_t pixel_height, int16_t trick_play_rate, uint8_t nalu_length_size, const std::string &language, bool is_encrypted)
              +
              std::string ToString() const override
              +
              VideoStreamInfo(int track_id, uint32_t time_scale, uint64_t duration, Codec codec, const std::string &codec_string, const uint8_t *codec_config, size_t codec_config_size, uint16_t width, uint16_t height, uint32_t pixel_width, uint32_t pixel_height, int16_t trick_play_rate, uint8_t nalu_length_size, const std::string &language, bool is_encrypted)
              diff --git a/docs/dd/d30/wvm__media__parser_8cc_source.html b/docs/dd/d30/wvm__media__parser_8cc_source.html index 735f26aab6..8c943ce2a9 100644 --- a/docs/dd/d30/wvm__media__parser_8cc_source.html +++ b/docs/dd/d30/wvm__media__parser_8cc_source.html @@ -1265,7 +1265,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dd/d3b/mp4_2segmenter_8h_source.html b/docs/dd/d3b/mp4_2segmenter_8h_source.html index 8a26b6ccc2..15dcd81994 100644 --- a/docs/dd/d3b/mp4_2segmenter_8h_source.html +++ b/docs/dd/d3b/mp4_2segmenter_8h_source.html @@ -184,7 +184,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              134  std::unique_ptr<MovieFragment> moof_;
              135  std::unique_ptr<BufferWriter> fragment_buffer_;
              136  std::unique_ptr<SegmentIndex> sidx_;
              -
              137  std::vector<Fragmenter*> fragmenters_;
              +
              137  std::vector<std::unique_ptr<Fragmenter>> fragmenters_;
              138  std::vector<uint64_t> segment_durations_;
              139  std::map<const MediaStream*, uint32_t> stream_map_;
              140  MuxerListener* muxer_listener_;
              @@ -201,26 +201,26 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              151 } // namespace shaka
              152 
              153 #endif // MEDIA_FORMATS_MP4_SEGMENTER_H_
              -
              Status Initialize(const std::vector< MediaStream * > &streams, MuxerListener *muxer_listener, ProgressListener *progress_listener, KeySource *encryption_key_source, uint32_t max_sd_pixels, double clear_lead_in_seconds, double crypto_period_duration_in_seconds, FourCC protection_scheme)
              Definition: segmenter.cc:166
              -
              void UpdateProgress(uint64_t progress)
              Update segmentation progress using ProgressListener.
              Definition: segmenter.cc:389
              -
              void SetComplete()
              Set progress to 100%.
              Definition: segmenter.cc:405
              +
              Status Initialize(const std::vector< MediaStream * > &streams, MuxerListener *muxer_listener, ProgressListener *progress_listener, KeySource *encryption_key_source, uint32_t max_sd_pixels, double clear_lead_in_seconds, double crypto_period_duration_in_seconds, FourCC protection_scheme)
              Definition: segmenter.cc:165
              +
              void UpdateProgress(uint64_t progress)
              Update segmentation progress using ProgressListener.
              Definition: segmenter.cc:387
              +
              void SetComplete()
              Set progress to 100%.
              Definition: segmenter.cc:403
              virtual bool GetInitRange(size_t *offset, size_t *size)=0
              This structure contains the list of configuration options for Muxer.
              Definition: muxer_options.h:18
              uint32_t sample_duration() const
              Definition: segmenter.h:101
              -
              Status AddSample(const MediaStream *stream, scoped_refptr< MediaSample > sample)
              Definition: segmenter.cc:322
              +
              Status AddSample(const MediaStream *stream, scoped_refptr< MediaSample > sample)
              Definition: segmenter.cc:320
              This class listens to progress updates events.
              KeySource is responsible for encryption key acquisition.
              Definition: key_source.h:30
              -
              double GetDuration() const
              Definition: segmenter.cc:380
              +
              double GetDuration() const
              Definition: segmenter.cc:378
              virtual bool GetIndexRange(size_t *offset, size_t *size)=0
              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 23935282d0..dfb9a198c4 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 @@ -182,7 +182,7 @@ Additional Inherited Members diff --git a/docs/dd/d42/encryptor_8h_source.html b/docs/dd/d42/encryptor_8h_source.html index dc2fe5e544..4d4c285d9a 100644 --- a/docs/dd/d42/encryptor_8h_source.html +++ b/docs/dd/d42/encryptor_8h_source.html @@ -161,7 +161,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dd/d46/webm__parser_8h_source.html b/docs/dd/d46/webm__parser_8h_source.html index 52dd8a0da9..fdfbc7fd78 100644 --- a/docs/dd/d46/webm__parser_8h_source.html +++ b/docs/dd/d46/webm__parser_8h_source.html @@ -227,7 +227,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 db0ca2548c..5b78c9bacb 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 @@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              const std::vector<MediaStream*>& shaka::media::Demuxer::streams const std::vector<std::unique_ptr<MediaStream> >& shaka::media::Demuxer::streams ( )
              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 873c12fb2b..989bc8a8a4 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 @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              diff --git a/docs/dd/d54/widevine__encryption__flags_8h_source.html b/docs/dd/d54/widevine__encryption__flags_8h_source.html index f694323394..c7cb242b55 100644 --- a/docs/dd/d54/widevine__encryption__flags_8h_source.html +++ b/docs/dd/d54/widevine__encryption__flags_8h_source.html @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              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 85195823f2..17b5ddbbcd 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 @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 131f88fb0a..5997b157c7 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 @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 377be8c5dd..178eb8a04d 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dd/d65/vp8__parser_8h_source.html b/docs/dd/d65/vp8__parser_8h_source.html index 3cc9da9861..f8fc479fae 100644 --- a/docs/dd/d65/vp8__parser_8h_source.html +++ b/docs/dd/d65/vp8__parser_8h_source.html @@ -136,7 +136,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 91e04f426e..4ad49ef72e 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 @@ -177,7 +177,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 5b0941562d..8b94f1ea9c 100644 --- a/docs/dd/d6e/classshaka_1_1media_1_1H265VideoSliceHeaderParser-members.html +++ b/docs/dd/d6e/classshaka_1_1media_1_1H265VideoSliceHeaderParser-members.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 67a2450647..b1685c04fe 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 @@ -176,7 +176,7 @@ Additional Inherited Members diff --git a/docs/dd/d7a/classshaka_1_1media_1_1MuxerListener.html b/docs/dd/d7a/classshaka_1_1media_1_1MuxerListener.html index 30d33ff8b7..8a7cc6f411 100644 --- a/docs/dd/d7a/classshaka_1_1media_1_1MuxerListener.html +++ b/docs/dd/d7a/classshaka_1_1media_1_1MuxerListener.html @@ -469,7 +469,7 @@ Public Member Functions diff --git a/docs/dd/d7c/classshaka_1_1media_1_1IoCache.html b/docs/dd/d7c/classshaka_1_1media_1_1IoCache.html index 600ec0d587..fbc0556498 100644 --- a/docs/dd/d7c/classshaka_1_1media_1_1IoCache.html +++ b/docs/dd/d7c/classshaka_1_1media_1_1IoCache.html @@ -297,7 +297,7 @@ void  diff --git a/docs/dd/d80/media__sample_8h_source.html b/docs/dd/d80/media__sample_8h_source.html index 92a8407e8a..5056a1b108 100644 --- a/docs/dd/d80/media__sample_8h_source.html +++ b/docs/dd/d80/media__sample_8h_source.html @@ -259,7 +259,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dd/d87/memory__file_8cc_source.html b/docs/dd/d87/memory__file_8cc_source.html index 111f670a90..6693cfafca 100644 --- a/docs/dd/d87/memory__file_8cc_source.html +++ b/docs/dd/d87/memory__file_8cc_source.html @@ -242,7 +242,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dd/d88/pes__packet__generator_8h_source.html b/docs/dd/d88/pes__packet__generator_8h_source.html index d266ebbb66..94c0fb8ef6 100644 --- a/docs/dd/d88/pes__packet__generator_8h_source.html +++ b/docs/dd/d88/pes__packet__generator_8h_source.html @@ -99,71 +99,69 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              10 #include <list>
              11 #include <memory>
              12 
              -
              13 #include "packager/base/stl_util.h"
              -
              14 #include "packager/media/base/aes_cryptor.h"
              -
              15 #include "packager/media/base/key_source.h"
              -
              16 #include "packager/media/base/media_sample.h"
              -
              17 #include "packager/media/base/stream_info.h"
              -
              18 
              -
              19 namespace shaka {
              -
              20 namespace media {
              -
              21 
              -
              22 class AACAudioSpecificConfig;
              -
              23 class NalUnitToByteStreamConverter;
              -
              24 class StreamInfo;
              -
              25 
              -
              26 namespace mp2t {
              -
              27 
              -
              28 class PesPacket;
              -
              29 
              - -
              33  public:
              - -
              35  virtual ~PesPacketGenerator();
              -
              36 
              -
              42  virtual bool Initialize(const StreamInfo& stream);
              -
              43 
              -
              48  virtual bool PushSample(scoped_refptr<MediaSample> sample);
              -
              49 
              -
              54  virtual bool SetEncryptionKey(std::unique_ptr<EncryptionKey> encryption_key);
              -
              55 
              -
              57  virtual size_t NumberOfReadyPesPackets();
              -
              58 
              -
              62  virtual std::unique_ptr<PesPacket> GetNextPesPacket();
              -
              63 
              -
              67  virtual bool Flush();
              -
              68 
              -
              69  private:
              -
              70  friend class PesPacketGeneratorTest;
              -
              71 
              -
              72  StreamType stream_type_;
              -
              73 
              -
              74  // Calculated by 90000 / input stream's timescale. This is used to scale the
              -
              75  // timestamps.
              -
              76  double timescale_scale_ = 0.0;
              -
              77 
              -
              78  std::unique_ptr<NalUnitToByteStreamConverter> converter_;
              -
              79  std::unique_ptr<AACAudioSpecificConfig> adts_converter_;
              -
              80 
              -
              81  // This is the PES packet that this object is currently working on.
              -
              82  // This can be used to create a PES from multiple audio samples.
              -
              83  std::unique_ptr<PesPacket> current_processing_pes_;
              -
              84 
              -
              85  std::list<PesPacket*> pes_packets_;
              -
              86  STLElementDeleter<decltype(pes_packets_)> pes_packets_deleter_;
              -
              87 
              -
              88  // Current encryption key.
              -
              89  std::unique_ptr<AesCryptor> encryptor_;
              -
              90 
              -
              91  DISALLOW_COPY_AND_ASSIGN(PesPacketGenerator);
              -
              92 };
              -
              93 
              -
              94 } // namespace mp2t
              -
              95 } // namespace media
              -
              96 } // namespace shaka
              -
              97 
              -
              98 #endif // PACKAGER_MEDIA_FORMATS_MP2T_PES_PACKET_GENERATOR_H_
              - +
              13 #include "packager/media/base/aes_cryptor.h"
              +
              14 #include "packager/media/base/key_source.h"
              +
              15 #include "packager/media/base/media_sample.h"
              +
              16 #include "packager/media/base/stream_info.h"
              +
              17 
              +
              18 namespace shaka {
              +
              19 namespace media {
              +
              20 
              +
              21 class AACAudioSpecificConfig;
              +
              22 class NalUnitToByteStreamConverter;
              +
              23 class StreamInfo;
              +
              24 
              +
              25 namespace mp2t {
              +
              26 
              +
              27 class PesPacket;
              +
              28 
              + +
              32  public:
              + +
              34  virtual ~PesPacketGenerator();
              +
              35 
              +
              41  virtual bool Initialize(const StreamInfo& stream);
              +
              42 
              +
              47  virtual bool PushSample(scoped_refptr<MediaSample> sample);
              +
              48 
              +
              53  virtual bool SetEncryptionKey(std::unique_ptr<EncryptionKey> encryption_key);
              +
              54 
              +
              56  virtual size_t NumberOfReadyPesPackets();
              +
              57 
              +
              61  virtual std::unique_ptr<PesPacket> GetNextPesPacket();
              +
              62 
              +
              66  virtual bool Flush();
              +
              67 
              +
              68  private:
              +
              69  friend class PesPacketGeneratorTest;
              +
              70 
              +
              71  StreamType stream_type_;
              +
              72 
              +
              73  // Calculated by 90000 / input stream's timescale. This is used to scale the
              +
              74  // timestamps.
              +
              75  double timescale_scale_ = 0.0;
              +
              76 
              +
              77  std::unique_ptr<NalUnitToByteStreamConverter> converter_;
              +
              78  std::unique_ptr<AACAudioSpecificConfig> adts_converter_;
              +
              79 
              +
              80  // This is the PES packet that this object is currently working on.
              +
              81  // This can be used to create a PES from multiple audio samples.
              +
              82  std::unique_ptr<PesPacket> current_processing_pes_;
              +
              83 
              +
              84  std::list<std::unique_ptr<PesPacket>> pes_packets_;
              +
              85 
              +
              86  // Current encryption key.
              +
              87  std::unique_ptr<AesCryptor> encryptor_;
              +
              88 
              +
              89  DISALLOW_COPY_AND_ASSIGN(PesPacketGenerator);
              +
              90 };
              +
              91 
              +
              92 } // namespace mp2t
              +
              93 } // namespace media
              +
              94 } // namespace shaka
              +
              95 
              +
              96 #endif // PACKAGER_MEDIA_FORMATS_MP2T_PES_PACKET_GENERATOR_H_
              +
              Abstract class holds stream information.
              Definition: stream_info.h:53
              virtual std::unique_ptr< PesPacket > GetNextPesPacket()
              @@ -174,7 +172,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dd/d8c/file__test__util_8h_source.html b/docs/dd/d8c/file__test__util_8h_source.html index 99ddde940b..5094880cc8 100644 --- a/docs/dd/d8c/file__test__util_8h_source.html +++ b/docs/dd/d8c/file__test__util_8h_source.html @@ -119,7 +119,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 fd3b3ca5e7..23ecd3f5d6 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 @@ -117,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 5013cb2262..cafa0face1 100644 --- a/docs/dd/d98/ts__packet__writer__util_8h_source.html +++ b/docs/dd/d98/ts__packet__writer__util_8h_source.html @@ -127,7 +127,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dd/d9a/audio__timestamp__helper_8h_source.html b/docs/dd/d9a/audio__timestamp__helper_8h_source.html index 073d480086..b2d9dfb213 100644 --- a/docs/dd/d9a/audio__timestamp__helper_8h_source.html +++ b/docs/dd/d9a/audio__timestamp__helper_8h_source.html @@ -167,7 +167,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 4b75c0105f..23f58b381a 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 @@ -143,7 +143,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 3b4376267e..47a460766f 100644 --- a/docs/dd/d9d/classshaka_1_1MpdNotifier-members.html +++ b/docs/dd/d9d/classshaka_1_1MpdNotifier-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dd/da4/structshaka_1_1xml_1_1XmlDeleter.html b/docs/dd/da4/structshaka_1_1xml_1_1XmlDeleter.html index c1af190e2f..63aaa4e0f2 100644 --- a/docs/dd/da4/structshaka_1_1xml_1_1XmlDeleter.html +++ b/docs/dd/da4/structshaka_1_1xml_1_1XmlDeleter.html @@ -127,7 +127,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 3f4435874a..69f635e74b 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 @@ -217,7 +217,7 @@ double cluster_length_sec< 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 e2fc840497..0904a73dda 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 @@ -180,7 +180,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dd/dab/webm__muxer_8h_source.html b/docs/dd/dab/webm__muxer_8h_source.html index c403febfae..30380608a4 100644 --- a/docs/dd/dab/webm__muxer_8h_source.html +++ b/docs/dd/dab/webm__muxer_8h_source.html @@ -138,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 7d0a5be1a9..78d20ab8c0 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 @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 af1104a30e..34ce31c753 100644 --- a/docs/dd/db0/classshaka_1_1media_1_1WebMAudioClient-members.html +++ b/docs/dd/db0/classshaka_1_1media_1_1WebMAudioClient-members.html @@ -107,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 99fb3c6a0f..7f9b29b49b 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 @@ -117,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dd/db9/classshaka_1_1xml_1_1RepresentationBaseXmlNode.html b/docs/dd/db9/classshaka_1_1xml_1_1RepresentationBaseXmlNode.html index 7fb5d0903f..6284f216d6 100644 --- a/docs/dd/db9/classshaka_1_1xml_1_1RepresentationBaseXmlNode.html +++ b/docs/dd/db9/classshaka_1_1xml_1_1RepresentationBaseXmlNode.html @@ -156,7 +156,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 adedcaa66d..9fbbc3fce9 100644 --- a/docs/dd/dbc/buffer__reader_8cc_source.html +++ b/docs/dd/dbc/buffer__reader_8cc_source.html @@ -196,7 +196,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dd/dbd/structshaka_1_1media_1_1EncryptionKey.html b/docs/dd/dbd/structshaka_1_1media_1_1EncryptionKey.html index 5bb730a0dc..11a7675bbe 100644 --- a/docs/dd/dbd/structshaka_1_1media_1_1EncryptionKey.html +++ b/docs/dd/dbd/structshaka_1_1media_1_1EncryptionKey.html @@ -120,7 +120,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 cab2935e0f..6a78bb3664 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 @@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dd/dbf/webm__webvtt__parser_8h_source.html b/docs/dd/dbf/webm__webvtt__parser_8h_source.html index 17b2337700..aa602f8f24 100644 --- a/docs/dd/dbf/webm__webvtt__parser_8h_source.html +++ b/docs/dd/dbf/webm__webvtt__parser_8h_source.html @@ -144,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 e1acc7bc1b..0cd46e23e0 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 @@ -245,7 +245,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 973f169a49..93c2454bbf 100644 --- a/docs/dd/dc4/classshaka_1_1media_1_1ProducerConsumerQueue-members.html +++ b/docs/dd/dc4/classshaka_1_1media_1_1ProducerConsumerQueue-members.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 619608e5dc..a75142dd53 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 @@ -427,7 +427,7 @@ virtual Sta 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 f19eba235d..0ac2617950 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 @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dd/dce/structshaka_1_1media_1_1Cue.html b/docs/dd/dce/structshaka_1_1media_1_1Cue.html index 86d326338d..66be616f16 100644 --- a/docs/dd/dce/structshaka_1_1media_1_1Cue.html +++ b/docs/dd/dce/structshaka_1_1media_1_1Cue.html @@ -125,7 +125,7 @@ std::vector< std::string >  diff --git a/docs/dd/dd2/buffer__writer_8h_source.html b/docs/dd/dd2/buffer__writer_8h_source.html index ff883b3762..b4ff24b757 100644 --- a/docs/dd/dd2/buffer__writer_8h_source.html +++ b/docs/dd/dd2/buffer__writer_8h_source.html @@ -159,7 +159,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dd/dd3/buffer__writer_8cc_source.html b/docs/dd/dd3/buffer__writer_8cc_source.html index ead39fe7ef..15a179366c 100644 --- a/docs/dd/dd3/buffer__writer_8cc_source.html +++ b/docs/dd/dd3/buffer__writer_8cc_source.html @@ -187,7 +187,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 ed24c22bed..a31dbcdece 100644 --- a/docs/dd/dd6/classshaka_1_1media_1_1WebMVideoClient-members.html +++ b/docs/dd/dd6/classshaka_1_1media_1_1WebMVideoClient-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dd/dd8/mock__muxer__listener_8cc_source.html b/docs/dd/dd8/mock__muxer__listener_8cc_source.html index a80ac1b95c..5f55edc8d9 100644 --- a/docs/dd/dd8/mock__muxer__listener_8cc_source.html +++ b/docs/dd/dd8/mock__muxer__listener_8cc_source.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 2ef621adca..9439b6df63 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 @@ -107,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dd/de4/classshaka_1_1media_1_1VideoSliceHeaderParser.html b/docs/dd/de4/classshaka_1_1media_1_1VideoSliceHeaderParser.html index 1de5588f86..da931e1396 100644 --- a/docs/dd/de4/classshaka_1_1media_1_1VideoSliceHeaderParser.html +++ b/docs/dd/de4/classshaka_1_1media_1_1VideoSliceHeaderParser.html @@ -150,7 +150,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 cd9b16f6ea..855b039b7f 100644 --- a/docs/dd/de7/structshaka_1_1media_1_1H265Pps-members.html +++ b/docs/dd/de7/structshaka_1_1media_1_1H265Pps-members.html @@ -137,7 +137,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dd/de7/xml__node_8h_source.html b/docs/dd/de7/xml__node_8h_source.html index df02f1e793..bc6b38709d 100644 --- a/docs/dd/de7/xml__node_8h_source.html +++ b/docs/dd/de7/xml__node_8h_source.html @@ -207,31 +207,31 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              175 } // namespace xml
              176 } // namespace shaka
              177 #endif // MPD_BASE_XML_XML_NODE_H_
              -
              bool AddVideoInfo(const MediaInfo::VideoInfo &video_info, bool set_width, bool set_height, bool set_frame_rate)
              Definition: xml_node.cc:216
              +
              bool AddVideoInfo(const MediaInfo::VideoInfo &video_info, bool set_width, bool set_height, bool set_frame_rate)
              Definition: xml_node.cc:215
              RepresentationType in MPD.
              Definition: xml_node.h:129
              -
              void SetFloatingPointAttribute(const char *attribute_name, double number)
              Definition: xml_node.cc:119
              +
              void SetFloatingPointAttribute(const char *attribute_name, double number)
              Definition: xml_node.cc:118
              AdaptationSetType specified in MPD.
              Definition: xml_node.h:114
              -
              scoped_xml_ptr< xmlNode > PassScopedPtr()
              Definition: xml_node.cc:137
              -
              XmlNode(const char *name)
              Definition: xml_node.cc:55
              -
              bool AddVODOnlyInfo(const MediaInfo &media_info)
              Definition: xml_node.cc:251
              -
              void SetStringAttribute(const char *attribute_name, const std::string &attribute)
              Definition: xml_node.cc:104
              +
              scoped_xml_ptr< xmlNode > PassScopedPtr()
              Definition: xml_node.cc:136
              +
              XmlNode(const char *name)
              Definition: xml_node.cc:54
              +
              bool AddVODOnlyInfo(const MediaInfo &media_info)
              Definition: xml_node.cc:250
              +
              void SetStringAttribute(const char *attribute_name, const std::string &attribute)
              Definition: xml_node.cc:103
              -
              bool AddChild(scoped_xml_ptr< xmlNode > child)
              Definition: xml_node.cc:62
              -
              xmlNodePtr Release()
              Definition: xml_node.cc:143
              -
              bool AddLiveOnlyInfo(const MediaInfo &media_info, const std::list< SegmentInfo > &segment_infos, uint32_t start_number)
              Definition: xml_node.cc:298
              -
              void SetId(uint32_t id)
              Definition: xml_node.cc:128
              -
              bool AddElements(const std::vector< Element > &elements)
              Adds Elements to this node using the Element struct.
              Definition: xml_node.cc:74
              -
              void SetIntegerAttribute(const char *attribute_name, uint64_t number)
              Definition: xml_node.cc:111
              -
              void AddRoleElement(const std::string &scheme_id_uri, const std::string &value)
              Definition: xml_node.cc:204
              -
              void SetContent(const std::string &content)
              Definition: xml_node.cc:132
              -
              bool AddAudioInfo(const MediaInfo::AudioInfo &audio_info)
              Definition: xml_node.cc:243
              -
              xmlNodePtr GetRawPtr()
              Definition: xml_node.cc:149
              +
              bool AddChild(scoped_xml_ptr< xmlNode > child)
              Definition: xml_node.cc:61
              +
              xmlNodePtr Release()
              Definition: xml_node.cc:142
              +
              bool AddLiveOnlyInfo(const MediaInfo &media_info, const std::list< SegmentInfo > &segment_infos, uint32_t start_number)
              Definition: xml_node.cc:297
              +
              void SetId(uint32_t id)
              Definition: xml_node.cc:127
              +
              bool AddElements(const std::vector< Element > &elements)
              Adds Elements to this node using the Element struct.
              Definition: xml_node.cc:73
              +
              void SetIntegerAttribute(const char *attribute_name, uint64_t number)
              Definition: xml_node.cc:110
              +
              void AddRoleElement(const std::string &scheme_id_uri, const std::string &value)
              Definition: xml_node.cc:203
              +
              void SetContent(const std::string &content)
              Definition: xml_node.cc:131
              +
              bool AddAudioInfo(const MediaInfo::AudioInfo &audio_info)
              Definition: xml_node.cc:242
              +
              xmlNodePtr GetRawPtr()
              Definition: xml_node.cc:148
              diff --git a/docs/dd/dee/box__definitions_8cc_source.html b/docs/dd/dee/box__definitions_8cc_source.html index 674632de93..562e8cfa3c 100644 --- a/docs/dd/dee/box__definitions_8cc_source.html +++ b/docs/dd/dee/box__definitions_8cc_source.html @@ -2944,7 +2944,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 c4614b8c6f..459ebe301e 100644 --- a/docs/dd/df2/webm_2multi__segment__segmenter_8h_source.html +++ b/docs/dd/df2/webm_2multi__segment__segmenter_8h_source.html @@ -148,7 +148,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 675153b9d6..af3b277082 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 @@ -212,7 +212,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 12365254a2..f41f4945c2 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 @@ -185,7 +185,7 @@ Additional Inherited Members diff --git a/docs/de/d0f/local__file_8h_source.html b/docs/de/d0f/local__file_8h_source.html index ec5961a524..758dac6c26 100644 --- a/docs/de/d0f/local__file_8h_source.html +++ b/docs/de/d0f/local__file_8h_source.html @@ -152,7 +152,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/d12/container__names_8h_source.html b/docs/de/d12/container__names_8h_source.html index 6c5ac7beb0..128deb28e6 100644 --- a/docs/de/d12/container__names_8h_source.html +++ b/docs/de/d12/container__names_8h_source.html @@ -159,7 +159,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/d13/ts__writer_8cc_source.html b/docs/de/d13/ts__writer_8cc_source.html index a84bdcdbfe..393cfa0fff 100644 --- a/docs/de/d13/ts__writer_8cc_source.html +++ b/docs/de/d13/ts__writer_8cc_source.html @@ -361,7 +361,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/d15/media__stream_8cc_source.html b/docs/de/d15/media__stream_8cc_source.html index b122dbbfb0..2be622e0f5 100644 --- a/docs/de/d15/media__stream_8cc_source.html +++ b/docs/de/d15/media__stream_8cc_source.html @@ -171,8 +171,8 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              82  } else {
              83  // We need to disconnect all its peer streams which are not connected
              84  // to a muxer.
              -
              85  for (size_t i = 0; i < demuxer_->streams().size(); ++i) {
              -
              86  Status status = demuxer_->streams()[i]->Start(operation);
              +
              85  for (size_t i = 0; i < demuxer_->streams().size(); ++i) {
              +
              86  Status status = demuxer_->streams()[i]->Start(operation);
              87  if (!status.ok())
              88  return status;
              89  }
              @@ -197,20 +197,20 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              108 } // namespace media
              109 } // namespace shaka
              Status PullSample(scoped_refptr< MediaSample > *sample)
              Pull sample from Demuxer (triggered by Muxer).
              Definition: media_stream.cc:24
              -
              const std::vector< MediaStream * > & streams()
              Definition: demuxer.h:68
              Status Start(MediaStreamOperation operation)
              Start the stream for pushing or pulling.
              Definition: media_stream.cc:62
              Status PushSample(const scoped_refptr< MediaSample > &sample)
              Push sample to Muxer (triggered by Demuxer).
              Definition: media_stream.cc:39
              MediaStream(scoped_refptr< StreamInfo > info, Demuxer *demuxer)
              Definition: media_stream.cc:19
              +
              const std::vector< std::unique_ptr< MediaStream > > & streams()
              Definition: demuxer.h:68
              void Connect(Muxer *muxer)
              Definition: media_stream.cc:55
              -
              Status Parse()
              Read from the source and send it to the parser.
              Definition: demuxer.cc:207
              +
              Status Parse()
              Read from the source and send it to the parser.
              Definition: demuxer.cc:197
              std::string ToString() const
              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 50a591a048..3708a419e6 100644 --- a/docs/de/d16/classshaka_1_1media_1_1TextTrackConfig-members.html +++ b/docs/de/d16/classshaka_1_1media_1_1TextTrackConfig-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/d17/cluster__builder_8cc_source.html b/docs/de/d17/cluster__builder_8cc_source.html index 13b19438fe..65cfa36e55 100644 --- a/docs/de/d17/cluster__builder_8cc_source.html +++ b/docs/de/d17/cluster__builder_8cc_source.html @@ -346,7 +346,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 b6bf507121..e107901aa5 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 @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 d187c58297..41ab76694d 100644 --- a/docs/de/d1e/mp4_2single__segment__segmenter_8cc_source.html +++ b/docs/de/d1e/mp4_2single__segment__segmenter_8cc_source.html @@ -336,7 +336,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/d22/aes__pattern__cryptor_8cc_source.html b/docs/de/d22/aes__pattern__cryptor_8cc_source.html index fb926ec1fb..2197761d46 100644 --- a/docs/de/d22/aes__pattern__cryptor_8cc_source.html +++ b/docs/de/d22/aes__pattern__cryptor_8cc_source.html @@ -193,12 +193,12 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              const std::vector< uint8_t > & iv() const
              Definition: aes_cryptor.h:81
              -
              bool SetIv(const std::vector< uint8_t > &iv)
              Definition: aes_cryptor.cc:69
              +
              bool SetIv(const std::vector< uint8_t > &iv)
              Definition: aes_cryptor.cc:67
              AesPatternCryptor(uint8_t crypt_byte_block, uint8_t skip_byte_block, PatternEncryptionMode encryption_mode, ConstantIvFlag constant_iv_flag, std::unique_ptr< AesCryptor > cryptor)
              diff --git a/docs/de/d27/classshaka_1_1media_1_1mp2t_1_1H264ProgramMapTableWriter.html b/docs/de/d27/classshaka_1_1media_1_1mp2t_1_1H264ProgramMapTableWriter.html index 708eb68966..de09124a34 100644 --- a/docs/de/d27/classshaka_1_1media_1_1mp2t_1_1H264ProgramMapTableWriter.html +++ b/docs/de/d27/classshaka_1_1media_1_1mp2t_1_1H264ProgramMapTableWriter.html @@ -140,7 +140,7 @@ static const uint8_t kElem 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 d057d145c8..66726523e6 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 @@ -194,7 +194,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 18fd61192c..ec44629120 100644 --- a/docs/de/d33/classshaka_1_1media_1_1WebMTracksParser-members.html +++ b/docs/de/d33/classshaka_1_1media_1_1WebMTracksParser-members.html @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/d33/structshaka_1_1media_1_1H265Pps.html b/docs/de/d33/structshaka_1_1media_1_1H265Pps.html index c69792c60c..af58dd7a38 100644 --- a/docs/de/d33/structshaka_1_1media_1_1H265Pps.html +++ b/docs/de/d33/structshaka_1_1media_1_1H265Pps.html @@ -224,7 +224,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 959ba96730..1fe1c448be 100644 --- a/docs/de/d34/offset__byte__queue_8h_source.html +++ b/docs/de/d34/offset__byte__queue_8h_source.html @@ -143,7 +143,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 eb788501c4..4c50204f68 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 @@ -162,7 +162,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/d3c/macros_8h_source.html b/docs/de/d3c/macros_8h_source.html index 1024c174ce..25ce07fcba 100644 --- a/docs/de/d3c/macros_8h_source.html +++ b/docs/de/d3c/macros_8h_source.html @@ -144,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/d3e/buffer__reader_8h_source.html b/docs/de/d3e/buffer__reader_8h_source.html index 7f472e708d..67cec56711 100644 --- a/docs/de/d3e/buffer__reader_8h_source.html +++ b/docs/de/d3e/buffer__reader_8h_source.html @@ -163,7 +163,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 2f150190ac..1d6421a0f3 100644 --- a/docs/de/d3e/classshaka_1_1media_1_1H264Parser-members.html +++ b/docs/de/d3e/classshaka_1_1media_1_1H264Parser-members.html @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 7834524c96..297ff772d1 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 @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/d49/classshaka_1_1media_1_1DecryptConfig.html b/docs/de/d49/classshaka_1_1media_1_1DecryptConfig.html index e6f48eb77c..30ebd2ab53 100644 --- a/docs/de/d49/classshaka_1_1media_1_1DecryptConfig.html +++ b/docs/de/d49/classshaka_1_1media_1_1DecryptConfig.html @@ -249,7 +249,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 d4e9e6434b..0f9418e56e 100644 --- a/docs/de/d4a/muxer__listener__internal_8h_source.html +++ b/docs/de/d4a/muxer__listener__internal_8h_source.html @@ -145,7 +145,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/d52/classshaka_1_1Representation.html b/docs/de/d52/classshaka_1_1Representation.html index 25e1d48940..b373c24e2b 100644 --- a/docs/de/d52/classshaka_1_1Representation.html +++ b/docs/de/d52/classshaka_1_1Representation.html @@ -145,7 +145,7 @@ template<MpdBuilder::MpdType type>

              Detailed Description

              Representation class contains references to a single media stream, as well as optional ContentProtection elements for that stream.

              -

              Definition at line 428 of file mpd_builder.h.

              +

              Definition at line 425 of file mpd_builder.h.

              Constructor & Destructor Documentation

              @@ -200,7 +200,7 @@ template<MpdBuilder::MpdType type> -

              Definition at line 1035 of file mpd_builder.cc.

              +

              Definition at line 1031 of file mpd_builder.cc.

              @@ -234,7 +234,7 @@ template<MpdBuilder::MpdType type> -

              Definition at line 1092 of file mpd_builder.cc.

              +

              Definition at line 1088 of file mpd_builder.cc.

              @@ -285,7 +285,7 @@ template<MpdBuilder::MpdType type> -

              Definition at line 1104 of file mpd_builder.cc.

              +

              Definition at line 1100 of file mpd_builder.cc.

              @@ -303,7 +303,7 @@ template<MpdBuilder::MpdType type>
              Returns
              Copy of <Representation>.
              -

              Definition at line 1144 of file mpd_builder.cc.

              +

              Definition at line 1140 of file mpd_builder.cc.

              @@ -329,7 +329,7 @@ template<MpdBuilder::MpdType type>
              Returns
              ID number for <Representation>.
              -

              Definition at line 503 of file mpd_builder.h.

              +

              Definition at line 500 of file mpd_builder.h.

              @@ -348,7 +348,7 @@ template<MpdBuilder::MpdType type>

              Tries to initialize the instance. If this does not succeed, the instance should not be used.

              Returns
              true on success, false otherwise.
              -

              Definition at line 1050 of file mpd_builder.cc.

              +

              Definition at line 1046 of file mpd_builder.cc.

              @@ -381,7 +381,7 @@ template<MpdBuilder::MpdType type> -

              Definition at line 1128 of file mpd_builder.cc.

              +

              Definition at line 1124 of file mpd_builder.cc.

              @@ -400,7 +400,7 @@ template<MpdBuilder::MpdType type>

              By calling this methods, the next time GetXml() is called, the corresponding attributes will not be set. For example, if SuppressOnce(kSuppressWidth) is called, then GetXml() will return a <Representation> element without a attribute. Note that it only applies to the next call to GetXml(), calling GetXml() again without calling this methods will return a <Representation> element with the attribute. This may be called multiple times to set different (or the same) flags.

              -

              Definition at line 1207 of file mpd_builder.cc.

              +

              Definition at line 1203 of file mpd_builder.cc.

              @@ -445,7 +445,7 @@ template<MpdBuilder::MpdType type>
              Attention
              This might get removed once DASH IF IOP specification makes a a clear guideline on how to handle key rotation. Also to get this working with shaka-player, this method DOES NOT update the PSSH element. Instead, it removes the element regardless of the content of pssh.
              -

              Definition at line 1098 of file mpd_builder.cc.

              +

              Definition at line 1094 of file mpd_builder.cc.

              @@ -456,7 +456,7 @@ template<MpdBuilder::MpdType type> 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 4cd1c8ca8f..c1a371ee1d 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 @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/d5b/adts__header_8cc_source.html b/docs/de/d5b/adts__header_8cc_source.html index ef015d973a..1504cc8000 100644 --- a/docs/de/d5b/adts__header_8cc_source.html +++ b/docs/de/d5b/adts__header_8cc_source.html @@ -207,7 +207,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/d5c/mpd__flags_8h_source.html b/docs/de/d5c/mpd__flags_8h_source.html index 7cbe2c2442..acf298c2a1 100644 --- a/docs/de/d5c/mpd__flags_8h_source.html +++ b/docs/de/d5c/mpd__flags_8h_source.html @@ -114,7 +114,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 65692436bc..50f76a31e4 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 @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 ca432259c1..68d14a016c 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 @@ -257,7 +257,7 @@ void  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 e58b1abb59..a34d5b07f4 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 @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/d6e/language__utils_8h_source.html b/docs/de/d6e/language__utils_8h_source.html index f4ccc63c8e..5375236595 100644 --- a/docs/de/d6e/language__utils_8h_source.html +++ b/docs/de/d6e/language__utils_8h_source.html @@ -114,7 +114,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/d70/http__key__fetcher_8cc_source.html b/docs/de/d70/http__key__fetcher_8cc_source.html index 1eba97cf78..3f5b2ccd09 100644 --- a/docs/de/d70/http__key__fetcher_8cc_source.html +++ b/docs/de/d70/http__key__fetcher_8cc_source.html @@ -238,7 +238,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 a53633fd89..f1235dab67 100644 --- a/docs/de/d77/webm__content__encodings__client_8cc_source.html +++ b/docs/de/d77/webm__content__encodings__client_8cc_source.html @@ -94,274 +94,271 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              5 #include "packager/media/formats/webm/webm_content_encodings_client.h"
              6 
              7 #include "packager/base/logging.h"
              -
              8 #include "packager/base/stl_util.h"
              -
              9 #include "packager/media/formats/webm/webm_constants.h"
              -
              10 
              -
              11 namespace shaka {
              -
              12 namespace media {
              -
              13 
              -
              14 WebMContentEncodingsClient::WebMContentEncodingsClient()
              -
              15  : content_encryption_encountered_(false), content_encodings_ready_(false) {}
              -
              16 
              -
              17 WebMContentEncodingsClient::~WebMContentEncodingsClient() {
              -
              18  STLDeleteElements(&content_encodings_);
              -
              19 }
              -
              20 
              -
              21 const ContentEncodings& WebMContentEncodingsClient::content_encodings() const {
              -
              22  DCHECK(content_encodings_ready_);
              -
              23  return content_encodings_;
              -
              24 }
              -
              25 
              - -
              27  if (id == kWebMIdContentEncodings) {
              -
              28  DCHECK(!cur_content_encoding_.get());
              -
              29  DCHECK(!content_encryption_encountered_);
              -
              30  STLDeleteElements(&content_encodings_);
              -
              31  content_encodings_ready_ = false;
              -
              32  return this;
              -
              33  }
              -
              34 
              -
              35  if (id == kWebMIdContentEncoding) {
              -
              36  DCHECK(!cur_content_encoding_.get());
              -
              37  DCHECK(!content_encryption_encountered_);
              -
              38  cur_content_encoding_.reset(new ContentEncoding());
              -
              39  return this;
              -
              40  }
              -
              41 
              -
              42  if (id == kWebMIdContentEncryption) {
              -
              43  DCHECK(cur_content_encoding_.get());
              -
              44  if (content_encryption_encountered_) {
              -
              45  LOG(ERROR) << "Unexpected multiple ContentEncryption.";
              -
              46  return NULL;
              -
              47  }
              -
              48  content_encryption_encountered_ = true;
              -
              49  return this;
              -
              50  }
              -
              51 
              -
              52  if (id == kWebMIdContentEncAESSettings) {
              -
              53  DCHECK(cur_content_encoding_.get());
              -
              54  return this;
              -
              55  }
              -
              56 
              -
              57  // This should not happen if WebMListParser is working properly.
              -
              58  DCHECK(false);
              -
              59  return NULL;
              -
              60 }
              -
              61 
              -
              62 // Mandatory occurrence restriction is checked in this function. Multiple
              -
              63 // occurrence restriction is checked in OnUInt and OnBinary.
              -
              64 bool WebMContentEncodingsClient::OnListEnd(int id) {
              -
              65  if (id == kWebMIdContentEncodings) {
              -
              66  // ContentEncoding element is mandatory. Check this!
              -
              67  if (content_encodings_.empty()) {
              -
              68  LOG(ERROR) << "Missing ContentEncoding.";
              -
              69  return false;
              -
              70  }
              -
              71  content_encodings_ready_ = true;
              -
              72  return true;
              -
              73  }
              +
              8 #include "packager/media/formats/webm/webm_constants.h"
              +
              9 
              +
              10 namespace shaka {
              +
              11 namespace media {
              +
              12 
              +
              13 WebMContentEncodingsClient::WebMContentEncodingsClient()
              +
              14  : content_encryption_encountered_(false), content_encodings_ready_(false) {}
              +
              15 
              +
              16 WebMContentEncodingsClient::~WebMContentEncodingsClient() {}
              +
              17 
              +
              18 const ContentEncodings& WebMContentEncodingsClient::content_encodings() const {
              +
              19  DCHECK(content_encodings_ready_);
              +
              20  return content_encodings_;
              +
              21 }
              +
              22 
              + +
              24  if (id == kWebMIdContentEncodings) {
              +
              25  DCHECK(!cur_content_encoding_.get());
              +
              26  DCHECK(!content_encryption_encountered_);
              +
              27  content_encodings_.clear();
              +
              28  content_encodings_ready_ = false;
              +
              29  return this;
              +
              30  }
              +
              31 
              +
              32  if (id == kWebMIdContentEncoding) {
              +
              33  DCHECK(!cur_content_encoding_.get());
              +
              34  DCHECK(!content_encryption_encountered_);
              +
              35  cur_content_encoding_.reset(new ContentEncoding());
              +
              36  return this;
              +
              37  }
              +
              38 
              +
              39  if (id == kWebMIdContentEncryption) {
              +
              40  DCHECK(cur_content_encoding_.get());
              +
              41  if (content_encryption_encountered_) {
              +
              42  LOG(ERROR) << "Unexpected multiple ContentEncryption.";
              +
              43  return NULL;
              +
              44  }
              +
              45  content_encryption_encountered_ = true;
              +
              46  return this;
              +
              47  }
              +
              48 
              +
              49  if (id == kWebMIdContentEncAESSettings) {
              +
              50  DCHECK(cur_content_encoding_.get());
              +
              51  return this;
              +
              52  }
              +
              53 
              +
              54  // This should not happen if WebMListParser is working properly.
              +
              55  DCHECK(false);
              +
              56  return NULL;
              +
              57 }
              +
              58 
              +
              59 // Mandatory occurrence restriction is checked in this function. Multiple
              +
              60 // occurrence restriction is checked in OnUInt and OnBinary.
              +
              61 bool WebMContentEncodingsClient::OnListEnd(int id) {
              +
              62  if (id == kWebMIdContentEncodings) {
              +
              63  // ContentEncoding element is mandatory. Check this!
              +
              64  if (content_encodings_.empty()) {
              +
              65  LOG(ERROR) << "Missing ContentEncoding.";
              +
              66  return false;
              +
              67  }
              +
              68  content_encodings_ready_ = true;
              +
              69  return true;
              +
              70  }
              +
              71 
              +
              72  if (id == kWebMIdContentEncoding) {
              +
              73  DCHECK(cur_content_encoding_.get());
              74 
              -
              75  if (id == kWebMIdContentEncoding) {
              -
              76  DCHECK(cur_content_encoding_.get());
              -
              77 
              -
              78  //
              -
              79  // Specify default values to missing mandatory elements.
              -
              80  //
              -
              81 
              -
              82  if (cur_content_encoding_->order() == ContentEncoding::kOrderInvalid) {
              -
              83  // Default value of encoding order is 0, which should only be used on the
              -
              84  // first ContentEncoding.
              -
              85  if (!content_encodings_.empty()) {
              -
              86  LOG(ERROR) << "Missing ContentEncodingOrder.";
              -
              87  return false;
              -
              88  }
              -
              89  cur_content_encoding_->set_order(0);
              -
              90  }
              +
              75  //
              +
              76  // Specify default values to missing mandatory elements.
              +
              77  //
              +
              78 
              +
              79  if (cur_content_encoding_->order() == ContentEncoding::kOrderInvalid) {
              +
              80  // Default value of encoding order is 0, which should only be used on the
              +
              81  // first ContentEncoding.
              +
              82  if (!content_encodings_.empty()) {
              +
              83  LOG(ERROR) << "Missing ContentEncodingOrder.";
              +
              84  return false;
              +
              85  }
              +
              86  cur_content_encoding_->set_order(0);
              +
              87  }
              +
              88 
              +
              89  if (cur_content_encoding_->scope() == ContentEncoding::kScopeInvalid)
              +
              90  cur_content_encoding_->set_scope(ContentEncoding::kScopeAllFrameContents);
              91 
              -
              92  if (cur_content_encoding_->scope() == ContentEncoding::kScopeInvalid)
              -
              93  cur_content_encoding_->set_scope(ContentEncoding::kScopeAllFrameContents);
              +
              92  if (cur_content_encoding_->type() == ContentEncoding::kTypeInvalid)
              +
              93  cur_content_encoding_->set_type(ContentEncoding::kTypeCompression);
              94 
              -
              95  if (cur_content_encoding_->type() == ContentEncoding::kTypeInvalid)
              -
              96  cur_content_encoding_->set_type(ContentEncoding::kTypeCompression);
              -
              97 
              -
              98  // Check for elements valid in spec but not supported for now.
              -
              99  if (cur_content_encoding_->type() == ContentEncoding::kTypeCompression) {
              -
              100  LOG(ERROR) << "ContentCompression not supported.";
              -
              101  return false;
              -
              102  }
              -
              103 
              -
              104  // Enforce mandatory elements without default values.
              -
              105  DCHECK(cur_content_encoding_->type() == ContentEncoding::kTypeEncryption);
              -
              106  if (!content_encryption_encountered_) {
              -
              107  LOG(ERROR) << "ContentEncodingType is encryption but"
              -
              108  << " ContentEncryption is missing.";
              -
              109  return false;
              -
              110  }
              -
              111 
              -
              112  content_encodings_.push_back(cur_content_encoding_.release());
              -
              113  content_encryption_encountered_ = false;
              -
              114  return true;
              -
              115  }
              -
              116 
              -
              117  if (id == kWebMIdContentEncryption) {
              -
              118  DCHECK(cur_content_encoding_.get());
              -
              119  // Specify default value for elements that are not present.
              -
              120  if (cur_content_encoding_->encryption_algo() ==
              -
              121  ContentEncoding::kEncAlgoInvalid) {
              -
              122  cur_content_encoding_->set_encryption_algo(
              -
              123  ContentEncoding::kEncAlgoNotEncrypted);
              -
              124  }
              -
              125  return true;
              -
              126  }
              -
              127 
              -
              128  if (id == kWebMIdContentEncAESSettings) {
              -
              129  if (cur_content_encoding_->cipher_mode() ==
              -
              130  ContentEncoding::kCipherModeInvalid)
              -
              131  cur_content_encoding_->set_cipher_mode(ContentEncoding::kCipherModeCtr);
              -
              132  return true;
              -
              133  }
              -
              134 
              -
              135  // This should not happen if WebMListParser is working properly.
              -
              136  DCHECK(false);
              -
              137  return false;
              -
              138 }
              -
              139 
              -
              140 // Multiple occurrence restriction and range are checked in this function.
              -
              141 // Mandatory occurrence restriction is checked in OnListEnd.
              -
              142 bool WebMContentEncodingsClient::OnUInt(int id, int64_t val) {
              -
              143  DCHECK(cur_content_encoding_.get());
              -
              144 
              -
              145  if (id == kWebMIdContentEncodingOrder) {
              -
              146  if (cur_content_encoding_->order() != ContentEncoding::kOrderInvalid) {
              -
              147  LOG(ERROR) << "Unexpected multiple ContentEncodingOrder.";
              -
              148  return false;
              -
              149  }
              -
              150 
              -
              151  if (val != static_cast<int64_t>(content_encodings_.size())) {
              -
              152  // According to the spec, encoding order starts with 0 and counts upwards.
              -
              153  LOG(ERROR) << "Unexpected ContentEncodingOrder.";
              -
              154  return false;
              -
              155  }
              -
              156 
              -
              157  cur_content_encoding_->set_order(val);
              -
              158  return true;
              -
              159  }
              -
              160 
              -
              161  if (id == kWebMIdContentEncodingScope) {
              -
              162  if (cur_content_encoding_->scope() != ContentEncoding::kScopeInvalid) {
              -
              163  LOG(ERROR) << "Unexpected multiple ContentEncodingScope.";
              -
              164  return false;
              -
              165  }
              -
              166 
              -
              167  if (val == ContentEncoding::kScopeInvalid ||
              -
              168  val > ContentEncoding::kScopeMax) {
              -
              169  LOG(ERROR) << "Unexpected ContentEncodingScope.";
              -
              170  return false;
              -
              171  }
              -
              172 
              -
              173  if (val & ContentEncoding::kScopeNextContentEncodingData) {
              -
              174  LOG(ERROR) << "Encoded next ContentEncoding is not "
              -
              175  "supported.";
              -
              176  return false;
              -
              177  }
              -
              178 
              -
              179  cur_content_encoding_->set_scope(static_cast<ContentEncoding::Scope>(val));
              -
              180  return true;
              -
              181  }
              -
              182 
              -
              183  if (id == kWebMIdContentEncodingType) {
              -
              184  if (cur_content_encoding_->type() != ContentEncoding::kTypeInvalid) {
              -
              185  LOG(ERROR) << "Unexpected multiple ContentEncodingType.";
              -
              186  return false;
              -
              187  }
              -
              188 
              -
              189  if (val == ContentEncoding::kTypeCompression) {
              -
              190  LOG(ERROR) << "ContentCompression not supported.";
              -
              191  return false;
              -
              192  }
              -
              193 
              -
              194  if (val != ContentEncoding::kTypeEncryption) {
              -
              195  LOG(ERROR) << "Unexpected ContentEncodingType " << val << ".";
              -
              196  return false;
              -
              197  }
              -
              198 
              -
              199  cur_content_encoding_->set_type(static_cast<ContentEncoding::Type>(val));
              -
              200  return true;
              -
              201  }
              -
              202 
              -
              203  if (id == kWebMIdContentEncAlgo) {
              -
              204  if (cur_content_encoding_->encryption_algo() !=
              -
              205  ContentEncoding::kEncAlgoInvalid) {
              -
              206  LOG(ERROR) << "Unexpected multiple ContentEncAlgo.";
              -
              207  return false;
              -
              208  }
              -
              209 
              -
              210  if (val < ContentEncoding::kEncAlgoNotEncrypted ||
              -
              211  val > ContentEncoding::kEncAlgoAes) {
              -
              212  LOG(ERROR) << "Unexpected ContentEncAlgo " << val << ".";
              -
              213  return false;
              -
              214  }
              -
              215 
              -
              216  cur_content_encoding_->set_encryption_algo(
              -
              217  static_cast<ContentEncoding::EncryptionAlgo>(val));
              -
              218  return true;
              -
              219  }
              -
              220 
              -
              221  if (id == kWebMIdAESSettingsCipherMode) {
              -
              222  if (cur_content_encoding_->cipher_mode() !=
              -
              223  ContentEncoding::kCipherModeInvalid) {
              -
              224  LOG(ERROR) << "Unexpected multiple AESSettingsCipherMode.";
              -
              225  return false;
              -
              226  }
              -
              227 
              -
              228  if (val != ContentEncoding::kCipherModeCtr) {
              -
              229  LOG(ERROR) << "Unexpected AESSettingsCipherMode " << val << ".";
              -
              230  return false;
              -
              231  }
              -
              232 
              -
              233  cur_content_encoding_->set_cipher_mode(
              -
              234  static_cast<ContentEncoding::CipherMode>(val));
              -
              235  return true;
              -
              236  }
              -
              237 
              -
              238  // This should not happen if WebMListParser is working properly.
              -
              239  DCHECK(false);
              -
              240  return false;
              -
              241 }
              -
              242 
              -
              243 // Multiple occurrence restriction is checked in this function. Mandatory
              -
              244 // restriction is checked in OnListEnd.
              -
              245 bool WebMContentEncodingsClient::OnBinary(int id,
              -
              246  const uint8_t* data,
              -
              247  int size) {
              -
              248  DCHECK(cur_content_encoding_.get());
              -
              249  DCHECK(data);
              -
              250  DCHECK_GT(size, 0);
              -
              251 
              -
              252  if (id == kWebMIdContentEncKeyID) {
              -
              253  if (!cur_content_encoding_->encryption_key_id().empty()) {
              -
              254  LOG(ERROR) << "Unexpected multiple ContentEncKeyID";
              -
              255  return false;
              -
              256  }
              -
              257  cur_content_encoding_->SetEncryptionKeyId(data, size);
              -
              258  return true;
              -
              259  }
              -
              260 
              -
              261  // This should not happen if WebMListParser is working properly.
              -
              262  DCHECK(false);
              -
              263  return false;
              -
              264 }
              -
              265 
              -
              266 } // namespace media
              -
              267 } // namespace shaka
              +
              95  // Check for elements valid in spec but not supported for now.
              +
              96  if (cur_content_encoding_->type() == ContentEncoding::kTypeCompression) {
              +
              97  LOG(ERROR) << "ContentCompression not supported.";
              +
              98  return false;
              +
              99  }
              +
              100 
              +
              101  // Enforce mandatory elements without default values.
              +
              102  DCHECK_EQ(cur_content_encoding_->type(), ContentEncoding::kTypeEncryption);
              +
              103  if (!content_encryption_encountered_) {
              +
              104  LOG(ERROR) << "ContentEncodingType is encryption but"
              +
              105  << " ContentEncryption is missing.";
              +
              106  return false;
              +
              107  }
              +
              108 
              +
              109  content_encodings_.push_back(std::move(cur_content_encoding_));
              +
              110  content_encryption_encountered_ = false;
              +
              111  return true;
              +
              112  }
              +
              113 
              +
              114  if (id == kWebMIdContentEncryption) {
              +
              115  DCHECK(cur_content_encoding_.get());
              +
              116  // Specify default value for elements that are not present.
              +
              117  if (cur_content_encoding_->encryption_algo() ==
              +
              118  ContentEncoding::kEncAlgoInvalid) {
              +
              119  cur_content_encoding_->set_encryption_algo(
              +
              120  ContentEncoding::kEncAlgoNotEncrypted);
              +
              121  }
              +
              122  return true;
              +
              123  }
              +
              124 
              +
              125  if (id == kWebMIdContentEncAESSettings) {
              +
              126  if (cur_content_encoding_->cipher_mode() ==
              +
              127  ContentEncoding::kCipherModeInvalid)
              +
              128  cur_content_encoding_->set_cipher_mode(ContentEncoding::kCipherModeCtr);
              +
              129  return true;
              +
              130  }
              +
              131 
              +
              132  // This should not happen if WebMListParser is working properly.
              +
              133  DCHECK(false);
              +
              134  return false;
              +
              135 }
              +
              136 
              +
              137 // Multiple occurrence restriction and range are checked in this function.
              +
              138 // Mandatory occurrence restriction is checked in OnListEnd.
              +
              139 bool WebMContentEncodingsClient::OnUInt(int id, int64_t val) {
              +
              140  DCHECK(cur_content_encoding_.get());
              +
              141 
              +
              142  if (id == kWebMIdContentEncodingOrder) {
              +
              143  if (cur_content_encoding_->order() != ContentEncoding::kOrderInvalid) {
              +
              144  LOG(ERROR) << "Unexpected multiple ContentEncodingOrder.";
              +
              145  return false;
              +
              146  }
              +
              147 
              +
              148  if (val != static_cast<int64_t>(content_encodings_.size())) {
              +
              149  // According to the spec, encoding order starts with 0 and counts upwards.
              +
              150  LOG(ERROR) << "Unexpected ContentEncodingOrder.";
              +
              151  return false;
              +
              152  }
              +
              153 
              +
              154  cur_content_encoding_->set_order(val);
              +
              155  return true;
              +
              156  }
              +
              157 
              +
              158  if (id == kWebMIdContentEncodingScope) {
              +
              159  if (cur_content_encoding_->scope() != ContentEncoding::kScopeInvalid) {
              +
              160  LOG(ERROR) << "Unexpected multiple ContentEncodingScope.";
              +
              161  return false;
              +
              162  }
              +
              163 
              +
              164  if (val == ContentEncoding::kScopeInvalid ||
              +
              165  val > ContentEncoding::kScopeMax) {
              +
              166  LOG(ERROR) << "Unexpected ContentEncodingScope.";
              +
              167  return false;
              +
              168  }
              +
              169 
              +
              170  if (val & ContentEncoding::kScopeNextContentEncodingData) {
              +
              171  LOG(ERROR) << "Encoded next ContentEncoding is not "
              +
              172  "supported.";
              +
              173  return false;
              +
              174  }
              +
              175 
              +
              176  cur_content_encoding_->set_scope(static_cast<ContentEncoding::Scope>(val));
              +
              177  return true;
              +
              178  }
              +
              179 
              +
              180  if (id == kWebMIdContentEncodingType) {
              +
              181  if (cur_content_encoding_->type() != ContentEncoding::kTypeInvalid) {
              +
              182  LOG(ERROR) << "Unexpected multiple ContentEncodingType.";
              +
              183  return false;
              +
              184  }
              +
              185 
              +
              186  if (val == ContentEncoding::kTypeCompression) {
              +
              187  LOG(ERROR) << "ContentCompression not supported.";
              +
              188  return false;
              +
              189  }
              +
              190 
              +
              191  if (val != ContentEncoding::kTypeEncryption) {
              +
              192  LOG(ERROR) << "Unexpected ContentEncodingType " << val << ".";
              +
              193  return false;
              +
              194  }
              +
              195 
              +
              196  cur_content_encoding_->set_type(static_cast<ContentEncoding::Type>(val));
              +
              197  return true;
              +
              198  }
              +
              199 
              +
              200  if (id == kWebMIdContentEncAlgo) {
              +
              201  if (cur_content_encoding_->encryption_algo() !=
              +
              202  ContentEncoding::kEncAlgoInvalid) {
              +
              203  LOG(ERROR) << "Unexpected multiple ContentEncAlgo.";
              +
              204  return false;
              +
              205  }
              +
              206 
              +
              207  if (val < ContentEncoding::kEncAlgoNotEncrypted ||
              +
              208  val > ContentEncoding::kEncAlgoAes) {
              +
              209  LOG(ERROR) << "Unexpected ContentEncAlgo " << val << ".";
              +
              210  return false;
              +
              211  }
              +
              212 
              +
              213  cur_content_encoding_->set_encryption_algo(
              +
              214  static_cast<ContentEncoding::EncryptionAlgo>(val));
              +
              215  return true;
              +
              216  }
              +
              217 
              +
              218  if (id == kWebMIdAESSettingsCipherMode) {
              +
              219  if (cur_content_encoding_->cipher_mode() !=
              +
              220  ContentEncoding::kCipherModeInvalid) {
              +
              221  LOG(ERROR) << "Unexpected multiple AESSettingsCipherMode.";
              +
              222  return false;
              +
              223  }
              +
              224 
              +
              225  if (val != ContentEncoding::kCipherModeCtr) {
              +
              226  LOG(ERROR) << "Unexpected AESSettingsCipherMode " << val << ".";
              +
              227  return false;
              +
              228  }
              +
              229 
              +
              230  cur_content_encoding_->set_cipher_mode(
              +
              231  static_cast<ContentEncoding::CipherMode>(val));
              +
              232  return true;
              +
              233  }
              +
              234 
              +
              235  // This should not happen if WebMListParser is working properly.
              +
              236  DCHECK(false);
              +
              237  return false;
              +
              238 }
              +
              239 
              +
              240 // Multiple occurrence restriction is checked in this function. Mandatory
              +
              241 // restriction is checked in OnListEnd.
              +
              242 bool WebMContentEncodingsClient::OnBinary(int id,
              +
              243  const uint8_t* data,
              +
              244  int size) {
              +
              245  DCHECK(cur_content_encoding_.get());
              +
              246  DCHECK(data);
              +
              247  DCHECK_GT(size, 0);
              +
              248 
              +
              249  if (id == kWebMIdContentEncKeyID) {
              +
              250  if (!cur_content_encoding_->encryption_key_id().empty()) {
              +
              251  LOG(ERROR) << "Unexpected multiple ContentEncKeyID";
              +
              252  return false;
              +
              253  }
              +
              254  cur_content_encoding_->SetEncryptionKeyId(data, size);
              +
              255  return true;
              +
              256  }
              +
              257 
              +
              258  // This should not happen if WebMListParser is working properly.
              +
              259  DCHECK(false);
              +
              260  return false;
              +
              261 }
              +
              262 
              +
              263 } // namespace media
              +
              264 } // namespace shaka
              -
              WebMParserClient * OnListStart(int id) override
              WebMParserClient methods.
              +
              WebMParserClient * OnListStart(int id) override
              WebMParserClient methods.
              diff --git a/docs/de/d7b/mp4__media__parser_8h_source.html b/docs/de/d7b/mp4__media__parser_8h_source.html index 40ca6dc3ed..453d39b306 100644 --- a/docs/de/d7b/mp4__media__parser_8h_source.html +++ b/docs/de/d7b/mp4__media__parser_8h_source.html @@ -204,7 +204,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 905300e1dc..9eef7efb80 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 @@ -147,7 +147,7 @@ Additional Inherited Members diff --git a/docs/de/d83/box__definitions__comparison_8h_source.html b/docs/de/d83/box__definitions__comparison_8h_source.html index 5f9ba85644..e00d014e8e 100644 --- a/docs/de/d83/box__definitions__comparison_8h_source.html +++ b/docs/de/d83/box__definitions__comparison_8h_source.html @@ -592,7 +592,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/d83/classshaka_1_1media_1_1LocalFile-members.html b/docs/de/d83/classshaka_1_1media_1_1LocalFile-members.html index e5e8d1883a..55d4704fc8 100644 --- a/docs/de/d83/classshaka_1_1media_1_1LocalFile-members.html +++ b/docs/de/d83/classshaka_1_1media_1_1LocalFile-members.html @@ -117,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 f669aa22a7..0e5d698a83 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 @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 25dfbbb6e8..f3e7c6d6a6 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 e35d68f366..3193fa7155 100644 --- a/docs/de/d93/classshaka_1_1media_1_1VP8Parser-members.html +++ b/docs/de/d93/classshaka_1_1media_1_1VP8Parser-members.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/da9/structshaka_1_1Element.html b/docs/de/da9/structshaka_1_1Element.html index b98d37fdb0..3dd91a8f21 100644 --- a/docs/de/da9/structshaka_1_1Element.html +++ b/docs/de/da9/structshaka_1_1Element.html @@ -120,7 +120,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 758f17495e..8c5be0a39e 100644 --- a/docs/de/dab/es__parser__h26x_8cc_source.html +++ b/docs/de/dab/es__parser__h26x_8cc_source.html @@ -410,7 +410,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/dad/validate__flag_8cc_source.html b/docs/de/dad/validate__flag_8cc_source.html index e74d8c162b..881a267e4d 100644 --- a/docs/de/dad/validate__flag_8cc_source.html +++ b/docs/de/dad/validate__flag_8cc_source.html @@ -132,7 +132,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/db3/classshaka_1_1media_1_1TextTrackConfig.html b/docs/de/db3/classshaka_1_1media_1_1TextTrackConfig.html index 0e74e778e6..9efc55f4ec 100644 --- a/docs/de/db3/classshaka_1_1media_1_1TextTrackConfig.html +++ b/docs/de/db3/classshaka_1_1media_1_1TextTrackConfig.html @@ -125,7 +125,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 814d65a334..2385c64bb4 100644 --- a/docs/de/db4/classshaka_1_1media_1_1H26xBitReader.html +++ b/docs/de/db4/classshaka_1_1media_1_1H26xBitReader.html @@ -134,7 +134,7 @@ size_t NumEmulationPrevent diff --git a/docs/de/dc1/demuxer_8h_source.html b/docs/de/dc1/demuxer_8h_source.html index a7edd7795e..b03d1ea47a 100644 --- a/docs/de/dc1/demuxer_8h_source.html +++ b/docs/de/dc1/demuxer_8h_source.html @@ -131,63 +131,65 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
              59 
              62  void Cancel();
              63 
              -
              68  const std::vector<MediaStream*>& streams() { return streams_; }
              -
              69 
              -
              72  MediaContainerName container_name() { return container_name_; }
              -
              73 
              -
              74  private:
              -
              75  struct QueuedSample {
              -
              76  QueuedSample(uint32_t track_id, scoped_refptr<MediaSample> sample);
              -
              77  ~QueuedSample();
              -
              78 
              -
              79  uint32_t track_id;
              -
              80  scoped_refptr<MediaSample> sample;
              -
              81  };
              -
              82 
              -
              83  // Parser init event.
              -
              84  void ParserInitEvent(const std::vector<scoped_refptr<StreamInfo> >& streams);
              -
              85  // Parser new sample event handler. Queues the samples if init event has not
              -
              86  // been received, otherwise calls PushSample() to push the sample to
              -
              87  // corresponding stream.
              -
              88  bool NewSampleEvent(uint32_t track_id,
              -
              89  const scoped_refptr<MediaSample>& sample);
              -
              90  // Helper function to push the sample to corresponding stream.
              -
              91  bool PushSample(uint32_t track_id, const scoped_refptr<MediaSample>& sample);
              -
              92 
              -
              93  std::string file_name_;
              -
              94  File* media_file_;
              -
              95  bool init_event_received_;
              -
              96  Status init_parsing_status_;
              -
              97  // Queued samples received in NewSampleEvent() before ParserInitEvent().
              -
              98  std::deque<QueuedSample> queued_samples_;
              -
              99  std::unique_ptr<MediaParser> parser_;
              -
              100  std::vector<MediaStream*> streams_;
              -
              101  MediaContainerName container_name_;
              -
              102  std::unique_ptr<uint8_t[]> buffer_;
              -
              103  std::unique_ptr<KeySource> key_source_;
              -
              104  bool cancelled_;
              -
              105 
              -
              106  DISALLOW_COPY_AND_ASSIGN(Demuxer);
              -
              107 };
              -
              108 
              -
              109 } // namespace media
              -
              110 } // namespace shaka
              -
              111 
              -
              112 #endif // MEDIA_BASE_DEMUXER_H_
              -
              MediaContainerName container_name()
              Definition: demuxer.h:72
              - - -
              const std::vector< MediaStream * > & streams()
              Definition: demuxer.h:68
              -
              void SetKeySource(std::unique_ptr< KeySource > key_source)
              Definition: demuxer.cc:52
              +
              68  const std::vector<std::unique_ptr<MediaStream>>& streams() {
              +
              69  return streams_;
              +
              70  }
              +
              71 
              +
              74  MediaContainerName container_name() { return container_name_; }
              +
              75 
              +
              76  private:
              +
              77  struct QueuedSample {
              +
              78  QueuedSample(uint32_t track_id, scoped_refptr<MediaSample> sample);
              +
              79  ~QueuedSample();
              +
              80 
              +
              81  uint32_t track_id;
              +
              82  scoped_refptr<MediaSample> sample;
              +
              83  };
              +
              84 
              +
              85  // Parser init event.
              +
              86  void ParserInitEvent(const std::vector<scoped_refptr<StreamInfo> >& streams);
              +
              87  // Parser new sample event handler. Queues the samples if init event has not
              +
              88  // been received, otherwise calls PushSample() to push the sample to
              +
              89  // corresponding stream.
              +
              90  bool NewSampleEvent(uint32_t track_id,
              +
              91  const scoped_refptr<MediaSample>& sample);
              +
              92  // Helper function to push the sample to corresponding stream.
              +
              93  bool PushSample(uint32_t track_id, const scoped_refptr<MediaSample>& sample);
              +
              94 
              +
              95  std::string file_name_;
              +
              96  File* media_file_;
              +
              97  bool init_event_received_;
              +
              98  Status init_parsing_status_;
              +
              99  // Queued samples received in NewSampleEvent() before ParserInitEvent().
              +
              100  std::deque<QueuedSample> queued_samples_;
              +
              101  std::unique_ptr<MediaParser> parser_;
              +
              102  std::vector<std::unique_ptr<MediaStream>> streams_;
              +
              103  MediaContainerName container_name_;
              +
              104  std::unique_ptr<uint8_t[]> buffer_;
              +
              105  std::unique_ptr<KeySource> key_source_;
              +
              106  bool cancelled_;
              +
              107 
              +
              108  DISALLOW_COPY_AND_ASSIGN(Demuxer);
              +
              109 };
              +
              110 
              +
              111 } // namespace media
              +
              112 } // namespace shaka
              +
              113 
              +
              114 #endif // MEDIA_BASE_DEMUXER_H_
              +
              MediaContainerName container_name()
              Definition: demuxer.h:74
              + + +
              void SetKeySource(std::unique_ptr< KeySource > key_source)
              Definition: demuxer.cc:50
              +
              const std::vector< std::unique_ptr< MediaStream > > & streams()
              Definition: demuxer.h:68
              -
              Status Parse()
              Read from the source and send it to the parser.
              Definition: demuxer.cc:207
              -
              Status Initialize()
              Definition: demuxer.cc:56
              -
              Demuxer(const std::string &file_name)
              Definition: demuxer.cc:37
              +
              Status Parse()
              Read from the source and send it to the parser.
              Definition: demuxer.cc:197
              +
              Status Initialize()
              Definition: demuxer.cc:54
              +
              Demuxer(const std::string &file_name)
              Definition: demuxer.cc:36
              diff --git a/docs/de/dc2/classshaka_1_1media_1_1H265Parser.html b/docs/de/dc2/classshaka_1_1media_1_1H265Parser.html index 420a842f75..0fff9d152a 100644 --- a/docs/de/dc2/classshaka_1_1media_1_1H265Parser.html +++ b/docs/de/dc2/classshaka_1_1media_1_1H265Parser.html @@ -139,7 +139,7 @@ Public Member Functions
              Returns
              a pointer to the PPS with the given ID, or NULL if none exists.
              -

              Definition at line 630 of file h265_parser.cc.

              +

              Definition at line 624 of file h265_parser.cc.

              @@ -158,7 +158,7 @@ Public Member Functions
              Returns
              a pointer to the SPS with the given ID, or NULL if none exists.
              -

              Definition at line 634 of file h265_parser.cc.

              +

              Definition at line 628 of file h265_parser.cc.

              @@ -187,7 +187,7 @@ Public Member Functions

              Parses a PPS element. This object is owned and managed by this class. The unique ID of the parsed PPS is stored in |*pps_id| if kOk is returned.

              -

              Definition at line 404 of file h265_parser.cc.

              +

              Definition at line 400 of file h265_parser.cc.

              @@ -216,7 +216,7 @@ Public Member Functions

              Parses a video slice header. If this returns kOk, then |*slice_header| will contain the parsed header; if it returns something else, the contents of |*slice_header| are undefined.

              -

              Definition at line 187 of file h265_parser.cc.

              +

              Definition at line 183 of file h265_parser.cc.

              @@ -245,7 +245,7 @@ Public Member Functions

              Parses a SPS element. This object is owned and managed by this class. The unique ID of the parsed SPS is stored in |*sps_id| if kOk is returned.

              -

              Definition at line 513 of file h265_parser.cc.

              +

              Definition at line 508 of file h265_parser.cc.

              @@ -256,7 +256,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 9abf6ee290..00cabb0dd8 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/dcb/ts__segmenter_8h_source.html b/docs/de/dcb/ts__segmenter_8h_source.html index f99f1dbdd6..039c15b375 100644 --- a/docs/de/dcb/ts__segmenter_8h_source.html +++ b/docs/de/dcb/ts__segmenter_8h_source.html @@ -211,7 +211,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/dcc/mock__mpd__notifier_8cc_source.html b/docs/de/dcc/mock__mpd__notifier_8cc_source.html index 4b87825450..87cf1d352b 100644 --- a/docs/de/dcc/mock__mpd__notifier_8cc_source.html +++ b/docs/de/dcc/mock__mpd__notifier_8cc_source.html @@ -98,7 +98,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/dcf/file__closer_8h_source.html b/docs/de/dcf/file__closer_8h_source.html index 0658843e08..b6aaff4b6d 100644 --- a/docs/de/dcf/file__closer_8h_source.html +++ b/docs/de/dcf/file__closer_8h_source.html @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/dd6/content__protection__element_8h_source.html b/docs/de/dd6/content__protection__element_8h_source.html index c5a9773ef8..37fb879f5d 100644 --- a/docs/de/dd6/content__protection__element_8h_source.html +++ b/docs/de/dd6/content__protection__element_8h_source.html @@ -142,7 +142,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 c4f258851a..9ea95ba2aa 100644 --- a/docs/de/dd6/muxer__listener__test__helper_8cc_source.html +++ b/docs/de/dd6/muxer__listener__test__helper_8cc_source.html @@ -209,7 +209,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 549070ad8a..47f4effe81 100644 --- a/docs/de/ddd/classshaka_1_1media_1_1Muxer-members.html +++ b/docs/de/ddd/classshaka_1_1media_1_1Muxer-members.html @@ -116,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 b9cd3ba9f9..e13c988232 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 @@ -256,7 +256,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 72117d1956..7f1c00a503 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 @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/de0/classshaka_1_1media_1_1DecoderConfigurationRecord.html b/docs/de/de0/classshaka_1_1media_1_1DecoderConfigurationRecord.html index 2207b39404..d16a10375d 100644 --- a/docs/de/de0/classshaka_1_1media_1_1DecoderConfigurationRecord.html +++ b/docs/de/de0/classshaka_1_1media_1_1DecoderConfigurationRecord.html @@ -333,7 +333,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 225204cded..f2bf147ea2 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 @@ -117,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/de/de4/structshaka_1_1media_1_1H264Pps.html b/docs/de/de4/structshaka_1_1media_1_1H264Pps.html index 66c9576582..eee778a396 100644 --- a/docs/de/de4/structshaka_1_1media_1_1H264Pps.html +++ b/docs/de/de4/structshaka_1_1media_1_1H264Pps.html @@ -159,7 +159,7 @@ int second_chroma_qp_index

              Detailed Description

              -

              Definition at line 91 of file h264_parser.h.

              +

              Definition at line 92 of file h264_parser.h.


              The documentation for this struct was generated from the following files:
              • media/codecs/h264_parser.h
              • media/codecs/h264_parser.cc
              • @@ -167,7 +167,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 ad346b9b05..4426fdcd1c 100644 --- a/docs/de/dea/classshaka_1_1media_1_1H26xByteToUnitStreamConverter.html +++ b/docs/de/dea/classshaka_1_1media_1_1H26xByteToUnitStreamConverter.html @@ -216,7 +216,7 @@ static const size_t kUnitS 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 2e0babe9dd..62d1e61101 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 @@ -182,7 +182,7 @@ Additional Inherited Members 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 df1d7df0f9..b0a80f2497 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 @@ -412,7 +412,7 @@ bool is_keyframe () co diff --git a/docs/de/dfa/classshaka_1_1media_1_1webm_1_1Encryptor.html b/docs/de/dfa/classshaka_1_1media_1_1webm_1_1Encryptor.html index 3b058fdcda..27a672cfff 100644 --- a/docs/de/dfa/classshaka_1_1media_1_1webm_1_1Encryptor.html +++ b/docs/de/dfa/classshaka_1_1media_1_1webm_1_1Encryptor.html @@ -215,7 +215,7 @@ Public Member Functions diff --git a/docs/de/dfa/muxer__listener_8h_source.html b/docs/de/dfa/muxer__listener_8h_source.html index 7dbde93dbd..8a16bf3199 100644 --- a/docs/de/dfa/muxer__listener_8h_source.html +++ b/docs/de/dfa/muxer__listener_8h_source.html @@ -173,7 +173,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 0d11d14f6d..0a1e36c967 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 @@ -176,7 +176,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 f1d6c88aac..64326b27ed 100644 --- a/docs/de/dfd/stream__info_8cc_source.html +++ b/docs/de/dfd/stream__info_8cc_source.html @@ -140,7 +140,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 fb284a30f2..6c8fc9ddd0 100644 --- a/docs/df/d05/vp__codec__configuration__record_8cc_source.html +++ b/docs/df/d05/vp__codec__configuration__record_8cc_source.html @@ -360,7 +360,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/d1a/offset__byte__queue_8cc_source.html b/docs/df/d1a/offset__byte__queue_8cc_source.html index fd436445fa..11893093ec 100644 --- a/docs/df/d1a/offset__byte__queue_8cc_source.html +++ b/docs/df/d1a/offset__byte__queue_8cc_source.html @@ -164,7 +164,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 036a5e183c..1236754ef6 100644 --- a/docs/df/d1c/classshaka_1_1media_1_1MediaSample-members.html +++ b/docs/df/d1c/classshaka_1_1media_1_1MediaSample-members.html @@ -123,7 +123,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/d1c/composition__offset__iterator_8h_source.html b/docs/df/d1c/composition__offset__iterator_8h_source.html index a4f4b1cc6a..20c22a9b16 100644 --- a/docs/df/d1c/composition__offset__iterator_8h_source.html +++ b/docs/df/d1c/composition__offset__iterator_8h_source.html @@ -147,7 +147,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 bde5d33957..867e7a057a 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 @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/d22/validate__flag_8h_source.html b/docs/df/d22/validate__flag_8h_source.html index 0f2cc28a85..cf3ca3c182 100644 --- a/docs/df/d22/validate__flag_8h_source.html +++ b/docs/df/d22/validate__flag_8h_source.html @@ -120,7 +120,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 9b208e5652..82834651c7 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 @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/d2d/classshaka_1_1media_1_1AesCbcDecryptor.html b/docs/df/d2d/classshaka_1_1media_1_1AesCbcDecryptor.html index ad7a205dd6..d0b1b30f16 100644 --- a/docs/df/d2d/classshaka_1_1media_1_1AesCbcDecryptor.html +++ b/docs/df/d2d/classshaka_1_1media_1_1AesCbcDecryptor.html @@ -279,7 +279,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 8e5f36a009..631a2809c7 100644 --- a/docs/df/d31/muxer__util_8cc_source.html +++ b/docs/df/d31/muxer__util_8cc_source.html @@ -264,7 +264,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/d32/audio__stream__info_8h_source.html b/docs/df/d32/audio__stream__info_8h_source.html index 838688fb07..1a83fb7c0c 100644 --- a/docs/df/d32/audio__stream__info_8h_source.html +++ b/docs/df/d32/audio__stream__info_8h_source.html @@ -164,7 +164,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/d33/classshaka_1_1AdaptationSet-members.html b/docs/df/d33/classshaka_1_1AdaptationSet-members.html index ea39e2a670..761285620d 100644 --- a/docs/df/d33/classshaka_1_1AdaptationSet-members.html +++ b/docs/df/d33/classshaka_1_1AdaptationSet-members.html @@ -119,7 +119,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 f0adddc7db..51cb6ead8f 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 @@ -115,7 +115,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 da7eccd15e..01f919c3da 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 @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/d3c/classshaka_1_1media_1_1RequestSigner.html b/docs/df/d3c/classshaka_1_1media_1_1RequestSigner.html index e393e8ea2e..3983eee9da 100644 --- a/docs/df/d3c/classshaka_1_1media_1_1RequestSigner.html +++ b/docs/df/d3c/classshaka_1_1media_1_1RequestSigner.html @@ -180,7 +180,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 142334763a..8a6af19ec8 100644 --- a/docs/df/d46/classshaka_1_1media_1_1Muxer.html +++ b/docs/df/d46/classshaka_1_1media_1_1Muxer.html @@ -342,7 +342,7 @@ class MediaStream diff --git a/docs/df/d46/classshaka_1_1media_1_1ThreadedIoFile-members.html b/docs/df/d46/classshaka_1_1media_1_1ThreadedIoFile-members.html index e96993ee33..48089a4f5a 100644 --- a/docs/df/d46/classshaka_1_1media_1_1ThreadedIoFile-members.html +++ b/docs/df/d46/classshaka_1_1media_1_1ThreadedIoFile-members.html @@ -120,7 +120,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/d50/classshaka_1_1media_1_1mp2t_1_1AacProgramMapTableWriter-members.html b/docs/df/d50/classshaka_1_1media_1_1mp2t_1_1AacProgramMapTableWriter-members.html index c40524e08c..5b114a7ddc 100644 --- a/docs/df/d50/classshaka_1_1media_1_1mp2t_1_1AacProgramMapTableWriter-members.html +++ b/docs/df/d50/classshaka_1_1media_1_1mp2t_1_1AacProgramMapTableWriter-members.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 754cc84655..e975f65396 100644 --- a/docs/df/d51/classshaka_1_1media_1_1RsaPrivateKey-members.html +++ b/docs/df/d51/classshaka_1_1media_1_1RsaPrivateKey-members.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/d51/classshaka_1_1media_1_1mp4_1_1EncryptingFragmenter-members.html b/docs/df/d51/classshaka_1_1media_1_1mp4_1_1EncryptingFragmenter-members.html index 8511c27216..c941a9ef39 100644 --- a/docs/df/d51/classshaka_1_1media_1_1mp4_1_1EncryptingFragmenter-members.html +++ b/docs/df/d51/classshaka_1_1media_1_1mp4_1_1EncryptingFragmenter-members.html @@ -122,7 +122,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/d60/classshaka_1_1MockMpdBuilder.html b/docs/df/d60/classshaka_1_1MockMpdBuilder.html index 92942c8b93..e7e192a4e5 100644 --- a/docs/df/d60/classshaka_1_1MockMpdBuilder.html +++ b/docs/df/d60/classshaka_1_1MockMpdBuilder.html @@ -153,7 +153,7 @@ Additional Inherited Members 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 ed48d09d63..861f175329 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 @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/d66/classshaka_1_1media_1_1KeyFetcher.html b/docs/df/d66/classshaka_1_1media_1_1KeyFetcher.html index e55bbf0775..834593a3df 100644 --- a/docs/df/d66/classshaka_1_1media_1_1KeyFetcher.html +++ b/docs/df/d66/classshaka_1_1media_1_1KeyFetcher.html @@ -177,7 +177,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 9b17726f01..7f140935bd 100644 --- a/docs/df/d6a/classshaka_1_1MockMpdBuilder-members.html +++ b/docs/df/d6a/classshaka_1_1MockMpdBuilder-members.html @@ -112,7 +112,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 a63ce6860b..90c063fbcd 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 @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 44b048ad7b..357d730c33 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 @@ -182,7 +182,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 b32a14562b..5ebc002503 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 @@ -198,7 +198,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 fa93634b0e..a64567fd64 100644 --- a/docs/df/d7d/webm__info__parser_8cc_source.html +++ b/docs/df/d7d/webm__info__parser_8cc_source.html @@ -200,7 +200,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 2bb9324ea1..d210c07aca 100644 --- a/docs/df/d82/classshaka_1_1media_1_1DecoderConfigurationRecord-members.html +++ b/docs/df/d82/classshaka_1_1media_1_1DecoderConfigurationRecord-members.html @@ -107,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/d87/classshaka_1_1media_1_1AesCryptor.html b/docs/df/d87/classshaka_1_1media_1_1AesCryptor.html index bed5de5bc3..12c23f15d9 100644 --- a/docs/df/d87/classshaka_1_1media_1_1AesCryptor.html +++ b/docs/df/d87/classshaka_1_1media_1_1AesCryptor.html @@ -192,7 +192,7 @@ AES_KEY * mutable_aes_key< -

                Definition at line 32 of file aes_cryptor.cc.

                +

                Definition at line 31 of file aes_cryptor.cc.

                @@ -285,7 +285,7 @@ AES_KEY * mutable_aes_key<
                Returns
                true on success, false otherwise.
                -

                Definition at line 109 of file aes_cryptor.cc.

                +

                Definition at line 107 of file aes_cryptor.cc.

                @@ -369,7 +369,7 @@ AES_KEY * mutable_aes_key<

                Set IV.

                Returns
                true if successful, false if the input is invalid.
                -

                Definition at line 69 of file aes_cryptor.cc.

                +

                Definition at line 67 of file aes_cryptor.cc.

                @@ -387,7 +387,7 @@ AES_KEY * mutable_aes_key<

                Update IV for next sample. As recommended in ISO/IEC 23001-7: IV need to be updated per sample for CENC. This is used by encryptors only. It is a NOP if using kUseConstantIv.

                -

                Definition at line 80 of file aes_cryptor.cc.

                +

                Definition at line 78 of file aes_cryptor.cc.

                @@ -424,7 +424,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 d293707bb5..8b870ac21a 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 @@ -182,7 +182,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 387529705a..9f39d73da2 100644 --- a/docs/df/d8a/vp9__parser_8h_source.html +++ b/docs/df/d8a/vp9__parser_8h_source.html @@ -136,7 +136,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/d8a/vpx__parser_8h_source.html b/docs/df/d8a/vpx__parser_8h_source.html index beab3d395f..c33746727d 100644 --- a/docs/df/d8a/vpx__parser_8h_source.html +++ b/docs/df/d8a/vpx__parser_8h_source.html @@ -147,7 +147,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 cfc799c37a..cad54912b0 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 @@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/d8d/es__parser__h26x_8h_source.html b/docs/df/d8d/es__parser__h26x_8h_source.html index bce267f259..45d43b4387 100644 --- a/docs/df/d8d/es__parser__h26x_8h_source.html +++ b/docs/df/d8d/es__parser__h26x_8h_source.html @@ -235,7 +235,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/d94/classshaka_1_1RepresentationStateChangeListener.html b/docs/df/d94/classshaka_1_1RepresentationStateChangeListener.html index 1fef701eb4..1a1d56b11a 100644 --- a/docs/df/d94/classshaka_1_1RepresentationStateChangeListener.html +++ b/docs/df/d94/classshaka_1_1RepresentationStateChangeListener.html @@ -103,7 +103,7 @@ Public Member Functions

                Detailed Description

                -

                Definition at line 406 of file mpd_builder.h.

                +

                Definition at line 403 of file mpd_builder.h.

                Member Function Documentation

                @@ -195,7 +195,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 0867868df8..4a66890f1c 100644 --- a/docs/df/d96/xml__node_8cc_source.html +++ b/docs/df/d96/xml__node_8cc_source.html @@ -100,395 +100,394 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
                11 
                12 #include "packager/base/logging.h"
                13 #include "packager/base/macros.h"
                -
                14 #include "packager/base/stl_util.h"
                -
                15 #include "packager/base/strings/string_number_conversions.h"
                -
                16 #include "packager/base/sys_byteorder.h"
                -
                17 #include "packager/mpd/base/media_info.pb.h"
                -
                18 #include "packager/mpd/base/segment_info.h"
                -
                19 
                -
                20 namespace shaka {
                -
                21 
                -
                22 using xml::XmlNode;
                -
                23 typedef MediaInfo::AudioInfo AudioInfo;
                -
                24 typedef MediaInfo::VideoInfo VideoInfo;
                -
                25 
                -
                26 namespace {
                -
                27 const char kEC3Codec[] = "ec-3";
                -
                28 
                -
                29 std::string RangeToString(const Range& range) {
                -
                30  return base::Uint64ToString(range.begin()) + "-" +
                -
                31  base::Uint64ToString(range.end());
                -
                32 }
                -
                33 
                -
                34 bool PopulateSegmentTimeline(const std::list<SegmentInfo>& segment_infos,
                -
                35  XmlNode* segment_timeline) {
                -
                36  for (std::list<SegmentInfo>::const_iterator it = segment_infos.begin();
                -
                37  it != segment_infos.end();
                -
                38  ++it) {
                -
                39  XmlNode s_element("S");
                -
                40  s_element.SetIntegerAttribute("t", it->start_time);
                -
                41  s_element.SetIntegerAttribute("d", it->duration);
                -
                42  if (it->repeat > 0)
                -
                43  s_element.SetIntegerAttribute("r", it->repeat);
                -
                44 
                -
                45  CHECK(segment_timeline->AddChild(s_element.PassScopedPtr()));
                -
                46  }
                -
                47 
                -
                48  return true;
                -
                49 }
                -
                50 
                -
                51 } // namespace
                -
                52 
                -
                53 namespace xml {
                -
                54 
                -
                55 XmlNode::XmlNode(const char* name) : node_(xmlNewNode(NULL, BAD_CAST name)) {
                -
                56  DCHECK(name);
                -
                57  DCHECK(node_);
                -
                58 }
                -
                59 
                -
                60 XmlNode::~XmlNode() {}
                -
                61 
                -
                62 bool XmlNode::AddChild(scoped_xml_ptr<xmlNode> child) {
                -
                63  DCHECK(node_);
                -
                64  DCHECK(child);
                -
                65  if (!xmlAddChild(node_.get(), child.get()))
                -
                66  return false;
                -
                67 
                -
                68  // Reaching here means the ownership of |child| transfered to |node_|.
                -
                69  // Release the pointer so that it doesn't get destructed in this scope.
                -
                70  ignore_result(child.release());
                -
                71  return true;
                -
                72 }
                -
                73 
                -
                74 bool XmlNode::AddElements(const std::vector<Element>& elements) {
                -
                75  for (size_t element_index = 0; element_index < elements.size();
                -
                76  ++element_index) {
                -
                77  const Element& child_element = elements[element_index];
                -
                78  XmlNode child_node(child_element.name.c_str());
                -
                79  for (std::map<std::string, std::string>::const_iterator attribute_it =
                -
                80  child_element.attributes.begin();
                -
                81  attribute_it != child_element.attributes.end(); ++attribute_it) {
                -
                82  child_node.SetStringAttribute(attribute_it->first.c_str(),
                -
                83  attribute_it->second);
                -
                84  }
                -
                85  // Recursively set children for the child.
                -
                86  if (!child_node.AddElements(child_element.subelements))
                -
                87  return false;
                -
                88 
                -
                89  child_node.SetContent(child_element.content);
                -
                90 
                -
                91  if (!xmlAddChild(node_.get(), child_node.GetRawPtr())) {
                -
                92  LOG(ERROR) << "Failed to set child " << child_element.name
                -
                93  << " to parent element "
                -
                94  << reinterpret_cast<const char*>(node_->name);
                -
                95  return false;
                -
                96  }
                -
                97  // Reaching here means the ownership of |child_node| transfered to |node_|.
                -
                98  // Release the pointer so that it doesn't get destructed in this scope.
                -
                99  ignore_result(child_node.Release());
                -
                100  }
                -
                101  return true;
                -
                102 }
                -
                103 
                -
                104 void XmlNode::SetStringAttribute(const char* attribute_name,
                -
                105  const std::string& attribute) {
                -
                106  DCHECK(node_);
                -
                107  DCHECK(attribute_name);
                -
                108  xmlSetProp(node_.get(), BAD_CAST attribute_name, BAD_CAST attribute.c_str());
                -
                109 }
                -
                110 
                -
                111 void XmlNode::SetIntegerAttribute(const char* attribute_name, uint64_t number) {
                -
                112  DCHECK(node_);
                -
                113  DCHECK(attribute_name);
                -
                114  xmlSetProp(node_.get(),
                -
                115  BAD_CAST attribute_name,
                -
                116  BAD_CAST (base::Uint64ToString(number).c_str()));
                -
                117 }
                -
                118 
                -
                119 void XmlNode::SetFloatingPointAttribute(const char* attribute_name,
                -
                120  double number) {
                -
                121  DCHECK(node_);
                -
                122  DCHECK(attribute_name);
                -
                123  xmlSetProp(node_.get(),
                -
                124  BAD_CAST attribute_name,
                -
                125  BAD_CAST (base::DoubleToString(number).c_str()));
                -
                126 }
                -
                127 
                -
                128 void XmlNode::SetId(uint32_t id) {
                -
                129  SetIntegerAttribute("id", id);
                -
                130 }
                -
                131 
                -
                132 void XmlNode::SetContent(const std::string& content) {
                -
                133  DCHECK(node_);
                -
                134  xmlNodeSetContent(node_.get(), BAD_CAST content.c_str());
                -
                135 }
                -
                136 
                -
                137 scoped_xml_ptr<xmlNode> XmlNode::PassScopedPtr() {
                -
                138  DVLOG(2) << "Passing node_.";
                -
                139  DCHECK(node_);
                -
                140  return std::move(node_);
                -
                141 }
                -
                142 
                -
                143 xmlNodePtr XmlNode::Release() {
                -
                144  DVLOG(2) << "Releasing node_.";
                -
                145  DCHECK(node_);
                -
                146  return node_.release();
                -
                147 }
                -
                148 
                -
                149 xmlNodePtr XmlNode::GetRawPtr() {
                -
                150  return node_.get();
                -
                151 }
                -
                152 
                -
                153 RepresentationBaseXmlNode::RepresentationBaseXmlNode(const char* name)
                -
                154  : XmlNode(name) {}
                -
                155 RepresentationBaseXmlNode::~RepresentationBaseXmlNode() {}
                -
                156 
                -
                157 bool RepresentationBaseXmlNode::AddContentProtectionElements(
                -
                158  const std::list<ContentProtectionElement>& content_protection_elements) {
                -
                159  std::list<ContentProtectionElement>::const_iterator content_protection_it =
                -
                160  content_protection_elements.begin();
                -
                161  for (; content_protection_it != content_protection_elements.end();
                -
                162  ++content_protection_it) {
                -
                163  if (!AddContentProtectionElement(*content_protection_it))
                -
                164  return false;
                -
                165  }
                -
                166 
                -
                167  return true;
                -
                168 }
                -
                169 
                -
                170 bool RepresentationBaseXmlNode::AddContentProtectionElement(
                -
                171  const ContentProtectionElement& content_protection_element) {
                -
                172  XmlNode content_protection_node("ContentProtection");
                -
                173 
                -
                174  // @value is an optional attribute.
                -
                175  if (!content_protection_element.value.empty()) {
                -
                176  content_protection_node.SetStringAttribute(
                -
                177  "value", content_protection_element.value);
                -
                178  }
                -
                179  content_protection_node.SetStringAttribute(
                -
                180  "schemeIdUri", content_protection_element.scheme_id_uri);
                -
                181 
                -
                182  typedef std::map<std::string, std::string> AttributesMapType;
                -
                183  const AttributesMapType& additional_attributes =
                -
                184  content_protection_element.additional_attributes;
                -
                185 
                -
                186  AttributesMapType::const_iterator attributes_it =
                -
                187  additional_attributes.begin();
                -
                188  for (; attributes_it != additional_attributes.end(); ++attributes_it) {
                -
                189  content_protection_node.SetStringAttribute(attributes_it->first.c_str(),
                -
                190  attributes_it->second);
                -
                191  }
                -
                192 
                -
                193  if (!content_protection_node.AddElements(
                -
                194  content_protection_element.subelements)) {
                -
                195  return false;
                -
                196  }
                -
                197  return AddChild(content_protection_node.PassScopedPtr());
                -
                198 }
                -
                199 
                -
                200 AdaptationSetXmlNode::AdaptationSetXmlNode()
                -
                201  : RepresentationBaseXmlNode("AdaptationSet") {}
                -
                202 AdaptationSetXmlNode::~AdaptationSetXmlNode() {}
                -
                203 
                -
                204 void AdaptationSetXmlNode::AddRoleElement(const std::string& scheme_id_uri,
                -
                205  const std::string& value) {
                -
                206  XmlNode role("Role");
                -
                207  role.SetStringAttribute("schemeIdUri", scheme_id_uri);
                -
                208  role.SetStringAttribute("value", value);
                -
                209  AddChild(role.PassScopedPtr());
                -
                210 }
                -
                211 
                -
                212 RepresentationXmlNode::RepresentationXmlNode()
                -
                213  : RepresentationBaseXmlNode("Representation") {}
                -
                214 RepresentationXmlNode::~RepresentationXmlNode() {}
                -
                215 
                -
                216 bool RepresentationXmlNode::AddVideoInfo(const VideoInfo& video_info,
                -
                217  bool set_width,
                -
                218  bool set_height,
                -
                219  bool set_frame_rate) {
                -
                220  if (!video_info.has_width() || !video_info.has_height()) {
                -
                221  LOG(ERROR) << "Missing width or height for adding a video info.";
                -
                222  return false;
                -
                223  }
                -
                224 
                -
                225  if (video_info.has_pixel_width() && video_info.has_pixel_height()) {
                -
                226  SetStringAttribute("sar", base::IntToString(video_info.pixel_width()) +
                -
                227  ":" +
                -
                228  base::IntToString(video_info.pixel_height()));
                -
                229  }
                -
                230 
                -
                231  if (set_width)
                -
                232  SetIntegerAttribute("width", video_info.width());
                -
                233  if (set_height)
                -
                234  SetIntegerAttribute("height", video_info.height());
                -
                235  if (set_frame_rate) {
                -
                236  SetStringAttribute("frameRate",
                -
                237  base::IntToString(video_info.time_scale()) + "/" +
                -
                238  base::IntToString(video_info.frame_duration()));
                -
                239  }
                -
                240  return true;
                -
                241 }
                -
                242 
                -
                243 bool RepresentationXmlNode::AddAudioInfo(const AudioInfo& audio_info) {
                -
                244  if (!AddAudioChannelInfo(audio_info))
                -
                245  return false;
                -
                246 
                -
                247  AddAudioSamplingRateInfo(audio_info);
                -
                248  return true;
                -
                249 }
                -
                250 
                -
                251 bool RepresentationXmlNode::AddVODOnlyInfo(const MediaInfo& media_info) {
                -
                252  if (media_info.has_media_file_name()) {
                -
                253  XmlNode base_url("BaseURL");
                -
                254  base_url.SetContent(media_info.media_file_name());
                -
                255 
                -
                256  if (!AddChild(base_url.PassScopedPtr()))
                -
                257  return false;
                -
                258  }
                -
                259 
                -
                260  const bool need_segment_base = media_info.has_index_range() ||
                -
                261  media_info.has_init_range() ||
                -
                262  media_info.has_reference_time_scale();
                -
                263 
                -
                264  if (need_segment_base) {
                -
                265  XmlNode segment_base("SegmentBase");
                -
                266  if (media_info.has_index_range()) {
                -
                267  segment_base.SetStringAttribute("indexRange",
                -
                268  RangeToString(media_info.index_range()));
                -
                269  }
                -
                270 
                -
                271  if (media_info.has_reference_time_scale()) {
                -
                272  segment_base.SetIntegerAttribute("timescale",
                -
                273  media_info.reference_time_scale());
                -
                274  }
                -
                275 
                -
                276  if (media_info.has_init_range()) {
                -
                277  XmlNode initialization("Initialization");
                -
                278  initialization.SetStringAttribute("range",
                -
                279  RangeToString(media_info.init_range()));
                -
                280 
                -
                281  if (!segment_base.AddChild(initialization.PassScopedPtr()))
                -
                282  return false;
                -
                283  }
                -
                284 
                -
                285  if (!AddChild(segment_base.PassScopedPtr()))
                -
                286  return false;
                -
                287  }
                -
                288 
                -
                289  if (media_info.has_media_duration_seconds()) {
                -
                290  // Adding 'duration' attribute, so that this information can be used when
                -
                291  // generating one MPD file. This should be removed from the final MPD.
                -
                292  SetFloatingPointAttribute("duration", media_info.media_duration_seconds());
                -
                293  }
                -
                294 
                -
                295  return true;
                -
                296 }
                -
                297 
                - -
                299  const MediaInfo& media_info,
                -
                300  const std::list<SegmentInfo>& segment_infos,
                -
                301  uint32_t start_number) {
                -
                302  XmlNode segment_template("SegmentTemplate");
                -
                303  if (media_info.has_reference_time_scale()) {
                -
                304  segment_template.SetIntegerAttribute("timescale",
                -
                305  media_info.reference_time_scale());
                -
                306  }
                -
                307 
                -
                308  if (media_info.has_init_segment_name()) {
                -
                309  // The spec does not allow '$Number$' and '$Time$' in initialization
                -
                310  // attribute.
                -
                311  // TODO(rkuroiwa, kqyang): Swap this check out with a better check. These
                -
                312  // templates allow formatting as well.
                -
                313  const std::string& init_segment_name = media_info.init_segment_name();
                -
                314  if (init_segment_name.find("$Number$") != std::string::npos ||
                -
                315  init_segment_name.find("$Time$") != std::string::npos) {
                -
                316  LOG(ERROR) << "$Number$ and $Time$ cannot be used for "
                -
                317  "SegmentTemplate@initialization";
                -
                318  return false;
                -
                319  }
                -
                320  segment_template.SetStringAttribute("initialization",
                -
                321  media_info.init_segment_name());
                -
                322  }
                -
                323 
                -
                324  if (media_info.has_segment_template()) {
                -
                325  segment_template.SetStringAttribute("media", media_info.segment_template());
                -
                326 
                -
                327  // TODO(rkuroiwa): Need a better check. $$Number is legitimate but not a
                -
                328  // template.
                -
                329  if (media_info.segment_template().find("$Number") != std::string::npos) {
                -
                330  DCHECK_GE(start_number, 1u);
                -
                331  segment_template.SetIntegerAttribute("startNumber", start_number);
                -
                332  }
                -
                333  }
                -
                334 
                -
                335  // TODO(rkuroiwa): Find out when a live MPD doesn't require SegmentTimeline.
                -
                336  XmlNode segment_timeline("SegmentTimeline");
                -
                337 
                -
                338  return PopulateSegmentTimeline(segment_infos, &segment_timeline) &&
                -
                339  segment_template.AddChild(segment_timeline.PassScopedPtr()) &&
                -
                340  AddChild(segment_template.PassScopedPtr());
                -
                341 }
                -
                342 
                -
                343 bool RepresentationXmlNode::AddAudioChannelInfo(const AudioInfo& audio_info) {
                -
                344  std::string audio_channel_config_scheme;
                -
                345  std::string audio_channel_config_value;
                -
                346 
                -
                347  if (audio_info.codec() == kEC3Codec) {
                -
                348  // Convert EC3 channel map into string of hexadecimal digits. Spec: DASH-IF
                -
                349  // Interoperability Points v3.0 9.2.1.2.
                -
                350  const uint16_t ec3_channel_map =
                -
                351  base::HostToNet16(audio_info.codec_specific_data().ec3_channel_map());
                -
                352  audio_channel_config_value =
                -
                353  base::HexEncode(&ec3_channel_map, sizeof(ec3_channel_map));
                -
                354  audio_channel_config_scheme =
                -
                355  "tag:dolby.com,2014:dash:audio_channel_configuration:2011";
                -
                356  } else {
                -
                357  audio_channel_config_value = base::UintToString(audio_info.num_channels());
                -
                358  audio_channel_config_scheme =
                -
                359  "urn:mpeg:dash:23003:3:audio_channel_configuration:2011";
                -
                360  }
                -
                361 
                -
                362  XmlNode audio_channel_config("AudioChannelConfiguration");
                -
                363  audio_channel_config.SetStringAttribute("schemeIdUri",
                -
                364  audio_channel_config_scheme);
                -
                365  audio_channel_config.SetStringAttribute("value", audio_channel_config_value);
                -
                366 
                -
                367  return AddChild(audio_channel_config.PassScopedPtr());
                -
                368 }
                -
                369 
                -
                370 // MPD expects one number for sampling frequency, or if it is a range it should
                -
                371 // be space separated.
                -
                372 void RepresentationXmlNode::AddAudioSamplingRateInfo(
                -
                373  const AudioInfo& audio_info) {
                -
                374  if (audio_info.has_sampling_frequency())
                -
                375  SetIntegerAttribute("audioSamplingRate", audio_info.sampling_frequency());
                -
                376 }
                -
                377 
                -
                378 } // namespace xml
                -
                379 } // namespace shaka
                -
                bool AddVideoInfo(const MediaInfo::VideoInfo &video_info, bool set_width, bool set_height, bool set_frame_rate)
                Definition: xml_node.cc:216
                +
                14 #include "packager/base/strings/string_number_conversions.h"
                +
                15 #include "packager/base/sys_byteorder.h"
                +
                16 #include "packager/mpd/base/media_info.pb.h"
                +
                17 #include "packager/mpd/base/segment_info.h"
                +
                18 
                +
                19 namespace shaka {
                +
                20 
                +
                21 using xml::XmlNode;
                +
                22 typedef MediaInfo::AudioInfo AudioInfo;
                +
                23 typedef MediaInfo::VideoInfo VideoInfo;
                +
                24 
                +
                25 namespace {
                +
                26 const char kEC3Codec[] = "ec-3";
                +
                27 
                +
                28 std::string RangeToString(const Range& range) {
                +
                29  return base::Uint64ToString(range.begin()) + "-" +
                +
                30  base::Uint64ToString(range.end());
                +
                31 }
                +
                32 
                +
                33 bool PopulateSegmentTimeline(const std::list<SegmentInfo>& segment_infos,
                +
                34  XmlNode* segment_timeline) {
                +
                35  for (std::list<SegmentInfo>::const_iterator it = segment_infos.begin();
                +
                36  it != segment_infos.end();
                +
                37  ++it) {
                +
                38  XmlNode s_element("S");
                +
                39  s_element.SetIntegerAttribute("t", it->start_time);
                +
                40  s_element.SetIntegerAttribute("d", it->duration);
                +
                41  if (it->repeat > 0)
                +
                42  s_element.SetIntegerAttribute("r", it->repeat);
                +
                43 
                +
                44  CHECK(segment_timeline->AddChild(s_element.PassScopedPtr()));
                +
                45  }
                +
                46 
                +
                47  return true;
                +
                48 }
                +
                49 
                +
                50 } // namespace
                +
                51 
                +
                52 namespace xml {
                +
                53 
                +
                54 XmlNode::XmlNode(const char* name) : node_(xmlNewNode(NULL, BAD_CAST name)) {
                +
                55  DCHECK(name);
                +
                56  DCHECK(node_);
                +
                57 }
                +
                58 
                +
                59 XmlNode::~XmlNode() {}
                +
                60 
                +
                61 bool XmlNode::AddChild(scoped_xml_ptr<xmlNode> child) {
                +
                62  DCHECK(node_);
                +
                63  DCHECK(child);
                +
                64  if (!xmlAddChild(node_.get(), child.get()))
                +
                65  return false;
                +
                66 
                +
                67  // Reaching here means the ownership of |child| transfered to |node_|.
                +
                68  // Release the pointer so that it doesn't get destructed in this scope.
                +
                69  ignore_result(child.release());
                +
                70  return true;
                +
                71 }
                +
                72 
                +
                73 bool XmlNode::AddElements(const std::vector<Element>& elements) {
                +
                74  for (size_t element_index = 0; element_index < elements.size();
                +
                75  ++element_index) {
                +
                76  const Element& child_element = elements[element_index];
                +
                77  XmlNode child_node(child_element.name.c_str());
                +
                78  for (std::map<std::string, std::string>::const_iterator attribute_it =
                +
                79  child_element.attributes.begin();
                +
                80  attribute_it != child_element.attributes.end(); ++attribute_it) {
                +
                81  child_node.SetStringAttribute(attribute_it->first.c_str(),
                +
                82  attribute_it->second);
                +
                83  }
                +
                84  // Recursively set children for the child.
                +
                85  if (!child_node.AddElements(child_element.subelements))
                +
                86  return false;
                +
                87 
                +
                88  child_node.SetContent(child_element.content);
                +
                89 
                +
                90  if (!xmlAddChild(node_.get(), child_node.GetRawPtr())) {
                +
                91  LOG(ERROR) << "Failed to set child " << child_element.name
                +
                92  << " to parent element "
                +
                93  << reinterpret_cast<const char*>(node_->name);
                +
                94  return false;
                +
                95  }
                +
                96  // Reaching here means the ownership of |child_node| transfered to |node_|.
                +
                97  // Release the pointer so that it doesn't get destructed in this scope.
                +
                98  ignore_result(child_node.Release());
                +
                99  }
                +
                100  return true;
                +
                101 }
                +
                102 
                +
                103 void XmlNode::SetStringAttribute(const char* attribute_name,
                +
                104  const std::string& attribute) {
                +
                105  DCHECK(node_);
                +
                106  DCHECK(attribute_name);
                +
                107  xmlSetProp(node_.get(), BAD_CAST attribute_name, BAD_CAST attribute.c_str());
                +
                108 }
                +
                109 
                +
                110 void XmlNode::SetIntegerAttribute(const char* attribute_name, uint64_t number) {
                +
                111  DCHECK(node_);
                +
                112  DCHECK(attribute_name);
                +
                113  xmlSetProp(node_.get(),
                +
                114  BAD_CAST attribute_name,
                +
                115  BAD_CAST (base::Uint64ToString(number).c_str()));
                +
                116 }
                +
                117 
                +
                118 void XmlNode::SetFloatingPointAttribute(const char* attribute_name,
                +
                119  double number) {
                +
                120  DCHECK(node_);
                +
                121  DCHECK(attribute_name);
                +
                122  xmlSetProp(node_.get(),
                +
                123  BAD_CAST attribute_name,
                +
                124  BAD_CAST (base::DoubleToString(number).c_str()));
                +
                125 }
                +
                126 
                +
                127 void XmlNode::SetId(uint32_t id) {
                +
                128  SetIntegerAttribute("id", id);
                +
                129 }
                +
                130 
                +
                131 void XmlNode::SetContent(const std::string& content) {
                +
                132  DCHECK(node_);
                +
                133  xmlNodeSetContent(node_.get(), BAD_CAST content.c_str());
                +
                134 }
                +
                135 
                +
                136 scoped_xml_ptr<xmlNode> XmlNode::PassScopedPtr() {
                +
                137  DVLOG(2) << "Passing node_.";
                +
                138  DCHECK(node_);
                +
                139  return std::move(node_);
                +
                140 }
                +
                141 
                +
                142 xmlNodePtr XmlNode::Release() {
                +
                143  DVLOG(2) << "Releasing node_.";
                +
                144  DCHECK(node_);
                +
                145  return node_.release();
                +
                146 }
                +
                147 
                +
                148 xmlNodePtr XmlNode::GetRawPtr() {
                +
                149  return node_.get();
                +
                150 }
                +
                151 
                +
                152 RepresentationBaseXmlNode::RepresentationBaseXmlNode(const char* name)
                +
                153  : XmlNode(name) {}
                +
                154 RepresentationBaseXmlNode::~RepresentationBaseXmlNode() {}
                +
                155 
                +
                156 bool RepresentationBaseXmlNode::AddContentProtectionElements(
                +
                157  const std::list<ContentProtectionElement>& content_protection_elements) {
                +
                158  std::list<ContentProtectionElement>::const_iterator content_protection_it =
                +
                159  content_protection_elements.begin();
                +
                160  for (; content_protection_it != content_protection_elements.end();
                +
                161  ++content_protection_it) {
                +
                162  if (!AddContentProtectionElement(*content_protection_it))
                +
                163  return false;
                +
                164  }
                +
                165 
                +
                166  return true;
                +
                167 }
                +
                168 
                +
                169 bool RepresentationBaseXmlNode::AddContentProtectionElement(
                +
                170  const ContentProtectionElement& content_protection_element) {
                +
                171  XmlNode content_protection_node("ContentProtection");
                +
                172 
                +
                173  // @value is an optional attribute.
                +
                174  if (!content_protection_element.value.empty()) {
                +
                175  content_protection_node.SetStringAttribute(
                +
                176  "value", content_protection_element.value);
                +
                177  }
                +
                178  content_protection_node.SetStringAttribute(
                +
                179  "schemeIdUri", content_protection_element.scheme_id_uri);
                +
                180 
                +
                181  typedef std::map<std::string, std::string> AttributesMapType;
                +
                182  const AttributesMapType& additional_attributes =
                +
                183  content_protection_element.additional_attributes;
                +
                184 
                +
                185  AttributesMapType::const_iterator attributes_it =
                +
                186  additional_attributes.begin();
                +
                187  for (; attributes_it != additional_attributes.end(); ++attributes_it) {
                +
                188  content_protection_node.SetStringAttribute(attributes_it->first.c_str(),
                +
                189  attributes_it->second);
                +
                190  }
                +
                191 
                +
                192  if (!content_protection_node.AddElements(
                +
                193  content_protection_element.subelements)) {
                +
                194  return false;
                +
                195  }
                +
                196  return AddChild(content_protection_node.PassScopedPtr());
                +
                197 }
                +
                198 
                +
                199 AdaptationSetXmlNode::AdaptationSetXmlNode()
                +
                200  : RepresentationBaseXmlNode("AdaptationSet") {}
                +
                201 AdaptationSetXmlNode::~AdaptationSetXmlNode() {}
                +
                202 
                +
                203 void AdaptationSetXmlNode::AddRoleElement(const std::string& scheme_id_uri,
                +
                204  const std::string& value) {
                +
                205  XmlNode role("Role");
                +
                206  role.SetStringAttribute("schemeIdUri", scheme_id_uri);
                +
                207  role.SetStringAttribute("value", value);
                +
                208  AddChild(role.PassScopedPtr());
                +
                209 }
                +
                210 
                +
                211 RepresentationXmlNode::RepresentationXmlNode()
                +
                212  : RepresentationBaseXmlNode("Representation") {}
                +
                213 RepresentationXmlNode::~RepresentationXmlNode() {}
                +
                214 
                +
                215 bool RepresentationXmlNode::AddVideoInfo(const VideoInfo& video_info,
                +
                216  bool set_width,
                +
                217  bool set_height,
                +
                218  bool set_frame_rate) {
                +
                219  if (!video_info.has_width() || !video_info.has_height()) {
                +
                220  LOG(ERROR) << "Missing width or height for adding a video info.";
                +
                221  return false;
                +
                222  }
                +
                223 
                +
                224  if (video_info.has_pixel_width() && video_info.has_pixel_height()) {
                +
                225  SetStringAttribute("sar", base::IntToString(video_info.pixel_width()) +
                +
                226  ":" +
                +
                227  base::IntToString(video_info.pixel_height()));
                +
                228  }
                +
                229 
                +
                230  if (set_width)
                +
                231  SetIntegerAttribute("width", video_info.width());
                +
                232  if (set_height)
                +
                233  SetIntegerAttribute("height", video_info.height());
                +
                234  if (set_frame_rate) {
                +
                235  SetStringAttribute("frameRate",
                +
                236  base::IntToString(video_info.time_scale()) + "/" +
                +
                237  base::IntToString(video_info.frame_duration()));
                +
                238  }
                +
                239  return true;
                +
                240 }
                +
                241 
                +
                242 bool RepresentationXmlNode::AddAudioInfo(const AudioInfo& audio_info) {
                +
                243  if (!AddAudioChannelInfo(audio_info))
                +
                244  return false;
                +
                245 
                +
                246  AddAudioSamplingRateInfo(audio_info);
                +
                247  return true;
                +
                248 }
                +
                249 
                +
                250 bool RepresentationXmlNode::AddVODOnlyInfo(const MediaInfo& media_info) {
                +
                251  if (media_info.has_media_file_name()) {
                +
                252  XmlNode base_url("BaseURL");
                +
                253  base_url.SetContent(media_info.media_file_name());
                +
                254 
                +
                255  if (!AddChild(base_url.PassScopedPtr()))
                +
                256  return false;
                +
                257  }
                +
                258 
                +
                259  const bool need_segment_base = media_info.has_index_range() ||
                +
                260  media_info.has_init_range() ||
                +
                261  media_info.has_reference_time_scale();
                +
                262 
                +
                263  if (need_segment_base) {
                +
                264  XmlNode segment_base("SegmentBase");
                +
                265  if (media_info.has_index_range()) {
                +
                266  segment_base.SetStringAttribute("indexRange",
                +
                267  RangeToString(media_info.index_range()));
                +
                268  }
                +
                269 
                +
                270  if (media_info.has_reference_time_scale()) {
                +
                271  segment_base.SetIntegerAttribute("timescale",
                +
                272  media_info.reference_time_scale());
                +
                273  }
                +
                274 
                +
                275  if (media_info.has_init_range()) {
                +
                276  XmlNode initialization("Initialization");
                +
                277  initialization.SetStringAttribute("range",
                +
                278  RangeToString(media_info.init_range()));
                +
                279 
                +
                280  if (!segment_base.AddChild(initialization.PassScopedPtr()))
                +
                281  return false;
                +
                282  }
                +
                283 
                +
                284  if (!AddChild(segment_base.PassScopedPtr()))
                +
                285  return false;
                +
                286  }
                +
                287 
                +
                288  if (media_info.has_media_duration_seconds()) {
                +
                289  // Adding 'duration' attribute, so that this information can be used when
                +
                290  // generating one MPD file. This should be removed from the final MPD.
                +
                291  SetFloatingPointAttribute("duration", media_info.media_duration_seconds());
                +
                292  }
                +
                293 
                +
                294  return true;
                +
                295 }
                +
                296 
                + +
                298  const MediaInfo& media_info,
                +
                299  const std::list<SegmentInfo>& segment_infos,
                +
                300  uint32_t start_number) {
                +
                301  XmlNode segment_template("SegmentTemplate");
                +
                302  if (media_info.has_reference_time_scale()) {
                +
                303  segment_template.SetIntegerAttribute("timescale",
                +
                304  media_info.reference_time_scale());
                +
                305  }
                +
                306 
                +
                307  if (media_info.has_init_segment_name()) {
                +
                308  // The spec does not allow '$Number$' and '$Time$' in initialization
                +
                309  // attribute.
                +
                310  // TODO(rkuroiwa, kqyang): Swap this check out with a better check. These
                +
                311  // templates allow formatting as well.
                +
                312  const std::string& init_segment_name = media_info.init_segment_name();
                +
                313  if (init_segment_name.find("$Number$") != std::string::npos ||
                +
                314  init_segment_name.find("$Time$") != std::string::npos) {
                +
                315  LOG(ERROR) << "$Number$ and $Time$ cannot be used for "
                +
                316  "SegmentTemplate@initialization";
                +
                317  return false;
                +
                318  }
                +
                319  segment_template.SetStringAttribute("initialization",
                +
                320  media_info.init_segment_name());
                +
                321  }
                +
                322 
                +
                323  if (media_info.has_segment_template()) {
                +
                324  segment_template.SetStringAttribute("media", media_info.segment_template());
                +
                325 
                +
                326  // TODO(rkuroiwa): Need a better check. $$Number is legitimate but not a
                +
                327  // template.
                +
                328  if (media_info.segment_template().find("$Number") != std::string::npos) {
                +
                329  DCHECK_GE(start_number, 1u);
                +
                330  segment_template.SetIntegerAttribute("startNumber", start_number);
                +
                331  }
                +
                332  }
                +
                333 
                +
                334  // TODO(rkuroiwa): Find out when a live MPD doesn't require SegmentTimeline.
                +
                335  XmlNode segment_timeline("SegmentTimeline");
                +
                336 
                +
                337  return PopulateSegmentTimeline(segment_infos, &segment_timeline) &&
                +
                338  segment_template.AddChild(segment_timeline.PassScopedPtr()) &&
                +
                339  AddChild(segment_template.PassScopedPtr());
                +
                340 }
                +
                341 
                +
                342 bool RepresentationXmlNode::AddAudioChannelInfo(const AudioInfo& audio_info) {
                +
                343  std::string audio_channel_config_scheme;
                +
                344  std::string audio_channel_config_value;
                +
                345 
                +
                346  if (audio_info.codec() == kEC3Codec) {
                +
                347  // Convert EC3 channel map into string of hexadecimal digits. Spec: DASH-IF
                +
                348  // Interoperability Points v3.0 9.2.1.2.
                +
                349  const uint16_t ec3_channel_map =
                +
                350  base::HostToNet16(audio_info.codec_specific_data().ec3_channel_map());
                +
                351  audio_channel_config_value =
                +
                352  base::HexEncode(&ec3_channel_map, sizeof(ec3_channel_map));
                +
                353  audio_channel_config_scheme =
                +
                354  "tag:dolby.com,2014:dash:audio_channel_configuration:2011";
                +
                355  } else {
                +
                356  audio_channel_config_value = base::UintToString(audio_info.num_channels());
                +
                357  audio_channel_config_scheme =
                +
                358  "urn:mpeg:dash:23003:3:audio_channel_configuration:2011";
                +
                359  }
                +
                360 
                +
                361  XmlNode audio_channel_config("AudioChannelConfiguration");
                +
                362  audio_channel_config.SetStringAttribute("schemeIdUri",
                +
                363  audio_channel_config_scheme);
                +
                364  audio_channel_config.SetStringAttribute("value", audio_channel_config_value);
                +
                365 
                +
                366  return AddChild(audio_channel_config.PassScopedPtr());
                +
                367 }
                +
                368 
                +
                369 // MPD expects one number for sampling frequency, or if it is a range it should
                +
                370 // be space separated.
                +
                371 void RepresentationXmlNode::AddAudioSamplingRateInfo(
                +
                372  const AudioInfo& audio_info) {
                +
                373  if (audio_info.has_sampling_frequency())
                +
                374  SetIntegerAttribute("audioSamplingRate", audio_info.sampling_frequency());
                +
                375 }
                +
                376 
                +
                377 } // namespace xml
                +
                378 } // namespace shaka
                +
                bool AddVideoInfo(const MediaInfo::VideoInfo &video_info, bool set_width, bool set_height, bool set_frame_rate)
                Definition: xml_node.cc:215
                -
                void SetFloatingPointAttribute(const char *attribute_name, double number)
                Definition: xml_node.cc:119
                +
                void SetFloatingPointAttribute(const char *attribute_name, double number)
                Definition: xml_node.cc:118
                -
                scoped_xml_ptr< xmlNode > PassScopedPtr()
                Definition: xml_node.cc:137
                -
                XmlNode(const char *name)
                Definition: xml_node.cc:55
                -
                bool AddVODOnlyInfo(const MediaInfo &media_info)
                Definition: xml_node.cc:251
                -
                void SetStringAttribute(const char *attribute_name, const std::string &attribute)
                Definition: xml_node.cc:104
                -
                bool AddChild(scoped_xml_ptr< xmlNode > child)
                Definition: xml_node.cc:62
                -
                xmlNodePtr Release()
                Definition: xml_node.cc:143
                -
                bool AddLiveOnlyInfo(const MediaInfo &media_info, const std::list< SegmentInfo > &segment_infos, uint32_t start_number)
                Definition: xml_node.cc:298
                -
                void SetId(uint32_t id)
                Definition: xml_node.cc:128
                -
                bool AddElements(const std::vector< Element > &elements)
                Adds Elements to this node using the Element struct.
                Definition: xml_node.cc:74
                -
                void SetIntegerAttribute(const char *attribute_name, uint64_t number)
                Definition: xml_node.cc:111
                -
                void AddRoleElement(const std::string &scheme_id_uri, const std::string &value)
                Definition: xml_node.cc:204
                -
                void SetContent(const std::string &content)
                Definition: xml_node.cc:132
                -
                bool AddAudioInfo(const MediaInfo::AudioInfo &audio_info)
                Definition: xml_node.cc:243
                -
                xmlNodePtr GetRawPtr()
                Definition: xml_node.cc:149
                +
                scoped_xml_ptr< xmlNode > PassScopedPtr()
                Definition: xml_node.cc:136
                +
                XmlNode(const char *name)
                Definition: xml_node.cc:54
                +
                bool AddVODOnlyInfo(const MediaInfo &media_info)
                Definition: xml_node.cc:250
                +
                void SetStringAttribute(const char *attribute_name, const std::string &attribute)
                Definition: xml_node.cc:103
                +
                bool AddChild(scoped_xml_ptr< xmlNode > child)
                Definition: xml_node.cc:61
                +
                xmlNodePtr Release()
                Definition: xml_node.cc:142
                +
                bool AddLiveOnlyInfo(const MediaInfo &media_info, const std::list< SegmentInfo > &segment_infos, uint32_t start_number)
                Definition: xml_node.cc:297
                +
                void SetId(uint32_t id)
                Definition: xml_node.cc:127
                +
                bool AddElements(const std::vector< Element > &elements)
                Adds Elements to this node using the Element struct.
                Definition: xml_node.cc:73
                +
                void SetIntegerAttribute(const char *attribute_name, uint64_t number)
                Definition: xml_node.cc:110
                +
                void AddRoleElement(const std::string &scheme_id_uri, const std::string &value)
                Definition: xml_node.cc:203
                +
                void SetContent(const std::string &content)
                Definition: xml_node.cc:131
                +
                bool AddAudioInfo(const MediaInfo::AudioInfo &audio_info)
                Definition: xml_node.cc:242
                +
                xmlNodePtr GetRawPtr()
                Definition: xml_node.cc:148
                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 262b2d17eb..a0b41f1d56 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 @@ -182,7 +182,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 f1f295ac49..b5c8a9e7bf 100644 --- a/docs/df/d9e/classshaka_1_1xml_1_1RepresentationXmlNode.html +++ b/docs/df/d9e/classshaka_1_1xml_1_1RepresentationXmlNode.html @@ -183,7 +183,7 @@ Additional Inherited Members
                Returns
                true if successfully set attributes and children elements (if applicable), false otherwise.
                -

                Definition at line 243 of file xml_node.cc.

                +

                Definition at line 242 of file xml_node.cc.

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

                Definition at line 298 of file xml_node.cc.

                +

                Definition at line 297 of file xml_node.cc.

                @@ -274,7 +274,7 @@ Additional Inherited Members
                Returns
                true if successfully set attributes and children elements (if applicable), false otherwise.
                -

                Definition at line 216 of file xml_node.cc.

                +

                Definition at line 215 of file xml_node.cc.

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

                Definition at line 251 of file xml_node.cc.

                +

                Definition at line 250 of file xml_node.cc.

                @@ -311,7 +311,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 12d82576ca..3d1d923fed 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 @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 995e830fbf..70bb383a60 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 @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/dad/decrypt__config_8h_source.html b/docs/df/dad/decrypt__config_8h_source.html index 9692948ec3..f8b02b2eb7 100644 --- a/docs/df/dad/decrypt__config_8h_source.html +++ b/docs/df/dad/decrypt__config_8h_source.html @@ -168,7 +168,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/db8/structshaka_1_1media_1_1StreamDescriptor-members.html b/docs/df/db8/structshaka_1_1media_1_1StreamDescriptor-members.html index bb5876ba65..7b498b32c4 100644 --- a/docs/df/db8/structshaka_1_1media_1_1StreamDescriptor-members.html +++ b/docs/df/db8/structshaka_1_1media_1_1StreamDescriptor-members.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 efa9448fbf..37e505ee79 100644 --- a/docs/df/dc7/avc__decoder__configuration__record_8h_source.html +++ b/docs/df/dc7/avc__decoder__configuration__record_8h_source.html @@ -153,7 +153,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/dd2/mpd__utils_8h_source.html b/docs/df/dd2/mpd__utils_8h_source.html index 526cb05af5..286be9e58d 100644 --- a/docs/df/dd2/mpd__utils_8h_source.html +++ b/docs/df/dd2/mpd__utils_8h_source.html @@ -174,7 +174,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); 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 57fcdb1fbe..96ae6cb439 100644 --- a/docs/df/dd2/structshaka_1_1media_1_1H264Pps-members.html +++ b/docs/df/dd2/structshaka_1_1media_1_1H264Pps-members.html @@ -117,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/ddc/webm_2segmenter_8h_source.html b/docs/df/ddc/webm_2segmenter_8h_source.html index 56f9c362a0..c066793c82 100644 --- a/docs/df/ddc/webm_2segmenter_8h_source.html +++ b/docs/df/ddc/webm_2segmenter_8h_source.html @@ -251,7 +251,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/dde/ts__section__psi_8cc_source.html b/docs/df/dde/ts__section__psi_8cc_source.html index 4663f99b5a..8bb2bcf0bb 100644 --- a/docs/df/dde/ts__section__psi_8cc_source.html +++ b/docs/df/dde/ts__section__psi_8cc_source.html @@ -230,7 +230,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/de2/structshaka_1_1media_1_1H264SEIRecoveryPoint.html b/docs/df/de2/structshaka_1_1media_1_1H264SEIRecoveryPoint.html index 4f81d9c253..c18de73ba3 100644 --- a/docs/df/de2/structshaka_1_1media_1_1H264SEIRecoveryPoint.html +++ b/docs/df/de2/structshaka_1_1media_1_1H264SEIRecoveryPoint.html @@ -111,14 +111,14 @@ int changing_slice_group_i

                Detailed Description

                -

                Definition at line 219 of file h264_parser.h.

                +

                Definition at line 220 of file h264_parser.h.


                The documentation for this struct was generated from the following file: diff --git a/docs/df/de3/text__track__config_8cc_source.html b/docs/df/de3/text__track__config_8cc_source.html index 69a1712f4d..57a7c0c917 100644 --- a/docs/df/de3/text__track__config_8cc_source.html +++ b/docs/df/de3/text__track__config_8cc_source.html @@ -122,7 +122,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/de9/segment__info_8h_source.html b/docs/df/de9/segment__info_8h_source.html index 3d0eb8f934..e9c6c6fae0 100644 --- a/docs/df/de9/segment__info_8h_source.html +++ b/docs/df/de9/segment__info_8h_source.html @@ -114,7 +114,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/df/df1/structshaka_1_1ContentProtectionElement-members.html b/docs/df/df1/structshaka_1_1ContentProtectionElement-members.html index f3c271486f..25af7241a5 100644 --- a/docs/df/df1/structshaka_1_1ContentProtectionElement-members.html +++ b/docs/df/df1/structshaka_1_1ContentProtectionElement-members.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); diff --git a/docs/dir_0494b8c96e3190a776d2b97ade9c8ddf.html b/docs/dir_0494b8c96e3190a776d2b97ade9c8ddf.html index 36a4215fdb..ba8b63cb5f 100644 --- a/docs/dir_0494b8c96e3190a776d2b97ade9c8ddf.html +++ b/docs/dir_0494b8c96e3190a776d2b97ade9c8ddf.html @@ -165,7 +165,7 @@ Files diff --git a/docs/dir_2618cd273dea54f184e42d7a562af818.html b/docs/dir_2618cd273dea54f184e42d7a562af818.html index 3462295322..ef9a328490 100644 --- a/docs/dir_2618cd273dea54f184e42d7a562af818.html +++ b/docs/dir_2618cd273dea54f184e42d7a562af818.html @@ -140,7 +140,7 @@ Files diff --git a/docs/dir_279fd47bebb21302c25cfb685e84c359.html b/docs/dir_279fd47bebb21302c25cfb685e84c359.html index be91ce118e..1afd4c1984 100644 --- a/docs/dir_279fd47bebb21302c25cfb685e84c359.html +++ b/docs/dir_279fd47bebb21302c25cfb685e84c359.html @@ -119,7 +119,7 @@ Files diff --git a/docs/dir_2eceb70145328c029a5f43350007537a.html b/docs/dir_2eceb70145328c029a5f43350007537a.html index c0f638686d..d7603e703e 100644 --- a/docs/dir_2eceb70145328c029a5f43350007537a.html +++ b/docs/dir_2eceb70145328c029a5f43350007537a.html @@ -93,7 +93,7 @@ Files diff --git a/docs/dir_39dc0668bd5a501998f94e8b4e546c71.html b/docs/dir_39dc0668bd5a501998f94e8b4e546c71.html index d833a925d5..457175abaf 100644 --- a/docs/dir_39dc0668bd5a501998f94e8b4e546c71.html +++ b/docs/dir_39dc0668bd5a501998f94e8b4e546c71.html @@ -99,7 +99,7 @@ Directories diff --git a/docs/dir_3e9291fd7a18fdecc763294cb2628910.html b/docs/dir_3e9291fd7a18fdecc763294cb2628910.html index a451f5ed1f..a33662012e 100644 --- a/docs/dir_3e9291fd7a18fdecc763294cb2628910.html +++ b/docs/dir_3e9291fd7a18fdecc763294cb2628910.html @@ -157,7 +157,7 @@ Files diff --git a/docs/dir_49627ef5ef0630f6cf11dd06344c4cf0.html b/docs/dir_49627ef5ef0630f6cf11dd06344c4cf0.html index 37e485cd82..fc02cef194 100644 --- a/docs/dir_49627ef5ef0630f6cf11dd06344c4cf0.html +++ b/docs/dir_49627ef5ef0630f6cf11dd06344c4cf0.html @@ -93,7 +93,7 @@ Files diff --git a/docs/dir_5039d854a18988ed1f1dbebc120ffbf7.html b/docs/dir_5039d854a18988ed1f1dbebc120ffbf7.html index bbab10e32f..ae7d591014 100644 --- a/docs/dir_5039d854a18988ed1f1dbebc120ffbf7.html +++ b/docs/dir_5039d854a18988ed1f1dbebc120ffbf7.html @@ -181,7 +181,7 @@ Files diff --git a/docs/dir_65f7acfa8cf3a5f1edc11faa2428b914.html b/docs/dir_65f7acfa8cf3a5f1edc11faa2428b914.html index cfa1c38d20..d85af28a60 100644 --- a/docs/dir_65f7acfa8cf3a5f1edc11faa2428b914.html +++ b/docs/dir_65f7acfa8cf3a5f1edc11faa2428b914.html @@ -101,7 +101,7 @@ Directories diff --git a/docs/dir_679a6f4e9fa092b388fc986148018f2a.html b/docs/dir_679a6f4e9fa092b388fc986148018f2a.html index f3bd80eac0..651af2fe78 100644 --- a/docs/dir_679a6f4e9fa092b388fc986148018f2a.html +++ b/docs/dir_679a6f4e9fa092b388fc986148018f2a.html @@ -95,7 +95,7 @@ Files diff --git a/docs/dir_7f5e01ba7faf319a30cabd201b6ef121.html b/docs/dir_7f5e01ba7faf319a30cabd201b6ef121.html index e7ca0ea8df..745586b619 100644 --- a/docs/dir_7f5e01ba7faf319a30cabd201b6ef121.html +++ b/docs/dir_7f5e01ba7faf319a30cabd201b6ef121.html @@ -93,7 +93,7 @@ Files diff --git a/docs/dir_89dd766eb2df7d7257dbe806a34404af.html b/docs/dir_89dd766eb2df7d7257dbe806a34404af.html index 24cb75a125..d6ae57e103 100644 --- a/docs/dir_89dd766eb2df7d7257dbe806a34404af.html +++ b/docs/dir_89dd766eb2df7d7257dbe806a34404af.html @@ -93,7 +93,7 @@ Directories diff --git a/docs/dir_aa73376d632f252584a1c0dfbefab2c4.html b/docs/dir_aa73376d632f252584a1c0dfbefab2c4.html index b60157c1dd..f323a56fe1 100644 --- a/docs/dir_aa73376d632f252584a1c0dfbefab2c4.html +++ b/docs/dir_aa73376d632f252584a1c0dfbefab2c4.html @@ -117,7 +117,7 @@ Files diff --git a/docs/dir_c6ada2450b25ab5438a4dba6c9b890af.html b/docs/dir_c6ada2450b25ab5438a4dba6c9b890af.html index 05cd2544d1..34909bd868 100644 --- a/docs/dir_c6ada2450b25ab5438a4dba6c9b890af.html +++ b/docs/dir_c6ada2450b25ab5438a4dba6c9b890af.html @@ -245,7 +245,7 @@ Files diff --git a/docs/dir_d422163b96683743ed3963d4aac17747.html b/docs/dir_d422163b96683743ed3963d4aac17747.html index f5cb193470..00830f1175 100644 --- a/docs/dir_d422163b96683743ed3963d4aac17747.html +++ b/docs/dir_d422163b96683743ed3963d4aac17747.html @@ -135,7 +135,7 @@ Files diff --git a/docs/dir_eeaeb49ac3913fcfb450d3ce9cc0141b.html b/docs/dir_eeaeb49ac3913fcfb450d3ce9cc0141b.html index b5f52e5719..20ed0add89 100644 --- a/docs/dir_eeaeb49ac3913fcfb450d3ce9cc0141b.html +++ b/docs/dir_eeaeb49ac3913fcfb450d3ce9cc0141b.html @@ -93,7 +93,7 @@ Files diff --git a/docs/dir_f7dcbe7025bbacfc4b9a7dff6ad41d72.html b/docs/dir_f7dcbe7025bbacfc4b9a7dff6ad41d72.html index a3d497e89b..5a42847bf4 100644 --- a/docs/dir_f7dcbe7025bbacfc4b9a7dff6ad41d72.html +++ b/docs/dir_f7dcbe7025bbacfc4b9a7dff6ad41d72.html @@ -171,7 +171,7 @@ Files diff --git a/docs/files.html b/docs/files.html index ccbe1b26a7..a66e4746d0 100644 --- a/docs/files.html +++ b/docs/files.html @@ -430,7 +430,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions.html b/docs/functions.html index 20abae650d..10b1579948 100644 --- a/docs/functions.html +++ b/docs/functions.html @@ -240,7 +240,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_b.html b/docs/functions_b.html index 2833684b89..aa8a016884 100644 --- a/docs/functions_b.html +++ b/docs/functions_b.html @@ -240,7 +240,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_c.html b/docs/functions_c.html index 37bd1f46ad..89df45ce77 100644 --- a/docs/functions_c.html +++ b/docs/functions_c.html @@ -241,7 +241,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_d.html b/docs/functions_d.html index 91fb996094..d02a272fa3 100644 --- a/docs/functions_d.html +++ b/docs/functions_d.html @@ -162,7 +162,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_e.html b/docs/functions_e.html index db2c7affa1..dc2f72f5e4 100644 --- a/docs/functions_e.html +++ b/docs/functions_e.html @@ -146,7 +146,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_enum.html b/docs/functions_enum.html index c2bf40b3af..6c44ac58c1 100644 --- a/docs/functions_enum.html +++ b/docs/functions_enum.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_eval.html b/docs/functions_eval.html index 0b727df69b..a4564aca7d 100644 --- a/docs/functions_eval.html +++ b/docs/functions_eval.html @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_f.html b/docs/functions_f.html index bde6504a5d..5fd3ef7ede 100644 --- a/docs/functions_f.html +++ b/docs/functions_f.html @@ -193,7 +193,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func.html b/docs/functions_func.html index f00389acf9..6872c44c45 100644 --- a/docs/functions_func.html +++ b/docs/functions_func.html @@ -240,7 +240,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_b.html b/docs/functions_func_b.html index 49d795d8aa..76320f0e33 100644 --- a/docs/functions_func_b.html +++ b/docs/functions_func_b.html @@ -237,7 +237,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_c.html b/docs/functions_func_c.html index 7f9bc3a7f7..fc5bf3be99 100644 --- a/docs/functions_func_c.html +++ b/docs/functions_func_c.html @@ -241,7 +241,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_d.html b/docs/functions_func_d.html index 4491f65bfc..af81acf163 100644 --- a/docs/functions_func_d.html +++ b/docs/functions_func_d.html @@ -162,7 +162,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_e.html b/docs/functions_func_e.html index 5b1a580013..55797150de 100644 --- a/docs/functions_func_e.html +++ b/docs/functions_func_e.html @@ -146,7 +146,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_f.html b/docs/functions_func_f.html index d81a59b4bb..ff9241577a 100644 --- a/docs/functions_func_f.html +++ b/docs/functions_func_f.html @@ -187,7 +187,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_g.html b/docs/functions_func_g.html index fd5280d66d..c49a7d8581 100644 --- a/docs/functions_func_g.html +++ b/docs/functions_func_g.html @@ -259,7 +259,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_h.html b/docs/functions_func_h.html index fd65714b4d..60617b1cf0 100644 --- a/docs/functions_func_h.html +++ b/docs/functions_func_h.html @@ -154,7 +154,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_i.html b/docs/functions_func_i.html index d3feda2c58..1e8551a68d 100644 --- a/docs/functions_func_i.html +++ b/docs/functions_func_i.html @@ -210,7 +210,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_k.html b/docs/functions_func_k.html index 673d6238f7..9d3f1af031 100644 --- a/docs/functions_func_k.html +++ b/docs/functions_func_k.html @@ -129,7 +129,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_l.html b/docs/functions_func_l.html index 361a88048b..ae66d6c176 100644 --- a/docs/functions_func_l.html +++ b/docs/functions_func_l.html @@ -135,7 +135,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_m.html b/docs/functions_func_m.html index 9ff3881a62..1e6793c9da 100644 --- a/docs/functions_func_m.html +++ b/docs/functions_func_m.html @@ -147,7 +147,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_n.html b/docs/functions_func_n.html index c94d9e9c2b..10d98bceb1 100644 --- a/docs/functions_func_n.html +++ b/docs/functions_func_n.html @@ -172,7 +172,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_o.html b/docs/functions_func_o.html index 9bc3cdb67a..b8d3a2444f 100644 --- a/docs/functions_func_o.html +++ b/docs/functions_func_o.html @@ -193,7 +193,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_p.html b/docs/functions_func_p.html index f014804975..d427afea1a 100644 --- a/docs/functions_func_p.html +++ b/docs/functions_func_p.html @@ -228,7 +228,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_r.html b/docs/functions_func_r.html index 4d6a139a1d..e53031425a 100644 --- a/docs/functions_func_r.html +++ b/docs/functions_func_r.html @@ -201,7 +201,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_s.html b/docs/functions_func_s.html index 482d446126..eb51d8e5af 100644 --- a/docs/functions_func_s.html +++ b/docs/functions_func_s.html @@ -273,7 +273,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : shaka::media::mp2t::PesPacket
              • streams() -: shaka::media::Demuxer +: shaka::media::Demuxer
              • SuppressOnce() : shaka::Representation @@ -285,7 +285,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_t.html b/docs/functions_func_t.html index d91fbe1557..0deff07e5e 100644 --- a/docs/functions_func_t.html +++ b/docs/functions_func_t.html @@ -179,7 +179,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_u.html b/docs/functions_func_u.html index 6561dbf7f7..307a4f822f 100644 --- a/docs/functions_func_u.html +++ b/docs/functions_func_u.html @@ -146,7 +146,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_v.html b/docs/functions_func_v.html index 097d2ad59f..d627521fdd 100644 --- a/docs/functions_func_v.html +++ b/docs/functions_func_v.html @@ -135,7 +135,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_w.html b/docs/functions_func_w.html index 0fb5dd3a7b..e83a2ff8c5 100644 --- a/docs/functions_func_w.html +++ b/docs/functions_func_w.html @@ -182,7 +182,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_x.html b/docs/functions_func_x.html index fc71f3ac09..01ce1df713 100644 --- a/docs/functions_func_x.html +++ b/docs/functions_func_x.html @@ -129,7 +129,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_func_~.html b/docs/functions_func_~.html index 35e0ad961c..3be7676232 100644 --- a/docs/functions_func_~.html +++ b/docs/functions_func_~.html @@ -132,7 +132,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_g.html b/docs/functions_g.html index e2a9d8a513..dddd1281d3 100644 --- a/docs/functions_g.html +++ b/docs/functions_g.html @@ -259,7 +259,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_h.html b/docs/functions_h.html index 3c59bd300f..d2524a863f 100644 --- a/docs/functions_h.html +++ b/docs/functions_h.html @@ -154,7 +154,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_i.html b/docs/functions_i.html index 7157201b1f..fc7a31c162 100644 --- a/docs/functions_i.html +++ b/docs/functions_i.html @@ -213,7 +213,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_k.html b/docs/functions_k.html index e668c1dcb6..c7bd893b68 100644 --- a/docs/functions_k.html +++ b/docs/functions_k.html @@ -150,7 +150,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_l.html b/docs/functions_l.html index 72d71f5251..99ab4f3c49 100644 --- a/docs/functions_l.html +++ b/docs/functions_l.html @@ -135,7 +135,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_m.html b/docs/functions_m.html index cd5ad5ee59..1efe8b23ea 100644 --- a/docs/functions_m.html +++ b/docs/functions_m.html @@ -150,7 +150,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_n.html b/docs/functions_n.html index 9ef0ff63b6..1600475a26 100644 --- a/docs/functions_n.html +++ b/docs/functions_n.html @@ -178,7 +178,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_o.html b/docs/functions_o.html index 6e921d07bb..1509d4796f 100644 --- a/docs/functions_o.html +++ b/docs/functions_o.html @@ -196,7 +196,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_p.html b/docs/functions_p.html index 5bca819b6a..d0d45b1f36 100644 --- a/docs/functions_p.html +++ b/docs/functions_p.html @@ -234,7 +234,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_r.html b/docs/functions_r.html index 169721b611..fdf4b5763b 100644 --- a/docs/functions_r.html +++ b/docs/functions_r.html @@ -201,7 +201,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_s.html b/docs/functions_s.html index 7723279623..878db8a4d0 100644 --- a/docs/functions_s.html +++ b/docs/functions_s.html @@ -288,7 +288,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : shaka::media::mp2t::PesPacket
              • streams() -: shaka::media::Demuxer +: shaka::media::Demuxer
              • SuppressOnce() : shaka::Representation @@ -300,7 +300,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_t.html b/docs/functions_t.html index f68fd6e100..94529da80d 100644 --- a/docs/functions_t.html +++ b/docs/functions_t.html @@ -182,7 +182,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_type.html b/docs/functions_type.html index e3ee567626..36c711a4ed 100644 --- a/docs/functions_type.html +++ b/docs/functions_type.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_u.html b/docs/functions_u.html index 90c0f2f13a..45942e32d6 100644 --- a/docs/functions_u.html +++ b/docs/functions_u.html @@ -146,7 +146,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_v.html b/docs/functions_v.html index c2370e41b3..82d0276ef8 100644 --- a/docs/functions_v.html +++ b/docs/functions_v.html @@ -135,7 +135,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_vars.html b/docs/functions_vars.html index 7d3469e145..e2313433e6 100644 --- a/docs/functions_vars.html +++ b/docs/functions_vars.html @@ -145,7 +145,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_w.html b/docs/functions_w.html index 823d5db791..ff7041fa99 100644 --- a/docs/functions_w.html +++ b/docs/functions_w.html @@ -182,7 +182,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_x.html b/docs/functions_x.html index 27e1d1d461..22732dd123 100644 --- a/docs/functions_x.html +++ b/docs/functions_x.html @@ -129,7 +129,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/functions_~.html b/docs/functions_~.html index b7fea26ba0..13ca30a9a9 100644 --- a/docs/functions_~.html +++ b/docs/functions_~.html @@ -132,7 +132,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/hierarchy.html b/docs/hierarchy.html index cf9b65d3a5..c54b14de49 100644 --- a/docs/hierarchy.html +++ b/docs/hierarchy.html @@ -369,7 +369,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/index.html b/docs/index.html index 1bc544f54f..5a5cdd6cdd 100644 --- a/docs/index.html +++ b/docs/index.html @@ -81,7 +81,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/namespacemembers.html b/docs/namespacemembers.html index f2d4a82c22..59b7f2db29 100644 --- a/docs/namespacemembers.html +++ b/docs/namespacemembers.html @@ -124,7 +124,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/namespacemembers_func.html b/docs/namespacemembers_func.html index fdac44b844..27c8e2f970 100644 --- a/docs/namespacemembers_func.html +++ b/docs/namespacemembers_func.html @@ -124,7 +124,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/namespaces.html b/docs/namespaces.html index 1c9ead4ac6..ed9018b3aa 100644 --- a/docs/namespaces.html +++ b/docs/namespaces.html @@ -92,7 +92,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/search/all_10.js b/docs/search/all_10.js index 7dda612aaf..dfe659a09b 100644 --- a/docs/search/all_10.js +++ b/docs/search/all_10.js @@ -81,7 +81,7 @@ var searchData= ['streamdescriptor',['StreamDescriptor',['../d2/d95/structshaka_1_1media_1_1StreamDescriptor.html',1,'shaka::media']]], ['streamdescriptorcomparefn',['StreamDescriptorCompareFn',['../d8/d3e/classshaka_1_1media_1_1StreamDescriptorCompareFn.html',1,'shaka::media']]], ['streaminfo',['StreamInfo',['../d5/db1/classshaka_1_1media_1_1StreamInfo.html',1,'shaka::media']]], - ['streams',['streams',['../dd/d17/classshaka_1_1media_1_1Demuxer.html#af89c3d15b452d45bcacea9470ba43a7f',1,'shaka::media::Demuxer']]], + ['streams',['streams',['../dd/d17/classshaka_1_1media_1_1Demuxer.html#aafb74f83b0de2c787336bad9f096ce50',1,'shaka::media::Demuxer']]], ['subsampleentry',['SubsampleEntry',['../d1/d34/structshaka_1_1media_1_1SubsampleEntry.html',1,'shaka::media']]], ['subtitlemediaheader',['SubtitleMediaHeader',['../db/d21/structshaka_1_1media_1_1mp4_1_1SubtitleMediaHeader.html',1,'shaka::media::mp4']]], ['suppressonce',['SuppressOnce',['../de/d52/classshaka_1_1Representation.html#a473e45dbbf64e6ab6ed670ccedac84ed',1,'shaka::Representation']]], diff --git a/docs/search/functions_10.js b/docs/search/functions_10.js index 319aa16974..193957856c 100644 --- a/docs/search/functions_10.js +++ b/docs/search/functions_10.js @@ -46,7 +46,7 @@ var searchData= ['stop',['Stop',['../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html#ac600977b708381facf07f87e36b43d79',1,'shaka::media::ProducerConsumerQueue']]], ['stopped',['Stopped',['../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html#a3d88bdebfa412f2847f1d96fd804bba1',1,'shaka::media::ProducerConsumerQueue']]], ['stream_5fid',['stream_id',['../d2/d93/classshaka_1_1media_1_1mp2t_1_1PesPacket.html#aa023c7fafbced88ca40e98362a7e4c69',1,'shaka::media::mp2t::PesPacket']]], - ['streams',['streams',['../dd/d17/classshaka_1_1media_1_1Demuxer.html#af89c3d15b452d45bcacea9470ba43a7f',1,'shaka::media::Demuxer']]], + ['streams',['streams',['../dd/d17/classshaka_1_1media_1_1Demuxer.html#aafb74f83b0de2c787336bad9f096ce50',1,'shaka::media::Demuxer']]], ['suppressonce',['SuppressOnce',['../de/d52/classshaka_1_1Representation.html#a473e45dbbf64e6ab6ed670ccedac84ed',1,'shaka::Representation']]], ['syncsampleiterator',['SyncSampleIterator',['../d7/d26/classshaka_1_1media_1_1mp4_1_1SyncSampleIterator.html#af8bc2d5d153bfdd168f145213c47d3fe',1,'shaka::media::mp4::SyncSampleIterator']]] ];