OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_CAPTURE_HOST_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_CAPTURE_HOST_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_CAPTURE_HOST_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_CAPTURE_HOST_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "content/public/renderer/renderer_ppapi_host.h" | 10 #include "content/public/renderer/renderer_ppapi_host.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 // media::VideoCapture::EventHandler | 41 // media::VideoCapture::EventHandler |
42 virtual void OnStarted(media::VideoCapture* capture) OVERRIDE; | 42 virtual void OnStarted(media::VideoCapture* capture) OVERRIDE; |
43 virtual void OnStopped(media::VideoCapture* capture) OVERRIDE; | 43 virtual void OnStopped(media::VideoCapture* capture) OVERRIDE; |
44 virtual void OnPaused(media::VideoCapture* capture) OVERRIDE; | 44 virtual void OnPaused(media::VideoCapture* capture) OVERRIDE; |
45 virtual void OnError(media::VideoCapture* capture, int error_code) OVERRIDE; | 45 virtual void OnError(media::VideoCapture* capture, int error_code) OVERRIDE; |
46 virtual void OnRemoved(media::VideoCapture* capture) OVERRIDE; | 46 virtual void OnRemoved(media::VideoCapture* capture) OVERRIDE; |
47 virtual void OnFrameReady( | 47 virtual void OnFrameReady( |
48 media::VideoCapture* capture, | 48 media::VideoCapture* capture, |
49 const scoped_refptr<media::VideoFrame>& frame) OVERRIDE; | 49 const scoped_refptr<media::VideoFrame>& frame) OVERRIDE; |
50 virtual void OnDeviceInfoReceived( | 50 |
51 media::VideoCapture* capture, | |
52 const media::VideoCaptureParams& device_info) OVERRIDE; | |
53 | 51 |
54 private: | 52 private: |
55 int32_t OnOpen(ppapi::host::HostMessageContext* context, | 53 int32_t OnOpen(ppapi::host::HostMessageContext* context, |
56 const std::string& device_id, | 54 const std::string& device_id, |
57 const PP_VideoCaptureDeviceInfo_Dev& requested_info, | 55 const PP_VideoCaptureDeviceInfo_Dev& requested_info, |
58 uint32_t buffer_count); | 56 uint32_t buffer_count); |
59 int32_t OnStartCapture(ppapi::host::HostMessageContext* context); | 57 int32_t OnStartCapture(ppapi::host::HostMessageContext* context); |
60 int32_t OnReuseBuffer(ppapi::host::HostMessageContext* context, | 58 int32_t OnReuseBuffer(ppapi::host::HostMessageContext* context, |
61 uint32_t buffer); | 59 uint32_t buffer); |
62 int32_t OnStopCapture(ppapi::host::HostMessageContext* context); | 60 int32_t OnStopCapture(ppapi::host::HostMessageContext* context); |
63 int32_t OnClose(ppapi::host::HostMessageContext* context); | 61 int32_t OnClose(ppapi::host::HostMessageContext* context); |
64 | 62 |
65 int32_t StopCapture(); | 63 int32_t StopCapture(); |
66 int32_t Close(); | 64 int32_t Close(); |
| 65 void Error(); |
| 66 void AllocBuffers(const gfx::Size& resolution, |
| 67 int frame_rate); |
67 void ReleaseBuffers(); | 68 void ReleaseBuffers(); |
68 void SendStatus(); | 69 void SendStatus(); |
69 | 70 |
70 void SetRequestedInfo(const PP_VideoCaptureDeviceInfo_Dev& device_info, | 71 void SetRequestedInfo(const PP_VideoCaptureDeviceInfo_Dev& device_info, |
71 uint32_t buffer_count); | 72 uint32_t buffer_count); |
72 | 73 |
73 void DetachPlatformVideoCapture(); | 74 void DetachPlatformVideoCapture(); |
74 | 75 |
75 bool SetStatus(PP_VideoCaptureStatus_Dev status, bool forced); | 76 bool SetStatus(PP_VideoCaptureStatus_Dev status, bool forced); |
76 | 77 |
77 scoped_refptr<PepperPlatformVideoCapture> platform_video_capture_; | 78 scoped_refptr<PepperPlatformVideoCapture> platform_video_capture_; |
78 | 79 |
79 // Buffers of video frame. | 80 // Buffers of video frame. |
80 struct BufferInfo { | 81 struct BufferInfo { |
81 BufferInfo(); | 82 BufferInfo(); |
82 ~BufferInfo(); | 83 ~BufferInfo(); |
83 | 84 |
84 bool in_use; | 85 bool in_use; |
85 void* data; | 86 void* data; |
86 scoped_refptr<PPB_Buffer_Impl> buffer; | 87 scoped_refptr<PPB_Buffer_Impl> buffer; |
87 }; | 88 }; |
88 | 89 |
89 RendererPpapiHostImpl* renderer_ppapi_host_; | 90 RendererPpapiHostImpl* renderer_ppapi_host_; |
90 | 91 |
| 92 gfx::Size alloc_size_; |
91 std::vector<BufferInfo> buffers_; | 93 std::vector<BufferInfo> buffers_; |
92 size_t buffer_count_hint_; | 94 size_t buffer_count_hint_; |
93 | 95 |
94 media::VideoCaptureCapability capability_; | 96 media::VideoCaptureParams param_request_; |
95 | 97 |
96 PP_VideoCaptureStatus_Dev status_; | 98 PP_VideoCaptureStatus_Dev status_; |
97 | 99 |
98 ppapi::host::ReplyMessageContext open_reply_context_; | 100 ppapi::host::ReplyMessageContext open_reply_context_; |
99 | 101 |
100 PepperDeviceEnumerationHostHelper enumeration_helper_; | 102 PepperDeviceEnumerationHostHelper enumeration_helper_; |
101 | 103 |
102 DISALLOW_COPY_AND_ASSIGN(PepperVideoCaptureHost); | 104 DISALLOW_COPY_AND_ASSIGN(PepperVideoCaptureHost); |
103 }; | 105 }; |
104 | 106 |
105 } // namespace content | 107 } // namespace content |
106 | 108 |
107 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_CAPTURE_HOST_H_ | 109 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_CAPTURE_HOST_H_ |
OLD | NEW |