| 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/memory/scoped_ptr.h" |
| 13 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 14 #include "media/base/decryptor_client.h" | 15 #include "media/base/decryptor_client.h" |
| 15 #include "media/crypto/aes_decryptor.h" | 16 #include "media/crypto/aes_decryptor.h" |
| 16 #include "webkit/media/crypto/ppapi/content_decryption_module.h" | 17 #include "webkit/media/crypto/ppapi/content_decryption_module.h" |
| 17 | 18 |
| 18 namespace media { | 19 namespace media { |
| 19 class DecoderBuffer; | 20 class DecoderBuffer; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace webkit_media { | 23 namespace webkit_media { |
| 23 | 24 |
| 25 class FFmpegVideoDecoder; |
| 26 |
| 24 // Clear key implementation of the cdm::ContentDecryptionModule interface. | 27 // Clear key implementation of the cdm::ContentDecryptionModule interface. |
| 25 class ClearKeyCdm : public cdm::ContentDecryptionModule { | 28 class ClearKeyCdm : public cdm::ContentDecryptionModule { |
| 26 public: | 29 public: |
| 27 ClearKeyCdm(); | 30 ClearKeyCdm(); |
| 28 virtual ~ClearKeyCdm(); | 31 virtual ~ClearKeyCdm(); |
| 29 | 32 |
| 30 // ContentDecryptionModule implementation. | 33 // ContentDecryptionModule implementation. |
| 31 virtual cdm::Status GenerateKeyRequest(const uint8_t* init_data, | 34 virtual cdm::Status GenerateKeyRequest(const uint8_t* init_data, |
| 32 int init_data_size, | 35 int init_data_size, |
| 33 cdm::KeyMessage* key_request) OVERRIDE; | 36 cdm::KeyMessage* key_request) OVERRIDE; |
| 34 | 37 |
| 35 virtual cdm::Status AddKey(const char* session_id, | 38 virtual cdm::Status AddKey(const char* session_id, |
| 36 int session_id_size, | 39 int session_id_size, |
| 37 const uint8_t* key, | 40 const uint8_t* key, |
| 38 int key_size, | 41 int key_size, |
| 39 const uint8_t* key_id, | 42 const uint8_t* key_id, |
| 40 int key_id_size) OVERRIDE; | 43 int key_id_size) OVERRIDE; |
| 41 | 44 |
| 42 virtual cdm::Status CancelKeyRequest(const char* session_id, | 45 virtual cdm::Status CancelKeyRequest(const char* session_id, |
| 43 int session_id_size) OVERRIDE; | 46 int session_id_size) OVERRIDE; |
| 44 | 47 |
| 48 virtual cdm::Status InitializeVideoDecoder( |
| 49 const cdm::VideoDecoderConfig& video_decoder_config) OVERRIDE; |
| 50 |
| 51 virtual cdm::Status FlushVideoDecoder() OVERRIDE; |
| 52 |
| 45 virtual cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer, | 53 virtual cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer, |
| 46 cdm::OutputBuffer* decrypted_buffer) OVERRIDE; | 54 cdm::OutputBuffer* decrypted_buffer) OVERRIDE; |
| 47 | 55 |
| 56 virtual cdm::Status DecryptAndDecode(const cdm::InputBuffer& encrypted_buffer, |
| 57 cdm::VideoFrame* video_frame) OVERRIDE; |
| 58 |
| 48 private: | 59 private: |
| 49 class Client : public media::DecryptorClient { | 60 class Client : public media::DecryptorClient { |
| 50 public: | 61 public: |
| 51 enum Status { | 62 enum Status { |
| 52 kKeyAdded, | 63 kKeyAdded, |
| 53 kKeyError, | 64 kKeyError, |
| 54 kKeyMessage, | 65 kKeyMessage, |
| 55 kNeedKey | 66 kNeedKey |
| 56 }; | 67 }; |
| 57 | 68 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 scoped_array<uint8> key_message_; | 101 scoped_array<uint8> key_message_; |
| 91 int key_message_length_; | 102 int key_message_length_; |
| 92 std::string default_url_; | 103 std::string default_url_; |
| 93 }; | 104 }; |
| 94 | 105 |
| 95 Client client_; | 106 Client client_; |
| 96 media::AesDecryptor decryptor_; | 107 media::AesDecryptor decryptor_; |
| 97 // Protects the |client_| from being accessed by the |decryptor_| | 108 // Protects the |client_| from being accessed by the |decryptor_| |
| 98 // simultaneously. | 109 // simultaneously. |
| 99 base::Lock client_lock_; | 110 base::Lock client_lock_; |
| 111 |
| 112 scoped_ptr<FFmpegVideoDecoder> video_decoder_; |
| 100 }; | 113 }; |
| 101 | 114 |
| 102 } // namespace webkit_media | 115 } // namespace webkit_media |
| 103 | 116 |
| 104 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_ | 117 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_ |
| OLD | NEW |