summaryrefslogtreecommitdiffstats
path: root/src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm
diff options
context:
space:
mode:
authorTimur Pocheptsov <Timur.Pocheptsov@digia.com>2015-03-04 16:34:32 +0100
committerTimur Pocheptsov <Timur.Pocheptsov@digia.com>2015-03-10 16:35:59 +0000
commitf839f9e3eb2cd89f2b458349a08f9e5444744f1b (patch)
treea39c78e2fe3541da7dfd8e2e2197faf1d039769c /src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm
parentdbcf44247d41fa456329da30ae378a69de19e3cd (diff)
AVCaptureDeviceFormat - avoid duplicates (OS X/iOS)
Excluding video range (iOS) is not the right way to avoid "duplicates" - with other devices there can be also duplicates (formats with the same resolutions), but completely different pixel formats. Since we do not know what they will be in advance, we take the media subtype from the initial preset for a capture device and use it as a filter. Update viewfinder and image encoder settings controls. Change-Id: If20aea24b19b43574d5c3e9bf2ba85f50fc08916 Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
Diffstat (limited to 'src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm')
-rw-r--r--src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm b/src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm
index c5aa5733d..250aae9c1 100644
--- a/src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm
+++ b/src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm
@@ -279,9 +279,11 @@ QList<QCameraViewfinderSettings> AVFCameraViewfinderSettingsControl2::supportedV
return supportedSettings;
}
- for (AVCaptureDeviceFormat *format in m_captureDevice.formats) {
- if (qt_is_video_range_subtype(format))
- continue;
+ const QVector<AVCaptureDeviceFormat *> formats(qt_unique_device_formats(m_captureDevice,
+ m_session->defaultCodec()));
+ for (int i = 0; i < formats.size(); ++i) {
+ AVCaptureDeviceFormat *format = formats[i];
+
const QSize res(qt_device_format_resolution(format));
if (res.isNull() || !res.isValid())
continue;
@@ -435,12 +437,14 @@ AVCaptureDeviceFormat *AVFCameraViewfinderSettingsControl2::findBestFormatMatch(
#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
if (QSysInfo::MacintoshVersion >= qt_OS_limit(QSysInfo::MV_10_7, QSysInfo::MV_IOS_7_0)) {
Q_ASSERT(m_captureDevice);
+ Q_ASSERT(m_session);
const QSize &resolution = settings.resolution();
if (!resolution.isNull() && resolution.isValid()) {
// Either the exact match (including high resolution for images on iOS)
// or a format with a resolution close to the requested one.
- return qt_find_best_resolution_match(m_captureDevice, resolution);
+ return qt_find_best_resolution_match(m_captureDevice, resolution,
+ m_session->defaultCodec());
}
// No resolution requested, what about framerates?
@@ -453,7 +457,8 @@ AVCaptureDeviceFormat *AVFCameraViewfinderSettingsControl2::findBestFormatMatch(
const qreal minFPS(settings.minimumFrameRate());
const qreal maxFPS(settings.maximumFrameRate());
if (minFPS || maxFPS)
- return qt_find_best_framerate_match(m_captureDevice, maxFPS ? maxFPS : minFPS);
+ return qt_find_best_framerate_match(m_captureDevice, maxFPS ? maxFPS : minFPS,
+ m_session->defaultCodec());
// Ignore PAR for the moment (PAR without resolution can
// pick a format with really bad resolution).
// No need to test pixel format, just return settings.