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/decryptor_client.h" | 15 #include "media/base/decryptor_client.h" |
| 16 #include "media/crypto/aes_decryptor.h" | 16 #include "media/crypto/aes_decryptor.h" |
| 17 #include "webkit/media/crypto/ppapi/content_decryption_module.h" | 17 #include "webkit/media/crypto/ppapi/content_decryption_module.h" |
| 18 | 18 |
| 19 // Enable this to use the fake decoder for testing. | 19 // Enable this to use the fake decoder for testing. |
| 20 // #define CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER | 20 #if 0 |
| 21 #define CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER | |
| 22 #endif | |
| 23 | |
| 24 #if 0 | |
| 25 #define CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER | |
| 26 #endif | |
| 21 | 27 |
| 22 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) | 28 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) |
| 23 #undef CLEAR_KEY_CDM_USE_FFMPEG_DECODER | 29 #undef CLEAR_KEY_CDM_USE_FFMPEG_DECODER |
|
ddorwin
2012/10/24 17:59:27
Do we really want separate FFMPEG uses for video a
xhwang
2012/10/24 19:45:57
Do you want me to fix this here? Or in Tom's ffmpe
ddorwin
2012/10/24 20:08:37
In patch 2, Tom said he will add a TODO, then we'l
| |
| 24 #endif | 30 #endif |
| 25 | 31 |
| 26 namespace media { | 32 namespace media { |
| 27 class DecoderBuffer; | 33 class DecoderBuffer; |
| 28 } | 34 } |
| 29 | 35 |
| 30 namespace webkit_media { | 36 namespace webkit_media { |
| 31 | 37 |
| 32 class FFmpegCdmVideoDecoder; | 38 class FFmpegCdmVideoDecoder; |
| 33 | 39 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 // put in |decrypted_buffer|. If |encrypted_buffer| is empty, the | 124 // put in |decrypted_buffer|. If |encrypted_buffer| is empty, the |
| 119 // |decrypted_buffer| is set to an empty (EOS) buffer. | 125 // |decrypted_buffer| is set to an empty (EOS) buffer. |
| 120 // Returns cdm::kNoKey if no decryption key was available. In this case | 126 // Returns cdm::kNoKey if no decryption key was available. In this case |
| 121 // |decrypted_buffer| should be ignored by the caller. | 127 // |decrypted_buffer| should be ignored by the caller. |
| 122 // Returns cdm::kDecryptError if any decryption error occurred. In this case | 128 // Returns cdm::kDecryptError if any decryption error occurred. In this case |
| 123 // |decrypted_buffer| should be ignored by the caller. | 129 // |decrypted_buffer| should be ignored by the caller. |
| 124 cdm::Status DecryptToMediaDecoderBuffer( | 130 cdm::Status DecryptToMediaDecoderBuffer( |
| 125 const cdm::InputBuffer& encrypted_buffer, | 131 const cdm::InputBuffer& encrypted_buffer, |
| 126 scoped_refptr<media::DecoderBuffer>* decrypted_buffer); | 132 scoped_refptr<media::DecoderBuffer>* decrypted_buffer); |
| 127 | 133 |
| 134 #if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER) | |
| 135 void GenerateFakeAudioFrames(cdm::AudioFrames* audio_frames); | |
| 136 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER | |
| 137 | |
| 128 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) | 138 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) |
| 129 void GenerateFakeVideoFrame(base::TimeDelta timestamp, | 139 void GenerateFakeVideoFrame(base::TimeDelta timestamp, |
| 130 cdm::VideoFrame* video_frame); | 140 cdm::VideoFrame* video_frame); |
| 131 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER | 141 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER |
| 132 | 142 |
| 133 Client client_; | 143 Client client_; |
| 134 media::AesDecryptor decryptor_; | 144 media::AesDecryptor decryptor_; |
| 135 | 145 |
| 136 // Protects the |client_| from being accessed by the |decryptor_| | 146 // Protects the |client_| from being accessed by the |decryptor_| |
| 137 // simultaneously. | 147 // simultaneously. |
| 138 base::Lock client_lock_; | 148 base::Lock client_lock_; |
| 139 | 149 |
| 140 cdm::Allocator* const allocator_; | 150 cdm::Allocator* const allocator_; |
| 141 | 151 |
| 152 #if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER) | |
| 153 int channel_count_; | |
| 154 int bits_per_channel_; | |
| 155 int samples_per_second_; | |
| 156 base::TimeDelta last_timestamp_; | |
| 157 base::TimeDelta last_duration_; | |
| 158 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER | |
| 159 | |
| 142 #if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER) | 160 #if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER) |
| 143 scoped_ptr<FFmpegCdmVideoDecoder> video_decoder_; | 161 scoped_ptr<FFmpegCdmVideoDecoder> video_decoder_; |
| 144 #endif | 162 #endif // CLEAR_KEY_CDM_USE_FFMPEG_DECODER |
| 145 | 163 |
| 146 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) | 164 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) |
| 147 cdm::Size video_size_; | 165 cdm::Size video_size_; |
| 148 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER | 166 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER |
| 149 }; | 167 }; |
| 150 | 168 |
| 151 } // namespace webkit_media | 169 } // namespace webkit_media |
| 152 | 170 |
| 153 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_ | 171 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_ |
| OLD | NEW |