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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 // 8 in non-Metro mode. | 380 // 8 in non-Metro mode. |
381 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 381 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
382 use_media_foundation_ = (base::win::IsMetroProcess() && | 382 use_media_foundation_ = (base::win::IsMetroProcess() && |
383 !cmd_line->HasSwitch(switches::kForceDirectShowVideoCapture)) || | 383 !cmd_line->HasSwitch(switches::kForceDirectShowVideoCapture)) || |
384 (base::win::GetVersion() >= base::win::VERSION_WIN7 && | 384 (base::win::GetVersion() >= base::win::VERSION_WIN7 && |
385 cmd_line->HasSwitch(switches::kForceMediaFoundationVideoCapture)); | 385 cmd_line->HasSwitch(switches::kForceMediaFoundationVideoCapture)); |
386 } | 386 } |
387 | 387 |
388 | 388 |
389 scoped_ptr<VideoCaptureDevice> VideoCaptureDeviceFactoryWin::Create( | 389 scoped_ptr<VideoCaptureDevice> VideoCaptureDeviceFactoryWin::Create( |
390 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | |
391 const VideoCaptureDevice::Name& device_name) { | 390 const VideoCaptureDevice::Name& device_name) { |
392 DCHECK(thread_checker_.CalledOnValidThread()); | 391 DCHECK(thread_checker_.CalledOnValidThread()); |
393 scoped_ptr<VideoCaptureDevice> device; | 392 scoped_ptr<VideoCaptureDevice> device; |
394 if (device_name.capture_api_type() == | 393 if (device_name.capture_api_type() == |
395 VideoCaptureDevice::Name::MEDIA_FOUNDATION) { | 394 VideoCaptureDevice::Name::MEDIA_FOUNDATION) { |
396 DCHECK(PlatformSupportsMediaFoundation()); | 395 DCHECK(PlatformSupportsMediaFoundation()); |
397 device.reset(new VideoCaptureDeviceMFWin(device_name)); | 396 device.reset(new VideoCaptureDeviceMFWin(device_name)); |
398 DVLOG(1) << " MediaFoundation Device: " << device_name.name(); | 397 DVLOG(1) << " MediaFoundation Device: " << device_name.name(); |
399 ScopedComPtr<IMFMediaSource> source; | 398 ScopedComPtr<IMFMediaSource> source; |
400 if (!CreateVideoCaptureDeviceMediaFoundation(device_name.id().c_str(), | 399 if (!CreateVideoCaptureDeviceMediaFoundation(device_name.id().c_str(), |
(...skipping 27 matching lines...) Expand all Loading... |
428 const VideoCaptureDevice::Name& device, | 427 const VideoCaptureDevice::Name& device, |
429 VideoCaptureFormats* formats) { | 428 VideoCaptureFormats* formats) { |
430 DCHECK(thread_checker_.CalledOnValidThread()); | 429 DCHECK(thread_checker_.CalledOnValidThread()); |
431 if (use_media_foundation_) | 430 if (use_media_foundation_) |
432 GetDeviceSupportedFormatsMediaFoundation(device, formats); | 431 GetDeviceSupportedFormatsMediaFoundation(device, formats); |
433 else | 432 else |
434 GetDeviceSupportedFormatsDirectShow(device, formats); | 433 GetDeviceSupportedFormatsDirectShow(device, formats); |
435 } | 434 } |
436 | 435 |
437 } // namespace media | 436 } // namespace media |
OLD | NEW |