diff options
author | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2015-11-19 15:19:23 +0100 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2015-12-03 09:40:21 +0000 |
commit | 8dc46cef05d901bb48f0d87e19a8b35b5e70757e (patch) | |
tree | ecc541bb56bd12d9e3c6dd9ae18645470a882ae8 /src/plugins/avfoundation | |
parent | b7880782b92e214d98bb957fb2ff6f7d5fffd104 (diff) | |
download | qtmultimedia-8dc46cef05d901bb48f0d87e19a8b35b5e70757e.tar.gz |
AVFoundation: fix setting the camera viewfinder resolution.
Image capture resolution and viewfinder resolution must be the same,
with the image capture resolution taking precedence over the viewfinder
resolution when both are explicitly set.
The code was getting the active image capture resolution, instead of
the one explicitly requested, to adjust the viewfinder resolution.
That effectively made the viewfinder resolution always ignored since
the active capture resolution always has a default value.
Task-number: QTBUG-49170
Change-Id: I2f3d01366d83a3e28c0a1ea0109663cfdfa75963
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Diffstat (limited to 'src/plugins/avfoundation')
-rw-r--r-- | src/plugins/avfoundation/camera/avfcamerasession.mm | 4 | ||||
-rw-r--r-- | src/plugins/avfoundation/camera/avfimageencodercontrol.h | 2 | ||||
-rw-r--r-- | src/plugins/avfoundation/camera/avfimageencodercontrol.mm | 5 |
3 files changed, 10 insertions, 1 deletions
diff --git a/src/plugins/avfoundation/camera/avfcamerasession.mm b/src/plugins/avfoundation/camera/avfcamerasession.mm index 2cb3824db..5bf841bec 100644 --- a/src/plugins/avfoundation/camera/avfcamerasession.mm +++ b/src/plugins/avfoundation/camera/avfcamerasession.mm @@ -365,8 +365,10 @@ void AVFCameraSession::applyViewfinderSettings() { if (AVFCameraViewfinderSettingsControl2 *vfControl = m_service->viewfinderSettingsControl2()) { 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->imageSettings().resolution()); + const QSize imageResolution(imControl->requestedSettings().resolution()); if (!imageResolution.isNull() && imageResolution.isValid()) { vfSettings.setResolution(imageResolution); vfControl->setViewfinderSettings(vfSettings); diff --git a/src/plugins/avfoundation/camera/avfimageencodercontrol.h b/src/plugins/avfoundation/camera/avfimageencodercontrol.h index fcb665a03..c805b3e21 100644 --- a/src/plugins/avfoundation/camera/avfimageencodercontrol.h +++ b/src/plugins/avfoundation/camera/avfimageencodercontrol.h @@ -62,6 +62,8 @@ public: QImageEncoderSettings imageSettings() const Q_DECL_OVERRIDE; void setImageSettings(const QImageEncoderSettings &settings) Q_DECL_OVERRIDE; + QImageEncoderSettings requestedSettings() const; + private: AVFCameraService *m_service; QImageEncoderSettings m_settings; diff --git a/src/plugins/avfoundation/camera/avfimageencodercontrol.mm b/src/plugins/avfoundation/camera/avfimageencodercontrol.mm index 36050c3a2..a5e9c0e09 100644 --- a/src/plugins/avfoundation/camera/avfimageencodercontrol.mm +++ b/src/plugins/avfoundation/camera/avfimageencodercontrol.mm @@ -115,6 +115,11 @@ QList<QSize> AVFImageEncoderControl::supportedResolutions(const QImageEncoderSet return resolutions; } +QImageEncoderSettings AVFImageEncoderControl::requestedSettings() const +{ + return m_settings; +} + QImageEncoderSettings AVFImageEncoderControl::imageSettings() const { QImageEncoderSettings settings; |