| 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 // Enable this to use the fake decoder for testing. | 19 // Enable this to use the fake decoder for testing. |
| 19 // #define CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER | 20 // #define CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER |
| 20 | 21 |
| 22 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) |
| 23 #undef CLEAR_KEY_CDM_USE_FFMPEG_DECODER |
| 24 #endif |
| 25 |
| 21 namespace media { | 26 namespace media { |
| 22 class DecoderBuffer; | 27 class DecoderBuffer; |
| 23 } | 28 } |
| 24 | 29 |
| 25 namespace webkit_media { | 30 namespace webkit_media { |
| 26 | 31 |
| 32 class FFmpegCdmVideoDecoder; |
| 33 |
| 27 // Clear key implementation of the cdm::ContentDecryptionModule interface. | 34 // Clear key implementation of the cdm::ContentDecryptionModule interface. |
| 28 class ClearKeyCdm : public cdm::ContentDecryptionModule { | 35 class ClearKeyCdm : public cdm::ContentDecryptionModule { |
| 29 public: | 36 public: |
| 30 explicit ClearKeyCdm(cdm::Allocator* allocator, cdm::CdmHost*); | 37 explicit ClearKeyCdm(cdm::Allocator* allocator, cdm::CdmHost*); |
| 31 virtual ~ClearKeyCdm(); | 38 virtual ~ClearKeyCdm(); |
| 32 | 39 |
| 33 // ContentDecryptionModule implementation. | 40 // ContentDecryptionModule implementation. |
| 34 virtual cdm::Status GenerateKeyRequest( | 41 virtual cdm::Status GenerateKeyRequest( |
| 35 const uint8_t* init_data, | 42 const uint8_t* init_data, |
| 36 int init_data_size, | 43 int init_data_size, |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 120 |
| 114 Client client_; | 121 Client client_; |
| 115 media::AesDecryptor decryptor_; | 122 media::AesDecryptor decryptor_; |
| 116 | 123 |
| 117 // Protects the |client_| from being accessed by the |decryptor_| | 124 // Protects the |client_| from being accessed by the |decryptor_| |
| 118 // simultaneously. | 125 // simultaneously. |
| 119 base::Lock client_lock_; | 126 base::Lock client_lock_; |
| 120 | 127 |
| 121 cdm::Allocator* const allocator_; | 128 cdm::Allocator* const allocator_; |
| 122 | 129 |
| 130 #if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER) |
| 131 scoped_ptr<FFmpegCdmVideoDecoder> video_decoder_; |
| 132 #endif |
| 133 |
| 123 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) | 134 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) |
| 124 cdm::Size video_size_; | 135 cdm::Size video_size_; |
| 125 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER | 136 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER |
| 126 }; | 137 }; |
| 127 | 138 |
| 128 } // namespace webkit_media | 139 } // namespace webkit_media |
| 129 | 140 |
| 130 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_ | 141 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_ |
| OLD | NEW |