blob: bbc85b469bbfd696a15b4774f97d254bc807c5d3 [file] [log] [blame]
[email protected]b76257d2013-05-04 00:11:301// 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
avie029c4132015-12-23 06:45:228#include <stdint.h>
9
[email protected]b76257d2013-05-04 00:11:3010#include <string>
11
avie029c4132015-12-23 06:45:2212#include "base/macros.h"
[email protected]b76257d2013-05-04 00:11:3013#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]38f61e8f2013-05-11 19:23:3820struct PP_ImageDataDesc;
[email protected]b76257d2013-05-04 00:11:3021struct PP_VideoFrame_Private;
22
23namespace ppapi {
24
25class TrackedCallback;
26
27namespace proxy {
28
29class PPAPI_PROXY_EXPORT VideoSourceResource
30 : public PluginResource,
31 public thunk::PPB_VideoSource_Private_API {
32 public:
33 VideoSourceResource(Connection connection,
34 PP_Instance instance);
nicke4784432015-04-23 14:01:4835 ~VideoSourceResource() override;
[email protected]b76257d2013-05-04 00:11:3036
37 // Resource overrides.
nicke4784432015-04-23 14:01:4838 thunk::PPB_VideoSource_Private_API* AsPPB_VideoSource_Private_API() override;
[email protected]b76257d2013-05-04 00:11:3039
40 // PPB_VideoSource_Private_API implementation.
nicke4784432015-04-23 14:01:4841 int32_t Open(
[email protected]b76257d2013-05-04 00:11:3042 const PP_Var& stream_url,
mostynb699af3c2014-10-06 18:03:3443 scoped_refptr<TrackedCallback> callback) override;
nicke4784432015-04-23 14:01:4844 int32_t GetFrame(
[email protected]b76257d2013-05-04 00:11:3045 PP_VideoFrame_Private* frame,
mostynb699af3c2014-10-06 18:03:3446 scoped_refptr<TrackedCallback> callback) override;
nicke4784432015-04-23 14:01:4847 void Close() override;
[email protected]b76257d2013-05-04 00:11:3048
49 private:
50 void OnPluginMsgOpenComplete(
[email protected]38f61e8f2013-05-11 19:23:3851 const ResourceMessageReplyParams& reply_params);
[email protected]b76257d2013-05-04 00:11:3052 void OnPluginMsgGetFrameComplete(
53 PP_VideoFrame_Private* frame,
[email protected]38f61e8f2013-05-11 19:23:3854 const ResourceMessageReplyParams& reply_params,
[email protected]b76257d2013-05-04 00:11:3055 const HostResource& image_data,
[email protected]38f61e8f2013-05-11 19:23:3856 const PP_ImageDataDesc& image_desc_data,
[email protected]b76257d2013-05-04 00:11:3057 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_