OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ppapi/cpp/dev/video_capture_dev.h" |
| 6 |
| 7 #include "ppapi/c/dev/ppb_video_capture_dev.h" |
| 8 #include "ppapi/c/pp_errors.h" |
| 9 #include "ppapi/cpp/instance.h" |
| 10 #include "ppapi/cpp/module.h" |
| 11 #include "ppapi/cpp/module_impl.h" |
| 12 |
| 13 namespace pp { |
| 14 |
| 15 namespace { |
| 16 |
| 17 template <> const char* interface_name<PPB_VideoCapture_Dev>() { |
| 18 return PPB_VIDEO_CAPTURE_DEV_INTERFACE; |
| 19 } |
| 20 |
| 21 } // namespace |
| 22 |
| 23 VideoCapture_Dev::VideoCapture_Dev(const Instance& instance) { |
| 24 if (!has_interface<PPB_VideoCapture_Dev>()) |
| 25 return; |
| 26 PassRefFromConstructor(get_interface<PPB_VideoCapture_Dev>()->Create( |
| 27 instance.pp_instance())); |
| 28 } |
| 29 |
| 30 VideoCapture_Dev::VideoCapture_Dev(PP_Resource resource) : Resource(resource) { |
| 31 } |
| 32 |
| 33 VideoCapture_Dev::VideoCapture_Dev(const VideoCapture_Dev& other) |
| 34 : Resource(other) { |
| 35 } |
| 36 |
| 37 int32_t VideoCapture_Dev::StartCapture( |
| 38 const PP_VideoCaptureDeviceInfo_Dev& requested_info, |
| 39 uint32_t buffer_count) { |
| 40 if (!has_interface<PPB_VideoCapture_Dev>()) |
| 41 return PP_ERROR_FAILED; |
| 42 return get_interface<PPB_VideoCapture_Dev>()->StartCapture( |
| 43 pp_resource(), &requested_info, buffer_count); |
| 44 } |
| 45 |
| 46 int32_t VideoCapture_Dev::ReuseBuffer(uint32_t buffer) { |
| 47 if (!has_interface<PPB_VideoCapture_Dev>()) |
| 48 return PP_ERROR_FAILED; |
| 49 return get_interface<PPB_VideoCapture_Dev>()->ReuseBuffer( |
| 50 pp_resource(), buffer); |
| 51 } |
| 52 |
| 53 int32_t VideoCapture_Dev::StopCapture(){ |
| 54 if (!has_interface<PPB_VideoCapture_Dev>()) |
| 55 return PP_ERROR_FAILED; |
| 56 return get_interface<PPB_VideoCapture_Dev>()->StopCapture(pp_resource()); |
| 57 } |
| 58 |
| 59 } // namespace pp |
OLD | NEW |