Chromium Code Reviews| 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/memory/scoped_ptr.h" |
| 14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 15 #include "media/base/channel_layout.h" | |
|
Tom Finegan
2012/10/24 02:27:19
What's this for?
xhwang
2012/10/24 16:40:39
Done.
| |
| 15 #include "media/base/decryptor_client.h" | 16 #include "media/base/decryptor_client.h" |
| 16 #include "media/crypto/aes_decryptor.h" | 17 #include "media/crypto/aes_decryptor.h" |
| 17 #include "webkit/media/crypto/ppapi/content_decryption_module.h" | 18 #include "webkit/media/crypto/ppapi/content_decryption_module.h" |
| 18 | 19 |
| 19 // Enable this to use the fake decoder for testing. | 20 // Enable this to use the fake decoder for testing. |
| 20 // #define CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER | 21 #if 0 |
| 22 #define CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER | |
| 23 #endif | |
| 24 | |
| 25 #if 0 | |
| 26 #define CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER | |
| 27 #endif | |
| 21 | 28 |
| 22 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) | 29 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) |
|
Tom Finegan
2012/10/24 02:27:19
|| defined (CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER)?
xhwang
2012/10/24 16:40:39
Hmm, for best testing coverage, I want to use the
Tom Finegan
2012/10/24 18:06:09
I'll define CLEAR_KEY_CDM_USE_FFMPEG_AUDIO_DECODER
ddorwin
2012/10/24 18:09:31
Please don't. I want to avoid polluting the gyp un
| |
| 23 #undef CLEAR_KEY_CDM_USE_FFMPEG_DECODER | 30 #undef CLEAR_KEY_CDM_USE_FFMPEG_DECODER |
| 24 #endif | 31 #endif |
| 25 | 32 |
| 26 namespace media { | 33 namespace media { |
| 27 class DecoderBuffer; | 34 class DecoderBuffer; |
| 28 } | 35 } |
| 29 | 36 |
| 30 namespace webkit_media { | 37 namespace webkit_media { |
| 31 | 38 |
| 32 class FFmpegCdmVideoDecoder; | 39 class FFmpegCdmVideoDecoder; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 // put in |decrypted_buffer|. If |encrypted_buffer| is empty, the | 125 // put in |decrypted_buffer|. If |encrypted_buffer| is empty, the |
| 119 // |decrypted_buffer| is set to an empty (EOS) buffer. | 126 // |decrypted_buffer| is set to an empty (EOS) buffer. |
| 120 // Returns cdm::kNoKey if no decryption key was available. In this case | 127 // Returns cdm::kNoKey if no decryption key was available. In this case |
| 121 // |decrypted_buffer| should be ignored by the caller. | 128 // |decrypted_buffer| should be ignored by the caller. |
| 122 // Returns cdm::kDecryptError if any decryption error occurred. In this case | 129 // Returns cdm::kDecryptError if any decryption error occurred. In this case |
| 123 // |decrypted_buffer| should be ignored by the caller. | 130 // |decrypted_buffer| should be ignored by the caller. |
| 124 cdm::Status DecryptToMediaDecoderBuffer( | 131 cdm::Status DecryptToMediaDecoderBuffer( |
| 125 const cdm::InputBuffer& encrypted_buffer, | 132 const cdm::InputBuffer& encrypted_buffer, |
| 126 scoped_refptr<media::DecoderBuffer>* decrypted_buffer); | 133 scoped_refptr<media::DecoderBuffer>* decrypted_buffer); |
| 127 | 134 |
| 135 #if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER) | |
| 136 void GenerateFakeAudioFrames(cdm::AudioFrames* audio_frames); | |
| 137 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER | |
| 138 | |
| 128 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) | 139 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) |
| 129 void GenerateFakeVideoFrame(base::TimeDelta timestamp, | 140 void GenerateFakeVideoFrame(base::TimeDelta timestamp, |
| 130 cdm::VideoFrame* video_frame); | 141 cdm::VideoFrame* video_frame); |
| 131 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER | 142 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER |
| 132 | 143 |
| 133 Client client_; | 144 Client client_; |
| 134 media::AesDecryptor decryptor_; | 145 media::AesDecryptor decryptor_; |
| 135 | 146 |
| 136 // Protects the |client_| from being accessed by the |decryptor_| | 147 // Protects the |client_| from being accessed by the |decryptor_| |
| 137 // simultaneously. | 148 // simultaneously. |
| 138 base::Lock client_lock_; | 149 base::Lock client_lock_; |
| 139 | 150 |
| 140 cdm::Allocator* const allocator_; | 151 cdm::Allocator* const allocator_; |
| 141 | 152 |
| 153 #if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER) | |
| 154 int channel_count_; | |
| 155 int bits_per_channel_; | |
| 156 int samples_per_second_; | |
| 157 base::TimeDelta last_timestamp_; | |
| 158 base::TimeDelta last_duration_; | |
| 159 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER | |
| 160 | |
| 142 #if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER) | 161 #if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER) |
| 143 scoped_ptr<FFmpegCdmVideoDecoder> video_decoder_; | 162 scoped_ptr<FFmpegCdmVideoDecoder> video_decoder_; |
| 144 #endif | 163 #endif // CLEAR_KEY_CDM_USE_FFMPEG_DECODER |
| 145 | 164 |
| 146 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) | 165 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) |
| 147 cdm::Size video_size_; | 166 cdm::Size video_size_; |
| 148 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER | 167 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER |
| 149 }; | 168 }; |
| 150 | 169 |
| 151 } // namespace webkit_media | 170 } // namespace webkit_media |
| 152 | 171 |
| 153 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_ | 172 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_ |
| OLD | NEW |