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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // purposes of buffer throttling. | 140 // purposes of buffer throttling. |
141 // | 141 // |
142 // The output buffer stays reserved and mapped for use until the Buffer | 142 // The output buffer stays reserved and mapped for use until the Buffer |
143 // object is destroyed or returned. | 143 // object is destroyed or returned. |
144 virtual std::unique_ptr<Buffer> ReserveOutputBuffer( | 144 virtual std::unique_ptr<Buffer> ReserveOutputBuffer( |
145 const gfx::Size& dimensions, | 145 const gfx::Size& dimensions, |
146 VideoPixelFormat format, | 146 VideoPixelFormat format, |
147 VideoPixelStorage storage, | 147 VideoPixelStorage storage, |
148 int frame_feedback_id) = 0; | 148 int frame_feedback_id) = 0; |
149 | 149 |
150 // Captured new video data, held in |frame| or |buffer|, respectively for | 150 // Provides VCD::Client with a populated Buffer containing the content of |
151 // OnIncomingCapturedVideoFrame() and OnIncomingCapturedBuffer(). | 151 // the next video frame. The |buffer| must originate from an earlier call to |
152 // | 152 // ReserveOutputBuffer(). |
153 // In both cases, as the frame is backed by a reservation returned by | |
154 // ReserveOutputBuffer(), delivery is guaranteed and will require no | |
155 // additional copies in the browser process. | |
156 // See OnIncomingCapturedData for details of |reference_time| and | 153 // See OnIncomingCapturedData for details of |reference_time| and |
157 // |timestamp|. | 154 // |timestamp|. |
158 // TODO(chfremer): Consider removing one of the two in order to simplify the | |
159 // interface. | |
160 virtual void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer, | 155 virtual void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer, |
161 const VideoCaptureFormat& format, | 156 const VideoCaptureFormat& format, |
162 base::TimeTicks reference_time, | 157 base::TimeTicks reference_time, |
163 base::TimeDelta timestamp) = 0; | 158 base::TimeDelta timestamp) = 0; |
164 virtual void OnIncomingCapturedVideoFrame( | 159 |
| 160 // Extended version of OnIncomingCapturedBuffer() allowing clients to |
| 161 // pass a custom |visible_rect| and |additional_metadata|. |
| 162 virtual void OnIncomingCapturedBufferExt( |
165 std::unique_ptr<Buffer> buffer, | 163 std::unique_ptr<Buffer> buffer, |
166 scoped_refptr<VideoFrame> frame) = 0; | 164 const VideoCaptureFormat& format, |
| 165 base::TimeTicks reference_time, |
| 166 base::TimeDelta timestamp, |
| 167 gfx::Rect visible_rect, |
| 168 const VideoFrameMetadata& additional_metadata) = 0; |
167 | 169 |
168 // Attempts to reserve the same Buffer provided in the last call to one of | 170 // Attempts to reserve the same Buffer provided in the last call to one of |
169 // the OnIncomingCapturedXXX() methods. This will fail if the content of the | 171 // the OnIncomingCapturedBufferXXX() methods. This will fail if the content |
170 // Buffer has not been preserved, or if the |dimensions|, |format|, or | 172 // of the Buffer has not been preserved, or if the |dimensions|, |format|, |
171 // |storage| disagree with how it was reserved via ReserveOutputBuffer(). | 173 // or |storage| disagree with how it was reserved via ReserveOutputBuffer(). |
172 // When this operation fails, nullptr will be returned. | 174 // When this operation fails, nullptr will be returned. |
173 virtual std::unique_ptr<Buffer> ResurrectLastOutputBuffer( | 175 virtual std::unique_ptr<Buffer> ResurrectLastOutputBuffer( |
174 const gfx::Size& dimensions, | 176 const gfx::Size& dimensions, |
175 VideoPixelFormat format, | 177 VideoPixelFormat format, |
176 VideoPixelStorage storage, | 178 VideoPixelStorage storage, |
177 int new_frame_feedback_id) = 0; | 179 int new_frame_feedback_id) = 0; |
178 | 180 |
179 // An error has occurred that cannot be handled and VideoCaptureDevice must | 181 // An error has occurred that cannot be handled and VideoCaptureDevice must |
180 // be StopAndDeAllocate()-ed. |reason| is a text description of the error. | 182 // be StopAndDeAllocate()-ed. |reason| is a text description of the error. |
181 virtual void OnError(const tracked_objects::Location& from_here, | 183 virtual void OnError(const tracked_objects::Location& from_here, |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 277 |
276 private: | 278 private: |
277 // Gets the power line frequency from the current system time zone if this is | 279 // Gets the power line frequency from the current system time zone if this is |
278 // defined, otherwise returns 0. | 280 // defined, otherwise returns 0. |
279 PowerLineFrequency GetPowerLineFrequencyForLocation() const; | 281 PowerLineFrequency GetPowerLineFrequencyForLocation() const; |
280 }; | 282 }; |
281 | 283 |
282 } // namespace media | 284 } // namespace media |
283 | 285 |
284 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ | 286 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ |
OLD | NEW |