Index: webkit/media/crypto/ppapi/content_decryption_module.h |
diff --git a/webkit/media/crypto/ppapi/content_decryption_module.h b/webkit/media/crypto/ppapi/content_decryption_module.h |
index 491c064f15bb7379c03d0f74dc65a782b8210909..f8af8a442134fe3f8fe36d507af9961f6be6c407 100644 |
--- a/webkit/media/crypto/ppapi/content_decryption_module.h |
+++ b/webkit/media/crypto/ppapi/content_decryption_module.h |
@@ -13,18 +13,35 @@ typedef __int64 int64_t; |
#include <stdint.h> |
#endif |
+#include "cdm_export.h" |
+ |
namespace cdm { |
class ContentDecryptionModule; |
} |
extern "C" { |
-cdm::ContentDecryptionModule* CreateCdmInstance(); |
-void DestroyCdmInstance(cdm::ContentDecryptionModule* instance); |
-const char* GetCdmVersion(); |
+CDM_EXPORT cdm::ContentDecryptionModule* CreateCdmInstance(); |
xhwang
2012/08/20 21:09:45
This is to simulate what's in MEDIA_EXPORT, or CON
ddorwin
2012/08/20 21:27:07
I don't think its definition should be based on de
xhwang
2012/08/20 21:57:10
Done.
|
+CDM_EXPORT void DestroyCdmInstance(cdm::ContentDecryptionModule* instance); |
+CDM_EXPORT const char* GetCdmVersion(); |
} |
namespace cdm { |
+enum Status { |
xhwang
2012/08/20 21:09:45
Move it here so that the caller (e.g. CdmWrapper)
|
+ kSuccess = 0, |
+ kErrorUnknown, |
+ kErrorNoKey |
+}; |
+ |
+struct KeyRequest { |
+ char* session_id; |
+ uint32_t session_id_size; |
+ uint8_t* key_request; |
+ uint32_t key_request_size; |
+ char* default_url; |
+ uint32_t default_url_size; |
+}; |
+ |
// An input buffer can be split into several continuous subsamples. |
// A SubsampleEntry specifies the number of clear and cipher bytes in each |
// subsample. For example, the following buffer has three subsamples: |
@@ -82,31 +99,20 @@ struct OutputBuffer { |
class ContentDecryptionModule { |
public: |
- enum Status { |
- kSuccess = 0, |
- kErrorUnknown, |
- kErrorNoKey |
- }; |
- |
- // Generates a |key_request| as well as a |session_id| given the |init_data|. |
- // The CDM may also extract a |default_url|. |
+ // Generates a |key_request| given the |init_data|. |
// Returns kSuccess if the key request was successfully generated, |
// in which case the callee should have allocated memory for the output |
- // parameters (e.g |session_id|) and passed the ownership to the caller. |
- // Returns kErrorUnknown otherwise, in which case the output |
- // parameters should not be used by the caller. |
+ // parameters (e.g |session_id| in |key_request|) and passed the ownership |
+ // to the caller. |
+ // Returns kErrorUnknown otherwise, in which case the output parameters should |
+ // not be used by the caller. |
// |
// TODO(xhwang): It's not safe to pass the ownership of the dynamically |
// allocated memory over library boundaries. Fix it after related PPAPI change |
// and sample CDM are landed. |
virtual Status GenerateKeyRequest(const uint8_t* init_data, |
int init_data_size, |
- char** session_id, |
- int* session_id_size, |
- uint8_t** key_request, |
- int* key_request_size, |
- char** default_url, |
- int* default_url_size) = 0; |
+ KeyRequest* key_request) = 0; |
// Adds the |key| to the CDM to be associated with |key_id|. |
// Returns kSuccess if the key was successfully added. |
@@ -137,9 +143,7 @@ class ContentDecryptionModule { |
// TODO(xhwang): It's not safe to pass the ownership of the dynamically |
// allocated memory over library boundaries. Fix it after related PPAPI change |
// and sample CDM are landed. |
- virtual Status Decrypt(const char* session_id, |
- int session_id_size, |
- const InputBuffer& encrypted_buffer, |
+ virtual Status Decrypt(const InputBuffer& encrypted_buffer, |
OutputBuffer* decrypted_buffer) = 0; |
virtual ~ContentDecryptionModule() {}; |