Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ppapi / proxy / video_source_resource.h
blob56cd7ddd3e2c7ea9ab6fdd4c56dfbe1158529c29
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.
5 #ifndef PPAPI_PROXY_VIDEO_SOURCE_RESOURCE_H_
6 #define PPAPI_PROXY_VIDEO_SOURCE_RESOURCE_H_
8 #include <string>
10 #include "ppapi/c/pp_time.h"
11 #include "ppapi/c/pp_var.h"
12 #include "ppapi/proxy/connection.h"
13 #include "ppapi/proxy/plugin_resource.h"
14 #include "ppapi/proxy/ppapi_proxy_export.h"
15 #include "ppapi/thunk/ppb_video_source_private_api.h"
17 struct PP_ImageDataDesc;
18 struct PP_VideoFrame_Private;
20 namespace ppapi {
22 class TrackedCallback;
24 namespace proxy {
26 class PPAPI_PROXY_EXPORT VideoSourceResource
27 : public PluginResource,
28 public thunk::PPB_VideoSource_Private_API {
29 public:
30 VideoSourceResource(Connection connection,
31 PP_Instance instance);
32 ~VideoSourceResource() override;
34 // Resource overrides.
35 thunk::PPB_VideoSource_Private_API* AsPPB_VideoSource_Private_API() override;
37 // PPB_VideoSource_Private_API implementation.
38 int32_t Open(
39 const PP_Var& stream_url,
40 scoped_refptr<TrackedCallback> callback) override;
41 int32_t GetFrame(
42 PP_VideoFrame_Private* frame,
43 scoped_refptr<TrackedCallback> callback) override;
44 void Close() override;
46 private:
47 void OnPluginMsgOpenComplete(
48 const ResourceMessageReplyParams& reply_params);
49 void OnPluginMsgGetFrameComplete(
50 PP_VideoFrame_Private* frame,
51 const ResourceMessageReplyParams& reply_params,
52 const HostResource& image_data,
53 const PP_ImageDataDesc& image_desc_data,
54 PP_TimeTicks timestamp);
56 scoped_refptr<TrackedCallback> open_callback_;
57 scoped_refptr<TrackedCallback> get_frame_callback_;
58 bool is_open_;
60 DISALLOW_COPY_AND_ASSIGN(VideoSourceResource);
63 } // namespace proxy
64 } // namespace ppapi
66 #endif // PPAPI_PROXY_VIDEO_SOURCE_RESOURCE_H_