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 // VideoCaptureDevice is the abstract base class for realizing video capture | 5 // VideoCaptureDevice is the abstract base class for realizing video capture |
6 // device support in Chromium. It provides the interface for OS dependent | 6 // device support in Chromium. It provides the interface for OS dependent |
7 // implementations. | 7 // implementations. |
8 // The class is created and functions are invoked on a thread owned by | 8 // The class is created and functions are invoked on a thread owned by |
9 // VideoCaptureManager. Capturing is done on other threads, depending on the OS | 9 // VideoCaptureManager. Capturing is done on other threads, depending on the OS |
10 // specific implementation. | 10 // specific implementation. |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // layout are taken from the parameters specified by an earlier call to | 155 // layout are taken from the parameters specified by an earlier call to |
156 // OnFrameInfo(). |data| must be packed, with no padding between rows and/or | 156 // OnFrameInfo(). |data| must be packed, with no padding between rows and/or |
157 // color planes. | 157 // color planes. |
158 // | 158 // |
159 // This method will try to reserve an output buffer and copy from |data| | 159 // This method will try to reserve an output buffer and copy from |data| |
160 // into the output buffer. If no output buffer is available, the frame will | 160 // into the output buffer. If no output buffer is available, the frame will |
161 // be silently dropped. | 161 // be silently dropped. |
162 virtual void OnIncomingCapturedFrame( | 162 virtual void OnIncomingCapturedFrame( |
163 const uint8* data, | 163 const uint8* data, |
164 int length, | 164 int length, |
165 base::Time timestamp, | 165 base::TimeTicks timestamp, |
166 int rotation, // Clockwise. | 166 int rotation, // Clockwise. |
167 const VideoCaptureFormat& frame_format) = 0; | 167 const VideoCaptureFormat& frame_format) = 0; |
168 | 168 |
169 // Captured a new video frame, held in |buffer|. | 169 // Captured a new video frame, held in |buffer|. |
170 // | 170 // |
171 // As the frame is backed by a reservation returned by | 171 // As the frame is backed by a reservation returned by |
172 // ReserveOutputBuffer(), delivery is guaranteed and will require no | 172 // ReserveOutputBuffer(), delivery is guaranteed and will require no |
173 // additional copies in the browser process. |dimensions| indicates the | 173 // additional copies in the browser process. |dimensions| indicates the |
174 // frame width and height of the buffer contents; this is assumed to be of | 174 // frame width and height of the buffer contents; this is assumed to be of |
175 // |format| format and tightly packed. | 175 // |format| format and tightly packed. |
176 virtual void OnIncomingCapturedBuffer(const scoped_refptr<Buffer>& buffer, | 176 virtual void OnIncomingCapturedBuffer(const scoped_refptr<Buffer>& buffer, |
177 media::VideoFrame::Format format, | 177 media::VideoFrame::Format format, |
178 const gfx::Size& dimensions, | 178 const gfx::Size& dimensions, |
179 base::Time timestamp, | 179 base::TimeTicks timestamp, |
180 int frame_rate) = 0; | 180 int frame_rate) = 0; |
181 | 181 |
182 // An error has occurred that cannot be handled and VideoCaptureDevice must | 182 // An error has occurred that cannot be handled and VideoCaptureDevice must |
183 // be StopAndDeAllocate()-ed. | 183 // be StopAndDeAllocate()-ed. |
184 virtual void OnError() = 0; | 184 virtual void OnError() = 0; |
185 }; | 185 }; |
186 | 186 |
187 // Creates a VideoCaptureDevice object. | 187 // Creates a VideoCaptureDevice object. |
188 // Return NULL if the hardware is not available. | 188 // Return NULL if the hardware is not available. |
189 static VideoCaptureDevice* Create(const Name& device_name); | 189 static VideoCaptureDevice* Create(const Name& device_name); |
(...skipping 25 matching lines...) Expand all Loading... |
215 // If deallocation is done asynchronously, then the device implementation must | 215 // If deallocation is done asynchronously, then the device implementation must |
216 // ensure that a subsequent AllocateAndStart() operation targeting the same ID | 216 // ensure that a subsequent AllocateAndStart() operation targeting the same ID |
217 // would be sequenced through the same task runner, so that deallocation | 217 // would be sequenced through the same task runner, so that deallocation |
218 // happens first. | 218 // happens first. |
219 virtual void StopAndDeAllocate() = 0; | 219 virtual void StopAndDeAllocate() = 0; |
220 }; | 220 }; |
221 | 221 |
222 } // namespace media | 222 } // namespace media |
223 | 223 |
224 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ | 224 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ |
OLD | NEW |