summaryrefslogtreecommitdiffstats
path: root/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2015-12-10 16:35:30 +0300
committerYoann Lopes <yoann.lopes@theqtcompany.com>2015-12-10 16:07:26 +0000
commitdd2b63498a4dd3b064dc4e4acc770e4124ead937 (patch)
tree13963a165fc465591dac095053c3bd9a3117b5d0 /src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp
parentfcb511b6d6985820e0c049e6bd0f25e8715e9e3f (diff)
GStreamer: Add color balance and sharpening adjustments using V4L2
GStreamer's backend does not implements this features, therefore now is used the V4L2 interface for the contrast, saturation, brightness and the sharpening adjustments. The V4l2 interface works together with the GStreamer and covers the features which are not supported by the GStreamer. Change-Id: I995ed6cb096a29543fb80206384a92c13a1d1af2 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.cpp67
1 files changed, 57 insertions, 10 deletions
diff --git a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp
index d2ff89af0..2d1659900 100644
--- a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp
@@ -234,8 +234,22 @@ bool CameraBinImageProcessing::isParameterValueSupported(QCameraImageProcessingC
switch (parameter) {
case ContrastAdjustment:
case BrightnessAdjustment:
- case SaturationAdjustment:
- return GST_IS_COLOR_BALANCE(m_session->cameraBin()) && qAbs(value.toReal()) <= 1.0;
+ case SaturationAdjustment: {
+ const bool isGstColorBalanceValueSupported = GST_IS_COLOR_BALANCE(m_session->cameraBin())
+ && qAbs(value.toReal()) <= 1.0;
+#ifdef USE_V4L
+ if (!isGstColorBalanceValueSupported)
+ return m_v4lImageControl->isParameterValueSupported(parameter, value);
+#endif
+ return isGstColorBalanceValueSupported;
+ }
+ case SharpeningAdjustment: {
+#ifdef USE_V4L
+ return m_v4lImageControl->isParameterValueSupported(parameter, value);
+#else
+ return false;
+#endif
+ }
case WhiteBalancePreset: {
const QCameraImageProcessing::WhiteBalanceMode mode =
value.value<QCameraImageProcessing::WhiteBalanceMode>();
@@ -303,25 +317,58 @@ QVariant CameraBinImageProcessing::parameter(
}
#endif
return QVariant::fromValue(QCameraImageProcessing::ColorFilterNone);
- default:
- return m_values.contains(parameter)
+ default: {
+ const bool isGstParameterSupported = m_values.contains(parameter);
+#ifdef USE_V4L
+ if (!isGstParameterSupported) {
+ if (parameter == QCameraImageProcessingControl::BrightnessAdjustment
+ || parameter == QCameraImageProcessingControl::ContrastAdjustment
+ || parameter == QCameraImageProcessingControl::SaturationAdjustment
+ || parameter == QCameraImageProcessingControl::SharpeningAdjustment) {
+ return m_v4lImageControl->parameter(parameter);
+ }
+ }
+#endif
+ return isGstParameterSupported
? QVariant(m_values.value(parameter))
: QVariant();
}
+ }
}
void CameraBinImageProcessing::setParameter(QCameraImageProcessingControl::ProcessingParameter parameter,
const QVariant &value)
{
switch (parameter) {
- case ContrastAdjustment:
- setColorBalanceValue("contrast", value.toReal());
+ case ContrastAdjustment: {
+ if (!setColorBalanceValue("contrast", value.toReal())) {
+#ifdef USE_V4L
+ m_v4lImageControl->setParameter(parameter, value);
+#endif
+ }
+ }
break;
- case BrightnessAdjustment:
- setColorBalanceValue("brightness", value.toReal());
+ case BrightnessAdjustment: {
+ if (!setColorBalanceValue("brightness", value.toReal())) {
+#ifdef USE_V4L
+ m_v4lImageControl->setParameter(parameter, value);
+#endif
+ }
+ }
break;
- case SaturationAdjustment:
- setColorBalanceValue("saturation", value.toReal());
+ case SaturationAdjustment: {
+ if (!setColorBalanceValue("saturation", value.toReal())) {
+#ifdef USE_V4L
+ m_v4lImageControl->setParameter(parameter, value);
+#endif
+ }
+ }
+ break;
+ case SharpeningAdjustment: {
+#ifdef USE_V4L
+ m_v4lImageControl->setParameter(parameter, value);
+#endif
+ }
break;
case WhiteBalancePreset: {
if (!setWhiteBalanceMode(value.value<QCameraImageProcessing::WhiteBalanceMode>())) {