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 VideoDecoder : public PluginResource, |
| 20 public ::ppapi::VideoDecoderImpl { |
| 21 public: |
| 22 virtual ~VideoDecoder(); |
| 23 |
| 24 static VideoDecoder* Create(const HostResource& resource, |
| 25 PP_Resource context3d_id, |
| 26 const PP_VideoConfigElement* config); |
| 27 |
| 28 // ResourceObjectBase overrides. |
| 29 virtual PPB_VideoDecoder_API* AsPPB_VideoDecoder_API() OVERRIDE; |
| 30 |
| 31 // PPB_VideoDecoder_API implementation. |
| 32 virtual int32_t Decode(const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, |
| 33 PP_CompletionCallback callback) OVERRIDE; |
| 34 virtual void AssignPictureBuffers( |
| 35 uint32_t no_of_buffers, const PP_PictureBuffer_Dev* buffers) OVERRIDE; |
| 36 virtual void ReusePictureBuffer(int32_t picture_buffer_id) OVERRIDE; |
| 37 virtual int32_t Flush(PP_CompletionCallback callback) OVERRIDE; |
| 38 virtual int32_t Reset(PP_CompletionCallback callback) OVERRIDE; |
| 39 virtual void Destroy() OVERRIDE; |
| 40 |
| 41 void FlushACK(); |
| 42 void ResetACK(); |
| 43 void EndOfBitstreamACK(int32_t buffer_id); |
| 44 |
| 45 virtual bool Init( |
| 46 PP_Resource context_id, const PP_VideoConfigElement* decoder_config); |
| 47 |
| 48 private: |
| 49 explicit VideoDecoder(const HostResource& resource); |
| 50 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); |
| 51 }; |
| 52 |
| 53 class PPB_VideoDecoder_Proxy : public InterfaceProxy { |
| 54 public: |
| 55 PPB_VideoDecoder_Proxy(Dispatcher* dispatcher, const void* target_interface); |
| 56 virtual ~PPB_VideoDecoder_Proxy(); |
| 57 |
| 58 static const Info* GetInfo(); |
| 59 |
| 60 // Creates a VideoDecoder object in the plugin process. |
| 61 static PP_Resource CreateProxyResource(PP_Instance instance, |
| 62 PP_Resource context3d_id, const PP_VideoConfigElement* config); |
| 63 |
| 64 // InterfaceProxy implementation. |
| 65 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 66 |
| 67 private: |
| 68 // Message handlers in the renderer process to receive messages from the |
| 69 // plugin process. |
| 70 void OnMsgCreate(PP_Instance instance, const HostResource& context3d_id, |
| 71 const std::vector<int32_t>& config, HostResource* result); |
| 72 void OnMsgDecode( |
| 73 const HostResource& decoder, |
| 74 const HostResource& buffer, int32 id, int32 size); |
| 75 void OnMsgAssignPictureBuffers( |
| 76 const HostResource& decoder, |
| 77 const std::vector<int32>& buffer_ids, |
| 78 const std::vector<uint32>& texture_ids, |
| 79 const std::vector<PP_Size>& sizes); |
| 80 void OnMsgReusePictureBuffer( |
| 81 const HostResource& decoder, |
| 82 int32 picture_buffer_id); |
| 83 void OnMsgFlush(const HostResource& decoder); |
| 84 void OnMsgReset(const HostResource& decoder); |
| 85 void OnMsgDestroy(const HostResource& decoder); |
| 86 |
| 87 void SendMsgEndOfBitstreamACKToPlugin( |
| 88 int32_t result, const HostResource& decoder, int32 id); |
| 89 void SendMsgFlushACKToPlugin( |
| 90 int32_t result, const HostResource& decoder); |
| 91 void SendMsgResetACKToPlugin( |
| 92 int32_t result, const HostResource& decoder); |
| 93 |
| 94 // Message handlers in the plugin process to receive messages from the |
| 95 // renderer process. |
| 96 void OnMsgEndOfBitstreamACK(const HostResource& decoder, int32_t pp_error); |
| 97 void OnMsgFlushACK(const HostResource& decoder, int32_t pp_error); |
| 98 void OnMsgResetACK(const HostResource& decoder, int32_t pp_error); |
| 99 |
| 100 CompletionCallbackFactory<PPB_VideoDecoder_Proxy, |
| 101 ProxyNonThreadSafeRefCount> callback_factory_; |
| 102 |
| 103 DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Proxy); |
| 104 }; |
| 105 |
| 106 } // namespace proxy |
| 107 } // namespace pp |
| 108 |
| 109 #endif // PPAPI_PROXY_PPB_VIDEO_DECODER_PROXY_H_ |
OLD | NEW |