summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjchuang <jchuang@chromium.org>2015-02-19 19:42:49 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-20 03:43:37 +0000
commit512b0a0d63d97d9a73116f36663e36af4703d1f4 (patch)
tree1c8b0ee0e1de59d9c8136fd917243f49e82db7be
parentf0d499ba83a29c4a905b5087057484940b2d5118 (diff)
downloadchromium_src-512b0a0d63d97d9a73116f36663e36af4703d1f4.zip
chromium_src-512b0a0d63d97d9a73116f36663e36af4703d1f4.tar.gz
chromium_src-512b0a0d63d97d9a73116f36663e36af4703d1f4.tar.bz2
PPAPI: Suppport GetSupportedVideoCaptureFormats for frame_rate
BUG=387547 TEST=Call the API from a trusted plugin and print all video capture formats. Review URL: https://codereview.chromium.org/911623002 Cr-Commit-Position: refs/heads/master@{#317230}
-rw-r--r--content/renderer/pepper/pepper_image_capture_host.cc31
-rw-r--r--content/renderer/pepper/pepper_image_capture_host.h11
-rw-r--r--content/renderer/pepper/pepper_platform_image_capture.cc14
-rw-r--r--content/renderer/pepper/pepper_platform_image_capture.h2
-rw-r--r--ppapi/api/private/pp_video_capture_format.idl29
-rw-r--r--ppapi/api/private/ppb_camera_capabilities_private.idl20
-rw-r--r--ppapi/c/private/pp_video_capture_format.h47
-rw-r--r--ppapi/c/private/ppb_camera_capabilities_private.h24
-rw-r--r--ppapi/cpp/private/camera_capabilities_private.cc20
-rw-r--r--ppapi/cpp/private/camera_capabilities_private.h12
-rw-r--r--ppapi/proxy/camera_capabilities_resource.cc20
-rw-r--r--ppapi/proxy/camera_capabilities_resource.h11
-rw-r--r--ppapi/proxy/image_capture_resource.cc13
-rw-r--r--ppapi/proxy/image_capture_resource.h6
-rw-r--r--ppapi/proxy/ppapi_messages.h14
-rw-r--r--ppapi/thunk/ppb_camera_capabilities_api.h5
-rw-r--r--ppapi/thunk/ppb_camera_capabilities_private_thunk.cc18
17 files changed, 201 insertions, 96 deletions
diff --git a/content/renderer/pepper/pepper_image_capture_host.cc b/content/renderer/pepper/pepper_image_capture_host.cc
index 0734891..2285425 100644
--- a/content/renderer/pepper/pepper_image_capture_host.cc
+++ b/content/renderer/pepper/pepper_image_capture_host.cc
@@ -35,8 +35,8 @@ int32_t PepperImageCaptureHost::OnResourceMessageReceived(
PPAPI_BEGIN_MESSAGE_MAP(PepperImageCaptureHost, msg)
PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_ImageCapture_Open, OnOpen)
PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(
- PpapiHostMsg_ImageCapture_GetSupportedPreviewSizes,
- OnGetSupportedPreviewSizes)
+ PpapiHostMsg_ImageCapture_GetSupportedVideoCaptureFormats,
+ OnGetSupportedVideoCaptureFormats)
PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_ImageCapture_Close,
OnClose)
PPAPI_END_MESSAGE_MAP()
@@ -59,19 +59,20 @@ void PepperImageCaptureHost::OnInitialized(bool succeeded) {
open_reply_context_ = ppapi::host::ReplyMessageContext();
}
-void PepperImageCaptureHost::OnPreviewSizesEnumerated(
- const std::vector<PP_Size>& sizes) {
- if (!preview_sizes_reply_context_.is_valid())
+void PepperImageCaptureHost::OnVideoCaptureFormatsEnumerated(
+ const std::vector<PP_VideoCaptureFormat>& formats) {
+ if (!video_capture_formats_reply_context_.is_valid())
return;
- if (sizes.size() > 0)
- preview_sizes_reply_context_.params.set_result(PP_OK);
+ if (formats.size() > 0)
+ video_capture_formats_reply_context_.params.set_result(PP_OK);
else
- preview_sizes_reply_context_.params.set_result(PP_ERROR_FAILED);
+ video_capture_formats_reply_context_.params.set_result(PP_ERROR_FAILED);
host()->SendReply(
- preview_sizes_reply_context_,
- PpapiPluginMsg_ImageCapture_GetSupportedPreviewSizesReply(sizes));
- preview_sizes_reply_context_ = ppapi::host::ReplyMessageContext();
+ video_capture_formats_reply_context_,
+ PpapiPluginMsg_ImageCapture_GetSupportedVideoCaptureFormatsReply(
+ formats));
+ video_capture_formats_reply_context_ = ppapi::host::ReplyMessageContext();
}
int32_t PepperImageCaptureHost::OnOpen(ppapi::host::HostMessageContext* context,
@@ -102,15 +103,15 @@ int32_t PepperImageCaptureHost::OnClose(
return PP_OK;
}
-int32_t PepperImageCaptureHost::OnGetSupportedPreviewSizes(
+int32_t PepperImageCaptureHost::OnGetSupportedVideoCaptureFormats(
ppapi::host::HostMessageContext* context) {
- if (preview_sizes_reply_context_.is_valid())
+ if (video_capture_formats_reply_context_.is_valid())
return PP_ERROR_INPROGRESS;
if (!platform_image_capture_)
return PP_ERROR_FAILED;
- preview_sizes_reply_context_ = context->MakeReplyMessageContext();
- platform_image_capture_->GetPreviewSizes();
+ video_capture_formats_reply_context_ = context->MakeReplyMessageContext();
+ platform_image_capture_->GetSupportedVideoCaptureFormats();
return PP_OK_COMPLETIONPENDING;
}
diff --git a/content/renderer/pepper/pepper_image_capture_host.h b/content/renderer/pepper/pepper_image_capture_host.h
index 126e462..d478f6d 100644
--- a/content/renderer/pepper/pepper_image_capture_host.h
+++ b/content/renderer/pepper/pepper_image_capture_host.h
@@ -9,6 +9,7 @@
#include "content/public/renderer/renderer_ppapi_host.h"
#include "content/renderer/pepper/ppb_buffer_impl.h"
#include "ppapi/c/pp_size.h"
+#include "ppapi/c/private/pp_video_capture_format.h"
#include "ppapi/host/host_message_context.h"
#include "ppapi/host/resource_host.h"
@@ -35,15 +36,17 @@ class PepperImageCaptureHost : public ppapi::host::ResourceHost {
// Called when image capture is initialized.
void OnInitialized(bool succeeded);
- // Called when the preview frame sizes are enumerated.
- void OnPreviewSizesEnumerated(const std::vector<PP_Size>& sizes);
+ // Called when the video capture formats are enumerated.
+ void OnVideoCaptureFormatsEnumerated(
+ const std::vector<PP_VideoCaptureFormat>& formats);
private:
// Plugin -> host message handlers.
int32_t OnOpen(ppapi::host::HostMessageContext* context,
const std::string& device_id);
int32_t OnClose(ppapi::host::HostMessageContext* context);
- int32_t OnGetSupportedPreviewSizes(ppapi::host::HostMessageContext* context);
+ int32_t OnGetSupportedVideoCaptureFormats(
+ ppapi::host::HostMessageContext* context);
// Utility methods.
void DetachPlatformImageCapture();
@@ -54,7 +57,7 @@ class PepperImageCaptureHost : public ppapi::host::ResourceHost {
ppapi::host::ReplyMessageContext open_reply_context_;
- ppapi::host::ReplyMessageContext preview_sizes_reply_context_;
+ ppapi::host::ReplyMessageContext video_capture_formats_reply_context_;
DISALLOW_COPY_AND_ASSIGN(PepperImageCaptureHost);
};
diff --git a/content/renderer/pepper/pepper_platform_image_capture.cc b/content/renderer/pepper/pepper_platform_image_capture.cc
index 65f8f9d..eda28e5 100644
--- a/content/renderer/pepper/pepper_platform_image_capture.cc
+++ b/content/renderer/pepper/pepper_platform_image_capture.cc
@@ -43,7 +43,7 @@ PepperPlatformImageCapture::PepperPlatformImageCapture(
}
}
-void PepperPlatformImageCapture::GetPreviewSizes() {
+void PepperPlatformImageCapture::GetSupportedVideoCaptureFormats() {
DCHECK(thread_checker_.CalledOnValidThread());
VideoCaptureImplManager* manager =
RenderThreadImpl::current()->video_capture_impl_manager();
@@ -110,10 +110,14 @@ void PepperPlatformImageCapture::OnDeviceSupportedFormatsEnumerated(
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(handler_);
- std::vector<PP_Size> sizes;
- for (const auto& format : formats)
- sizes.push_back(PP_FromGfxSize(format.frame_size));
- handler_->OnPreviewSizesEnumerated(sizes);
+ std::vector<PP_VideoCaptureFormat> output_formats;
+ for (const auto& format : formats) {
+ PP_VideoCaptureFormat output_format;
+ output_format.frame_size = PP_FromGfxSize(format.frame_size);
+ output_format.frame_rate = format.frame_rate;
+ output_formats.push_back(output_format);
+ }
+ handler_->OnVideoCaptureFormatsEnumerated(output_formats);
}
PepperMediaDeviceManager* PepperPlatformImageCapture::GetMediaDeviceManager() {
diff --git a/content/renderer/pepper/pepper_platform_image_capture.h b/content/renderer/pepper/pepper_platform_image_capture.h
index b65acee..72ec7bd 100644
--- a/content/renderer/pepper/pepper_platform_image_capture.h
+++ b/content/renderer/pepper/pepper_platform_image_capture.h
@@ -34,7 +34,7 @@ class PepperPlatformImageCapture {
// Detaches the event handler and stops sending notifications to it.
void DetachEventHandler();
- void GetPreviewSizes();
+ void GetSupportedVideoCaptureFormats();
private:
void OnDeviceOpened(int request_id, bool succeeded, const std::string& label);
diff --git a/ppapi/api/private/pp_video_capture_format.idl b/ppapi/api/private/pp_video_capture_format.idl
new file mode 100644
index 0000000..e934566
--- /dev/null
+++ b/ppapi/api/private/pp_video_capture_format.idl
@@ -0,0 +1,29 @@
+/* Copyright 2015 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.
+ */
+
+/**
+ * This file defines the struct used to hold a video capture format.
+ */
+
+label Chrome {
+ M42 = 0.1
+};
+
+/**
+ * The <code>PP_VideoCaptureFormat</code> struct represents a video capture
+ * format.
+ */
+[assert_size(12)]
+struct PP_VideoCaptureFormat {
+ /**
+ * Frame size in pixels.
+ */
+ PP_Size frame_size;
+
+ /**
+ * Frame rate in frames per second.
+ */
+ float_t frame_rate;
+};
diff --git a/ppapi/api/private/ppb_camera_capabilities_private.idl b/ppapi/api/private/ppb_camera_capabilities_private.idl
index cb97fb1..fb480bf 100644
--- a/ppapi/api/private/ppb_camera_capabilities_private.idl
+++ b/ppapi/api/private/ppb_camera_capabilities_private.idl
@@ -36,20 +36,20 @@ interface PPB_CameraCapabilities_Private {
[in] PP_Resource resource);
/**
- * GetSupportedPreviewSizes() returns the supported preview sizes for the
- * given <code>PPB_CameraCapabilities_Private</code>.
+ * GetSupportedVideoCaptureFormats() returns the supported video capture
+ * formats for the given <code>PPB_CameraCapabilities_Private</code>.
*
* @param[in] capabilities A <code>PP_Resource</code> corresponding to an
* image capture capabilities resource.
* @param[out] array_size The size of preview size array.
- * @param[out] preview_sizes An array of <code>PP_Size</code> corresponding
- * to the supported preview sizes in pixels. The ownership of the array
- * belongs to <code>PPB_CameraCapabilities_Private</code> and the caller
- * should not free it. When a PPB_CameraCapabilities_Private is deleted,
- * the array returning from this is no longer valid.
+ * @param[out] formats An array of <code>PP_VideoCaptureFormat</code>
+ * corresponding to the supported video capture formats. The ownership of the
+ * array belongs to <code>PPB_CameraCapabilities_Private</code> and the caller
+ * should not free it. When a PPB_CameraCapabilities_Private is deleted, the
+ * array returning from this is no longer valid.
*/
- void GetSupportedPreviewSizes(
+ void GetSupportedVideoCaptureFormats(
[in] PP_Resource capabilities,
- [out] int32_t array_size,
- [out, size_is(array_size)] PP_Size[] preview_sizes);
+ [out] uint32_t array_size,
+ [out, size_is(array_size)] PP_VideoCaptureFormat[] formats);
};
diff --git a/ppapi/c/private/pp_video_capture_format.h b/ppapi/c/private/pp_video_capture_format.h
new file mode 100644
index 0000000..4df9cba
--- /dev/null
+++ b/ppapi/c/private/pp_video_capture_format.h
@@ -0,0 +1,47 @@
+/* Copyright 2015 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.
+ */
+
+/* From private/pp_video_capture_format.idl,
+ * modified Wed Feb 18 01:41:26 2015.
+ */
+
+#ifndef PPAPI_C_PRIVATE_PP_VIDEO_CAPTURE_FORMAT_H_
+#define PPAPI_C_PRIVATE_PP_VIDEO_CAPTURE_FORMAT_H_
+
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_size.h"
+#include "ppapi/c/pp_stdint.h"
+
+/**
+ * @file
+ * This file defines the struct used to hold a video capture format.
+ */
+
+
+/**
+ * @addtogroup Structs
+ * @{
+ */
+/**
+ * The <code>PP_VideoCaptureFormat</code> struct represents a video capture
+ * format.
+ */
+struct PP_VideoCaptureFormat {
+ /**
+ * Frame size in pixels.
+ */
+ struct PP_Size frame_size;
+ /**
+ * Frame rate in frames per second.
+ */
+ float frame_rate;
+};
+PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoCaptureFormat, 12);
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_PRIVATE_PP_VIDEO_CAPTURE_FORMAT_H_ */
+
diff --git a/ppapi/c/private/ppb_camera_capabilities_private.h b/ppapi/c/private/ppb_camera_capabilities_private.h
index 7326549..269cd7a 100644
--- a/ppapi/c/private/ppb_camera_capabilities_private.h
+++ b/ppapi/c/private/ppb_camera_capabilities_private.h
@@ -4,7 +4,7 @@
*/
/* From private/ppb_camera_capabilities_private.idl,
- * modified Tue Feb 3 19:54:34 2015.
+ * modified Thu Feb 19 09:06:18 2015.
*/
#ifndef PPAPI_C_PRIVATE_PPB_CAMERA_CAPABILITIES_PRIVATE_H_
@@ -15,6 +15,7 @@
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_size.h"
#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/private/pp_video_capture_format.h"
#define PPB_CAMERACAPABILITIES_PRIVATE_INTERFACE_0_1 \
"PPB_CameraCapabilities_Private;0.1"
@@ -51,21 +52,22 @@ struct PPB_CameraCapabilities_Private_0_1 {
*/
PP_Bool (*IsCameraCapabilities)(PP_Resource resource);
/**
- * GetSupportedPreviewSizes() returns the supported preview sizes for the
- * given <code>PPB_CameraCapabilities_Private</code>.
+ * GetSupportedVideoCaptureFormats() returns the supported video capture
+ * formats for the given <code>PPB_CameraCapabilities_Private</code>.
*
* @param[in] capabilities A <code>PP_Resource</code> corresponding to an
* image capture capabilities resource.
* @param[out] array_size The size of preview size array.
- * @param[out] preview_sizes An array of <code>PP_Size</code> corresponding
- * to the supported preview sizes in pixels. The ownership of the array
- * belongs to <code>PPB_CameraCapabilities_Private</code> and the caller
- * should not free it. When a PPB_CameraCapabilities_Private is deleted,
- * the array returning from this is no longer valid.
+ * @param[out] formats An array of <code>PP_VideoCaptureFormat</code>
+ * corresponding to the supported video capture formats. The ownership of the
+ * array belongs to <code>PPB_CameraCapabilities_Private</code> and the caller
+ * should not free it. When a PPB_CameraCapabilities_Private is deleted, the
+ * array returning from this is no longer valid.
*/
- void (*GetSupportedPreviewSizes)(PP_Resource capabilities,
- int32_t* array_size,
- struct PP_Size** preview_sizes);
+ void (*GetSupportedVideoCaptureFormats)(
+ PP_Resource capabilities,
+ uint32_t* array_size,
+ struct PP_VideoCaptureFormat** formats);
};
typedef struct PPB_CameraCapabilities_Private_0_1
diff --git a/ppapi/cpp/private/camera_capabilities_private.cc b/ppapi/cpp/private/camera_capabilities_private.cc
index ce2ebb4..ad3d435 100644
--- a/ppapi/cpp/private/camera_capabilities_private.cc
+++ b/ppapi/cpp/private/camera_capabilities_private.cc
@@ -41,21 +41,21 @@ CameraCapabilities_Private::CameraCapabilities_Private(PassRef,
CameraCapabilities_Private::~CameraCapabilities_Private() {
}
-void CameraCapabilities_Private::GetSupportedPreviewSizes(
- std::vector<Size>* preview_sizes) {
+void CameraCapabilities_Private::GetSupportedVideoCaptureFormats(
+ std::vector<PP_VideoCaptureFormat>* formats) {
if (!has_interface<PPB_CameraCapabilities_Private_0_1>()) {
PP_DCHECK(false);
return;
}
- int32_t array_size;
- PP_Size* array;
- get_interface<PPB_CameraCapabilities_Private_0_1>()->GetSupportedPreviewSizes(
- pp_resource(), &array_size, &array);
- preview_sizes->clear();
- preview_sizes->reserve(array_size);
- for (int32_t i = 0; i < array_size; i++) {
- preview_sizes->push_back(Size(array[i]));
+ uint32_t array_size;
+ PP_VideoCaptureFormat* array;
+ get_interface<PPB_CameraCapabilities_Private_0_1>()
+ ->GetSupportedVideoCaptureFormats(pp_resource(), &array_size, &array);
+ formats->clear();
+ formats->reserve(array_size);
+ for (uint32_t i = 0; i < array_size; i++) {
+ formats->push_back(array[i]);
}
}
diff --git a/ppapi/cpp/private/camera_capabilities_private.h b/ppapi/cpp/private/camera_capabilities_private.h
index 5686d88..e0dbfe3 100644
--- a/ppapi/cpp/private/camera_capabilities_private.h
+++ b/ppapi/cpp/private/camera_capabilities_private.h
@@ -48,12 +48,14 @@ class CameraCapabilities_Private : public Resource {
// Destructor.
~CameraCapabilities_Private();
- /// GetSupportedPreviewSizes() returns the supported preview sizes for the
- /// given <code>CameraCapabilities_Private</code>.
+ /// GetSupportedVideoCaptureFormats() returns the supported video capture
+ /// formats.
///
- /// @param[out] A vector of <code>Size</code> corresponding to the
- /// supported preview sizes in pixels.
- void GetSupportedPreviewSizes(std::vector<Size>* preview_sizes);
+ /// @param[out] formats A vector of <code>PP_VideoCaptureFormat</code>
+ /// corresponding to the supported video capture formats. This output vector
+ /// must be prepared by the caller beforehand.
+ void GetSupportedVideoCaptureFormats(
+ std::vector<PP_VideoCaptureFormat>* formats);
/// IsCameraCapabilities() determines if the given resource is a
/// <code>CameraCapabilities_Private</code>.
diff --git a/ppapi/proxy/camera_capabilities_resource.cc b/ppapi/proxy/camera_capabilities_resource.cc
index 1854097..1236aa3 100644
--- a/ppapi/proxy/camera_capabilities_resource.cc
+++ b/ppapi/proxy/camera_capabilities_resource.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/logging.h"
+#include "base/numerics/safe_conversions.h"
#include "ppapi/proxy/camera_capabilities_resource.h"
namespace ppapi {
@@ -10,11 +11,12 @@ namespace proxy {
CameraCapabilitiesResource::CameraCapabilitiesResource(
PP_Instance instance,
- const std::vector<PP_Size>& preview_sizes)
+ const std::vector<PP_VideoCaptureFormat>& formats)
: Resource(OBJECT_IS_PROXY, instance),
- num_preview_sizes_(static_cast<int32_t>(preview_sizes.size())),
- preview_sizes_(new PP_Size[num_preview_sizes_]) {
- std::copy(preview_sizes.begin(), preview_sizes.end(), preview_sizes_.get());
+ num_video_capture_formats_(formats.size()),
+ video_capture_formats_(
+ new PP_VideoCaptureFormat[num_video_capture_formats_]) {
+ std::copy(formats.begin(), formats.end(), video_capture_formats_.get());
}
CameraCapabilitiesResource::~CameraCapabilitiesResource() {
@@ -25,11 +27,11 @@ CameraCapabilitiesResource::AsPPB_CameraCapabilities_API() {
return this;
}
-void CameraCapabilitiesResource::GetSupportedPreviewSizes(
- int32_t* array_size,
- PP_Size** preview_sizes) {
- *array_size = num_preview_sizes_;
- *preview_sizes = preview_sizes_.get();
+void CameraCapabilitiesResource::GetSupportedVideoCaptureFormats(
+ uint32_t* array_size,
+ PP_VideoCaptureFormat** formats) {
+ *array_size = base::checked_cast<uint32_t>(num_video_capture_formats_);
+ *formats = video_capture_formats_.get();
}
} // namespace proxy
diff --git a/ppapi/proxy/camera_capabilities_resource.h b/ppapi/proxy/camera_capabilities_resource.h
index 237910a..1430500 100644
--- a/ppapi/proxy/camera_capabilities_resource.h
+++ b/ppapi/proxy/camera_capabilities_resource.h
@@ -23,7 +23,7 @@ class PPAPI_PROXY_EXPORT CameraCapabilitiesResource
public thunk::PPB_CameraCapabilities_API {
public:
CameraCapabilitiesResource(PP_Instance instance,
- const std::vector<PP_Size>& preview_sizes);
+ const std::vector<PP_VideoCaptureFormat>& formats);
~CameraCapabilitiesResource() override;
@@ -31,12 +31,13 @@ class PPAPI_PROXY_EXPORT CameraCapabilitiesResource
thunk::PPB_CameraCapabilities_API* AsPPB_CameraCapabilities_API() override;
// PPB_CameraCapabilities_API implementation.
- void GetSupportedPreviewSizes(int32_t* array_size,
- PP_Size** preview_sizes) override;
+ void GetSupportedVideoCaptureFormats(
+ uint32_t* array_size,
+ PP_VideoCaptureFormat** formats) override;
private:
- int32_t num_preview_sizes_;
- scoped_ptr<PP_Size[]> preview_sizes_;
+ size_t num_video_capture_formats_;
+ scoped_ptr<PP_VideoCaptureFormat[]> video_capture_formats_;
DISALLOW_COPY_AND_ASSIGN(CameraCapabilitiesResource);
};
diff --git a/ppapi/proxy/image_capture_resource.cc b/ppapi/proxy/image_capture_resource.cc
index cccd1c6..9cf2cda 100644
--- a/ppapi/proxy/image_capture_resource.cc
+++ b/ppapi/proxy/image_capture_resource.cc
@@ -78,10 +78,11 @@ int32_t ImageCaptureResource::GetCameraCapabilities(
}
get_capabilities_callback_ = callback;
- Call<PpapiPluginMsg_ImageCapture_GetSupportedPreviewSizesReply>(
- RENDERER, PpapiHostMsg_ImageCapture_GetSupportedPreviewSizes(),
- base::Bind(&ImageCaptureResource::OnPluginMsgGetPreviewSizesReply,
+ Call<PpapiPluginMsg_ImageCapture_GetSupportedVideoCaptureFormatsReply>(
+ RENDERER, PpapiHostMsg_ImageCapture_GetSupportedVideoCaptureFormats(),
+ base::Bind(&ImageCaptureResource::OnPluginMsgGetVideoCaptureFormatsReply,
base::Unretained(this), capabilities));
+
return PP_OK_COMPLETIONPENDING;
}
@@ -96,10 +97,10 @@ void ImageCaptureResource::OnPluginMsgOpenReply(
}
}
-void ImageCaptureResource::OnPluginMsgGetPreviewSizesReply(
+void ImageCaptureResource::OnPluginMsgGetVideoCaptureFormatsReply(
PP_Resource* capabilities_output,
const ResourceMessageReplyParams& params,
- const std::vector<PP_Size>& preview_sizes) {
+ const std::vector<PP_VideoCaptureFormat>& formats) {
if (!TrackedCallback::IsPending(get_capabilities_callback_))
return;
@@ -109,7 +110,7 @@ void ImageCaptureResource::OnPluginMsgGetPreviewSizesReply(
callback.swap(get_capabilities_callback_);
if (result == PP_OK) {
camera_capabilities_ =
- new CameraCapabilitiesResource(pp_instance(), preview_sizes);
+ new CameraCapabilitiesResource(pp_instance(), formats);
*capabilities_output = camera_capabilities_->GetReference();
}
callback->Run(result == PP_OK ? PP_OK : PP_ERROR_FAILED);
diff --git a/ppapi/proxy/image_capture_resource.h b/ppapi/proxy/image_capture_resource.h
index 491c91e..2db3a0f 100644
--- a/ppapi/proxy/image_capture_resource.h
+++ b/ppapi/proxy/image_capture_resource.h
@@ -7,6 +7,7 @@
#include "base/basictypes.h"
#include "ppapi/c/pp_size.h"
+#include "ppapi/c/private/pp_video_capture_format.h"
#include "ppapi/proxy/connection.h"
#include "ppapi/proxy/plugin_resource.h"
#include "ppapi/proxy/ppapi_proxy_export.h"
@@ -42,10 +43,11 @@ class PPAPI_PROXY_EXPORT ImageCaptureResource
private:
enum class OpenState { BEFORE_OPEN, OPENED, CLOSED };
- void OnPluginMsgGetPreviewSizesReply(
+ void OnPluginMsgGetVideoCaptureFormatsReply(
PP_Resource* capabilities_output,
const ResourceMessageReplyParams& params,
- const std::vector<PP_Size>& preview_sizes);
+ const std::vector<PP_VideoCaptureFormat>& formats);
+
void OnPluginMsgOpenReply(const ResourceMessageReplyParams& params);
bool is_opened() const { return open_state_ == OpenState::OPENED; }
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 2899371..2f153f3 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -43,6 +43,7 @@
#include "ppapi/c/ppb_udp_socket.h"
#include "ppapi/c/private/pp_content_decryptor.h"
#include "ppapi/c/private/pp_private_font_charset.h"
+#include "ppapi/c/private/pp_video_capture_format.h"
#include "ppapi/c/private/ppb_flash.h"
#include "ppapi/c/private/ppb_host_resolver_private.h"
#include "ppapi/c/private/ppb_isolated_file_system_private.h"
@@ -229,6 +230,11 @@ IPC_STRUCT_TRAITS_BEGIN(PP_URLComponents_Dev)
IPC_STRUCT_TRAITS_MEMBER(ref)
IPC_STRUCT_TRAITS_END()
+IPC_STRUCT_TRAITS_BEGIN(PP_VideoCaptureFormat)
+ IPC_STRUCT_TRAITS_MEMBER(frame_size)
+ IPC_STRUCT_TRAITS_MEMBER(frame_rate)
+IPC_STRUCT_TRAITS_END()
+
IPC_STRUCT_TRAITS_BEGIN(PP_FileInfo)
IPC_STRUCT_TRAITS_MEMBER(size)
IPC_STRUCT_TRAITS_MEMBER(type)
@@ -1549,9 +1555,11 @@ IPC_MESSAGE_CONTROL1(PpapiHostMsg_ImageCapture_Open,
std::string /* camera_source_id */)
IPC_MESSAGE_CONTROL0(PpapiPluginMsg_ImageCapture_OpenReply)
-IPC_MESSAGE_CONTROL0(PpapiHostMsg_ImageCapture_GetSupportedPreviewSizes)
-IPC_MESSAGE_CONTROL1(PpapiPluginMsg_ImageCapture_GetSupportedPreviewSizesReply,
- std::vector<PP_Size> /* preview_sizes */)
+IPC_MESSAGE_CONTROL0(
+ PpapiHostMsg_ImageCapture_GetSupportedVideoCaptureFormats)
+IPC_MESSAGE_CONTROL1(
+ PpapiPluginMsg_ImageCapture_GetSupportedVideoCaptureFormatsReply,
+ std::vector<PP_VideoCaptureFormat> /* video_capture_formats */)
// IsolatedFileSystem ----------------------------------------------------------
IPC_MESSAGE_CONTROL0(PpapiHostMsg_IsolatedFileSystem_Create)
diff --git a/ppapi/thunk/ppb_camera_capabilities_api.h b/ppapi/thunk/ppb_camera_capabilities_api.h
index ba51f5f..34d5127 100644
--- a/ppapi/thunk/ppb_camera_capabilities_api.h
+++ b/ppapi/thunk/ppb_camera_capabilities_api.h
@@ -15,8 +15,9 @@ namespace thunk {
class PPAPI_THUNK_EXPORT PPB_CameraCapabilities_API {
public:
virtual ~PPB_CameraCapabilities_API() {}
- virtual void GetSupportedPreviewSizes(int32_t* array_size,
- PP_Size** preview_sizes) = 0;
+ virtual void GetSupportedVideoCaptureFormats(
+ uint32_t* array_size,
+ PP_VideoCaptureFormat** formats) = 0;
};
} // namespace thunk
diff --git a/ppapi/thunk/ppb_camera_capabilities_private_thunk.cc b/ppapi/thunk/ppb_camera_capabilities_private_thunk.cc
index 3940a04..85a64bb 100644
--- a/ppapi/thunk/ppb_camera_capabilities_private_thunk.cc
+++ b/ppapi/thunk/ppb_camera_capabilities_private_thunk.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// From private/ppb_camera_capabilities_private.idl modified Tue Feb 3 19:54:34
+// From private/ppb_camera_capabilities_private.idl modified Thu Feb 19 09:06:18
// 2015.
#include "ppapi/c/pp_errors.h"
@@ -23,19 +23,21 @@ PP_Bool IsCameraCapabilities(PP_Resource resource) {
return PP_FromBool(enter.succeeded());
}
-void GetSupportedPreviewSizes(PP_Resource capabilities,
- int32_t* array_size,
- struct PP_Size** preview_sizes) {
- VLOG(4) << "PPB_CameraCapabilities_Private::GetSupportedPreviewSizes()";
+void GetSupportedVideoCaptureFormats(PP_Resource capabilities,
+ uint32_t* array_size,
+ struct PP_VideoCaptureFormat** formats) {
+ VLOG(4)
+ << "PPB_CameraCapabilities_Private::GetSupportedVideoCaptureFormats()";
EnterResource<PPB_CameraCapabilities_API> enter(capabilities, true);
if (enter.failed())
return;
- enter.object()->GetSupportedPreviewSizes(array_size, preview_sizes);
+ enter.object()->GetSupportedVideoCaptureFormats(array_size, formats);
}
const PPB_CameraCapabilities_Private_0_1
- g_ppb_cameracapabilities_private_thunk_0_1 = {&IsCameraCapabilities,
- &GetSupportedPreviewSizes};
+ g_ppb_cameracapabilities_private_thunk_0_1 = {
+ &IsCameraCapabilities,
+ &GetSupportedVideoCaptureFormats};
} // namespace