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

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

Issue 276383002: VideoCaptureDeviceWin: Extract class-static method into a Factory (both MF/DS) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tommi@s comments. Created 6 years, 7 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 #include "media/video/capture/video_capture_device_factory.h" 5 #include "media/video/capture/video_capture_device_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "media/base/media_switches.h" 8 #include "media/base/media_switches.h"
9 #include "media/video/capture/fake_video_capture_device_factory.h" 9 #include "media/video/capture/fake_video_capture_device_factory.h"
10 #include "media/video/capture/file_video_capture_device_factory.h" 10 #include "media/video/capture/file_video_capture_device_factory.h"
11 11
12 #if defined(OS_MACOSX) 12 #if defined(OS_MACOSX)
13 #include "media/video/capture/mac/video_capture_device_factory_mac.h" 13 #include "media/video/capture/mac/video_capture_device_factory_mac.h"
14 #elif defined(OS_WIN)
15 #include "media/video/capture/win/video_capture_device_factory_win.h"
14 #endif 16 #endif
15 17
16 namespace media { 18 namespace media {
17 19
18 // static 20 // static
19 scoped_ptr<VideoCaptureDeviceFactory> 21 scoped_ptr<VideoCaptureDeviceFactory>
20 VideoCaptureDeviceFactory::CreateFactory() { 22 VideoCaptureDeviceFactory::CreateFactory() {
21 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 23 const CommandLine* command_line = CommandLine::ForCurrentProcess();
22 // Use a Fake or File Video Device Factory if the command line flags are 24 // Use a Fake or File Video Device Factory if the command line flags are
23 // present, otherwise use the normal, platform-dependent, device factory. 25 // present, otherwise use the normal, platform-dependent, device factory.
24 if (command_line->HasSwitch(switches::kUseFakeDeviceForMediaStream)) { 26 if (command_line->HasSwitch(switches::kUseFakeDeviceForMediaStream)) {
25 if (command_line->HasSwitch(switches::kUseFileForFakeVideoCapture)) { 27 if (command_line->HasSwitch(switches::kUseFileForFakeVideoCapture)) {
26 return scoped_ptr<VideoCaptureDeviceFactory>(new 28 return scoped_ptr<VideoCaptureDeviceFactory>(new
27 media::FileVideoCaptureDeviceFactory()); 29 media::FileVideoCaptureDeviceFactory());
28 } else { 30 } else {
29 return scoped_ptr<VideoCaptureDeviceFactory>(new 31 return scoped_ptr<VideoCaptureDeviceFactory>(new
30 media::FakeVideoCaptureDeviceFactory()); 32 media::FakeVideoCaptureDeviceFactory());
31 } 33 }
32 } else { 34 } else {
33 #if defined(OS_MACOSX) 35 #if defined(OS_MACOSX)
34 return scoped_ptr<VideoCaptureDeviceFactory>(new 36 return scoped_ptr<VideoCaptureDeviceFactory>(new
35 VideoCaptureDeviceFactoryMac()); 37 VideoCaptureDeviceFactoryMac());
38 #elif defined(OS_WIN)
39 return scoped_ptr<VideoCaptureDeviceFactory>(new
40 VideoCaptureDeviceFactoryWin());
36 #else 41 #else
37 return scoped_ptr<VideoCaptureDeviceFactory>(new 42 return scoped_ptr<VideoCaptureDeviceFactory>(new
38 VideoCaptureDeviceFactory()); 43 VideoCaptureDeviceFactory());
39 #endif 44 #endif
40 } 45 }
41 } 46 }
42 47
43 VideoCaptureDeviceFactory::VideoCaptureDeviceFactory() { 48 VideoCaptureDeviceFactory::VideoCaptureDeviceFactory() {
44 thread_checker_.DetachFromThread(); 49 thread_checker_.DetachFromThread();
45 } 50 }
(...skipping 14 matching lines...) Expand all
60 } 65 }
61 66
62 void VideoCaptureDeviceFactory::GetDeviceSupportedFormats( 67 void VideoCaptureDeviceFactory::GetDeviceSupportedFormats(
63 const VideoCaptureDevice::Name& device, 68 const VideoCaptureDevice::Name& device,
64 VideoCaptureFormats* supported_formats) { 69 VideoCaptureFormats* supported_formats) {
65 DCHECK(thread_checker_.CalledOnValidThread()); 70 DCHECK(thread_checker_.CalledOnValidThread());
66 VideoCaptureDevice::GetDeviceSupportedFormats(device, supported_formats); 71 VideoCaptureDevice::GetDeviceSupportedFormats(device, supported_formats);
67 } 72 }
68 73
69 } // namespace media 74 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698