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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // Allow generated copy constructor and assignment. | 118 // Allow generated copy constructor and assignment. |
119 }; | 119 }; |
120 | 120 |
121 class MEDIA_EXPORT Client { | 121 class MEDIA_EXPORT Client { |
122 public: | 122 public: |
123 virtual ~Client() {} | 123 virtual ~Client() {} |
124 | 124 |
125 // Reserve an output buffer into which a video frame can be captured | 125 // Reserve an output buffer into which a video frame can be captured |
126 // directly. If all buffers are currently busy, returns NULL. | 126 // directly. If all buffers are currently busy, returns NULL. |
127 // | 127 // |
128 // The returned VideoFrames will always be allocated with a YV12 format. The | 128 // The returned VideoFrames will always be allocated with a YV12 format and |
129 // size will match that specified by an earlier call to OnFrameInfo. It is | 129 // have dimensions matching |size|. It is the VideoCaptureDevice's |
130 // the VideoCaptureDevice's responsibility to obey whatever stride and | 130 // responsibility to obey whatever stride and memory layout are indicated on |
131 // memory layout are indicated on the returned VideoFrame object. | 131 // the returned VideoFrame object. |
132 // | 132 // |
133 // The output buffer stays reserved for use by the calling | 133 // The output buffer stays reserved for use by the calling |
134 // VideoCaptureDevice until either the last reference to the VideoFrame is | 134 // VideoCaptureDevice until either the last reference to the VideoFrame is |
135 // released, or until the buffer is passed back to the Client's | 135 // released, or until the buffer is passed back to the Client's |
136 // OnIncomingCapturedFrame() method. | 136 // OnIncomingCapturedFrame() method. |
137 virtual scoped_refptr<media::VideoFrame> ReserveOutputBuffer() = 0; | 137 virtual scoped_refptr<media::VideoFrame> ReserveOutputBuffer( |
| 138 const gfx::Size& size) = 0; |
138 | 139 |
139 // Captured a new video frame as a raw buffer. The size, color format, and | 140 // Captured a new video frame as a raw buffer. The size, color format, and |
140 // layout are taken from the parameters specified by an earlier call to | 141 // layout are taken from the parameters specified by an earlier call to |
141 // OnFrameInfo(). |data| must be packed, with no padding between rows and/or | 142 // OnFrameInfo(). |data| must be packed, with no padding between rows and/or |
142 // color planes. | 143 // color planes. |
143 // | 144 // |
144 // This method will try to reserve an output buffer and copy from |data| | 145 // This method will try to reserve an output buffer and copy from |data| |
145 // into the output buffer. If no output buffer is available, the frame will | 146 // into the output buffer. If no output buffer is available, the frame will |
146 // be silently dropped. | 147 // be silently dropped. |
147 virtual void OnIncomingCapturedFrame(const uint8* data, | 148 virtual void OnIncomingCapturedFrame(const uint8* data, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // If deallocation is done asynchronously, then the device implementation must | 216 // If deallocation is done asynchronously, then the device implementation must |
216 // ensure that a subsequent AllocateAndStart() operation targeting the same ID | 217 // ensure that a subsequent AllocateAndStart() operation targeting the same ID |
217 // would be sequenced through the same task runner, so that deallocation | 218 // would be sequenced through the same task runner, so that deallocation |
218 // happens first. | 219 // happens first. |
219 virtual void StopAndDeAllocate() = 0; | 220 virtual void StopAndDeAllocate() = 0; |
220 }; | 221 }; |
221 | 222 |
222 } // namespace media | 223 } // namespace media |
223 | 224 |
224 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ | 225 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ |
OLD | NEW |