| 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" |
| 11 #include "ppapi/c/pp_errors.h" | 11 #include "ppapi/c/pp_errors.h" |
| 12 #include "ppapi/c/pp_resource.h" | 12 #include "ppapi/c/pp_resource.h" |
| 13 #include "ppapi/c/ppb_core.h" | 13 #include "ppapi/c/ppb_core.h" |
| 14 #include "ppapi/c/dev/ppb_video_capture_dev.h" | 14 #include "ppapi/c/dev/ppb_video_capture_dev.h" |
| 15 #include "ppapi/c/dev/ppp_video_capture_dev.h" | 15 #include "ppapi/c/dev/ppp_video_capture_dev.h" |
| 16 #include "ppapi/proxy/enter_proxy.h" | 16 #include "ppapi/proxy/enter_proxy.h" |
| 17 #include "ppapi/proxy/host_dispatcher.h" | 17 #include "ppapi/proxy/host_dispatcher.h" |
| 18 #include "ppapi/proxy/plugin_dispatcher.h" | 18 #include "ppapi/proxy/plugin_dispatcher.h" |
| 19 #include "ppapi/proxy/plugin_resource.h" | 19 #include "ppapi/proxy/plugin_resource.h" |
| 20 #include "ppapi/proxy/ppapi_messages.h" | 20 #include "ppapi/proxy/ppapi_messages.h" |
| 21 #include "ppapi/proxy/ppb_buffer_proxy.h" | 21 #include "ppapi/proxy/ppb_buffer_proxy.h" |
| 22 #include "ppapi/thunk/ppb_buffer_api.h" | 22 #include "ppapi/thunk/ppb_buffer_api.h" |
| 23 #include "ppapi/thunk/ppb_buffer_trusted_api.h" | 23 #include "ppapi/thunk/ppb_buffer_trusted_api.h" |
| 24 #include "ppapi/thunk/ppb_video_capture_api.h" | 24 #include "ppapi/thunk/ppb_video_capture_api.h" |
| 25 #include "ppapi/thunk/thunk.h" | 25 #include "ppapi/thunk/thunk.h" |
| 26 | 26 |
| 27 using ppapi::HostResource; |
| 27 using ppapi::thunk::EnterResourceNoLock; | 28 using ppapi::thunk::EnterResourceNoLock; |
| 28 using ppapi::thunk::PPB_Buffer_API; | 29 using ppapi::thunk::PPB_Buffer_API; |
| 29 using ppapi::thunk::PPB_BufferTrusted_API; | 30 using ppapi::thunk::PPB_BufferTrusted_API; |
| 30 using ppapi::thunk::PPB_VideoCapture_API; | 31 using ppapi::thunk::PPB_VideoCapture_API; |
| 31 | 32 |
| 32 namespace pp { | 33 namespace pp { |
| 33 namespace proxy { | 34 namespace proxy { |
| 34 | 35 |
| 35 namespace { | 36 namespace { |
| 36 | 37 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 }; | 143 }; |
| 143 | 144 |
| 144 } // namespace | 145 } // namespace |
| 145 | 146 |
| 146 class VideoCapture : public ppapi::thunk::PPB_VideoCapture_API, | 147 class VideoCapture : public ppapi::thunk::PPB_VideoCapture_API, |
| 147 public PluginResource { | 148 public PluginResource { |
| 148 public: | 149 public: |
| 149 VideoCapture(const HostResource& resource); | 150 VideoCapture(const HostResource& resource); |
| 150 virtual ~VideoCapture(); | 151 virtual ~VideoCapture(); |
| 151 | 152 |
| 152 // Resource overrides. | |
| 153 virtual VideoCapture* AsVideoCapture() OVERRIDE; | |
| 154 | |
| 155 // ResourceObjectBase overrides. | 153 // ResourceObjectBase overrides. |
| 156 virtual ppapi::thunk::PPB_VideoCapture_API* AsPPB_VideoCapture_API() OVERRIDE; | 154 virtual ppapi::thunk::PPB_VideoCapture_API* AsPPB_VideoCapture_API() OVERRIDE; |
| 157 | 155 |
| 158 // PPB_VideoCapture_API implementation. | 156 // PPB_VideoCapture_API implementation. |
| 159 virtual int32_t StartCapture( | 157 virtual int32_t StartCapture( |
| 160 const PP_VideoCaptureDeviceInfo_Dev& requested_info, | 158 const PP_VideoCaptureDeviceInfo_Dev& requested_info, |
| 161 uint32_t buffer_count) { | 159 uint32_t buffer_count) { |
| 162 switch (status_) { | 160 switch (status_) { |
| 163 case PP_VIDEO_CAPTURE_STATUS_STARTING: | 161 case PP_VIDEO_CAPTURE_STATUS_STARTING: |
| 164 case PP_VIDEO_CAPTURE_STATUS_STARTED: | 162 case PP_VIDEO_CAPTURE_STATUS_STARTED: |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 }; | 252 }; |
| 255 | 253 |
| 256 VideoCapture::VideoCapture(const HostResource& resource) | 254 VideoCapture::VideoCapture(const HostResource& resource) |
| 257 : PluginResource(resource), | 255 : PluginResource(resource), |
| 258 status_(PP_VIDEO_CAPTURE_STATUS_STOPPED) { | 256 status_(PP_VIDEO_CAPTURE_STATUS_STOPPED) { |
| 259 } | 257 } |
| 260 | 258 |
| 261 VideoCapture::~VideoCapture() { | 259 VideoCapture::~VideoCapture() { |
| 262 } | 260 } |
| 263 | 261 |
| 264 VideoCapture* VideoCapture::AsVideoCapture() { | |
| 265 return this; | |
| 266 } | |
| 267 | |
| 268 ppapi::thunk::PPB_VideoCapture_API* VideoCapture::AsPPB_VideoCapture_API() { | 262 ppapi::thunk::PPB_VideoCapture_API* VideoCapture::AsPPB_VideoCapture_API() { |
| 269 return this; | 263 return this; |
| 270 } | 264 } |
| 271 | 265 |
| 272 PPB_VideoCapture_Proxy::PPB_VideoCapture_Proxy(Dispatcher* dispatcher, | 266 PPB_VideoCapture_Proxy::PPB_VideoCapture_Proxy(Dispatcher* dispatcher, |
| 273 const void* target_interface) | 267 const void* target_interface) |
| 274 : InterfaceProxy(dispatcher, target_interface) { | 268 : InterfaceProxy(dispatcher, target_interface) { |
| 275 } | 269 } |
| 276 | 270 |
| 277 PPB_VideoCapture_Proxy::~PPB_VideoCapture_Proxy() { | 271 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); | 444 PP_Resource resource = tracker->PluginResourceForHostResource(host_resource); |
| 451 if (!resource || !ppp_video_capture_target() || enter.failed()) | 445 if (!resource || !ppp_video_capture_target() || enter.failed()) |
| 452 return; | 446 return; |
| 453 static_cast<VideoCapture*>(enter.object())->SetBufferInUse(buffer); | 447 static_cast<VideoCapture*>(enter.object())->SetBufferInUse(buffer); |
| 454 ppp_video_capture_target()->OnBufferReady( | 448 ppp_video_capture_target()->OnBufferReady( |
| 455 host_resource.instance(), resource, buffer); | 449 host_resource.instance(), resource, buffer); |
| 456 } | 450 } |
| 457 | 451 |
| 458 } // namespace proxy | 452 } // namespace proxy |
| 459 } // namespace pp | 453 } // namespace pp |
| OLD | NEW |