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