diff options
-rw-r--r-- | src/plugins/multimedia/android/common/qandroidvideooutput_p.h | 2 | ||||
-rw-r--r-- | src/plugins/multimedia/android/mediacapture/qandroidcamerasession.cpp | 19 |
2 files changed, 14 insertions, 7 deletions
diff --git a/src/plugins/multimedia/android/common/qandroidvideooutput_p.h b/src/plugins/multimedia/android/common/qandroidvideooutput_p.h index cc7e2413e..b9a3bc4d6 100644 --- a/src/plugins/multimedia/android/common/qandroidvideooutput_p.h +++ b/src/plugins/multimedia/android/common/qandroidvideooutput_p.h @@ -44,6 +44,7 @@ public: virtual void start() { } virtual void stop() { } virtual void reset() { } + virtual QSize getVideoSize() const { return QSize(0, 0); } Q_SIGNALS: void readyChanged(bool); @@ -67,6 +68,7 @@ public: void setVideoSize(const QSize &) override; void stop() override; void reset() override; + QSize getVideoSize() const override { return m_nativeSize; } void setSubtitle(const QString &subtitle); private Q_SLOTS: diff --git a/src/plugins/multimedia/android/mediacapture/qandroidcamerasession.cpp b/src/plugins/multimedia/android/mediacapture/qandroidcamerasession.cpp index fa756b610..d6aee3aff 100644 --- a/src/plugins/multimedia/android/mediacapture/qandroidcamerasession.cpp +++ b/src/plugins/multimedia/android/mediacapture/qandroidcamerasession.cpp @@ -290,25 +290,30 @@ void QAndroidCameraSession::applyResolution(const QSize &captureSize, bool resta // -- Set values on camera // fix the resolution of output based on the orientation - QSize outputResolution = adjustedViewfinderResolution; + QSize cameraOutputResolution = adjustedViewfinderResolution; + QSize videoOutputResolution = adjustedViewfinderResolution; + QSize currentVideoOutputResolution = m_videoOutput ? m_videoOutput->getVideoSize() : QSize(0, 0); const int rotation = currentCameraRotation(); // only transpose if it's valid for the preview - if ((rotation == 90 || rotation == 270) && previewSizes.contains(outputResolution.transposed())) - outputResolution.transpose(); + if (rotation == 90 || rotation == 270) { + videoOutputResolution.transpose(); + if (previewSizes.contains(cameraOutputResolution.transposed())) + cameraOutputResolution.transpose(); + } - if (currentViewfinderResolution != outputResolution + if (currentViewfinderResolution != cameraOutputResolution + || (m_videoOutput && currentVideoOutputResolution != videoOutputResolution) || currentPreviewFormat != adjustedPreviewFormat || currentFpsRange.min != adjustedFps.min || currentFpsRange.max != adjustedFps.max) { - if (m_videoOutput) { - m_videoOutput->setVideoSize(outputResolution); + m_videoOutput->setVideoSize(videoOutputResolution); } // if preview is started, we have to stop it first before changing its size if (m_previewStarted && restartPreview) m_camera->stopPreview(); - m_camera->setPreviewSize(outputResolution); + m_camera->setPreviewSize(cameraOutputResolution); m_camera->setPreviewFormat(adjustedPreviewFormat); m_camera->setPreviewFpsRange(adjustedFps); |