Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_FACTORY_H_ | 5 #ifndef MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_FACTORY_H_ |
| 6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_FACTORY_H_ | 6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/threading/thread_checker.h" | 9 #include "base/threading/thread_checker.h" |
| 10 #include "media/capture/video/video_capture_device.h" | 10 #include "media/capture/video/video_capture_device.h" |
| 11 #include "media/capture/video/video_capture_device_info.h" | |
| 11 | 12 |
| 12 namespace media { | 13 namespace media { |
| 13 | 14 |
| 14 // VideoCaptureDeviceFactory is the base class for creation of video capture | 15 // VideoCaptureDeviceFactory is the base class for creation of video capture |
| 15 // devices in the different platforms. VCDFs are created by MediaStreamManager | 16 // devices in the different platforms. VCDFs are created by MediaStreamManager |
| 16 // on IO thread and plugged into VideoCaptureManager, who owns and operates them | 17 // on IO thread and plugged into VideoCaptureManager, who owns and operates them |
| 17 // in Device Thread (a.k.a. Audio Thread). | 18 // in Device Thread (a.k.a. Audio Thread). |
| 18 class CAPTURE_EXPORT VideoCaptureDeviceFactory { | 19 class CAPTURE_EXPORT VideoCaptureDeviceFactory { |
| 19 public: | 20 public: |
| 20 static std::unique_ptr<VideoCaptureDeviceFactory> CreateFactory( | 21 static std::unique_ptr<VideoCaptureDeviceFactory> CreateFactory( |
| 21 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); | 22 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); |
| 22 | 23 |
| 23 VideoCaptureDeviceFactory(); | 24 VideoCaptureDeviceFactory(); |
| 24 virtual ~VideoCaptureDeviceFactory(); | 25 virtual ~VideoCaptureDeviceFactory(); |
| 25 | 26 |
| 26 // Creates a VideoCaptureDevice object. Returns NULL if something goes wrong. | 27 // Creates a VideoCaptureDevice object. Returns NULL if something goes wrong. |
| 27 virtual std::unique_ptr<VideoCaptureDevice> Create( | 28 virtual std::unique_ptr<VideoCaptureDevice> Create( |
| 28 const VideoCaptureDevice::Name& device_name) = 0; | 29 const VideoCaptureDeviceDescriptor& device_descriptor) = 0; |
| 29 | 30 |
| 30 // Asynchronous version of GetDeviceNames calling back to |callback|. | 31 // Asynchronous version of GetDeviceDescriptors calling back to |callback|. |
| 31 virtual void EnumerateDeviceNames( | 32 virtual void EnumerateDeviceDescriptors( |
| 32 const base::Callback< | 33 const base::Callback< |
| 33 void(std::unique_ptr<media::VideoCaptureDevice::Names>)>& callback); | 34 void(std::unique_ptr<VideoCaptureDeviceDescriptors>)>& callback); |
| 34 | 35 |
| 35 // Gets the supported formats of a particular device attached to the system. | 36 // Obtains extended information about a device. This includes the supported |
| 37 // formats. | |
| 36 // This method should be called before allocating or starting a device. In | 38 // This method should be called before allocating or starting a device. In |
| 37 // case format enumeration is not supported, or there was a problem, the | 39 // case format enumeration is not supported, or there was a problem, the |
| 38 // formats array will be empty. | 40 // formats array will be empty. |
|
emircan
2016/07/25 22:56:40
Please update the comment.
chfremer
2016/07/26 16:56:35
Done.
| |
| 39 virtual void GetDeviceSupportedFormats( | 41 virtual void GetDeviceInfo( |
| 40 const VideoCaptureDevice::Name& device, | 42 const VideoCaptureDeviceDescriptor& device_descriptor, |
| 41 VideoCaptureFormats* supported_formats) = 0; | 43 VideoCaptureDeviceInfo* device_info) = 0; |
|
emircan
2016/07/25 22:56:40
VideoCaptureDeviceInfo* const device_info
chfremer
2016/07/26 16:56:35
Discussed offline.
I don't see much value in maki
| |
| 42 | 44 |
| 43 protected: | 45 protected: |
| 44 // Gets the names of all video capture devices connected to this computer. | 46 // Gets descriptors of all video capture devices connected to this computer. |
| 45 // Used by the default implementation of EnumerateDeviceNames(). | 47 // Used by the default implementation of EnumerateDevices(). |
| 46 virtual void GetDeviceNames(VideoCaptureDevice::Names* device_names) = 0; | 48 // Note: The same physical device may appear more than once if it is |
| 49 // accessible through different APIs. | |
| 50 virtual void GetDeviceDescriptors( | |
| 51 VideoCaptureDeviceDescriptors* device_descriptors) = 0; | |
|
emircan
2016/07/25 22:56:40
VideoCaptureDeviceDescriptors* const device_descri
chfremer
2016/07/26 16:56:35
Acknowledged.
| |
| 47 | 52 |
| 48 base::ThreadChecker thread_checker_; | 53 base::ThreadChecker thread_checker_; |
| 49 | 54 |
| 50 private: | 55 private: |
| 51 static VideoCaptureDeviceFactory* CreateVideoCaptureDeviceFactory( | 56 static VideoCaptureDeviceFactory* CreateVideoCaptureDeviceFactory( |
| 52 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); | 57 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); |
| 53 | 58 |
| 54 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceFactory); | 59 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceFactory); |
| 55 }; | 60 }; |
| 56 | 61 |
| 57 } // namespace media | 62 } // namespace media |
| 58 | 63 |
| 59 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_FACTORY_H_ | 64 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_FACTORY_H_ |
| OLD | NEW |