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

Unified Diff: media/video/capture/mac/video_capture_device_factory_mac.mm

Issue 468833002: Mac QTKit Video Capture: Force BlackMagic cameras to be opened in HD (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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
Index: media/video/capture/mac/video_capture_device_factory_mac.mm
diff --git a/media/video/capture/mac/video_capture_device_factory_mac.mm b/media/video/capture/mac/video_capture_device_factory_mac.mm
index af97fd21e03cfeea3b2fdfaa5b5bd52b9ff3b874..0fc3c65ebf813191e3b9d81c137e05633d8f9db2 100644
--- a/media/video/capture/mac/video_capture_device_factory_mac.mm
+++ b/media/video/capture/mac/video_capture_device_factory_mac.mm
@@ -25,6 +25,9 @@ const struct NameAndVid {
const char* name;
} kBlacklistedCameras[] = { { "-01FDA82C8A9C", "Blackmagic" } };
+const gfx::Size kBlackmagicQTKitCaptureResolution = gfx::Size(1280, 720);
tommi (sloooow) - chröme 2014/08/13 12:42:28 is this a global that requires construction? (if s
mcasas 2014/08/13 14:04:52 Done.
+const float kBlackmagicQTKitCaptureFrameRate = 60.0f;
tommi (sloooow) - chröme 2014/08/13 12:42:28 These two constants seem specific to blackmagic ca
mcasas 2014/08/13 14:04:52 Done.
+
static scoped_ptr<media::VideoCaptureDevice::Names>
EnumerateDevicesUsingQTKit() {
scoped_ptr<VideoCaptureDevice::Names> device_names(
@@ -36,6 +39,13 @@ EnumerateDevicesUsingQTKit() {
VideoCaptureDevice::Name name(
[[[capture_devices valueForKey:key] deviceName] UTF8String],
[key UTF8String], VideoCaptureDevice::Name::QTKIT);
+ for (size_t i = 0; i < arraysize(kBlacklistedCameras); ++i) {
+ if (name.id().find(kBlacklistedCameras[i].name) != std::string::npos) {
+ DVLOG(2) << "Found blacklisted camera: " << name.id();
+ name.set_is_blacklisted(true);
+ break;
+ }
+ }
device_names->push_back(name);
}
return device_names.Pass();
@@ -175,7 +185,15 @@ void VideoCaptureDeviceFactoryMac::GetDeviceSupportedFormats(
[VideoCaptureDeviceAVFoundation getDevice:device
supportedFormats:supported_formats];
} else {
- NOTIMPLEMENTED();
+ // Some cameras are known to crash if requested with VGA (crbug.com/396812),
+ // HD is the only supported resolution for them. In any other case, QTKit
+ // provides no format information.
+ if (device.is_blacklisted()) {
+ DVLOG(2) << "Found blacklisted camera with only HD supported format.";
+ supported_formats->push_back(media::VideoCaptureFormat(
+ kBlackmagicQTKitCaptureResolution, kBlackmagicQTKitCaptureFrameRate,
tommi (sloooow) - chröme 2014/08/13 12:42:29 here, there's an assumption that blacklisted==blac
mcasas 2014/08/13 14:04:52 Done.
+ media::PIXEL_FORMAT_UYVY));
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698