Chromium Code Reviews| Index: content/renderer/pepper/pepper_video_capture_host.h |
| diff --git a/content/renderer/pepper/pepper_video_capture_host.h b/content/renderer/pepper/pepper_video_capture_host.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4e0562a26b3e57cfab4dfba91c360576f7b9be43 |
| --- /dev/null |
| +++ b/content/renderer/pepper/pepper_video_capture_host.h |
| @@ -0,0 +1,123 @@ |
| +// 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. |
| + |
| +#ifndef CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_CAPTURE_HOST_H_ |
| +#define CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_CAPTURE_HOST_H_ |
| + |
| +#include "base/compiler_specific.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "content/common/content_export.h" |
| +#include "content/public/renderer/renderer_ppapi_host.h" |
| +#include "media/video/capture/video_capture.h" |
| +#include "media/video/capture/video_capture_types.h" |
| +#include "ppapi/c/dev/ppp_video_capture_dev.h" |
| +#include "ppapi/host/host_message_context.h" |
| +#include "ppapi/host/resource_host.h" |
| +#include "ppapi/shared_impl/ppb_device_ref_shared.h" |
| +#include "ppapi/shared_impl/ppb_video_capture_shared.h" |
| +#include "webkit/plugins/ppapi/plugin_delegate.h" |
| +#include "webkit/plugins/ppapi/ppb_buffer_impl.h" |
| + |
| +namespace content { |
| + |
| +class CONTENT_EXPORT PepperVideoCaptureHost |
| + : public ppapi::host::ResourceHost, |
| + public webkit::ppapi::PluginDelegate::PlatformVideoCaptureEventHandler, |
| + private ppapi::PPB_VideoCapture_Shared, |
| + public base::SupportsWeakPtr<PepperVideoCaptureHost> { |
| + public: |
| + PepperVideoCaptureHost(RendererPpapiHost* host, |
| + PP_Instance instance, |
| + PP_Resource resource); |
| + |
| + ~PepperVideoCaptureHost(); |
| + |
| + bool Init(); |
| + |
| + virtual int32_t OnResourceMessageReceived( |
| + const IPC::Message& msg, |
| + ppapi::host::HostMessageContext* context) OVERRIDE; |
| + |
| + // PluginDelegate::PlatformVideoCaptureEventHandler |
| + virtual void OnInitialized(media::VideoCapture* capture, |
| + bool succeeded) OVERRIDE; |
| + virtual void OnStarted(media::VideoCapture* capture) OVERRIDE; |
| + virtual void OnStopped(media::VideoCapture* capture) OVERRIDE; |
| + virtual void OnPaused(media::VideoCapture* capture) OVERRIDE; |
| + virtual void OnError(media::VideoCapture* capture, int error_code) OVERRIDE; |
| + virtual void OnRemoved(media::VideoCapture* capture) OVERRIDE; |
| + virtual void OnBufferReady( |
| + media::VideoCapture* capture, |
| + scoped_refptr<media::VideoCapture::VideoFrameBuffer> buffer) OVERRIDE; |
| + virtual void OnDeviceInfoReceived( |
| + media::VideoCapture* capture, |
| + const media::VideoCaptureParams& device_info) OVERRIDE; |
| + |
| + private: |
| + webkit::ppapi::PluginInstance* GetPluginInstance() const; |
| + |
| + int32_t OnEnumerateDevices( |
| + ppapi::host::HostMessageContext* context); |
| + int32_t OnOpen(ppapi::host::HostMessageContext* context, |
| + const std::string& device_id, |
| + const PP_VideoCaptureDeviceInfo_Dev& requested_info, |
| + uint32_t buffer_count); |
| + int32_t OnStartCapture(ppapi::host::HostMessageContext* context); |
| + int32_t OnReuseBuffer(ppapi::host::HostMessageContext* context, |
| + uint32_t buffer); |
| + int32_t OnStopCapture(ppapi::host::HostMessageContext* context); |
| + int32_t OnClose(ppapi::host::HostMessageContext* context); |
| + int32_t OnStartCapture0_1(ppapi::host::HostMessageContext* context, |
| + const PP_VideoCaptureDeviceInfo_Dev& requested_info, |
| + uint32_t buffer_count); |
| + |
| + int32_t Close(); |
| + |
| + // PPB_VideoCapture_Shared implementation. |
| + virtual int32_t InternalStartCapture() OVERRIDE; |
| + virtual int32_t InternalStopCapture() OVERRIDE; |
| + virtual int32_t InternalStartCapture0_1( |
|
yzshen1
2012/10/25 20:41:05
We can probably remove the support of V0.1 entirel
victorhsieh
2012/10/30 09:43:28
I'm removing all the v0.1 interface, including tho
|
| + const PP_VideoCaptureDeviceInfo_Dev& requested_info, |
| + uint32_t buffer_count) OVERRIDE; |
| + |
| + void ReleaseBuffers(); |
| + void SendStatus(); |
| + |
| + void SetRequestedInfo(const PP_VideoCaptureDeviceInfo_Dev& device_info, |
| + uint32_t buffer_count); |
| + |
| + void DetachPlatformVideoCapture(); |
| + |
| + void EnumerateDevicesCallbackFunc( |
| + int request_id, |
| + bool succeeded, |
| + const std::vector<ppapi::DeviceRefData>& devices); |
| + |
| + scoped_refptr<webkit::ppapi::PluginDelegate::PlatformVideoCapture> |
| + platform_video_capture_; |
| + |
| + size_t buffer_count_hint_; |
| + struct BufferInfo { |
| + BufferInfo(); |
| + ~BufferInfo(); |
| + |
| + bool in_use; |
| + void* data; |
| + scoped_refptr<webkit::ppapi::PPB_Buffer_Impl> buffer; |
| + }; |
| + std::vector<BufferInfo> buffers_; |
| + |
| + const PPP_VideoCapture_Dev* ppp_videocapture_; |
| + |
| + media::VideoCaptureCapability capability_; |
| + |
| + ppapi::host::ReplyMessageContext open_reply_context_; |
| + ppapi::host::ReplyMessageContext enum_reply_context_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PepperVideoCaptureHost); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_CAPTURE_HOST_H_ |