diff options
author | Andrew den Exter <andrew.den.exter@qinetic.com.au> | 2014-11-25 09:22:23 +1000 |
---|---|---|
committer | Andrew den Exter <andrew.den.exter@qinetic.com.au> | 2014-11-28 06:07:44 +0100 |
commit | 9932feec63994d87c586a07513e692545ba0db9e (patch) | |
tree | 4bdc7cd2b3167ee0306a52432f74da6632fa1573 /src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp | |
parent | dc2fec1bd8974d695d9c22d4b958a73bbe9ff1a2 (diff) |
Implement exposure and whitebalance lock for gstreamer camera.
Change-Id: I58277d69c18ad2e31cad719a2dd6361c0c2d7e98
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
Diffstat (limited to 'src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp')
-rw-r--r-- | src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp | 56 |
1 files changed, 40 insertions, 16 deletions
diff --git a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp index 811225f68..5e4b67b29 100644 --- a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp @@ -44,15 +44,17 @@ QT_BEGIN_NAMESPACE CameraBinImageProcessing::CameraBinImageProcessing(CameraBinSession *session) :QCameraImageProcessingControl(session), - m_session(session) + m_session(session), + m_whiteBalanceMode(QCameraImageProcessing::WhiteBalanceAuto) { #ifdef HAVE_GST_PHOTOGRAPHY - m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_AUTO] = QCameraImageProcessing::WhiteBalanceAuto; - m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT] = QCameraImageProcessing::WhiteBalanceSunlight; - m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_CLOUDY] = QCameraImageProcessing::WhiteBalanceCloudy; - m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_SUNSET] = QCameraImageProcessing::WhiteBalanceSunset; - m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN] = QCameraImageProcessing::WhiteBalanceTungsten; - m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT] = QCameraImageProcessing::WhiteBalanceFluorescent; + m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_AUTO] = QCameraImageProcessing::WhiteBalanceAuto; + m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT] = QCameraImageProcessing::WhiteBalanceSunlight; + m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_CLOUDY] = QCameraImageProcessing::WhiteBalanceCloudy; + m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_SUNSET] = QCameraImageProcessing::WhiteBalanceSunset; + m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN] = QCameraImageProcessing::WhiteBalanceTungsten; + m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT] = QCameraImageProcessing::WhiteBalanceFluorescent; + unlockWhiteBalance(); #endif updateColorBalanceValues(); @@ -129,20 +131,23 @@ bool CameraBinImageProcessing::setColorBalanceValue(const QString& channel, qrea QCameraImageProcessing::WhiteBalanceMode CameraBinImageProcessing::whiteBalanceMode() const { -#ifdef HAVE_GST_PHOTOGRAPHY - GstPhotographyWhiteBalanceMode wbMode; - gst_photography_get_white_balance_mode(m_session->photography(), &wbMode); - return m_mappedWbValues[wbMode]; -#else - return QCameraImageProcessing::WhiteBalanceAuto; -#endif + return m_whiteBalanceMode; } void CameraBinImageProcessing::setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode mode) { #ifdef HAVE_GST_PHOTOGRAPHY - if (isWhiteBalanceModeSupported(mode)) - gst_photography_set_white_balance_mode(m_session->photography(), m_mappedWbValues.key(mode)); + if (isWhiteBalanceModeSupported(mode)) { + m_whiteBalanceMode = mode; +#if GST_CHECK_VERSION(1, 2, 0) + GstPhotographyWhiteBalanceMode currentMode; + if (gst_photography_get_white_balance_mode(m_session->photography(), ¤tMode) + && currentMode != GST_PHOTOGRAPHY_WB_MODE_MANUAL) +#endif + { + unlockWhiteBalance(); + } + } #else Q_UNUSED(mode); #endif @@ -215,4 +220,23 @@ void CameraBinImageProcessing::setParameter(QCameraImageProcessingControl::Proce updateColorBalanceValues(); } +#ifdef HAVE_GST_PHOTOGRAPHY +void CameraBinImageProcessing::lockWhiteBalance() +{ +#if GST_CHECK_VERSION(1, 2, 0) + if (GstPhotography *photography = m_session->photography()) { + gst_photography_set_white_balance_mode(photography, GST_PHOTOGRAPHY_WB_MODE_MANUAL); + } +#endif +} + +void CameraBinImageProcessing::unlockWhiteBalance() +{ + if (GstPhotography *photography = m_session->photography()) { + gst_photography_set_white_balance_mode( + photography, m_mappedWbValues.key(m_whiteBalanceMode)); + } +} +#endif + QT_END_NAMESPACE |