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/capture/video/win/video_capture_device_factory_win.h" | 5 #include "media/capture/video/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 #include <objbase.h> |
9 #include <stddef.h> | 10 #include <stddef.h> |
10 | 11 |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/metrics/histogram_macros.h" | 14 #include "base/metrics/histogram_macros.h" |
14 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
15 #include "base/strings/sys_string_conversions.h" | 16 #include "base/strings/sys_string_conversions.h" |
16 #include "base/win/scoped_co_mem.h" | 17 #include "base/win/scoped_co_mem.h" |
17 #include "base/win/scoped_variant.h" | 18 #include "base/win/scoped_variant.h" |
18 #include "base/win/windows_version.h" | 19 #include "base/win/windows_version.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // CreateClassEnumerator returns S_FALSE on some Windows OS | 164 // CreateClassEnumerator returns S_FALSE on some Windows OS |
164 // when no camera exist. Therefore the FAILED macro can't be used. | 165 // when no camera exist. Therefore the FAILED macro can't be used. |
165 if (hr != S_OK) | 166 if (hr != S_OK) |
166 return; | 167 return; |
167 | 168 |
168 // Enumerate all video capture devices. | 169 // Enumerate all video capture devices. |
169 for (ScopedComPtr<IMoniker> moniker; | 170 for (ScopedComPtr<IMoniker> moniker; |
170 enum_moniker->Next(1, moniker.Receive(), NULL) == S_OK; | 171 enum_moniker->Next(1, moniker.Receive(), NULL) == S_OK; |
171 moniker.Reset()) { | 172 moniker.Reset()) { |
172 ScopedComPtr<IPropertyBag> prop_bag; | 173 ScopedComPtr<IPropertyBag> prop_bag; |
173 hr = moniker->BindToStorage(0, 0, IID_IPropertyBag, prop_bag.ReceiveVoid()); | 174 hr = moniker->BindToStorage(0, 0, IID_PPV_ARGS(&prop_bag)); |
174 if (FAILED(hr)) | 175 if (FAILED(hr)) |
175 continue; | 176 continue; |
176 | 177 |
177 // Find the description or friendly name. | 178 // Find the description or friendly name. |
178 ScopedVariant name; | 179 ScopedVariant name; |
179 hr = prop_bag->Read(L"Description", name.Receive(), 0); | 180 hr = prop_bag->Read(L"Description", name.Receive(), 0); |
180 if (FAILED(hr)) | 181 if (FAILED(hr)) |
181 hr = prop_bag->Read(L"FriendlyName", name.Receive(), 0); | 182 hr = prop_bag->Read(L"FriendlyName", name.Receive(), 0); |
182 | 183 |
183 if (FAILED(hr) || name.type() != VT_BSTR) | 184 if (FAILED(hr) || name.type() != VT_BSTR) |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 } | 461 } |
461 | 462 |
462 // static | 463 // static |
463 VideoCaptureDeviceFactory* | 464 VideoCaptureDeviceFactory* |
464 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( | 465 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( |
465 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 466 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
466 return new VideoCaptureDeviceFactoryWin(); | 467 return new VideoCaptureDeviceFactoryWin(); |
467 } | 468 } |
468 | 469 |
469 } // namespace media | 470 } // namespace media |
OLD | NEW |