Chromium Code Reviews| OLD | NEW |
|---|---|
| (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/ppapi_proxy_export.h" | |
| 11 #include "ppapi/proxy/plugin_resource.h" | |
| 12 #include "ppapi/shared_impl/api_id.h" | |
|
yzshen1
2012/11/06 06:51:40
why do you need this?
victorhsieh
2012/11/08 09:20:18
Done.
| |
| 13 #include "ppapi/thunk/ppb_video_capture_api.h" | |
| 14 | |
| 15 namespace ppapi { | |
| 16 namespace proxy { | |
| 17 | |
| 18 class PPAPI_PROXY_EXPORT VideoCaptureResource | |
|
yzshen1
2012/11/06 06:51:40
I don't think it is necessary to be exported.
(And
victorhsieh
2012/11/08 09:20:18
Done. It runs well, but I saw many resource heade
| |
| 19 : public PluginResource, | |
| 20 public NON_EXPORTED_BASE(::ppapi::thunk::PPB_VideoCapture_API) { | |
| 21 public: | |
| 22 VideoCaptureResource(Connection connection, PP_Instance instance, | |
|
yzshen1
2012/11/06 06:51:40
According to style guide, you should not put multi
victorhsieh
2012/11/08 09:20:18
Done.
| |
| 23 PluginDispatcher* dispatcher); | |
| 24 ~VideoCaptureResource(); | |
|
yzshen1
2012/11/06 06:51:40
virtual
victorhsieh
2012/11/08 09:20:18
Done.
| |
| 25 | |
| 26 void OnReplyReceived(const ResourceMessageReplyParams& params, | |
|
yzshen1
2012/11/06 06:51:40
- virtual.
- add "<some_base_class> implementation
victorhsieh
2012/11/08 09:20:18
Done and moved to private.
| |
| 27 const IPC::Message& msg) OVERRIDE; | |
| 28 | |
| 29 thunk::PPB_VideoCapture_API* AsPPB_VideoCapture_API() OVERRIDE { | |
|
yzshen1
2012/11/06 06:51:40
ditto.
victorhsieh
2012/11/08 09:20:18
Done.
| |
| 30 return this; | |
| 31 } | |
| 32 | |
| 33 // PPB_VideoCapture_API | |
| 34 int32_t EnumerateDevices(PP_Resource* devices, | |
| 35 scoped_refptr<TrackedCallback> callback) OVERRIDE; | |
| 36 int32_t Open(const std::string& device_id, | |
| 37 const PP_VideoCaptureDeviceInfo_Dev& requested_info, | |
| 38 uint32_t buffer_count, | |
| 39 scoped_refptr<TrackedCallback> callback) OVERRIDE; | |
| 40 int32_t StartCapture() OVERRIDE; | |
| 41 int32_t ReuseBuffer(uint32_t buffer) OVERRIDE; | |
| 42 int32_t StopCapture() OVERRIDE; | |
| 43 void Close() OVERRIDE; | |
| 44 const std::vector<DeviceRefData>& GetDeviceRefData() const OVERRIDE { | |
|
yzshen1
2012/11/06 06:51:40
you don't need this method.
victorhsieh
2012/11/08 09:20:18
It's still referenced by PepperFlashHost.
yzshen1
2012/11/10 01:14:40
You have to also change PepperFlashHost. It will b
victorhsieh
2012/11/13 03:10:53
Done.
| |
| 45 return devices_data_; | |
| 46 } | |
| 47 | |
| 48 private: | |
| 49 enum OpenState { | |
| 50 BEFORE_OPEN, | |
| 51 OPENED, | |
| 52 CLOSED | |
| 53 }; | |
| 54 | |
| 55 void OnDeviceInfo(const ResourceMessageReplyParams& params, | |
| 56 const struct PP_VideoCaptureDeviceInfo_Dev& info, | |
| 57 const std::vector<HostResource>& buffers, | |
| 58 uint32_t buffer_size); | |
| 59 void OnStatus(const ResourceMessageReplyParams& params, | |
| 60 uint32_t status); | |
| 61 void OnError(const ResourceMessageReplyParams& params, | |
| 62 uint32_t error); | |
| 63 void OnBufferReady(const ResourceMessageReplyParams& params, | |
| 64 uint32_t buffer); | |
| 65 | |
| 66 void OnOpenComplete(const ResourceMessageReplyParams& params); | |
|
yzshen1
2012/11/06 06:51:40
nit: The convention is to use OnPluginMsg<the last
victorhsieh
2012/11/08 09:20:18
Done.
| |
| 67 void OnEnumerateDevicesComplete(PP_Resource* devices_output, | |
| 68 scoped_refptr<TrackedCallback> callback, | |
| 69 const ResourceMessageReplyParams& params, | |
| 70 const std::vector<DeviceRefData>& devices); | |
| 71 | |
| 72 void SetBufferInUse(uint32_t buffer_index); | |
| 73 | |
| 74 // Points to the client implementation of pp::VideoCaptureClient_Dev. | |
|
yzshen1
2012/11/06 06:51:40
nit: inaccurate comment, this doesn't point to the
victorhsieh
2012/11/08 09:20:18
Done.
| |
| 75 const PPP_VideoCapture_Dev* ppp_video_capture_impl_; | |
| 76 | |
| 77 // Indicates that the i-th buffer is currently in use. | |
| 78 std::vector<bool> buffer_in_use_; | |
| 79 | |
| 80 // Holds a reference of the callback so that Close() can cancel it. | |
| 81 scoped_refptr<TrackedCallback> open_callback_; | |
| 82 OpenState open_state_; | |
| 83 | |
| 84 // Saves the output of EnumerateDevices(). | |
| 85 std::vector<DeviceRefData> devices_data_; | |
|
yzshen1
2012/11/06 06:51:40
you don't need this one.
victorhsieh
2012/11/08 09:20:18
ditto, still referenced.
yzshen1
2012/11/10 01:14:40
ditto.
On 2012/11/08 09:20:18, Victor Hsieh wrote:
victorhsieh
2012/11/13 03:10:53
Done.
| |
| 86 bool has_pending_enum_devices_callback_; | |
| 87 }; | |
|
yzshen1
2012/11/06 06:51:40
DISALLOW_COPY_AND_ASSIGN, please.
victorhsieh
2012/11/08 09:20:18
Done.
| |
| 88 | |
| 89 } // namespace proxy | |
| 90 } // namespace ppapi | |
| 91 | |
| 92 #endif // PPAPI_PROXY_VIDEO_CAPTURE_RESOURCE_H_ | |
| OLD | NEW |