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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 if (SUCCEEDED(hr) && name.type() == VT_BSTR) { | 132 if (SUCCEEDED(hr) && name.type() == VT_BSTR) { |
133 // Ignore all VFW drivers and the special Google Camera Adapter. | 133 // Ignore all VFW drivers and the special Google Camera Adapter. |
134 // Google Camera Adapter is not a real DirectShow camera device. | 134 // Google Camera Adapter is not a real DirectShow camera device. |
135 // VFW are very old Video for Windows drivers that can not be used. | 135 // VFW are very old Video for Windows drivers that can not be used. |
136 const wchar_t* str_ptr = V_BSTR(&name); | 136 const wchar_t* str_ptr = V_BSTR(&name); |
137 const int name_length = arraysize(kGoogleCameraAdapter) - 1; | 137 const int name_length = arraysize(kGoogleCameraAdapter) - 1; |
138 | 138 |
139 if ((wcsstr(str_ptr, L"(VFW)") == NULL) && | 139 if ((wcsstr(str_ptr, L"(VFW)") == NULL) && |
140 lstrlenW(str_ptr) < name_length || | 140 lstrlenW(str_ptr) < name_length || |
141 (!(LowerCaseEqualsASCII(str_ptr, str_ptr + name_length, | 141 (!(base::LowerCaseEqualsASCII(str_ptr, str_ptr + name_length, |
142 kGoogleCameraAdapter)))) { | 142 kGoogleCameraAdapter)))) { |
143 std::string id; | 143 std::string id; |
144 std::string device_name(base::SysWideToUTF8(str_ptr)); | 144 std::string device_name(base::SysWideToUTF8(str_ptr)); |
145 name.Reset(); | 145 name.Reset(); |
146 hr = prop_bag->Read(L"DevicePath", name.Receive(), 0); | 146 hr = prop_bag->Read(L"DevicePath", name.Receive(), 0); |
147 if (FAILED(hr) || name.type() != VT_BSTR) { | 147 if (FAILED(hr) || name.type() != VT_BSTR) { |
148 id = device_name; | 148 id = device_name; |
149 } else { | 149 } else { |
150 DCHECK_EQ(name.type(), VT_BSTR); | 150 DCHECK_EQ(name.type(), VT_BSTR); |
151 id = base::SysWideToUTF8(V_BSTR(&name)); | 151 id = base::SysWideToUTF8(V_BSTR(&name)); |
152 } | 152 } |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 const VideoCaptureDevice::Name& device, | 410 const VideoCaptureDevice::Name& device, |
411 VideoCaptureFormats* formats) { | 411 VideoCaptureFormats* formats) { |
412 DCHECK(thread_checker_.CalledOnValidThread()); | 412 DCHECK(thread_checker_.CalledOnValidThread()); |
413 if (use_media_foundation_) | 413 if (use_media_foundation_) |
414 GetDeviceSupportedFormatsMediaFoundation(device, formats); | 414 GetDeviceSupportedFormatsMediaFoundation(device, formats); |
415 else | 415 else |
416 GetDeviceSupportedFormatsDirectShow(device, formats); | 416 GetDeviceSupportedFormatsDirectShow(device, formats); |
417 } | 417 } |
418 | 418 |
419 } // namespace media | 419 } // namespace media |
OLD | NEW |