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

Unified 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, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/video/capture/win/video_capture_device_factory_win.cc
diff --git a/media/video/capture/win/video_capture_device_factory_win.cc b/media/video/capture/win/video_capture_device_factory_win.cc
index ad2922bd94ea48cdd1d2cbc7be1734daa755a48f..7bd6b2907c54c8eba948917daa288eb143074190 100644
--- a/media/video/capture/win/video_capture_device_factory_win.cc
+++ b/media/video/capture/win/video_capture_device_factory_win.cc
@@ -222,12 +222,31 @@ static void GetDeviceSupportedFormatsDirectShow(const Name& device,
if (hr != S_OK)
return;
- // Walk the capture devices. No need to check for device presence again, that
- // is caught in GetDeviceFilter(). "google camera adapter" and old VFW devices
- // are already skipped in the previous GetDeviceNames() enumeration.
+ // Walk the capture devices. No need to check for device presence again since
+ // that is anyway needed in GetDeviceFilter(). "google camera adapter" and old
+ // VFW devices are already skipped previously in GetDeviceNames() enumeration.
base::win::ScopedComPtr<IBaseFilter> capture_filter;
- hr = VideoCaptureDeviceWin::GetDeviceFilter(device,
- capture_filter.Receive());
+ if (device.capture_api_type() == Name::DIRECT_SHOW_WDM) {
+ // Find the "normal" DirectShow device corresponding to the WDM device by
+ // comparing USB IDs.
+ // TODO(mcasas): USB ID comparison won't work with PCIe capture cards.
+ Names device_names;
+ GetDeviceNamesDirectShow(&device_names);
+ const std::string current_device_model = device.GetModel();
+ for (Names::const_iterator iter = device_names.begin();
+ iter != device_names.end(); ++iter) {
+ if ((iter->GetModel().compare(current_device_model) == 0) &&
+ (iter->capture_api_type() == Name::DIRECT_SHOW)) {
+ DVLOG(1) << "Enumerating formats for a WDM device.";
+ hr = VideoCaptureDeviceWin::GetDeviceFilter(*iter,
perkj_chrome 2014/09/01 09:57:43 GetDeviceFilter need the correct Name::id. So why
+ capture_filter.Receive());
+ break;
+ }
+ }
+ } else {
+ hr = VideoCaptureDeviceWin::GetDeviceFilter(device,
+ capture_filter.Receive());
+ }
if (!capture_filter) {
DVLOG(2) << "Failed to create capture filter.";
return;
« 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