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..8920b4a640bf171990920bc2f6de288225335892 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 Audio Device and Fake/File Video Device Factory if the command |
+ // line flags are present, otherwise use a normal device factory. |
mcasas
2014/05/06 12:47:21
Rewrite part on "Fake Audio Device".
|
+ 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 |
+// 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 |