summaryrefslogtreecommitdiffstats
path: root/src/multimedia/platform/android/mediacapture
diff options
context:
space:
mode:
Diffstat (limited to 'src/multimedia/platform/android/mediacapture')
-rw-r--r--src/multimedia/platform/android/mediacapture/qandroidcameracontrol.cpp238
-rw-r--r--src/multimedia/platform/android/mediacapture/qandroidcameracontrol_p.h22
-rw-r--r--src/multimedia/platform/android/mediacapture/qandroidcameraexposurecontrol.cpp377
-rw-r--r--src/multimedia/platform/android/mediacapture/qandroidcameraexposurecontrol_p.h109
-rw-r--r--src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp3
-rw-r--r--src/multimedia/platform/android/mediacapture/qandroidcamerasession_p.h3
6 files changed, 249 insertions, 503 deletions
diff --git a/src/multimedia/platform/android/mediacapture/qandroidcameracontrol.cpp b/src/multimedia/platform/android/mediacapture/qandroidcameracontrol.cpp
index a8eb9ec16..4e8414381 100644
--- a/src/multimedia/platform/android/mediacapture/qandroidcameracontrol.cpp
+++ b/src/multimedia/platform/android/mediacapture/qandroidcameracontrol.cpp
@@ -39,7 +39,6 @@
#include "qandroidcameracontrol_p.h"
#include "qandroidcamerasession_p.h"
-#include "qandroidcameraexposurecontrol_p.h"
#include "qandroidcameraimageprocessingcontrol_p.h"
#include "qandroidcameravideorenderercontrol_p.h"
#include "qandroidcaptureservice_p.h"
@@ -119,11 +118,6 @@ void QAndroidCameraControl::setCaptureSession(QPlatformMediaCaptureSession *sess
}
-QPlatformCameraExposure *QAndroidCameraControl::exposureControl()
-{
- return m_cameraSession->exposureControl();
-}
-
QPlatformCameraImageProcessing *QAndroidCameraControl::imageProcessingControl()
{
return m_cameraSession->imageProcessingControl();
@@ -226,20 +220,86 @@ void QAndroidCameraControl::onCameraOpened()
m_zoomRatios.clear();
m_maximumZoom = 1.0;
}
+
+ m_minExposureCompensationIndex = m_cameraSession->camera()->getMinExposureCompensation();
+ m_maxExposureCompensationIndex = m_cameraSession->camera()->getMaxExposureCompensation();
+ m_exposureCompensationStep = m_cameraSession->camera()->getExposureCompensationStep();
+ exposureCompensationRangeChanged(m_minExposureCompensationIndex*m_exposureCompensationStep,
+ m_maxExposureCompensationIndex*m_exposureCompensationStep);
+
+ m_supportedExposureModes.clear();
+ QStringList sceneModes = m_cameraSession->camera()->getSupportedSceneModes();
+ if (!sceneModes.isEmpty()) {
+ for (int i = 0; i < sceneModes.size(); ++i) {
+ const QString &sceneMode = sceneModes.at(i);
+ if (sceneMode == QLatin1String("auto"))
+ m_supportedExposureModes << QCamera::ExposureAuto;
+ else if (sceneMode == QLatin1String("beach"))
+ m_supportedExposureModes << QCamera::ExposureBeach;
+ else if (sceneMode == QLatin1String("night"))
+ m_supportedExposureModes << QCamera::ExposureNight;
+ else if (sceneMode == QLatin1String("portrait"))
+ m_supportedExposureModes << QCamera::ExposurePortrait;
+ else if (sceneMode == QLatin1String("snow"))
+ m_supportedExposureModes << QCamera::ExposureSnow;
+ else if (sceneMode == QLatin1String("sports"))
+ m_supportedExposureModes << QCamera::ExposureSports;
+ else if (sceneMode == QLatin1String("action"))
+ m_supportedExposureModes << QCamera::ExposureAction;
+ else if (sceneMode == QLatin1String("landscape"))
+ m_supportedExposureModes << QCamera::ExposureLandscape;
+ else if (sceneMode == QLatin1String("night-portrait"))
+ m_supportedExposureModes << QCamera::ExposureNightPortrait;
+ else if (sceneMode == QLatin1String("theatre"))
+ m_supportedExposureModes << QCamera::ExposureTheatre;
+ else if (sceneMode == QLatin1String("sunset"))
+ m_supportedExposureModes << QCamera::ExposureSunset;
+ else if (sceneMode == QLatin1String("steadyphoto"))
+ m_supportedExposureModes << QCamera::ExposureSteadyPhoto;
+ else if (sceneMode == QLatin1String("fireworks"))
+ m_supportedExposureModes << QCamera::ExposureFireworks;
+ else if (sceneMode == QLatin1String("party"))
+ m_supportedExposureModes << QCamera::ExposureParty;
+ else if (sceneMode == QLatin1String("candlelight"))
+ m_supportedExposureModes << QCamera::ExposureCandlelight;
+ else if (sceneMode == QLatin1String("barcode"))
+ m_supportedExposureModes << QCamera::ExposureBarcode;
+ }
+ }
+
+ setExposureCompensation(exposureCompensation());
+ setExposureMode(exposureMode());
+
+ isFlashSupported = false;
+ isFlashAutoSupported = false;
+ isTorchSupported = false;
+
+ QStringList flashModes = m_cameraSession->camera()->getSupportedFlashModes();
+ for (int i = 0; i < flashModes.size(); ++i) {
+ const QString &flashMode = flashModes.at(i);
+ if (flashMode == QLatin1String("auto"))
+ isFlashAutoSupported = true;
+ else if (flashMode == QLatin1String("on"))
+ isFlashSupported = true;
+ else if (flashMode == QLatin1String("torch"))
+ isTorchSupported = true;
+ }
+
+ setFlashMode(flashMode());
}
//void QAndroidCameraFocusControl::onCameraCaptureModeChanged()
//{
-// if (m_session->camera() && m_focusMode == QCamera::FocusModeAudio) {
+// if (m_cameraSession->camera() && m_focusMode == QCamera::FocusModeAudio) {
// QString focusMode;
-// if ((m_session->captureMode().testFlag(QCamera::CaptureVideo) && m_continuousVideoFocusSupported)
+// if ((m_cameraSession->captureMode().testFlag(QCamera::CaptureVideo) && m_continuousVideoFocusSupported)
// || !m_continuousPictureFocusSupported) {
// focusMode = QLatin1String("continuous-video");
// } else {
// focusMode = QLatin1String("continuous-picture");
// }
-// m_session->camera()->setFocusMode(focusMode);
-// m_session->camera()->cancelAutoFocus();
+// m_cameraSession->camera()->setFocusMode(focusMode);
+// m_cameraSession->camera()->cancelAutoFocus();
// }
//}
@@ -300,4 +360,162 @@ void QAndroidCameraControl::zoomTo(float factor, float rate)
zoomFactorChanged(newZoom);
}
+void QAndroidCameraControl::setFlashMode(QCamera::FlashMode mode)
+{
+ if (!m_cameraSession->camera())
+ return;
+
+ if (!isFlashModeSupported(mode))
+ return;
+
+ QString flashMode;
+ if (mode == QCamera::FlashAuto)
+ flashMode = QLatin1String("auto");
+ else if (mode == QCamera::FlashOn)
+ flashMode = QLatin1String("on");
+ else // FlashOff
+ flashMode = QLatin1String("off");
+
+ m_cameraSession->camera()->setFlashMode(flashMode);
+ flashModeChanged(mode);
+}
+
+bool QAndroidCameraControl::isFlashModeSupported(QCamera::FlashMode mode) const
+{
+ if (!m_cameraSession->camera())
+ return false;
+ switch (mode) {
+ case QCamera::FlashOff:
+ return true;
+ case QCamera::FlashOn:
+ return isFlashSupported;
+ case QCamera::FlashAuto:
+ return isFlashAutoSupported;
+ }
+}
+
+bool QAndroidCameraControl::isFlashReady() const
+{
+ // Android doesn't have an API for that
+ return true;
+}
+
+void QAndroidCameraControl::setTorchMode(QCamera::TorchMode mode)
+{
+ auto *camera = m_cameraSession->camera();
+ if (!camera || !isTorchSupported || mode == QCamera::TorchAuto)
+ return;
+
+ if (mode == QCamera::TorchOn) {
+ camera->setFlashMode(QLatin1String("torch"));
+ } else if (mode == QCamera::TorchOff) {
+ // if torch was enabled, it first needs to be turned off before restoring the flash mode
+ camera->setFlashMode(QLatin1String("off"));
+ setFlashMode(flashMode());
+ }
+ torchModeChanged(mode);
+}
+
+bool QAndroidCameraControl::isTorchModeSupported(QCamera::TorchMode mode) const
+{
+ if (!m_cameraSession->camera())
+ return false;
+ switch (mode) {
+ case QCamera::TorchOff:
+ return true;
+ case QCamera::TorchOn:
+ return isTorchSupported;
+ case QCamera::TorchAuto:
+ return false;
+ }
+}
+
+void QAndroidCameraControl::setExposureMode(QCamera::ExposureMode mode)
+{
+ if (exposureMode() == mode)
+ return;
+
+ if (!m_cameraSession->camera())
+ return;
+
+ if (!m_supportedExposureModes.contains(mode))
+ return;
+
+ QString sceneMode;
+ switch (mode) {
+ case QCamera::ExposureAuto:
+ sceneMode = QLatin1String("auto");
+ break;
+ case QCamera::ExposureSports:
+ sceneMode = QLatin1String("sports");
+ break;
+ case QCamera::ExposurePortrait:
+ sceneMode = QLatin1String("portrait");
+ break;
+ case QCamera::ExposureBeach:
+ sceneMode = QLatin1String("beach");
+ break;
+ case QCamera::ExposureSnow:
+ sceneMode = QLatin1String("snow");
+ break;
+ case QCamera::ExposureNight:
+ sceneMode = QLatin1String("night");
+ break;
+ case QCamera::ExposureAction:
+ sceneMode = QLatin1String("action");
+ break;
+ case QCamera::ExposureLandscape:
+ sceneMode = QLatin1String("landscape");
+ break;
+ case QCamera::ExposureNightPortrait:
+ sceneMode = QLatin1String("night-portrait");
+ break;
+ case QCamera::ExposureTheatre:
+ sceneMode = QLatin1String("theatre");
+ break;
+ case QCamera::ExposureSunset:
+ sceneMode = QLatin1String("sunset");
+ break;
+ case QCamera::ExposureSteadyPhoto:
+ sceneMode = QLatin1String("steadyphoto");
+ break;
+ case QCamera::ExposureFireworks:
+ sceneMode = QLatin1String("fireworks");
+ break;
+ case QCamera::ExposureParty:
+ sceneMode = QLatin1String("party");
+ break;
+ case QCamera::ExposureCandlelight:
+ sceneMode = QLatin1String("candlelight");
+ break;
+ case QCamera::ExposureBarcode:
+ sceneMode = QLatin1String("barcode");
+ break;
+ default:
+ sceneMode = QLatin1String("auto");
+ mode = QCamera::ExposureAuto;
+ break;
+ }
+
+ m_cameraSession->camera()->setSceneMode(sceneMode);
+ exposureModeChanged(mode);
+}
+
+bool QAndroidCameraControl::isExposureModeSupported(QCamera::ExposureMode mode) const
+{
+ return m_supportedExposureModes.contains(mode);
+}
+
+void QAndroidCameraControl::setExposureCompensation(float bias)
+{
+ if (exposureCompensation() == bias || !m_cameraSession->camera())
+ return;
+
+ int biasIndex = qRound(bias / m_exposureCompensationStep);
+ biasIndex = qBound(m_minExposureCompensationIndex, biasIndex, m_maxExposureCompensationIndex);
+ float comp = biasIndex * m_exposureCompensationStep;
+ m_cameraSession->camera()->setExposureCompensation(biasIndex);
+ exposureCompensationChanged(comp);
+}
+
QT_END_NAMESPACE
diff --git a/src/multimedia/platform/android/mediacapture/qandroidcameracontrol_p.h b/src/multimedia/platform/android/mediacapture/qandroidcameracontrol_p.h
index 1c9927dc2..86a685a60 100644
--- a/src/multimedia/platform/android/mediacapture/qandroidcameracontrol_p.h
+++ b/src/multimedia/platform/android/mediacapture/qandroidcameracontrol_p.h
@@ -76,7 +76,6 @@ public:
void setCaptureSession(QPlatformMediaCaptureSession *session) override;
- QPlatformCameraExposure *exposureControl() override;
QPlatformCameraImageProcessing *imageProcessingControl() override;
void setFocusMode(QCamera::FocusMode mode) override;
@@ -84,6 +83,18 @@ public:
void zoomTo(float factor, float rate) override;
+ void setFlashMode(QCamera::FlashMode mode) override;
+ bool isFlashModeSupported(QCamera::FlashMode mode) const override;
+ bool isFlashReady() const override;
+
+ void setTorchMode(QCamera::TorchMode mode) override;
+ bool isTorchModeSupported(QCamera::TorchMode mode) const override;
+
+ void setExposureMode(QCamera::ExposureMode mode) override;
+ bool isExposureModeSupported(QCamera::ExposureMode mode) const override;
+
+ void setExposureCompensation(float bias) override;
+
private Q_SLOTS:
void onCameraOpened();
void setCameraFocusArea();
@@ -100,6 +111,15 @@ private:
float m_maximumZoom;
QList<int> m_zoomRatios;
+
+ QList<QCamera::ExposureMode> m_supportedExposureModes;
+ int m_minExposureCompensationIndex;
+ int m_maxExposureCompensationIndex;
+ qreal m_exposureCompensationStep;
+
+ bool isFlashSupported = false;
+ bool isFlashAutoSupported = false;
+ bool isTorchSupported = false;
};
diff --git a/src/multimedia/platform/android/mediacapture/qandroidcameraexposurecontrol.cpp b/src/multimedia/platform/android/mediacapture/qandroidcameraexposurecontrol.cpp
deleted file mode 100644
index fc78330af..000000000
--- a/src/multimedia/platform/android/mediacapture/qandroidcameraexposurecontrol.cpp
+++ /dev/null
@@ -1,377 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidcameraexposurecontrol_p.h"
-
-#include "qandroidcamerasession_p.h"
-#include "androidcamera_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QAndroidCameraExposureControl::QAndroidCameraExposureControl(QAndroidCameraSession *session)
- : QPlatformCameraExposure()
- , m_session(session)
- , m_minExposureCompensationIndex(0)
- , m_maxExposureCompensationIndex(0)
- , m_exposureCompensationStep(0.0)
- , m_requestedExposureCompensation(0.0)
- , m_actualExposureCompensation(0.0)
- , m_requestedExposureMode(QCamera::ExposureAuto)
- , m_actualExposureMode(QCamera::ExposureAuto)
-{
- connect(m_session, SIGNAL(opened()),
- this, SLOT(onCameraOpened()));
-}
-
-bool QAndroidCameraExposureControl::isParameterSupported(ExposureParameter parameter) const
-{
- if (!m_session->camera())
- return false;
-
- switch (parameter) {
- case QPlatformCameraExposure::ISO:
- return false;
- case QPlatformCameraExposure::ShutterSpeed:
- return false;
- case QPlatformCameraExposure::ExposureCompensation:
- return !m_supportedExposureCompensations.isEmpty();
- case QPlatformCameraExposure::TorchPower:
- return false;
- case QPlatformCameraExposure::ExposureMode:
- return !m_supportedExposureModes.isEmpty();
- default:
- return false;
- }
-}
-
-QVariantList QAndroidCameraExposureControl::supportedParameterRange(ExposureParameter parameter, bool *continuous) const
-{
- if (!m_session->camera())
- return QVariantList();
-
- if (continuous)
- *continuous = false;
-
- if (parameter == QPlatformCameraExposure::ExposureCompensation)
- return m_supportedExposureCompensations;
- else if (parameter == QPlatformCameraExposure::ExposureMode)
- return m_supportedExposureModes;
-
- return QVariantList();
-}
-
-QVariant QAndroidCameraExposureControl::requestedValue(ExposureParameter parameter) const
-{
- if (parameter == QPlatformCameraExposure::ExposureCompensation)
- return QVariant::fromValue(m_requestedExposureCompensation);
- else if (parameter == QPlatformCameraExposure::ExposureMode)
- return QVariant::fromValue(m_requestedExposureMode);
-
- return QVariant();
-}
-
-QVariant QAndroidCameraExposureControl::actualValue(ExposureParameter parameter) const
-{
- if (parameter == QPlatformCameraExposure::ExposureCompensation)
- return QVariant::fromValue(m_actualExposureCompensation);
- else if (parameter == QPlatformCameraExposure::ExposureMode)
- return QVariant::fromValue(m_actualExposureMode);
-
- return QVariant();
-}
-
-bool QAndroidCameraExposureControl::setValue(ExposureParameter parameter, const QVariant& value)
-{
- if (!value.isValid())
- return false;
-
- if (parameter == QPlatformCameraExposure::ExposureCompensation) {
- qreal expComp = value.toReal();
- if (!qFuzzyCompare(m_requestedExposureCompensation, expComp)) {
- m_requestedExposureCompensation = expComp;
- emit requestedValueChanged(QPlatformCameraExposure::ExposureCompensation);
- }
-
- if (!m_session->camera())
- return true;
-
- int expCompIndex = qRound(m_requestedExposureCompensation / m_exposureCompensationStep);
- if (expCompIndex >= m_minExposureCompensationIndex
- && expCompIndex <= m_maxExposureCompensationIndex) {
- qreal comp = expCompIndex * m_exposureCompensationStep;
- m_session->camera()->setExposureCompensation(expCompIndex);
- if (!qFuzzyCompare(m_actualExposureCompensation, comp)) {
- m_actualExposureCompensation = expCompIndex * m_exposureCompensationStep;
- emit actualValueChanged(QPlatformCameraExposure::ExposureCompensation);
- }
-
- return true;
- }
-
- } else if (parameter == QPlatformCameraExposure::ExposureMode) {
- QCamera::ExposureMode expMode = value.value<QCamera::ExposureMode>();
- if (m_requestedExposureMode != expMode) {
- m_requestedExposureMode = expMode;
- emit requestedValueChanged(QPlatformCameraExposure::ExposureMode);
- }
-
- if (!m_session->camera())
- return true;
-
- if (!m_supportedExposureModes.isEmpty()) {
- m_actualExposureMode = m_requestedExposureMode;
-
- QString sceneMode;
- switch (m_requestedExposureMode) {
- case QCamera::ExposureAuto:
- sceneMode = QLatin1String("auto");
- break;
- case QCamera::ExposureSports:
- sceneMode = QLatin1String("sports");
- break;
- case QCamera::ExposurePortrait:
- sceneMode = QLatin1String("portrait");
- break;
- case QCamera::ExposureBeach:
- sceneMode = QLatin1String("beach");
- break;
- case QCamera::ExposureSnow:
- sceneMode = QLatin1String("snow");
- break;
- case QCamera::ExposureNight:
- sceneMode = QLatin1String("night");
- break;
- case QCamera::ExposureAction:
- sceneMode = QLatin1String("action");
- break;
- case QCamera::ExposureLandscape:
- sceneMode = QLatin1String("landscape");
- break;
- case QCamera::ExposureNightPortrait:
- sceneMode = QLatin1String("night-portrait");
- break;
- case QCamera::ExposureTheatre:
- sceneMode = QLatin1String("theatre");
- break;
- case QCamera::ExposureSunset:
- sceneMode = QLatin1String("sunset");
- break;
- case QCamera::ExposureSteadyPhoto:
- sceneMode = QLatin1String("steadyphoto");
- break;
- case QCamera::ExposureFireworks:
- sceneMode = QLatin1String("fireworks");
- break;
- case QCamera::ExposureParty:
- sceneMode = QLatin1String("party");
- break;
- case QCamera::ExposureCandlelight:
- sceneMode = QLatin1String("candlelight");
- break;
- case QCamera::ExposureBarcode:
- sceneMode = QLatin1String("barcode");
- break;
- default:
- sceneMode = QLatin1String("auto");
- m_actualExposureMode = QCamera::ExposureAuto;
- break;
- }
-
- m_session->camera()->setSceneMode(sceneMode);
- emit actualValueChanged(QPlatformCameraExposure::ExposureMode);
-
- return true;
- }
- }
-
- return false;
-}
-
-void QAndroidCameraExposureControl::onCameraOpened()
-{
- m_supportedExposureCompensations.clear();
- m_minExposureCompensationIndex = m_session->camera()->getMinExposureCompensation();
- m_maxExposureCompensationIndex = m_session->camera()->getMaxExposureCompensation();
- m_exposureCompensationStep = m_session->camera()->getExposureCompensationStep();
- if (m_minExposureCompensationIndex != 0 || m_maxExposureCompensationIndex != 0) {
- for (int i = m_minExposureCompensationIndex; i <= m_maxExposureCompensationIndex; ++i)
- m_supportedExposureCompensations.append(i * m_exposureCompensationStep);
- emit parameterRangeChanged(QPlatformCameraExposure::ExposureCompensation);
- }
-
- m_supportedExposureModes.clear();
- QStringList sceneModes = m_session->camera()->getSupportedSceneModes();
- if (!sceneModes.isEmpty()) {
- for (int i = 0; i < sceneModes.size(); ++i) {
- const QString &sceneMode = sceneModes.at(i);
- if (sceneMode == QLatin1String("auto"))
- m_supportedExposureModes << QVariant::fromValue(QCamera::ExposureAuto);
- else if (sceneMode == QLatin1String("beach"))
- m_supportedExposureModes << QVariant::fromValue(QCamera::ExposureBeach);
- else if (sceneMode == QLatin1String("night"))
- m_supportedExposureModes << QVariant::fromValue(QCamera::ExposureNight);
- else if (sceneMode == QLatin1String("portrait"))
- m_supportedExposureModes << QVariant::fromValue(QCamera::ExposurePortrait);
- else if (sceneMode == QLatin1String("snow"))
- m_supportedExposureModes << QVariant::fromValue(QCamera::ExposureSnow);
- else if (sceneMode == QLatin1String("sports"))
- m_supportedExposureModes << QVariant::fromValue(QCamera::ExposureSports);
- else if (sceneMode == QLatin1String("action"))
- m_supportedExposureModes << QVariant::fromValue(QCamera::ExposureAction);
- else if (sceneMode == QLatin1String("landscape"))
- m_supportedExposureModes << QVariant::fromValue(QCamera::ExposureLandscape);
- else if (sceneMode == QLatin1String("night-portrait"))
- m_supportedExposureModes << QVariant::fromValue(QCamera::ExposureNightPortrait);
- else if (sceneMode == QLatin1String("theatre"))
- m_supportedExposureModes << QVariant::fromValue(QCamera::ExposureTheatre);
- else if (sceneMode == QLatin1String("sunset"))
- m_supportedExposureModes << QVariant::fromValue(QCamera::ExposureSunset);
- else if (sceneMode == QLatin1String("steadyphoto"))
- m_supportedExposureModes << QVariant::fromValue(QCamera::ExposureSteadyPhoto);
- else if (sceneMode == QLatin1String("fireworks"))
- m_supportedExposureModes << QVariant::fromValue(QCamera::ExposureFireworks);
- else if (sceneMode == QLatin1String("party"))
- m_supportedExposureModes << QVariant::fromValue(QCamera::ExposureParty);
- else if (sceneMode == QLatin1String("candlelight"))
- m_supportedExposureModes << QVariant::fromValue(QCamera::ExposureCandlelight);
- else if (sceneMode == QLatin1String("barcode"))
- m_supportedExposureModes << QVariant::fromValue(QCamera::ExposureBarcode);
- }
- emit parameterRangeChanged(QPlatformCameraExposure::ExposureMode);
- }
-
- setValue(QPlatformCameraExposure::ExposureCompensation, QVariant::fromValue(m_requestedExposureCompensation));
- setValue(QPlatformCameraExposure::ExposureMode, QVariant::fromValue(m_requestedExposureMode));
-
- m_supportedFlashModes.clear();
- torchModeSupported = false;
-
- QStringList flashModes = m_session->camera()->getSupportedFlashModes();
- for (int i = 0; i < flashModes.size(); ++i) {
- const QString &flashMode = flashModes.at(i);
- if (flashMode == QLatin1String("off"))
- m_supportedFlashModes << QCamera::FlashOff;
- else if (flashMode == QLatin1String("auto"))
- m_supportedFlashModes << QCamera::FlashAuto;
- else if (flashMode == QLatin1String("on"))
- m_supportedFlashModes << QCamera::FlashOn;
- else if (flashMode == QLatin1String("torch"))
- torchModeSupported = true;
- }
-
- if (!m_supportedFlashModes.contains(m_flashMode))
- m_flashMode = QCamera::FlashOff;
-
- setFlashMode(m_flashMode);
-}
-
-
-QCamera::FlashMode QAndroidCameraExposureControl::flashMode() const
-{
- return m_flashMode;
-}
-
-void QAndroidCameraExposureControl::setFlashMode(QCamera::FlashMode mode)
-{
- if (!m_session->camera()) {
- m_flashMode = QCamera::FlashOff;
- return;
- }
-
- if (!isFlashModeSupported(mode))
- return;
-
-
- m_flashMode = mode;
-
- QString flashMode;
- if (mode == QCamera::FlashAuto)
- flashMode = QLatin1String("auto");
- else if (mode == QCamera::FlashOn)
- flashMode = QLatin1String("on");
- else // FlashOff
- flashMode = QLatin1String("off");
-
- m_session->camera()->setFlashMode(flashMode);
-}
-
-bool QAndroidCameraExposureControl::isFlashModeSupported(QCamera::FlashMode mode) const
-{
- return m_session->camera() ? m_supportedFlashModes.contains(mode) : false;
-}
-
-bool QAndroidCameraExposureControl::isFlashReady() const
-{
- // Android doesn't have an API for that
- return true;
-}
-
-QCamera::TorchMode QAndroidCameraExposureControl::torchMode() const
-{
- return torchEnabled ? QCamera::TorchOn : QCamera::TorchOff;
-}
-
-void QAndroidCameraExposureControl::setTorchMode(QCamera::TorchMode mode)
-{
- auto *camera = m_session->camera();
- if (!camera || !torchModeSupported)
- return;
-
- if (mode == QCamera::TorchOn) {
- camera->setFlashMode(QLatin1String("torch"));
- torchEnabled = true;
- } else if (mode == QCamera::TorchOff) {
- // if torch was enabled, it first needs to be turned off before restoring the flash mode
- camera->setFlashMode(QLatin1String("off"));
- setFlashMode(m_flashMode);
- torchEnabled = false;
- }
-}
-
-bool QAndroidCameraExposureControl::isTorchModeSupported(QCamera::TorchMode mode) const
-{
- if (mode == QCamera::TorchAuto)
- return false;
- else if (mode == QCamera::TorchOn)
- return torchModeSupported;
- else
- return true;
-}
-
-QT_END_NAMESPACE
diff --git a/src/multimedia/platform/android/mediacapture/qandroidcameraexposurecontrol_p.h b/src/multimedia/platform/android/mediacapture/qandroidcameraexposurecontrol_p.h
deleted file mode 100644
index 510a9a764..000000000
--- a/src/multimedia/platform/android/mediacapture/qandroidcameraexposurecontrol_p.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDCAMERAEXPOSURECONTROL_H
-#define QANDROIDCAMERAEXPOSURECONTROL_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qplatformcameraexposure_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QAndroidCameraSession;
-
-class QAndroidCameraExposureControl : public QPlatformCameraExposure
-{
- Q_OBJECT
-public:
- explicit QAndroidCameraExposureControl(QAndroidCameraSession *session);
-
- bool isParameterSupported(ExposureParameter parameter) const override;
- QVariantList supportedParameterRange(ExposureParameter parameter, bool *continuous) const override;
-
- QVariant requestedValue(ExposureParameter parameter) const override;
- QVariant actualValue(ExposureParameter parameter) const override;
- bool setValue(ExposureParameter parameter, const QVariant& value) override;
-
- QCamera::FlashMode flashMode() const override;
- void setFlashMode(QCamera::FlashMode mode) override;
- bool isFlashModeSupported(QCamera::FlashMode mode) const override;
- bool isFlashReady() const override;
-
- QCamera::TorchMode torchMode() const override;
- void setTorchMode(QCamera::TorchMode mode) override;
- bool isTorchModeSupported(QCamera::TorchMode mode) const override;
-
-private Q_SLOTS:
- void onCameraOpened();
-
-private:
- QAndroidCameraSession *m_session;
-
- QVariantList m_supportedExposureCompensations;
- QVariantList m_supportedExposureModes;
-
- int m_minExposureCompensationIndex;
- int m_maxExposureCompensationIndex;
- qreal m_exposureCompensationStep;
-
- qreal m_requestedExposureCompensation;
- qreal m_actualExposureCompensation;
- QCamera::ExposureMode m_requestedExposureMode;
- QCamera::ExposureMode m_actualExposureMode;
-
- QList<QCamera::FlashMode> m_supportedFlashModes;
- QCamera::FlashMode m_flashMode;
-
- bool torchModeSupported = false;
- bool torchEnabled = false;
-};
-
-QT_END_NAMESPACE
-
-#endif // QANDROIDCAMERAEXPOSURECONTROL_H
diff --git a/src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp b/src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp
index 81e208a2a..369c7ed10 100644
--- a/src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp
+++ b/src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp
@@ -45,7 +45,6 @@
#include "qandroidvideooutput_p.h"
#include "qandroidmultimediautils_p.h"
#include "qandroidcameravideorenderercontrol_p.h"
-#include "qandroidcameraexposurecontrol_p.h"
#include "qandroidcameraimageprocessingcontrol_p.h"
#include <qvideosink.h>
#include <QtConcurrent/qtconcurrentrun.h>
@@ -79,7 +78,6 @@ QAndroidCameraSession::QAndroidCameraSession(QObject *parent)
QMediaStorageLocation::Pictures,
AndroidMultimediaUtils::getDefaultMediaDirectory(AndroidMultimediaUtils::DCIM));
- m_cameraExposureControl = new QAndroidCameraExposureControl(this);
m_cameraImageProcessingControl = new QAndroidCameraImageProcessingControl(this);
if (qApp) {
@@ -90,7 +88,6 @@ QAndroidCameraSession::QAndroidCameraSession(QObject *parent)
QAndroidCameraSession::~QAndroidCameraSession()
{
- delete m_cameraExposureControl;
delete m_cameraImageProcessingControl;
delete m_renderer;
diff --git a/src/multimedia/platform/android/mediacapture/qandroidcamerasession_p.h b/src/multimedia/platform/android/mediacapture/qandroidcamerasession_p.h
index 69a2d8864..9f88bd76d 100644
--- a/src/multimedia/platform/android/mediacapture/qandroidcamerasession_p.h
+++ b/src/multimedia/platform/android/mediacapture/qandroidcamerasession_p.h
@@ -63,7 +63,6 @@
QT_BEGIN_NAMESPACE
class QAndroidVideoOutput;
-class QAndroidCameraExposureControl;
class QAndroidCameraImageProcessingControl;
class QAndroidCameraVideoRendererControl;
class QVideoSink;
@@ -112,7 +111,6 @@ public:
void setPreviewCallback(PreviewCallback *callback);
bool requestRecordingPermission();
- QAndroidCameraExposureControl *exposureControl() { return m_cameraExposureControl; }
QAndroidCameraImageProcessingControl *imageProcessingControl() { return m_cameraImageProcessingControl; }
void setVideoSink(QVideoSink *surface);
@@ -180,7 +178,6 @@ private:
QAndroidCameraVideoRendererControl *m_renderer = nullptr;
- QAndroidCameraExposureControl *m_cameraExposureControl;
QAndroidCameraImageProcessingControl *m_cameraImageProcessingControl;
QImageEncoderSettings m_requestedImageSettings;