From 2ec3645b729d4a9ccc3b4bfbf4d64c6def69b68f Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Thu, 5 Dec 2013 16:17:19 +1000 Subject: [PATCH] Fix configuration of camera settings in camerabin backend. Enable gstphotography interfaces if the compile check passes, and implement missing pieces of whitebalance and focus configuration. Change-Id: Icd24dfd148204f8d8218176593c3120427a13e1e Reviewed-by: John Brooks Reviewed-by: Yoann Lopes --- src/plugins/gstreamer/camerabin/camerabin.pro | 2 +- src/plugins/gstreamer/camerabin/camerabinfocus.cpp | 43 ++++++++++++++++++++-- .../camerabin/camerabinimageprocessing.cpp | 4 +- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/src/plugins/gstreamer/camerabin/camerabin.pro b/src/plugins/gstreamer/camerabin/camerabin.pro index 27c368e..e18da8e 100644 --- a/src/plugins/gstreamer/camerabin/camerabin.pro +++ b/src/plugins/gstreamer/camerabin/camerabin.pro @@ -58,7 +58,7 @@ maemo6 { CONFIG += have_gst_photography } -have_gst_photography { +config_gstreamer_photography { DEFINES += HAVE_GST_PHOTOGRAPHY HEADERS += \ diff --git a/src/plugins/gstreamer/camerabin/camerabinfocus.cpp b/src/plugins/gstreamer/camerabin/camerabinfocus.cpp index 2f69cad..ed5b483 100644 --- a/src/plugins/gstreamer/camerabin/camerabinfocus.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinfocus.cpp @@ -58,6 +58,8 @@ CameraBinFocus::CameraBinFocus(CameraBinSession *session) m_focusStatus(QCamera::Unlocked), m_focusZoneStatus(QCameraFocusZone::Selected) { + gst_photography_set_focus_mode(m_session->photography(), GST_PHOTOGRAPHY_FOCUS_MODE_AUTO); + connect(m_session, SIGNAL(stateChanged(QCamera::State)), this, SLOT(_q_handleCameraStateChange(QCamera::State))); } @@ -73,14 +75,49 @@ QCameraFocus::FocusModes CameraBinFocus::focusMode() const void CameraBinFocus::setFocusMode(QCameraFocus::FocusModes mode) { - if (isFocusModeSupported(mode)) { - m_focusMode = mode; + GstFocusMode photographyMode; + + switch (mode) { + case QCameraFocus::AutoFocus: + photographyMode = GST_PHOTOGRAPHY_FOCUS_MODE_AUTO; + break; + case QCameraFocus::HyperfocalFocus: + photographyMode = GST_PHOTOGRAPHY_FOCUS_MODE_HYPERFOCAL; + break; + case QCameraFocus::InfinityFocus: + photographyMode = GST_PHOTOGRAPHY_FOCUS_MODE_INFINITY; + break; + case QCameraFocus::ContinuousFocus: + photographyMode = GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_NORMAL; + break; + case QCameraFocus::MacroFocus: + photographyMode = GST_PHOTOGRAPHY_FOCUS_MODE_MACRO; + break; + default: + if (mode & QCameraFocus::AutoFocus) { + photographyMode = GST_PHOTOGRAPHY_FOCUS_MODE_AUTO; + break; + } else { + return; + } } + + if (gst_photography_set_focus_mode(m_session->photography(), photographyMode)) + m_focusMode = mode; } bool CameraBinFocus::isFocusModeSupported(QCameraFocus::FocusModes mode) const { - return mode & QCameraFocus::AutoFocus; + switch (mode) { + case QCameraFocus::AutoFocus: + case QCameraFocus::HyperfocalFocus: + case QCameraFocus::InfinityFocus: + case QCameraFocus::ContinuousFocus: + case QCameraFocus::MacroFocus: + return true; + default: + return mode & QCameraFocus::AutoFocus; + } } QCameraFocus::FocusPointMode CameraBinFocus::focusPointMode() const diff --git a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp index a714b28..fb98020 100644 --- a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp @@ -188,7 +188,9 @@ bool CameraBinImageProcessing::isParameterValueSupported(QCameraImageProcessingC QVariant CameraBinImageProcessing::parameter( QCameraImageProcessingControl::ProcessingParameter parameter) const { - if (m_values.contains(parameter)) + if (parameter == QCameraImageProcessingControl::WhiteBalancePreset) + return QVariant::fromValue(whiteBalanceMode()); + else if (m_values.contains(parameter)) return m_values.value(parameter); else return QVariant(); -- 2.7.4