Index: webkit/media/crypto/ppapi/cdm_wrapper.cc |
diff --git a/webkit/media/crypto/ppapi/cdm_wrapper.cc b/webkit/media/crypto/ppapi/cdm_wrapper.cc |
index 8b7edf3f85cac81b8a04cf42e9211565e471ed5e..9df644d1d904b5947091f033b727e2085b1bc328 100644 |
--- a/webkit/media/crypto/ppapi/cdm_wrapper.cc |
+++ b/webkit/media/crypto/ppapi/cdm_wrapper.cc |
@@ -7,6 +7,7 @@ |
#include "base/compiler_specific.h" // For OVERRIDE. |
#include "ppapi/c/pp_errors.h" |
#include "ppapi/c/pp_stdint.h" |
+#include "ppapi/c/private/pp_content_decryptor.h" |
#include "ppapi/cpp/completion_callback.h" |
#include "ppapi/cpp/core.h" |
#include "ppapi/cpp/instance.h" |
@@ -33,9 +34,8 @@ struct DecryptorMessage { |
}; |
struct DecryptedBlock { |
- DecryptedBlock() : request_id(0) {} |
- int32_t request_id; |
- std::string data; |
+ std::string decrypted_data; |
+ PP_DecryptedBlockInfo decrypted_block_info; |
dmichael (off chromium)
2012/08/21 17:37:08
Do you maybe still want a default constructor so y
Tom Finegan
2012/08/21 22:57:38
Definitely, added. (memset abuse!)
|
}; |
void CallOnMain(pp::CompletionCallback cb) { |
@@ -57,13 +57,16 @@ class CDMWrapper : public pp::Instance, |
virtual bool GenerateKeyRequest(const std::string& key_system, |
pp::VarArrayBuffer init_data) OVERRIDE; |
virtual bool AddKey(const std::string& session_id, |
- pp::VarArrayBuffer key) OVERRIDE; |
+ pp::VarArrayBuffer key, |
+ pp::VarArrayBuffer init_data) OVERRIDE; |
virtual bool CancelKeyRequest(const std::string& session_id) OVERRIDE; |
- virtual bool Decrypt(pp::Buffer_Dev encrypted_buffer, |
- int32_t request_id) OVERRIDE; |
+ virtual bool Decrypt( |
+ pp::Buffer_Dev encrypted_buffer, |
+ const PP_EncryptedBlockInfo* encrypted_block_info) OVERRIDE; |
- virtual bool DecryptAndDecode(pp::Buffer_Dev encrypted_buffer, |
- int32_t request_id) OVERRIDE { |
+ virtual bool DecryptAndDecode( |
+ pp::Buffer_Dev encrypted_buffer, |
+ const PP_EncryptedBlockInfo* encrypted_block_info) OVERRIDE { |
return false; |
} |
@@ -109,9 +112,12 @@ bool CDMWrapper::GenerateKeyRequest(const std::string& key_system, |
} |
bool CDMWrapper::AddKey(const std::string& session_id, |
- pp::VarArrayBuffer key) { |
+ pp::VarArrayBuffer key, |
+ pp::VarArrayBuffer init_data) { |
const std::string key_string(reinterpret_cast<char*>(key.Map()), |
key.ByteLength()); |
+ const std::string init_data_string(reinterpret_cast<char*>(init_data.Map()), |
+ init_data.ByteLength()); |
dmichael (off chromium)
2012/08/21 17:37:08
surprised you don't get an unused variable warning
Tom Finegan
2012/08/21 22:57:38
This is just a placeholder-- the CDM takes uint8*
|
PP_DCHECK(!session_id.empty() && !key_string.empty()); |
@@ -141,12 +147,12 @@ bool CDMWrapper::CancelKeyRequest(const std::string& session_id) { |
} |
bool CDMWrapper::Decrypt(pp::Buffer_Dev encrypted_buffer, |
- int32_t request_id) { |
+ const PP_EncryptedBlockInfo* encrypted_block_info) { |
PP_DCHECK(!encrypted_buffer.is_null()); |
+ PP_DCHECK(encrypted_block_info); |
DecryptedBlock decrypted_block; |
- decrypted_block.request_id = request_id; |
- decrypted_block.data = "Pretend I'm decrypted data!"; |
+ decrypted_block.decrypted_data = "Pretend I'm decrypted data!"; |
CallOnMain(callback_factory_.NewCallback(&CDMWrapper::DeliverBlock, |
decrypted_block)); |
dmichael (off chromium)
2012/08/21 17:37:08
This copies potentially a lot of data... have you
Tom Finegan
2012/08/21 22:57:38
Added TODO per offline discussion.
|
return true; |
@@ -201,9 +207,10 @@ void CDMWrapper::KeyError(int32_t result, |
void CDMWrapper::DeliverBlock(int32_t result, |
const DecryptedBlock& decrypted_block) { |
pp::Buffer_Dev decrypted_buffer( |
- StringToBufferResource(decrypted_block.data)); |
- pp::ContentDecryptor_Private::DeliverBlock(decrypted_buffer, |
- decrypted_block.request_id); |
+ StringToBufferResource(decrypted_block.decrypted_data)); |
+ pp::ContentDecryptor_Private::DeliverBlock( |
+ decrypted_buffer, |
+ &decrypted_block.decrypted_block_info); |
} |
// This object is the global object representing this plugin library as long |