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
3 // found in the LICENSE file.
5 #ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_FACTORY_H_
6 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_FACTORY_H_
8 #include "base/threading/thread_checker.h"
9 #include "media/capture/video/video_capture_device.h"
13 // VideoCaptureDeviceFactory is the base class for creation of video capture
14 // devices in the different platforms. VCDFs are created by MediaStreamManager
15 // on IO thread and plugged into VideoCaptureManager, who owns and operates them
16 // in Device Thread (a.k.a. Audio Thread).
17 class MEDIA_EXPORT VideoCaptureDeviceFactory
{
19 static scoped_ptr
<VideoCaptureDeviceFactory
> CreateFactory(
20 scoped_refptr
<base::SingleThreadTaskRunner
> ui_task_runner
);
22 VideoCaptureDeviceFactory();
23 virtual ~VideoCaptureDeviceFactory();
25 // Creates a VideoCaptureDevice object. Returns NULL if something goes wrong.
26 virtual scoped_ptr
<VideoCaptureDevice
> Create(
27 const VideoCaptureDevice::Name
& device_name
) = 0;
29 // Asynchronous version of GetDeviceNames calling back to |callback|.
30 virtual void EnumerateDeviceNames(const base::Callback
<
31 void(scoped_ptr
<media::VideoCaptureDevice::Names
>)>& callback
);
33 // Gets the supported formats of a particular device attached to the system.
34 // This method should be called before allocating or starting a device. In
35 // case format enumeration is not supported, or there was a problem, the
36 // formats array will be empty.
37 virtual void GetDeviceSupportedFormats(
38 const VideoCaptureDevice::Name
& device
,
39 VideoCaptureFormats
* supported_formats
) = 0;
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;
46 base::ThreadChecker thread_checker_
;
49 static VideoCaptureDeviceFactory
* CreateVideoCaptureDeviceFactory(
50 scoped_refptr
<base::SingleThreadTaskRunner
> ui_task_runner
);
52 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceFactory
);
57 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_FACTORY_H_