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

Unified Diff: media/video/capture/win/video_capture_device_win.cc

Issue 17402002: Reconnect support for DirectShow video capture devices in parallel to MediaFoundation ones. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added check for Windows version in unittests, Capture Driver Api is DS if Windows version < 7 Created 7 years, 5 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 | « media/video/capture/win/video_capture_device_mf_win.cc ('k') | 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_win.cc
diff --git a/media/video/capture/win/video_capture_device_win.cc b/media/video/capture/win/video_capture_device_win.cc
index 2066066771728801fa36276be04f7925a2974cb2..32ac70c99e8894ce286f65e5360a30dd6a64cd96 100644
--- a/media/video/capture/win/video_capture_device_win.cc
+++ b/media/video/capture/win/video_capture_device_win.cc
@@ -148,26 +148,40 @@ void DeleteMediaType(AM_MEDIA_TYPE* mt) {
// static
void VideoCaptureDevice::GetDeviceNames(Names* device_names) {
+ Names::iterator it;
+
if (VideoCaptureDeviceMFWin::PlatformSupported()) {
VideoCaptureDeviceMFWin::GetDeviceNames(device_names);
- } else {
- VideoCaptureDeviceWin::GetDeviceNames(device_names);
}
+ // Retrieve the devices with DirectShow (DS) interface. They might (partially)
+ // overlap with the MediaFoundation (MF), so the list has to be consolidated.
+ Names temp_names;
+ VideoCaptureDeviceWin::GetDeviceNames(&temp_names);
+
+ // Merge the DS devices into the MF device list, and next remove
+ // the duplicates, giving priority to the MF "versions".
+ device_names->merge(temp_names);
+ device_names->unique();
}
// static
VideoCaptureDevice* VideoCaptureDevice::Create(const Name& device_name) {
VideoCaptureDevice* ret = NULL;
- if (VideoCaptureDeviceMFWin::PlatformSupported()) {
+ if (device_name.capture_api_type() == Name::MEDIA_FOUNDATION) {
+ DCHECK(VideoCaptureDeviceMFWin::PlatformSupported());
scoped_ptr<VideoCaptureDeviceMFWin> device(
new VideoCaptureDeviceMFWin(device_name));
+ DVLOG(1) << " MediaFoundation Device: " << device_name.name();
if (device->Init())
ret = device.release();
- } else {
+ } else if (device_name.capture_api_type() == Name::DIRECT_SHOW) {
scoped_ptr<VideoCaptureDeviceWin> device(
new VideoCaptureDeviceWin(device_name));
+ DVLOG(1) << " DirectShow Device: " << device_name.name();
if (device->Init())
ret = device.release();
+ } else{
+ NOTREACHED() << " Couldn't recognize VideoCaptureDevice type";
}
return ret;
@@ -236,7 +250,7 @@ void VideoCaptureDeviceWin::GetDeviceNames(Names* device_names) {
id = base::SysWideToUTF8(V_BSTR(&name));
}
- device_names->push_back(Name(device_name, id));
+ device_names->push_back(Name(device_name, id, Name::DIRECT_SHOW));
}
}
moniker.Release();
@@ -575,10 +589,14 @@ bool VideoCaptureDeviceWin::CreateCapabilityMap() {
capability.color = VideoCaptureCapability::kYUY2;
} else if (media_type->subtype == MEDIASUBTYPE_MJPG) {
capability.color = VideoCaptureCapability::kMJPEG;
+ } else if (media_type->subtype == MEDIASUBTYPE_UYVY) {
+ capability.color = VideoCaptureCapability::kUYVY;
+ } else if (media_type->subtype == MEDIASUBTYPE_ARGB32) {
+ capability.color = VideoCaptureCapability::kARGB;
} else {
WCHAR guid_str[128];
StringFromGUID2(media_type->subtype, guid_str, arraysize(guid_str));
- DVLOG(2) << "Device support unknown media type " << guid_str;
+ DVLOG(2) << "Device supports (also) an unknown media type " << guid_str;
continue;
}
capabilities_.Add(capability);
@@ -596,5 +614,4 @@ void VideoCaptureDeviceWin::SetErrorState(const char* reason) {
state_ = kError;
observer_->OnError();
}
-
} // namespace media
« no previous file with comments | « media/video/capture/win/video_capture_device_mf_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698