Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: media/video/capture/video_capture_device.h

Issue 83793004: Implement IPCs and VideoCapture::Client interfaces for texture capture (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: e296ac98 Win32 bits. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 const int id_; 133 const int id_;
134 void* const data_; 134 void* const data_;
135 const size_t size_; 135 const size_t size_;
136 }; 136 };
137 137
138 virtual ~Client() {} 138 virtual ~Client() {}
139 139
140 // Reserve an output buffer into which contents can be captured directly. 140 // Reserve an output buffer into which contents can be captured directly.
141 // The returned Buffer will always be allocated with a memory size suitable 141 // The returned Buffer will always be allocated with a memory size suitable
142 // for holding a packed video frame of |format| format, of |dimensions| 142 // for holding a packed video frame with pixels of |format| format, of
143 // dimensions. It is permissible for |dimensions| to be zero; in which 143 // |dimensions| frame dimensions. It is permissible for |dimensions| to be
144 // case the returned Buffer does not guarantee memory backing, but functions 144 // zero; in which case the returned Buffer does not guarantee memory
145 // as a reservation for external input for the purposes of buffer 145 // backing, but functions as a reservation for external input for the
146 // throttling. 146 // purposes of buffer throttling.
147 // 147 //
148 // The output buffer stays reserved for use until the Buffer object is 148 // The output buffer stays reserved for use until the Buffer object is
149 // destroyed. 149 // destroyed.
150 virtual scoped_refptr<Buffer> ReserveOutputBuffer( 150 virtual scoped_refptr<Buffer> ReserveOutputBuffer(
151 media::VideoFrame::Format format, 151 media::VideoFrame::Format format,
152 const gfx::Size& dimensions) = 0; 152 const gfx::Size& dimensions) = 0;
153 153
154 // Captured a new video frame as a raw buffer. The size, color format, and 154 // Captured a new video frame, data for which is pointed to by |data|.
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
157 // color planes.
158 // 155 //
159 // This method will try to reserve an output buffer and copy from |data| 156 // The format of the frame is described by |frame_format|, and is assumed to
160 // into the output buffer. If no output buffer is available, the frame will 157 // be tightly packed. This method will try to reserve an output buffer and
161 // be silently dropped. 158 // copy from |data| into the output buffer. If no output buffer is
162 virtual void OnIncomingCapturedFrame( 159 // available, the frame will be silently dropped.
163 const uint8* data, 160 virtual void OnIncomingCapturedData(const uint8* data,
164 int length, 161 int length,
165 base::TimeTicks timestamp, 162 const VideoCaptureFormat& frame_format,
166 int rotation, // Clockwise. 163 int rotation, // Clockwise.
167 const VideoCaptureFormat& frame_format) = 0; 164 base::TimeTicks timestamp) = 0;
168 165
169 // Captured a new video frame, held in |buffer|. 166 // Captured a new video frame, held in |frame|.
170 // 167 //
171 // As the frame is backed by a reservation returned by 168 // As the frame is backed by a reservation returned by
172 // ReserveOutputBuffer(), delivery is guaranteed and will require no 169 // ReserveOutputBuffer(), delivery is guaranteed and will require no
173 // additional copies in the browser process. |dimensions| indicates the 170 // additional copies in the browser process.
174 // frame width and height of the buffer contents; this is assumed to be of 171 virtual void OnIncomingCapturedVideoFrame(
175 // |format| format and tightly packed. 172 const scoped_refptr<Buffer>& buffer,
176 virtual void OnIncomingCapturedBuffer(const scoped_refptr<Buffer>& buffer, 173 const VideoCaptureFormat& buffer_format,
177 media::VideoFrame::Format format, 174 const scoped_refptr<media::VideoFrame>& frame,
178 const gfx::Size& dimensions, 175 base::TimeTicks timestamp) = 0;
179 base::TimeTicks timestamp,
180 int frame_rate) = 0;
181 176
182 // An error has occurred that cannot be handled and VideoCaptureDevice must 177 // An error has occurred that cannot be handled and VideoCaptureDevice must
183 // be StopAndDeAllocate()-ed. |reason| is a text description of the error. 178 // be StopAndDeAllocate()-ed. |reason| is a text description of the error.
184 virtual void OnError(const std::string& reason) = 0; 179 virtual void OnError(const std::string& reason) = 0;
185 }; 180 };
186 181
187 // Creates a VideoCaptureDevice object. 182 // Creates a VideoCaptureDevice object.
188 // Return NULL if the hardware is not available. 183 // Return NULL if the hardware is not available.
189 static VideoCaptureDevice* Create(const Name& device_name); 184 static VideoCaptureDevice* Create(const Name& device_name);
190 virtual ~VideoCaptureDevice(); 185 virtual ~VideoCaptureDevice();
(...skipping 24 matching lines...) Expand all
215 // If deallocation is done asynchronously, then the device implementation must 210 // If deallocation is done asynchronously, then the device implementation must
216 // ensure that a subsequent AllocateAndStart() operation targeting the same ID 211 // ensure that a subsequent AllocateAndStart() operation targeting the same ID
217 // would be sequenced through the same task runner, so that deallocation 212 // would be sequenced through the same task runner, so that deallocation
218 // happens first. 213 // happens first.
219 virtual void StopAndDeAllocate() = 0; 214 virtual void StopAndDeAllocate() = 0;
220 }; 215 };
221 216
222 } // namespace media 217 } // namespace media
223 218
224 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ 219 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_
OLDNEW
« no previous file with comments | « media/video/capture/mac/video_capture_device_qtkit_mac.mm ('k') | media/video/capture/video_capture_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698