Index: ppapi/cpp/dev/video_capture_dev.cc |
diff --git a/ppapi/cpp/dev/video_capture_dev.cc b/ppapi/cpp/dev/video_capture_dev.cc |
index ecb55729309c5badbf17fb4efa2f0cef32d8593f..7a4502835ce377d21789e0b4ccc7cebb1aadd38d 100644 |
--- a/ppapi/cpp/dev/video_capture_dev.cc |
+++ b/ppapi/cpp/dev/video_capture_dev.cc |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -6,6 +6,9 @@ |
#include "ppapi/c/dev/ppb_video_capture_dev.h" |
#include "ppapi/c/pp_errors.h" |
+#include "ppapi/cpp/completion_callback.h" |
+#include "ppapi/cpp/dev/device_ref_dev.h" |
+#include "ppapi/cpp/dev/resource_array_dev.h" |
#include "ppapi/cpp/instance.h" |
#include "ppapi/cpp/module.h" |
#include "ppapi/cpp/module_impl.h" |
@@ -39,13 +42,34 @@ bool VideoCapture_Dev::IsAvailable() { |
return has_interface<PPB_VideoCapture_Dev>(); |
} |
+int32_t VideoCapture_Dev::EnumerateDevices(const CompletionCallback& callback) { |
+ if (!has_interface<PPB_VideoCapture_Dev>()) |
+ return callback.MayForce(PP_ERROR_NOINTERFACE); |
+ return get_interface<PPB_VideoCapture_Dev>()->EnumerateDevices( |
+ pp_resource(), callback.pp_completion_callback()); |
+} |
+ |
+void VideoCapture_Dev::GetDevices(std::vector<DeviceRef_Dev>* devices) { |
+ if (!has_interface<PPB_VideoCapture_Dev>() || !devices) |
+ return; |
+ devices->clear(); |
+ ResourceArray_Dev resources( |
+ ResourceArray_Dev::PassRef(), |
+ get_interface<PPB_VideoCapture_Dev>()->GetDevices(pp_resource())); |
+ for (uint32_t index = 0; index < resources.size(); ++index) { |
+ DeviceRef_Dev device(resources[index]); |
+ devices->push_back(device); |
+ } |
+} |
+ |
int32_t VideoCapture_Dev::StartCapture( |
+ const DeviceRef_Dev& device_ref, |
const PP_VideoCaptureDeviceInfo_Dev& requested_info, |
uint32_t buffer_count) { |
if (!has_interface<PPB_VideoCapture_Dev>()) |
return PP_ERROR_FAILED; |
return get_interface<PPB_VideoCapture_Dev>()->StartCapture( |
- pp_resource(), &requested_info, buffer_count); |
+ pp_resource(), device_ref.pp_resource(), &requested_info, buffer_count); |
} |
int32_t VideoCapture_Dev::ReuseBuffer(uint32_t buffer) { |