| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_ | 5 #ifndef WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_ |
| 6 #define WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_ | 6 #define WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 14 #include "media/base/decryptor_client.h" | 14 #include "media/base/decryptor_client.h" |
| 15 #include "media/crypto/aes_decryptor.h" | 15 #include "media/crypto/aes_decryptor.h" |
| 16 #include "webkit/media/crypto/ppapi/content_decryption_module.h" | 16 #include "webkit/media/crypto/ppapi/content_decryption_module.h" |
| 17 | 17 |
| 18 namespace media { | 18 namespace media { |
| 19 class DecoderBuffer; | 19 class DecoderBuffer; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace webkit_media { | 22 namespace webkit_media { |
| 23 | 23 |
| 24 // Clear key implementation of the cdm::ContentDecryptionModule interface. | 24 // Clear key implementation of the cdm::ContentDecryptionModule interface. |
| 25 class ClearKeyCdm : public cdm::ContentDecryptionModule { | 25 class ClearKeyCdm : public cdm::ContentDecryptionModule { |
| 26 public: | 26 public: |
| 27 ClearKeyCdm(); | 27 explicit ClearKeyCdm(cdm::Allocator* allocator); |
| 28 virtual ~ClearKeyCdm(); | 28 virtual ~ClearKeyCdm(); |
| 29 | 29 |
| 30 // ContentDecryptionModule implementation. | 30 // ContentDecryptionModule implementation. |
| 31 virtual cdm::Status GenerateKeyRequest(const uint8_t* init_data, | 31 virtual cdm::Status GenerateKeyRequest( |
| 32 int init_data_size, | 32 const uint8_t* init_data, |
| 33 cdm::KeyMessage* key_request) OVERRIDE; | 33 int init_data_size, |
| 34 cdm::KeyMessage* key_request) OVERRIDE; |
| 34 virtual cdm::Status AddKey(const char* session_id, | 35 virtual cdm::Status AddKey(const char* session_id, |
| 35 int session_id_size, | 36 int session_id_size, |
| 36 const uint8_t* key, | 37 const uint8_t* key, |
| 37 int key_size, | 38 int key_size, |
| 38 const uint8_t* key_id, | 39 const uint8_t* key_id, |
| 39 int key_id_size) OVERRIDE; | 40 int key_id_size) OVERRIDE; |
| 40 virtual cdm::Status CancelKeyRequest(const char* session_id, | 41 virtual cdm::Status CancelKeyRequest(const char* session_id, |
| 41 int session_id_size) OVERRIDE; | 42 int session_id_size) OVERRIDE; |
| 42 virtual cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer, | 43 virtual cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer, |
| 43 cdm::OutputBuffer* decrypted_buffer) OVERRIDE; | 44 cdm::OutputBuffer* decrypted_buffer) OVERRIDE; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 private: | 92 private: |
| 92 Status status_; | 93 Status status_; |
| 93 std::string session_id_; | 94 std::string session_id_; |
| 94 scoped_array<uint8> key_message_; | 95 scoped_array<uint8> key_message_; |
| 95 int key_message_length_; | 96 int key_message_length_; |
| 96 std::string default_url_; | 97 std::string default_url_; |
| 97 }; | 98 }; |
| 98 | 99 |
| 99 Client client_; | 100 Client client_; |
| 100 media::AesDecryptor decryptor_; | 101 media::AesDecryptor decryptor_; |
| 102 |
| 101 // Protects the |client_| from being accessed by the |decryptor_| | 103 // Protects the |client_| from being accessed by the |decryptor_| |
| 102 // simultaneously. | 104 // simultaneously. |
| 103 base::Lock client_lock_; | 105 base::Lock client_lock_; |
| 106 |
| 107 cdm::Allocator* const allocator_; |
| 104 }; | 108 }; |
| 105 | 109 |
| 106 } // namespace webkit_media | 110 } // namespace webkit_media |
| 107 | 111 |
| 108 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_ | 112 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_ |
| OLD | NEW |