OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PPAPI_SHARED_IMPL_PPB_VIDEO_CAPTURE_SHARED_H_ | 5 #ifndef PPAPI_SHARED_IMPL_PPB_VIDEO_CAPTURE_SHARED_H_ |
6 #define PPAPI_SHARED_IMPL_PPB_VIDEO_CAPTURE_SHARED_H_ | 6 #define PPAPI_SHARED_IMPL_PPB_VIDEO_CAPTURE_SHARED_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 explicit PPB_VideoCapture_Shared(PP_Instance instance); | 22 explicit PPB_VideoCapture_Shared(PP_Instance instance); |
23 explicit PPB_VideoCapture_Shared(const HostResource& host_resource); | 23 explicit PPB_VideoCapture_Shared(const HostResource& host_resource); |
24 virtual ~PPB_VideoCapture_Shared(); | 24 virtual ~PPB_VideoCapture_Shared(); |
25 | 25 |
26 // Resource implementation. | 26 // Resource implementation. |
27 virtual thunk::PPB_VideoCapture_API* AsPPB_VideoCapture_API() OVERRIDE; | 27 virtual thunk::PPB_VideoCapture_API* AsPPB_VideoCapture_API() OVERRIDE; |
28 | 28 |
29 // PPB_VideoCapture_API implementation. | 29 // PPB_VideoCapture_API implementation. |
30 virtual int32_t EnumerateDevices( | 30 virtual int32_t EnumerateDevices( |
31 PP_Resource* devices, | 31 PP_Resource* devices, |
32 const PP_CompletionCallback& callback) OVERRIDE; | 32 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
33 virtual int32_t Open(const std::string& device_id, | 33 virtual int32_t Open(const std::string& device_id, |
34 const PP_VideoCaptureDeviceInfo_Dev& requested_info, | 34 const PP_VideoCaptureDeviceInfo_Dev& requested_info, |
35 uint32_t buffer_count, | 35 uint32_t buffer_count, |
36 const PP_CompletionCallback& callback) OVERRIDE; | 36 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
37 virtual int32_t StartCapture() OVERRIDE; | 37 virtual int32_t StartCapture() OVERRIDE; |
38 virtual int32_t ReuseBuffer(uint32_t buffer) OVERRIDE; | 38 virtual int32_t ReuseBuffer(uint32_t buffer) OVERRIDE; |
39 virtual int32_t StopCapture() OVERRIDE; | 39 virtual int32_t StopCapture() OVERRIDE; |
40 virtual void Close() OVERRIDE; | 40 virtual void Close() OVERRIDE; |
41 virtual int32_t StartCapture0_1( | 41 virtual int32_t StartCapture0_1( |
42 const PP_VideoCaptureDeviceInfo_Dev& requested_info, | 42 const PP_VideoCaptureDeviceInfo_Dev& requested_info, |
43 uint32_t buffer_count) OVERRIDE; | 43 uint32_t buffer_count) OVERRIDE; |
44 virtual const std::vector<DeviceRefData>& GetDeviceRefData() const OVERRIDE; | 44 virtual const std::vector<DeviceRefData>& GetDeviceRefData() const OVERRIDE; |
45 | 45 |
46 void OnEnumerateDevicesComplete(int32_t result, | 46 void OnEnumerateDevicesComplete(int32_t result, |
47 const std::vector<DeviceRefData>& devices); | 47 const std::vector<DeviceRefData>& devices); |
48 void OnOpenComplete(int32_t result); | 48 void OnOpenComplete(int32_t result); |
49 | 49 |
50 protected: | 50 protected: |
51 enum OpenState { | 51 enum OpenState { |
52 BEFORE_OPEN, | 52 BEFORE_OPEN, |
53 OPENED, | 53 OPENED, |
54 CLOSED | 54 CLOSED |
55 }; | 55 }; |
56 | 56 |
57 // Subclasses should implement these methods to do impl- and proxy-specific | 57 // Subclasses should implement these methods to do impl- and proxy-specific |
58 // work. | 58 // work. |
59 virtual int32_t InternalEnumerateDevices( | 59 virtual int32_t InternalEnumerateDevices( |
60 PP_Resource* devices, | 60 PP_Resource* devices, |
61 const PP_CompletionCallback& callback) = 0; | 61 scoped_refptr<TrackedCallback> callback) = 0; |
62 virtual int32_t InternalOpen( | 62 virtual int32_t InternalOpen( |
63 const std::string& device_id, | 63 const std::string& device_id, |
64 const PP_VideoCaptureDeviceInfo_Dev& requested_info, | 64 const PP_VideoCaptureDeviceInfo_Dev& requested_info, |
65 uint32_t buffer_count, | 65 uint32_t buffer_count, |
66 const PP_CompletionCallback& callback) = 0; | 66 scoped_refptr<TrackedCallback> callback) = 0; |
67 virtual int32_t InternalStartCapture() = 0; | 67 virtual int32_t InternalStartCapture() = 0; |
68 virtual int32_t InternalReuseBuffer(uint32_t buffer) = 0; | 68 virtual int32_t InternalReuseBuffer(uint32_t buffer) = 0; |
69 virtual int32_t InternalStopCapture() = 0; | 69 virtual int32_t InternalStopCapture() = 0; |
70 virtual void InternalClose() = 0; | 70 virtual void InternalClose() = 0; |
71 virtual int32_t InternalStartCapture0_1( | 71 virtual int32_t InternalStartCapture0_1( |
72 const PP_VideoCaptureDeviceInfo_Dev& requested_info, | 72 const PP_VideoCaptureDeviceInfo_Dev& requested_info, |
73 uint32_t buffer_count) = 0; | 73 uint32_t buffer_count) = 0; |
74 virtual const std::vector<DeviceRefData>& InternalGetDeviceRefData( | 74 virtual const std::vector<DeviceRefData>& InternalGetDeviceRefData( |
75 ) const = 0; | 75 ) const = 0; |
76 | 76 |
(...skipping 14 matching lines...) Expand all Loading... |
91 | 91 |
92 ResourceObjectType resource_object_type_; | 92 ResourceObjectType resource_object_type_; |
93 | 93 |
94 private: | 94 private: |
95 DISALLOW_COPY_AND_ASSIGN(PPB_VideoCapture_Shared); | 95 DISALLOW_COPY_AND_ASSIGN(PPB_VideoCapture_Shared); |
96 }; | 96 }; |
97 | 97 |
98 } // namespace ppapi | 98 } // namespace ppapi |
99 | 99 |
100 #endif // PPAPI_SHARED_IMPL_PPB_VIDEO_CAPTURE_SHARED_H_ | 100 #endif // PPAPI_SHARED_IMPL_PPB_VIDEO_CAPTURE_SHARED_H_ |
OLD | NEW |