Index: chromecast/public/media/decoder_config.h |
diff --git a/chromecast/public/media/decoder_config.h b/chromecast/public/media/decoder_config.h |
index b82c5c1a1ef424685d8c54333e68d2f35fda8d3d..261b3f1fa575667196ef681dedec74f7bacdb49b 100644 |
--- a/chromecast/public/media/decoder_config.h |
+++ b/chromecast/public/media/decoder_config.h |
@@ -93,77 +93,12 @@ |
kVideoProfileMax = kDolbyVisionNonCompatible_BL_EL_MD, |
}; |
-// Specification of whether and how the stream is encrypted (in whole or part). |
-struct EncryptionScheme { |
- // Algorithm and mode that was used to encrypt the stream. |
- enum CipherMode { |
- CIPHER_MODE_UNENCRYPTED, |
- CIPHER_MODE_AES_CTR, |
- CIPHER_MODE_AES_CBC |
- }; |
- |
- // CENC 3rd Edition adds pattern encryption, through two new protection |
- // schemes: 'cens' (with AES-CTR) and 'cbcs' (with AES-CBC). |
- // The pattern applies independently to each 'encrypted' part of the frame (as |
- // defined by the relevant subsample entries), and reduces further the |
- // actual encryption applied through a repeating pattern of (encrypt:skip) |
- // 16 byte blocks. For example, in a (1:9) pattern, the first block is |
- // encrypted, and the next nine are skipped. This pattern is applied |
- // repeatedly until the end of the last 16-byte block in the subsample. |
- // Any remaining bytes are left clear. |
- // If either of encrypt_blocks or skip_blocks is 0, pattern encryption is |
- // disabled. |
- struct Pattern { |
- Pattern() {} |
- Pattern(uint32_t encrypt_blocks, uint32_t skip_blocks); |
- ~Pattern() {} |
- bool IsInEffect() const; |
- |
- uint32_t encrypt_blocks = 0; |
- uint32_t skip_blocks = 0; |
- }; |
- |
- EncryptionScheme() {} |
- EncryptionScheme(CipherMode mode, const Pattern& pattern); |
- ~EncryptionScheme() {} |
- bool is_encrypted() const { return mode != CIPHER_MODE_UNENCRYPTED; } |
- |
- CipherMode mode = CIPHER_MODE_UNENCRYPTED; |
- Pattern pattern; |
-}; |
- |
-inline EncryptionScheme::Pattern::Pattern(uint32_t encrypt_blocks, |
- uint32_t skip_blocks) |
- : encrypt_blocks(encrypt_blocks), skip_blocks(skip_blocks) { |
-} |
- |
-inline bool EncryptionScheme::Pattern::IsInEffect() const { |
- return encrypt_blocks != 0 && skip_blocks != 0; |
-} |
- |
-inline EncryptionScheme::EncryptionScheme(CipherMode mode, |
- const Pattern& pattern) |
- : mode(mode), pattern(pattern) { |
-} |
- |
-inline EncryptionScheme Unencrypted() { |
- return EncryptionScheme(); |
-} |
- |
-inline EncryptionScheme AesCtrEncryptionScheme() { |
- return EncryptionScheme(EncryptionScheme::CIPHER_MODE_AES_CTR, |
- EncryptionScheme::Pattern()); |
-} |
- |
- |
-// TODO(erickung): Remove constructor once CMA backend implementation doesn't |
+// TODO(erickung): Remove constructor once CMA backend implementation does't |
// create a new object to reset the configuration and use IsValidConfig() to |
// determine if the configuration is still valid or not. |
struct AudioConfig { |
AudioConfig(); |
~AudioConfig(); |
- |
- bool is_encrypted() const { return encryption_scheme.is_encrypted(); } |
// Stream id. |
StreamId id; |
@@ -179,8 +114,8 @@ |
int samples_per_second; |
// Extra data buffer for certain codec initialization. |
std::vector<uint8_t> extra_data; |
- // Encryption scheme (if any) used for the content. |
- EncryptionScheme encryption_scheme; |
+ // content is encrypted or not. |
+ bool is_encrypted; |
}; |
inline AudioConfig::AudioConfig() |
@@ -189,7 +124,8 @@ |
sample_format(kUnknownSampleFormat), |
bytes_per_channel(0), |
channel_number(0), |
- samples_per_second(0) { |
+ samples_per_second(0), |
+ is_encrypted(false) { |
} |
inline AudioConfig::~AudioConfig() { |
@@ -201,8 +137,6 @@ |
struct VideoConfig { |
VideoConfig(); |
~VideoConfig(); |
- |
- bool is_encrypted() const { return encryption_scheme.is_encrypted(); } |
// Stream Id. |
StreamId id; |
@@ -216,15 +150,16 @@ |
VideoConfig* additional_config; |
// Extra data buffer for certain codec initialization. |
std::vector<uint8_t> extra_data; |
- // Encryption scheme (if any) used for the content. |
- EncryptionScheme encryption_scheme; |
+ // content is encrypted or not. |
+ bool is_encrypted; |
}; |
inline VideoConfig::VideoConfig() |
: id(kPrimary), |
codec(kVideoCodecUnknown), |
profile(kVideoProfileUnknown), |
- additional_config(nullptr) { |
+ additional_config(nullptr), |
+ is_encrypted(false) { |
} |
inline VideoConfig::~VideoConfig() { |