OLD | NEW |
(Empty) | |
| 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/cpp/completion_callback.h" |
| 10 #include "ppapi/proxy/interface_proxy.h" |
| 11 #include "ppapi/proxy/plugin_resource.h" |
| 12 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" |
| 13 #include "ppapi/shared_impl/video_decoder_impl.h" |
| 14 #include "ppapi/thunk/ppb_video_decoder_api.h" |
| 15 |
| 16 namespace pp { |
| 17 namespace proxy { |
| 18 |
| 19 class PPB_VideoDecoder_Proxy : public InterfaceProxy { |
| 20 public: |
| 21 PPB_VideoDecoder_Proxy(Dispatcher* dispatcher, const void* target_interface); |
| 22 virtual ~PPB_VideoDecoder_Proxy(); |
| 23 |
| 24 static const Info* GetInfo(); |
| 25 |
| 26 // Creates a VideoDecoder object in the plugin process. |
| 27 static PP_Resource CreateProxyResource(PP_Instance instance, |
| 28 PP_Resource context3d_id, const PP_VideoConfigElement* config); |
| 29 |
| 30 // InterfaceProxy implementation. |
| 31 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 32 |
| 33 const PPB_VideoDecoder_Dev* ppb_video_decoder_target() const { |
| 34 return static_cast<const PPB_VideoDecoder_Dev*>(target_interface()); |
| 35 } |
| 36 |
| 37 private: |
| 38 // Message handlers in the renderer process to receive messages from the |
| 39 // plugin process. |
| 40 void OnMsgCreate(PP_Instance instance, const HostResource& context3d_id, |
| 41 const std::vector<PP_VideoConfigElement>& config, |
| 42 HostResource* result); |
| 43 void OnMsgDecode( |
| 44 const HostResource& decoder, |
| 45 const HostResource& buffer, int32 id, int32 size); |
| 46 void OnMsgAssignPictureBuffers( |
| 47 const HostResource& decoder, |
| 48 const std::vector<PP_PictureBuffer_Dev>& buffers); |
| 49 void OnMsgReusePictureBuffer( |
| 50 const HostResource& decoder, |
| 51 int32 picture_buffer_id); |
| 52 void OnMsgFlush(const HostResource& decoder); |
| 53 void OnMsgReset(const HostResource& decoder); |
| 54 void OnMsgDestroy(const HostResource& decoder); |
| 55 |
| 56 // Send a message from the renderer process to the plugin process to tell it |
| 57 // to run its callback. |
| 58 void SendMsgEndOfBitstreamACKToPlugin( |
| 59 int32_t result, const HostResource& decoder, int32 id); |
| 60 void SendMsgFlushACKToPlugin( |
| 61 int32_t result, const HostResource& decoder); |
| 62 void SendMsgResetACKToPlugin( |
| 63 int32_t result, const HostResource& decoder); |
| 64 |
| 65 // Message handlers in the plugin process to receive messages from the |
| 66 // renderer process. |
| 67 void OnMsgEndOfBitstreamACK(const HostResource& decoder, |
| 68 int32_t id, int32_t result); |
| 69 void OnMsgFlushACK(const HostResource& decoder, int32_t result); |
| 70 void OnMsgResetACK(const HostResource& decoder, int32_t result); |
| 71 |
| 72 CompletionCallbackFactory<PPB_VideoDecoder_Proxy, |
| 73 ProxyNonThreadSafeRefCount> callback_factory_; |
| 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Proxy); |
| 76 }; |
| 77 |
| 78 } // namespace proxy |
| 79 } // namespace pp |
| 80 |
| 81 #endif // PPAPI_PROXY_PPB_VIDEO_DECODER_PROXY_H_ |
OLD | NEW |