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

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

Issue 2214533002: move //media/capture to //device/capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
(Empty)
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.
4
5 #include "media/capture/video/video_capture_device_factory.h"
6
7 #include <utility>
8
9 #include "base/command_line.h"
10 #include "build/build_config.h"
11 #include "media/base/media_switches.h"
12 #include "media/capture/video/fake_video_capture_device_factory.h"
13 #include "media/capture/video/file_video_capture_device_factory.h"
14
15 namespace media {
16
17 // static
18 std::unique_ptr<VideoCaptureDeviceFactory>
19 VideoCaptureDeviceFactory::CreateFactory(
20 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
21 const base::CommandLine* command_line =
22 base::CommandLine::ForCurrentProcess();
23 // Use a Fake or File Video Device Factory if the command line flags are
24 // present, otherwise use the normal, platform-dependent, device factory.
25 if (command_line->HasSwitch(switches::kUseFakeDeviceForMediaStream)) {
26 if (command_line->HasSwitch(switches::kUseFileForFakeVideoCapture)) {
27 return std::unique_ptr<VideoCaptureDeviceFactory>(
28 new media::FileVideoCaptureDeviceFactory());
29 } else {
30 return std::unique_ptr<VideoCaptureDeviceFactory>(
31 new media::FakeVideoCaptureDeviceFactory());
32 }
33 } else {
34 // |ui_task_runner| is needed for the Linux ChromeOS factory to retrieve
35 // screen rotations.
36 return std::unique_ptr<VideoCaptureDeviceFactory>(
37 CreateVideoCaptureDeviceFactory(ui_task_runner));
38 }
39 }
40
41 VideoCaptureDeviceFactory::VideoCaptureDeviceFactory() {
42 thread_checker_.DetachFromThread();
43 }
44
45 VideoCaptureDeviceFactory::~VideoCaptureDeviceFactory() {}
46
47 void VideoCaptureDeviceFactory::EnumerateDeviceDescriptors(
48 const base::Callback<void(std::unique_ptr<VideoCaptureDeviceDescriptors>)>&
49 callback) {
50 DCHECK(thread_checker_.CalledOnValidThread());
51 DCHECK(!callback.is_null());
52 std::unique_ptr<VideoCaptureDeviceDescriptors> device_descriptors(
53 new VideoCaptureDeviceDescriptors());
54 GetDeviceDescriptors(device_descriptors.get());
55 callback.Run(std::move(device_descriptors));
56 }
57
58 #if !defined(OS_MACOSX) && !defined(OS_LINUX) && !defined(OS_ANDROID) && \
59 !defined(OS_WIN)
60 // static
61 VideoCaptureDeviceFactory*
62 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory(
63 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
64 NOTIMPLEMENTED();
65 return NULL;
66 }
67 #endif
68
69 } // namespace media
OLDNEW
« no previous file with comments | « media/capture/video/video_capture_device_factory.h ('k') | media/capture/video/video_capture_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698