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

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

Issue 2805863002: Remove VideoCaptureDeviceFactory::EnumerateDeviceDescriptors() (Closed)
Patch Set: Rebase Created 3 years, 8 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 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 11
12 namespace media { 12 namespace media {
13 13
14 // VideoCaptureDeviceFactory is the base class for creation of video capture 14 // VideoCaptureDeviceFactory is the base class for creation of video capture
15 // devices in the different platforms. VCDFs are created by MediaStreamManager 15 // devices in the different platforms. VCDFs are created by MediaStreamManager
16 // on IO thread and plugged into VideoCaptureManager, who owns and operates them 16 // on IO thread and plugged into VideoCaptureManager, who owns and operates them
17 // in Device Thread (a.k.a. Audio Thread). 17 // in Device Thread (a.k.a. Audio Thread).
18 // Typical operation is to first call EnumerateDeviceDescriptors() to obtain 18 // Typical operation is to first call GetDeviceDescriptors() to obtain
19 // information about available devices. The obtained descriptors can then be 19 // information about available devices. The obtained descriptors can then be
20 // used to either obtain the supported formats of a device using 20 // used to either obtain the supported formats of a device using
21 // GetSupportedFormats(), or to create an instance of VideoCaptureDevice for 21 // GetSupportedFormats(), or to create an instance of VideoCaptureDevice for
22 // the device using CreateDevice(). 22 // the device using CreateDevice().
23 // TODO(chfremer): Add a layer on top of the platform-specific implementations 23 // TODO(chfremer): Add a layer on top of the platform-specific implementations
24 // that uses strings instead of descriptors as keys for accessing devices. 24 // that uses strings instead of descriptors as keys for accessing devices.
25 // crbug.com/665065 25 // crbug.com/665065
26 class CAPTURE_EXPORT VideoCaptureDeviceFactory { 26 class CAPTURE_EXPORT VideoCaptureDeviceFactory {
27 public: 27 public:
28 static std::unique_ptr<VideoCaptureDeviceFactory> CreateFactory( 28 static std::unique_ptr<VideoCaptureDeviceFactory> CreateFactory(
29 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); 29 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner);
30 30
31 VideoCaptureDeviceFactory(); 31 VideoCaptureDeviceFactory();
32 virtual ~VideoCaptureDeviceFactory(); 32 virtual ~VideoCaptureDeviceFactory();
33 33
34 // Creates a VideoCaptureDevice object. Returns NULL if something goes wrong. 34 // Creates a VideoCaptureDevice object. Returns NULL if something goes wrong.
35 virtual std::unique_ptr<VideoCaptureDevice> CreateDevice( 35 virtual std::unique_ptr<VideoCaptureDevice> CreateDevice(
36 const VideoCaptureDeviceDescriptor& device_descriptor) = 0; 36 const VideoCaptureDeviceDescriptor& device_descriptor) = 0;
37 37
38 // Asynchronous version of GetDeviceDescriptors calling back to |callback|.
39 // TODO(chfremer): Consider removing this if none of the implementations
40 // overrides it. See crbug.com/708233.
41 virtual void EnumerateDeviceDescriptors(
42 const base::Callback<
43 void(std::unique_ptr<VideoCaptureDeviceDescriptors>)>& callback);
44
45 // Obtains the supported formats of a device. 38 // Obtains the supported formats of a device.
46 // This method should be called before allocating or starting a device. In 39 // This method should be called before allocating or starting a device. In
47 // case format enumeration is not supported, or there was a problem 40 // case format enumeration is not supported, or there was a problem
48 // |supported_formats| will be empty. 41 // |supported_formats| will be empty.
49 virtual void GetSupportedFormats( 42 virtual void GetSupportedFormats(
50 const VideoCaptureDeviceDescriptor& device_descriptor, 43 const VideoCaptureDeviceDescriptor& device_descriptor,
51 VideoCaptureFormats* supported_formats) = 0; 44 VideoCaptureFormats* supported_formats) = 0;
52 45
53 // Gets descriptors of all video capture devices connected. 46 // Gets descriptors of all video capture devices connected.
54 // Used by the default implementation of EnumerateDevices(). 47 // Used by the default implementation of EnumerateDevices().
55 // Note: The same physical device may appear more than once if it is 48 // Note: The same physical device may appear more than once if it is
56 // accessible through different APIs. 49 // accessible through different APIs.
57 virtual void GetDeviceDescriptors( 50 virtual void GetDeviceDescriptors(
58 VideoCaptureDeviceDescriptors* device_descriptors) = 0; 51 VideoCaptureDeviceDescriptors* device_descriptors) = 0;
59 52
60 protected: 53 protected:
61 base::ThreadChecker thread_checker_; 54 base::ThreadChecker thread_checker_;
62 55
63 private: 56 private:
64 static VideoCaptureDeviceFactory* CreateVideoCaptureDeviceFactory( 57 static VideoCaptureDeviceFactory* CreateVideoCaptureDeviceFactory(
65 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); 58 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner);
66 59
67 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceFactory); 60 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceFactory);
68 }; 61 };
69 62
70 } // namespace media 63 } // namespace media
71 64
72 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_FACTORY_H_ 65 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_FACTORY_H_
OLDNEW
« no previous file with comments | « media/capture/video/video_capture_device_descriptor.h ('k') | media/capture/video/video_capture_device_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698