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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 base::TimeTicks timestamp) = 0; | 225 base::TimeTicks timestamp) = 0; |
226 | 226 |
227 // An error has occurred that cannot be handled and VideoCaptureDevice must | 227 // An error has occurred that cannot be handled and VideoCaptureDevice must |
228 // be StopAndDeAllocate()-ed. |reason| is a text description of the error. | 228 // be StopAndDeAllocate()-ed. |reason| is a text description of the error. |
229 virtual void OnError(const std::string& reason) = 0; | 229 virtual void OnError(const std::string& reason) = 0; |
230 | 230 |
231 // VideoCaptureDevice requests the |message| to be logged. | 231 // VideoCaptureDevice requests the |message| to be logged. |
232 virtual void OnLog(const std::string& message) {} | 232 virtual void OnLog(const std::string& message) {} |
233 }; | 233 }; |
234 | 234 |
235 // Creates a VideoCaptureDevice object. | |
236 // Return NULL if the hardware is not available. | |
237 static VideoCaptureDevice* Create( | |
238 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | |
239 const Name& device_name); | |
240 virtual ~VideoCaptureDevice(); | 235 virtual ~VideoCaptureDevice(); |
241 | 236 |
242 // Gets the names of all video capture devices connected to this computer. | |
243 static void GetDeviceNames(Names* device_names); | |
244 | |
245 // Gets the supported formats of a particular device attached to the system. | |
246 // This method should be called before allocating or starting a device. In | |
247 // case format enumeration is not supported, or there was a problem, the | |
248 // formats array will be empty. | |
249 static void GetDeviceSupportedFormats(const Name& device, | |
250 VideoCaptureFormats* supported_formats); | |
251 | |
252 // Prepares the camera for use. After this function has been called no other | 237 // Prepares the camera for use. After this function has been called no other |
253 // applications can use the camera. StopAndDeAllocate() must be called before | 238 // applications can use the camera. StopAndDeAllocate() must be called before |
254 // the object is deleted. | 239 // the object is deleted. |
255 virtual void AllocateAndStart(const VideoCaptureParams& params, | 240 virtual void AllocateAndStart(const VideoCaptureParams& params, |
256 scoped_ptr<Client> client) = 0; | 241 scoped_ptr<Client> client) = 0; |
257 | 242 |
258 // Deallocates the camera, possibly asynchronously. | 243 // Deallocates the camera, possibly asynchronously. |
259 // | 244 // |
260 // This call requires the device to do the following things, eventually: put | 245 // This call requires the device to do the following things, eventually: put |
261 // camera hardware into a state where other applications could use it, free | 246 // camera hardware into a state where other applications could use it, free |
(...skipping 11 matching lines...) Expand all Loading... |
273 int GetPowerLineFrequencyForLocation() const; | 258 int GetPowerLineFrequencyForLocation() const; |
274 | 259 |
275 protected: | 260 protected: |
276 static const int kPowerLine50Hz = 50; | 261 static const int kPowerLine50Hz = 50; |
277 static const int kPowerLine60Hz = 60; | 262 static const int kPowerLine60Hz = 60; |
278 }; | 263 }; |
279 | 264 |
280 } // namespace media | 265 } // namespace media |
281 | 266 |
282 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ | 267 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ |
OLD | NEW |