| 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/cpp/dev/video_capture_dev.h" | 5 #include "ppapi/cpp/dev/video_capture_dev.h" |
| 6 | 6 |
| 7 #include "ppapi/c/dev/ppb_video_capture_dev.h" | 7 #include "ppapi/c/dev/ppb_video_capture_dev.h" |
| 8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
| 9 #include "ppapi/cpp/instance.h" | 9 #include "ppapi/cpp/instance.h" |
| 10 #include "ppapi/cpp/module.h" | 10 #include "ppapi/cpp/module.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 instance.pp_instance())); | 27 instance.pp_instance())); |
| 28 } | 28 } |
| 29 | 29 |
| 30 VideoCapture_Dev::VideoCapture_Dev(PP_Resource resource) : Resource(resource) { | 30 VideoCapture_Dev::VideoCapture_Dev(PP_Resource resource) : Resource(resource) { |
| 31 } | 31 } |
| 32 | 32 |
| 33 VideoCapture_Dev::VideoCapture_Dev(const VideoCapture_Dev& other) | 33 VideoCapture_Dev::VideoCapture_Dev(const VideoCapture_Dev& other) |
| 34 : Resource(other) { | 34 : Resource(other) { |
| 35 } | 35 } |
| 36 | 36 |
| 37 // static |
| 38 bool VideoCapture_Dev::IsAvailable() { |
| 39 return has_interface<PPB_VideoCapture_Dev>(); |
| 40 } |
| 41 |
| 37 int32_t VideoCapture_Dev::StartCapture( | 42 int32_t VideoCapture_Dev::StartCapture( |
| 38 const PP_VideoCaptureDeviceInfo_Dev& requested_info, | 43 const PP_VideoCaptureDeviceInfo_Dev& requested_info, |
| 39 uint32_t buffer_count) { | 44 uint32_t buffer_count) { |
| 40 if (!has_interface<PPB_VideoCapture_Dev>()) | 45 if (!has_interface<PPB_VideoCapture_Dev>()) |
| 41 return PP_ERROR_FAILED; | 46 return PP_ERROR_FAILED; |
| 42 return get_interface<PPB_VideoCapture_Dev>()->StartCapture( | 47 return get_interface<PPB_VideoCapture_Dev>()->StartCapture( |
| 43 pp_resource(), &requested_info, buffer_count); | 48 pp_resource(), &requested_info, buffer_count); |
| 44 } | 49 } |
| 45 | 50 |
| 46 int32_t VideoCapture_Dev::ReuseBuffer(uint32_t buffer) { | 51 int32_t VideoCapture_Dev::ReuseBuffer(uint32_t buffer) { |
| 47 if (!has_interface<PPB_VideoCapture_Dev>()) | 52 if (!has_interface<PPB_VideoCapture_Dev>()) |
| 48 return PP_ERROR_FAILED; | 53 return PP_ERROR_FAILED; |
| 49 return get_interface<PPB_VideoCapture_Dev>()->ReuseBuffer( | 54 return get_interface<PPB_VideoCapture_Dev>()->ReuseBuffer( |
| 50 pp_resource(), buffer); | 55 pp_resource(), buffer); |
| 51 } | 56 } |
| 52 | 57 |
| 53 int32_t VideoCapture_Dev::StopCapture(){ | 58 int32_t VideoCapture_Dev::StopCapture(){ |
| 54 if (!has_interface<PPB_VideoCapture_Dev>()) | 59 if (!has_interface<PPB_VideoCapture_Dev>()) |
| 55 return PP_ERROR_FAILED; | 60 return PP_ERROR_FAILED; |
| 56 return get_interface<PPB_VideoCapture_Dev>()->StopCapture(pp_resource()); | 61 return get_interface<PPB_VideoCapture_Dev>()->StopCapture(pp_resource()); |
| 57 } | 62 } |
| 58 | 63 |
| 59 } // namespace pp | 64 } // namespace pp |
| OLD | NEW |