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/video/capture/win/video_capture_device_factory_win.h" | 5 #include "media/video/capture/win/video_capture_device_factory_win.h" |
6 | 6 |
7 #include <mfapi.h> | 7 #include <mfapi.h> |
8 #include <mferror.h> | 8 #include <mferror.h> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 376 |
377 static bool g_dlls_available = LoadMediaFoundationDlls(); | 377 static bool g_dlls_available = LoadMediaFoundationDlls(); |
378 return g_dlls_available; | 378 return g_dlls_available; |
379 } | 379 } |
380 | 380 |
381 VideoCaptureDeviceFactoryWin::VideoCaptureDeviceFactoryWin() { | 381 VideoCaptureDeviceFactoryWin::VideoCaptureDeviceFactoryWin() { |
382 // Use Media Foundation for Metro processes (after and including Win8) and | 382 // Use Media Foundation for Metro processes (after and including Win8) and |
383 // DirectShow for any other versions, unless forced via flag. Media Foundation | 383 // DirectShow for any other versions, unless forced via flag. Media Foundation |
384 // can also be forced if appropriate flag is set and we are in Windows 7 or | 384 // can also be forced if appropriate flag is set and we are in Windows 7 or |
385 // 8 in non-Metro mode. | 385 // 8 in non-Metro mode. |
386 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 386 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
387 use_media_foundation_ = (base::win::IsMetroProcess() && | 387 use_media_foundation_ = (base::win::IsMetroProcess() && |
388 !cmd_line->HasSwitch(switches::kForceDirectShowVideoCapture)) || | 388 !cmd_line->HasSwitch(switches::kForceDirectShowVideoCapture)) || |
389 (base::win::GetVersion() >= base::win::VERSION_WIN7 && | 389 (base::win::GetVersion() >= base::win::VERSION_WIN7 && |
390 cmd_line->HasSwitch(switches::kForceMediaFoundationVideoCapture)); | 390 cmd_line->HasSwitch(switches::kForceMediaFoundationVideoCapture)); |
391 } | 391 } |
392 | 392 |
393 | 393 |
394 scoped_ptr<VideoCaptureDevice> VideoCaptureDeviceFactoryWin::Create( | 394 scoped_ptr<VideoCaptureDevice> VideoCaptureDeviceFactoryWin::Create( |
395 const Name& device_name) { | 395 const Name& device_name) { |
396 DCHECK(thread_checker_.CalledOnValidThread()); | 396 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 } | 459 } |
460 | 460 |
461 // static | 461 // static |
462 VideoCaptureDeviceFactory* | 462 VideoCaptureDeviceFactory* |
463 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( | 463 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( |
464 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 464 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
465 return new VideoCaptureDeviceFactoryWin(); | 465 return new VideoCaptureDeviceFactoryWin(); |
466 } | 466 } |
467 | 467 |
468 } // namespace media | 468 } // namespace media |
OLD | NEW |