| 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/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
| (...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1539 | 1539 |
| 1540 DCHECK(!ContainsKey(pending_decryption_cbs_, request_id)); | 1540 DCHECK(!ContainsKey(pending_decryption_cbs_, request_id)); |
| 1541 pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb)); | 1541 pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb)); |
| 1542 | 1542 |
| 1543 plugin_decryption_interface_->Decrypt(pp_instance(), | 1543 plugin_decryption_interface_->Decrypt(pp_instance(), |
| 1544 encrypted_resource, | 1544 encrypted_resource, |
| 1545 &block_info); | 1545 &block_info); |
| 1546 return true; | 1546 return true; |
| 1547 } | 1547 } |
| 1548 | 1548 |
| 1549 bool PluginInstance::DeinitializeDecoder() { |
| 1550 if (!LoadContentDecryptorInterface()) |
| 1551 return false; |
| 1552 |
| 1553 // TODO(tomfinegan): Add decoder deinitialize request tracking, and get |
| 1554 // stream type from media stack. |
| 1555 plugin_decryption_interface_->DeinitializeDecoder(pp_instance(), |
| 1556 PP_STREAMTYPE_VIDEO, |
| 1557 0); |
| 1558 return true; |
| 1559 } |
| 1560 |
| 1561 bool PluginInstance::ResetDecoder() { |
| 1562 if (!LoadContentDecryptorInterface()) |
| 1563 return false; |
| 1564 |
| 1565 // TODO(tomfinegan): Add decoder reset request tracking, and get |
| 1566 // stream type from media stack. |
| 1567 plugin_decryption_interface_->ResetDecoder(pp_instance(), |
| 1568 PP_STREAMTYPE_VIDEO, |
| 1569 0); |
| 1570 return true; |
| 1571 } |
| 1572 |
| 1549 // Note: this method can be used with an unencrypted frame. | 1573 // Note: this method can be used with an unencrypted frame. |
| 1550 bool PluginInstance::DecryptAndDecodeFrame( | 1574 bool PluginInstance::DecryptAndDecodeFrame( |
| 1551 const scoped_refptr<media::DecoderBuffer>& encrypted_frame, | 1575 const scoped_refptr<media::DecoderBuffer>& encrypted_frame, |
| 1552 const media::Decryptor::DecryptCB& decrypt_cb) { | 1576 const media::Decryptor::DecryptCB& decrypt_cb) { |
| 1553 if (!LoadContentDecryptorInterface()) | 1577 if (!LoadContentDecryptorInterface()) |
| 1554 return false; | 1578 return false; |
| 1555 | 1579 |
| 1556 ScopedPPResource encrypted_resource(MakeBufferResource( | 1580 ScopedPPResource encrypted_resource(MakeBufferResource( |
| 1557 pp_instance(), | 1581 pp_instance(), |
| 1558 encrypted_frame->GetData(), | 1582 encrypted_frame->GetData(), |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2272 } | 2296 } |
| 2273 | 2297 |
| 2274 DCHECK(decryptor_client_); | 2298 DCHECK(decryptor_client_); |
| 2275 decryptor_client_->KeyError( | 2299 decryptor_client_->KeyError( |
| 2276 key_system_string->value(), | 2300 key_system_string->value(), |
| 2277 session_id_string->value(), | 2301 session_id_string->value(), |
| 2278 static_cast<media::Decryptor::KeyError>(media_error), | 2302 static_cast<media::Decryptor::KeyError>(media_error), |
| 2279 system_code); | 2303 system_code); |
| 2280 } | 2304 } |
| 2281 | 2305 |
| 2306 void PluginInstance::DecoderDeinitializeDone(PP_Instance instance, |
| 2307 PP_StreamType decoder_type, |
| 2308 uint32_t request_id) { |
| 2309 // TODO(tomfinegan): Add decoder stop completion handling. |
| 2310 } |
| 2311 |
| 2312 void PluginInstance::DecoderResetDone(PP_Instance instance, |
| 2313 PP_StreamType decoder_type, |
| 2314 uint32_t request_id) { |
| 2315 // TODO(tomfinegan): Add decoder reset completion handling. |
| 2316 } |
| 2317 |
| 2282 void PluginInstance::DeliverBlock(PP_Instance instance, | 2318 void PluginInstance::DeliverBlock(PP_Instance instance, |
| 2283 PP_Resource decrypted_block, | 2319 PP_Resource decrypted_block, |
| 2284 const PP_DecryptedBlockInfo* block_info) { | 2320 const PP_DecryptedBlockInfo* block_info) { |
| 2285 DCHECK(block_info); | 2321 DCHECK(block_info); |
| 2286 DecryptionCBMap::iterator found = pending_decryption_cbs_.find( | 2322 DecryptionCBMap::iterator found = pending_decryption_cbs_.find( |
| 2287 block_info->tracking_info.request_id); | 2323 block_info->tracking_info.request_id); |
| 2288 if (found == pending_decryption_cbs_.end()) | 2324 if (found == pending_decryption_cbs_.end()) |
| 2289 return; | 2325 return; |
| 2290 media::Decryptor::DecryptCB decrypt_cb = found->second; | 2326 media::Decryptor::DecryptCB decrypt_cb = found->second; |
| 2291 pending_decryption_cbs_.erase(found); | 2327 pending_decryption_cbs_.erase(found); |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2708 screen_size_for_fullscreen_ = gfx::Size(); | 2744 screen_size_for_fullscreen_ = gfx::Size(); |
| 2709 WebElement element = container_->element(); | 2745 WebElement element = container_->element(); |
| 2710 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2746 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
| 2711 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2747 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
| 2712 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2748 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
| 2713 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2749 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
| 2714 } | 2750 } |
| 2715 | 2751 |
| 2716 } // namespace ppapi | 2752 } // namespace ppapi |
| 2717 } // namespace webkit | 2753 } // namespace webkit |
| OLD | NEW |