[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 | #ifndef PPAPI_PROXY_PPB_VIDEO_DECODER_PROXY_H_ |
| 6 | #define PPAPI_PROXY_PPB_VIDEO_DECODER_PROXY_H_ |
| 7 | |
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 8 | #include <stdint.h> |
| 9 | |
| 10 | #include "base/macros.h" |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 11 | #include "ppapi/c/pp_instance.h" |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 12 | #include "ppapi/proxy/interface_proxy.h" |
[email protected] | 47a961c | 2012-07-13 19:18:52 | [diff] [blame] | 13 | #include "ppapi/proxy/proxy_completion_callback_factory.h" |
[email protected] | 9a57839 | 2011-12-07 18:59:27 | [diff] [blame] | 14 | #include "ppapi/shared_impl/ppb_video_decoder_shared.h" |
[email protected] | 4ba60db | 2014-05-06 07:08:19 | [diff] [blame] | 15 | #include "ppapi/thunk/ppb_video_decoder_dev_api.h" |
[email protected] | ae5ff9ae | 2012-01-06 22:50:33 | [diff] [blame] | 16 | #include "ppapi/utility/completion_callback_factory.h" |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 17 | |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 18 | namespace ppapi { |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 19 | namespace proxy { |
| 20 | |
| 21 | class PPB_VideoDecoder_Proxy : public InterfaceProxy { |
| 22 | public: |
[email protected] | 5c96602 | 2011-09-13 18:09:37 | [diff] [blame] | 23 | PPB_VideoDecoder_Proxy(Dispatcher* dispatcher); |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 24 | virtual ~PPB_VideoDecoder_Proxy(); |
| 25 | |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 26 | // Creates a VideoDecoder object in the plugin process. |
[email protected] | 2ffc31a | 2011-09-01 03:18:28 | [diff] [blame] | 27 | static PP_Resource CreateProxyResource( |
| 28 | PP_Instance instance, |
| 29 | PP_Resource graphics_context, |
| 30 | PP_VideoDecoder_Profile profile); |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 31 | |
| 32 | // InterfaceProxy implementation. |
| 33 | virtual bool OnMessageReceived(const IPC::Message& msg); |
| 34 | |
[email protected] | ac4b54d | 2011-10-20 23:09:28 | [diff] [blame] | 35 | static const ApiID kApiID = API_ID_PPB_VIDEO_DECODER_DEV; |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 36 | |
| 37 | private: |
| 38 | // Message handlers in the renderer process to receive messages from the |
| 39 | // plugin process. |
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 40 | void OnMsgCreate(PP_Instance instance, |
[email protected] | 1b2ec22e | 2011-08-30 00:48:33 | [diff] [blame] | 41 | const ppapi::HostResource& graphics_context, |
[email protected] | 2ffc31a | 2011-09-01 03:18:28 | [diff] [blame] | 42 | PP_VideoDecoder_Profile profile, |
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 43 | ppapi::HostResource* result); |
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 44 | void OnMsgDecode(const ppapi::HostResource& decoder, |
| 45 | const ppapi::HostResource& buffer, |
| 46 | int32_t id, |
| 47 | uint32_t size); |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 48 | void OnMsgAssignPictureBuffers( |
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 49 | const ppapi::HostResource& decoder, |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 50 | const std::vector<PP_PictureBuffer_Dev>& buffers); |
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 51 | void OnMsgReusePictureBuffer(const ppapi::HostResource& decoder, |
| 52 | int32_t picture_buffer_id); |
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 53 | void OnMsgFlush(const ppapi::HostResource& decoder); |
| 54 | void OnMsgReset(const ppapi::HostResource& decoder); |
| 55 | void OnMsgDestroy(const ppapi::HostResource& decoder); |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 56 | |
| 57 | // Send a message from the renderer process to the plugin process to tell it |
| 58 | // to run its callback. |
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 59 | void SendMsgEndOfBitstreamACKToPlugin(int32_t result, |
| 60 | const ppapi::HostResource& decoder, |
| 61 | int32_t id); |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 62 | void SendMsgFlushACKToPlugin( |
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 63 | int32_t result, const ppapi::HostResource& decoder); |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 64 | void SendMsgResetACKToPlugin( |
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 65 | int32_t result, const ppapi::HostResource& decoder); |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 66 | |
| 67 | // Message handlers in the plugin process to receive messages from the |
| 68 | // renderer process. |
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 69 | void OnMsgEndOfBitstreamACK(const ppapi::HostResource& decoder, |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 70 | int32_t id, int32_t result); |
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 71 | void OnMsgFlushACK(const ppapi::HostResource& decoder, int32_t result); |
| 72 | void OnMsgResetACK(const ppapi::HostResource& decoder, int32_t result); |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 73 | |
[email protected] | 47a961c | 2012-07-13 19:18:52 | [diff] [blame] | 74 | ProxyCompletionCallbackFactory<PPB_VideoDecoder_Proxy> callback_factory_; |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 75 | |
| 76 | DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Proxy); |
| 77 | }; |
| 78 | |
| 79 | } // namespace proxy |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 80 | } // namespace ppapi |
[email protected] | 7ace8ad | 2011-08-06 03:23:58 | [diff] [blame] | 81 | |
| 82 | #endif // PPAPI_PROXY_PPB_VIDEO_DECODER_PROXY_H_ |