[email protected] | b76257d | 2013-05-04 00:11:30 | [diff] [blame] | 1 | // Copyright (c) 2013 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_VIDEO_SOURCE_RESOURCE_H_ | ||||
6 | #define PPAPI_PROXY_VIDEO_SOURCE_RESOURCE_H_ | ||||
7 | |||||
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 8 | #include <stdint.h> |
9 | |||||
[email protected] | b76257d | 2013-05-04 00:11:30 | [diff] [blame] | 10 | #include <string> |
11 | |||||
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 12 | #include "base/macros.h" |
[email protected] | b76257d | 2013-05-04 00:11:30 | [diff] [blame] | 13 | #include "ppapi/c/pp_time.h" |
14 | #include "ppapi/c/pp_var.h" | ||||
15 | #include "ppapi/proxy/connection.h" | ||||
16 | #include "ppapi/proxy/plugin_resource.h" | ||||
17 | #include "ppapi/proxy/ppapi_proxy_export.h" | ||||
18 | #include "ppapi/thunk/ppb_video_source_private_api.h" | ||||
19 | |||||
[email protected] | 38f61e8f | 2013-05-11 19:23:38 | [diff] [blame] | 20 | struct PP_ImageDataDesc; |
[email protected] | b76257d | 2013-05-04 00:11:30 | [diff] [blame] | 21 | struct PP_VideoFrame_Private; |
22 | |||||
23 | namespace ppapi { | ||||
24 | |||||
25 | class TrackedCallback; | ||||
26 | |||||
27 | namespace proxy { | ||||
28 | |||||
29 | class PPAPI_PROXY_EXPORT VideoSourceResource | ||||
30 | : public PluginResource, | ||||
31 | public thunk::PPB_VideoSource_Private_API { | ||||
32 | public: | ||||
33 | VideoSourceResource(Connection connection, | ||||
34 | PP_Instance instance); | ||||
nick | e478443 | 2015-04-23 14:01:48 | [diff] [blame] | 35 | ~VideoSourceResource() override; |
[email protected] | b76257d | 2013-05-04 00:11:30 | [diff] [blame] | 36 | |
37 | // Resource overrides. | ||||
nick | e478443 | 2015-04-23 14:01:48 | [diff] [blame] | 38 | thunk::PPB_VideoSource_Private_API* AsPPB_VideoSource_Private_API() override; |
[email protected] | b76257d | 2013-05-04 00:11:30 | [diff] [blame] | 39 | |
40 | // PPB_VideoSource_Private_API implementation. | ||||
nick | e478443 | 2015-04-23 14:01:48 | [diff] [blame] | 41 | int32_t Open( |
[email protected] | b76257d | 2013-05-04 00:11:30 | [diff] [blame] | 42 | const PP_Var& stream_url, |
mostynb | 699af3c | 2014-10-06 18:03:34 | [diff] [blame] | 43 | scoped_refptr<TrackedCallback> callback) override; |
nick | e478443 | 2015-04-23 14:01:48 | [diff] [blame] | 44 | int32_t GetFrame( |
[email protected] | b76257d | 2013-05-04 00:11:30 | [diff] [blame] | 45 | PP_VideoFrame_Private* frame, |
mostynb | 699af3c | 2014-10-06 18:03:34 | [diff] [blame] | 46 | scoped_refptr<TrackedCallback> callback) override; |
nick | e478443 | 2015-04-23 14:01:48 | [diff] [blame] | 47 | void Close() override; |
[email protected] | b76257d | 2013-05-04 00:11:30 | [diff] [blame] | 48 | |
49 | private: | ||||
50 | void OnPluginMsgOpenComplete( | ||||
[email protected] | 38f61e8f | 2013-05-11 19:23:38 | [diff] [blame] | 51 | const ResourceMessageReplyParams& reply_params); |
[email protected] | b76257d | 2013-05-04 00:11:30 | [diff] [blame] | 52 | void OnPluginMsgGetFrameComplete( |
53 | PP_VideoFrame_Private* frame, | ||||
[email protected] | 38f61e8f | 2013-05-11 19:23:38 | [diff] [blame] | 54 | const ResourceMessageReplyParams& reply_params, |
[email protected] | b76257d | 2013-05-04 00:11:30 | [diff] [blame] | 55 | const HostResource& image_data, |
[email protected] | 38f61e8f | 2013-05-11 19:23:38 | [diff] [blame] | 56 | const PP_ImageDataDesc& image_desc_data, |
[email protected] | b76257d | 2013-05-04 00:11:30 | [diff] [blame] | 57 | PP_TimeTicks timestamp); |
58 | |||||
59 | scoped_refptr<TrackedCallback> open_callback_; | ||||
60 | scoped_refptr<TrackedCallback> get_frame_callback_; | ||||
61 | bool is_open_; | ||||
62 | |||||
63 | DISALLOW_COPY_AND_ASSIGN(VideoSourceResource); | ||||
64 | }; | ||||
65 | |||||
66 | } // namespace proxy | ||||
67 | } // namespace ppapi | ||||
68 | |||||
69 | #endif // PPAPI_PROXY_VIDEO_SOURCE_RESOURCE_H_ |