Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1090)

Side by Side Diff: media/video/capture/win/video_capture_device_factory_win.cc

Issue 517273004: Win Video Capture: add DirectShow WDM devices capabilities enumeration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 return; 215 return;
216 216
217 ScopedComPtr<IEnumMoniker> enum_moniker; 217 ScopedComPtr<IEnumMoniker> enum_moniker;
218 hr = dev_enum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, 218 hr = dev_enum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory,
219 enum_moniker.Receive(), 0); 219 enum_moniker.Receive(), 0);
220 // CreateClassEnumerator returns S_FALSE on some Windows OS when no camera 220 // CreateClassEnumerator returns S_FALSE on some Windows OS when no camera
221 // exists. Therefore the FAILED macro can't be used. 221 // exists. Therefore the FAILED macro can't be used.
222 if (hr != S_OK) 222 if (hr != S_OK)
223 return; 223 return;
224 224
225 // Walk the capture devices. No need to check for device presence again, that 225 // Walk the capture devices. No need to check for device presence again since
226 // is caught in GetDeviceFilter(). "google camera adapter" and old VFW devices 226 // that is anyway needed in GetDeviceFilter(). "google camera adapter" and old
227 // are already skipped in the previous GetDeviceNames() enumeration. 227 // VFW devices are already skipped previously in GetDeviceNames() enumeration.
228 base::win::ScopedComPtr<IBaseFilter> capture_filter; 228 base::win::ScopedComPtr<IBaseFilter> capture_filter;
229 hr = VideoCaptureDeviceWin::GetDeviceFilter(device, 229 if (device.capture_api_type() == Name::DIRECT_SHOW_WDM) {
230 capture_filter.Receive()); 230 // Find the "normal" DirectShow device corresponding to the WDM device by
231 // comparing USB IDs.
232 // TODO(mcasas): USB ID comparison won't work with PCIe capture cards.
233 Names device_names;
234 GetDeviceNamesDirectShow(&device_names);
235 const std::string current_device_model = device.GetModel();
236 for (Names::const_iterator iter = device_names.begin();
237 iter != device_names.end(); ++iter) {
238 if ((iter->GetModel().compare(current_device_model) == 0) &&
239 (iter->capture_api_type() == Name::DIRECT_SHOW)) {
240 DVLOG(1) << "Enumerating formats for a WDM device.";
241 hr = VideoCaptureDeviceWin::GetDeviceFilter(*iter,
perkj_chrome 2014/09/01 09:57:43 GetDeviceFilter need the correct Name::id. So why
242 capture_filter.Receive());
243 break;
244 }
245 }
246 } else {
247 hr = VideoCaptureDeviceWin::GetDeviceFilter(device,
248 capture_filter.Receive());
249 }
231 if (!capture_filter) { 250 if (!capture_filter) {
232 DVLOG(2) << "Failed to create capture filter."; 251 DVLOG(2) << "Failed to create capture filter.";
233 return; 252 return;
234 } 253 }
235 254
236 base::win::ScopedComPtr<IPin> output_capture_pin( 255 base::win::ScopedComPtr<IPin> output_capture_pin(
237 VideoCaptureDeviceWin::GetPin(capture_filter, 256 VideoCaptureDeviceWin::GetPin(capture_filter,
238 PINDIR_OUTPUT, 257 PINDIR_OUTPUT,
239 PIN_CATEGORY_CAPTURE)); 258 PIN_CATEGORY_CAPTURE));
240 if (!output_capture_pin) { 259 if (!output_capture_pin) {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 const Name& device, 437 const Name& device,
419 VideoCaptureFormats* formats) { 438 VideoCaptureFormats* formats) {
420 DCHECK(thread_checker_.CalledOnValidThread()); 439 DCHECK(thread_checker_.CalledOnValidThread());
421 if (use_media_foundation_) 440 if (use_media_foundation_)
422 GetDeviceSupportedFormatsMediaFoundation(device, formats); 441 GetDeviceSupportedFormatsMediaFoundation(device, formats);
423 else 442 else
424 GetDeviceSupportedFormatsDirectShow(device, formats); 443 GetDeviceSupportedFormatsDirectShow(device, formats);
425 } 444 }
426 445
427 } // namespace media 446 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698