Chromium Code Reviews| 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 "base/memory/scoped_ptr.h" | |
| 11 #include "content/common/media/video_capture.h" | |
| 10 #include "content/public/renderer/renderer_ppapi_host.h" | 12 #include "content/public/renderer/renderer_ppapi_host.h" |
| 11 #include "content/renderer/pepper/pepper_device_enumeration_host_helper.h" | 13 #include "content/renderer/pepper/pepper_device_enumeration_host_helper.h" |
| 12 #include "content/renderer/pepper/ppb_buffer_impl.h" | 14 #include "content/renderer/pepper/ppb_buffer_impl.h" |
| 13 #include "media/video/capture/video_capture.h" | |
| 14 #include "media/video/capture/video_capture_types.h" | 15 #include "media/video/capture/video_capture_types.h" |
| 15 #include "ppapi/c/dev/ppp_video_capture_dev.h" | 16 #include "ppapi/c/dev/ppp_video_capture_dev.h" |
| 16 #include "ppapi/host/host_message_context.h" | 17 #include "ppapi/host/host_message_context.h" |
| 17 #include "ppapi/host/resource_host.h" | 18 #include "ppapi/host/resource_host.h" |
| 18 | 19 |
| 20 namespace media { | |
| 21 class VideoFrame; | |
| 22 } // namespace media | |
| 23 | |
| 19 namespace content { | 24 namespace content { |
| 20 class PepperPlatformVideoCapture; | 25 class PepperPlatformVideoCapture; |
| 21 class RendererPpapiHostImpl; | 26 class RendererPpapiHostImpl; |
| 22 | 27 |
| 23 class PepperVideoCaptureHost : public ppapi::host::ResourceHost, | 28 class PepperVideoCaptureHost : public ppapi::host::ResourceHost { |
| 24 public media::VideoCapture::EventHandler { | |
| 25 public: | 29 public: |
| 26 PepperVideoCaptureHost(RendererPpapiHostImpl* host, | 30 PepperVideoCaptureHost(RendererPpapiHostImpl* host, |
| 27 PP_Instance instance, | 31 PP_Instance instance, |
| 28 PP_Resource resource); | 32 PP_Resource resource); |
| 29 | 33 |
| 30 virtual ~PepperVideoCaptureHost(); | 34 virtual ~PepperVideoCaptureHost(); |
| 31 | 35 |
| 32 bool Init(); | 36 bool Init(); |
| 33 | 37 |
| 34 virtual int32_t OnResourceMessageReceived( | 38 virtual int32_t OnResourceMessageReceived( |
| 35 const IPC::Message& msg, | 39 const IPC::Message& msg, |
| 36 ppapi::host::HostMessageContext* context) OVERRIDE; | 40 ppapi::host::HostMessageContext* context) OVERRIDE; |
| 37 | 41 |
| 38 void OnInitialized(media::VideoCapture* capture, bool succeeded); | 42 void OnInitialized(bool succeeded); |
| 39 | 43 |
| 40 // media::VideoCapture::EventHandler | 44 void OnStarted(); |
|
Ami GONE FROM CHROMIUM
2014/04/21 23:42:53
It's strange to see methods like this not be OVERR
Alpha Left Google
2014/04/23 18:48:33
I added documents for these methods. PepperVidoeCa
| |
| 41 virtual void OnStarted(media::VideoCapture* capture) OVERRIDE; | 45 void OnStopped(); |
| 42 virtual void OnStopped(media::VideoCapture* capture) OVERRIDE; | 46 void OnPaused(); |
| 43 virtual void OnPaused(media::VideoCapture* capture) OVERRIDE; | 47 void OnError(); |
| 44 virtual void OnError(media::VideoCapture* capture, int error_code) OVERRIDE; | 48 void OnFrameReady(const scoped_refptr<media::VideoFrame>& frame, |
| 45 virtual void OnRemoved(media::VideoCapture* capture) OVERRIDE; | 49 media::VideoCaptureFormat format); |
| 46 virtual void OnFrameReady(media::VideoCapture* capture, | |
| 47 const scoped_refptr<media::VideoFrame>& frame) | |
| 48 OVERRIDE; | |
| 49 | 50 |
| 50 private: | 51 private: |
| 51 int32_t OnOpen(ppapi::host::HostMessageContext* context, | 52 int32_t OnOpen(ppapi::host::HostMessageContext* context, |
| 52 const std::string& device_id, | 53 const std::string& device_id, |
| 53 const PP_VideoCaptureDeviceInfo_Dev& requested_info, | 54 const PP_VideoCaptureDeviceInfo_Dev& requested_info, |
| 54 uint32_t buffer_count); | 55 uint32_t buffer_count); |
| 55 int32_t OnStartCapture(ppapi::host::HostMessageContext* context); | 56 int32_t OnStartCapture(ppapi::host::HostMessageContext* context); |
| 56 int32_t OnReuseBuffer(ppapi::host::HostMessageContext* context, | 57 int32_t OnReuseBuffer(ppapi::host::HostMessageContext* context, |
| 57 uint32_t buffer); | 58 uint32_t buffer); |
| 58 int32_t OnStopCapture(ppapi::host::HostMessageContext* context); | 59 int32_t OnStopCapture(ppapi::host::HostMessageContext* context); |
| 59 int32_t OnClose(ppapi::host::HostMessageContext* context); | 60 int32_t OnClose(ppapi::host::HostMessageContext* context); |
| 60 | 61 |
| 61 int32_t StopCapture(); | 62 int32_t StopCapture(); |
| 62 int32_t Close(); | 63 int32_t Close(); |
| 63 void PostErrorReply(); | 64 void PostErrorReply(); |
| 64 void AllocBuffers(const gfx::Size& resolution, int frame_rate); | 65 void AllocBuffers(const gfx::Size& resolution, int frame_rate); |
| 65 void ReleaseBuffers(); | 66 void ReleaseBuffers(); |
| 66 void SendStatus(); | 67 void SendStatus(); |
| 67 | 68 |
| 68 void SetRequestedInfo(const PP_VideoCaptureDeviceInfo_Dev& device_info, | 69 void SetRequestedInfo(const PP_VideoCaptureDeviceInfo_Dev& device_info, |
| 69 uint32_t buffer_count); | 70 uint32_t buffer_count); |
| 70 | 71 |
| 71 void DetachPlatformVideoCapture(); | 72 void DetachPlatformVideoCapture(); |
| 72 | 73 |
| 73 bool SetStatus(PP_VideoCaptureStatus_Dev status, bool forced); | 74 bool SetStatus(PP_VideoCaptureStatus_Dev status, bool forced); |
| 74 | 75 |
| 75 scoped_refptr<PepperPlatformVideoCapture> platform_video_capture_; | 76 scoped_ptr<PepperPlatformVideoCapture> platform_video_capture_; |
| 76 | 77 |
| 77 // Buffers of video frame. | 78 // Buffers of video frame. |
| 78 struct BufferInfo { | 79 struct BufferInfo { |
| 79 BufferInfo(); | 80 BufferInfo(); |
| 80 ~BufferInfo(); | 81 ~BufferInfo(); |
| 81 | 82 |
| 82 bool in_use; | 83 bool in_use; |
| 83 void* data; | 84 void* data; |
| 84 scoped_refptr<PPB_Buffer_Impl> buffer; | 85 scoped_refptr<PPB_Buffer_Impl> buffer; |
| 85 }; | 86 }; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 97 ppapi::host::ReplyMessageContext open_reply_context_; | 98 ppapi::host::ReplyMessageContext open_reply_context_; |
| 98 | 99 |
| 99 PepperDeviceEnumerationHostHelper enumeration_helper_; | 100 PepperDeviceEnumerationHostHelper enumeration_helper_; |
| 100 | 101 |
| 101 DISALLOW_COPY_AND_ASSIGN(PepperVideoCaptureHost); | 102 DISALLOW_COPY_AND_ASSIGN(PepperVideoCaptureHost); |
| 102 }; | 103 }; |
| 103 | 104 |
| 104 } // namespace content | 105 } // namespace content |
| 105 | 106 |
| 106 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_CAPTURE_HOST_H_ | 107 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_CAPTURE_HOST_H_ |
| OLD | NEW |