From 4bdf1561f46e85b14665b38804410340ffe1820b Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Mon, 30 Jun 2014 05:59:10 +0000 Subject: [PATCH] Add additional exposure modes to QCameraExposure. [ChangeLog][GStreamer][Android] Camera exposure mode extended to support Action, Landscape, NightPortrait, Theatre, Sunset, SteadyPhoto, Fireworks, Party, Candlelight, and Barcode modes. Change-Id: I13d4bb042d27c0bd2ffcd369882b56bbabc84335 Reviewed-by: Yoann Lopes --- src/imports/multimedia/qdeclarativecamera_p.h | 10 +++ .../multimedia/qdeclarativecameraexposure.cpp | 10 +++ .../multimedia/qdeclarativecameraexposure_p.h | 10 +++ src/multimedia/camera/qcameraexposure.cpp | 10 +++ src/multimedia/camera/qcameraexposure.h | 10 +++ .../mediacapture/qandroidcameraexposurecontrol.cpp | 50 +++++++++++++ .../gstreamer/camerabin/camerabinexposure.cpp | 81 +++++++++++++++++++--- 7 files changed, 172 insertions(+), 9 deletions(-) diff --git a/src/imports/multimedia/qdeclarativecamera_p.h b/src/imports/multimedia/qdeclarativecamera_p.h index 113f01b..4bc6065 100644 --- a/src/imports/multimedia/qdeclarativecamera_p.h +++ b/src/imports/multimedia/qdeclarativecamera_p.h @@ -191,6 +191,16 @@ public: ExposureBeach = QCameraExposure::ExposureBeach, ExposureLargeAperture = QCameraExposure::ExposureLargeAperture, ExposureSmallAperture = QCameraExposure::ExposureSmallAperture, + ExposureAction = QCameraExposure::ExposureAction, + ExposureLandscape = QCameraExposure::ExposureLandscape, + ExposureNightPortrait = QCameraExposure::ExposureNightPortrait, + ExposureTheatre = QCameraExposure::ExposureTheatre, + ExposureSunset = QCameraExposure::ExposureSunset, + ExposureSteadyPhoto = QCameraExposure::ExposureSteadyPhoto, + ExposureFireworks = QCameraExposure::ExposureFireworks, + ExposureParty = QCameraExposure::ExposureParty, + ExposureCandlelight = QCameraExposure::ExposureCandlelight, + ExposureBarcode = QCameraExposure::ExposureBarcode, ExposureModeVendor = QCameraExposure::ExposureModeVendor }; diff --git a/src/imports/multimedia/qdeclarativecameraexposure.cpp b/src/imports/multimedia/qdeclarativecameraexposure.cpp index cc793cd..3b1f920 100644 --- a/src/imports/multimedia/qdeclarativecameraexposure.cpp +++ b/src/imports/multimedia/qdeclarativecameraexposure.cpp @@ -341,6 +341,16 @@ void QDeclarativeCameraExposure::setAutoIsoSensitivity() \row \li Camera.ExposureLargeAperture \li Use larger aperture with small depth of field. \row \li Camera.ExposureSmallAperture \li Use smaller aperture. \row \li Camera.ExposurePortrait \li Portrait exposure mode. + \row \li Camera.ExposureAction \li Action exposure mode. Since 5.5 + \row \li Camera.ExposureLandscape \li Landscape exposure mode. Since 5.5 + \row \li Camera.ExposureNightPortrait \li Night portrait exposure mode. Since 5.5 + \row \li Camera.ExposureTheatre \li Theatre exposure mode. Since 5.5 + \row \li Camera.ExposureSunset \li Sunset exposure mode. Since 5.5 + \row \li Camera.ExposureSteadyPhoto \li Steady photo exposure mode. Since 5.5 + \row \li Camera.ExposureFireworks \li Fireworks exposure mode. Since 5.5 + \row \li Camera.ExposureParty \li Party exposure mode. Since 5.5 + \row \li Camera.ExposureCandlelight \li Candlelight exposure mode. Since 5.5 + \row \li Camera.ExposureBarcode \li Barcode exposure mode. Since 5.5 \row \li Camera.ExposureModeVendor \li The base value for device specific exposure modes. \endtable */ diff --git a/src/imports/multimedia/qdeclarativecameraexposure_p.h b/src/imports/multimedia/qdeclarativecameraexposure_p.h index a8a53f0..83058a9 100644 --- a/src/imports/multimedia/qdeclarativecameraexposure_p.h +++ b/src/imports/multimedia/qdeclarativecameraexposure_p.h @@ -86,6 +86,16 @@ public: ExposureBeach = QCameraExposure::ExposureBeach, ExposureLargeAperture = QCameraExposure::ExposureLargeAperture, ExposureSmallAperture = QCameraExposure::ExposureSmallAperture, + ExposureAction = QCameraExposure::ExposureAction, + ExposureLandscape = QCameraExposure::ExposureLandscape, + ExposureNightPortrait = QCameraExposure::ExposureNightPortrait, + ExposureTheatre = QCameraExposure::ExposureTheatre, + ExposureSunset = QCameraExposure::ExposureSunset, + ExposureSteadyPhoto = QCameraExposure::ExposureSteadyPhoto, + ExposureFireworks = QCameraExposure::ExposureFireworks, + ExposureParty = QCameraExposure::ExposureParty, + ExposureCandlelight = QCameraExposure::ExposureCandlelight, + ExposureBarcode = QCameraExposure::ExposureBarcode, ExposureModeVendor = QCameraExposure::ExposureModeVendor }; diff --git a/src/multimedia/camera/qcameraexposure.cpp b/src/multimedia/camera/qcameraexposure.cpp index 358e27b..9a74dbd 100644 --- a/src/multimedia/camera/qcameraexposure.cpp +++ b/src/multimedia/camera/qcameraexposure.cpp @@ -632,6 +632,16 @@ void QCameraExposure::setAutoShutterSpeed() \value ExposureBeach Beach exposure mode. \value ExposureLargeAperture Use larger aperture with small depth of field. \value ExposureSmallAperture Use smaller aperture. + \value ExposureAction Action mode. Since 5.5 + \value ExposureLandscape Landscape mode. Since 5.5 + \value ExposureNightPortrait Night portrait mode. Since 5.5 + \value ExposureTheatre Theatre mode. Since 5.5 + \value ExposureSunset Sunset mode. Since 5.5 + \value ExposureSteadyPhoto Steady photo mode. Since 5.5 + \value ExposureFireworks Fireworks mode. Since 5.5 + \value ExposureParty Party mode. Since 5.5 + \value ExposureCandlelight Candlelight mode. Since 5.5 + \value ExposureBarcode Barcode mode. Since 5.5 \value ExposureModeVendor The base value for device specific exposure modes. */ diff --git a/src/multimedia/camera/qcameraexposure.h b/src/multimedia/camera/qcameraexposure.h index 92eee6f..bb51fb6 100644 --- a/src/multimedia/camera/qcameraexposure.h +++ b/src/multimedia/camera/qcameraexposure.h @@ -85,6 +85,16 @@ public: ExposureBeach = 8, ExposureLargeAperture = 9, ExposureSmallAperture = 10, + ExposureAction = 11, + ExposureLandscape = 12, + ExposureNightPortrait = 13, + ExposureTheatre = 14, + ExposureSunset = 15, + ExposureSteadyPhoto = 16, + ExposureFireworks = 17, + ExposureParty = 18, + ExposureCandlelight = 19, + ExposureBarcode = 20, ExposureModeVendor = 1000 }; diff --git a/src/plugins/android/src/mediacapture/qandroidcameraexposurecontrol.cpp b/src/plugins/android/src/mediacapture/qandroidcameraexposurecontrol.cpp index 50a3759..707fb80 100644 --- a/src/plugins/android/src/mediacapture/qandroidcameraexposurecontrol.cpp +++ b/src/plugins/android/src/mediacapture/qandroidcameraexposurecontrol.cpp @@ -181,6 +181,36 @@ bool QAndroidCameraExposureControl::setValue(ExposureParameter parameter, const case QCameraExposure::ExposureNight: sceneMode = QLatin1String("night"); break; + case QCameraExposure::ExposureAction: + sceneMode = QLatin1String("action"); + break; + case QCameraExposure::ExposureLandscape: + sceneMode = QLatin1String("landscape"); + break; + case QCameraExposure::ExposureNightPortrait: + sceneMode = QLatin1String("night-portrait"); + break; + case QCameraExposure::ExposureTheatre: + sceneMode = QLatin1String("theatre"); + break; + case QCameraExposure::ExposureSunset: + sceneMode = QLatin1String("sunset"); + break; + case QCameraExposure::ExposureSteadyPhoto: + sceneMode = QLatin1String("steadyphoto"); + break; + case QCameraExposure::ExposureFireworks: + sceneMode = QLatin1String("fireworks"); + break; + case QCameraExposure::ExposureParty: + sceneMode = QLatin1String("party"); + break; + case QCameraExposure::ExposureCandlelight: + sceneMode = QLatin1String("candlelight"); + break; + case QCameraExposure::ExposureBarcode: + sceneMode = QLatin1String("barcode"); + break; default: sceneMode = QLatin1String("auto"); m_actualExposureMode = QCameraExposure::ExposureAuto; @@ -226,6 +256,26 @@ void QAndroidCameraExposureControl::onCameraOpened() m_supportedExposureModes << QVariant::fromValue(QCameraExposure::ExposureSnow); else if (sceneMode == QLatin1String("sports")) m_supportedExposureModes << QVariant::fromValue(QCameraExposure::ExposureSports); + else if (sceneMode == QLatin1String("action")) + m_supportedExposureModes << QVariant::fromValue(QCameraExposure::ExposureAction); + else if (sceneMode == QLatin1String("landscape")) + m_supportedExposureModes << QVariant::fromValue(QCameraExposure::ExposureLandscape); + else if (sceneMode == QLatin1String("night-portrait")) + m_supportedExposureModes << QVariant::fromValue(QCameraExposure::ExposureNightPortrait); + else if (sceneMode == QLatin1String("theatre")) + m_supportedExposureModes << QVariant::fromValue(QCameraExposure::ExposureTheatre); + else if (sceneMode == QLatin1String("sunset")) + m_supportedExposureModes << QVariant::fromValue(QCameraExposure::ExposureSunset); + else if (sceneMode == QLatin1String("steadyphoto")) + m_supportedExposureModes << QVariant::fromValue(QCameraExposure::ExposureSteadyPhoto); + else if (sceneMode == QLatin1String("fireworks")) + m_supportedExposureModes << QVariant::fromValue(QCameraExposure::ExposureFireworks); + else if (sceneMode == QLatin1String("party")) + m_supportedExposureModes << QVariant::fromValue(QCameraExposure::ExposureParty); + else if (sceneMode == QLatin1String("candlelight")) + m_supportedExposureModes << QVariant::fromValue(QCameraExposure::ExposureCandlelight); + else if (sceneMode == QLatin1String("barcode")) + m_supportedExposureModes << QVariant::fromValue(QCameraExposure::ExposureBarcode); } emit parameterRangeChanged(QCameraExposureControl::ExposureMode); } diff --git a/src/plugins/gstreamer/camerabin/camerabinexposure.cpp b/src/plugins/gstreamer/camerabin/camerabinexposure.cpp index 795fd42..be12ddc 100644 --- a/src/plugins/gstreamer/camerabin/camerabinexposure.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinexposure.cpp @@ -128,20 +128,44 @@ QVariant CameraBinExposure::actualValue(ExposureParameter parameter) const switch (sceneMode) { case GST_PHOTOGRAPHY_SCENE_MODE_PORTRAIT: - return QCameraExposure::ExposurePortrait; + return QVariant::fromValue(QCameraExposure::ExposurePortrait); case GST_PHOTOGRAPHY_SCENE_MODE_SPORT: - return QCameraExposure::ExposureSports; + return QVariant::fromValue(QCameraExposure::ExposureSports); case GST_PHOTOGRAPHY_SCENE_MODE_NIGHT: - return QCameraExposure::ExposureNight; + return QVariant::fromValue(QCameraExposure::ExposureNight); case GST_PHOTOGRAPHY_SCENE_MODE_MANUAL: - return QCameraExposure::ExposureManual; - case GST_PHOTOGRAPHY_SCENE_MODE_CLOSEUP: - //no direct mapping available so mapping to auto mode + return QVariant::fromValue(QCameraExposure::ExposureManual); case GST_PHOTOGRAPHY_SCENE_MODE_LANDSCAPE: - //no direct mapping available so mapping to auto mode + return QVariant::fromValue(QCameraExposure::ExposureLandscape); +#if GST_CHECK_VERSION(1, 2, 0) + case GST_PHOTOGRAPHY_SCENE_MODE_SNOW: + return QVariant::fromValue(QCameraExposure::ExposureSnow); + case GST_PHOTOGRAPHY_SCENE_MODE_BEACH: + return QVariant::fromValue(QCameraExposure::ExposureBeach); + case GST_PHOTOGRAPHY_SCENE_MODE_ACTION: + return QVariant::fromValue(QCameraExposure::ExposureAction); + case GST_PHOTOGRAPHY_SCENE_MODE_NIGHT_PORTRAIT: + return QVariant::fromValue(QCameraExposure::ExposureNightPortrait); + case GST_PHOTOGRAPHY_SCENE_MODE_THEATRE: + return QVariant::fromValue(QCameraExposure::ExposureTheatre); + case GST_PHOTOGRAPHY_SCENE_MODE_SUNSET: + return QVariant::fromValue(QCameraExposure::ExposureSunset); + case GST_PHOTOGRAPHY_SCENE_MODE_STEADY_PHOTO: + return QVariant::fromValue(QCameraExposure::ExposureSteadyPhoto); + case GST_PHOTOGRAPHY_SCENE_MODE_FIREWORKS: + return QVariant::fromValue(QCameraExposure::ExposureFireworks); + case GST_PHOTOGRAPHY_SCENE_MODE_PARTY: + return QVariant::fromValue(QCameraExposure::ExposureParty); + case GST_PHOTOGRAPHY_SCENE_MODE_CANDLELIGHT: + return QVariant::fromValue(QCameraExposure::ExposureCandlelight); + case GST_PHOTOGRAPHY_SCENE_MODE_BARCODE: + return QVariant::fromValue(QCameraExposure::ExposureBarcode); +#endif + //no direct mapping available so mapping to auto mode + case GST_PHOTOGRAPHY_SCENE_MODE_CLOSEUP: case GST_PHOTOGRAPHY_SCENE_MODE_AUTO: default: - return QCameraExposure::ExposureAuto; + return QVariant::fromValue(QCameraExposure::ExposureAuto); } } case QCameraExposureControl::MeteringMode: @@ -170,8 +194,9 @@ bool CameraBinExposure::setValue(ExposureParameter parameter, const QVariant& va break; case QCameraExposureControl::ExposureMode: { - QCameraExposure::ExposureMode mode = QCameraExposure::ExposureMode(value.toInt()); + QCameraExposure::ExposureMode mode = value.value(); GstPhotographySceneMode sceneMode; + gst_photography_get_scene_mode(m_session->photography(), &sceneMode); switch (mode) { @@ -190,6 +215,44 @@ bool CameraBinExposure::setValue(ExposureParameter parameter, const QVariant& va case QCameraExposure::ExposureAuto: sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_AUTO; break; + case QCameraExposure::ExposureLandscape: + sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_LANDSCAPE; + break; +#if GST_CHECK_VERSION(1, 2, 0) + case QCameraExposure::ExposureSnow: + sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_SNOW; + break; + case QCameraExposure::ExposureBeach: + sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_BEACH; + break; + case QCameraExposure::ExposureAction: + sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_ACTION; + break; + case QCameraExposure::ExposureNightPortrait: + sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_NIGHT_PORTRAIT; + break; + case QCameraExposure::ExposureTheatre: + sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_THEATRE; + break; + case QCameraExposure::ExposureSunset: + sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_SUNSET; + break; + case QCameraExposure::ExposureSteadyPhoto: + sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_STEADY_PHOTO; + break; + case QCameraExposure::ExposureFireworks: + sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_FIREWORKS; + break; + case QCameraExposure::ExposureParty: + sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_PARTY; + break; + case QCameraExposure::ExposureCandlelight: + sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_CANDLELIGHT; + break; + case QCameraExposure::ExposureBarcode: + sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_BARCODE; + break; +#endif default: break; } -- 2.7.4