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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 static bool EnumerateVideoDevicesMediaFoundation(IMFActivate*** devices, | 107 static bool EnumerateVideoDevicesMediaFoundation(IMFActivate*** devices, |
108 UINT32* count) { | 108 UINT32* count) { |
109 ScopedComPtr<IMFAttributes> attributes; | 109 ScopedComPtr<IMFAttributes> attributes; |
110 if (!PrepareVideoCaptureAttributesMediaFoundation(attributes.Receive(), 1)) | 110 if (!PrepareVideoCaptureAttributesMediaFoundation(attributes.Receive(), 1)) |
111 return false; | 111 return false; |
112 | 112 |
113 return SUCCEEDED(MFEnumDeviceSources(attributes, devices, count)); | 113 return SUCCEEDED(MFEnumDeviceSources(attributes, devices, count)); |
114 } | 114 } |
115 | 115 |
116 static bool IsDeviceBlackListed(const std::string& name) { | 116 static bool IsDeviceBlackListed(const std::string& name) { |
117 DCHECK_EQ(BLACKLISTED_CAMERA_MAX, | 117 DCHECK_EQ(BLACKLISTED_CAMERA_MAX + 1, |
118 static_cast<int>(arraysize(kBlacklistedCameraNames))); | 118 static_cast<int>(arraysize(kBlacklistedCameraNames))); |
119 for (size_t i = 0; i < arraysize(kBlacklistedCameraNames); ++i) { | 119 for (size_t i = 0; i < arraysize(kBlacklistedCameraNames); ++i) { |
120 if (StartsWithASCII(name, kBlacklistedCameraNames[i], false)) { | 120 if (StartsWithASCII(name, kBlacklistedCameraNames[i], false)) { |
121 DVLOG(1) << "Enumerated blacklisted device: " << name; | 121 DVLOG(1) << "Enumerated blacklisted device: " << name; |
122 UMA_HISTOGRAM_ENUMERATION("Media.VideoCapture.BlacklistedDevice", | 122 UMA_HISTOGRAM_ENUMERATION("Media.VideoCapture.BlacklistedDevice", |
123 i, BLACKLISTED_CAMERA_MAX + 1); | 123 i, BLACKLISTED_CAMERA_MAX + 1); |
124 return true; | 124 return true; |
125 } | 125 } |
126 } | 126 } |
127 return false; | 127 return false; |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 const Name& device, | 453 const Name& device, |
454 VideoCaptureFormats* formats) { | 454 VideoCaptureFormats* formats) { |
455 DCHECK(thread_checker_.CalledOnValidThread()); | 455 DCHECK(thread_checker_.CalledOnValidThread()); |
456 if (use_media_foundation_) | 456 if (use_media_foundation_) |
457 GetDeviceSupportedFormatsMediaFoundation(device, formats); | 457 GetDeviceSupportedFormatsMediaFoundation(device, formats); |
458 else | 458 else |
459 GetDeviceSupportedFormatsDirectShow(device, formats); | 459 GetDeviceSupportedFormatsDirectShow(device, formats); |
460 } | 460 } |
461 | 461 |
462 } // namespace media | 462 } // namespace media |
OLD | NEW |