Add additional exposure modes to QCameraExposure.
authorAndrew den Exter <andrew.den.exter@jollamobile.com>
Mon, 30 Jun 2014 05:59:10 +0000 (05:59 +0000)
committerYoann Lopes <yoann.lopes@theqtcompany.com>
Fri, 28 Nov 2014 15:41:30 +0000 (16:41 +0100)
[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 <yoann.lopes@theqtcompany.com>
src/imports/multimedia/qdeclarativecamera_p.h
src/imports/multimedia/qdeclarativecameraexposure.cpp
src/imports/multimedia/qdeclarativecameraexposure_p.h
src/multimedia/camera/qcameraexposure.cpp
src/multimedia/camera/qcameraexposure.h
src/plugins/android/src/mediacapture/qandroidcameraexposurecontrol.cpp
src/plugins/gstreamer/camerabin/camerabinexposure.cpp

index 113f01b..4bc6065 100644 (file)
@@ -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
     };
 
index cc793cd..3b1f920 100644 (file)
@@ -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
 */
index a8a53f0..83058a9 100644 (file)
@@ -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
     };
 
index 358e27b..9a74dbd 100644 (file)
@@ -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.
 */
 
index 92eee6f..bb51fb6 100644 (file)
@@ -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
     };
 
index 50a3759..707fb80 100644 (file)
@@ -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);
     }
index 795fd42..be12ddc 100644 (file)
@@ -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<QCameraExposure::ExposureMode>();
         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;
         }