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

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

Issue 294893006: VideoCaptureDeviceFactory: Change device enumeration to callback + QTKit enumerates in UI thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: QTKit/AVFoundation Factory create of inexistent device and associated unit tests Created 6 years, 6 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 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_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_FACTORY_H_ 5 #ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_FACTORY_H_
6 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_FACTORY_H_ 6 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_FACTORY_H_
7 7
8 #include "base/threading/thread_checker.h" 8 #include "base/threading/thread_checker.h"
9 #include "media/video/capture/video_capture_device.h" 9 #include "media/video/capture/video_capture_device.h"
10 10
11 namespace media { 11 namespace media {
12 12
13 // VideoCaptureDeviceFactory is the base class for creation of video capture 13 // VideoCaptureDeviceFactory is the base class for creation of video capture
14 // devices in the different platforms. VCDFs are created by MediaStreamManager 14 // devices in the different platforms. VCDFs are created by MediaStreamManager
15 // on IO thread and plugged into VideoCaptureManager, who owns and operates them 15 // on IO thread and plugged into VideoCaptureManager, who owns and operates them
16 // in Device Thread (a.k.a. Audio Thread). 16 // in Device Thread (a.k.a. Audio Thread).
17 class MEDIA_EXPORT VideoCaptureDeviceFactory { 17 class MEDIA_EXPORT VideoCaptureDeviceFactory {
18 public: 18 public:
19 static scoped_ptr<VideoCaptureDeviceFactory> CreateFactory(); 19 static scoped_ptr<VideoCaptureDeviceFactory> CreateFactory(
20 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner);
20 21
21 VideoCaptureDeviceFactory(); 22 VideoCaptureDeviceFactory();
22 virtual ~VideoCaptureDeviceFactory(); 23 virtual ~VideoCaptureDeviceFactory();
23 24
24 // Creates a VideoCaptureDevice object. Returns NULL if something goes wrong. 25 // Creates a VideoCaptureDevice object. Returns NULL if something goes wrong.
25 virtual scoped_ptr<VideoCaptureDevice> Create( 26 virtual scoped_ptr<VideoCaptureDevice> Create(
26 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 27 const VideoCaptureDevice::Name& device_name) = 0;
27 const VideoCaptureDevice::Name& device_name);
28 28
29 // Gets the names of all video capture devices connected to this computer. 29 // Asynchronous version of GetDeviceNames calling back to |callback|.
30 virtual void GetDeviceNames(VideoCaptureDevice::Names* device_names); 30 virtual void EnumerateDeviceNames(const base::Callback<
31 void(scoped_ptr<media::VideoCaptureDevice::Names>)>& callback);
31 32
32 // Gets the supported formats of a particular device attached to the system. 33 // Gets the supported formats of a particular device attached to the system.
33 // This method should be called before allocating or starting a device. In 34 // This method should be called before allocating or starting a device. In
34 // case format enumeration is not supported, or there was a problem, the 35 // case format enumeration is not supported, or there was a problem, the
35 // formats array will be empty. 36 // formats array will be empty.
36 virtual void GetDeviceSupportedFormats( 37 virtual void GetDeviceSupportedFormats(
37 const VideoCaptureDevice::Name& device, 38 const VideoCaptureDevice::Name& device,
38 VideoCaptureFormats* supported_formats); 39 VideoCaptureFormats* supported_formats) = 0;
39 40
40 protected: 41 protected:
42 // Gets the names of all video capture devices connected to this computer.
43 // Used by the default implementation of EnumerateDeviceNames().
44 virtual void GetDeviceNames(VideoCaptureDevice::Names* device_names) = 0;
45
41 base::ThreadChecker thread_checker_; 46 base::ThreadChecker thread_checker_;
42 47
43 private: 48 private:
44 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceFactory); 49 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceFactory);
45 }; 50 };
46 51
47 } // namespace media 52 } // namespace media
48 53
49 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_FACTORY_H_ 54 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698