| 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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace webkit_media { | 28 namespace webkit_media { |
| 29 | 29 |
| 30 class CdmVideoDecoder; | 30 class CdmVideoDecoder; |
| 31 class FFmpegCdmAudioDecoder; | 31 class FFmpegCdmAudioDecoder; |
| 32 | 32 |
| 33 // Clear key implementation of the cdm::ContentDecryptionModule interface. | 33 // Clear key implementation of the cdm::ContentDecryptionModule interface. |
| 34 class ClearKeyCdm : public cdm::ContentDecryptionModule { | 34 class ClearKeyCdm : public cdm::ContentDecryptionModule { |
| 35 public: | 35 public: |
| 36 ClearKeyCdm(cdm::Allocator* allocator, cdm::Host* host); | 36 ClearKeyCdm(cdm::Host* host); |
| 37 virtual ~ClearKeyCdm(); | 37 virtual ~ClearKeyCdm(); |
| 38 | 38 |
| 39 // ContentDecryptionModule implementation. | 39 // ContentDecryptionModule implementation. |
| 40 virtual cdm::Status GenerateKeyRequest( | 40 virtual cdm::Status GenerateKeyRequest( |
| 41 const char* type, int type_size, | 41 const char* type, int type_size, |
| 42 const uint8_t* init_data, int init_data_size) OVERRIDE; | 42 const uint8_t* init_data, int init_data_size) OVERRIDE; |
| 43 virtual cdm::Status AddKey(const char* session_id, int session_id_size, | 43 virtual cdm::Status AddKey(const char* session_id, int session_id_size, |
| 44 const uint8_t* key, int key_size, | 44 const uint8_t* key, int key_size, |
| 45 const uint8_t* key_id, int key_id_size) OVERRIDE; | 45 const uint8_t* key_id, int key_id_size) OVERRIDE; |
| 46 virtual cdm::Status CancelKeyRequest(const char* session_id, | 46 virtual cdm::Status CancelKeyRequest(const char* session_id, |
| 47 int session_id_size) OVERRIDE; | 47 int session_id_size) OVERRIDE; |
| 48 virtual void TimerExpired(void* context) OVERRIDE; | 48 virtual void TimerExpired(void* context) OVERRIDE; |
| 49 virtual cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer, | 49 virtual cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer, |
| 50 cdm::DecryptedBlock* decrypted_block) OVERRIDE; | 50 cdm::DecryptedBlock* decrypted_block) OVERRIDE; |
| 51 virtual cdm::Status InitializeAudioDecoder( | 51 virtual cdm::Status InitializeAudioDecoder( |
| 52 const cdm::AudioDecoderConfig& audio_decoder_config) OVERRIDE; | 52 const cdm::AudioDecoderConfig& audio_decoder_config) OVERRIDE; |
| 53 virtual cdm::Status InitializeVideoDecoder( | 53 virtual cdm::Status InitializeVideoDecoder( |
| 54 const cdm::VideoDecoderConfig& video_decoder_config) OVERRIDE; | 54 const cdm::VideoDecoderConfig& video_decoder_config) OVERRIDE; |
| 55 virtual void DeinitializeDecoder(cdm::StreamType decoder_type) OVERRIDE; | 55 virtual void DeinitializeDecoder(cdm::StreamType decoder_type) OVERRIDE; |
| 56 virtual void ResetDecoder(cdm::StreamType decoder_type) OVERRIDE; | 56 virtual void ResetDecoder(cdm::StreamType decoder_type) OVERRIDE; |
| 57 virtual cdm::Status DecryptAndDecodeFrame( | 57 virtual cdm::Status DecryptAndDecodeFrame( |
| 58 const cdm::InputBuffer& encrypted_buffer, | 58 const cdm::InputBuffer& encrypted_buffer, |
| 59 cdm::VideoFrame* video_frame) OVERRIDE; | 59 cdm::VideoFrame* video_frame) OVERRIDE; |
| 60 virtual cdm::Status DecryptAndDecodeSamples( | 60 virtual cdm::Status DecryptAndDecodeSamples( |
| 61 const cdm::InputBuffer& encrypted_buffer, | 61 const cdm::InputBuffer& encrypted_buffer, |
| 62 cdm::AudioFrames* audio_frames) OVERRIDE; | 62 cdm::AudioFrames* audio_frames) OVERRIDE; |
| 63 virtual void Destroy() OVERRIDE; |
| 63 | 64 |
| 64 private: | 65 private: |
| 65 // TODO(xhwang): After we removed DecryptorClient. We probably can also remove | 66 // TODO(xhwang): After we removed DecryptorClient. We probably can also remove |
| 66 // this Client class as well. Investigate this possibility. | 67 // this Client class as well. Investigate this possibility. |
| 67 class Client { | 68 class Client { |
| 68 public: | 69 public: |
| 69 enum Status { | 70 enum Status { |
| 70 kKeyAdded, | 71 kKeyAdded, |
| 71 kKeyError, | 72 kKeyError, |
| 72 kKeyMessage, | 73 kKeyMessage, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 cdm::AudioFrames* audio_frames); | 135 cdm::AudioFrames* audio_frames); |
| 135 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER | 136 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER |
| 136 | 137 |
| 137 Client client_; | 138 Client client_; |
| 138 media::AesDecryptor decryptor_; | 139 media::AesDecryptor decryptor_; |
| 139 | 140 |
| 140 // Protects the |client_| from being accessed by the |decryptor_| | 141 // Protects the |client_| from being accessed by the |decryptor_| |
| 141 // simultaneously. | 142 // simultaneously. |
| 142 base::Lock client_lock_; | 143 base::Lock client_lock_; |
| 143 | 144 |
| 144 cdm::Allocator* const allocator_; | |
| 145 cdm::Host* host_; | 145 cdm::Host* host_; |
| 146 | 146 |
| 147 std::string heartbeat_session_id_; | 147 std::string heartbeat_session_id_; |
| 148 std::string next_heartbeat_message_; | 148 std::string next_heartbeat_message_; |
| 149 | 149 |
| 150 // Timer delay in milliseconds for the next host_->SetTimer() call. | 150 // Timer delay in milliseconds for the next host_->SetTimer() call. |
| 151 int64 timer_delay_ms_; | 151 int64 timer_delay_ms_; |
| 152 | 152 |
| 153 // Indicates whether a timer has been set to prevent multiple timers from | 153 // Indicates whether a timer has been set to prevent multiple timers from |
| 154 // running. | 154 // running. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 167 #endif // CLEAR_KEY_CDM_USE_FFMPEG_DECODER | 167 #endif // CLEAR_KEY_CDM_USE_FFMPEG_DECODER |
| 168 | 168 |
| 169 scoped_ptr<CdmVideoDecoder> video_decoder_; | 169 scoped_ptr<CdmVideoDecoder> video_decoder_; |
| 170 | 170 |
| 171 DISALLOW_COPY_AND_ASSIGN(ClearKeyCdm); | 171 DISALLOW_COPY_AND_ASSIGN(ClearKeyCdm); |
| 172 }; | 172 }; |
| 173 | 173 |
| 174 } // namespace webkit_media | 174 } // namespace webkit_media |
| 175 | 175 |
| 176 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_ | 176 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_ |
| OLD | NEW |