Commit 0fa46e83 authored by piman@chromium.org's avatar piman@chromium.org

PPB/PPP_VideoCapture_Dev proxy

BUG=None
TEST=VideoCapture sample (in a later CL)


Review URL: http://codereview.chromium.org/7601005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95961 0039d316-1c4b-4281-b951-d872f2087c98
parent 1a2966b9
......@@ -126,6 +126,8 @@
'proxy/ppb_var_deprecated_proxy.h',
'proxy/ppb_var_proxy.cc',
'proxy/ppb_var_proxy.h',
'proxy/ppb_video_capture_proxy.cc',
'proxy/ppb_video_capture_proxy.h',
'proxy/ppb_video_decoder_proxy.cc',
'proxy/ppb_video_decoder_proxy.h',
'proxy/ppp_class_proxy.cc',
......
......@@ -80,6 +80,7 @@
#include "ppapi/proxy/ppb_url_util_proxy.h"
#include "ppapi/proxy/ppb_var_deprecated_proxy.h"
#include "ppapi/proxy/ppb_var_proxy.h"
#include "ppapi/proxy/ppb_video_capture_proxy.h"
#include "ppapi/proxy/ppb_video_decoder_proxy.h"
#include "ppapi/proxy/ppp_class_proxy.h"
#include "ppapi/proxy/ppp_graphics_3d_proxy.h"
......@@ -164,6 +165,7 @@ InterfaceList::InterfaceList() {
AddPPB(PPB_URLUtil_Proxy::GetInfo());
AddPPB(PPB_Var_Deprecated_Proxy::GetInfo());
AddPPB(PPB_Var_Proxy::GetInfo());
AddPPB(PPB_VideoCapture_Proxy::GetInfo());
AddPPB(PPB_VideoDecoder_Proxy::GetInfo());
#ifdef ENABLE_FLAPPER_HACKS
......@@ -176,6 +178,7 @@ InterfaceList::InterfaceList() {
AddPPP(PPP_Instance_Private_Proxy::GetInfo());
AddPPP(PPP_Instance_Proxy::GetInfo1_0());
AddPPP(PPP_Messaging_Proxy::GetInfo());
AddPPP(PPP_VideoCapture_Proxy::GetInfo());
AddPPP(PPP_VideoDecoder_Proxy::GetInfo());
}
......
......@@ -34,6 +34,7 @@
F(URLLoader) \
F(URLRequestInfo) \
F(URLResponseInfo) \
F(VideoCapture) \
F(VideoDecoder)
namespace pp {
......
......@@ -18,6 +18,7 @@
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_message_utils.h"
#include "ipc/ipc_platform_file.h"
#include "ppapi/c/dev/pp_video_capture_dev.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_file_info.h"
#include "ppapi/c/pp_instance.h"
......@@ -71,6 +72,18 @@ IPC_STRUCT_TRAITS_BEGIN(PP_Picture_Dev)
IPC_STRUCT_TRAITS_MEMBER(bitstream_buffer_id)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(PP_VideoCaptureDeviceInfo_Dev)
IPC_STRUCT_TRAITS_MEMBER(width)
IPC_STRUCT_TRAITS_MEMBER(height)
IPC_STRUCT_TRAITS_MEMBER(frames_per_second)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(pp::proxy::PPPVideoCapture_Buffer)
IPC_STRUCT_TRAITS_MEMBER(resource)
IPC_STRUCT_TRAITS_MEMBER(handle)
IPC_STRUCT_TRAITS_MEMBER(size)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(::ppapi::Preferences)
IPC_STRUCT_TRAITS_MEMBER(standard_font_family)
IPC_STRUCT_TRAITS_MEMBER(fixed_font_family)
......@@ -330,6 +343,22 @@ IPC_MESSAGE_ROUTED3(PpapiMsg_PPBURLLoader_ReadResponseBody_Ack,
int32 /* result */,
std::string /* data */)
// PPP_VideoCapture_Dev
IPC_MESSAGE_ROUTED3(
PpapiMsg_PPPVideoCapture_OnDeviceInfo,
pp::proxy::HostResource /* video_capture */,
PP_VideoCaptureDeviceInfo_Dev /* info */,
std::vector<pp::proxy::PPPVideoCapture_Buffer> /* buffers */)
IPC_MESSAGE_ROUTED2(PpapiMsg_PPPVideoCapture_OnStatus,
pp::proxy::HostResource /* video_capture */,
uint32_t /* status */)
IPC_MESSAGE_ROUTED2(PpapiMsg_PPPVideoCapture_OnError,
pp::proxy::HostResource /* video_capture */,
uint32_t /* error_code */)
IPC_MESSAGE_ROUTED2(PpapiMsg_PPPVideoCapture_OnBufferReady,
pp::proxy::HostResource /* video_capture */,
uint32_t /* buffer */)
// PPB_VideoDecoder_Dev.
// (Messages from renderer to plugin to notify it to run callbacks.)
IPC_MESSAGE_ROUTED3(PpapiMsg_PPBVideoDecoder_EndOfBitstreamACK,
......@@ -945,6 +974,21 @@ IPC_SYNC_MESSAGE_ROUTED4_3(PpapiHostMsg_ResourceCreation_ImageData,
pp::proxy::HostResource /* result_resource */,
std::string /* image_data_desc */,
pp::proxy::ImageHandle /* result */)
// PPB_VideoCapture_Dev.
IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBVideoCapture_Create,
PP_Instance /* instance */,
pp::proxy::HostResource /* result */)
IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBVideoCapture_StartCapture,
pp::proxy::HostResource /* video_capture */,
PP_VideoCaptureDeviceInfo_Dev /* requested_info */,
uint32_t /* buffer_count */)
IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBVideoCapture_ReuseBuffer,
pp::proxy::HostResource /* video_capture */,
uint32_t /* buffer */)
IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBVideoCapture_StopCapture,
pp::proxy::HostResource /* video_capture */)
// PPB_VideoDecoder.
IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBVideoDecoder_Create,
PP_Instance /* instance */,
......
......@@ -108,7 +108,15 @@ PP_Resource PPB_Buffer_Proxy::CreateProxyResource(PP_Instance instance,
if (result.is_null() || !base::SharedMemory::IsHandleValid(shm_handle))
return 0;
linked_ptr<Buffer> object(new Buffer(result, shm_handle, size));
return AddProxyResource(result, shm_handle, size);
}
// static
PP_Resource PPB_Buffer_Proxy::AddProxyResource(
const HostResource& resource,
base::SharedMemoryHandle shm_handle,
uint32_t size) {
linked_ptr<Buffer> object(new Buffer(resource, shm_handle, size));
return PluginResourceTracker::GetInstance()->AddResource(object);
}
......
......@@ -56,6 +56,9 @@ class PPB_Buffer_Proxy : public InterfaceProxy {
static PP_Resource CreateProxyResource(PP_Instance instance,
uint32_t size);
static PP_Resource AddProxyResource(const HostResource& resource,
base::SharedMemoryHandle shm_handle,
uint32_t size);
const PPB_Buffer_Dev* ppb_buffer_target() const {
return static_cast<const PPB_Buffer_Dev*>(target_interface());
......
This diff is collapsed.
// Copyright (c) 2011 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.
#ifndef PPAPI_PPB_VIDEO_CAPTURE_PROXY_H_
#define PPAPI_PPB_VIDEO_CAPTURE_PROXY_H_
#include "ppapi/c/pp_instance.h"
#include "ppapi/proxy/interface_proxy.h"
#include "ppapi/proxy/serialized_structs.h"
struct PPB_VideoCapture_Dev;
struct PPP_VideoCapture_Dev;
struct PP_VideoCaptureDeviceInfo_Dev;
namespace pp {
namespace proxy {
class HostResource;
class PPB_VideoCapture_Proxy : public InterfaceProxy {
public:
PPB_VideoCapture_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_VideoCapture_Proxy();
static const Info* GetInfo();
static PP_Resource CreateProxyResource(PP_Instance instance);
const PPB_VideoCapture_Dev* ppb_video_capture_target() const {
return static_cast<const PPB_VideoCapture_Dev*>(target_interface());
}
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
private:
// Message handlers.
void OnMsgCreate(PP_Instance instance, HostResource* result_resource);
void OnMsgStartCapture(const HostResource& resource,
const PP_VideoCaptureDeviceInfo_Dev& info,
uint32_t buffers);
void OnMsgReuseBuffer(const HostResource& resource,
uint32_t buffer);
void OnMsgStopCapture(const HostResource& resource);
};
class PPP_VideoCapture_Proxy : public InterfaceProxy {
public:
PPP_VideoCapture_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPP_VideoCapture_Proxy();
static const Info* GetInfo();
const PPP_VideoCapture_Dev* ppp_video_capture_target() const {
return static_cast<const PPP_VideoCapture_Dev*>(target_interface());
}
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
private:
// Message handlers.
void OnMsgOnDeviceInfo(const HostResource& video_capture,
const PP_VideoCaptureDeviceInfo_Dev& info,
const std::vector<PPPVideoCapture_Buffer>& buffers);
void OnMsgOnStatus(const HostResource& video_capture,
uint32_t status);
void OnMsgOnError(const HostResource& video_capture,
uint32_t error_code);
void OnMsgOnBufferReady(const HostResource& video_capture,
uint32_t buffer);
};
} // namespace proxy
} // namespace pp
#endif // PPAPI_PPB_VIDEO_CAPTURE_PROXY_H_
......@@ -31,6 +31,7 @@
#include "ppapi/proxy/ppb_surface_3d_proxy.h"
#include "ppapi/proxy/ppb_url_loader_proxy.h"
#include "ppapi/proxy/ppb_url_request_info_proxy.h"
#include "ppapi/proxy/ppb_video_capture_proxy.h"
#include "ppapi/proxy/ppb_video_decoder_proxy.h"
#include "ppapi/shared_impl/font_impl.h"
#include "ppapi/shared_impl/function_group_base.h"
......@@ -293,8 +294,7 @@ PP_Resource ResourceCreationProxy::CreateURLRequestInfo(PP_Instance instance) {
}
PP_Resource ResourceCreationProxy::CreateVideoCapture(PP_Instance instance) {
NOTIMPLEMENTED();
return 0;
return PPB_VideoCapture_Proxy::CreateProxyResource(instance);
}
PP_Resource ResourceCreationProxy::CreateVideoDecoder(
......
......@@ -113,6 +113,12 @@ struct PPBURLLoader_UpdateProgress_Params {
int64_t total_bytes_to_be_received;
};
struct PPPVideoCapture_Buffer {
pp::proxy::HostResource resource;
uint32_t size;
base::SharedMemoryHandle handle;
};
#if defined(OS_WIN)
typedef HANDLE ImageHandle;
#elif defined(OS_MACOSX)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment