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/common/content_export.h" | 15 #include "content/common/content_export.h" |
16 #include "content/renderer/media/video_capture_message_filter.h" | 16 #include "content/renderer/media/video_capture_message_filter.h" |
17 #include "media/video/capture/video_capture.h" | 17 #include "media/video/capture/video_capture.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class MessageLoopProxy; | 20 class MessageLoopProxy; |
21 } | 21 } |
22 | 22 |
23 class CONTENT_EXPORT VideoCaptureImpl | 23 class CONTENT_EXPORT VideoCaptureImpl |
24 : public media::VideoCapture, public VideoCaptureMessageFilter::Delegate { | 24 : public media::VideoCapture, public VideoCaptureMessageFilter::Delegate { |
25 public: | 25 public: |
26 // media::VideoCapture interface. | 26 // media::VideoCapture interface. |
27 virtual void StartCapture(media::VideoCapture::EventHandler* handler, | 27 virtual void StartCapture(media::VideoCapture::EventHandler* handler, |
28 const VideoCaptureCapability& capability); | 28 const VideoCaptureCapability& capability) OVERRIDE; |
29 virtual void StopCapture(media::VideoCapture::EventHandler* handler); | 29 virtual void StopCapture(media::VideoCapture::EventHandler* handler) OVERRIDE; |
30 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer); | 30 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) OVERRIDE; |
31 virtual bool CaptureStarted(); | 31 virtual bool CaptureStarted() OVERRIDE; |
32 virtual int CaptureWidth(); | 32 virtual int CaptureWidth() OVERRIDE; |
33 virtual int CaptureHeight(); | 33 virtual int CaptureHeight() OVERRIDE; |
34 virtual int CaptureFrameRate(); | 34 virtual int CaptureFrameRate() OVERRIDE; |
35 | 35 |
36 // VideoCaptureMessageFilter::Delegate interface. | 36 // VideoCaptureMessageFilter::Delegate interface. |
37 virtual void OnBufferCreated(base::SharedMemoryHandle handle, | 37 virtual void OnBufferCreated(base::SharedMemoryHandle handle, |
38 int length, int buffer_id); | 38 int length, int buffer_id) OVERRIDE; |
39 virtual void OnBufferReceived(int buffer_id, base::Time timestamp); | 39 virtual void OnBufferReceived(int buffer_id, base::Time timestamp) OVERRIDE; |
40 virtual void OnStateChanged(const media::VideoCapture::State& state); | 40 virtual void OnStateChanged(const media::VideoCapture::State& state) OVERRIDE; |
41 virtual void OnDeviceInfoReceived( | 41 virtual void OnDeviceInfoReceived( |
42 const media::VideoCaptureParams& device_info); | 42 const media::VideoCaptureParams& device_info) OVERRIDE; |
43 virtual void OnDelegateAdded(int32 device_id); | 43 virtual void OnDelegateAdded(int32 device_id) OVERRIDE; |
44 | 44 |
45 private: | 45 private: |
46 friend class VideoCaptureImplManager; | 46 friend class VideoCaptureImplManager; |
47 friend class VideoCaptureImplTest; | 47 friend class VideoCaptureImplTest; |
48 friend class MockVideoCaptureImpl; | 48 friend class MockVideoCaptureImpl; |
49 | 49 |
50 struct DIBBuffer; | 50 struct DIBBuffer; |
51 | 51 |
52 VideoCaptureImpl(media::VideoCaptureSessionId id, | 52 VideoCaptureImpl(media::VideoCaptureSessionId id, |
53 scoped_refptr<base::MessageLoopProxy> ml_proxy, | 53 scoped_refptr<base::MessageLoopProxy> ml_proxy, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 bool device_info_available_; | 104 bool device_info_available_; |
105 | 105 |
106 State state_; | 106 State state_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); | 108 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); |
109 }; | 109 }; |
110 | 110 |
111 DISABLE_RUNNABLE_METHOD_REFCOUNT(VideoCaptureImpl); | 111 DISABLE_RUNNABLE_METHOD_REFCOUNT(VideoCaptureImpl); |
112 | 112 |
113 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ | 113 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ |
OLD | NEW |