Index: media/base/decrypt_config.h |
diff --git a/media/base/decrypt_config.h b/media/base/decrypt_config.h |
index 5fca7876d330c78c76ade6c624ba00b85b49c70c..e96103dd41134039fad49e851614918bb6a22f4d 100644 |
--- a/media/base/decrypt_config.h |
+++ b/media/base/decrypt_config.h |
@@ -5,24 +5,57 @@ |
#ifndef MEDIA_BASE_DECRYPT_CONFIG_H_ |
#define MEDIA_BASE_DECRYPT_CONFIG_H_ |
+#include <string> |
+#include <vector> |
+ |
#include "base/basictypes.h" |
#include "base/memory/scoped_ptr.h" |
#include "media/base/media_export.h" |
namespace media { |
+// The Common Encryption spec provides for subsample encryption, where portions |
+// of a sample are set in cleartext. A SubsampleEntry specifies the number of |
+// clear and encrypted bytes in each subsample. For decryption, all of the |
+// encrypted bytes in a sample should be considered a single logical stream, |
+// regardless of how they are divided into subsamples, and the clear bytes |
+// should not be considered as part of decryption. This is logically equivalent |
+// to concatenating all 'cypher_bytes' portions of subsamples, decrypting that |
+// result, and then copying each byte from the decrypted block over the |
+// position of the corresponding encrypted byte. |
+struct SubsampleEntry { |
+ uint32 clear_bytes; |
+ uint32 cypher_bytes; |
+}; |
+ |
// Contains all information that a decryptor needs to decrypt. |
class MEDIA_EXPORT DecryptConfig { |
public: |
- explicit DecryptConfig(const uint8* key_id, int key_id_size); |
+ DecryptConfig(const uint8* key_id, int key_id_size, |
+ const std::string& iv, |
+ const std::vector<SubsampleEntry>& subsamples); |
+ |
+ // TODO(strobe): This constructor implicitly sets CBC mode and uses a default |
+ // IV, to preserve compatibility with an early implementation. It should be |
+ // removed, along with CBC mode and the default IV, when |
+ // https://chromiumcodereview.appspot.com/10535029 lands. |
+ DecryptConfig(const uint8* key_id, int key_id_size); |
+ |
~DecryptConfig(); |
const uint8* key_id() const { return key_id_.get(); } |
int key_id_size() const { return key_id_size_; } |
+ const std::string& iv() const { return iv_; } |
+ const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; } |
+ bool use_cbc() const { return use_cbc_; } |
private: |
scoped_array<uint8> key_id_; |
int key_id_size_; |
+ std::string iv_; |
+ std::vector<SubsampleEntry> subsamples_; |
+ // TODO(strobe): Remove when CBC is no longer used. |
+ bool use_cbc_; |
DISALLOW_COPY_AND_ASSIGN(DecryptConfig); |
}; |