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

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

Issue 24079003: Add VideoCaptureDevice::GetDeviceSupportedFormats to interface + implementation for Linux and Fake (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed inexistent video_capture_device_dummy; also removed from media.gyp targets. Created 7 years, 2 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
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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // be StopAndDeAllocate()-ed. 174 // be StopAndDeAllocate()-ed.
175 virtual void OnError() = 0; 175 virtual void OnError() = 0;
176 176
177 // Called when VideoCaptureDevice::AllocateAndStart() has been called to 177 // Called when VideoCaptureDevice::AllocateAndStart() has been called to
178 // inform of the resulting frame size. 178 // inform of the resulting frame size.
179 virtual void OnFrameInfo(const VideoCaptureCapability& info) = 0; 179 virtual void OnFrameInfo(const VideoCaptureCapability& info) = 0;
180 180
181 // Called when the native resolution of VideoCaptureDevice has been changed 181 // Called when the native resolution of VideoCaptureDevice has been changed
182 // and it needs to inform its client of the new frame size. 182 // and it needs to inform its client of the new frame size.
183 virtual void OnFrameInfoChanged(const VideoCaptureCapability& info) {}; 183 virtual void OnFrameInfoChanged(const VideoCaptureCapability& info) {};
184
185 // Called when VideoCaptureDevice::GetDeviceSupportedFormats() has been
186 // called, to reply with the the resulting device capabilities.
187 virtual void OnDeviceSupportedFormatsEnumerated(
188 const VideoCaptureFormats& formats) {};
184 }; 189 };
185 // Creates a VideoCaptureDevice object. 190 // Creates a VideoCaptureDevice object.
186 // Return NULL if the hardware is not available. 191 // Return NULL if the hardware is not available.
187 static VideoCaptureDevice* Create(const Name& device_name); 192 static VideoCaptureDevice* Create(const Name& device_name);
188 virtual ~VideoCaptureDevice(); 193 virtual ~VideoCaptureDevice();
189 194
190 // Gets the names of all video capture devices connected to this computer. 195 // Gets the names of all video capture devices connected to this computer.
191 static void GetDeviceNames(Names* device_names); 196 static void GetDeviceNames(Names* device_names);
192 197
193 // Prepare the camera for use. After this function has been called no other 198 // Prepare the camera for use. After this function has been called no other
194 // applications can use the camera. On completion EventHandler::OnFrameInfo() 199 // applications can use the camera. On completion EventHandler::OnFrameInfo()
195 // is called informing of the resulting resolution and frame rate. 200 // is called informing of the resulting resolution and frame rate.
196 // StopAndDeAllocate() must be called before the object is deleted. 201 // StopAndDeAllocate() must be called before the object is deleted.
197 virtual void AllocateAndStart( 202 virtual void AllocateAndStart(
198 const VideoCaptureCapability& capture_format, 203 const VideoCaptureCapability& capture_format,
199 scoped_ptr<EventHandler> client) = 0; 204 scoped_ptr<EventHandler> client) = 0;
200 205
201 // Deallocates the camera, possibly asynchronously. 206 // Deallocates the camera, possibly asynchronously.
202 // 207 //
203 // This call requires the device to do the following things, eventually: put 208 // This call requires the device to do the following things, eventually: put
204 // camera hardware into a state where other applications could use it, free 209 // camera hardware into a state where other applications could use it, free
205 // the memory associated with capture, and delete the |client| pointer passed 210 // the memory associated with capture, and delete the |client| pointer passed
206 // into AllocateAndStart. 211 // into AllocateAndStart.
207 // 212 //
208 // If deallocation is done asynchronously, then the device implementation must 213 // If deallocation is done asynchronously, then the device implementation must
209 // ensure that a subsequent AllocateAndStart() operation targeting the same ID 214 // ensure that a subsequent AllocateAndStart() operation targeting the same ID
210 // would be sequenced through the same task runner, so that deallocation 215 // would be sequenced through the same task runner, so that deallocation
211 // happens first. 216 // happens first.
212 virtual void StopAndDeAllocate() = 0; 217 virtual void StopAndDeAllocate() = 0;
218
219 // Gets the supported video capture formats, if operation is supported by the
220 // driver, for a particular video capture device. This operation may be called
221 // before or after AllocateAndStart, and it may take into account the current
222 // state of the device, f.i. an already opened device might see supported
223 // formats limited etc.
224 virtual void GetDeviceSupportedFormats(scoped_ptr<EventHandler> client) {};
perkj_chrome 2013/09/25 07:58:41 Instead of |client| beeing an EventHandler - it mi
mcasas 2013/10/02 08:13:23 Done.
213 }; 225 };
214 226
215 // VideoCaptureDevice1 is a bridge to an older API against which 227 // VideoCaptureDevice1 is a bridge to an older API against which
216 // VideoCaptureDevices were implemented. Differences between VideoCaptureDevice 228 // VideoCaptureDevices were implemented. Differences between VideoCaptureDevice
217 // (new style) and VideoCaptureDevice1 (old style) are as follows: 229 // (new style) and VideoCaptureDevice1 (old style) are as follows:
218 // 230 //
219 // [1] The Stop+DeAllocate calls are merged in the new style. 231 // [1] The Stop+DeAllocate calls are merged in the new style.
220 // [2] The Allocate+Start calls are merged in the new style. 232 // [2] The Allocate+Start calls are merged in the new style.
221 // [3] New style devices own their EventHandler* pointers, allowing handlers to 233 // [3] New style devices own their EventHandler* pointers, allowing handlers to
222 // remain valid even after the device is stopped. Whereas old style devices 234 // remain valid even after the device is stopped. Whereas old style devices
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 virtual const Name& device_name() = 0; 272 virtual const Name& device_name() = 0;
261 273
262 private: 274 private:
263 // The device client which proxies device events to the controller. 275 // The device client which proxies device events to the controller.
264 scoped_ptr<EventHandler> client_; 276 scoped_ptr<EventHandler> client_;
265 }; 277 };
266 278
267 } // namespace media 279 } // namespace media
268 280
269 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ 281 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698