summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp
diff options
context:
space:
mode:
authorraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-16 02:14:11 +0000
committerraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-16 02:14:11 +0000
commitd29171a549b5c20980b9930c07e34da97bcbd13c (patch)
tree0acbe45178f5313cdd704652fc6f866c4255833b /ppapi/cpp
parentc0131a39a53f46594e6af35127f8c1b4e3bebd28 (diff)
downloadchromium_src-d29171a549b5c20980b9930c07e34da97bcbd13c.zip
chromium_src-d29171a549b5c20980b9930c07e34da97bcbd13c.tar.gz
chromium_src-d29171a549b5c20980b9930c07e34da97bcbd13c.tar.bz2
Implement host side of sync EnumerateVideoCaptureDevices
This implements the host side of the sync ppapi function EnumerateVideoCaptureDevices. BUG=none TEST=Wrote a sample that runs the sync and non-sync versions. Ran it and compared the outputs. Review URL: https://chromiumcodereview.appspot.com/11016007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162048 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp')
-rw-r--r--ppapi/cpp/private/flash.cc30
-rw-r--r--ppapi/cpp/private/flash.h6
2 files changed, 34 insertions, 2 deletions
diff --git a/ppapi/cpp/private/flash.cc b/ppapi/cpp/private/flash.cc
index 3a3da4e..5707b70 100644
--- a/ppapi/cpp/private/flash.cc
+++ b/ppapi/cpp/private/flash.cc
@@ -8,7 +8,9 @@
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_errors.h"
+#include "ppapi/cpp/dev/device_ref_dev.h"
#include "ppapi/cpp/dev/font_dev.h"
+#include "ppapi/cpp/dev/video_capture_dev.h"
#include "ppapi/cpp/image_data.h"
#include "ppapi/cpp/instance_handle.h"
#include "ppapi/cpp/module.h"
@@ -24,6 +26,10 @@ namespace pp {
namespace {
+template <> const char* interface_name<PPB_Flash_12_6>() {
+ return PPB_FLASH_INTERFACE_12_6;
+}
+
template <> const char* interface_name<PPB_Flash_12_5>() {
return PPB_FLASH_INTERFACE_12_5;
}
@@ -53,7 +59,10 @@ PPB_Flash flash_12_combined_interface;
void InitializeCombinedInterface() {
if (initialized_combined_interface)
return;
- if (has_interface<PPB_Flash_12_5>()) {
+ if (has_interface<PPB_Flash_12_6>()) {
+ memcpy(&flash_12_combined_interface, get_interface<PPB_Flash_12_6>(),
+ sizeof(PPB_Flash_12_6));
+ } else if (has_interface<PPB_Flash_12_5>()) {
memcpy(&flash_12_combined_interface, get_interface<PPB_Flash_12_5>(),
sizeof(PPB_Flash_12_5));
} else if (has_interface<PPB_Flash_12_4>()) {
@@ -72,7 +81,8 @@ namespace flash {
// static
bool Flash::IsAvailable() {
- return has_interface<PPB_Flash_12_5>() ||
+ return has_interface<PPB_Flash_12_6>() ||
+ has_interface<PPB_Flash_12_5>() ||
has_interface<PPB_Flash_12_4>() ||
has_interface<PPB_Flash_12_3>();
}
@@ -246,6 +256,22 @@ bool Flash::SetCrashData(const InstanceHandle& instance,
}
// static
+int32_t Flash::EnumerateVideoCaptureDevices(
+ const InstanceHandle& instance,
+ const VideoCapture_Dev& video_capture,
+ std::vector<DeviceRef_Dev>* devices_out) {
+ InitializeCombinedInterface();
+ if (flash_12_combined_interface.EnumerateVideoCaptureDevices) {
+ ResourceArrayOutputAdapter<DeviceRef_Dev> adapter(devices_out);
+ return flash_12_combined_interface.EnumerateVideoCaptureDevices(
+ instance.pp_instance(),
+ video_capture.pp_resource(),
+ adapter.pp_array_output());
+ }
+ return PP_ERROR_FAILED;
+}
+
+// static
bool Flash::InvokePrinting(const InstanceHandle& instance) {
if (has_interface<PPB_Flash_Print_1_0>()) {
get_interface<PPB_Flash_Print_1_0>()->InvokePrinting(
diff --git a/ppapi/cpp/private/flash.h b/ppapi/cpp/private/flash.h
index dc5f929..857c689 100644
--- a/ppapi/cpp/private/flash.h
+++ b/ppapi/cpp/private/flash.h
@@ -6,6 +6,7 @@
#define PPAPI_CPP_PRIVATE_FLASH_H_
#include <string>
+#include <vector>
#include "ppapi/c/private/ppb_flash.h"
#include "ppapi/c/pp_stdint.h"
@@ -15,6 +16,7 @@ struct PP_Point;
namespace pp {
+class DeviceRef_Dev;
class FontDescription_Dev;
class ImageData;
class InstanceHandle;
@@ -23,6 +25,7 @@ class Point;
class Rect;
class URLRequestInfo;
class Var;
+class VideoCapture_Dev;
namespace flash {
@@ -63,6 +66,9 @@ class Flash {
static bool SetCrashData(const InstanceHandle& instance,
PP_FlashCrashKey key,
const pp::Var& value);
+ static int32_t EnumerateVideoCaptureDevices(const InstanceHandle& instance,
+ const VideoCapture_Dev& video_capture,
+ std::vector<DeviceRef_Dev>* devices_out);
// PPB_Flash_Print.
static bool InvokePrinting(const InstanceHandle& instance);