Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: content/renderer/pepper/pepper_video_capture_host.h

Issue 11274036: Refactor video capture to new design (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_CAPTURE_HOST_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_CAPTURE_HOST_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h"
10 #include "content/common/content_export.h"
11 #include "content/public/renderer/renderer_ppapi_host.h"
12 #include "media/video/capture/video_capture.h"
13 #include "media/video/capture/video_capture_types.h"
14 #include "ppapi/c/dev/ppp_video_capture_dev.h"
15 #include "ppapi/host/host_message_context.h"
16 #include "ppapi/host/resource_host.h"
17 #include "ppapi/shared_impl/ppb_device_ref_shared.h"
18 #include "ppapi/shared_impl/ppb_video_capture_shared.h"
19 #include "webkit/plugins/ppapi/plugin_delegate.h"
20 #include "webkit/plugins/ppapi/ppb_buffer_impl.h"
21
22 namespace content {
23
24 class CONTENT_EXPORT PepperVideoCaptureHost
25 : public ppapi::host::ResourceHost,
26 public webkit::ppapi::PluginDelegate::PlatformVideoCaptureEventHandler,
27 private ppapi::PPB_VideoCapture_Shared,
28 public base::SupportsWeakPtr<PepperVideoCaptureHost> {
29 public:
30 PepperVideoCaptureHost(RendererPpapiHost* host,
31 PP_Instance instance,
32 PP_Resource resource);
33
34 ~PepperVideoCaptureHost();
35
36 bool Init();
37
38 virtual int32_t OnResourceMessageReceived(
39 const IPC::Message& msg,
40 ppapi::host::HostMessageContext* context) OVERRIDE;
41
42 // PluginDelegate::PlatformVideoCaptureEventHandler
43 virtual void OnInitialized(media::VideoCapture* capture,
44 bool succeeded) OVERRIDE;
45 virtual void OnStarted(media::VideoCapture* capture) OVERRIDE;
46 virtual void OnStopped(media::VideoCapture* capture) OVERRIDE;
47 virtual void OnPaused(media::VideoCapture* capture) OVERRIDE;
48 virtual void OnError(media::VideoCapture* capture, int error_code) OVERRIDE;
49 virtual void OnRemoved(media::VideoCapture* capture) OVERRIDE;
50 virtual void OnBufferReady(
51 media::VideoCapture* capture,
52 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buffer) OVERRIDE;
53 virtual void OnDeviceInfoReceived(
54 media::VideoCapture* capture,
55 const media::VideoCaptureParams& device_info) OVERRIDE;
56
57 private:
58 webkit::ppapi::PluginInstance* GetPluginInstance() const;
59
60 int32_t OnEnumerateDevices(
61 ppapi::host::HostMessageContext* context);
62 int32_t OnOpen(ppapi::host::HostMessageContext* context,
63 const std::string& device_id,
64 const PP_VideoCaptureDeviceInfo_Dev& requested_info,
65 uint32_t buffer_count);
66 int32_t OnStartCapture(ppapi::host::HostMessageContext* context);
67 int32_t OnReuseBuffer(ppapi::host::HostMessageContext* context,
68 uint32_t buffer);
69 int32_t OnStopCapture(ppapi::host::HostMessageContext* context);
70 int32_t OnClose(ppapi::host::HostMessageContext* context);
71 int32_t OnStartCapture0_1(ppapi::host::HostMessageContext* context,
72 const PP_VideoCaptureDeviceInfo_Dev& requested_info,
73 uint32_t buffer_count);
74
75 int32_t Close();
76
77 // PPB_VideoCapture_Shared implementation.
78 virtual int32_t InternalStartCapture() OVERRIDE;
79 virtual int32_t InternalStopCapture() OVERRIDE;
80 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
81 const PP_VideoCaptureDeviceInfo_Dev& requested_info,
82 uint32_t buffer_count) OVERRIDE;
83
84 void ReleaseBuffers();
85 void SendStatus();
86
87 void SetRequestedInfo(const PP_VideoCaptureDeviceInfo_Dev& device_info,
88 uint32_t buffer_count);
89
90 void DetachPlatformVideoCapture();
91
92 void EnumerateDevicesCallbackFunc(
93 int request_id,
94 bool succeeded,
95 const std::vector<ppapi::DeviceRefData>& devices);
96
97 scoped_refptr<webkit::ppapi::PluginDelegate::PlatformVideoCapture>
98 platform_video_capture_;
99
100 size_t buffer_count_hint_;
101 struct BufferInfo {
102 BufferInfo();
103 ~BufferInfo();
104
105 bool in_use;
106 void* data;
107 scoped_refptr<webkit::ppapi::PPB_Buffer_Impl> buffer;
108 };
109 std::vector<BufferInfo> buffers_;
110
111 const PPP_VideoCapture_Dev* ppp_videocapture_;
112
113 media::VideoCaptureCapability capability_;
114
115 ppapi::host::ReplyMessageContext open_reply_context_;
116 ppapi::host::ReplyMessageContext enum_reply_context_;
117
118 DISALLOW_COPY_AND_ASSIGN(PepperVideoCaptureHost);
119 };
120
121 } // namespace content
122
123 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_CAPTURE_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698