[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "ppapi/proxy/ppb_video_decoder_proxy.h" |
| 6 | |
| 7 | #include "base/logging.h" |
| 8 | #include "gpu/command_buffer/client/gles2_implementation.h" |
| 9 | #include "ppapi/proxy/enter_proxy.h" |
| 10 | #include "ppapi/proxy/plugin_dispatcher.h" |
| 11 | #include "ppapi/proxy/ppapi_messages.h" |
| 12 | #include "ppapi/proxy/ppb_buffer_proxy.h" |
| 13 | #include "ppapi/proxy/ppb_context_3d_proxy.h" |
[email protected] | 1b2ec22e | 2011-08-30 00:48:33 | [diff] [blame^] | 14 | #include "ppapi/proxy/ppb_graphics_3d_proxy.h" |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 15 | #include "ppapi/thunk/enter.h" |
| 16 | #include "ppapi/thunk/resource_creation_api.h" |
| 17 | #include "ppapi/thunk/thunk.h" |
| 18 | |
| 19 | using ppapi::thunk::EnterResourceNoLock; |
| 20 | using ppapi::thunk::PPB_Buffer_API; |
| 21 | using ppapi::thunk::PPB_Context3D_API; |
[email protected] | 1b2ec22e | 2011-08-30 00:48:33 | [diff] [blame^] | 22 | using ppapi::thunk::PPB_Graphics3D_API; |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 23 | using ppapi::thunk::PPB_VideoDecoder_API; |
| 24 | |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 25 | namespace ppapi { |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 26 | namespace proxy { |
| 27 | |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 28 | class VideoDecoder : public Resource, public VideoDecoderImpl { |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 29 | public: |
[email protected] | 7f8b26b | 2011-08-18 15:41:01 | [diff] [blame] | 30 | // You must call Init() before using this class. |
| 31 | explicit VideoDecoder(const HostResource& resource); |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 32 | virtual ~VideoDecoder(); |
| 33 | |
| 34 | static VideoDecoder* Create(const HostResource& resource, |
[email protected] | 1b2ec22e | 2011-08-30 00:48:33 | [diff] [blame^] | 35 | PP_Resource graphics_context, |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 36 | const PP_VideoConfigElement* config); |
| 37 | |
[email protected] | 7f8b26b | 2011-08-18 15:41:01 | [diff] [blame] | 38 | // Resource overrides. |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 39 | virtual PPB_VideoDecoder_API* AsPPB_VideoDecoder_API() OVERRIDE; |
| 40 | |
| 41 | // PPB_VideoDecoder_API implementation. |
| 42 | virtual int32_t Decode(const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, |
| 43 | PP_CompletionCallback callback) OVERRIDE; |
| 44 | virtual void AssignPictureBuffers( |
| 45 | uint32_t no_of_buffers, const PP_PictureBuffer_Dev* buffers) OVERRIDE; |
| 46 | virtual void ReusePictureBuffer(int32_t picture_buffer_id) OVERRIDE; |
| 47 | virtual int32_t Flush(PP_CompletionCallback callback) OVERRIDE; |
| 48 | virtual int32_t Reset(PP_CompletionCallback callback) OVERRIDE; |
| 49 | virtual void Destroy() OVERRIDE; |
| 50 | |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 51 | private: |
| 52 | friend class PPB_VideoDecoder_Proxy; |
[email protected] | 7f8b26b | 2011-08-18 15:41:01 | [diff] [blame] | 53 | |
| 54 | PluginDispatcher* GetDispatcher() const; |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 55 | |
| 56 | // Run the callbacks that were passed into the plugin interface. |
| 57 | void FlushACK(int32_t result); |
| 58 | void ResetACK(int32_t result); |
| 59 | void EndOfBitstreamACK(int32_t buffer_id, int32_t result); |
| 60 | |
| 61 | DISALLOW_COPY_AND_ASSIGN(VideoDecoder); |
| 62 | }; |
| 63 | |
[email protected] | 7f8b26b | 2011-08-18 15:41:01 | [diff] [blame] | 64 | VideoDecoder::VideoDecoder(const HostResource& decoder) : Resource(decoder) { |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | VideoDecoder::~VideoDecoder() { |
| 68 | } |
| 69 | |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 70 | PPB_VideoDecoder_API* VideoDecoder::AsPPB_VideoDecoder_API() { |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 71 | return this; |
| 72 | } |
| 73 | |
| 74 | int32_t VideoDecoder::Decode( |
| 75 | const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, |
| 76 | PP_CompletionCallback callback) { |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 77 | EnterResourceNoLock<PPB_Buffer_API> |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 78 | enter_buffer(bitstream_buffer->data, true); |
| 79 | if (enter_buffer.failed()) |
| 80 | return PP_ERROR_BADRESOURCE; |
| 81 | |
[email protected] | d527cdd8 | 2011-08-12 22:50:19 | [diff] [blame] | 82 | if (!SetBitstreamBufferCallback(bitstream_buffer->id, callback)) |
| 83 | return PP_ERROR_BADARGUMENT; |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 84 | |
| 85 | Buffer* ppb_buffer = |
| 86 | static_cast<Buffer*>(enter_buffer.object()); |
| 87 | HostResource host_buffer = ppb_buffer->host_resource(); |
| 88 | |
| 89 | FlushCommandBuffer(); |
| 90 | GetDispatcher()->Send(new PpapiHostMsg_PPBVideoDecoder_Decode( |
| 91 | INTERFACE_ID_PPB_VIDEO_DECODER_DEV, host_resource(), |
| 92 | host_buffer, bitstream_buffer->id, |
| 93 | bitstream_buffer->size)); |
| 94 | return PP_OK_COMPLETIONPENDING; |
| 95 | } |
| 96 | |
| 97 | void VideoDecoder::AssignPictureBuffers(uint32_t no_of_buffers, |
| 98 | const PP_PictureBuffer_Dev* buffers) { |
| 99 | std::vector<PP_PictureBuffer_Dev> buffer_list( |
| 100 | buffers, buffers + no_of_buffers); |
| 101 | FlushCommandBuffer(); |
| 102 | GetDispatcher()->Send( |
| 103 | new PpapiHostMsg_PPBVideoDecoder_AssignPictureBuffers( |
| 104 | INTERFACE_ID_PPB_VIDEO_DECODER_DEV, host_resource(), buffer_list)); |
| 105 | } |
| 106 | |
| 107 | void VideoDecoder::ReusePictureBuffer(int32_t picture_buffer_id) { |
| 108 | FlushCommandBuffer(); |
| 109 | GetDispatcher()->Send(new PpapiHostMsg_PPBVideoDecoder_ReusePictureBuffer( |
| 110 | INTERFACE_ID_PPB_VIDEO_DECODER_DEV, host_resource(), picture_buffer_id)); |
| 111 | } |
| 112 | |
| 113 | int32_t VideoDecoder::Flush(PP_CompletionCallback callback) { |
[email protected] | d527cdd8 | 2011-08-12 22:50:19 | [diff] [blame] | 114 | if (!SetFlushCallback(callback)) |
| 115 | return PP_ERROR_INPROGRESS; |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 116 | |
| 117 | FlushCommandBuffer(); |
| 118 | GetDispatcher()->Send(new PpapiHostMsg_PPBVideoDecoder_Flush( |
| 119 | INTERFACE_ID_PPB_VIDEO_DECODER_DEV, host_resource())); |
| 120 | return PP_OK_COMPLETIONPENDING; |
| 121 | } |
| 122 | |
| 123 | int32_t VideoDecoder::Reset(PP_CompletionCallback callback) { |
[email protected] | d527cdd8 | 2011-08-12 22:50:19 | [diff] [blame] | 124 | if (!SetResetCallback(callback)) |
| 125 | return PP_ERROR_INPROGRESS; |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 126 | |
| 127 | FlushCommandBuffer(); |
| 128 | GetDispatcher()->Send(new PpapiHostMsg_PPBVideoDecoder_Reset( |
| 129 | INTERFACE_ID_PPB_VIDEO_DECODER_DEV, host_resource())); |
| 130 | return PP_OK_COMPLETIONPENDING; |
| 131 | } |
| 132 | |
| 133 | void VideoDecoder::Destroy() { |
| 134 | FlushCommandBuffer(); |
| 135 | GetDispatcher()->Send(new PpapiHostMsg_PPBVideoDecoder_Destroy( |
| 136 | INTERFACE_ID_PPB_VIDEO_DECODER_DEV, host_resource())); |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 137 | VideoDecoderImpl::Destroy(); |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 138 | } |
| 139 | |
[email protected] | 7f8b26b | 2011-08-18 15:41:01 | [diff] [blame] | 140 | PluginDispatcher* VideoDecoder::GetDispatcher() const { |
| 141 | return PluginDispatcher::GetForResource(this); |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 142 | } |
| 143 | |
| 144 | void VideoDecoder::ResetACK(int32_t result) { |
| 145 | RunResetCallback(result); |
| 146 | } |
| 147 | |
| 148 | void VideoDecoder::FlushACK(int32_t result) { |
| 149 | RunFlushCallback(result); |
| 150 | } |
| 151 | |
| 152 | void VideoDecoder::EndOfBitstreamACK( |
| 153 | int32_t bitstream_buffer_id, int32_t result) { |
| 154 | RunBitstreamBufferCallback(bitstream_buffer_id, result); |
| 155 | } |
| 156 | |
| 157 | namespace { |
| 158 | |
| 159 | InterfaceProxy* CreateVideoDecoderProxy(Dispatcher* dispatcher, |
| 160 | const void* target_interface) { |
| 161 | return new PPB_VideoDecoder_Proxy(dispatcher, target_interface); |
| 162 | } |
| 163 | |
| 164 | } // namespace |
| 165 | |
| 166 | PPB_VideoDecoder_Proxy::PPB_VideoDecoder_Proxy(Dispatcher* dispatcher, |
| 167 | const void* target_interface) |
| 168 | : InterfaceProxy(dispatcher, target_interface), |
| 169 | callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
| 170 | } |
| 171 | |
| 172 | PPB_VideoDecoder_Proxy::~PPB_VideoDecoder_Proxy() { |
| 173 | } |
| 174 | |
| 175 | // static |
| 176 | const InterfaceProxy::Info* PPB_VideoDecoder_Proxy::GetInfo() { |
| 177 | static const Info info = { |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 178 | thunk::GetPPB_VideoDecoder_Thunk(), |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 179 | PPB_VIDEODECODER_DEV_INTERFACE, |
| 180 | INTERFACE_ID_PPB_VIDEO_DECODER_DEV, |
| 181 | false, |
| 182 | &CreateVideoDecoderProxy, |
| 183 | }; |
| 184 | return &info; |
| 185 | } |
| 186 | |
| 187 | bool PPB_VideoDecoder_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 188 | bool handled = true; |
| 189 | IPC_BEGIN_MESSAGE_MAP(PPB_VideoDecoder_Proxy, msg) |
| 190 | IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoDecoder_Create, |
| 191 | OnMsgCreate) |
| 192 | IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoDecoder_Decode, OnMsgDecode) |
| 193 | IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoDecoder_AssignPictureBuffers, |
| 194 | OnMsgAssignPictureBuffers) |
| 195 | IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoDecoder_ReusePictureBuffer, |
| 196 | OnMsgReusePictureBuffer) |
| 197 | IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoDecoder_Flush, OnMsgFlush) |
| 198 | IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoDecoder_Reset, OnMsgReset) |
| 199 | IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoDecoder_Destroy, OnMsgDestroy) |
| 200 | IPC_MESSAGE_HANDLER(PpapiMsg_PPBVideoDecoder_ResetACK, OnMsgResetACK) |
| 201 | IPC_MESSAGE_HANDLER(PpapiMsg_PPBVideoDecoder_EndOfBitstreamACK, |
| 202 | OnMsgEndOfBitstreamACK) |
| 203 | IPC_MESSAGE_HANDLER(PpapiMsg_PPBVideoDecoder_FlushACK, OnMsgFlushACK) |
| 204 | IPC_MESSAGE_UNHANDLED(handled = false) |
| 205 | IPC_END_MESSAGE_MAP() |
| 206 | DCHECK(handled); |
| 207 | return handled; |
| 208 | } |
| 209 | |
| 210 | PP_Resource PPB_VideoDecoder_Proxy::CreateProxyResource( |
[email protected] | 1b2ec22e | 2011-08-30 00:48:33 | [diff] [blame^] | 211 | PP_Instance instance, |
| 212 | PP_Resource graphics_context, |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 213 | const PP_VideoConfigElement* config) { |
| 214 | PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
| 215 | // Dispatcher is null if it cannot find the instance passed to it (i.e. if the |
| 216 | // client passes in an invalid instance). |
| 217 | if (!dispatcher) |
| 218 | return 0; |
| 219 | |
| 220 | std::vector<PP_VideoConfigElement> copied; |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 221 | if (!VideoDecoderImpl::CopyConfigsToVector(config, &copied)) |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 222 | return 0; |
| 223 | |
[email protected] | 1b2ec22e | 2011-08-30 00:48:33 | [diff] [blame^] | 224 | HostResource host_context; |
| 225 | gpu::gles2::GLES2Implementation* gles2_impl = NULL; |
| 226 | |
| 227 | EnterResourceNoLock<PPB_Context3D_API> enter_context(graphics_context, false); |
| 228 | if (enter_context.succeeded()) { |
| 229 | Context3D* context = static_cast<Context3D*>(enter_context.object()); |
| 230 | host_context = context->host_resource(); |
| 231 | gles2_impl = context->gles2_impl(); |
| 232 | } else { |
| 233 | EnterResourceNoLock<PPB_Graphics3D_API> enter_context(graphics_context, |
| 234 | true); |
| 235 | if (enter_context.failed()) |
| 236 | return 0; |
| 237 | Graphics3D* context = static_cast<Graphics3D*>(enter_context.object()); |
| 238 | host_context = context->host_resource(); |
| 239 | gles2_impl = context->gles2_impl(); |
| 240 | } |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 241 | |
| 242 | HostResource result; |
| 243 | dispatcher->Send(new PpapiHostMsg_PPBVideoDecoder_Create( |
| 244 | INTERFACE_ID_PPB_VIDEO_DECODER_DEV, instance, |
| 245 | host_context, copied, &result)); |
| 246 | if (result.is_null()) |
| 247 | return 0; |
| 248 | |
[email protected] | 7f8b26b | 2011-08-18 15:41:01 | [diff] [blame] | 249 | // Need a scoped_refptr to keep the object alive during the Init call. |
| 250 | scoped_refptr<VideoDecoder> decoder(new VideoDecoder(result)); |
[email protected] | 1b2ec22e | 2011-08-30 00:48:33 | [diff] [blame^] | 251 | decoder->InitCommon(graphics_context, gles2_impl); |
[email protected] | 7f8b26b | 2011-08-18 15:41:01 | [diff] [blame] | 252 | return decoder->GetReference(); |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 253 | } |
| 254 | |
| 255 | void PPB_VideoDecoder_Proxy::OnMsgCreate( |
[email protected] | 1b2ec22e | 2011-08-30 00:48:33 | [diff] [blame^] | 256 | PP_Instance instance, const HostResource& graphics_context, |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 257 | const std::vector<PP_VideoConfigElement>& config, |
| 258 | HostResource* result) { |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 259 | thunk::EnterFunction<thunk::ResourceCreationAPI> resource_creation(instance, |
| 260 | true); |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 261 | if (resource_creation.failed()) |
| 262 | return; |
| 263 | |
| 264 | std::vector<PP_VideoConfigElement> copied = config; |
| 265 | copied.push_back(PP_VIDEOATTR_DICTIONARY_TERMINATOR); |
| 266 | |
| 267 | // Make the resource and get the API pointer to its interface. |
| 268 | result->SetHostResource( |
| 269 | instance, resource_creation.functions()->CreateVideoDecoder( |
[email protected] | 1b2ec22e | 2011-08-30 00:48:33 | [diff] [blame^] | 270 | instance, graphics_context.host_resource(), &copied.front())); |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 271 | } |
| 272 | |
| 273 | void PPB_VideoDecoder_Proxy::OnMsgDecode( |
| 274 | const HostResource& decoder, |
| 275 | const HostResource& buffer, int32 id, int32 size) { |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 276 | pp::CompletionCallback callback = callback_factory_.NewRequiredCallback( |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 277 | &PPB_VideoDecoder_Proxy::SendMsgEndOfBitstreamACKToPlugin, decoder, id); |
| 278 | |
| 279 | PP_VideoBitstreamBuffer_Dev bitstream = { id, buffer.host_resource(), size }; |
| 280 | ppb_video_decoder_target()->Decode( |
| 281 | decoder.host_resource(), &bitstream, callback.pp_completion_callback()); |
| 282 | } |
| 283 | |
| 284 | void PPB_VideoDecoder_Proxy::OnMsgAssignPictureBuffers( |
| 285 | const HostResource& decoder, |
| 286 | const std::vector<PP_PictureBuffer_Dev>& buffers) { |
| 287 | DCHECK(!buffers.empty()); |
| 288 | const PP_PictureBuffer_Dev* buffer_array = &buffers.front(); |
| 289 | |
| 290 | ppb_video_decoder_target()->AssignPictureBuffers( |
[email protected] | 1b2ec22e | 2011-08-30 00:48:33 | [diff] [blame^] | 291 | decoder.host_resource(), buffers.size(), buffer_array); |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 292 | } |
| 293 | |
| 294 | void PPB_VideoDecoder_Proxy::OnMsgReusePictureBuffer( |
| 295 | const HostResource& decoder, int32 picture_buffer_id) { |
| 296 | ppb_video_decoder_target()->ReusePictureBuffer( |
| 297 | decoder.host_resource(), picture_buffer_id); |
| 298 | } |
| 299 | |
| 300 | void PPB_VideoDecoder_Proxy::OnMsgFlush(const HostResource& decoder) { |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 301 | pp::CompletionCallback callback = callback_factory_.NewRequiredCallback( |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 302 | &PPB_VideoDecoder_Proxy::SendMsgFlushACKToPlugin, decoder); |
| 303 | ppb_video_decoder_target()->Flush( |
| 304 | decoder.host_resource(), callback.pp_completion_callback()); |
| 305 | } |
| 306 | |
| 307 | void PPB_VideoDecoder_Proxy::OnMsgReset(const HostResource& decoder) { |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 308 | pp::CompletionCallback callback = callback_factory_.NewRequiredCallback( |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 309 | &PPB_VideoDecoder_Proxy::SendMsgResetACKToPlugin, decoder); |
| 310 | ppb_video_decoder_target()->Reset( |
| 311 | decoder.host_resource(), callback.pp_completion_callback()); |
| 312 | } |
| 313 | |
| 314 | void PPB_VideoDecoder_Proxy::OnMsgDestroy(const HostResource& decoder) { |
| 315 | ppb_video_decoder_target()->Destroy(decoder.host_resource()); |
| 316 | } |
| 317 | |
| 318 | void PPB_VideoDecoder_Proxy::SendMsgEndOfBitstreamACKToPlugin( |
| 319 | int32_t result, const HostResource& decoder, int32 id) { |
| 320 | dispatcher()->Send(new PpapiMsg_PPBVideoDecoder_EndOfBitstreamACK( |
| 321 | INTERFACE_ID_PPB_VIDEO_DECODER_DEV, decoder, id, result)); |
| 322 | } |
| 323 | |
| 324 | void PPB_VideoDecoder_Proxy::SendMsgFlushACKToPlugin( |
| 325 | int32_t result, const HostResource& decoder) { |
| 326 | dispatcher()->Send(new PpapiMsg_PPBVideoDecoder_FlushACK( |
| 327 | INTERFACE_ID_PPB_VIDEO_DECODER_DEV, decoder, result)); |
| 328 | } |
| 329 | |
| 330 | void PPB_VideoDecoder_Proxy::SendMsgResetACKToPlugin( |
| 331 | int32_t result, const HostResource& decoder) { |
| 332 | dispatcher()->Send(new PpapiMsg_PPBVideoDecoder_ResetACK( |
| 333 | INTERFACE_ID_PPB_VIDEO_DECODER_DEV, decoder, result)); |
| 334 | } |
| 335 | |
| 336 | void PPB_VideoDecoder_Proxy::OnMsgEndOfBitstreamACK( |
| 337 | const HostResource& decoder, int32_t id, int32_t result) { |
| 338 | EnterPluginFromHostResource<PPB_VideoDecoder_API> enter(decoder); |
| 339 | if (enter.succeeded()) |
| 340 | static_cast<VideoDecoder*>(enter.object())->EndOfBitstreamACK(id, result); |
| 341 | } |
| 342 | |
| 343 | void PPB_VideoDecoder_Proxy::OnMsgFlushACK( |
| 344 | const HostResource& decoder, int32_t result) { |
| 345 | EnterPluginFromHostResource<PPB_VideoDecoder_API> enter(decoder); |
| 346 | if (enter.succeeded()) |
| 347 | static_cast<VideoDecoder*>(enter.object())->FlushACK(result); |
| 348 | } |
| 349 | |
| 350 | void PPB_VideoDecoder_Proxy::OnMsgResetACK( |
| 351 | const HostResource& decoder, int32_t result) { |
| 352 | EnterPluginFromHostResource<PPB_VideoDecoder_API> enter(decoder); |
| 353 | if (enter.succeeded()) |
| 354 | static_cast<VideoDecoder*>(enter.object())->ResetACK(result); |
| 355 | } |
| 356 | |
| 357 | } // namespace proxy |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 358 | } // namespace ppapi |