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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 // Find the description or friendly name. | 159 // Find the description or friendly name. |
160 ScopedVariant name; | 160 ScopedVariant name; |
161 hr = prop_bag->Read(L"Description", name.Receive(), 0); | 161 hr = prop_bag->Read(L"Description", name.Receive(), 0); |
162 if (FAILED(hr)) | 162 if (FAILED(hr)) |
163 hr = prop_bag->Read(L"FriendlyName", name.Receive(), 0); | 163 hr = prop_bag->Read(L"FriendlyName", name.Receive(), 0); |
164 | 164 |
165 if (FAILED(hr) || name.type() != VT_BSTR) | 165 if (FAILED(hr) || name.type() != VT_BSTR) |
166 continue; | 166 continue; |
167 | 167 |
168 const std::string device_name(base::SysWideToUTF8(V_BSTR(&name))); | 168 const std::string device_name(base::SysWideToUTF8(V_BSTR(name.ptr()))); |
169 if (IsDeviceBlackListed(device_name)) | 169 if (IsDeviceBlackListed(device_name)) |
170 continue; | 170 continue; |
171 | 171 |
172 name.Reset(); | 172 name.Reset(); |
173 hr = prop_bag->Read(L"DevicePath", name.Receive(), 0); | 173 hr = prop_bag->Read(L"DevicePath", name.Receive(), 0); |
174 std::string id; | 174 std::string id; |
175 if (FAILED(hr) || name.type() != VT_BSTR) { | 175 if (FAILED(hr) || name.type() != VT_BSTR) { |
176 id = device_name; | 176 id = device_name; |
177 } else { | 177 } else { |
178 DCHECK_EQ(name.type(), VT_BSTR); | 178 DCHECK_EQ(name.type(), VT_BSTR); |
179 id = base::SysWideToUTF8(V_BSTR(&name)); | 179 id = base::SysWideToUTF8(V_BSTR(name.ptr())); |
180 } | 180 } |
181 device_names->push_back(Name(device_name, id, capture_api_type)); | 181 device_names->push_back(Name(device_name, id, capture_api_type)); |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
185 static void GetDeviceNamesMediaFoundation(Names* device_names) { | 185 static void GetDeviceNamesMediaFoundation(Names* device_names) { |
186 DVLOG(1) << " GetDeviceNamesMediaFoundation"; | 186 DVLOG(1) << " GetDeviceNamesMediaFoundation"; |
187 ScopedCoMem<IMFActivate*> devices; | 187 ScopedCoMem<IMFActivate*> devices; |
188 UINT32 count; | 188 UINT32 count; |
189 if (!EnumerateVideoDevicesMediaFoundation(&devices, &count)) | 189 if (!EnumerateVideoDevicesMediaFoundation(&devices, &count)) |
(...skipping 269 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 |