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