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 <yoann.lopes@theqtcompany.com>
This commit is contained in:
Andrew den Exter
2014-06-30 05:59:10 +00:00
committed by Yoann Lopes
parent 25ad679c25
commit 4bdf1561f4
7 changed files with 172 additions and 9 deletions

View 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);
}

View 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;
}