| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // VideoCaptureImpl represents a capture device in renderer process. It provides | 5 // VideoCaptureImpl represents a capture device in renderer process. It provides |
| 6 // interfaces for clients to Start/Stop capture. It also communicates to clients | 6 // interfaces for clients to Start/Stop capture. It also communicates to clients |
| 7 // when buffer is ready, state of capture device is changed. | 7 // when buffer is ready, state of capture device is changed. |
| 8 | 8 |
| 9 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ | 9 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ |
| 10 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ | 10 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ |
| 11 | 11 |
| 12 #include <list> | 12 #include <list> |
| 13 #include <map> | 13 #include <map> |
| 14 | 14 |
| 15 #include "content/renderer/media/video_capture_message_filter.h" | 15 #include "content/renderer/media/video_capture_message_filter.h" |
| 16 #include "media/video/capture/video_capture.h" | 16 #include "media/video/capture/video_capture.h" |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class MessageLoopProxy; | 19 class MessageLoopProxy; |
| 20 class WaitableEvent; |
| 20 } | 21 } |
| 21 | 22 |
| 22 class VideoCaptureImpl | 23 class VideoCaptureImpl |
| 23 : public media::VideoCapture, | 24 : public media::VideoCapture, |
| 24 public VideoCaptureMessageFilter::Delegate { | 25 public VideoCaptureMessageFilter::Delegate { |
| 25 public: | 26 public: |
| 26 // media::VideoCapture interface. | 27 // media::VideoCapture interface. |
| 27 virtual void StartCapture(media::VideoCapture::EventHandler* handler, | 28 virtual void StartCapture(media::VideoCapture::EventHandler* handler, |
| 28 const VideoCaptureCapability& capability); | 29 const VideoCaptureCapability& capability) OVERRIDE; |
| 29 virtual void StopCapture(media::VideoCapture::EventHandler* handler); | 30 virtual void StopCapture(media::VideoCapture::EventHandler* handler, |
| 30 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer); | 31 bool need_notification) OVERRIDE; |
| 31 virtual bool CaptureStarted(); | 32 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) OVERRIDE; |
| 32 virtual int CaptureWidth(); | 33 virtual bool CaptureStarted() OVERRIDE; |
| 33 virtual int CaptureHeight(); | 34 virtual int CaptureWidth() OVERRIDE; |
| 34 virtual int CaptureFrameRate(); | 35 virtual int CaptureHeight() OVERRIDE; |
| 36 virtual int CaptureFrameRate() OVERRIDE; |
| 35 | 37 |
| 36 // VideoCaptureMessageFilter::Delegate interface. | 38 // VideoCaptureMessageFilter::Delegate interface. |
| 37 virtual void OnBufferCreated(base::SharedMemoryHandle handle, | 39 virtual void OnBufferCreated(base::SharedMemoryHandle handle, |
| 38 int length, int buffer_id); | 40 int length, int buffer_id); |
| 39 virtual void OnBufferReceived(int buffer_id, base::Time timestamp); | 41 virtual void OnBufferReceived(int buffer_id, base::Time timestamp); |
| 40 virtual void OnStateChanged(const media::VideoCapture::State& state); | 42 virtual void OnStateChanged(const media::VideoCapture::State& state); |
| 41 virtual void OnDeviceInfoReceived( | 43 virtual void OnDeviceInfoReceived( |
| 42 const media::VideoCaptureParams& device_info); | 44 const media::VideoCaptureParams& device_info); |
| 43 virtual void OnDelegateAdded(int32 device_id); | 45 virtual void OnDelegateAdded(int32 device_id); |
| 44 | 46 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 61 scoped_refptr<media::VideoCapture::VideoFrameBuffer> mapped_memory; | 63 scoped_refptr<media::VideoCapture::VideoFrameBuffer> mapped_memory; |
| 62 }; | 64 }; |
| 63 | 65 |
| 64 VideoCaptureImpl(media::VideoCaptureSessionId id, | 66 VideoCaptureImpl(media::VideoCaptureSessionId id, |
| 65 scoped_refptr<base::MessageLoopProxy> ml_proxy, | 67 scoped_refptr<base::MessageLoopProxy> ml_proxy, |
| 66 VideoCaptureMessageFilter* filter); | 68 VideoCaptureMessageFilter* filter); |
| 67 virtual ~VideoCaptureImpl(); | 69 virtual ~VideoCaptureImpl(); |
| 68 | 70 |
| 69 void DoStartCapture(media::VideoCapture::EventHandler* handler, | 71 void DoStartCapture(media::VideoCapture::EventHandler* handler, |
| 70 const VideoCaptureCapability& capability); | 72 const VideoCaptureCapability& capability); |
| 71 void DoStopCapture(media::VideoCapture::EventHandler* handler); | 73 void DoStopCapture(media::VideoCapture::EventHandler* handler, |
| 74 base::WaitableEvent* completion); |
| 72 void DoFeedBuffer(scoped_refptr<VideoFrameBuffer> buffer); | 75 void DoFeedBuffer(scoped_refptr<VideoFrameBuffer> buffer); |
| 73 | 76 |
| 74 void DoBufferCreated(base::SharedMemoryHandle handle, | 77 void DoBufferCreated(base::SharedMemoryHandle handle, |
| 75 int length, int buffer_id); | 78 int length, int buffer_id); |
| 76 void DoBufferReceived(int buffer_id, base::Time timestamp); | 79 void DoBufferReceived(int buffer_id, base::Time timestamp); |
| 77 void DoStateChanged(const media::VideoCapture::State& state); | 80 void DoStateChanged(const media::VideoCapture::State& state); |
| 78 void DoDeviceInfoReceived(const media::VideoCaptureParams& device_info); | 81 void DoDeviceInfoReceived(const media::VideoCaptureParams& device_info); |
| 79 void DoDelegateAdded(int32 device_id); | 82 void DoDelegateAdded(int32 device_id); |
| 80 | 83 |
| 81 void Init(); | 84 void Init(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // The parameter will be used in next capture session. | 119 // The parameter will be used in next capture session. |
| 117 media::VideoCaptureParams new_params_; | 120 media::VideoCaptureParams new_params_; |
| 118 State state_; | 121 State state_; |
| 119 | 122 |
| 120 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); | 123 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); |
| 121 }; | 124 }; |
| 122 | 125 |
| 123 DISABLE_RUNNABLE_METHOD_REFCOUNT(VideoCaptureImpl); | 126 DISABLE_RUNNABLE_METHOD_REFCOUNT(VideoCaptureImpl); |
| 124 | 127 |
| 125 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ | 128 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ |
| OLD | NEW |