Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(997)

Side by Side Diff: ppapi/proxy/video_capture_resource.h

Issue 11274036: Refactor video capture to new design (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: export Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ppapi/proxy/serialized_structs.h ('k') | ppapi/proxy/video_capture_resource.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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_CAPTURE_RESOURCE_H_
6 #define PPAPI_PROXY_VIDEO_CAPTURE_RESOURCE_H_
7
8 #include "base/compiler_specific.h"
9 #include "ppapi/c/dev/ppp_video_capture_dev.h"
10 #include "ppapi/proxy/plugin_resource.h"
11 #include "ppapi/thunk/ppb_video_capture_api.h"
12
13 namespace ppapi {
14 namespace proxy {
15
16 class VideoCaptureResource
17 : public PluginResource,
18 public ::ppapi::thunk::PPB_VideoCapture_API {
19 public:
20 VideoCaptureResource(Connection connection,
21 PP_Instance instance,
22 PluginDispatcher* dispatcher);
23 virtual ~VideoCaptureResource();
24
25 // PluginResource override.
26 virtual thunk::PPB_VideoCapture_API* AsPPB_VideoCapture_API() OVERRIDE {
27 return this;
28 }
29
30 // PPB_VideoCapture_API implementation.
31 virtual int32_t EnumerateDevices(
32 PP_Resource* devices,
33 scoped_refptr<TrackedCallback> callback) OVERRIDE;
34 virtual int32_t Open(const std::string& device_id,
35 const PP_VideoCaptureDeviceInfo_Dev& requested_info,
36 uint32_t buffer_count,
37 scoped_refptr<TrackedCallback> callback) OVERRIDE;
38 virtual int32_t StartCapture() OVERRIDE;
39 virtual int32_t ReuseBuffer(uint32_t buffer) OVERRIDE;
40 virtual int32_t StopCapture() OVERRIDE;
41 virtual void Close() OVERRIDE;
42 virtual int32_t EnumerateDevicesSync(const PP_ArrayOutput& devices) OVERRIDE;
43
44 private:
45 enum OpenState {
46 BEFORE_OPEN,
47 OPENED,
48 CLOSED
49 };
50
51 // PluginResource overrides.
52 virtual void OnReplyReceived(const ResourceMessageReplyParams& params,
53 const IPC::Message& msg) OVERRIDE;
54
55 void OnPluginMsgOnDeviceInfo(const ResourceMessageReplyParams& params,
56 const struct PP_VideoCaptureDeviceInfo_Dev& info,
57 const std::vector<HostResource>& buffers,
58 uint32_t buffer_size);
59 void OnPluginMsgOnStatus(const ResourceMessageReplyParams& params,
60 uint32_t status);
61 void OnPluginMsgOnError(const ResourceMessageReplyParams& params,
62 uint32_t error);
63 void OnPluginMsgOnBufferReady(const ResourceMessageReplyParams& params,
64 uint32_t buffer);
65
66 void OnPluginMsgOpenReply(const ResourceMessageReplyParams& params);
67 void OnPluginMsgEnumerateDevicesReply(
68 PP_Resource* devices_output,
69 scoped_refptr<TrackedCallback> callback,
70 const ResourceMessageReplyParams& params,
71 const std::vector<DeviceRefData>& devices);
72
73 void SetBufferInUse(uint32_t buffer_index);
74
75 // Points to the C interface of client implementation.
76 const PPP_VideoCapture_Dev* ppp_video_capture_impl_;
77
78 // Indicates that the i-th buffer is currently in use.
79 std::vector<bool> buffer_in_use_;
80
81 // Holds a reference of the callback so that Close() can cancel it.
82 scoped_refptr<TrackedCallback> open_callback_;
83 OpenState open_state_;
84
85 bool has_pending_enum_devices_callback_;
86
87 DISALLOW_COPY_AND_ASSIGN(VideoCaptureResource);
88 };
89
90 } // namespace proxy
91 } // namespace ppapi
92
93 #endif // PPAPI_PROXY_VIDEO_CAPTURE_RESOURCE_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/serialized_structs.h ('k') | ppapi/proxy/video_capture_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698