Home | History | Annotate | Download | only in proxy
      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 #ifndef PPAPI_PROXY_PPB_VIDEO_DECODER_PROXY_H_
      6 #define PPAPI_PROXY_PPB_VIDEO_DECODER_PROXY_H_
      7 
      8 #include "ppapi/c/pp_instance.h"
      9 #include "ppapi/proxy/interface_proxy.h"
     10 #include "ppapi/proxy/proxy_completion_callback_factory.h"
     11 #include "ppapi/shared_impl/ppb_video_decoder_shared.h"
     12 #include "ppapi/thunk/ppb_video_decoder_api.h"
     13 #include "ppapi/utility/completion_callback_factory.h"
     14 
     15 namespace ppapi {
     16 namespace proxy {
     17 
     18 class PPB_VideoDecoder_Proxy : public InterfaceProxy {
     19  public:
     20   PPB_VideoDecoder_Proxy(Dispatcher* dispatcher);
     21   virtual ~PPB_VideoDecoder_Proxy();
     22 
     23   // Creates a VideoDecoder object in the plugin process.
     24   static PP_Resource CreateProxyResource(
     25       PP_Instance instance,
     26       PP_Resource graphics_context,
     27       PP_VideoDecoder_Profile profile);
     28 
     29   // InterfaceProxy implementation.
     30   virtual bool OnMessageReceived(const IPC::Message& msg);
     31 
     32   static const ApiID kApiID = API_ID_PPB_VIDEO_DECODER_DEV;
     33 
     34  private:
     35   // Message handlers in the renderer process to receive messages from the
     36   // plugin process.
     37   void OnMsgCreate(PP_Instance instance,
     38                    const ppapi::HostResource& graphics_context,
     39                    PP_VideoDecoder_Profile profile,
     40                    ppapi::HostResource* result);
     41   void OnMsgDecode(
     42       const ppapi::HostResource& decoder,
     43       const ppapi::HostResource& buffer, int32 id, uint32 size);
     44   void OnMsgAssignPictureBuffers(
     45       const ppapi::HostResource& decoder,
     46       const std::vector<PP_PictureBuffer_Dev>& buffers);
     47   void OnMsgReusePictureBuffer(
     48       const ppapi::HostResource& decoder,
     49       int32 picture_buffer_id);
     50   void OnMsgFlush(const ppapi::HostResource& decoder);
     51   void OnMsgReset(const ppapi::HostResource& decoder);
     52   void OnMsgDestroy(const ppapi::HostResource& decoder);
     53 
     54   // Send a message from the renderer process to the plugin process to tell it
     55   // to run its callback.
     56   void SendMsgEndOfBitstreamACKToPlugin(
     57       int32_t result, const ppapi::HostResource& decoder, int32 id);
     58   void SendMsgFlushACKToPlugin(
     59       int32_t result, const ppapi::HostResource& decoder);
     60   void SendMsgResetACKToPlugin(
     61       int32_t result, const ppapi::HostResource& decoder);
     62 
     63   // Message handlers in the plugin process to receive messages from the
     64   // renderer process.
     65   void OnMsgEndOfBitstreamACK(const ppapi::HostResource& decoder,
     66                               int32_t id, int32_t result);
     67   void OnMsgFlushACK(const ppapi::HostResource& decoder, int32_t result);
     68   void OnMsgResetACK(const ppapi::HostResource& decoder, int32_t result);
     69 
     70   ProxyCompletionCallbackFactory<PPB_VideoDecoder_Proxy> callback_factory_;
     71 
     72   DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Proxy);
     73 };
     74 
     75 }  // namespace proxy
     76 }  // namespace ppapi
     77 
     78 #endif  // PPAPI_PROXY_PPB_VIDEO_DECODER_PROXY_H_
     79