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 // 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 // VideoCaptureImpl is also a delegate of VideoCaptureMessageFilter which | 9 // VideoCaptureImpl is also a delegate of VideoCaptureMessageFilter which |
10 // relays operation of capture device to browser process and receives response | 10 // relays operation of capture device to browser process and receives response |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) OVERRIDE; | 45 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) OVERRIDE; |
46 virtual bool CaptureStarted() OVERRIDE; | 46 virtual bool CaptureStarted() OVERRIDE; |
47 virtual int CaptureWidth() OVERRIDE; | 47 virtual int CaptureWidth() OVERRIDE; |
48 virtual int CaptureHeight() OVERRIDE; | 48 virtual int CaptureHeight() OVERRIDE; |
49 virtual int CaptureFrameRate() OVERRIDE; | 49 virtual int CaptureFrameRate() OVERRIDE; |
50 | 50 |
51 // VideoCaptureMessageFilter::Delegate interface. | 51 // VideoCaptureMessageFilter::Delegate interface. |
52 virtual void OnBufferCreated(base::SharedMemoryHandle handle, | 52 virtual void OnBufferCreated(base::SharedMemoryHandle handle, |
53 int length, int buffer_id) OVERRIDE; | 53 int length, int buffer_id) OVERRIDE; |
54 virtual void OnBufferReceived(int buffer_id, base::Time timestamp) OVERRIDE; | 54 virtual void OnBufferReceived(int buffer_id, base::Time timestamp) OVERRIDE; |
55 virtual void OnStateChanged(video_capture::State state) OVERRIDE; | 55 virtual void OnStateChanged(VideoCaptureState state) OVERRIDE; |
56 virtual void OnDeviceInfoReceived( | 56 virtual void OnDeviceInfoReceived( |
57 const media::VideoCaptureParams& device_info) OVERRIDE; | 57 const media::VideoCaptureParams& device_info) OVERRIDE; |
58 virtual void OnDelegateAdded(int32 device_id) OVERRIDE; | 58 virtual void OnDelegateAdded(int32 device_id) OVERRIDE; |
59 | 59 |
60 private: | 60 private: |
61 friend class VideoCaptureImplManager; | 61 friend class VideoCaptureImplManager; |
62 friend class VideoCaptureImplTest; | 62 friend class VideoCaptureImplTest; |
63 friend class MockVideoCaptureImpl; | 63 friend class MockVideoCaptureImpl; |
64 | 64 |
65 struct DIBBuffer; | 65 struct DIBBuffer; |
66 typedef std::map<media::VideoCapture::EventHandler*, | 66 typedef std::map<media::VideoCapture::EventHandler*, |
67 media::VideoCaptureCapability> ClientInfo; | 67 media::VideoCaptureCapability> ClientInfo; |
68 | 68 |
69 VideoCaptureImpl(media::VideoCaptureSessionId id, | 69 VideoCaptureImpl(media::VideoCaptureSessionId id, |
70 base::MessageLoopProxy* capture_message_loop_proxy, | 70 base::MessageLoopProxy* capture_message_loop_proxy, |
71 VideoCaptureMessageFilter* filter); | 71 VideoCaptureMessageFilter* filter); |
72 virtual ~VideoCaptureImpl(); | 72 virtual ~VideoCaptureImpl(); |
73 | 73 |
74 void DoStartCaptureOnCaptureThread( | 74 void DoStartCaptureOnCaptureThread( |
75 media::VideoCapture::EventHandler* handler, | 75 media::VideoCapture::EventHandler* handler, |
76 const media::VideoCaptureCapability& capability); | 76 const media::VideoCaptureCapability& capability); |
77 void DoStopCaptureOnCaptureThread(media::VideoCapture::EventHandler* handler); | 77 void DoStopCaptureOnCaptureThread(media::VideoCapture::EventHandler* handler); |
78 void DoFeedBufferOnCaptureThread(scoped_refptr<VideoFrameBuffer> buffer); | 78 void DoFeedBufferOnCaptureThread(scoped_refptr<VideoFrameBuffer> buffer); |
79 | 79 |
80 void DoBufferCreatedOnCaptureThread(base::SharedMemoryHandle handle, | 80 void DoBufferCreatedOnCaptureThread(base::SharedMemoryHandle handle, |
81 int length, int buffer_id); | 81 int length, int buffer_id); |
82 void DoBufferReceivedOnCaptureThread(int buffer_id, base::Time timestamp); | 82 void DoBufferReceivedOnCaptureThread(int buffer_id, base::Time timestamp); |
83 void DoStateChangedOnCaptureThread(video_capture::State state); | 83 void DoStateChangedOnCaptureThread(VideoCaptureState state); |
84 void DoDeviceInfoReceivedOnCaptureThread( | 84 void DoDeviceInfoReceivedOnCaptureThread( |
85 const media::VideoCaptureParams& device_info); | 85 const media::VideoCaptureParams& device_info); |
86 void DoDelegateAddedOnCaptureThread(int32 device_id); | 86 void DoDelegateAddedOnCaptureThread(int32 device_id); |
87 | 87 |
88 void Init(); | 88 void Init(); |
89 void DeInit(base::Closure task); | 89 void DeInit(base::Closure task); |
90 void DoDeInitOnCaptureThread(base::Closure task); | 90 void DoDeInitOnCaptureThread(base::Closure task); |
91 void StopDevice(); | 91 void StopDevice(); |
92 void RestartCapture(); | 92 void RestartCapture(); |
93 void StartCaptureInternal(); | 93 void StartCaptureInternal(); |
(...skipping 23 matching lines...) Expand all Loading... |
117 media::VideoCaptureCapability::Format video_type_; | 117 media::VideoCaptureCapability::Format video_type_; |
118 | 118 |
119 // The parameter is being used in current capture session. A capture session | 119 // The parameter is being used in current capture session. A capture session |
120 // starts with StartCapture and ends with StopCapture. | 120 // starts with StartCapture and ends with StopCapture. |
121 media::VideoCaptureParams current_params_; | 121 media::VideoCaptureParams current_params_; |
122 | 122 |
123 // The information about the device sent from browser process side. | 123 // The information about the device sent from browser process side. |
124 media::VideoCaptureParams device_info_; | 124 media::VideoCaptureParams device_info_; |
125 bool device_info_available_; | 125 bool device_info_available_; |
126 | 126 |
127 video_capture::State state_; | 127 VideoCaptureState state_; |
128 | 128 |
129 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); | 129 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); |
130 }; | 130 }; |
131 | 131 |
132 } // namespace content | 132 } // namespace content |
133 | 133 |
134 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ | 134 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ |
OLD | NEW |