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 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1599 MakeBufferResource(pp_instance(), | 1599 MakeBufferResource(pp_instance(), |
1600 decoder_config.extra_data(), | 1600 decoder_config.extra_data(), |
1601 decoder_config.extra_data_size())); | 1601 decoder_config.extra_data_size())); |
1602 | 1602 |
1603 plugin_decryption_interface_->InitializeVideoDecoder(pp_instance(), | 1603 plugin_decryption_interface_->InitializeVideoDecoder(pp_instance(), |
1604 &pp_decoder_config, | 1604 &pp_decoder_config, |
1605 extra_data_resource); | 1605 extra_data_resource); |
1606 return true; | 1606 return true; |
1607 } | 1607 } |
1608 | 1608 |
| 1609 bool PluginInstance::DeinitializeDecoder() { |
| 1610 if (!LoadContentDecryptorInterface()) |
| 1611 return false; |
| 1612 |
| 1613 // TODO(tomfinegan): Add decoder deinitialize request tracking, and get |
| 1614 // stream type from media stack. |
| 1615 plugin_decryption_interface_->DeinitializeDecoder( |
| 1616 pp_instance(), |
| 1617 PP_DECRYPTORSTREAMTYPE_VIDEO, |
| 1618 0); |
| 1619 return true; |
| 1620 } |
| 1621 |
| 1622 bool PluginInstance::ResetDecoder() { |
| 1623 if (!LoadContentDecryptorInterface()) |
| 1624 return false; |
| 1625 |
| 1626 // TODO(tomfinegan): Add decoder reset request tracking, and get |
| 1627 // stream type from media stack. |
| 1628 plugin_decryption_interface_->ResetDecoder(pp_instance(), |
| 1629 PP_DECRYPTORSTREAMTYPE_VIDEO, |
| 1630 0); |
| 1631 return true; |
| 1632 } |
| 1633 |
1609 bool PluginInstance::DecryptAndDecodeFrame( | 1634 bool PluginInstance::DecryptAndDecodeFrame( |
1610 const scoped_refptr<media::DecoderBuffer>& encrypted_frame, | 1635 const scoped_refptr<media::DecoderBuffer>& encrypted_frame, |
1611 const media::Decryptor::DecryptCB& decrypt_cb) { | 1636 const media::Decryptor::DecryptCB& decrypt_cb) { |
1612 if (!LoadContentDecryptorInterface()) | 1637 if (!LoadContentDecryptorInterface()) |
1613 return false; | 1638 return false; |
1614 | 1639 |
1615 ScopedPPResource encrypted_resource(MakeBufferResource( | 1640 ScopedPPResource encrypted_resource(MakeBufferResource( |
1616 pp_instance(), | 1641 pp_instance(), |
1617 encrypted_frame->GetData(), | 1642 encrypted_frame->GetData(), |
1618 encrypted_frame->GetDataSize())); | 1643 encrypted_frame->GetDataSize())); |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2347 return; | 2372 return; |
2348 media::Decryptor::DecryptCB decrypt_cb = found->second; | 2373 media::Decryptor::DecryptCB decrypt_cb = found->second; |
2349 pending_decryption_cbs_.erase(found); | 2374 pending_decryption_cbs_.erase(found); |
2350 | 2375 |
2351 media::Decryptor::Status status = | 2376 media::Decryptor::Status status = |
2352 success == PP_TRUE ? media::Decryptor::kSuccess : | 2377 success == PP_TRUE ? media::Decryptor::kSuccess : |
2353 media::Decryptor::kError; | 2378 media::Decryptor::kError; |
2354 decrypt_cb.Run(status, NULL); | 2379 decrypt_cb.Run(status, NULL); |
2355 } | 2380 } |
2356 | 2381 |
| 2382 void PluginInstance::DecoderDeinitializeDone( |
| 2383 PP_Instance instance, |
| 2384 PP_DecryptorStreamType decoder_type, |
| 2385 uint32_t request_id) { |
| 2386 // TODO(tomfinegan): Add decoder stop completion handling. |
| 2387 } |
| 2388 |
| 2389 void PluginInstance::DecoderResetDone(PP_Instance instance, |
| 2390 PP_DecryptorStreamType decoder_type, |
| 2391 uint32_t request_id) { |
| 2392 // TODO(tomfinegan): Add decoder reset completion handling. |
| 2393 } |
| 2394 |
2357 void PluginInstance::DeliverBlock(PP_Instance instance, | 2395 void PluginInstance::DeliverBlock(PP_Instance instance, |
2358 PP_Resource decrypted_block, | 2396 PP_Resource decrypted_block, |
2359 const PP_DecryptedBlockInfo* block_info) { | 2397 const PP_DecryptedBlockInfo* block_info) { |
2360 DCHECK(block_info); | 2398 DCHECK(block_info); |
2361 DecryptionCBMap::iterator found = pending_decryption_cbs_.find( | 2399 DecryptionCBMap::iterator found = pending_decryption_cbs_.find( |
2362 block_info->tracking_info.request_id); | 2400 block_info->tracking_info.request_id); |
2363 if (found == pending_decryption_cbs_.end()) | 2401 if (found == pending_decryption_cbs_.end()) |
2364 return; | 2402 return; |
2365 media::Decryptor::DecryptCB decrypt_cb = found->second; | 2403 media::Decryptor::DecryptCB decrypt_cb = found->second; |
2366 pending_decryption_cbs_.erase(found); | 2404 pending_decryption_cbs_.erase(found); |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2789 screen_size_for_fullscreen_ = gfx::Size(); | 2827 screen_size_for_fullscreen_ = gfx::Size(); |
2790 WebElement element = container_->element(); | 2828 WebElement element = container_->element(); |
2791 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2829 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
2792 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2830 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
2793 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2831 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
2794 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2832 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
2795 } | 2833 } |
2796 | 2834 |
2797 } // namespace ppapi | 2835 } // namespace ppapi |
2798 } // namespace webkit | 2836 } // namespace webkit |
OLD | NEW |