OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "ppapi/proxy/ppb_video_capture_proxy.h" | 5 #include "ppapi/proxy/ppb_video_capture_proxy.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 }; | 142 }; |
143 | 143 |
144 } // namespace | 144 } // namespace |
145 | 145 |
146 class VideoCapture : public ppapi::thunk::PPB_VideoCapture_API, | 146 class VideoCapture : public ppapi::thunk::PPB_VideoCapture_API, |
147 public PluginResource { | 147 public PluginResource { |
148 public: | 148 public: |
149 VideoCapture(const HostResource& resource); | 149 VideoCapture(const HostResource& resource); |
150 virtual ~VideoCapture(); | 150 virtual ~VideoCapture(); |
151 | 151 |
152 // Resource overrides. | |
153 virtual VideoCapture* AsVideoCapture() OVERRIDE; | |
154 | |
155 // ResourceObjectBase overrides. | 152 // ResourceObjectBase overrides. |
156 virtual ppapi::thunk::PPB_VideoCapture_API* AsPPB_VideoCapture_API() OVERRIDE; | 153 virtual ppapi::thunk::PPB_VideoCapture_API* AsPPB_VideoCapture_API() OVERRIDE; |
157 | 154 |
158 // PPB_VideoCapture_API implementation. | 155 // PPB_VideoCapture_API implementation. |
159 virtual int32_t StartCapture( | 156 virtual int32_t StartCapture( |
160 const PP_VideoCaptureDeviceInfo_Dev& requested_info, | 157 const PP_VideoCaptureDeviceInfo_Dev& requested_info, |
161 uint32_t buffer_count) { | 158 uint32_t buffer_count) { |
162 switch (status_) { | 159 switch (status_) { |
163 case PP_VIDEO_CAPTURE_STATUS_STARTING: | 160 case PP_VIDEO_CAPTURE_STATUS_STARTING: |
164 case PP_VIDEO_CAPTURE_STATUS_STARTED: | 161 case PP_VIDEO_CAPTURE_STATUS_STARTED: |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 }; | 251 }; |
255 | 252 |
256 VideoCapture::VideoCapture(const HostResource& resource) | 253 VideoCapture::VideoCapture(const HostResource& resource) |
257 : PluginResource(resource), | 254 : PluginResource(resource), |
258 status_(PP_VIDEO_CAPTURE_STATUS_STOPPED) { | 255 status_(PP_VIDEO_CAPTURE_STATUS_STOPPED) { |
259 } | 256 } |
260 | 257 |
261 VideoCapture::~VideoCapture() { | 258 VideoCapture::~VideoCapture() { |
262 } | 259 } |
263 | 260 |
264 VideoCapture* VideoCapture::AsVideoCapture() { | |
265 return this; | |
266 } | |
267 | |
268 ppapi::thunk::PPB_VideoCapture_API* VideoCapture::AsPPB_VideoCapture_API() { | 261 ppapi::thunk::PPB_VideoCapture_API* VideoCapture::AsPPB_VideoCapture_API() { |
269 return this; | 262 return this; |
270 } | 263 } |
271 | 264 |
272 PPB_VideoCapture_Proxy::PPB_VideoCapture_Proxy(Dispatcher* dispatcher, | 265 PPB_VideoCapture_Proxy::PPB_VideoCapture_Proxy(Dispatcher* dispatcher, |
273 const void* target_interface) | 266 const void* target_interface) |
274 : InterfaceProxy(dispatcher, target_interface) { | 267 : InterfaceProxy(dispatcher, target_interface) { |
275 } | 268 } |
276 | 269 |
277 PPB_VideoCapture_Proxy::~PPB_VideoCapture_Proxy() { | 270 PPB_VideoCapture_Proxy::~PPB_VideoCapture_Proxy() { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 PP_Resource resource = tracker->PluginResourceForHostResource(host_resource); | 443 PP_Resource resource = tracker->PluginResourceForHostResource(host_resource); |
451 if (!resource || !ppp_video_capture_target() || enter.failed()) | 444 if (!resource || !ppp_video_capture_target() || enter.failed()) |
452 return; | 445 return; |
453 static_cast<VideoCapture*>(enter.object())->SetBufferInUse(buffer); | 446 static_cast<VideoCapture*>(enter.object())->SetBufferInUse(buffer); |
454 ppp_video_capture_target()->OnBufferReady( | 447 ppp_video_capture_target()->OnBufferReady( |
455 host_resource.instance(), resource, buffer); | 448 host_resource.instance(), resource, buffer); |
456 } | 449 } |
457 | 450 |
458 } // namespace proxy | 451 } // namespace proxy |
459 } // namespace pp | 452 } // namespace pp |
OLD | NEW |