summaryrefslogtreecommitdiffstats
path: root/src/multimedia/platform/gstreamer/mediacapture
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-05-19 10:54:21 +0200
committerLars Knoll <lars.knoll@qt.io>2021-05-20 07:46:40 +0000
commit424614afde0ca3cb7479296c093689e98a0c6f13 (patch)
tree8e5b3bfd9d964482ef02e97513ed12fca3ccba52 /src/multimedia/platform/gstreamer/mediacapture
parent4262e48197d66e5ec215ba30b3dd2e4469694609 (diff)
Merge QPlatformCameraImageProcessing into QPlatformCamera
Clean up the API while wer're at it, and rename manualWhiteBalance to colorTemperature. Simplify the backend API now that we only have white balance and color temperature in there. Change-Id: Ied8702b0c68a8fbea08d314d96c0261049db5b4d Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/multimedia/platform/gstreamer/mediacapture')
-rw-r--r--src/multimedia/platform/gstreamer/mediacapture/qgstreamercamera.cpp219
-rw-r--r--src/multimedia/platform/gstreamer/mediacapture/qgstreamercamera_p.h22
-rw-r--r--src/multimedia/platform/gstreamer/mediacapture/qgstreamercameraimageprocessing.cpp312
-rw-r--r--src/multimedia/platform/gstreamer/mediacapture/qgstreamercameraimageprocessing_p.h111
4 files changed, 219 insertions, 445 deletions
diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercamera.cpp b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercamera.cpp
index 9ece4a09e..2ac1da4b4 100644
--- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercamera.cpp
+++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercamera.cpp
@@ -43,9 +43,13 @@
#include "qgstreamercameraimagecapture_p.h"
#include <private/qgstreamermediadevices_p.h>
#include <private/qgstreamerintegration_p.h>
-#include <private/qgstreamercameraimageprocessing_p.h>
#include <qmediacapturesession.h>
+#if QT_CONFIG(linux_v4l)
+#include <linux/videodev2.h>
+#include <private/qcore_unix_p.h>
+#endif
+
#include <QtCore/qdebug.h>
QGstreamerCamera::QGstreamerCamera(QCamera *camera)
@@ -60,8 +64,6 @@ QGstreamerCamera::QGstreamerCamera(QCamera *camera)
gstCamera.link(gstDecode, gstVideoConvert, gstVideoScale);
gstCameraBin.addGhostPad(gstVideoScale, "src");
-
- imageProcessing = new QGstreamerImageProcessing(this);
}
QGstreamerCamera::~QGstreamerCamera() = default;
@@ -125,8 +127,7 @@ void QGstreamerCamera::setCamera(const QCameraInfo &camera)
gstPipeline.setStateSync(state);
}
- //m_session->cameraChanged();
- imageProcessing->update();
+ updateCameraProperties();
}
void QGstreamerCamera::setCameraFormatInternal(const QCameraFormat &format)
@@ -183,17 +184,17 @@ void QGstreamerCamera::setCaptureSession(QPlatformMediaCaptureSession *session)
// is this enough?
}
-QPlatformCameraImageProcessing *QGstreamerCamera::imageProcessingControl()
+void QGstreamerCamera::updateCameraProperties()
{
- return imageProcessing;
-}
+#if QT_CONFIG(linux_v4l)
+ if (isV4L2Camera())
+ initV4L2Controls();
+#endif
+#if QT_CONFIG(gstreamer_photography)
+ if (auto *p = photography())
+ gst_photography_set_white_balance_mode(p, GST_PHOTOGRAPHY_WB_MODE_AUTO);
+#endif
-GstColorBalance *QGstreamerCamera::colorBalance() const
-{
- if (!gstCamera.isNull() && GST_IS_COLOR_BALANCE(gstCamera.element()))
- return GST_COLOR_BALANCE(gstCamera.element());
- // ### Add support for manual/SW color balancing using the gstreamer colorbalance element
- return nullptr;
}
#if QT_CONFIG(gstreamer_photography)
@@ -405,4 +406,194 @@ float QGstreamerCamera::shutterSpeed() const
}
return -1;
}
+
+bool QGstreamerCamera::isWhiteBalanceModeSupported(QCamera::WhiteBalanceMode mode) const
+{
+ if (mode == QCamera::WhiteBalanceAuto)
+ return true;
+
+#if QT_CONFIG(linux_v4l)
+ if (isV4L2Camera()) {
+ if (v4l2AutoWhiteBalanceSupported && v4l2ColorTemperatureSupported)
+ return true;
+ }
+#endif
+#if QT_CONFIG(gstreamer_photography)
+ if (photography()) {
+ switch (mode) {
+ case QCamera::WhiteBalanceAuto:
+ case QCamera::WhiteBalanceSunlight:
+ case QCamera::WhiteBalanceCloudy:
+ case QCamera::WhiteBalanceShade:
+ case QCamera::WhiteBalanceSunset:
+ case QCamera::WhiteBalanceTungsten:
+ case QCamera::WhiteBalanceFluorescent:
+ return true;
+ case QCamera::WhiteBalanceManual: {
+#if GST_CHECK_VERSION(1, 18, 0)
+ GstPhotographyInterface *iface = GST_PHOTOGRAPHY_GET_INTERFACE(p);
+ if (iface->set_color_temperature && iface->get_color_temperature)
+ return true;
+#endif
+ break;
+ }
+ default:
+ break;
+ }
+ }
+#endif
+
+ return mode == QCamera::WhiteBalanceAuto;
+}
+
+void QGstreamerCamera::setWhiteBalanceMode(QCamera::WhiteBalanceMode mode)
+{
+ Q_ASSERT(isWhiteBalanceModeSupported(mode));
+
+#if QT_CONFIG(gstreamer_photography)
+ if (auto *p = photography()) {
+ GstPhotographyWhiteBalanceMode gstMode = GST_PHOTOGRAPHY_WB_MODE_AUTO;
+ switch (mode) {
+ case QCamera::WhiteBalanceSunlight:
+ gstMode = GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT;
+ break;
+ case QCamera::WhiteBalanceCloudy:
+ gstMode = GST_PHOTOGRAPHY_WB_MODE_CLOUDY;
+ break;
+ case QCamera::WhiteBalanceShade:
+ gstMode = GST_PHOTOGRAPHY_WB_MODE_SHADE;
+ break;
+ case QCamera::WhiteBalanceSunset:
+ gstMode = GST_PHOTOGRAPHY_WB_MODE_SUNSET;
+ break;
+ case QCamera::WhiteBalanceTungsten:
+ gstMode = GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN;
+ break;
+ case QCamera::WhiteBalanceFluorescent:
+ gstMode = GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT;
+ break;
+ case QCamera::WhiteBalanceAuto:
+ default:
+ break;
+ }
+ if (gst_photography_set_white_balance_mode(p, gstMode)) {
+ whiteBalanceModeChanged(mode);
+ return;
+ }
+ } else
+#endif
+
+ if (isV4L2Camera()) {
+ int temperature = colorTemperatureForWhiteBalance(mode);
+ int t = setV4L2ColorTemperature(temperature);
+ if (t == 0)
+ mode = QCamera::WhiteBalanceAuto;
+ whiteBalanceModeChanged(mode);
+ }
+}
+
+void QGstreamerCamera::setColorTemperature(int temperature)
+{
+ if (temperature == 0) {
+ setWhiteBalanceMode(QCamera::WhiteBalanceAuto);
+ return;
+ }
+
+ Q_ASSERT(isWhiteBalanceModeSupported(QCamera::WhiteBalanceManual));
+
+#if QT_CONFIG(gstreamer_photography) && GST_CHECK_VERSION(1, 18, 0)
+ if (auto *p = photography()) {
+ GstPhotographyInterface *iface = GST_PHOTOGRAPHY_GET_INTERFACE(p);
+ Q_ASSERT(iface->set_color_temperature);
+ iface->set_color_temperature(p, temperature);
+ return;
+ }
+#endif
+
+ if (isV4L2Camera()) {
+ int t = setV4L2ColorTemperature(temperature);
+ if (t)
+ colorTemperatureChanged(t);
+ }
+}
+
+#if QT_CONFIG(linux_v4l)
+void QGstreamerCamera::initV4L2Controls()
+{
+ v4l2AutoWhiteBalanceSupported = false;
+ v4l2ColorTemperatureSupported = false;
+
+ const QString deviceName = v4l2Device();
+ Q_ASSERT(!deviceName.isEmpty());
+
+ const int fd = qt_safe_open(deviceName.toLocal8Bit().constData(), O_RDONLY);
+ if (fd == -1) {
+ qWarning() << "Unable to open the camera" << deviceName
+ << "for read to query the parameter info:" << qt_error_string(errno);
+ return;
+ }
+
+ struct v4l2_queryctrl queryControl;
+ ::memset(&queryControl, 0, sizeof(queryControl));
+ queryControl.id = V4L2_CID_AUTO_WHITE_BALANCE;
+
+ if (::ioctl(fd, VIDIOC_QUERYCTRL, &queryControl) == 0) {
+ v4l2AutoWhiteBalanceSupported = true;
+ struct v4l2_control control;
+ control.id = V4L2_CID_WHITE_BALANCE_TEMPERATURE;
+ control.value = true;
+ ::ioctl(fd, VIDIOC_S_CTRL, &control);
+ }
+
+ ::memset(&queryControl, 0, sizeof(queryControl));
+ queryControl.id = V4L2_CID_WHITE_BALANCE_TEMPERATURE;
+ if (::ioctl(fd, VIDIOC_QUERYCTRL, &queryControl) == 0) {
+ v4l2MinColorTemp = queryControl.minimum;
+ v4l2MaxColorTemp = queryControl.maximum;
+ v4l2ColorTemperatureSupported = true;
+ }
+
+ qt_safe_close(fd);
+
+}
+
+int QGstreamerCamera::setV4L2ColorTemperature(int temperature)
+{
+ struct v4l2_control control;
+ ::memset(&control, 0, sizeof(control));
+
+ const int fd = qt_safe_open(v4l2Device().toLocal8Bit().constData(), O_RDONLY);
+ if (fd == -1) {
+ qWarning() << "Unable to open the camera" << v4l2Device()
+ << "for read to get the parameter value:" << qt_error_string(errno);
+ return 0;
+ }
+
+ if (v4l2AutoWhiteBalanceSupported) {
+ control.id = V4L2_CID_AUTO_WHITE_BALANCE;
+ control.value = temperature == 0 ? true : false;
+ if (::ioctl(fd, VIDIOC_S_CTRL, &control) != 0) {
+ qWarning() << "Unable to set the V4L2 AUTO_WHITE_BALANCE property" << qt_error_string(errno);
+ }
+ } else if (temperature == 0) {
+ temperature = 5600;
+ }
+
+ if (temperature != 0 && v4l2ColorTemperatureSupported) {
+ temperature = qBound(v4l2MinColorTemp, temperature, v4l2MaxColorTemp);
+ control.id = V4L2_CID_WHITE_BALANCE_TEMPERATURE;
+ control.value = qBound(v4l2MinColorTemp, temperature, v4l2MaxColorTemp);
+ if (::ioctl(fd, VIDIOC_S_CTRL, &control) != 0) {
+ qWarning() << "Unable to set the V4L2 AUTO_WHITE_BALANCE property" << qt_error_string(errno);
+ temperature = 0;
+ }
+ } else {
+ temperature = 0;
+ }
+
+ qt_safe_close(fd);
+ return temperature;
+}
+#endif
+
#endif
diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercamera_p.h b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercamera_p.h
index 2397cfa84..54064e399 100644
--- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercamera_p.h
+++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercamera_p.h
@@ -56,10 +56,8 @@
#include <private/qplatformcamera_p.h>
#include "qgstreamermediacapture_p.h"
#include <private/qgst_p.h>
-#include <gst/video/colorbalance.h>
QT_BEGIN_NAMESPACE
-class QGstreamerImageProcessing;
class QGstreamerCamera : public QPlatformCamera
{
@@ -80,8 +78,6 @@ public:
QGstElement gstElement() const { return gstCameraBin.element(); }
void setPipeline(const QGstPipeline &pipeline) { gstPipeline = pipeline; }
- QPlatformCameraImageProcessing *imageProcessingControl() override;
-
#if QT_CONFIG(gstreamer_photography)
GstPhotography *photography() const;
@@ -100,16 +96,26 @@ public:
void setManualShutterSpeed(float) override;
float shutterSpeed() const override;
#endif
+ bool isWhiteBalanceModeSupported(QCamera::WhiteBalanceMode mode) const override;
+ void setWhiteBalanceMode(QCamera::WhiteBalanceMode mode) override;
+ void setColorTemperature(int temperature) override;
QString v4l2Device() const { return m_v4l2Device; }
bool isV4L2Camera() const { return !m_v4l2Device.isEmpty(); }
- GstColorBalance *colorBalance() const;
-
private:
- QGstreamerMediaCapture *m_session = nullptr;
+ void updateCameraProperties();
+#if QT_CONFIG(linux_v4l)
+ void initV4L2Controls();
+ int setV4L2ColorTemperature(int temperature);
+
+ bool v4l2AutoWhiteBalanceSupported = false;
+ bool v4l2ColorTemperatureSupported = false;
+ qint32 v4l2MinColorTemp = 5600; // Daylight...
+ qint32 v4l2MaxColorTemp = 5600;
+#endif
- QGstreamerImageProcessing *imageProcessing = nullptr;
+ QGstreamerMediaCapture *m_session = nullptr;
QCameraInfo m_cameraInfo;
diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameraimageprocessing.cpp b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameraimageprocessing.cpp
deleted file mode 100644
index 8a692b866..000000000
--- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameraimageprocessing.cpp
+++ /dev/null
@@ -1,312 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Copyright (C) 2016 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamercameraimageprocessing_p.h"
-#include "qgstreamercamera_p.h"
-
-#include <gst/video/colorbalance.h>
-
-#if QT_CONFIG(linux_v4l)
-#include <linux/videodev2.h>
-#include <private/qcore_unix_p.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-QGstreamerImageProcessing::QGstreamerImageProcessing(QGstreamerCamera *camera)
- : QPlatformCameraImageProcessing(camera)
- , m_camera(camera)
-{
-#if QT_CONFIG(linux_v4l)
- if (m_camera->isV4L2Camera())
- initV4L2Controls();
-#endif
-#if QT_CONFIG(gstreamer_photography)
- if (auto *photography = m_camera->photography())
- gst_photography_set_white_balance_mode(photography, GST_PHOTOGRAPHY_WB_MODE_AUTO);
-#endif
-}
-
-QGstreamerImageProcessing::~QGstreamerImageProcessing()
-{
-}
-
-bool QGstreamerImageProcessing::setWhiteBalanceMode(QCamera::WhiteBalanceMode mode)
-{
- if (!isWhiteBalanceModeSupported(mode))
- return false;
-#if QT_CONFIG(gstreamer_photography)
- if (auto *photography = m_camera->photography()) {
- GstPhotographyWhiteBalanceMode gstMode = GST_PHOTOGRAPHY_WB_MODE_AUTO;
- switch (mode) {
- case QCamera::WhiteBalanceSunlight:
- gstMode = GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT;
- break;
- case QCamera::WhiteBalanceCloudy:
- gstMode = GST_PHOTOGRAPHY_WB_MODE_CLOUDY;
- break;
- case QCamera::WhiteBalanceShade:
- gstMode = GST_PHOTOGRAPHY_WB_MODE_SHADE;
- break;
- case QCamera::WhiteBalanceSunset:
- gstMode = GST_PHOTOGRAPHY_WB_MODE_SUNSET;
- break;
- case QCamera::WhiteBalanceTungsten:
- gstMode = GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN;
- break;
- case QCamera::WhiteBalanceFluorescent:
- gstMode = GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT;
- break;
- case QCamera::WhiteBalanceAuto:
- default:
- break;
- }
- if (gst_photography_set_white_balance_mode(photography, gstMode)) {
- m_whiteBalanceMode = mode;
- return true;
- }
- }
-#endif
-
- return false;
-}
-
-bool QGstreamerImageProcessing::isWhiteBalanceModeSupported(QCamera::WhiteBalanceMode mode) const
-{
-#if QT_CONFIG(linux_v4l)
- if (m_camera->isV4L2Camera()) {
- if (mode == QCamera::WhiteBalanceAuto)
- return true;
- if (v4l2AutoWhiteBalanceSupported && mode == QCamera::WhiteBalanceManual)
- return true;
- // ### Could emulate the others through hardcoded color temperatures
- return false;
- }
-#endif
-#if QT_CONFIG(gstreamer_photography)
- if (m_camera->photography()) {
- switch (mode) {
- case QCamera::WhiteBalanceAuto:
- case QCamera::WhiteBalanceSunlight:
- case QCamera::WhiteBalanceCloudy:
- case QCamera::WhiteBalanceShade:
- case QCamera::WhiteBalanceSunset:
- case QCamera::WhiteBalanceTungsten:
- case QCamera::WhiteBalanceFluorescent:
- return true;
- default:
- break;
- }
- }
-#endif
-
- return mode == QCamera::WhiteBalanceAuto;
-}
-
-
-bool QGstreamerImageProcessing::isParameterSupported(QPlatformCameraImageProcessing::ProcessingParameter parameter) const
-{
-#if QT_CONFIG(linux_v4l)
- if (m_camera->isV4L2Camera()) {
- switch (parameter) {
- case WhiteBalancePreset:
- return v4l2AutoWhiteBalanceSupported;
- case ColorTemperature:
- return v4l2ColorTemperatureSupported;
- default:
- // v4l2 doesn't have photography
- return false;
- }
- }
-#endif
-
-#if QT_CONFIG(gstreamer_photography)
- if (m_camera->photography()) {
- if (parameter == QPlatformCameraImageProcessing::WhiteBalancePreset)
- return true;
- }
-#endif
-
- return false;
-}
-
-bool QGstreamerImageProcessing::isParameterValueSupported(QPlatformCameraImageProcessing::ProcessingParameter parameter, const QVariant &value) const
-{
- switch (parameter) {
- case ColorTemperature: {
-#if QT_CONFIG(linux_v4l)
- if (m_camera->isV4L2Camera()) {
- int temp = value.toInt();
- return v4l2ColorTemperatureSupported && v4l2MinColorTemp <= temp && temp <= v4l2MaxColorTemp;
- }
-#endif
- return false;
- }
- case WhiteBalancePreset:
- return isWhiteBalanceModeSupported(value.value<QCamera::WhiteBalanceMode>());
- default:
- break;
- }
-
- return false;
-}
-
-void QGstreamerImageProcessing::setParameter(QPlatformCameraImageProcessing::ProcessingParameter parameter, const QVariant &value)
-{
-#if QT_CONFIG(linux_v4l)
- if (m_camera->isV4L2Camera()) {
- if (setV4L2Param(parameter, value))
- return;
- }
-#endif
-
- switch (parameter) {
- case WhiteBalancePreset:
- setWhiteBalanceMode(value.value<QCamera::WhiteBalanceMode>());
- break;
- case QPlatformCameraImageProcessing::ColorTemperature:
- break;
- default:
- break;
- }
-}
-
-void QGstreamerImageProcessing::update()
-{
-#if QT_CONFIG(linux_v4l)
- initV4L2Controls();
-#endif
-}
-
-#if QT_CONFIG(linux_v4l)
-void QGstreamerImageProcessing::initV4L2Controls()
-{
- v4l2AutoWhiteBalanceSupported = false;
- v4l2ColorTemperatureSupported = false;
-
- const QString deviceName = m_camera->v4l2Device();
- if (deviceName.isEmpty())
- return;
- isV4L2Device = true;
-
- const int fd = qt_safe_open(deviceName.toLocal8Bit().constData(), O_RDONLY);
- if (fd == -1) {
- qWarning() << "Unable to open the camera" << deviceName
- << "for read to query the parameter info:" << qt_error_string(errno);
- return;
- }
-
- struct v4l2_queryctrl queryControl;
- ::memset(&queryControl, 0, sizeof(queryControl));
- queryControl.id = V4L2_CID_AUTO_WHITE_BALANCE;
-
- if (::ioctl(fd, VIDIOC_QUERYCTRL, &queryControl) == 0) {
- v4l2AutoWhiteBalanceSupported = true;
- struct v4l2_control control;
- control.id = V4L2_CID_WHITE_BALANCE_TEMPERATURE;
- control.value = true;
- ::ioctl(fd, VIDIOC_S_CTRL, &control);
- }
-
- ::memset(&queryControl, 0, sizeof(queryControl));
- queryControl.id = V4L2_CID_WHITE_BALANCE_TEMPERATURE;
- if (::ioctl(fd, VIDIOC_QUERYCTRL, &queryControl) == 0) {
- v4l2MinColorTemp = queryControl.minimum;
- v4l2MaxColorTemp = queryControl.maximum;
- v4l2CurrentColorTemp = queryControl.default_value;
- v4l2ColorTemperatureSupported = true;
- struct v4l2_control control;
- control.id = V4L2_CID_WHITE_BALANCE_TEMPERATURE;
- control.value = 0;
- if (::ioctl(fd, VIDIOC_G_CTRL, &control) == 0)
- v4l2CurrentColorTemp = control.value;
- }
-
- qt_safe_close(fd);
-
-}
-
-bool QGstreamerImageProcessing::setV4L2Param(ProcessingParameter parameter, const QVariant &value)
-{
- struct v4l2_control control;
- ::memset(&control, 0, sizeof(control));
-
- switch (parameter) {
- case QPlatformCameraImageProcessing::WhiteBalancePreset: {
- if (!v4l2AutoWhiteBalanceSupported)
- return false;
- const QCamera::WhiteBalanceMode mode = value.value<QCamera::WhiteBalanceMode>();
- if (mode != QCamera::WhiteBalanceAuto && mode != QCamera::WhiteBalanceManual)
- return false;
- control.id = V4L2_CID_AUTO_WHITE_BALANCE;
- control.value = (mode == QCamera::WhiteBalanceAuto);
- m_whiteBalanceMode = mode;
- break;
- }
- case QPlatformCameraImageProcessing::ColorTemperature:
- control.id = V4L2_CID_WHITE_BALANCE_TEMPERATURE;
- control.value = qBound(v4l2MinColorTemp, value.toInt(), v4l2MaxColorTemp);
- break;
- default:
- return false;
- }
-
- if (!control.id)
- return false;
-
- const int fd = qt_safe_open(m_camera->v4l2Device().toLocal8Bit().constData(), O_RDONLY);
- if (fd == -1) {
- qWarning() << "Unable to open the camera" << m_camera->v4l2Device()
- << "for read to get the parameter value:" << qt_error_string(errno);
- return false;
- }
-
- if (::ioctl(fd, VIDIOC_S_CTRL, &control) != 0) {
- qWarning() << "Unable to set the parameter value:" << parameter << ":" << qt_error_string(errno);
- return false;
- }
-
- qt_safe_close(fd);
- return true;
-}
-#endif
-
-
-QT_END_NAMESPACE
diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameraimageprocessing_p.h b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameraimageprocessing_p.h
deleted file mode 100644
index 171cb060f..000000000
--- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameraimageprocessing_p.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERIMAGEPROCESSING_P_H
-#define QGSTREAMERIMAGEPROCESSING_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtMultimedia/private/qtmultimediaglobal_p.h>
-#include <qcamera.h>
-#include <private/qplatformcameraimageprocessing_p.h>
-
-#include <private/qgst_p.h>
-#include <gst/video/colorbalance.h>
-
-#if QT_CONFIG(gstreamer_photography)
-# include <gst/interfaces/photography.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-#if QT_CONFIG(linux_v4l)
-class QGstreamerImageProcessingV4L2;
-#endif
-
-class QGstreamerCamera;
-
-class QGstreamerImageProcessing : public QPlatformCameraImageProcessing
-{
- Q_OBJECT
-
-public:
- QGstreamerImageProcessing(QGstreamerCamera *camera);
- virtual ~QGstreamerImageProcessing();
-
- bool setWhiteBalanceMode(QCamera::WhiteBalanceMode mode);
- bool isWhiteBalanceModeSupported(QCamera::WhiteBalanceMode mode) const;
-
- bool isParameterSupported(ProcessingParameter) const override;
- bool isParameterValueSupported(ProcessingParameter parameter, const QVariant &value) const override;
- void setParameter(ProcessingParameter parameter, const QVariant &value) override;
-
- void update();
-
-private:
- QGstreamerCamera *m_camera;
- QCamera::WhiteBalanceMode m_whiteBalanceMode = QCamera::WhiteBalanceAuto;
-
-#if QT_CONFIG(linux_v4l)
- bool isV4L2Device = false;
- void initV4L2Controls();
- bool setV4L2Param(ProcessingParameter parameter, const QVariant &value);
-
-public:
-private:
- bool v4l2AutoWhiteBalanceSupported = false;
- bool v4l2ColorTemperatureSupported = false;
- qint32 v4l2MinColorTemp = 5600; // Daylight...
- qint32 v4l2MaxColorTemp = 5600;
- qint32 v4l2CurrentColorTemp = 5600;
-#endif
-};
-
-QT_END_NAMESPACE
-
-#endif // QGSTREAMERIMAGEPROCESSING_P_H