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 #include "webkit/media/crypto/proxy_decryptor.h" | 5 #include "webkit/media/crypto/proxy_decryptor.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/message_loop_proxy.h" | 11 #include "base/message_loop_proxy.h" |
12 #include "media/base/decoder_buffer.h" | 12 #include "media/base/decoder_buffer.h" |
13 #include "media/base/decryptor_client.h" | 13 #include "media/base/decryptor_client.h" |
| 14 #include "media/base/video_decoder_config.h" |
| 15 #include "media/base/video_frame.h" |
14 #include "media/crypto/aes_decryptor.h" | 16 #include "media/crypto/aes_decryptor.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
17 #include "webkit/media/crypto/key_systems.h" | 19 #include "webkit/media/crypto/key_systems.h" |
18 #include "webkit/media/crypto/ppapi_decryptor.h" | 20 #include "webkit/media/crypto/ppapi_decryptor.h" |
19 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 21 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
20 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" | 22 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" |
21 // TODO(xhwang): Put this include after "ppapi_plugin_instance.h" for definition | 23 // TODO(xhwang): Put this include after "ppapi_plugin_instance.h" for definition |
22 // of "uint8_t", which WebMediaPlayer.h uses without including a header for it. | 24 // of "uint8_t", which WebMediaPlayer.h uses without including a header for it. |
23 // See: https://bugs.webkit.org/show_bug.cgi?id=92031 | 25 // See: https://bugs.webkit.org/show_bug.cgi?id=92031 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 if (!is_waiting_for_decryptor_) { | 169 if (!is_waiting_for_decryptor_) { |
168 pending_buffer_to_decrypt_ = NULL; | 170 pending_buffer_to_decrypt_ = NULL; |
169 base::ResetAndReturn(&pending_decrypt_cb_).Run(kSuccess, NULL); | 171 base::ResetAndReturn(&pending_decrypt_cb_).Run(kSuccess, NULL); |
170 return; | 172 return; |
171 } | 173 } |
172 | 174 |
173 is_canceling_decrypt_ = true; | 175 is_canceling_decrypt_ = true; |
174 decryptor_->CancelDecrypt(); | 176 decryptor_->CancelDecrypt(); |
175 } | 177 } |
176 | 178 |
| 179 void ProxyDecryptor::InitializeVideoDecoder( |
| 180 const media::VideoDecoderConfig& config, |
| 181 const DecoderInitCB& init_cb) { |
| 182 // TODO(xhwang): Implement this! |
| 183 NOTIMPLEMENTED(); |
| 184 init_cb.Run(false); |
| 185 } |
| 186 |
| 187 void ProxyDecryptor::DecryptAndDecodeVideo( |
| 188 const scoped_refptr<media::DecoderBuffer>& encrypted, |
| 189 const VideoDecodeCB& video_decode_cb) { |
| 190 // TODO(xhwang): Implement this! |
| 191 NOTIMPLEMENTED(); |
| 192 video_decode_cb.Run(kError, NULL); |
| 193 } |
| 194 |
| 195 void ProxyDecryptor::CancelDecryptAndDecodeVideo() { |
| 196 // TODO(xhwang): Implement this! |
| 197 NOTIMPLEMENTED(); |
| 198 } |
| 199 |
| 200 void ProxyDecryptor::StopVideoDecoder() { |
| 201 // TODO(xhwang): Implement this! |
| 202 NOTIMPLEMENTED(); |
| 203 } |
| 204 |
177 scoped_ptr<media::Decryptor> ProxyDecryptor::CreatePpapiDecryptor( | 205 scoped_ptr<media::Decryptor> ProxyDecryptor::CreatePpapiDecryptor( |
178 const std::string& key_system) { | 206 const std::string& key_system) { |
179 DCHECK(client_); | 207 DCHECK(client_); |
180 DCHECK(web_media_player_client_); | 208 DCHECK(web_media_player_client_); |
181 DCHECK(web_frame_); | 209 DCHECK(web_frame_); |
182 | 210 |
183 std::string plugin_type = GetPluginType(key_system); | 211 std::string plugin_type = GetPluginType(key_system); |
184 DCHECK(!plugin_type.empty()); | 212 DCHECK(!plugin_type.empty()); |
185 const scoped_refptr<webkit::ppapi::PluginInstance>& plugin_instance = | 213 const scoped_refptr<webkit::ppapi::PluginInstance>& plugin_instance = |
186 CreatePluginInstance(plugin_type, web_media_player_client_, web_frame_); | 214 CreatePluginInstance(plugin_type, web_media_player_client_, web_frame_); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 return; | 309 return; |
282 } | 310 } |
283 | 311 |
284 // TODO(xhwang): The same NeedKey may be fired multiple times here and also | 312 // TODO(xhwang): The same NeedKey may be fired multiple times here and also |
285 // in Decrypt(). While the spec says only one NeedKey should be fired. Leave | 313 // in Decrypt(). While the spec says only one NeedKey should be fired. Leave |
286 // them as is since the spec about this may change. | 314 // them as is since the spec about this may change. |
287 FireNeedKey(client_, pending_buffer_to_decrypt_); | 315 FireNeedKey(client_, pending_buffer_to_decrypt_); |
288 } | 316 } |
289 | 317 |
290 } // namespace webkit_media | 318 } // namespace webkit_media |
OLD | NEW |