summaryrefslogtreecommitdiffstats
path: root/src/plugins/avfoundation/camera/avfcamerasession.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/avfoundation/camera/avfcamerasession.mm')
-rw-r--r--src/plugins/avfoundation/camera/avfcamerasession.mm26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/plugins/avfoundation/camera/avfcamerasession.mm b/src/plugins/avfoundation/camera/avfcamerasession.mm
index 5adc30296..c32b072ef 100644
--- a/src/plugins/avfoundation/camera/avfcamerasession.mm
+++ b/src/plugins/avfoundation/camera/avfcamerasession.mm
@@ -292,8 +292,8 @@ void AVFCameraSession::setState(QCamera::State newState)
m_defaultCodec = 0;
defaultCodec();
- bool activeFormatSet = applyImageEncoderSettings();
- activeFormatSet |= applyViewfinderSettings();
+ bool activeFormatSet = applyImageEncoderSettings()
+ | applyViewfinderSettings();
[m_captureSession commitConfiguration];
@@ -344,6 +344,17 @@ void AVFCameraSession::processSessionStopped()
}
}
+void AVFCameraSession::onCaptureModeChanged(QCamera::CaptureModes mode)
+{
+ Q_UNUSED(mode)
+
+ const QCamera::State s = state();
+ if (s == QCamera::LoadedState || s == QCamera::ActiveState) {
+ applyImageEncoderSettings();
+ applyViewfinderSettings();
+ }
+}
+
void AVFCameraSession::attachVideoInputDevice()
{
//Attach video input device:
@@ -387,18 +398,17 @@ bool AVFCameraSession::applyImageEncoderSettings()
bool AVFCameraSession::applyViewfinderSettings()
{
if (AVFCameraViewfinderSettingsControl2 *vfControl = m_service->viewfinderSettingsControl2()) {
+ QCamera::CaptureModes currentMode = m_service->cameraControl()->captureMode();
QCameraViewfinderSettings vfSettings(vfControl->requestedSettings());
// Viewfinder and image capture solutions must be the same, if an image capture
// resolution is set, it takes precedence over the viewfinder resolution.
- if (AVFImageEncoderControl *imControl = m_service->imageEncoderControl()) {
- const QSize imageResolution(imControl->requestedSettings().resolution());
- if (!imageResolution.isNull() && imageResolution.isValid()) {
+ if (currentMode.testFlag(QCamera::CaptureStillImage)) {
+ const QSize imageResolution(m_service->imageEncoderControl()->requestedSettings().resolution());
+ if (!imageResolution.isNull() && imageResolution.isValid())
vfSettings.setResolution(imageResolution);
- vfControl->setViewfinderSettings(vfSettings);
- }
}
- return vfControl->applySettings();
+ return vfControl->applySettings(vfSettings);
}
return false;