| 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 "ppapi/proxy/ppp_video_decoder_proxy.h" | 5 #include "ppapi/proxy/ppp_video_decoder_proxy.h" |
| 6 | 6 |
| 7 #include "ppapi/proxy/host_dispatcher.h" | 7 #include "ppapi/proxy/host_dispatcher.h" |
| 8 #include "ppapi/proxy/plugin_globals.h" | 8 #include "ppapi/proxy/plugin_globals.h" |
| 9 #include "ppapi/proxy/plugin_resource_tracker.h" | 9 #include "ppapi/proxy/plugin_resource_tracker.h" |
| 10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
| 11 #include "ppapi/proxy/ppb_video_decoder_proxy.h" | 11 #include "ppapi/proxy/ppb_video_decoder_proxy.h" |
| 12 #include "ppapi/thunk/enter.h" | 12 #include "ppapi/thunk/enter.h" |
| 13 #include "ppapi/thunk/ppb_video_decoder_api.h" | 13 #include "ppapi/thunk/ppb_video_decoder_api.h" |
| 14 #include "ppapi/thunk/thunk.h" | 14 #include "ppapi/thunk/thunk.h" |
| 15 | 15 |
| 16 using ppapi::thunk::PPB_VideoDecoder_API; | 16 using ppapi::thunk::PPB_VideoDecoder_API; |
| 17 | 17 |
| 18 namespace ppapi { | 18 namespace ppapi { |
| 19 namespace proxy { | 19 namespace proxy { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 void ProvidePictureBuffers(PP_Instance instance, PP_Resource decoder, | 23 void ProvidePictureBuffers(PP_Instance instance, PP_Resource decoder, |
| 24 uint32_t req_num_of_bufs, | 24 uint32_t req_num_of_bufs, |
| 25 const PP_Size* dimensions) { | 25 const PP_Size* dimensions, |
| 26 PP_VideoDecoder_TextureTarget_Dev texture_target) { |
| 26 HostResource decoder_resource; | 27 HostResource decoder_resource; |
| 27 decoder_resource.SetHostResource(instance, decoder); | 28 decoder_resource.SetHostResource(instance, decoder); |
| 28 | 29 |
| 29 HostDispatcher::GetForInstance(instance)->Send( | 30 HostDispatcher::GetForInstance(instance)->Send( |
| 30 new PpapiMsg_PPPVideoDecoder_ProvidePictureBuffers( | 31 new PpapiMsg_PPPVideoDecoder_ProvidePictureBuffers( |
| 31 API_ID_PPP_VIDEO_DECODER_DEV, | 32 API_ID_PPP_VIDEO_DECODER_DEV, |
| 32 decoder_resource, req_num_of_bufs, *dimensions)); | 33 decoder_resource, req_num_of_bufs, *dimensions, texture_target)); |
| 33 } | 34 } |
| 34 | 35 |
| 35 void DismissPictureBuffer(PP_Instance instance, PP_Resource decoder, | 36 void DismissPictureBuffer(PP_Instance instance, PP_Resource decoder, |
| 36 int32_t picture_buffer_id) { | 37 int32_t picture_buffer_id) { |
| 37 HostResource decoder_resource; | 38 HostResource decoder_resource; |
| 38 decoder_resource.SetHostResource(instance, decoder); | 39 decoder_resource.SetHostResource(instance, decoder); |
| 39 | 40 |
| 40 HostDispatcher::GetForInstance(instance)->Send( | 41 HostDispatcher::GetForInstance(instance)->Send( |
| 41 new PpapiMsg_PPPVideoDecoder_DismissPictureBuffer( | 42 new PpapiMsg_PPPVideoDecoder_DismissPictureBuffer( |
| 42 API_ID_PPP_VIDEO_DECODER_DEV, | 43 API_ID_PPP_VIDEO_DECODER_DEV, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 OnMsgPictureReady) | 112 OnMsgPictureReady) |
| 112 IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoDecoder_NotifyError, | 113 IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoDecoder_NotifyError, |
| 113 OnMsgNotifyError) | 114 OnMsgNotifyError) |
| 114 IPC_MESSAGE_UNHANDLED(handled = false) | 115 IPC_MESSAGE_UNHANDLED(handled = false) |
| 115 IPC_END_MESSAGE_MAP() | 116 IPC_END_MESSAGE_MAP() |
| 116 DCHECK(handled); | 117 DCHECK(handled); |
| 117 return handled; | 118 return handled; |
| 118 } | 119 } |
| 119 | 120 |
| 120 void PPP_VideoDecoder_Proxy::OnMsgProvidePictureBuffers( | 121 void PPP_VideoDecoder_Proxy::OnMsgProvidePictureBuffers( |
| 121 const HostResource& decoder, uint32_t req_num_of_bufs, | 122 const HostResource& decoder, |
| 122 const PP_Size& dimensions) { | 123 uint32_t req_num_of_bufs, |
| 124 const PP_Size& dimensions, |
| 125 PP_VideoDecoder_TextureTarget_Dev texture_target) { |
| 123 PP_Resource plugin_decoder = PluginGlobals::Get()->plugin_resource_tracker()-> | 126 PP_Resource plugin_decoder = PluginGlobals::Get()->plugin_resource_tracker()-> |
| 124 PluginResourceForHostResource(decoder); | 127 PluginResourceForHostResource(decoder); |
| 125 CallWhileUnlocked(ppp_video_decoder_impl_->ProvidePictureBuffers, | 128 CallWhileUnlocked(ppp_video_decoder_impl_->ProvidePictureBuffers, |
| 126 decoder.instance(), | 129 decoder.instance(), |
| 127 plugin_decoder, | 130 plugin_decoder, |
| 128 req_num_of_bufs, | 131 req_num_of_bufs, |
| 129 &dimensions); | 132 &dimensions, |
| 133 texture_target); |
| 130 } | 134 } |
| 131 | 135 |
| 132 void PPP_VideoDecoder_Proxy::OnMsgDismissPictureBuffer( | 136 void PPP_VideoDecoder_Proxy::OnMsgDismissPictureBuffer( |
| 133 const HostResource& decoder, int32_t picture_id) { | 137 const HostResource& decoder, int32_t picture_id) { |
| 134 PP_Resource plugin_decoder = PluginGlobals::Get()->plugin_resource_tracker()-> | 138 PP_Resource plugin_decoder = PluginGlobals::Get()->plugin_resource_tracker()-> |
| 135 PluginResourceForHostResource(decoder); | 139 PluginResourceForHostResource(decoder); |
| 136 CallWhileUnlocked(ppp_video_decoder_impl_->DismissPictureBuffer, | 140 CallWhileUnlocked(ppp_video_decoder_impl_->DismissPictureBuffer, |
| 137 decoder.instance(), | 141 decoder.instance(), |
| 138 plugin_decoder, | 142 plugin_decoder, |
| 139 picture_id); | 143 picture_id); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 154 PP_Resource plugin_decoder = PluginGlobals::Get()->plugin_resource_tracker()-> | 158 PP_Resource plugin_decoder = PluginGlobals::Get()->plugin_resource_tracker()-> |
| 155 PluginResourceForHostResource(decoder); | 159 PluginResourceForHostResource(decoder); |
| 156 CallWhileUnlocked(ppp_video_decoder_impl_->NotifyError, | 160 CallWhileUnlocked(ppp_video_decoder_impl_->NotifyError, |
| 157 decoder.instance(), | 161 decoder.instance(), |
| 158 plugin_decoder, | 162 plugin_decoder, |
| 159 error); | 163 error); |
| 160 } | 164 } |
| 161 | 165 |
| 162 } // namespace proxy | 166 } // namespace proxy |
| 163 } // namespace ppapi | 167 } // namespace ppapi |
| OLD | NEW |