Index: media/video/capture/video_capture_device_factory.cc |
diff --git a/media/video/capture/video_capture_device_factory.cc b/media/video/capture/video_capture_device_factory.cc |
index e63225dc178c9ea375bd62f965ccea9440b73f4f..e4ed934faa4b6a3b9152e2dc6fcac9cee6b1a187 100644 |
--- a/media/video/capture/video_capture_device_factory.cc |
+++ b/media/video/capture/video_capture_device_factory.cc |
@@ -4,30 +4,79 @@ |
#include "media/video/capture/video_capture_device_factory.h" |
+#include "base/command_line.h" |
+#include "media/base/media_switches.h" |
+#include "media/video/capture/fake_video_capture_device_factory.h" |
+#include "media/video/capture/file_video_capture_device_factory.h" |
+ |
+#if defined(OS_MACOSX) |
+#include "media/video/capture/mac/video_capture_device_factory_mac.h" |
+#endif |
+ |
namespace media { |
+// static |
+scoped_ptr<VideoCaptureDeviceFactory> |
+ VideoCaptureDeviceFactory::CreateFactory() { |
+ const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
+ // Use a Fake or File Video Device Factory if the command line flags are |
+ // present, otherwise use the normal, platform-dependent, device factory. |
+ if (command_line->HasSwitch(switches::kUseFakeDeviceForMediaStream)) { |
+ if (command_line->HasSwitch(switches::kUseFileForFakeVideoCapture)) { |
+ return scoped_ptr<VideoCaptureDeviceFactory>(new |
+ media::FileVideoCaptureDeviceFactory()); |
+ } else { |
+ return scoped_ptr<VideoCaptureDeviceFactory>(new |
+ media::FakeVideoCaptureDeviceFactory()); |
+ } |
+ } else { |
+#if defined(OS_MACOSX) |
+ return scoped_ptr<VideoCaptureDeviceFactory>(new |
+ VideoCaptureDeviceFactoryMac()); |
+#else |
+ return scoped_ptr<VideoCaptureDeviceFactory>(new |
+ VideoCaptureDeviceFactory()); |
+#endif |
+ } |
+} |
+ |
VideoCaptureDeviceFactory::VideoCaptureDeviceFactory() { |
thread_checker_.DetachFromThread(); |
-}; |
+} |
+ |
+VideoCaptureDeviceFactory::~VideoCaptureDeviceFactory() {} |
scoped_ptr<VideoCaptureDevice> VideoCaptureDeviceFactory::Create( |
const VideoCaptureDevice::Name& device_name) { |
DCHECK(thread_checker_.CalledOnValidThread()); |
+// TODO(mcasas): Remove the #if parts when all platforms have splitted the |
perkj_chrome
2014/05/06 11:32:43
You don't need all these Ifdefs now right? All me
mcasas
2014/05/06 12:47:21
Done.
|
+// VideoCaptureDevice into VideoCaptureDevice and VideoCaptureDeviceFactory. |
+// Remove as well the call to the VideoCaptureDevice static method. |
+#if !defined(OS_MACOSX) |
return scoped_ptr<VideoCaptureDevice>( |
VideoCaptureDevice::Create(device_name)); |
+#else |
+ return scoped_ptr<VideoCaptureDevice>(); |
+#endif |
} |
void VideoCaptureDeviceFactory::GetDeviceNames( |
VideoCaptureDevice::Names* device_names) { |
DCHECK(thread_checker_.CalledOnValidThread()); |
+// See TODO in Create(). |
+#if !defined(OS_MACOSX) |
VideoCaptureDevice::GetDeviceNames(device_names); |
+#endif |
} |
void VideoCaptureDeviceFactory::GetDeviceSupportedFormats( |
const VideoCaptureDevice::Name& device, |
VideoCaptureFormats* supported_formats) { |
DCHECK(thread_checker_.CalledOnValidThread()); |
+// See TODO in Create(). |
+#if !defined(OS_MACOSX) |
VideoCaptureDevice::GetDeviceSupportedFormats(device, supported_formats); |
+#endif |
} |
} // namespace media |