| 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( | |
| 51 media::VideoCapture* capture, | |
| 52 const media::VideoCaptureParams& device_info) OVERRIDE; | |
| 53 | 50 |
| 54 private: | 51 private: |
| 55 int32_t OnOpen(ppapi::host::HostMessageContext* context, | 52 int32_t OnOpen(ppapi::host::HostMessageContext* context, |
| 56 const std::string& device_id, | 53 const std::string& device_id, |
| 57 const PP_VideoCaptureDeviceInfo_Dev& requested_info, | 54 const PP_VideoCaptureDeviceInfo_Dev& requested_info, |
| 58 uint32_t buffer_count); | 55 uint32_t buffer_count); |
| 59 int32_t OnStartCapture(ppapi::host::HostMessageContext* context); | 56 int32_t OnStartCapture(ppapi::host::HostMessageContext* context); |
| 60 int32_t OnReuseBuffer(ppapi::host::HostMessageContext* context, | 57 int32_t OnReuseBuffer(ppapi::host::HostMessageContext* context, |
| 61 uint32_t buffer); | 58 uint32_t buffer); |
| 62 int32_t OnStopCapture(ppapi::host::HostMessageContext* context); | 59 int32_t OnStopCapture(ppapi::host::HostMessageContext* context); |
| 63 int32_t OnClose(ppapi::host::HostMessageContext* context); | 60 int32_t OnClose(ppapi::host::HostMessageContext* context); |
| 64 | 61 |
| 65 int32_t StopCapture(); | 62 int32_t StopCapture(); |
| 66 int32_t Close(); | 63 int32_t Close(); |
| 64 void PostErrorReply(); |
| 65 void AllocBuffers(const gfx::Size& resolution, |
| 66 int frame_rate); |
| 67 void ReleaseBuffers(); | 67 void ReleaseBuffers(); |
| 68 void SendStatus(); | 68 void SendStatus(); |
| 69 | 69 |
| 70 void SetRequestedInfo(const PP_VideoCaptureDeviceInfo_Dev& device_info, | 70 void SetRequestedInfo(const PP_VideoCaptureDeviceInfo_Dev& device_info, |
| 71 uint32_t buffer_count); | 71 uint32_t buffer_count); |
| 72 | 72 |
| 73 void DetachPlatformVideoCapture(); | 73 void DetachPlatformVideoCapture(); |
| 74 | 74 |
| 75 bool SetStatus(PP_VideoCaptureStatus_Dev status, bool forced); | 75 bool SetStatus(PP_VideoCaptureStatus_Dev status, bool forced); |
| 76 | 76 |
| 77 scoped_refptr<PepperPlatformVideoCapture> platform_video_capture_; | 77 scoped_refptr<PepperPlatformVideoCapture> platform_video_capture_; |
| 78 | 78 |
| 79 // Buffers of video frame. | 79 // Buffers of video frame. |
| 80 struct BufferInfo { | 80 struct BufferInfo { |
| 81 BufferInfo(); | 81 BufferInfo(); |
| 82 ~BufferInfo(); | 82 ~BufferInfo(); |
| 83 | 83 |
| 84 bool in_use; | 84 bool in_use; |
| 85 void* data; | 85 void* data; |
| 86 scoped_refptr<PPB_Buffer_Impl> buffer; | 86 scoped_refptr<PPB_Buffer_Impl> buffer; |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 RendererPpapiHostImpl* renderer_ppapi_host_; | 89 RendererPpapiHostImpl* renderer_ppapi_host_; |
| 90 | 90 |
| 91 gfx::Size alloc_size_; |
| 91 std::vector<BufferInfo> buffers_; | 92 std::vector<BufferInfo> buffers_; |
| 92 size_t buffer_count_hint_; | 93 size_t buffer_count_hint_; |
| 93 | 94 |
| 94 media::VideoCaptureCapability capability_; | 95 media::VideoCaptureParams video_capture_params_; |
| 95 | 96 |
| 96 PP_VideoCaptureStatus_Dev status_; | 97 PP_VideoCaptureStatus_Dev status_; |
| 97 | 98 |
| 98 ppapi::host::ReplyMessageContext open_reply_context_; | 99 ppapi::host::ReplyMessageContext open_reply_context_; |
| 99 | 100 |
| 100 PepperDeviceEnumerationHostHelper enumeration_helper_; | 101 PepperDeviceEnumerationHostHelper enumeration_helper_; |
| 101 | 102 |
| 102 DISALLOW_COPY_AND_ASSIGN(PepperVideoCaptureHost); | 103 DISALLOW_COPY_AND_ASSIGN(PepperVideoCaptureHost); |
| 103 }; | 104 }; |
| 104 | 105 |
| 105 } // namespace content | 106 } // namespace content |
| 106 | 107 |
| 107 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_CAPTURE_HOST_H_ | 108 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_CAPTURE_HOST_H_ |
| OLD | NEW |