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 #include "media/capture/video/video_capture_device_factory.h" | 5 #include "media/capture/video/video_capture_device_factory.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "media/base/media_switches.h" | 11 #include "media/base/media_switches.h" |
12 #include "media/capture/video/fake_video_capture_device_factory.h" | 12 #include "media/capture/video/fake_video_capture_device_factory.h" |
13 #include "media/capture/video/file_video_capture_device_factory.h" | 13 #include "media/capture/video/file_video_capture_device_factory.h" |
14 | 14 |
15 namespace media { | 15 namespace media { |
16 | 16 |
17 // static | 17 // static |
18 std::unique_ptr<VideoCaptureDeviceFactory> | 18 std::unique_ptr<VideoCaptureDeviceFactory> |
19 VideoCaptureDeviceFactory::CreateFactory( | 19 VideoCaptureDeviceFactory::CreateFactory( |
20 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 20 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
21 const base::CommandLine* command_line = | 21 const base::CommandLine* command_line = |
22 base::CommandLine::ForCurrentProcess(); | 22 base::CommandLine::ForCurrentProcess(); |
23 // Use a Fake or File Video Device Factory if the command line flags are | 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. | 24 // present, otherwise use the normal, platform-dependent, device factory. |
25 if (command_line->HasSwitch(switches::kUseFakeDeviceForMediaStream)) { | 25 if (command_line->HasSwitch(switches::kUseFakeDeviceForMediaStream)) { |
26 if (command_line->HasSwitch(switches::kUseFileForFakeVideoCapture)) { | 26 if (command_line->HasSwitch(switches::kUseFileForFakeVideoCapture)) { |
27 return std::unique_ptr<VideoCaptureDeviceFactory>( | 27 return std::unique_ptr<VideoCaptureDeviceFactory>( |
28 new media::FileVideoCaptureDeviceFactory()); | 28 new media::FileVideoCaptureDeviceFactory()); |
29 } else { | 29 } else { |
30 return std::unique_ptr<VideoCaptureDeviceFactory>( | 30 std::vector<FakeVideoCaptureDeviceSettings> config; |
31 new media::FakeVideoCaptureDeviceFactory()); | 31 FakeVideoCaptureDeviceFactory::ParseFakeDevicesConfigFromOptionsString( |
| 32 command_line->GetSwitchValueASCII( |
| 33 switches::kUseFakeDeviceForMediaStream), |
| 34 &config); |
| 35 auto result = base::MakeUnique<media::FakeVideoCaptureDeviceFactory>(); |
| 36 result->SetToCustomDevicesConfig(config); |
| 37 return std::move(result); |
32 } | 38 } |
33 } else { | 39 } else { |
34 // |ui_task_runner| is needed for the Linux ChromeOS factory to retrieve | 40 // |ui_task_runner| is needed for the Linux ChromeOS factory to retrieve |
35 // screen rotations. | 41 // screen rotations. |
36 return std::unique_ptr<VideoCaptureDeviceFactory>( | 42 return std::unique_ptr<VideoCaptureDeviceFactory>( |
37 CreateVideoCaptureDeviceFactory(ui_task_runner)); | 43 CreateVideoCaptureDeviceFactory(ui_task_runner)); |
38 } | 44 } |
39 } | 45 } |
40 | 46 |
41 VideoCaptureDeviceFactory::VideoCaptureDeviceFactory() { | 47 VideoCaptureDeviceFactory::VideoCaptureDeviceFactory() { |
(...skipping 18 matching lines...) Expand all Loading... |
60 // static | 66 // static |
61 VideoCaptureDeviceFactory* | 67 VideoCaptureDeviceFactory* |
62 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( | 68 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( |
63 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 69 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
64 NOTIMPLEMENTED(); | 70 NOTIMPLEMENTED(); |
65 return NULL; | 71 return NULL; |
66 } | 72 } |
67 #endif | 73 #endif |
68 | 74 |
69 } // namespace media | 75 } // namespace media |
OLD | NEW |