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

Unified Diff: media/video/capture/video_capture_device_factory.cc

Issue 265263004: Mac Video Capture Device: split VCD into VCD and Factory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Corrected tests that needed include media_switches.h 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698