summaryrefslogtreecommitdiffstats
path: root/src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm
diff options
context:
space:
mode:
authorVal Doroshchuk <valentyn.doroshchuk@qt.io>2020-02-17 15:32:25 +0100
committerVal Doroshchuk <valentyn.doroshchuk@qt.io>2020-02-18 15:54:23 +0100
commitaec140743b1a4110c327c46bdfbf15fcddb2dd17 (patch)
treee10af1522b7f93f9177f05e8dcc07521bb92b5af /src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm
parent7e64b859b6a663f42ee3067930ef132d9e7d2901 (diff)
AVF: Fix applying viewfinder settings for iOS
1. If a resolution of the viewfinder is requested to be changed, it is not needed to check available formats for highResolutionStillImageDimensions (since it is viewfinder resolution and not still images). format.highResolutionStillImageDimensions returns the highest resolution still image that can be produced by the format. Using this format will cause wrong resolution in the viewfinder. 2. Seems iOS requires to call beginConfiguration/commitConfiguration to apply any changes. commitConfiguration is currently called when the camera gets active. In case if settings are changed after starting the camera, they will not be applied. To fix that, added beginConfiguration/commitConfiguration. Fixes: QTBUG-79935 Change-Id: I60b6e08887a82e4337a2a302b8e5513c65b26e61 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm')
-rw-r--r--src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm b/src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm
index a77d7de03..0f7a0560b 100644
--- a/src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm
+++ b/src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm
@@ -185,7 +185,16 @@ void AVFCameraViewfinderSettingsControl2::setViewfinderSettings(const QCameraVie
return;
m_settings = settings;
+#if defined(Q_OS_IOS)
+ bool active = m_service->session()->state() == QCamera::ActiveState;
+ if (active)
+ [m_service->session()->captureSession() beginConfiguration];
applySettings(m_settings);
+ if (active)
+ [m_service->session()->captureSession() commitConfiguration];
+#else
+ applySettings(m_settings);
+#endif
}
QVideoFrame::PixelFormat AVFCameraViewfinderSettingsControl2::QtPixelFormatFromCVFormat(unsigned avPixelFormat)
@@ -264,7 +273,7 @@ AVCaptureDeviceFormat *AVFCameraViewfinderSettingsControl2::findBestFormatMatch(
// 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(captureDevice, resolution,
- m_service->session()->defaultCodec());
+ m_service->session()->defaultCodec(), false);
}
// No resolution requested, what about framerates?