summaryrefslogtreecommitdiffstats
path: root/src/plugins/gstreamer/camerabin
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/gstreamer/camerabin')
-rw-r--r--src/plugins/gstreamer/camerabin/camerabin.json4
-rw-r--r--src/plugins/gstreamer/camerabin/camerabin.pro85
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinaudioencoder.cpp165
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinaudioencoder.h109
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp76
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h74
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincapturedestination.cpp76
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincapturedestination.h70
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincontainer.cpp152
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincontainer.h94
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincontrol.cpp309
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincontrol.h101
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinexposure.cpp285
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinexposure.h75
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinflash.cpp109
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinflash.h73
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinfocus.cpp540
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinfocus.h134
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp380
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimagecapture.h123
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimageencoder.cpp88
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimageencoder.h86
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp441
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimageprocessing.h108
-rw-r--r--src/plugins/gstreamer/camerabin/camerabininfocontrol.cpp69
-rw-r--r--src/plugins/gstreamer/camerabin/camerabininfocontrol.h65
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinlocks.cpp259
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinlocks.h98
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinmetadata.cpp234
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinmetadata.h71
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinrecorder.cpp298
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinrecorder.h94
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp242
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinresourcepolicy.h95
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinservice.cpp271
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinservice.h104
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp163
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinserviceplugin.h89
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinsession.cpp1587
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinsession.h291
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinv4limageprocessing.cpp316
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinv4limageprocessing.h90
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp239
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinvideoencoder.h109
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinviewfindersettings.cpp118
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinviewfindersettings.h67
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.cpp73
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.h67
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinzoom.cpp147
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinzoom.h78
50 files changed, 0 insertions, 9091 deletions
diff --git a/src/plugins/gstreamer/camerabin/camerabin.json b/src/plugins/gstreamer/camerabin/camerabin.json
deleted file mode 100644
index 3246b4683..000000000
--- a/src/plugins/gstreamer/camerabin/camerabin.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "Keys": ["gstreamercamerabin"],
- "Services": ["org.qt-project.qt.camera"]
-}
diff --git a/src/plugins/gstreamer/camerabin/camerabin.pro b/src/plugins/gstreamer/camerabin/camerabin.pro
deleted file mode 100644
index 183ddf2d4..000000000
--- a/src/plugins/gstreamer/camerabin/camerabin.pro
+++ /dev/null
@@ -1,85 +0,0 @@
-TARGET = gstcamerabin
-
-QT += multimedia-private
-
-include(../common.pri)
-
-INCLUDEPATH += $$PWD \
- $${SOURCE_DIR}/src/multimedia
-
-INCLUDEPATH += camerabin
-
-
-HEADERS += \
- $$PWD/camerabinserviceplugin.h \
- $$PWD/camerabinservice.h \
- $$PWD/camerabinsession.h \
- $$PWD/camerabincontrol.h \
- $$PWD/camerabinaudioencoder.h \
- $$PWD/camerabinimageencoder.h \
- $$PWD/camerabinrecorder.h \
- $$PWD/camerabincontainer.h \
- $$PWD/camerabinimagecapture.h \
- $$PWD/camerabinzoom.h \
- $$PWD/camerabinimageprocessing.h \
- $$PWD/camerabinmetadata.h \
- $$PWD/camerabinvideoencoder.h \
- $$PWD/camerabinresourcepolicy.h \
- $$PWD/camerabincapturedestination.h \
- $$PWD/camerabincapturebufferformat.h \
- $$PWD/camerabinviewfindersettings.h \
- $$PWD/camerabinviewfindersettings2.h \
- $$PWD/camerabininfocontrol.h
-
-SOURCES += \
- $$PWD/camerabinserviceplugin.cpp \
- $$PWD/camerabinservice.cpp \
- $$PWD/camerabinsession.cpp \
- $$PWD/camerabincontrol.cpp \
- $$PWD/camerabinaudioencoder.cpp \
- $$PWD/camerabincontainer.cpp \
- $$PWD/camerabinimagecapture.cpp \
- $$PWD/camerabinimageencoder.cpp \
- $$PWD/camerabinzoom.cpp \
- $$PWD/camerabinimageprocessing.cpp \
- $$PWD/camerabinmetadata.cpp \
- $$PWD/camerabinrecorder.cpp \
- $$PWD/camerabinvideoencoder.cpp \
- $$PWD/camerabinresourcepolicy.cpp \
- $$PWD/camerabincapturedestination.cpp \
- $$PWD/camerabinviewfindersettings.cpp \
- $$PWD/camerabinviewfindersettings2.cpp \
- $$PWD/camerabincapturebufferformat.cpp \
- $$PWD/camerabininfocontrol.cpp
-
-qtConfig(gstreamer_photography) {
- HEADERS += \
- $$PWD/camerabinfocus.h \
- $$PWD/camerabinexposure.h \
- $$PWD/camerabinflash.h \
- $$PWD/camerabinlocks.h
-
- SOURCES += \
- $$PWD/camerabinexposure.cpp \
- $$PWD/camerabinflash.cpp \
- $$PWD/camerabinfocus.cpp \
- $$PWD/camerabinlocks.cpp
-
- QMAKE_USE += gstreamer_photography
- DEFINES += GST_USE_UNSTABLE_API #prevents warnings because of unstable photography API
-}
-
-qtConfig(linux_v4l) {
- HEADERS += \
- $$PWD/camerabinv4limageprocessing.h
-
- SOURCES += \
- $$PWD/camerabinv4limageprocessing.cpp
-}
-
-OTHER_FILES += \
- camerabin.json
-
-PLUGIN_TYPE = mediaservice
-PLUGIN_CLASS_NAME = CameraBinServicePlugin
-load(qt_plugin)
diff --git a/src/plugins/gstreamer/camerabin/camerabinaudioencoder.cpp b/src/plugins/gstreamer/camerabin/camerabinaudioencoder.cpp
deleted file mode 100644
index e5e253194..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinaudioencoder.cpp
+++ /dev/null
@@ -1,165 +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$
-**
-****************************************************************************/
-
-#include <QtMultimedia/private/qtmultimediaglobal_p.h>
-#include "camerabinaudioencoder.h"
-#include "camerabincontainer.h"
-#include <private/qgstutils_p.h>
-
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-CameraBinAudioEncoder::CameraBinAudioEncoder(QObject *parent)
- :QAudioEncoderSettingsControl(parent)
-#if QT_CONFIG(gstreamer_encodingprofiles)
- , m_codecs(QGstCodecsInfo::AudioEncoder)
-#endif
-{
-}
-
-CameraBinAudioEncoder::~CameraBinAudioEncoder()
-{
-}
-
-QStringList CameraBinAudioEncoder::supportedAudioCodecs() const
-{
-#if QT_CONFIG(gstreamer_encodingprofiles)
- return m_codecs.supportedCodecs();
-#else
- return QStringList();
-#endif
-}
-
-QString CameraBinAudioEncoder::codecDescription(const QString &codecName) const
-{
-#if QT_CONFIG(gstreamer_encodingprofiles)
- return m_codecs.codecDescription(codecName);
-#else
- Q_UNUSED(codecName);
- return QString();
-#endif
-}
-
-QList<int> CameraBinAudioEncoder::supportedSampleRates(const QAudioEncoderSettings &, bool *) const
-{
- //TODO check element caps to find actual values
-
- return QList<int>();
-}
-
-QAudioEncoderSettings CameraBinAudioEncoder::audioSettings() const
-{
- return m_audioSettings;
-}
-
-void CameraBinAudioEncoder::setAudioSettings(const QAudioEncoderSettings &settings)
-{
- if (m_audioSettings != settings) {
- m_audioSettings = settings;
- m_actualAudioSettings = settings;
- emit settingsChanged();
- }
-}
-
-QAudioEncoderSettings CameraBinAudioEncoder::actualAudioSettings() const
-{
- return m_actualAudioSettings;
-}
-
-void CameraBinAudioEncoder::setActualAudioSettings(const QAudioEncoderSettings &settings)
-{
- m_actualAudioSettings = settings;
-}
-
-void CameraBinAudioEncoder::resetActualSettings()
-{
- m_actualAudioSettings = m_audioSettings;
-}
-
-#if QT_CONFIG(gstreamer_encodingprofiles)
-
-GstEncodingProfile *CameraBinAudioEncoder::createProfile()
-{
- QString codec = m_actualAudioSettings.codec();
- QString preset = m_actualAudioSettings.encodingOption(QStringLiteral("preset")).toString();
- GstCaps *caps;
-
- if (codec.isEmpty())
- return 0;
- else
- caps = gst_caps_from_string(codec.toLatin1());
-
- GstEncodingProfile *profile = (GstEncodingProfile *)gst_encoding_audio_profile_new(
- caps,
- !preset.isEmpty() ? preset.toLatin1().constData() : NULL, //preset
- NULL, //restriction
- 0); //presence
-
- gst_caps_unref(caps);
-
- return profile;
-}
-
-#endif
-
-void CameraBinAudioEncoder::applySettings(GstElement *encoder)
-{
- GObjectClass * const objectClass = G_OBJECT_GET_CLASS(encoder);
- const char * const name = qt_gst_element_get_factory_name(encoder);
-
- const bool isVorbis = qstrcmp(name, "vorbisenc") == 0;
-
- const int bitRate = m_actualAudioSettings.bitRate();
- if (!isVorbis && bitRate == -1) {
- // Bit rate is invalid, don't evaluate the remaining conditions unless the encoder is
- // vorbisenc which is known to accept -1 as an unspecified bitrate.
- } else if (g_object_class_find_property(objectClass, "bitrate")) {
- g_object_set(G_OBJECT(encoder), "bitrate", bitRate, NULL);
- } else if (g_object_class_find_property(objectClass, "target-bitrate")) {
- g_object_set(G_OBJECT(encoder), "target-bitrate", bitRate, NULL);
- }
-
- if (isVorbis) {
- static const double qualities[] = { 0.1, 0.3, 0.5, 0.7, 1.0 };
- g_object_set(G_OBJECT(encoder), "quality", qualities[m_actualAudioSettings.quality()], NULL);
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinaudioencoder.h b/src/plugins/gstreamer/camerabin/camerabinaudioencoder.h
deleted file mode 100644
index b8091c8ca..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinaudioencoder.h
+++ /dev/null
@@ -1,109 +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 CAMERABINAUDIOENCODE_H
-#define CAMERABINAUDIOENCODE_H
-
-#include <QtMultimedia/private/qtmultimediaglobal_p.h>
-#include <qaudioencodersettingscontrol.h>
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmap.h>
-#include <QtCore/qset.h>
-
-#include <gst/gst.h>
-#include <gst/pbutils/pbutils.h>
-
-#if QT_CONFIG(gstreamer_encodingprofiles)
-#include <gst/pbutils/encoding-profile.h>
-#include <private/qgstcodecsinfo_p.h>
-#endif
-
-#include <qaudioformat.h>
-
-QT_BEGIN_NAMESPACE
-class CameraBinSession;
-
-class CameraBinAudioEncoder : public QAudioEncoderSettingsControl
-{
- Q_OBJECT
-public:
- CameraBinAudioEncoder(QObject *parent);
- virtual ~CameraBinAudioEncoder();
-
- QStringList supportedAudioCodecs() const override;
- QString codecDescription(const QString &codecName) const override;
-
- QStringList supportedEncodingOptions(const QString &codec) const;
- QVariant encodingOption(const QString &codec, const QString &name) const;
- void setEncodingOption(const QString &codec, const QString &name, const QVariant &value);
-
- QList<int> supportedSampleRates(const QAudioEncoderSettings &settings = QAudioEncoderSettings(),
- bool *isContinuous = 0) const override;
- QList<int> supportedChannelCounts(const QAudioEncoderSettings &settings = QAudioEncoderSettings()) const;
- QList<int> supportedSampleSizes(const QAudioEncoderSettings &settings = QAudioEncoderSettings()) const;
-
- QAudioEncoderSettings audioSettings() const override;
- void setAudioSettings(const QAudioEncoderSettings &) override;
-
- QAudioEncoderSettings actualAudioSettings() const;
- void setActualAudioSettings(const QAudioEncoderSettings&);
- void resetActualSettings();
-
-#if QT_CONFIG(gstreamer_encodingprofiles)
- GstEncodingProfile *createProfile();
-#endif
-
- void applySettings(GstElement *element);
-
-Q_SIGNALS:
- void settingsChanged();
-
-private:
-#if QT_CONFIG(gstreamer_encodingprofiles)
- QGstCodecsInfo m_codecs;
-#endif
-
- QAudioEncoderSettings m_actualAudioSettings;
- QAudioEncoderSettings m_audioSettings;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp b/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp
deleted file mode 100644
index 8b3e10546..000000000
--- a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp
+++ /dev/null
@@ -1,76 +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$
-**
-****************************************************************************/
-
-#include "camerabincapturebufferformat.h"
-#include "camerabinsession.h"
-
-QT_BEGIN_NAMESPACE
-
-CameraBinCaptureBufferFormat::CameraBinCaptureBufferFormat(CameraBinSession *session)
- :QCameraCaptureBufferFormatControl(session)
- , m_session(session)
- , m_format(QVideoFrame::Format_Jpeg)
-{
-}
-
-CameraBinCaptureBufferFormat::~CameraBinCaptureBufferFormat()
-{
-}
-
-QList<QVideoFrame::PixelFormat> CameraBinCaptureBufferFormat::supportedBufferFormats() const
-{
- //the exact YUV format is unknown with camerabin until the first capture is requested
- return QList<QVideoFrame::PixelFormat>()
- << QVideoFrame::Format_Jpeg;
-}
-
-QVideoFrame::PixelFormat CameraBinCaptureBufferFormat::bufferFormat() const
-{
- return m_format;
-}
-
-void CameraBinCaptureBufferFormat::setBufferFormat(QVideoFrame::PixelFormat format)
-{
- if (m_format != format) {
- m_format = format;
- emit bufferFormatChanged(format);
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h b/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h
deleted file mode 100644
index 7051913a7..000000000
--- a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h
+++ /dev/null
@@ -1,74 +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 CAMERABINCAPTUREBUFFERFORMAT_H
-#define CAMERABINCAPTUREBUFFERFORMAT_H
-
-#include <qcamera.h>
-#include <qcameracapturebufferformatcontrol.h>
-
-#include <gst/gst.h>
-#include <glib.h>
-
-QT_BEGIN_NAMESPACE
-
-class CameraBinSession;
-
-QT_USE_NAMESPACE
-
-class CameraBinCaptureBufferFormat : public QCameraCaptureBufferFormatControl
-{
- Q_OBJECT
-public:
- CameraBinCaptureBufferFormat(CameraBinSession *session);
- virtual ~CameraBinCaptureBufferFormat();
-
- QList<QVideoFrame::PixelFormat> supportedBufferFormats() const override;
-
- QVideoFrame::PixelFormat bufferFormat() const override;
- void setBufferFormat(QVideoFrame::PixelFormat format) override;
-
-private:
- CameraBinSession *m_session;
- QVideoFrame::PixelFormat m_format;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/gstreamer/camerabin/camerabincapturedestination.cpp b/src/plugins/gstreamer/camerabin/camerabincapturedestination.cpp
deleted file mode 100644
index 90ae81c86..000000000
--- a/src/plugins/gstreamer/camerabin/camerabincapturedestination.cpp
+++ /dev/null
@@ -1,76 +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$
-**
-****************************************************************************/
-
-#include "camerabincapturedestination.h"
-#include "camerabinsession.h"
-
-QT_BEGIN_NAMESPACE
-
-CameraBinCaptureDestination::CameraBinCaptureDestination(CameraBinSession *session)
- :QCameraCaptureDestinationControl(session)
- , m_session(session)
- , m_destination(QCameraImageCapture::CaptureToFile)
-{
-}
-
-CameraBinCaptureDestination::~CameraBinCaptureDestination()
-{
-}
-
-
-bool CameraBinCaptureDestination::isCaptureDestinationSupported(QCameraImageCapture::CaptureDestinations destination) const
-{
- //capture to buffer, file and both are supported.
- return destination & (QCameraImageCapture::CaptureToFile | QCameraImageCapture::CaptureToBuffer);
-}
-
-QCameraImageCapture::CaptureDestinations CameraBinCaptureDestination::captureDestination() const
-{
- return m_destination;
-}
-
-void CameraBinCaptureDestination::setCaptureDestination(QCameraImageCapture::CaptureDestinations destination)
-{
- if (m_destination != destination) {
- m_destination = destination;
- emit captureDestinationChanged(m_destination);
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabincapturedestination.h b/src/plugins/gstreamer/camerabin/camerabincapturedestination.h
deleted file mode 100644
index bc24a23d8..000000000
--- a/src/plugins/gstreamer/camerabin/camerabincapturedestination.h
+++ /dev/null
@@ -1,70 +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 CAMERABINCAPTUREDESTINATION_H
-#define CAMERABINCAPTUREDESTINATION_H
-
-#include <qcameraimagecapture.h>
-#include <qcameracapturedestinationcontrol.h>
-
-QT_BEGIN_NAMESPACE
-
-class CameraBinSession;
-
-QT_USE_NAMESPACE
-
-class CameraBinCaptureDestination : public QCameraCaptureDestinationControl
-{
- Q_OBJECT
-public:
- CameraBinCaptureDestination(CameraBinSession *session);
- virtual ~CameraBinCaptureDestination();
-
- bool isCaptureDestinationSupported(QCameraImageCapture::CaptureDestinations destination) const override;
- QCameraImageCapture::CaptureDestinations captureDestination() const override;
- void setCaptureDestination(QCameraImageCapture::CaptureDestinations destination) override;
-
-private:
- CameraBinSession *m_session;
- QCameraImageCapture::CaptureDestinations m_destination;
-};
-
-QT_END_NAMESPACE
-
-#endif // CAMERABINFLASHCONTROL_H
diff --git a/src/plugins/gstreamer/camerabin/camerabincontainer.cpp b/src/plugins/gstreamer/camerabin/camerabincontainer.cpp
deleted file mode 100644
index 0de9b25d8..000000000
--- a/src/plugins/gstreamer/camerabin/camerabincontainer.cpp
+++ /dev/null
@@ -1,152 +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$
-**
-****************************************************************************/
-
-#include <QtMultimedia/private/qtmultimediaglobal_p.h>
-#include "camerabincontainer.h"
-#include <private/qgstutils_p.h>
-
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-CameraBinContainer::CameraBinContainer(QObject *parent)
- :QMediaContainerControl(parent)
-#if QT_CONFIG(gstreamer_encodingprofiles)
- , m_supportedContainers(QGstCodecsInfo::Muxer)
-#endif
-{
-}
-
-QStringList CameraBinContainer::supportedContainers() const
-{
-#if QT_CONFIG(gstreamer_encodingprofiles)
- return m_supportedContainers.supportedCodecs();
-#else
- return QStringList();
-#endif
-}
-
-QString CameraBinContainer::containerDescription(const QString &formatMimeType) const
-{
-#if QT_CONFIG(gstreamer_encodingprofiles)
- return m_supportedContainers.codecDescription(formatMimeType);
-#else
- Q_UNUSED(formatMimeType);
- return QString();
-#endif
-}
-
-QString CameraBinContainer::containerFormat() const
-{
- return m_format;
-}
-
-void CameraBinContainer::setContainerFormat(const QString &format)
-{
-#if QT_CONFIG(gstreamer_encodingprofiles)
- if (m_format != format) {
- m_format = format;
- m_actualFormat = format;
- emit settingsChanged();
- }
-#endif
-}
-
-QString CameraBinContainer::actualContainerFormat() const
-{
- return m_actualFormat;
-}
-
-void CameraBinContainer::setActualContainerFormat(const QString &containerFormat)
-{
-#if QT_CONFIG(gstreamer_encodingprofiles)
- m_actualFormat = containerFormat;
-#endif
-}
-
-void CameraBinContainer::resetActualContainerFormat()
-{
- m_actualFormat = m_format;
-}
-
-#if QT_CONFIG(gstreamer_encodingprofiles)
-
-GstEncodingContainerProfile *CameraBinContainer::createProfile()
-{
- GstCaps *caps = nullptr;
-
- if (m_actualFormat.isEmpty()) {
- return 0;
- } else {
- QString format = m_actualFormat;
- const QStringList supportedFormats = m_supportedContainers.supportedCodecs();
-
- //if format is not in the list of supported gstreamer mime types,
- //try to find the mime type with matching extension
- if (!supportedFormats.contains(format)) {
- format.clear();
- QString extension = QGstUtils::fileExtensionForMimeType(m_actualFormat);
- for (const QString &formatCandidate : supportedFormats) {
- if (QGstUtils::fileExtensionForMimeType(formatCandidate) == extension) {
- format = formatCandidate;
- break;
- }
- }
- }
-
- if (format.isEmpty())
- return nullptr;
-
- caps = gst_caps_from_string(format.toLatin1());
- }
-
- GstEncodingContainerProfile *profile = (GstEncodingContainerProfile *)gst_encoding_container_profile_new(
- "camerabin2_profile",
- (gchar *)"custom camera profile",
- caps,
- NULL); //preset
-
- gst_caps_unref(caps);
-
- return profile;
-}
-
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabincontainer.h b/src/plugins/gstreamer/camerabin/camerabincontainer.h
deleted file mode 100644
index 738e55e2a..000000000
--- a/src/plugins/gstreamer/camerabin/camerabincontainer.h
+++ /dev/null
@@ -1,94 +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 CAMERABINMEDIACONTAINERCONTROL_H
-#define CAMERABINMEDIACONTAINERCONTROL_H
-
-#include <QtMultimedia/private/qtmultimediaglobal_p.h>
-#include <qmediacontainercontrol.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qset.h>
-
-#include <gst/gst.h>
-#include <gst/pbutils/pbutils.h>
-
-#if QT_CONFIG(gstreamer_encodingprofiles)
-#include <gst/pbutils/encoding-profile.h>
-#include <private/qgstcodecsinfo_p.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class CameraBinContainer : public QMediaContainerControl
-{
-Q_OBJECT
-public:
- CameraBinContainer(QObject *parent);
- virtual ~CameraBinContainer() {}
-
- QStringList supportedContainers() const override;
- QString containerDescription(const QString &formatMimeType) const override;
-
- QString containerFormat() const override;
- void setContainerFormat(const QString &format) override;
-
- QString actualContainerFormat() const;
- void setActualContainerFormat(const QString &containerFormat);
- void resetActualContainerFormat();
-
-#if QT_CONFIG(gstreamer_encodingprofiles)
- GstEncodingContainerProfile *createProfile();
-#endif
-
-Q_SIGNALS:
- void settingsChanged();
-
-private:
- QString m_format;
- QString m_actualFormat;
-
-#if QT_CONFIG(gstreamer_encodingprofiles)
- QGstCodecsInfo m_supportedContainers;
-#endif
-};
-
-QT_END_NAMESPACE
-
-#endif // CAMERABINMEDIACONTAINERCONTROL_H
diff --git a/src/plugins/gstreamer/camerabin/camerabincontrol.cpp b/src/plugins/gstreamer/camerabin/camerabincontrol.cpp
deleted file mode 100644
index 155887054..000000000
--- a/src/plugins/gstreamer/camerabin/camerabincontrol.cpp
+++ /dev/null
@@ -1,309 +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$
-**
-****************************************************************************/
-
-#include <QtMultimedia/private/qtmultimediaglobal_p.h>
-#include "camerabincontrol.h"
-#include "camerabincontainer.h"
-#include "camerabinaudioencoder.h"
-#include "camerabinvideoencoder.h"
-#include "camerabinimageencoder.h"
-#include "camerabinresourcepolicy.h"
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qfile.h>
-#include <QtCore/qmetaobject.h>
-
-QT_BEGIN_NAMESPACE
-
-//#define CAMEABIN_DEBUG 1
-#define ENUM_NAME(c,e,v) (c::staticMetaObject.enumerator(c::staticMetaObject.indexOfEnumerator(e)).valueToKey((v)))
-
-CameraBinControl::CameraBinControl(CameraBinSession *session)
- :QCameraControl(session),
- m_session(session),
- m_state(QCamera::UnloadedState),
- m_reloadPending(false)
-{
- connect(m_session, SIGNAL(statusChanged(QCamera::Status)),
- this, SIGNAL(statusChanged(QCamera::Status)));
-
- connect(m_session, SIGNAL(viewfinderChanged()),
- SLOT(reloadLater()));
- connect(m_session, SIGNAL(readyChanged(bool)),
- SLOT(reloadLater()));
- connect(m_session, SIGNAL(error(int,QString)),
- SLOT(handleCameraError(int,QString)));
-
- m_resourcePolicy = new CamerabinResourcePolicy(this);
- connect(m_resourcePolicy, SIGNAL(resourcesGranted()),
- SLOT(handleResourcesGranted()));
- connect(m_resourcePolicy, SIGNAL(resourcesDenied()),
- SLOT(handleResourcesLost()));
- connect(m_resourcePolicy, SIGNAL(resourcesLost()),
- SLOT(handleResourcesLost()));
-
- connect(m_session, SIGNAL(busyChanged(bool)),
- SLOT(handleBusyChanged(bool)));
-}
-
-CameraBinControl::~CameraBinControl()
-{
-}
-
-QCamera::CaptureModes CameraBinControl::captureMode() const
-{
- return m_session->captureMode();
-}
-
-void CameraBinControl::setCaptureMode(QCamera::CaptureModes mode)
-{
- if (m_session->captureMode() != mode) {
- m_session->setCaptureMode(mode);
-
- if (m_state == QCamera::ActiveState) {
- m_resourcePolicy->setResourceSet(
- captureMode() == QCamera::CaptureStillImage ?
- CamerabinResourcePolicy::ImageCaptureResources :
- CamerabinResourcePolicy::VideoCaptureResources);
- }
- emit captureModeChanged(mode);
- }
-}
-
-bool CameraBinControl::isCaptureModeSupported(QCamera::CaptureModes mode) const
-{
- return mode == QCamera::CaptureStillImage || mode == QCamera::CaptureVideo;
-}
-
-void CameraBinControl::setState(QCamera::State state)
-{
-#ifdef CAMEABIN_DEBUG
- qDebug() << Q_FUNC_INFO << ENUM_NAME(QCamera, "State", state);
-#endif
- if (m_state != state) {
- m_state = state;
-
- //special case for stopping the camera while it's busy,
- //it should be delayed until the camera is idle
- if ((state == QCamera::LoadedState || state == QCamera::UnloadedState) &&
- m_session->status() == QCamera::ActiveStatus &&
- m_session->isBusy()) {
-#ifdef CAMEABIN_DEBUG
- qDebug() << Q_FUNC_INFO << "Camera is busy,"
- << state == QCamera::LoadedState ? "QCamera::stop()" : "QCamera::unload()"
- << "is delayed";
-#endif
- emit stateChanged(m_state);
- return;
- }
-
- CamerabinResourcePolicy::ResourceSet resourceSet = CamerabinResourcePolicy::NoResources;
- switch (state) {
- case QCamera::UnloadedState:
- resourceSet = CamerabinResourcePolicy::NoResources;
- break;
- case QCamera::LoadedState:
- resourceSet = CamerabinResourcePolicy::LoadedResources;
- break;
- case QCamera::ActiveState:
- resourceSet = captureMode() == QCamera::CaptureStillImage ?
- CamerabinResourcePolicy::ImageCaptureResources :
- CamerabinResourcePolicy::VideoCaptureResources;
- break;
- }
-
- m_resourcePolicy->setResourceSet(resourceSet);
-
- if (m_resourcePolicy->isResourcesGranted()) {
- //postpone changing to Active if the session is nor ready yet
- if (state == QCamera::ActiveState) {
- if (m_session->isReady()) {
- m_session->setState(state);
- } else {
-#ifdef CAMEABIN_DEBUG
- qDebug() << "Camera session is not ready yet, postpone activating";
-#endif
- }
- } else
- m_session->setState(state);
- }
-
- emit stateChanged(m_state);
- }
-}
-
-QCamera::State CameraBinControl::state() const
-{
- return m_state;
-}
-
-QCamera::Status CameraBinControl::status() const
-{
- return m_session->status();
-}
-
-void CameraBinControl::reloadLater()
-{
-#ifdef CAMEABIN_DEBUG
- qDebug() << "CameraBinControl: reload pipeline requested" << ENUM_NAME(QCamera, "State", m_state);
-#endif
- if (!m_reloadPending && m_state == QCamera::ActiveState) {
- m_reloadPending = true;
-
- if (!m_session->isBusy()) {
- m_session->setState(QCamera::LoadedState);
- QMetaObject::invokeMethod(this, "delayedReload", Qt::QueuedConnection);
- }
- }
-}
-
-void CameraBinControl::handleResourcesLost()
-{
-#ifdef CAMEABIN_DEBUG
- qDebug() << Q_FUNC_INFO << ENUM_NAME(QCamera, "State", m_state);
-#endif
- m_session->setState(QCamera::UnloadedState);
-}
-
-void CameraBinControl::handleResourcesGranted()
-{
-#ifdef CAMEABIN_DEBUG
- qDebug() << Q_FUNC_INFO << ENUM_NAME(QCamera, "State", m_state);
-#endif
-
- //camera will be started soon by delayedReload()
- if (m_reloadPending && m_state == QCamera::ActiveState)
- return;
-
- if (m_state == QCamera::ActiveState && m_session->isReady())
- m_session->setState(QCamera::ActiveState);
- else if (m_state == QCamera::LoadedState)
- m_session->setState(QCamera::LoadedState);
-}
-
-void CameraBinControl::handleBusyChanged(bool busy)
-{
- if (!busy && m_session->status() == QCamera::ActiveStatus) {
- if (m_state != QCamera::ActiveState) {
- //handle delayed stop()/unload() because of busy camera
-
- CamerabinResourcePolicy::ResourceSet resourceSet = CamerabinResourcePolicy::NoResources;
- switch (m_state) {
- case QCamera::UnloadedState:
- resourceSet = CamerabinResourcePolicy::NoResources;
- break;
- case QCamera::LoadedState:
- resourceSet = CamerabinResourcePolicy::LoadedResources;
- break;
- default:
- Q_ASSERT(false);
- break;
- }
-
- m_resourcePolicy->setResourceSet(resourceSet);
- m_session->setState(m_state);
- } else if (m_reloadPending) {
- //handle delayed reload because of busy camera
- m_session->setState(QCamera::LoadedState);
- QMetaObject::invokeMethod(this, "delayedReload", Qt::QueuedConnection);
- }
- }
-}
-
-void CameraBinControl::handleCameraError(int errorCode, const QString &errorString)
-{
- emit error(errorCode, errorString);
- setState(QCamera::UnloadedState);
-}
-
-void CameraBinControl::delayedReload()
-{
-#ifdef CAMEABIN_DEBUG
- qDebug() << "CameraBinControl: reload pipeline";
-#endif
- if (m_reloadPending) {
- m_reloadPending = false;
- if (m_state == QCamera::ActiveState &&
- m_session->isReady() &&
- m_resourcePolicy->isResourcesGranted()) {
- m_session->setState(QCamera::ActiveState);
- }
- }
-}
-
-bool CameraBinControl::canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const
-{
- Q_UNUSED(status);
-
- switch (changeType) {
- case QCameraControl::Viewfinder:
- return true;
- case QCameraControl::CaptureMode:
- case QCameraControl::ImageEncodingSettings:
- case QCameraControl::VideoEncodingSettings:
- case QCameraControl::ViewfinderSettings:
- default:
- return status != QCamera::ActiveStatus;
- }
-}
-
-#define VIEWFINDER_COLORSPACE_CONVERSION 0x00000004
-
-bool CameraBinControl::viewfinderColorSpaceConversion() const
-{
- gint flags = 0;
- g_object_get(G_OBJECT(m_session->cameraBin()), "flags", &flags, NULL);
-
- return flags & VIEWFINDER_COLORSPACE_CONVERSION;
-}
-
-void CameraBinControl::setViewfinderColorSpaceConversion(bool enabled)
-{
- gint flags = 0;
- g_object_get(G_OBJECT(m_session->cameraBin()), "flags", &flags, NULL);
-
- if (enabled)
- flags |= VIEWFINDER_COLORSPACE_CONVERSION;
- else
- flags &= ~VIEWFINDER_COLORSPACE_CONVERSION;
-
- g_object_set(G_OBJECT(m_session->cameraBin()), "flags", flags, NULL);
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabincontrol.h b/src/plugins/gstreamer/camerabin/camerabincontrol.h
deleted file mode 100644
index 56c02dad4..000000000
--- a/src/plugins/gstreamer/camerabin/camerabincontrol.h
+++ /dev/null
@@ -1,101 +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 CAMERABINCONTROL_H
-#define CAMERABINCONTROL_H
-
-#include <QHash>
-#include <qcameracontrol.h>
-#include "camerabinsession.h"
-
-QT_BEGIN_NAMESPACE
-
-class CamerabinResourcePolicy;
-
-class CameraBinControl : public QCameraControl
-{
- Q_OBJECT
- Q_PROPERTY(bool viewfinderColorSpaceConversion READ viewfinderColorSpaceConversion WRITE setViewfinderColorSpaceConversion)
-public:
- CameraBinControl( CameraBinSession *session );
- virtual ~CameraBinControl();
-
- bool isValid() const { return true; }
-
- QCamera::State state() const override;
- void setState(QCamera::State state) override;
-
- QCamera::Status status() const override;
-
- QCamera::CaptureModes captureMode() const override;
- void setCaptureMode(QCamera::CaptureModes mode) override;
-
- bool isCaptureModeSupported(QCamera::CaptureModes mode) const override;
- bool canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const override;
- bool viewfinderColorSpaceConversion() const;
-
- CamerabinResourcePolicy *resourcePolicy() { return m_resourcePolicy; }
-
-public slots:
- void reloadLater();
- void setViewfinderColorSpaceConversion(bool enabled);
-
-private slots:
- void delayedReload();
-
- void handleResourcesGranted();
- void handleResourcesLost();
-
- void handleBusyChanged(bool);
- void handleCameraError(int error, const QString &errorString);
-
-private:
- void updateSupportedResolutions(const QString &device);
-
- CameraBinSession *m_session;
- QCamera::State m_state;
- CamerabinResourcePolicy *m_resourcePolicy;
-
- bool m_reloadPending;
-};
-
-QT_END_NAMESPACE
-
-#endif // CAMERABINCONTROL_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinexposure.cpp b/src/plugins/gstreamer/camerabin/camerabinexposure.cpp
deleted file mode 100644
index 35d3e7c8f..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinexposure.cpp
+++ /dev/null
@@ -1,285 +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$
-**
-****************************************************************************/
-
-#include "camerabinexposure.h"
-#include "camerabinsession.h"
-#include <gst/interfaces/photography.h>
-
-#include <QDebug>
-
-#if !GST_CHECK_VERSION(1,0,0)
-typedef GstSceneMode GstPhotographySceneMode;
-#endif
-
-QT_BEGIN_NAMESPACE
-
-CameraBinExposure::CameraBinExposure(CameraBinSession *session)
- :QCameraExposureControl(session),
- m_session(session)
-{
-}
-
-CameraBinExposure::~CameraBinExposure()
-{
-}
-
-bool CameraBinExposure::isParameterSupported(ExposureParameter parameter) const
-{
- switch (parameter) {
- case QCameraExposureControl::ExposureCompensation:
- case QCameraExposureControl::ISO:
- case QCameraExposureControl::Aperture:
- case QCameraExposureControl::ShutterSpeed:
- return true;
- default:
- return false;
- }
-}
-
-QVariantList CameraBinExposure::supportedParameterRange(ExposureParameter parameter,
- bool *continuous) const
-{
- if (continuous)
- *continuous = false;
-
- QVariantList res;
- switch (parameter) {
- case QCameraExposureControl::ExposureCompensation:
- if (continuous)
- *continuous = true;
- res << -2.0 << 2.0;
- break;
- case QCameraExposureControl::ISO:
- res << 100 << 200 << 400;
- break;
- case QCameraExposureControl::Aperture:
- res << 2.8;
- break;
- default:
- break;
- }
-
- return res;
-}
-
-QVariant CameraBinExposure::requestedValue(ExposureParameter parameter) const
-{
- return m_requestedValues.value(parameter);
-}
-
-QVariant CameraBinExposure::actualValue(ExposureParameter parameter) const
-{
- switch (parameter) {
- case QCameraExposureControl::ExposureCompensation:
- {
- gfloat ev;
- gst_photography_get_ev_compensation(m_session->photography(), &ev);
- return QVariant(ev);
- }
- case QCameraExposureControl::ISO:
- {
- guint isoSpeed = 0;
- gst_photography_get_iso_speed(m_session->photography(), &isoSpeed);
- return QVariant(isoSpeed);
- }
- case QCameraExposureControl::Aperture:
- return QVariant(2.8);
- case QCameraExposureControl::ShutterSpeed:
- {
- guint32 shutterSpeed = 0;
- gst_photography_get_exposure(m_session->photography(), &shutterSpeed);
-
- return QVariant(shutterSpeed/1000000.0);
- }
- case QCameraExposureControl::ExposureMode:
- {
- GstPhotographySceneMode sceneMode;
- gst_photography_get_scene_mode(m_session->photography(), &sceneMode);
-
- switch (sceneMode) {
- case GST_PHOTOGRAPHY_SCENE_MODE_PORTRAIT:
- return QVariant::fromValue(QCameraExposure::ExposurePortrait);
- case GST_PHOTOGRAPHY_SCENE_MODE_SPORT:
- return QVariant::fromValue(QCameraExposure::ExposureSports);
- case GST_PHOTOGRAPHY_SCENE_MODE_NIGHT:
- return QVariant::fromValue(QCameraExposure::ExposureNight);
- case GST_PHOTOGRAPHY_SCENE_MODE_MANUAL:
- return QVariant::fromValue(QCameraExposure::ExposureManual);
- case GST_PHOTOGRAPHY_SCENE_MODE_LANDSCAPE:
- 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 QVariant::fromValue(QCameraExposure::ExposureAuto);
- }
- }
- case QCameraExposureControl::MeteringMode:
- return QCameraExposure::MeteringMatrix;
- default:
- return QVariant();
- }
-}
-
-bool CameraBinExposure::setValue(ExposureParameter parameter, const QVariant& value)
-{
- QVariant oldValue = actualValue(parameter);
-
- switch (parameter) {
- case QCameraExposureControl::ExposureCompensation:
- gst_photography_set_ev_compensation(m_session->photography(), value.toReal());
- break;
- case QCameraExposureControl::ISO:
- gst_photography_set_iso_speed(m_session->photography(), value.toInt());
- break;
- case QCameraExposureControl::Aperture:
- gst_photography_set_aperture(m_session->photography(), guint(value.toReal()*1000000));
- break;
- case QCameraExposureControl::ShutterSpeed:
- gst_photography_set_exposure(m_session->photography(), guint(value.toReal()*1000000));
- break;
- case QCameraExposureControl::ExposureMode:
- {
- QCameraExposure::ExposureMode mode = value.value<QCameraExposure::ExposureMode>();
- GstPhotographySceneMode sceneMode;
-
- gst_photography_get_scene_mode(m_session->photography(), &sceneMode);
-
- switch (mode) {
- case QCameraExposure::ExposureManual:
- sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_MANUAL;
- break;
- case QCameraExposure::ExposurePortrait:
- sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_PORTRAIT;
- break;
- case QCameraExposure::ExposureSports:
- sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_SPORT;
- break;
- case QCameraExposure::ExposureNight:
- sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_NIGHT;
- break;
- 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;
- }
-
- gst_photography_set_scene_mode(m_session->photography(), sceneMode);
- break;
- }
- default:
- return false;
- }
-
- if (!qFuzzyCompare(m_requestedValues.value(parameter).toReal(), value.toReal())) {
- m_requestedValues[parameter] = value;
- emit requestedValueChanged(parameter);
- }
-
- QVariant newValue = actualValue(parameter);
- if (!qFuzzyCompare(oldValue.toReal(), newValue.toReal()))
- emit actualValueChanged(parameter);
-
- return true;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinexposure.h b/src/plugins/gstreamer/camerabin/camerabinexposure.h
deleted file mode 100644
index db16bed24..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinexposure.h
+++ /dev/null
@@ -1,75 +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 CAMERABINEXPOSURECONTROL_H
-#define CAMERABINEXPOSURECONTROL_H
-
-#include <qcamera.h>
-#include <qcameraexposurecontrol.h>
-
-#include <gst/gst.h>
-#include <glib.h>
-
-QT_BEGIN_NAMESPACE
-
-class CameraBinSession;
-
-class CameraBinExposure : public QCameraExposureControl
-{
- Q_OBJECT
-
-public:
- CameraBinExposure(CameraBinSession *session);
- virtual ~CameraBinExposure();
-
- bool isParameterSupported(ExposureParameter parameter) const override;
- QVariantList supportedParameterRange(ExposureParameter parameter, bool *continuous) const override;
-
- QVariant requestedValue(ExposureParameter parameter) const override;
- QVariant actualValue(ExposureParameter parameter) const override;
- bool setValue(ExposureParameter parameter, const QVariant &value) override;
-
-private:
- CameraBinSession *m_session;
- QHash<ExposureParameter, QVariant> m_requestedValues;
-};
-
-QT_END_NAMESPACE
-
-#endif // CAMERABINEXPOSURECONTROL_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinflash.cpp b/src/plugins/gstreamer/camerabin/camerabinflash.cpp
deleted file mode 100644
index 2bf7a2776..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinflash.cpp
+++ /dev/null
@@ -1,109 +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$
-**
-****************************************************************************/
-
-#include "camerabinflash.h"
-#include "camerabinsession.h"
-#include <gst/interfaces/photography.h>
-
-#include <QDebug>
-
-#if !GST_CHECK_VERSION(1,0,0)
-typedef GstFlashMode GstPhotographyFlashMode;
-#endif
-
-QT_BEGIN_NAMESPACE
-
-CameraBinFlash::CameraBinFlash(CameraBinSession *session)
- :QCameraFlashControl(session),
- m_session(session)
-{
-}
-
-CameraBinFlash::~CameraBinFlash()
-{
-}
-
-QCameraExposure::FlashModes CameraBinFlash::flashMode() const
-{
- GstPhotographyFlashMode flashMode;
- gst_photography_get_flash_mode(m_session->photography(), &flashMode);
-
- QCameraExposure::FlashModes modes;
- switch (flashMode) {
- case GST_PHOTOGRAPHY_FLASH_MODE_AUTO: modes |= QCameraExposure::FlashAuto; break;
- case GST_PHOTOGRAPHY_FLASH_MODE_OFF: modes |= QCameraExposure::FlashOff; break;
- case GST_PHOTOGRAPHY_FLASH_MODE_ON: modes |= QCameraExposure::FlashOn; break;
- case GST_PHOTOGRAPHY_FLASH_MODE_FILL_IN: modes |= QCameraExposure::FlashFill; break;
- case GST_PHOTOGRAPHY_FLASH_MODE_RED_EYE: modes |= QCameraExposure::FlashRedEyeReduction; break;
- default:
- modes |= QCameraExposure::FlashAuto;
- break;
- }
- return modes;
-}
-
-void CameraBinFlash::setFlashMode(QCameraExposure::FlashModes mode)
-{
- GstPhotographyFlashMode flashMode;
- gst_photography_get_flash_mode(m_session->photography(), &flashMode);
-
- if (mode.testFlag(QCameraExposure::FlashAuto)) flashMode = GST_PHOTOGRAPHY_FLASH_MODE_AUTO;
- else if (mode.testFlag(QCameraExposure::FlashOff)) flashMode = GST_PHOTOGRAPHY_FLASH_MODE_OFF;
- else if (mode.testFlag(QCameraExposure::FlashOn)) flashMode = GST_PHOTOGRAPHY_FLASH_MODE_ON;
- else if (mode.testFlag(QCameraExposure::FlashFill)) flashMode = GST_PHOTOGRAPHY_FLASH_MODE_FILL_IN;
- else if (mode.testFlag(QCameraExposure::FlashRedEyeReduction)) flashMode = GST_PHOTOGRAPHY_FLASH_MODE_RED_EYE;
-
- gst_photography_set_flash_mode(m_session->photography(), flashMode);
-}
-
-bool CameraBinFlash::isFlashModeSupported(QCameraExposure::FlashModes mode) const
-{
- return mode == QCameraExposure::FlashOff ||
- mode == QCameraExposure::FlashOn ||
- mode == QCameraExposure::FlashAuto ||
- mode == QCameraExposure::FlashRedEyeReduction ||
- mode == QCameraExposure::FlashFill;
-}
-
-bool CameraBinFlash::isFlashReady() const
-{
- return true;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinflash.h b/src/plugins/gstreamer/camerabin/camerabinflash.h
deleted file mode 100644
index 0efd100a7..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinflash.h
+++ /dev/null
@@ -1,73 +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 CAMERABINFLASHCONTROL_H
-#define CAMERABINFLASHCONTROL_H
-
-#include <qcamera.h>
-#include <qcameraflashcontrol.h>
-
-#include <gst/gst.h>
-#include <glib.h>
-
-QT_BEGIN_NAMESPACE
-
-class CameraBinSession;
-
-class CameraBinFlash : public QCameraFlashControl
-{
- Q_OBJECT
-public:
- CameraBinFlash(CameraBinSession *session);
- virtual ~CameraBinFlash();
-
- QCameraExposure::FlashModes flashMode() const override;
- void setFlashMode(QCameraExposure::FlashModes mode) override;
- bool isFlashModeSupported(QCameraExposure::FlashModes mode) const override;
-
- bool isFlashReady() const override;
-
-private:
- CameraBinSession *m_session;
-};
-
-QT_END_NAMESPACE
-
-#endif // CAMERABINFLASHCONTROL_H
-
diff --git a/src/plugins/gstreamer/camerabin/camerabinfocus.cpp b/src/plugins/gstreamer/camerabin/camerabinfocus.cpp
deleted file mode 100644
index 33ac7e3d7..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinfocus.cpp
+++ /dev/null
@@ -1,540 +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$
-**
-****************************************************************************/
-
-#include "camerabinfocus.h"
-#include "camerabinsession.h"
-
-#include <gst/interfaces/photography.h>
-
-#include <QDebug>
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qmetaobject.h>
-
-#include <private/qgstutils_p.h>
-
-#if !GST_CHECK_VERSION(1,0,0)
-typedef GstFocusMode GstPhotographyFocusMode;
-#endif
-
-//#define CAMERABIN_DEBUG 1
-
-QT_BEGIN_NAMESPACE
-
-CameraBinFocus::CameraBinFocus(CameraBinSession *session)
- :QCameraFocusControl(session),
-#if GST_CHECK_VERSION(1,0,0)
- QGstreamerBufferProbe(ProbeBuffers),
-#endif
- m_session(session),
- m_cameraStatus(QCamera::UnloadedStatus),
- m_focusMode(QCameraFocus::AutoFocus),
- m_focusPointMode(QCameraFocus::FocusPointAuto),
- m_focusStatus(QCamera::Unlocked),
- m_focusZoneStatus(QCameraFocusZone::Selected),
- m_focusPoint(0.5, 0.5),
- m_focusRect(0, 0, 0.3, 0.3)
-{
- m_focusRect.moveCenter(m_focusPoint);
-
- gst_photography_set_focus_mode(m_session->photography(), GST_PHOTOGRAPHY_FOCUS_MODE_AUTO);
-
- connect(m_session, SIGNAL(statusChanged(QCamera::Status)),
- this, SLOT(_q_handleCameraStatusChange(QCamera::Status)));
-}
-
-CameraBinFocus::~CameraBinFocus()
-{
-}
-
-QCameraFocus::FocusModes CameraBinFocus::focusMode() const
-{
- return m_focusMode;
-}
-
-void CameraBinFocus::setFocusMode(QCameraFocus::FocusModes mode)
-{
- GstPhotographyFocusMode 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
-{
- 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
-{
- return m_focusPointMode;
-}
-
-void CameraBinFocus::setFocusPointMode(QCameraFocus::FocusPointMode mode)
-{
- GstElement *source = m_session->cameraSource();
-
- if (m_focusPointMode == mode || !source)
- return;
-
-#if GST_CHECK_VERSION(1,0,0)
- if (m_focusPointMode == QCameraFocus::FocusPointFaceDetection) {
- g_object_set (G_OBJECT(source), "detect-faces", FALSE, NULL);
-
- if (GstPad *pad = gst_element_get_static_pad(source, "vfsrc")) {
- removeProbeFromPad(pad);
- gst_object_unref(GST_OBJECT(pad));
- }
-
- m_faceResetTimer.stop();
- m_faceFocusRects.clear();
-
- QMutexLocker locker(&m_mutex);
- m_faces.clear();
- }
-#endif
-
- if (m_focusPointMode != QCameraFocus::FocusPointAuto)
- resetFocusPoint();
-
- switch (mode) {
- case QCameraFocus::FocusPointAuto:
- case QCameraFocus::FocusPointCustom:
- break;
-#if GST_CHECK_VERSION(1,0,0)
- case QCameraFocus::FocusPointFaceDetection:
- if (g_object_class_find_property(G_OBJECT_GET_CLASS(source), "detect-faces")) {
- if (GstPad *pad = gst_element_get_static_pad(source, "vfsrc")) {
- addProbeToPad(pad);
- g_object_set (G_OBJECT(source), "detect-faces", TRUE, NULL);
- break;
- }
- }
- return;
-#endif
- default:
- return;
- }
-
- m_focusPointMode = mode;
- emit focusPointModeChanged(m_focusPointMode);
- emit focusZonesChanged();
-}
-
-bool CameraBinFocus::isFocusPointModeSupported(QCameraFocus::FocusPointMode mode) const
-{
- switch (mode) {
- case QCameraFocus::FocusPointAuto:
- case QCameraFocus::FocusPointCustom:
- return true;
-#if GST_CHECK_VERSION(1,0,0)
- case QCameraFocus::FocusPointFaceDetection:
- if (GstElement *source = m_session->cameraSource())
- return g_object_class_find_property(G_OBJECT_GET_CLASS(source), "detect-faces");
- return false;
-#endif
- default:
- return false;
- }
-}
-
-QPointF CameraBinFocus::customFocusPoint() const
-{
- return m_focusPoint;
-}
-
-void CameraBinFocus::setCustomFocusPoint(const QPointF &point)
-{
- if (m_focusPoint != point) {
- m_focusPoint = point;
-
- // Bound the focus point so the focus rect remains entirely within the unit square.
- m_focusPoint.setX(qBound(m_focusRect.width() / 2, m_focusPoint.x(), 1 - m_focusRect.width() / 2));
- m_focusPoint.setY(qBound(m_focusRect.height() / 2, m_focusPoint.y(), 1 - m_focusRect.height() / 2));
-
- if (m_focusPointMode == QCameraFocus::FocusPointCustom) {
- const QRectF focusRect = m_focusRect;
- m_focusRect.moveCenter(m_focusPoint);
-
- updateRegionOfInterest(m_focusRect);
-
- if (focusRect != m_focusRect) {
- emit focusZonesChanged();
- }
- }
-
- emit customFocusPointChanged(m_focusPoint);
- }
-}
-
-QCameraFocusZoneList CameraBinFocus::focusZones() const
-{
- QCameraFocusZoneList zones;
-
- if (m_focusPointMode != QCameraFocus::FocusPointFaceDetection) {
- zones.append(QCameraFocusZone(m_focusRect, m_focusZoneStatus));
-#if GST_CHECK_VERSION(1,0,0)
- } else for (const QRect &face : qAsConst(m_faceFocusRects)) {
- const QRectF normalizedRect(
- face.x() / qreal(m_viewfinderResolution.width()),
- face.y() / qreal(m_viewfinderResolution.height()),
- face.width() / qreal(m_viewfinderResolution.width()),
- face.height() / qreal(m_viewfinderResolution.height()));
- zones.append(QCameraFocusZone(normalizedRect, m_focusZoneStatus));
-#endif
- }
- return zones;
-}
-
-void CameraBinFocus::handleFocusMessage(GstMessage *gm)
-{
- //it's a sync message, so it's called from non main thread
- const GstStructure *structure = gst_message_get_structure(gm);
- if (gst_structure_has_name(structure, GST_PHOTOGRAPHY_AUTOFOCUS_DONE)) {
- gint status = GST_PHOTOGRAPHY_FOCUS_STATUS_NONE;
- gst_structure_get_int (structure, "status", &status);
- QCamera::LockStatus focusStatus = m_focusStatus;
- QCamera::LockChangeReason reason = QCamera::UserRequest;
-
- switch (status) {
- case GST_PHOTOGRAPHY_FOCUS_STATUS_FAIL:
- focusStatus = QCamera::Unlocked;
- reason = QCamera::LockFailed;
- break;
- case GST_PHOTOGRAPHY_FOCUS_STATUS_SUCCESS:
- focusStatus = QCamera::Locked;
- break;
- case GST_PHOTOGRAPHY_FOCUS_STATUS_NONE:
- break;
- case GST_PHOTOGRAPHY_FOCUS_STATUS_RUNNING:
- focusStatus = QCamera::Searching;
- break;
- default:
- break;
- }
-
- static int signalIndex = metaObject()->indexOfSlot(
- "_q_setFocusStatus(QCamera::LockStatus,QCamera::LockChangeReason)");
- metaObject()->method(signalIndex).invoke(this,
- Qt::QueuedConnection,
- Q_ARG(QCamera::LockStatus,focusStatus),
- Q_ARG(QCamera::LockChangeReason,reason));
- }
-}
-
-void CameraBinFocus::_q_setFocusStatus(QCamera::LockStatus status, QCamera::LockChangeReason reason)
-{
-#ifdef CAMERABIN_DEBUG
- qDebug() << Q_FUNC_INFO << "Current:"
- << m_focusStatus
- << "New:"
- << status << reason;
-#endif
-
- if (m_focusStatus != status) {
- m_focusStatus = status;
-
- QCameraFocusZone::FocusZoneStatus zonesStatus =
- m_focusStatus == QCamera::Locked ?
- QCameraFocusZone::Focused : QCameraFocusZone::Selected;
-
- if (m_focusZoneStatus != zonesStatus) {
- m_focusZoneStatus = zonesStatus;
- emit focusZonesChanged();
- }
-
-#if GST_CHECK_VERSION(1,0,0)
- if (m_focusPointMode == QCameraFocus::FocusPointFaceDetection
- && m_focusStatus == QCamera::Unlocked) {
- _q_updateFaces();
- }
-#endif
-
- emit _q_focusStatusChanged(m_focusStatus, reason);
- }
-}
-
-void CameraBinFocus::_q_handleCameraStatusChange(QCamera::Status status)
-{
- m_cameraStatus = status;
- if (status == QCamera::ActiveStatus) {
- if (GstPad *pad = gst_element_get_static_pad(m_session->cameraSource(), "vfsrc")) {
- if (GstCaps *caps = qt_gst_pad_get_current_caps(pad)) {
- if (GstStructure *structure = gst_caps_get_structure(caps, 0)) {
- int width = 0;
- int height = 0;
- gst_structure_get_int(structure, "width", &width);
- gst_structure_get_int(structure, "height", &height);
- setViewfinderResolution(QSize(width, height));
- }
- gst_caps_unref(caps);
- }
- gst_object_unref(GST_OBJECT(pad));
- }
- if (m_focusPointMode == QCameraFocus::FocusPointCustom) {
- updateRegionOfInterest(m_focusRect);
- }
- } else {
- _q_setFocusStatus(QCamera::Unlocked, QCamera::LockLost);
-
- resetFocusPoint();
- }
-}
-
-void CameraBinFocus::_q_startFocusing()
-{
- _q_setFocusStatus(QCamera::Searching, QCamera::UserRequest);
- gst_photography_set_autofocus(m_session->photography(), TRUE);
-}
-
-void CameraBinFocus::_q_stopFocusing()
-{
- gst_photography_set_autofocus(m_session->photography(), FALSE);
- _q_setFocusStatus(QCamera::Unlocked, QCamera::UserRequest);
-}
-
-void CameraBinFocus::setViewfinderResolution(const QSize &resolution)
-{
- if (resolution != m_viewfinderResolution) {
- m_viewfinderResolution = resolution;
- if (!resolution.isEmpty()) {
- const QPointF center = m_focusRect.center();
- m_focusRect.setWidth(m_focusRect.height() * resolution.height() / resolution.width());
- m_focusRect.moveCenter(center);
- }
- }
-}
-
-void CameraBinFocus::resetFocusPoint()
-{
- const QRectF focusRect = m_focusRect;
- m_focusPoint = QPointF(0.5, 0.5);
- m_focusRect.moveCenter(m_focusPoint);
-
- updateRegionOfInterest(QList<QRect>());
-
- if (focusRect != m_focusRect) {
- emit customFocusPointChanged(m_focusPoint);
- emit focusZonesChanged();
- }
-}
-
-static void appendRegion(GValue *regions, int priority, const QRect &rectangle)
-{
- GstStructure *region = gst_structure_new(
- "region",
- "region-x" , G_TYPE_UINT , rectangle.x(),
- "region-y" , G_TYPE_UINT, rectangle.y(),
- "region-w" , G_TYPE_UINT , rectangle.width(),
- "region-h" , G_TYPE_UINT, rectangle.height(),
- "region-priority" , G_TYPE_UINT, priority,
- NULL);
-
- GValue regionValue = G_VALUE_INIT;
- g_value_init(&regionValue, GST_TYPE_STRUCTURE);
- gst_value_set_structure(&regionValue, region);
- gst_structure_free(region);
-
- gst_value_list_append_value(regions, &regionValue);
- g_value_unset(&regionValue);
-}
-
-void CameraBinFocus::updateRegionOfInterest(const QRectF &rectangle)
-{
- updateRegionOfInterest(QList<QRect>() << QRect(
- rectangle.x() * m_viewfinderResolution.width(),
- rectangle.y() * m_viewfinderResolution.height(),
- rectangle.width() * m_viewfinderResolution.width(),
- rectangle.height() * m_viewfinderResolution.height()));
-}
-
-void CameraBinFocus::updateRegionOfInterest(const QList<QRect> &rectangles)
-{
- if (m_cameraStatus != QCamera::ActiveStatus)
- return;
-
- GstElement * const cameraSource = m_session->cameraSource();
- if (!cameraSource)
- return;
-
- GValue regions = G_VALUE_INIT;
- g_value_init(&regions, GST_TYPE_LIST);
-
- if (rectangles.isEmpty()) {
- appendRegion(&regions, 0, QRect(0, 0, 0, 0));
- } else {
- // Add padding around small face rectangles so the auto focus has a reasonable amount
- // of image to work with.
- const int minimumDimension = qMin(
- m_viewfinderResolution.width(), m_viewfinderResolution.height()) * 0.3;
- const QRect viewfinderRectangle(QPoint(0, 0), m_viewfinderResolution);
-
- for (const QRect &rectangle : rectangles) {
- QRect paddedRectangle(
- 0,
- 0,
- qMax(rectangle.width(), minimumDimension),
- qMax(rectangle.height(), minimumDimension));
- paddedRectangle.moveCenter(rectangle.center());
-
- appendRegion(&regions, 1, viewfinderRectangle.intersected(paddedRectangle));
- }
- }
-
- GstStructure *regionsOfInterest = gst_structure_new(
- "regions-of-interest",
- "frame-width" , G_TYPE_UINT , m_viewfinderResolution.width(),
- "frame-height" , G_TYPE_UINT, m_viewfinderResolution.height(),
- NULL);
- gst_structure_set_value(regionsOfInterest, "regions", &regions);
- g_value_unset(&regions);
-
- GstEvent *event = gst_event_new_custom(GST_EVENT_CUSTOM_UPSTREAM, regionsOfInterest);
- gst_element_send_event(cameraSource, event);
-}
-
-#if GST_CHECK_VERSION(1,0,0)
-
-void CameraBinFocus::_q_updateFaces()
-{
- if (m_focusPointMode != QCameraFocus::FocusPointFaceDetection
- || m_focusStatus != QCamera::Unlocked) {
- return;
- }
-
- QList<QRect> faces;
-
- {
- QMutexLocker locker(&m_mutex);
- faces = m_faces;
- }
-
- if (!faces.isEmpty()) {
- m_faceResetTimer.stop();
- m_faceFocusRects = faces;
- updateRegionOfInterest(m_faceFocusRects);
- emit focusZonesChanged();
- } else {
- m_faceResetTimer.start(500, this);
- }
-}
-
-void CameraBinFocus::timerEvent(QTimerEvent *event)
-{
- if (event->timerId() == m_faceResetTimer.timerId()) {
- m_faceResetTimer.stop();
-
- if (m_focusStatus == QCamera::Unlocked) {
- m_faceFocusRects.clear();
- updateRegionOfInterest(m_faceFocusRects);
- emit focusZonesChanged();
- }
- } else {
- QCameraFocusControl::timerEvent(event);
- }
-}
-
-bool CameraBinFocus::probeBuffer(GstBuffer *buffer)
-{
- QList<QRect> faces;
-
-#if GST_CHECK_VERSION(1,1,3)
- gpointer state = NULL;
- const GstMetaInfo *info = GST_VIDEO_REGION_OF_INTEREST_META_INFO;
-
- while (GstMeta *meta = gst_buffer_iterate_meta(buffer, &state)) {
- if (meta->info->api != info->api)
- continue;
-
- GstVideoRegionOfInterestMeta *region = reinterpret_cast<GstVideoRegionOfInterestMeta *>(meta);
-
- faces.append(QRect(region->x, region->y, region->w, region->h));
- }
-#else
- Q_UNUSED(buffer);
-#endif
-
- QMutexLocker locker(&m_mutex);
-
- if (m_faces != faces) {
- m_faces = faces;
-
- static const int signalIndex = metaObject()->indexOfSlot("_q_updateFaces()");
- metaObject()->method(signalIndex).invoke(this, Qt::QueuedConnection);
- }
-
- return true;
-}
-
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinfocus.h b/src/plugins/gstreamer/camerabin/camerabinfocus.h
deleted file mode 100644
index 0fca02c35..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinfocus.h
+++ /dev/null
@@ -1,134 +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 CAMERABINFOCUSCONTROL_H
-#define CAMERABINFOCUSCONTROL_H
-
-#include <qcamera.h>
-#include <qcamerafocuscontrol.h>
-
-#include <private/qgstreamerbufferprobe_p.h>
-
-#include <qbasictimer.h>
-#include <qlist.h>
-#include <qmutex.h>
-
-#include <gst/gst.h>
-#include <glib.h>
-
-QT_BEGIN_NAMESPACE
-
-class CameraBinSession;
-
-class CameraBinFocus
- : public QCameraFocusControl
-#if GST_CHECK_VERSION(1,0,0)
- , QGstreamerBufferProbe
-#endif
-{
- Q_OBJECT
-
-public:
- CameraBinFocus(CameraBinSession *session);
- virtual ~CameraBinFocus();
-
- QCameraFocus::FocusModes focusMode() const override;
- void setFocusMode(QCameraFocus::FocusModes mode) override;
- bool isFocusModeSupported(QCameraFocus::FocusModes mode) const override;
-
- QCameraFocus::FocusPointMode focusPointMode() const override;
- void setFocusPointMode(QCameraFocus::FocusPointMode mode) override;
- bool isFocusPointModeSupported(QCameraFocus::FocusPointMode) const override;
- QPointF customFocusPoint() const override;
- void setCustomFocusPoint(const QPointF &point) override;
-
- QCameraFocusZoneList focusZones() const override;
-
- void handleFocusMessage(GstMessage*);
- QCamera::LockStatus focusStatus() const { return m_focusStatus; }
-
-Q_SIGNALS:
- void _q_focusStatusChanged(QCamera::LockStatus status, QCamera::LockChangeReason reason);
-
-public Q_SLOTS:
- void _q_startFocusing();
- void _q_stopFocusing();
-
- void setViewfinderResolution(const QSize &resolution);
-
-#if GST_CHECK_VERSION(1,0,0)
-protected:
- void timerEvent(QTimerEvent *event) override;
-#endif
-
-private Q_SLOTS:
- void _q_setFocusStatus(QCamera::LockStatus status, QCamera::LockChangeReason reason);
- void _q_handleCameraStatusChange(QCamera::Status status);
-
-#if GST_CHECK_VERSION(1,0,0)
- void _q_updateFaces();
-#endif
-
-private:
- void resetFocusPoint();
- void updateRegionOfInterest(const QRectF &rectangle);
- void updateRegionOfInterest(const QList<QRect> &rectangles);
-
-#if GST_CHECK_VERSION(1,0,0)
- bool probeBuffer(GstBuffer *buffer) override;
-#endif
-
- CameraBinSession *m_session;
- QCamera::Status m_cameraStatus;
- QCameraFocus::FocusModes m_focusMode;
- QCameraFocus::FocusPointMode m_focusPointMode;
- QCamera::LockStatus m_focusStatus;
- QCameraFocusZone::FocusZoneStatus m_focusZoneStatus;
- QPointF m_focusPoint;
- QRectF m_focusRect;
- QSize m_viewfinderResolution;
- QList<QRect> m_faces;
- QList<QRect> m_faceFocusRects;
- QBasicTimer m_faceResetTimer;
- mutable QMutex m_mutex;
-};
-
-QT_END_NAMESPACE
-
-#endif // CAMERABINFOCUSCONTROL_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp b/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp
deleted file mode 100644
index b164bc31a..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp
+++ /dev/null
@@ -1,380 +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$
-**
-****************************************************************************/
-
-#include "camerabinimagecapture.h"
-#include "camerabincontrol.h"
-#include "camerabincapturedestination.h"
-#include "camerabincapturebufferformat.h"
-#include "camerabinsession.h"
-#include "camerabinresourcepolicy.h"
-#include <private/qgstvideobuffer_p.h>
-#include <private/qvideosurfacegstsink_p.h>
-#include <private/qgstutils_p.h>
-#include <QtMultimedia/qmediametadata.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qbuffer.h>
-#include <QtGui/qimagereader.h>
-
-//#define DEBUG_CAPTURE
-
-#define IMAGE_DONE_SIGNAL "image-done"
-
-QT_BEGIN_NAMESPACE
-
-CameraBinImageCapture::CameraBinImageCapture(CameraBinSession *session)
- :QCameraImageCaptureControl(session)
- , m_encoderProbe(this)
- , m_muxerProbe(this)
- , m_session(session)
- , m_jpegEncoderElement(0)
- , m_metadataMuxerElement(0)
- , m_requestId(0)
- , m_ready(false)
-{
- connect(m_session, SIGNAL(statusChanged(QCamera::Status)), SLOT(updateState()));
- connect(m_session, SIGNAL(imageExposed(int)), this, SIGNAL(imageExposed(int)));
- connect(m_session, SIGNAL(imageCaptured(int,QImage)), this, SIGNAL(imageCaptured(int,QImage)));
- connect(m_session->cameraControl()->resourcePolicy(), SIGNAL(canCaptureChanged()), this, SLOT(updateState()));
-
- m_session->bus()->installMessageFilter(this);
-}
-
-CameraBinImageCapture::~CameraBinImageCapture()
-{
-}
-
-bool CameraBinImageCapture::isReadyForCapture() const
-{
- return m_ready;
-}
-
-int CameraBinImageCapture::capture(const QString &fileName)
-{
- m_requestId++;
-
- if (!m_ready) {
- emit error(m_requestId, QCameraImageCapture::NotReadyError, tr("Camera not ready"));
- return m_requestId;
- }
-
-#ifdef DEBUG_CAPTURE
- qDebug() << Q_FUNC_INFO << m_requestId << fileName;
-#endif
- m_session->captureImage(m_requestId, fileName);
- return m_requestId;
-}
-
-void CameraBinImageCapture::cancelCapture()
-{
-}
-
-void CameraBinImageCapture::updateState()
-{
- bool ready = m_session->status() == QCamera::ActiveStatus
- && m_session->cameraControl()->resourcePolicy()->canCapture();
- if (m_ready != ready) {
-#ifdef DEBUG_CAPTURE
- qDebug() << "readyForCaptureChanged" << ready;
-#endif
- emit readyForCaptureChanged(m_ready = ready);
- }
-}
-
-#if GST_CHECK_VERSION(1,0,0)
-GstPadProbeReturn CameraBinImageCapture::encoderEventProbe(
- GstPad *, GstPadProbeInfo *info, gpointer user_data)
-{
- GstEvent * const event = gst_pad_probe_info_get_event(info);
-#else
-gboolean CameraBinImageCapture::encoderEventProbe(
- GstElement *, GstEvent *event, gpointer user_data)
-{
-#endif
- CameraBinImageCapture * const self = static_cast<CameraBinImageCapture *>(user_data);
- if (event && GST_EVENT_TYPE(event) == GST_EVENT_TAG) {
- GstTagList *gstTags;
- gst_event_parse_tag(event, &gstTags);
- QMap<QByteArray, QVariant> extendedTags = QGstUtils::gstTagListToMap(gstTags);
-
-#ifdef DEBUG_CAPTURE
- qDebug() << QString(gst_structure_to_string(gst_event_get_structure(event))).right(768);
- qDebug() << "Capture event probe" << extendedTags;
-#endif
-
- QVariantMap tags;
- tags[QMediaMetaData::ISOSpeedRatings] = extendedTags.value("capturing-iso-speed");
- tags[QMediaMetaData::DigitalZoomRatio] = extendedTags.value("capturing-digital-zoom-ratio");
- tags[QMediaMetaData::ExposureTime] = extendedTags.value("capturing-shutter-speed");
- tags[QMediaMetaData::WhiteBalance] = extendedTags.value("capturing-white-balance");
- tags[QMediaMetaData::Flash] = extendedTags.value("capturing-flash-fired");
- tags[QMediaMetaData::FocalLengthIn35mmFilm] = extendedTags.value("capturing-focal-length");
- tags[QMediaMetaData::MeteringMode] = extendedTags.value("capturing-metering-mode");
- tags[QMediaMetaData::ExposureMode] = extendedTags.value("capturing-exposure-mode");
- tags[QMediaMetaData::FNumber] = extendedTags.value("capturing-focal-ratio");
- tags[QMediaMetaData::ExposureMode] = extendedTags.value("capturing-exposure-mode");
-
- for (auto i = tags.cbegin(), end = tags.cend(); i != end; ++i) {
- if (i.value().isValid()) {
- QMetaObject::invokeMethod(self, "imageMetadataAvailable",
- Qt::QueuedConnection,
- Q_ARG(int, self->m_requestId),
- Q_ARG(QString, i.key()),
- Q_ARG(QVariant, i.value()));
- }
- }
- }
-#if GST_CHECK_VERSION(1,0,0)
- return GST_PAD_PROBE_OK;
-#else
- return TRUE;
-#endif
-}
-
-void CameraBinImageCapture::EncoderProbe::probeCaps(GstCaps *caps)
-{
-#if GST_CHECK_VERSION(1,0,0)
- capture->m_bufferFormat = QGstUtils::formatForCaps(caps, &capture->m_videoInfo);
-#else
- int bytesPerLine = 0;
- QVideoSurfaceFormat format = QGstUtils::formatForCaps(caps, &bytesPerLine);
- capture->m_bytesPerLine = bytesPerLine;
- capture->m_bufferFormat = format;
-#endif
-}
-
-bool CameraBinImageCapture::EncoderProbe::probeBuffer(GstBuffer *buffer)
-{
- CameraBinSession * const session = capture->m_session;
-
-#ifdef DEBUG_CAPTURE
- qDebug() << "Uncompressed buffer probe";
-#endif
-
- QCameraImageCapture::CaptureDestinations destination =
- session->captureDestinationControl()->captureDestination();
- QVideoFrame::PixelFormat format = session->captureBufferFormatControl()->bufferFormat();
-
- if (destination & QCameraImageCapture::CaptureToBuffer) {
- if (format != QVideoFrame::Format_Jpeg) {
-#ifdef DEBUG_CAPTURE
- qDebug() << "imageAvailable(uncompressed):" << format;
-#endif
-#if GST_CHECK_VERSION(1,0,0)
- QGstVideoBuffer *videoBuffer = new QGstVideoBuffer(buffer, capture->m_videoInfo);
-#else
- QGstVideoBuffer *videoBuffer = new QGstVideoBuffer(buffer, capture->m_bytesPerLine);
-#endif
-
- QVideoFrame frame(
- videoBuffer,
- capture->m_bufferFormat.frameSize(),
- capture->m_bufferFormat.pixelFormat());
-
- QMetaObject::invokeMethod(capture, "imageAvailable",
- Qt::QueuedConnection,
- Q_ARG(int, capture->m_requestId),
- Q_ARG(QVideoFrame, frame));
- }
- }
-
- //keep the buffer if capture to file or jpeg buffer capture was reuqsted
- bool keepBuffer = (destination & QCameraImageCapture::CaptureToFile) ||
- ((destination & QCameraImageCapture::CaptureToBuffer) &&
- format == QVideoFrame::Format_Jpeg);
-
- return keepBuffer;
-}
-
-void CameraBinImageCapture::MuxerProbe::probeCaps(GstCaps *caps)
-{
- capture->m_jpegResolution = QGstUtils::capsCorrectedResolution(caps);
-}
-
-bool CameraBinImageCapture::MuxerProbe::probeBuffer(GstBuffer *buffer)
-{
- CameraBinSession * const session = capture->m_session;
-
- QCameraImageCapture::CaptureDestinations destination =
- session->captureDestinationControl()->captureDestination();
-
- if ((destination & QCameraImageCapture::CaptureToBuffer) &&
- session->captureBufferFormatControl()->bufferFormat() == QVideoFrame::Format_Jpeg) {
-
- QSize resolution = capture->m_jpegResolution;
- //if resolution is not presented in caps, try to find it from encoded jpeg data:
-#if GST_CHECK_VERSION(1,0,0)
- GstMapInfo mapInfo;
- if (resolution.isEmpty() && gst_buffer_map(buffer, &mapInfo, GST_MAP_READ)) {
- QBuffer data;
- data.setData(reinterpret_cast<const char*>(mapInfo.data), mapInfo.size);
-
- QImageReader reader(&data, "JPEG");
- resolution = reader.size();
-
- gst_buffer_unmap(buffer, &mapInfo);
- }
-
- GstVideoInfo info;
- gst_video_info_set_format(
- &info, GST_VIDEO_FORMAT_ENCODED, resolution.width(), resolution.height());
- QGstVideoBuffer *videoBuffer = new QGstVideoBuffer(buffer, info);
-#else
- if (resolution.isEmpty()) {
- QBuffer data;
- data.setData(reinterpret_cast<const char*>(GST_BUFFER_DATA(buffer)), GST_BUFFER_SIZE(buffer));
- QImageReader reader(&data, "JPEG");
- resolution = reader.size();
- }
-
- QGstVideoBuffer *videoBuffer = new QGstVideoBuffer(buffer,
- -1); //bytesPerLine is not available for jpegs
-#endif
-
-
- QVideoFrame frame(videoBuffer,
- resolution,
- QVideoFrame::Format_Jpeg);
- QMetaObject::invokeMethod(capture, "imageAvailable",
- Qt::QueuedConnection,
- Q_ARG(int, capture->m_requestId),
- Q_ARG(QVideoFrame, frame));
- }
-
-
- // Theoretically we could drop the buffer here when don't want to capture to file but that
- // prevents camerabin from recognizing that capture has been completed and returning
- // to its idle state.
- return true;
-}
-
-
-bool CameraBinImageCapture::processBusMessage(const QGstreamerMessage &message)
-{
- //Install metadata event and buffer probes
-
- //The image capture pipiline is built dynamically,
- //it's necessary to wait until jpeg encoder is added to pipeline
-
- GstMessage *gm = message.rawMessage();
- if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_STATE_CHANGED) {
- GstState oldState;
- GstState newState;
- GstState pending;
- gst_message_parse_state_changed(gm, &oldState, &newState, &pending);
-
- if (newState == GST_STATE_READY) {
- GstElement *element = GST_ELEMENT(GST_MESSAGE_SRC(gm));
- if (!element)
- return false;
-
- gchar *name = gst_element_get_name(element);
- QString elementName = QString::fromLatin1(name);
- g_free(name);
-#if !GST_CHECK_VERSION(1,0,0)
- GstElementClass *elementClass = GST_ELEMENT_GET_CLASS(element);
- QString elementLongName = elementClass->details.longname;
-#endif
- if (elementName.contains("jpegenc") && element != m_jpegEncoderElement) {
- m_jpegEncoderElement = element;
- GstPad *sinkpad = gst_element_get_static_pad(element, "sink");
-
- //metadata event probe is installed before jpeg encoder
- //to emit metadata available signal as soon as possible.
-#ifdef DEBUG_CAPTURE
- qDebug() << "install metadata probe";
-#endif
-#if GST_CHECK_VERSION(1,0,0)
- gst_pad_add_probe(
- sinkpad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, encoderEventProbe, this, NULL);
-#else
- gst_pad_add_event_probe(sinkpad, G_CALLBACK(encoderEventProbe), this);
-#endif
-#ifdef DEBUG_CAPTURE
- qDebug() << "install uncompressed buffer probe";
-#endif
- m_encoderProbe.addProbeToPad(sinkpad, true);
-
- gst_object_unref(sinkpad);
- } else if ((elementName.contains("jifmux")
-#if !GST_CHECK_VERSION(1,0,0)
- || elementLongName == QLatin1String("JPEG stream muxer")
-#endif
- || elementName.startsWith("metadatamux"))
- && element != m_metadataMuxerElement) {
- //Jpeg encoded buffer probe is added after jifmux/metadatamux
- //element to ensure the resulting jpeg buffer contains capture metadata
- m_metadataMuxerElement = element;
-
- GstPad *srcpad = gst_element_get_static_pad(element, "src");
-#ifdef DEBUG_CAPTURE
- qDebug() << "install jpeg buffer probe";
-#endif
- m_muxerProbe.addProbeToPad(srcpad);
-
- gst_object_unref(srcpad);
- }
- }
- } else if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) {
- if (GST_MESSAGE_SRC(gm) == (GstObject *)m_session->cameraBin()) {
- const GstStructure *structure = gst_message_get_structure(gm);
-
- if (gst_structure_has_name (structure, "image-done")) {
- const gchar *fileName = gst_structure_get_string (structure, "filename");
-#ifdef DEBUG_CAPTURE
- qDebug() << "Image saved" << fileName;
-#endif
-
- if (m_session->captureDestinationControl()->captureDestination() & QCameraImageCapture::CaptureToFile) {
- emit imageSaved(m_requestId, QString::fromUtf8(fileName));
- } else {
-#ifdef DEBUG_CAPTURE
- qDebug() << Q_FUNC_INFO << "Dropped saving file" << fileName;
-#endif
- QFileInfo info(QString::fromUtf8(fileName));
- if (info.exists() && info.isFile())
- QFile(info.absoluteFilePath()).remove();
- }
- }
- }
- }
-
- return false;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinimagecapture.h b/src/plugins/gstreamer/camerabin/camerabinimagecapture.h
deleted file mode 100644
index 5e00ab6d5..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinimagecapture.h
+++ /dev/null
@@ -1,123 +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 CAMERABINIMAGECAPTURECONTROL_H
-#define CAMERABINIMAGECAPTURECONTROL_H
-
-#include <qcameraimagecapturecontrol.h>
-#include "camerabinsession.h"
-
-#include <qvideosurfaceformat.h>
-
-#include <private/qgstreamerbufferprobe_p.h>
-
-#if GST_CHECK_VERSION(1,0,0)
-#include <gst/video/video.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class CameraBinImageCapture : public QCameraImageCaptureControl, public QGstreamerBusMessageFilter
-{
- Q_OBJECT
- Q_INTERFACES(QGstreamerBusMessageFilter)
-public:
- CameraBinImageCapture(CameraBinSession *session);
- virtual ~CameraBinImageCapture();
-
- QCameraImageCapture::DriveMode driveMode() const override { return QCameraImageCapture::SingleImageCapture; }
- void setDriveMode(QCameraImageCapture::DriveMode) override {}
-
- bool isReadyForCapture() const override;
- int capture(const QString &fileName) override;
- void cancelCapture() override;
-
- bool processBusMessage(const QGstreamerMessage &message) override;
-
-private slots:
- void updateState();
-
-private:
-#if GST_CHECK_VERSION(1,0,0)
- static GstPadProbeReturn encoderEventProbe(GstPad *, GstPadProbeInfo *info, gpointer user_data);
-#else
- static gboolean encoderEventProbe(GstElement *, GstEvent *event, gpointer user_data);
-#endif
-
- class EncoderProbe : public QGstreamerBufferProbe
- {
- public:
- EncoderProbe(CameraBinImageCapture *capture) : capture(capture) {}
- void probeCaps(GstCaps *caps) override;
- bool probeBuffer(GstBuffer *buffer) override;
-
- private:
- CameraBinImageCapture * const capture;
- } m_encoderProbe;
-
- class MuxerProbe : public QGstreamerBufferProbe
- {
- public:
- MuxerProbe(CameraBinImageCapture *capture) : capture(capture) {}
- void probeCaps(GstCaps *caps) override;
- bool probeBuffer(GstBuffer *buffer) override;
-
- private:
- CameraBinImageCapture * const capture;
-
- } m_muxerProbe;
-
- QVideoSurfaceFormat m_bufferFormat;
- QSize m_jpegResolution;
- CameraBinSession *m_session;
- GstElement *m_jpegEncoderElement;
- GstElement *m_metadataMuxerElement;
-#if GST_CHECK_VERSION(1,0,0)
- GstVideoInfo m_videoInfo;
-#else
- int m_bytesPerLine;
-#endif
- int m_requestId;
- bool m_ready;
-};
-
-QT_END_NAMESPACE
-
-#endif // CAMERABINCAPTURECORNTROL_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinimageencoder.cpp b/src/plugins/gstreamer/camerabin/camerabinimageencoder.cpp
deleted file mode 100644
index 8c4eaec70..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinimageencoder.cpp
+++ /dev/null
@@ -1,88 +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$
-**
-****************************************************************************/
-
-#include "camerabinimageencoder.h"
-#include "camerabinsession.h"
-
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-CameraBinImageEncoder::CameraBinImageEncoder(CameraBinSession *session)
- :QImageEncoderControl(session), m_session(session)
-{
-}
-
-CameraBinImageEncoder::~CameraBinImageEncoder()
-{
-}
-
-QList<QSize> CameraBinImageEncoder::supportedResolutions(const QImageEncoderSettings &, bool *continuous) const
-{
- if (continuous)
- *continuous = false;
-
- return m_session->supportedResolutions(qMakePair<int,int>(0,0), continuous, QCamera::CaptureStillImage);
-}
-
-QStringList CameraBinImageEncoder::supportedImageCodecs() const
-{
- return QStringList() << "jpeg";
-}
-
-QString CameraBinImageEncoder::imageCodecDescription(const QString &codecName) const
-{
- if (codecName == "jpeg")
- return tr("JPEG image");
-
- return QString();
-}
-
-QImageEncoderSettings CameraBinImageEncoder::imageSettings() const
-{
- return m_settings;
-}
-
-void CameraBinImageEncoder::setImageSettings(const QImageEncoderSettings &settings)
-{
- m_settings = settings;
- emit settingsChanged();
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinimageencoder.h b/src/plugins/gstreamer/camerabin/camerabinimageencoder.h
deleted file mode 100644
index 96f7ae7aa..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinimageencoder.h
+++ /dev/null
@@ -1,86 +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 CAMERABINIMAGEENCODE_H
-#define CAMERABINIMAGEENCODE_H
-
-#include <qimageencodercontrol.h>
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmap.h>
-
-#include <gst/gst.h>
-QT_BEGIN_NAMESPACE
-
-class CameraBinSession;
-
-class CameraBinImageEncoder : public QImageEncoderControl
-{
- Q_OBJECT
-public:
- CameraBinImageEncoder(CameraBinSession *session);
- virtual ~CameraBinImageEncoder();
-
- QList<QSize> supportedResolutions(const QImageEncoderSettings &settings = QImageEncoderSettings(),
- bool *continuous = 0) const override;
-
- QStringList supportedImageCodecs() const override;
- QString imageCodecDescription(const QString &formatName) const override;
-
- QImageEncoderSettings imageSettings() const override;
- void setImageSettings(const QImageEncoderSettings &settings) override;
-
-Q_SIGNALS:
- void settingsChanged();
-
-private:
- QImageEncoderSettings m_settings;
-
- CameraBinSession *m_session;
-
- // Added
- QStringList m_codecs;
- QMap<QString,QByteArray> m_elementNames;
- QMap<QString,QString> m_codecDescriptions;
- QMap<QString,QStringList> m_codecOptions;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp
deleted file mode 100644
index 9d281e10c..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp
+++ /dev/null
@@ -1,441 +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$
-**
-****************************************************************************/
-
-#include <QtMultimedia/private/qtmultimediaglobal_p.h>
-#include "camerabinimageprocessing.h"
-#include "camerabinsession.h"
-
-#if QT_CONFIG(linux_v4l)
-#include "camerabinv4limageprocessing.h"
-#endif
-
-#if GST_CHECK_VERSION(1,0,0)
-# include <gst/video/colorbalance.h>
-#else
-# include <gst/interfaces/colorbalance.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-CameraBinImageProcessing::CameraBinImageProcessing(CameraBinSession *session)
- : QCameraImageProcessingControl(session)
- , m_session(session)
- , m_whiteBalanceMode(QCameraImageProcessing::WhiteBalanceAuto)
-#if QT_CONFIG(linux_v4l)
- , m_v4lImageControl(nullptr)
-#endif
-{
-#if QT_CONFIG(gstreamer_photography)
- if (m_session->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;
- unlockWhiteBalance();
- }
-
-#if GST_CHECK_VERSION(1, 0, 0)
- m_filterMap.insert(QCameraImageProcessing::ColorFilterNone, GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL);
- if (m_session->photography()) {
- m_filterMap.insert(QCameraImageProcessing::ColorFilterSepia, GST_PHOTOGRAPHY_COLOR_TONE_MODE_SEPIA);
- m_filterMap.insert(QCameraImageProcessing::ColorFilterGrayscale, GST_PHOTOGRAPHY_COLOR_TONE_MODE_GRAYSCALE);
- m_filterMap.insert(QCameraImageProcessing::ColorFilterNegative, GST_PHOTOGRAPHY_COLOR_TONE_MODE_NEGATIVE);
- m_filterMap.insert(QCameraImageProcessing::ColorFilterSolarize, GST_PHOTOGRAPHY_COLOR_TONE_MODE_SOLARIZE);
-#if GST_CHECK_VERSION(1, 2, 0)
- m_filterMap.insert(QCameraImageProcessing::ColorFilterPosterize, GST_PHOTOGRAPHY_COLOR_TONE_MODE_POSTERIZE);
- m_filterMap.insert(QCameraImageProcessing::ColorFilterWhiteboard, GST_PHOTOGRAPHY_COLOR_TONE_MODE_WHITEBOARD);
- m_filterMap.insert(QCameraImageProcessing::ColorFilterBlackboard, GST_PHOTOGRAPHY_COLOR_TONE_MODE_BLACKBOARD);
- m_filterMap.insert(QCameraImageProcessing::ColorFilterAqua, GST_PHOTOGRAPHY_COLOR_TONE_MODE_AQUA);
-#endif
- }
-#else
- m_filterMap.insert(QCameraImageProcessing::ColorFilterNone, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL);
- if (m_session->photography()) {
- m_filterMap.insert(QCameraImageProcessing::ColorFilterSepia, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SEPIA);
- m_filterMap.insert(QCameraImageProcessing::ColorFilterGrayscale, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_GRAYSCALE);
- m_filterMap.insert(QCameraImageProcessing::ColorFilterNegative, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NEGATIVE);
- m_filterMap.insert(QCameraImageProcessing::ColorFilterSolarize, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SOLARIZE);
- }
-#endif
-#endif
-
-#if QT_CONFIG(linux_v4l)
- m_v4lImageControl = new CameraBinV4LImageProcessing(m_session);
- connect(m_session, &CameraBinSession::statusChanged,
- m_v4lImageControl, &CameraBinV4LImageProcessing::updateParametersInfo);
-#endif
-
- updateColorBalanceValues();
-}
-
-CameraBinImageProcessing::~CameraBinImageProcessing()
-{
-}
-
-void CameraBinImageProcessing::updateColorBalanceValues()
-{
- if (!GST_IS_COLOR_BALANCE(m_session->cameraBin())) {
- // Camerabin doesn't implement gstcolorbalance interface
- return;
- }
-
- GstColorBalance *balance = GST_COLOR_BALANCE(m_session->cameraBin());
- const GList *controls = gst_color_balance_list_channels(balance);
-
- const GList *item;
- GstColorBalanceChannel *channel;
- gint cur_value;
- qreal scaledValue = 0;
-
- for (item = controls; item; item = g_list_next (item)) {
- channel = (GstColorBalanceChannel *)item->data;
- cur_value = gst_color_balance_get_value (balance, channel);
-
- //map the [min_value..max_value] range to [-1.0 .. 1.0]
- if (channel->min_value != channel->max_value) {
- scaledValue = qreal(cur_value - channel->min_value) /
- (channel->max_value - channel->min_value) * 2 - 1;
- }
-
- if (!g_ascii_strcasecmp (channel->label, "brightness")) {
- m_values[QCameraImageProcessingControl::BrightnessAdjustment] = scaledValue;
- } else if (!g_ascii_strcasecmp (channel->label, "contrast")) {
- m_values[QCameraImageProcessingControl::ContrastAdjustment] = scaledValue;
- } else if (!g_ascii_strcasecmp (channel->label, "saturation")) {
- m_values[QCameraImageProcessingControl::SaturationAdjustment] = scaledValue;
- }
- }
-}
-
-bool CameraBinImageProcessing::setColorBalanceValue(const QString& channel, qreal value)
-{
-
- if (!GST_IS_COLOR_BALANCE(m_session->cameraBin())) {
- // Camerabin doesn't implement gstcolorbalance interface
- return false;
- }
-
- GstColorBalance *balance = GST_COLOR_BALANCE(m_session->cameraBin());
- const GList *controls = gst_color_balance_list_channels(balance);
-
- const GList *item;
- GstColorBalanceChannel *colorBalanceChannel;
-
- for (item = controls; item; item = g_list_next (item)) {
- colorBalanceChannel = (GstColorBalanceChannel *)item->data;
-
- if (!g_ascii_strcasecmp (colorBalanceChannel->label, channel.toLatin1())) {
- //map the [-1.0 .. 1.0] range to [min_value..max_value]
- gint scaledValue = colorBalanceChannel->min_value + qRound(
- (value+1.0)/2.0 * (colorBalanceChannel->max_value - colorBalanceChannel->min_value));
-
- gst_color_balance_set_value (balance, colorBalanceChannel, scaledValue);
- return true;
- }
- }
-
- return false;
-}
-
-QCameraImageProcessing::WhiteBalanceMode CameraBinImageProcessing::whiteBalanceMode() const
-{
- return m_whiteBalanceMode;
-}
-
-bool CameraBinImageProcessing::setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode mode)
-{
-#if QT_CONFIG(gstreamer_photography)
- 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(), &currentMode)
- && currentMode != GST_PHOTOGRAPHY_WB_MODE_MANUAL)
-#endif
- {
- unlockWhiteBalance();
- return true;
- }
- }
-#else
- Q_UNUSED(mode);
-#endif
- return false;
-}
-
-bool CameraBinImageProcessing::isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceMode mode) const
-{
-#if QT_CONFIG(gstreamer_photography)
- return m_mappedWbValues.values().contains(mode);
-#else
- Q_UNUSED(mode);
- return false;
-#endif
-}
-
-bool CameraBinImageProcessing::isParameterSupported(QCameraImageProcessingControl::ProcessingParameter parameter) const
-{
-#if QT_CONFIG(gstreamer_photography)
- if (parameter == QCameraImageProcessingControl::WhiteBalancePreset
- || parameter == QCameraImageProcessingControl::ColorFilter) {
- if (m_session->photography())
- return true;
- }
-#endif
-
- if (parameter == QCameraImageProcessingControl::Contrast
- || parameter == QCameraImageProcessingControl::Brightness
- || parameter == QCameraImageProcessingControl::Saturation) {
- if (GST_IS_COLOR_BALANCE(m_session->cameraBin()))
- return true;
- }
-
-#if QT_CONFIG(linux_v4l)
- if (m_v4lImageControl->isParameterSupported(parameter))
- return true;
-#endif
-
- return false;
-}
-
-bool CameraBinImageProcessing::isParameterValueSupported(QCameraImageProcessingControl::ProcessingParameter parameter, const QVariant &value) const
-{
- switch (parameter) {
- case ContrastAdjustment:
- case BrightnessAdjustment:
- case SaturationAdjustment: {
- const bool isGstColorBalanceValueSupported = GST_IS_COLOR_BALANCE(m_session->cameraBin())
- && qAbs(value.toReal()) <= 1.0;
-#if QT_CONFIG(linux_v4l)
- if (!isGstColorBalanceValueSupported)
- return m_v4lImageControl->isParameterValueSupported(parameter, value);
-#endif
- return isGstColorBalanceValueSupported;
- }
- case SharpeningAdjustment: {
-#if QT_CONFIG(linux_v4l)
- return m_v4lImageControl->isParameterValueSupported(parameter, value);
-#else
- return false;
-#endif
- }
- case WhiteBalancePreset: {
- const QCameraImageProcessing::WhiteBalanceMode mode =
- value.value<QCameraImageProcessing::WhiteBalanceMode>();
- const bool isPhotographyWhiteBalanceSupported = isWhiteBalanceModeSupported(mode);
-#if QT_CONFIG(linux_v4l)
- if (!isPhotographyWhiteBalanceSupported)
- return m_v4lImageControl->isParameterValueSupported(parameter, value);
-#endif
- return isPhotographyWhiteBalanceSupported;
- }
- case ColorTemperature: {
-#if QT_CONFIG(linux_v4l)
- return m_v4lImageControl->isParameterValueSupported(parameter, value);
-#else
- return false;
-#endif
- }
- case ColorFilter: {
- const QCameraImageProcessing::ColorFilter filter = value.value<QCameraImageProcessing::ColorFilter>();
-#if QT_CONFIG(gstreamer_photography)
- return m_filterMap.contains(filter);
-#else
- return filter == QCameraImageProcessing::ColorFilterNone;
-#endif
- }
- default:
- break;
- }
-
- return false;
-}
-
-QVariant CameraBinImageProcessing::parameter(
- QCameraImageProcessingControl::ProcessingParameter parameter) const
-{
- switch (parameter) {
- case QCameraImageProcessingControl::WhiteBalancePreset: {
- const QCameraImageProcessing::WhiteBalanceMode mode = whiteBalanceMode();
-#if QT_CONFIG(linux_v4l)
- if (mode == QCameraImageProcessing::WhiteBalanceAuto
- || mode == QCameraImageProcessing::WhiteBalanceManual) {
- return m_v4lImageControl->parameter(parameter);
- }
-#endif
- return QVariant::fromValue<QCameraImageProcessing::WhiteBalanceMode>(mode);
- }
- case QCameraImageProcessingControl::ColorTemperature: {
-#if QT_CONFIG(linux_v4l)
- return m_v4lImageControl->parameter(parameter);
-#else
- return QVariant();
-#endif
- }
- case QCameraImageProcessingControl::ColorFilter:
-#if QT_CONFIG(gstreamer_photography)
- if (GstPhotography *photography = m_session->photography()) {
-#if GST_CHECK_VERSION(1, 0, 0)
- GstPhotographyColorToneMode mode = GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL;
- gst_photography_get_color_tone_mode(photography, &mode);
-#else
- GstColourToneMode mode = GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL;
- gst_photography_get_colour_tone_mode(photography, &mode);
-#endif
- return QVariant::fromValue(m_filterMap.key(mode, QCameraImageProcessing::ColorFilterNone));
- }
-#endif
- return QVariant::fromValue(QCameraImageProcessing::ColorFilterNone);
- default: {
- const bool isGstParameterSupported = m_values.contains(parameter);
-#if QT_CONFIG(linux_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: {
- if (!setColorBalanceValue("contrast", value.toReal())) {
-#if QT_CONFIG(linux_v4l)
- m_v4lImageControl->setParameter(parameter, value);
-#endif
- }
- }
- break;
- case BrightnessAdjustment: {
- if (!setColorBalanceValue("brightness", value.toReal())) {
-#if QT_CONFIG(linux_v4l)
- m_v4lImageControl->setParameter(parameter, value);
-#endif
- }
- }
- break;
- case SaturationAdjustment: {
- if (!setColorBalanceValue("saturation", value.toReal())) {
-#if QT_CONFIG(linux_v4l)
- m_v4lImageControl->setParameter(parameter, value);
-#endif
- }
- }
- break;
- case SharpeningAdjustment: {
-#if QT_CONFIG(linux_v4l)
- m_v4lImageControl->setParameter(parameter, value);
-#endif
- }
- break;
- case WhiteBalancePreset: {
- if (!setWhiteBalanceMode(value.value<QCameraImageProcessing::WhiteBalanceMode>())) {
-#if QT_CONFIG(linux_v4l)
- const QCameraImageProcessing::WhiteBalanceMode mode =
- value.value<QCameraImageProcessing::WhiteBalanceMode>();
- if (mode == QCameraImageProcessing::WhiteBalanceAuto
- || mode == QCameraImageProcessing::WhiteBalanceManual) {
- m_v4lImageControl->setParameter(parameter, value);
- return;
- }
-#endif
- }
- }
- break;
- case QCameraImageProcessingControl::ColorTemperature: {
-#if QT_CONFIG(linux_v4l)
- m_v4lImageControl->setParameter(parameter, value);
-#endif
- break;
- }
- case QCameraImageProcessingControl::ColorFilter:
-#if QT_CONFIG(gstreamer_photography)
- if (GstPhotography *photography = m_session->photography()) {
-#if GST_CHECK_VERSION(1, 0, 0)
- gst_photography_set_color_tone_mode(photography, m_filterMap.value(
- value.value<QCameraImageProcessing::ColorFilter>(),
- GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL));
-#else
- gst_photography_set_colour_tone_mode(photography, m_filterMap.value(
- value.value<QCameraImageProcessing::ColorFilter>(),
- GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL));
-#endif
- }
-#endif
- break;
- default:
- break;
- }
-
- updateColorBalanceValues();
-}
-
-#if QT_CONFIG(gstreamer_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
diff --git a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.h b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.h
deleted file mode 100644
index 259138e91..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.h
+++ /dev/null
@@ -1,108 +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 CAMERABINIMAGEPROCESSINGCONTROL_H
-#define CAMERABINIMAGEPROCESSINGCONTROL_H
-
-#include <QtMultimedia/private/qtmultimediaglobal_p.h>
-#include <qcamera.h>
-#include <qcameraimageprocessingcontrol.h>
-
-#include <gst/gst.h>
-#include <glib.h>
-
-#if QT_CONFIG(gstreamer_photography)
-# include <gst/interfaces/photography.h>
-# if !GST_CHECK_VERSION(1,0,0)
-typedef GstWhiteBalanceMode GstPhotographyWhiteBalanceMode;
-typedef GstColourToneMode GstPhotographyColorToneMode;
-# endif
-#endif
-
-QT_BEGIN_NAMESPACE
-
-#if QT_CONFIG(linux_v4l)
-class CameraBinV4LImageProcessing;
-#endif
-
-class CameraBinSession;
-
-class CameraBinImageProcessing : public QCameraImageProcessingControl
-{
- Q_OBJECT
-
-public:
- CameraBinImageProcessing(CameraBinSession *session);
- virtual ~CameraBinImageProcessing();
-
- QCameraImageProcessing::WhiteBalanceMode whiteBalanceMode() const;
- bool setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode mode);
- bool isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceMode mode) const;
-
- bool isParameterSupported(ProcessingParameter) const override;
- bool isParameterValueSupported(ProcessingParameter parameter, const QVariant &value) const override;
- QVariant parameter(ProcessingParameter parameter) const override;
- void setParameter(ProcessingParameter parameter, const QVariant &value) override;
-
-#if QT_CONFIG(gstreamer_photography)
- void lockWhiteBalance();
- void unlockWhiteBalance();
-#endif
-
-private:
- bool setColorBalanceValue(const QString& channel, qreal value);
- void updateColorBalanceValues();
-
-private:
- CameraBinSession *m_session;
- QMap<QCameraImageProcessingControl::ProcessingParameter, int> m_values;
-#if QT_CONFIG(gstreamer_photography)
- QMap<GstPhotographyWhiteBalanceMode, QCameraImageProcessing::WhiteBalanceMode> m_mappedWbValues;
- QMap<QCameraImageProcessing::ColorFilter, GstPhotographyColorToneMode> m_filterMap;
-#endif
- QCameraImageProcessing::WhiteBalanceMode m_whiteBalanceMode;
-
-#if QT_CONFIG(linux_v4l)
- CameraBinV4LImageProcessing *m_v4lImageControl;
-#endif
-};
-
-QT_END_NAMESPACE
-
-#endif // CAMERABINIMAGEPROCESSINGCONTROL_H
diff --git a/src/plugins/gstreamer/camerabin/camerabininfocontrol.cpp b/src/plugins/gstreamer/camerabin/camerabininfocontrol.cpp
deleted file mode 100644
index 6aa3aeb61..000000000
--- a/src/plugins/gstreamer/camerabin/camerabininfocontrol.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla 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$
-**
-****************************************************************************/
-
-
-#include "camerabininfocontrol.h"
-
-#include <private/qgstutils_p.h>
-
-QT_BEGIN_NAMESPACE
-
-CameraBinInfoControl::CameraBinInfoControl(GstElementFactory *sourceFactory, QObject *parent)
- : QCameraInfoControl(parent)
- , m_sourceFactory(sourceFactory)
-{
- gst_object_ref(GST_OBJECT(m_sourceFactory));
-}
-
-CameraBinInfoControl::~CameraBinInfoControl()
-{
- gst_object_unref(GST_OBJECT(m_sourceFactory));
-}
-
-QCamera::Position CameraBinInfoControl::cameraPosition(const QString &device) const
-{
- return QGstUtils::cameraPosition(device, m_sourceFactory);
-}
-
-int CameraBinInfoControl::cameraOrientation(const QString &device) const
-{
- return QGstUtils::cameraOrientation(device, m_sourceFactory);
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabininfocontrol.h b/src/plugins/gstreamer/camerabin/camerabininfocontrol.h
deleted file mode 100644
index 9c801e804..000000000
--- a/src/plugins/gstreamer/camerabin/camerabininfocontrol.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla 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 CAMERABININFOCONTROL_H
-#define CAMERABININFOCONTROL_H
-
-#include <qcamerainfocontrol.h>
-
-#include <gst/gst.h>
-
-QT_BEGIN_NAMESPACE
-
-class CameraBinInfoControl : public QCameraInfoControl
-{
- Q_OBJECT
-public:
- CameraBinInfoControl(GstElementFactory *sourceFactory, QObject *parent);
- ~CameraBinInfoControl();
-
- QCamera::Position cameraPosition(const QString &deviceName) const override;
- int cameraOrientation(const QString &deviceName) const override;
-
-private:
- GstElementFactory * const m_sourceFactory;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/gstreamer/camerabin/camerabinlocks.cpp b/src/plugins/gstreamer/camerabin/camerabinlocks.cpp
deleted file mode 100644
index 89be2ac5d..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinlocks.cpp
+++ /dev/null
@@ -1,259 +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$
-**
-****************************************************************************/
-
-#include "camerabinlocks.h"
-#include "camerabinsession.h"
-#include "camerabinfocus.h"
-#include "camerabinimageprocessing.h"
-
-#include <QtCore/qcoreevent.h>
-
-#include <gst/interfaces/photography.h>
-
-#include <QDebug>
-
-QT_BEGIN_NAMESPACE
-
-CameraBinLocks::CameraBinLocks(CameraBinSession *session)
- :QCameraLocksControl(session),
- m_session(session),
- m_focus(m_session->cameraFocusControl())
-{
- connect(m_focus, SIGNAL(_q_focusStatusChanged(QCamera::LockStatus,QCamera::LockChangeReason)),
- this, SLOT(updateFocusStatus(QCamera::LockStatus,QCamera::LockChangeReason)));
-}
-
-CameraBinLocks::~CameraBinLocks()
-{
-}
-
-QCamera::LockTypes CameraBinLocks::supportedLocks() const
-{
- QCamera::LockTypes locks = QCamera::LockFocus;
-
-#if GST_CHECK_VERSION(1, 2, 0)
- if (GstPhotography *photography = m_session->photography()) {
- if (gst_photography_get_capabilities(photography) & GST_PHOTOGRAPHY_CAPS_WB_MODE)
- locks |= QCamera::LockWhiteBalance;
-
- if (GstElement *source = m_session->cameraSource()) {
- if (g_object_class_find_property(
- G_OBJECT_GET_CLASS(source), "exposure-mode")) {
- locks |= QCamera::LockExposure;
- }
- }
- }
-#endif
-
- return locks;
-}
-
-QCamera::LockStatus CameraBinLocks::lockStatus(QCamera::LockType lock) const
-{
- switch (lock) {
- case QCamera::LockFocus:
- return m_focus->focusStatus();
-#if GST_CHECK_VERSION(1, 2, 0)
- case QCamera::LockExposure:
- if (m_pendingLocks & QCamera::LockExposure)
- return QCamera::Searching;
- return isExposureLocked() ? QCamera::Locked : QCamera::Unlocked;
- case QCamera::LockWhiteBalance:
- if (m_pendingLocks & QCamera::LockWhiteBalance)
- return QCamera::Searching;
- return isWhiteBalanceLocked() ? QCamera::Locked : QCamera::Unlocked;
-#endif
- default:
- return QCamera::Unlocked;
- }
-}
-
-void CameraBinLocks::searchAndLock(QCamera::LockTypes locks)
-{
- m_pendingLocks &= ~locks;
-
- if (locks & QCamera::LockFocus) {
- m_pendingLocks |= QCamera::LockFocus;
- m_focus->_q_startFocusing();
- }
-#if GST_CHECK_VERSION(1, 2, 0)
- if (!m_pendingLocks)
- m_lockTimer.stop();
-
- if (locks & QCamera::LockExposure) {
- if (isExposureLocked()) {
- unlockExposure(QCamera::Searching, QCamera::UserRequest);
- m_pendingLocks |= QCamera::LockExposure;
- m_lockTimer.start(1000, this);
- } else {
- lockExposure(QCamera::UserRequest);
- }
- }
- if (locks & QCamera::LockWhiteBalance) {
- if (isWhiteBalanceLocked()) {
- unlockWhiteBalance(QCamera::Searching, QCamera::UserRequest);
- m_pendingLocks |= QCamera::LockWhiteBalance;
- m_lockTimer.start(1000, this);
- } else {
- lockWhiteBalance(QCamera::UserRequest);
- }
- }
-#endif
-
-}
-
-void CameraBinLocks::unlock(QCamera::LockTypes locks)
-{
- m_pendingLocks &= ~locks;
-
- if (locks & QCamera::LockFocus)
- m_focus->_q_stopFocusing();
-
-#if GST_CHECK_VERSION(1, 2, 0)
- if (!m_pendingLocks)
- m_lockTimer.stop();
-
- if (locks & QCamera::LockExposure)
- unlockExposure(QCamera::Unlocked, QCamera::UserRequest);
- if (locks & QCamera::LockWhiteBalance)
- unlockWhiteBalance(QCamera::Unlocked, QCamera::UserRequest);
-#endif
-}
-
-void CameraBinLocks::updateFocusStatus(QCamera::LockStatus status, QCamera::LockChangeReason reason)
-{
- if (status != QCamera::Searching)
- m_pendingLocks &= ~QCamera::LockFocus;
-
-#if GST_CHECK_VERSION(1, 2, 0)
- if (status == QCamera::Locked && !m_lockTimer.isActive()) {
- if (m_pendingLocks & QCamera::LockExposure)
- lockExposure(QCamera::LockAcquired);
- if (m_pendingLocks & QCamera::LockWhiteBalance)
- lockWhiteBalance(QCamera::LockAcquired);
- }
-#endif
- emit lockStatusChanged(QCamera::LockFocus, status, reason);
-}
-
-#if GST_CHECK_VERSION(1, 2, 0)
-
-void CameraBinLocks::timerEvent(QTimerEvent *event)
-{
- if (event->timerId() != m_lockTimer.timerId())
- return QCameraLocksControl::timerEvent(event);
-
- m_lockTimer.stop();
-
- if (!(m_pendingLocks & QCamera::LockFocus)) {
- if (m_pendingLocks & QCamera::LockExposure)
- lockExposure(QCamera::LockAcquired);
- if (m_pendingLocks & QCamera::LockWhiteBalance)
- lockWhiteBalance(QCamera::LockAcquired);
- }
-}
-
-bool CameraBinLocks::isExposureLocked() const
-{
- if (GstElement *source = m_session->cameraSource()) {
- GstPhotographyExposureMode exposureMode = GST_PHOTOGRAPHY_EXPOSURE_MODE_AUTO;
- g_object_get (G_OBJECT(source), "exposure-mode", &exposureMode, NULL);
- return exposureMode == GST_PHOTOGRAPHY_EXPOSURE_MODE_MANUAL;
- } else {
- return false;
- }
-}
-
-void CameraBinLocks::lockExposure(QCamera::LockChangeReason reason)
-{
- GstElement *source = m_session->cameraSource();
- if (!source)
- return;
-
- m_pendingLocks &= ~QCamera::LockExposure;
- g_object_set(
- G_OBJECT(source),
- "exposure-mode",
- GST_PHOTOGRAPHY_EXPOSURE_MODE_MANUAL,
- NULL);
- emit lockStatusChanged(QCamera::LockExposure, QCamera::Locked, reason);
-}
-
-void CameraBinLocks::unlockExposure(QCamera::LockStatus status, QCamera::LockChangeReason reason)
-{
- GstElement *source = m_session->cameraSource();
- if (!source)
- return;
-
- g_object_set(
- G_OBJECT(source),
- "exposure-mode",
- GST_PHOTOGRAPHY_EXPOSURE_MODE_AUTO,
- NULL);
- emit lockStatusChanged(QCamera::LockExposure, status, reason);
-}
-
-bool CameraBinLocks::isWhiteBalanceLocked() const
-{
- if (GstPhotography *photography = m_session->photography()) {
- GstPhotographyWhiteBalanceMode whiteBalanceMode;
- return gst_photography_get_white_balance_mode(photography, &whiteBalanceMode)
- && whiteBalanceMode == GST_PHOTOGRAPHY_WB_MODE_MANUAL;
- } else {
- return false;
- }
-}
-
-void CameraBinLocks::lockWhiteBalance(QCamera::LockChangeReason reason)
-{
- m_pendingLocks &= ~QCamera::LockWhiteBalance;
- m_session->imageProcessingControl()->lockWhiteBalance();
- emit lockStatusChanged(QCamera::LockWhiteBalance, QCamera::Locked, reason);
-}
-
-void CameraBinLocks::unlockWhiteBalance(
- QCamera::LockStatus status, QCamera::LockChangeReason reason)
-{
- m_session->imageProcessingControl()->lockWhiteBalance();
- emit lockStatusChanged(QCamera::LockWhiteBalance, status, reason);
-}
-
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinlocks.h b/src/plugins/gstreamer/camerabin/camerabinlocks.h
deleted file mode 100644
index cd592ffd2..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinlocks.h
+++ /dev/null
@@ -1,98 +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 CAMERABINLOCKSCONTROL_H
-#define CAMERABINLOCKSCONTROL_H
-
-#include <qcamera.h>
-#include <qcameralockscontrol.h>
-
-#include <QtCore/qbasictimer.h>
-
-#include <gst/gst.h>
-#include <glib.h>
-
-QT_BEGIN_NAMESPACE
-
-class CameraBinSession;
-class CameraBinFocus;
-
-class CameraBinLocks : public QCameraLocksControl
-{
- Q_OBJECT
-
-public:
- CameraBinLocks(CameraBinSession *session);
- virtual ~CameraBinLocks();
-
- QCamera::LockTypes supportedLocks() const override;
-
- QCamera::LockStatus lockStatus(QCamera::LockType lock) const override;
-
- void searchAndLock(QCamera::LockTypes locks) override;
- void unlock(QCamera::LockTypes locks) override;
-
-protected:
-#if GST_CHECK_VERSION(1, 2, 0)
- void timerEvent(QTimerEvent *event) override;
-#endif
-
-private slots:
- void updateFocusStatus(QCamera::LockStatus status, QCamera::LockChangeReason reason);
-
-private:
-#if GST_CHECK_VERSION(1, 2, 0)
- bool isExposureLocked() const;
- void lockExposure(QCamera::LockChangeReason reason);
- void unlockExposure(QCamera::LockStatus status, QCamera::LockChangeReason reason);
-
- bool isWhiteBalanceLocked() const;
- void lockWhiteBalance(QCamera::LockChangeReason reason);
- void unlockWhiteBalance(QCamera::LockStatus status, QCamera::LockChangeReason reason);
-#endif
-
- CameraBinSession *m_session;
- CameraBinFocus *m_focus;
- QBasicTimer m_lockTimer;
- QCamera::LockTypes m_pendingLocks;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/gstreamer/camerabin/camerabinmetadata.cpp b/src/plugins/gstreamer/camerabin/camerabinmetadata.cpp
deleted file mode 100644
index afda2346d..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinmetadata.cpp
+++ /dev/null
@@ -1,234 +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$
-**
-****************************************************************************/
-
-#include "camerabinmetadata.h"
-
-#include <QtMultimedia/qmediametadata.h>
-
-#include <gst/gst.h>
-#include <gst/gstversion.h>
-#include <private/qgstutils_p.h>
-
-#include <QDebug>
-
-QT_BEGIN_NAMESPACE
-
-namespace {
- struct QGStreamerMetaDataKey
- {
- QString qtName;
- const char *gstName;
- QVariant::Type type;
-
- QGStreamerMetaDataKey(const QString &qtn, const char *gstn, QVariant::Type t)
- : qtName(qtn)
- , gstName(gstn)
- , type(t)
- { }
- };
-}
-
-typedef QList<QGStreamerMetaDataKey> QGStreamerMetaDataKeys;
-Q_GLOBAL_STATIC(QGStreamerMetaDataKeys, metadataKeys)
-
-static const QGStreamerMetaDataKeys *qt_gstreamerMetaDataKeys()
-{
- if (metadataKeys->isEmpty()) {
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Title, GST_TAG_TITLE, QVariant::String));
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::SubTitle, 0, QVariant::String));
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Author, 0, QVariant::String));
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Comment, GST_TAG_COMMENT, QVariant::String));
-#if GST_CHECK_VERSION(0,10,31)
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Date, GST_TAG_DATE_TIME, QVariant::DateTime));
-#endif
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Description, GST_TAG_DESCRIPTION, QVariant::String));
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Category, 0, QVariant::String));
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Genre, GST_TAG_GENRE, QVariant::String));
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Year, 0, QVariant::Int));
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::UserRating, , QVariant::Int));
-
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Language, GST_TAG_LANGUAGE_CODE, QVariant::String));
-
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Publisher, GST_TAG_ORGANIZATION, QVariant::String));
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Copyright, GST_TAG_COPYRIGHT, QVariant::String));
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::ParentalRating, 0, QVariant::String));
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::RatingOrganisation, 0, QVariant::String));
-
- // Media
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Size, 0, QVariant::Int));
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::MediaType, 0, QVariant::String));
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Duration, GST_TAG_DURATION, QVariant::Int));
-
- // Audio
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::AudioBitRate, GST_TAG_BITRATE, QVariant::Int));
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::AudioCodec, GST_TAG_AUDIO_CODEC, QVariant::String));
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::ChannelCount, 0, QVariant::Int));
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::SampleRate, 0, QVariant::Int));
-
- // Music
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::AlbumTitle, GST_TAG_ALBUM, QVariant::String));
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::AlbumArtist, GST_TAG_ARTIST, QVariant::String));
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::ContributingArtist, GST_TAG_PERFORMER, QVariant::String));
-#if GST_CHECK_VERSION(0,10,19)
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Composer, GST_TAG_COMPOSER, QVariant::String));
-#endif
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Conductor, 0, QVariant::String));
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Lyrics, 0, QVariant::String));
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Mood, 0, QVariant::String));
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::TrackNumber, GST_TAG_TRACK_NUMBER, QVariant::Int));
-
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::CoverArtUrlSmall, 0, QVariant::String));
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::CoverArtUrlLarge, 0, QVariant::String));
-
- // Image/Video
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Resolution, 0, QVariant::Size));
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::PixelAspectRatio, 0, QVariant::Size));
-
- // Video
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::VideoFrameRate, 0, QVariant::String));
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::VideoBitRate, 0, QVariant::Double));
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::VideoCodec, GST_TAG_VIDEO_CODEC, QVariant::String));
-
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::PosterUrl, 0, QVariant::String));
-
- // Movie
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::ChapterNumber, 0, QVariant::Int));
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Director, 0, QVariant::String));
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::LeadPerformer, GST_TAG_PERFORMER, QVariant::String));
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Writer, 0, QVariant::String));
-#if GST_CHECK_VERSION(0,10,30)
- // Photos
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::CameraManufacturer, GST_TAG_DEVICE_MANUFACTURER, QVariant::String));
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::CameraModel, GST_TAG_DEVICE_MODEL, QVariant::String));
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Event, 0, QVariant::String));
- //metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Subject, 0, QVariant::String));
-
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Orientation, GST_TAG_IMAGE_ORIENTATION, QVariant::String));
-
- // GPS
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::GPSLatitude, GST_TAG_GEO_LOCATION_LATITUDE, QVariant::Double));
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::GPSLongitude, GST_TAG_GEO_LOCATION_LONGITUDE, QVariant::Double));
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::GPSAltitude, GST_TAG_GEO_LOCATION_ELEVATION, QVariant::Double));
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::GPSTrack, GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION, QVariant::Double));
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::GPSSpeed, GST_TAG_GEO_LOCATION_MOVEMENT_SPEED, QVariant::Double));
- metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::GPSImgDirection, GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION, QVariant::Double));
-#endif
- }
-
- return metadataKeys;
-}
-
-CameraBinMetaData::CameraBinMetaData(QObject *parent)
- :QMetaDataWriterControl(parent)
-{
-}
-
-QVariant CameraBinMetaData::metaData(const QString &key) const
-{
-#if GST_CHECK_VERSION(0,10,30)
- if (key == QMediaMetaData::Orientation) {
- return QGstUtils::fromGStreamerOrientation(m_values.value(QByteArray(GST_TAG_IMAGE_ORIENTATION)));
- } else if (key == QMediaMetaData::GPSSpeed) {
- const double metersPerSec = m_values.value(QByteArray(GST_TAG_GEO_LOCATION_MOVEMENT_SPEED)).toDouble();
- return (metersPerSec * 3600) / 1000;
- }
-#endif
-
- const auto keys = *qt_gstreamerMetaDataKeys();
- for (const QGStreamerMetaDataKey &metadataKey : keys) {
- if (metadataKey.qtName == key)
- return m_values.value(QByteArray::fromRawData(metadataKey.gstName, qstrlen(metadataKey.gstName)));
- }
- return QVariant();
-}
-
-void CameraBinMetaData::setMetaData(const QString &key, const QVariant &value)
-{
- QVariant correctedValue = value;
-#if GST_CHECK_VERSION(0,10,30)
- if (value.isValid()) {
- if (key == QMediaMetaData::Orientation) {
- correctedValue = QGstUtils::toGStreamerOrientation(value);
- } else if (key == QMediaMetaData::GPSSpeed) {
- // kilometers per hour to meters per second.
- correctedValue = (value.toDouble() * 1000) / 3600;
- }
- }
-#endif
-
- const auto keys = *qt_gstreamerMetaDataKeys();
- for (const QGStreamerMetaDataKey &metadataKey : keys) {
- if (metadataKey.qtName == key) {
- const char *name = metadataKey.gstName;
-
- if (correctedValue.isValid()) {
- correctedValue.convert(metadataKey.type);
- m_values.insert(QByteArray::fromRawData(name, qstrlen(name)), correctedValue);
- } else {
- m_values.remove(QByteArray::fromRawData(name, qstrlen(name)));
- }
-
- emit QMetaDataWriterControl::metaDataChanged();
- emit metaDataChanged(m_values);
-
- return;
- }
- }
-}
-
-QStringList CameraBinMetaData::availableMetaData() const
-{
- static QMap<QByteArray, QString> keysMap;
- if (keysMap.isEmpty()) {
- const auto keys = *qt_gstreamerMetaDataKeys();
- for (const QGStreamerMetaDataKey &metadataKey : keys)
- keysMap[QByteArray(metadataKey.gstName)] = metadataKey.qtName;
- }
-
- QStringList res;
- for (auto it = m_values.keyBegin(), end = m_values.keyEnd(); it != end; ++it) {
- QString tag = keysMap.value(*it);
- if (!tag.isEmpty())
- res.append(tag);
- }
-
- return res;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinmetadata.h b/src/plugins/gstreamer/camerabin/camerabinmetadata.h
deleted file mode 100644
index 5fef7e388..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinmetadata.h
+++ /dev/null
@@ -1,71 +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 CAMERABINCAPTUREMETADATACONTROL_H
-#define CAMERABINCAPTUREMETADATACONTROL_H
-
-#include <qmetadatawritercontrol.h>
-
-QT_BEGIN_NAMESPACE
-
-class CameraBinMetaData : public QMetaDataWriterControl
-{
- Q_OBJECT
-public:
- CameraBinMetaData(QObject *parent);
- virtual ~CameraBinMetaData() {}
-
-
- bool isMetaDataAvailable() const override { return true; }
- bool isWritable() const override { return true; }
-
- QVariant metaData(const QString &key) const override;
- void setMetaData(const QString &key, const QVariant &value) override;
- QStringList availableMetaData() const override;
-
-Q_SIGNALS:
- void metaDataChanged(const QMap<QByteArray, QVariant>&);
-
-private:
- QMap<QByteArray, QVariant> m_values;
-};
-
-QT_END_NAMESPACE
-
-#endif // CAMERABINCAPTUREMETADATACONTROL_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinrecorder.cpp b/src/plugins/gstreamer/camerabin/camerabinrecorder.cpp
deleted file mode 100644
index b3505231b..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinrecorder.cpp
+++ /dev/null
@@ -1,298 +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$
-**
-****************************************************************************/
-
-#include "camerabinrecorder.h"
-#include "camerabincontrol.h"
-#include "camerabinresourcepolicy.h"
-#include "camerabinaudioencoder.h"
-#include "camerabinvideoencoder.h"
-#include "camerabincontainer.h"
-#include <QtCore/QDebug>
-
-
-QT_BEGIN_NAMESPACE
-
-CameraBinRecorder::CameraBinRecorder(CameraBinSession *session)
- :QMediaRecorderControl(session),
- m_session(session),
- m_state(QMediaRecorder::StoppedState),
- m_status(QMediaRecorder::UnloadedStatus)
-{
- connect(m_session, SIGNAL(statusChanged(QCamera::Status)), SLOT(updateStatus()));
- connect(m_session, SIGNAL(pendingStateChanged(QCamera::State)), SLOT(updateStatus()));
- connect(m_session, SIGNAL(busyChanged(bool)), SLOT(updateStatus()));
-
- connect(m_session, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged(qint64)));
- connect(m_session, SIGNAL(mutedChanged(bool)), this, SIGNAL(mutedChanged(bool)));
- connect(m_session->cameraControl()->resourcePolicy(), SIGNAL(canCaptureChanged()),
- this, SLOT(updateStatus()));
-}
-
-CameraBinRecorder::~CameraBinRecorder()
-{
-}
-
-QUrl CameraBinRecorder::outputLocation() const
-{
- return m_session->outputLocation();
-}
-
-bool CameraBinRecorder::setOutputLocation(const QUrl &sink)
-{
- m_session->setOutputLocation(sink);
- return true;
-}
-
-QMediaRecorder::State CameraBinRecorder::state() const
-{
- return m_state;
-}
-
-QMediaRecorder::Status CameraBinRecorder::status() const
-{
- return m_status;
-}
-
-void CameraBinRecorder::updateStatus()
-{
- QCamera::Status sessionStatus = m_session->status();
-
- QMediaRecorder::State oldState = m_state;
- QMediaRecorder::Status oldStatus = m_status;
-
- if (sessionStatus == QCamera::ActiveStatus &&
- m_session->captureMode().testFlag(QCamera::CaptureVideo)) {
-
- if (!m_session->cameraControl()->resourcePolicy()->canCapture()) {
- m_status = QMediaRecorder::UnavailableStatus;
- m_state = QMediaRecorder::StoppedState;
- m_session->stopVideoRecording();
- } else if (m_state == QMediaRecorder::RecordingState) {
- m_status = QMediaRecorder::RecordingStatus;
- } else {
- m_status = m_session->isBusy() ?
- QMediaRecorder::FinalizingStatus :
- QMediaRecorder::LoadedStatus;
- }
- } else {
- if (m_state == QMediaRecorder::RecordingState) {
- m_state = QMediaRecorder::StoppedState;
- m_session->stopVideoRecording();
- }
- m_status = m_session->pendingState() == QCamera::ActiveState
- && m_session->captureMode().testFlag(QCamera::CaptureVideo)
- ? QMediaRecorder::LoadingStatus
- : QMediaRecorder::UnloadedStatus;
- }
-
- if (m_state != oldState)
- emit stateChanged(m_state);
-
- if (m_status != oldStatus)
- emit statusChanged(m_status);
-}
-
-qint64 CameraBinRecorder::duration() const
-{
- return m_session->duration();
-}
-
-
-void CameraBinRecorder::applySettings()
-{
-#if QT_CONFIG(gstreamer_encodingprofiles)
- CameraBinContainer *containerControl = m_session->mediaContainerControl();
- CameraBinAudioEncoder *audioEncoderControl = m_session->audioEncodeControl();
- CameraBinVideoEncoder *videoEncoderControl = m_session->videoEncodeControl();
-
- containerControl->resetActualContainerFormat();
- audioEncoderControl->resetActualSettings();
- videoEncoderControl->resetActualSettings();
-
- //encodebin doesn't like the encoding profile with ANY caps,
- //if container and codecs are not specified,
- //try to find a commonly used supported combination
- if (containerControl->containerFormat().isEmpty() &&
- audioEncoderControl->audioSettings().codec().isEmpty() &&
- videoEncoderControl->videoSettings().codec().isEmpty()) {
-
- QList<QStringList> candidates;
-
- // By order of preference
-
- // .mp4 (h264, AAC)
- candidates.append(QStringList() << "video/quicktime, variant=(string)iso" << "video/x-h264" << "audio/mpeg, mpegversion=(int)4");
-
- // .mp4 (h264, AC3)
- candidates.append(QStringList() << "video/quicktime, variant=(string)iso" << "video/x-h264" << "audio/x-ac3");
-
- // .mp4 (h264, MP3)
- candidates.append(QStringList() << "video/quicktime, variant=(string)iso" << "video/x-h264" << "audio/mpeg, mpegversion=(int)1, layer=(int)3");
-
- // .mkv (h264, AAC)
- candidates.append(QStringList() << "video/x-matroska" << "video/x-h264" << "audio/mpeg, mpegversion=(int)4");
-
- // .mkv (h264, AC3)
- candidates.append(QStringList() << "video/x-matroska" << "video/x-h264" << "audio/x-ac3");
-
- // .mkv (h264, MP3)
- candidates.append(QStringList() << "video/x-matroska" << "video/x-h264" << "audio/mpeg, mpegversion=(int)1, layer=(int)3");
-
- // .mov (h264, AAC)
- candidates.append(QStringList() << "video/quicktime" << "video/x-h264" << "audio/mpeg, mpegversion=(int)4");
-
- // .mov (h264, MP3)
- candidates.append(QStringList() << "video/quicktime" << "video/x-h264" << "audio/mpeg, mpegversion=(int)1, layer=(int)3");
-
- // .webm (VP8, Vorbis)
- candidates.append(QStringList() << "video/webm" << "video/x-vp8" << "audio/x-vorbis");
-
- // .ogg (Theora, Vorbis)
- candidates.append(QStringList() << "application/ogg" << "video/x-theora" << "audio/x-vorbis");
-
- // .avi (DivX, MP3)
- candidates.append(QStringList() << "video/x-msvideo" << "video/x-divx" << "audio/mpeg, mpegversion=(int)1, layer=(int)3");
-
- for (const QStringList &candidate : qAsConst(candidates)) {
- if (containerControl->supportedContainers().contains(candidate[0]) &&
- videoEncoderControl->supportedVideoCodecs().contains(candidate[1]) &&
- audioEncoderControl->supportedAudioCodecs().contains(candidate[2])) {
- containerControl->setActualContainerFormat(candidate[0]);
-
- QVideoEncoderSettings videoSettings = videoEncoderControl->videoSettings();
- videoSettings.setCodec(candidate[1]);
- videoEncoderControl->setActualVideoSettings(videoSettings);
-
- QAudioEncoderSettings audioSettings = audioEncoderControl->audioSettings();
- audioSettings.setCodec(candidate[2]);
- audioEncoderControl->setActualAudioSettings(audioSettings);
-
- break;
- }
- }
- }
-#endif
-}
-
-#if QT_CONFIG(gstreamer_encodingprofiles)
-
-GstEncodingContainerProfile *CameraBinRecorder::videoProfile()
-{
- GstEncodingContainerProfile *containerProfile = m_session->mediaContainerControl()->createProfile();
-
- if (containerProfile) {
- GstEncodingProfile *audioProfile = m_session->audioEncodeControl()->createProfile();
- GstEncodingProfile *videoProfile = m_session->videoEncodeControl()->createProfile();
-
- if (audioProfile) {
- if (!gst_encoding_container_profile_add_profile(containerProfile, audioProfile))
- gst_encoding_profile_unref(audioProfile);
- }
- if (videoProfile) {
- if (!gst_encoding_container_profile_add_profile(containerProfile, videoProfile))
- gst_encoding_profile_unref(videoProfile);
- }
- }
-
- return containerProfile;
-}
-
-#endif
-
-void CameraBinRecorder::setState(QMediaRecorder::State state)
-{
- if (m_state == state)
- return;
-
- QMediaRecorder::State oldState = m_state;
- QMediaRecorder::Status oldStatus = m_status;
-
- switch (state) {
- case QMediaRecorder::StoppedState:
- m_state = state;
- m_status = QMediaRecorder::FinalizingStatus;
- m_session->stopVideoRecording();
- break;
- case QMediaRecorder::PausedState:
- emit error(QMediaRecorder::ResourceError, tr("QMediaRecorder::pause() is not supported by camerabin2."));
- break;
- case QMediaRecorder::RecordingState:
-
- if (m_session->status() != QCamera::ActiveStatus) {
- emit error(QMediaRecorder::ResourceError, tr("Service has not been started"));
- } else if (!m_session->cameraControl()->resourcePolicy()->canCapture()) {
- emit error(QMediaRecorder::ResourceError, tr("Recording permissions are not available"));
- } else {
- m_session->recordVideo();
- m_state = state;
- m_status = QMediaRecorder::RecordingStatus;
- emit actualLocationChanged(m_session->outputLocation());
- }
- }
-
- if (m_state != oldState)
- emit stateChanged(m_state);
-
- if (m_status != oldStatus)
- emit statusChanged(m_status);
-}
-
-bool CameraBinRecorder::isMuted() const
-{
- return m_session->isMuted();
-}
-
-qreal CameraBinRecorder::volume() const
-{
- return 1.0;
-}
-
-void CameraBinRecorder::setMuted(bool muted)
-{
- m_session->setMuted(muted);
-}
-
-void CameraBinRecorder::setVolume(qreal volume)
-{
- if (!qFuzzyCompare(volume, qreal(1.0)))
- qWarning() << "Media service doesn't support recorder audio gain.";
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/plugins/gstreamer/camerabin/camerabinrecorder.h b/src/plugins/gstreamer/camerabin/camerabinrecorder.h
deleted file mode 100644
index 8bd922fb8..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinrecorder.h
+++ /dev/null
@@ -1,94 +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 CAMERABINRECORDERCONTROL_H
-#define CAMERABINRECORDERCONTROL_H
-
-#include <QtMultimedia/private/qtmultimediaglobal_p.h>
-#include <qmediarecordercontrol.h>
-#include "camerabinsession.h"
-
-#if QT_CONFIG(gstreamer_encodingprofiles)
-#include <gst/pbutils/encoding-profile.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class CameraBinRecorder : public QMediaRecorderControl
-{
- Q_OBJECT
-
-public:
- CameraBinRecorder(CameraBinSession *session);
- virtual ~CameraBinRecorder();
-
- QUrl outputLocation() const override;
- bool setOutputLocation(const QUrl &sink) override;
-
- QMediaRecorder::State state() const override;
- QMediaRecorder::Status status() const override;
-
- qint64 duration() const override;
-
- bool isMuted() const override;
- qreal volume() const override;
-
- void applySettings() override;
-
-#if QT_CONFIG(gstreamer_encodingprofiles)
- GstEncodingContainerProfile *videoProfile();
-#endif
-
-public slots:
- void setState(QMediaRecorder::State state) override;
- void setMuted(bool) override;
- void setVolume(qreal volume) override;
-
- void updateStatus();
-
-private:
- CameraBinSession *m_session;
- QMediaRecorder::State m_state;
- QMediaRecorder::Status m_status;
-};
-
-QT_END_NAMESPACE
-
-#endif // CAMERABINCAPTURECORNTROL_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp b/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp
deleted file mode 100644
index 6da86e569..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp
+++ /dev/null
@@ -1,242 +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$
-**
-****************************************************************************/
-
-#include "QtMultimedia/private/qtmultimediaglobal_p.h"
-#include "camerabinresourcepolicy.h"
-//#define DEBUG_RESOURCE_POLICY
-#include <QtCore/qdebug.h>
-#include <QtCore/qset.h>
-
-#if QT_CONFIG(resourcepolicy)
-#include <policy/resource.h>
-#include <policy/resources.h>
-#include <policy/resource-set.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-CamerabinResourcePolicy::CamerabinResourcePolicy(QObject *parent) :
- QObject(parent),
- m_resourceSet(NoResources),
- m_releasingResources(false),
- m_canCapture(false)
-{
-#if QT_CONFIG(resourcepolicy)
- //loaded resource set is also kept requested for image and video capture sets
- m_resource = new ResourcePolicy::ResourceSet("camera");
- m_resource->setAlwaysReply();
- m_resource->initAndConnect();
-
- connect(m_resource, SIGNAL(resourcesGranted(QList<ResourcePolicy::ResourceType>)),
- SLOT(handleResourcesGranted()));
- connect(m_resource, SIGNAL(resourcesDenied()), SIGNAL(resourcesDenied()));
- connect(m_resource, SIGNAL(lostResources()), SLOT(handleResourcesLost()));
- connect(m_resource, SIGNAL(resourcesReleased()), SLOT(handleResourcesReleased()));
- connect(m_resource, SIGNAL(resourcesBecameAvailable(QList<ResourcePolicy::ResourceType>)),
- this, SLOT(resourcesAvailable()));
- connect(m_resource, SIGNAL(updateOK()), this, SLOT(updateCanCapture()));
-#endif
-}
-
-CamerabinResourcePolicy::~CamerabinResourcePolicy()
-{
-#if QT_CONFIG(resourcepolicy)
- //ensure the resources are released
- if (m_resourceSet != NoResources)
- setResourceSet(NoResources);
-
- //don't delete the resource set until resources are released
- if (m_releasingResources) {
- m_resource->connect(m_resource, SIGNAL(resourcesReleased()),
- SLOT(deleteLater()));
- } else {
- delete m_resource;
- m_resource = 0;
- }
-#endif
-}
-
-CamerabinResourcePolicy::ResourceSet CamerabinResourcePolicy::resourceSet() const
-{
- return m_resourceSet;
-}
-
-void CamerabinResourcePolicy::setResourceSet(CamerabinResourcePolicy::ResourceSet set)
-{
- CamerabinResourcePolicy::ResourceSet oldSet = m_resourceSet;
- m_resourceSet = set;
-
-#ifdef DEBUG_RESOURCE_POLICY
- qDebug() << Q_FUNC_INFO << set;
-#endif
-
-#if QT_CONFIG(resourcepolicy)
- QSet<ResourcePolicy::ResourceType> requestedTypes;
-
- switch (set) {
- case NoResources:
- break;
- case LoadedResources:
- requestedTypes << ResourcePolicy::LensCoverType //to detect lens cover is opened/closed
- << ResourcePolicy::VideoRecorderType; //to open camera device
- break;
- case ImageCaptureResources:
- requestedTypes << ResourcePolicy::LensCoverType
- << ResourcePolicy::VideoPlaybackType
- << ResourcePolicy::VideoRecorderType
- << ResourcePolicy::LedsType;
- break;
- case VideoCaptureResources:
- requestedTypes << ResourcePolicy::LensCoverType
- << ResourcePolicy::VideoPlaybackType
- << ResourcePolicy::VideoRecorderType
- << ResourcePolicy::AudioPlaybackType
- << ResourcePolicy::AudioRecorderType
- << ResourcePolicy::LedsType;
- break;
- }
-
- QSet<ResourcePolicy::ResourceType> currentTypes;
- const auto resources = m_resource->resources();
- currentTypes.reserve(resources.size());
- for (ResourcePolicy::Resource *resource : resources)
- currentTypes << resource->type();
-
- const auto diffCurrentWithRequested = currentTypes - requestedTypes;
- for (ResourcePolicy::ResourceType resourceType : diffCurrentWithRequested)
- m_resource->deleteResource(resourceType);
-
- const auto diffRequestedWithCurrent = requestedTypes - currentTypes;
- for (ResourcePolicy::ResourceType resourceType : diffRequestedWithCurrent) {
- if (resourceType == ResourcePolicy::LensCoverType) {
- ResourcePolicy::LensCoverResource *lensCoverResource = new ResourcePolicy::LensCoverResource;
- lensCoverResource->setOptional(true);
- m_resource->addResourceObject(lensCoverResource);
- } else if (resourceType == ResourcePolicy::AudioPlaybackType) {
- ResourcePolicy::Resource *resource = new ResourcePolicy::AudioResource;
- resource->setOptional(true);
- m_resource->addResourceObject(resource);
- } else if (resourceType == ResourcePolicy::AudioRecorderType) {
- ResourcePolicy::Resource *resource = new ResourcePolicy::AudioRecorderResource;
- resource->setOptional(true);
- m_resource->addResourceObject(resource);
- } else {
- m_resource->addResource(resourceType);
- }
- }
-
- m_resource->update();
- if (set != NoResources) {
- m_resource->acquire();
- } else {
- if (oldSet != NoResources) {
- m_releasingResources = true;
- m_resource->release();
- }
- }
-#else
- Q_UNUSED(oldSet);
- updateCanCapture();
-#endif
-}
-
-bool CamerabinResourcePolicy::isResourcesGranted() const
-{
-#if QT_CONFIG(resourcepolicy)
- const auto resources = m_resource->resources();
- for (ResourcePolicy::Resource *resource : resources)
- if (!resource->isOptional() && !resource->isGranted())
- return false;
-#endif
- return true;
-}
-
-void CamerabinResourcePolicy::handleResourcesLost()
-{
- updateCanCapture();
- emit resourcesLost();
-}
-
-void CamerabinResourcePolicy::handleResourcesGranted()
-{
- updateCanCapture();
- emit resourcesGranted();
-}
-
-void CamerabinResourcePolicy::handleResourcesReleased()
-{
-#if QT_CONFIG(resourcepolicy)
-#ifdef DEBUG_RESOURCE_POLICY
- qDebug() << Q_FUNC_INFO;
-#endif
- m_releasingResources = false;
-#endif
- updateCanCapture();
-}
-
-void CamerabinResourcePolicy::resourcesAvailable()
-{
-#if QT_CONFIG(resourcepolicy)
- if (m_resourceSet != NoResources) {
- m_resource->acquire();
- }
-#endif
-}
-
-bool CamerabinResourcePolicy::canCapture() const
-{
- return m_canCapture;
-}
-
-void CamerabinResourcePolicy::updateCanCapture()
-{
- const bool wasAbleToRecord = m_canCapture;
- m_canCapture = (m_resourceSet == VideoCaptureResources) || (m_resourceSet == ImageCaptureResources);
-#if QT_CONFIG(resourcepolicy)
- const auto resources = m_resource->resources();
- for (ResourcePolicy::Resource *resource : resources) {
- if (resource->type() != ResourcePolicy::LensCoverType)
- m_canCapture = m_canCapture && resource->isGranted();
- }
-#endif
- if (wasAbleToRecord != m_canCapture)
- emit canCaptureChanged();
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.h b/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.h
deleted file mode 100644
index c54595bcc..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.h
+++ /dev/null
@@ -1,95 +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 CAMERARESOURCEPOLICY_H
-#define CAMERARESOURCEPOLICY_H
-
-#include <QtCore/qobject.h>
-
-namespace ResourcePolicy {
-class ResourceSet;
-};
-
-QT_BEGIN_NAMESPACE
-
-class CamerabinResourcePolicy : public QObject
-{
- Q_OBJECT
-public:
- enum ResourceSet {
- NoResources,
- LoadedResources,
- ImageCaptureResources,
- VideoCaptureResources
- };
-
- CamerabinResourcePolicy(QObject *parent);
- ~CamerabinResourcePolicy();
-
- ResourceSet resourceSet() const;
- void setResourceSet(ResourceSet set);
-
- bool isResourcesGranted() const;
-
- bool canCapture() const;
-
-Q_SIGNALS:
- void resourcesDenied();
- void resourcesGranted();
- void resourcesLost();
- void canCaptureChanged();
-
-private Q_SLOTS:
- void handleResourcesLost();
- void handleResourcesGranted();
- void handleResourcesReleased();
- void resourcesAvailable();
- void updateCanCapture();
-
-
-private:
- ResourceSet m_resourceSet;
- ResourcePolicy::ResourceSet *m_resource;
- bool m_releasingResources;
- bool m_canCapture;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/gstreamer/camerabin/camerabinservice.cpp b/src/plugins/gstreamer/camerabin/camerabinservice.cpp
deleted file mode 100644
index a68ecfdbe..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinservice.cpp
+++ /dev/null
@@ -1,271 +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$
-**
-****************************************************************************/
-
-#include <QtMultimedia/private/qtmultimediaglobal_p.h>
-#include "camerabinservice.h"
-#include "camerabinsession.h"
-#include "camerabinrecorder.h"
-#include "camerabincontainer.h"
-#include "camerabinaudioencoder.h"
-#include "camerabinvideoencoder.h"
-#include "camerabinimageencoder.h"
-#include "camerabincontrol.h"
-#include "camerabinmetadata.h"
-#include "camerabininfocontrol.h"
-
-#if QT_CONFIG(gstreamer_photography)
-#include "camerabinexposure.h"
-#include "camerabinflash.h"
-#include "camerabinfocus.h"
-#include "camerabinlocks.h"
-#endif
-
-#include "camerabinimagecapture.h"
-#include "camerabinimageprocessing.h"
-#include "camerabincapturebufferformat.h"
-#include "camerabincapturedestination.h"
-#include "camerabinviewfindersettings.h"
-#include "camerabinviewfindersettings2.h"
-#include "camerabinzoom.h"
-#include <private/qgstreamerbushelper_p.h>
-#include <private/qgstutils_p.h>
-
-#include <private/qgstreameraudioinputselector_p.h>
-#include <private/qgstreamervideoinputdevicecontrol_p.h>
-
-#if defined(HAVE_WIDGETS)
-#include <private/qgstreamervideowidget_p.h>
-#endif
-#include <private/qgstreamervideowindow_p.h>
-#include <private/qgstreamervideorenderer_p.h>
-#include <private/qmediaserviceprovider_p.h>
-
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-CameraBinService::CameraBinService(GstElementFactory *sourceFactory, QObject *parent):
- QMediaService(parent),
- m_cameraInfoControl(0),
- m_viewfinderSettingsControl(0),
- m_viewfinderSettingsControl2(0)
-{
- m_captureSession = 0;
- m_metaDataControl = 0;
-
- m_audioInputSelector = 0;
- m_videoInputDevice = 0;
-
- m_videoOutput = 0;
- m_videoRenderer = 0;
- m_videoWindow = 0;
-#if defined(HAVE_WIDGETS)
- m_videoWidgetControl = 0;
-#endif
- m_imageCaptureControl = 0;
-
- m_captureSession = new CameraBinSession(sourceFactory, this);
- m_videoInputDevice = new QGstreamerVideoInputDeviceControl(sourceFactory, m_captureSession);
- m_imageCaptureControl = new CameraBinImageCapture(m_captureSession);
-
- connect(m_videoInputDevice, SIGNAL(selectedDeviceChanged(QString)),
- m_captureSession, SLOT(setDevice(QString)));
-
- if (m_videoInputDevice->deviceCount())
- m_captureSession->setDevice(m_videoInputDevice->deviceName(m_videoInputDevice->selectedDevice()));
-
- m_videoRenderer = new QGstreamerVideoRenderer(this);
-
- m_videoWindow = new QGstreamerVideoWindow(this);
- // If the GStreamer video sink is not available, don't provide the video window control since
- // it won't work anyway.
- if (!m_videoWindow->videoSink()) {
- delete m_videoWindow;
- m_videoWindow = 0;
- }
-#if defined(HAVE_WIDGETS)
- m_videoWidgetControl = new QGstreamerVideoWidgetControl(this);
-
- // If the GStreamer video sink is not available, don't provide the video widget control since
- // it won't work anyway. QVideoWidget will fall back to QVideoRendererControl in that case.
- if (!m_videoWidgetControl->videoSink()) {
- delete m_videoWidgetControl;
- m_videoWidgetControl = 0;
- }
-#endif
-
- m_audioInputSelector = new QGstreamerAudioInputSelector(this);
- connect(m_audioInputSelector, SIGNAL(activeInputChanged(QString)), m_captureSession, SLOT(setCaptureDevice(QString)));
-
- if (m_captureSession && m_audioInputSelector->availableInputs().size() > 0)
- m_captureSession->setCaptureDevice(m_audioInputSelector->defaultInput());
-
- m_metaDataControl = new CameraBinMetaData(this);
- connect(m_metaDataControl, SIGNAL(metaDataChanged(QMap<QByteArray,QVariant>)),
- m_captureSession, SLOT(setMetaData(QMap<QByteArray,QVariant>)));
-}
-
-CameraBinService::~CameraBinService()
-{
-}
-
-QMediaControl *CameraBinService::requestControl(const char *name)
-{
- if (!m_captureSession)
- return 0;
-
- if (!m_videoOutput) {
- if (qstrcmp(name, QVideoRendererControl_iid) == 0) {
- m_videoOutput = m_videoRenderer;
- } else if (qstrcmp(name, QVideoWindowControl_iid) == 0) {
- m_videoOutput = m_videoWindow;
- }
-#if defined(HAVE_WIDGETS)
- else if (qstrcmp(name, QVideoWidgetControl_iid) == 0) {
- m_videoOutput = m_videoWidgetControl;
- }
-#endif
-
- if (m_videoOutput) {
- m_captureSession->setViewfinder(m_videoOutput);
- return m_videoOutput;
- }
- }
-
- if (qstrcmp(name, QMediaVideoProbeControl_iid) == 0)
- return m_captureSession->videoProbe();
-
- if (qstrcmp(name,QAudioInputSelectorControl_iid) == 0)
- return m_audioInputSelector;
-
- if (qstrcmp(name,QVideoDeviceSelectorControl_iid) == 0)
- return m_videoInputDevice;
-
- if (qstrcmp(name,QMediaRecorderControl_iid) == 0)
- return m_captureSession->recorderControl();
-
- if (qstrcmp(name,QAudioEncoderSettingsControl_iid) == 0)
- return m_captureSession->audioEncodeControl();
-
- if (qstrcmp(name,QVideoEncoderSettingsControl_iid) == 0)
- return m_captureSession->videoEncodeControl();
-
- if (qstrcmp(name,QImageEncoderControl_iid) == 0)
- return m_captureSession->imageEncodeControl();
-
-
- if (qstrcmp(name,QMediaContainerControl_iid) == 0)
- return m_captureSession->mediaContainerControl();
-
- if (qstrcmp(name,QCameraControl_iid) == 0)
- return m_captureSession->cameraControl();
-
- if (qstrcmp(name,QMetaDataWriterControl_iid) == 0)
- return m_metaDataControl;
-
- if (qstrcmp(name, QCameraImageCaptureControl_iid) == 0)
- return m_imageCaptureControl;
-
-#if QT_CONFIG(gstreamer_photography)
- if (qstrcmp(name, QCameraExposureControl_iid) == 0)
- return m_captureSession->cameraExposureControl();
-
- if (qstrcmp(name, QCameraFlashControl_iid) == 0)
- return m_captureSession->cameraFlashControl();
-
- if (qstrcmp(name, QCameraFocusControl_iid) == 0)
- return m_captureSession->cameraFocusControl();
-
- if (qstrcmp(name, QCameraLocksControl_iid) == 0)
- return m_captureSession->cameraLocksControl();
-#endif
-
- if (qstrcmp(name, QCameraZoomControl_iid) == 0)
- return m_captureSession->cameraZoomControl();
-
- if (qstrcmp(name, QCameraImageProcessingControl_iid) == 0)
- return m_captureSession->imageProcessingControl();
-
- if (qstrcmp(name, QCameraCaptureDestinationControl_iid) == 0)
- return m_captureSession->captureDestinationControl();
-
- if (qstrcmp(name, QCameraCaptureBufferFormatControl_iid) == 0)
- return m_captureSession->captureBufferFormatControl();
-
- if (qstrcmp(name, QCameraViewfinderSettingsControl_iid) == 0) {
- if (!m_viewfinderSettingsControl)
- m_viewfinderSettingsControl = new CameraBinViewfinderSettings(m_captureSession);
- return m_viewfinderSettingsControl;
- }
-
- if (qstrcmp(name, QCameraViewfinderSettingsControl2_iid) == 0) {
- if (!m_viewfinderSettingsControl2)
- m_viewfinderSettingsControl2 = new CameraBinViewfinderSettings2(m_captureSession);
- return m_viewfinderSettingsControl2;
- }
-
- if (qstrcmp(name, QCameraInfoControl_iid) == 0) {
- if (!m_cameraInfoControl)
- m_cameraInfoControl = new CameraBinInfoControl(m_captureSession->sourceFactory(), this);
- return m_cameraInfoControl;
- }
-
- return 0;
-}
-
-void CameraBinService::releaseControl(QMediaControl *control)
-{
- if (control && control == m_videoOutput) {
- m_videoOutput = 0;
- m_captureSession->setViewfinder(0);
- }
-}
-
-bool CameraBinService::isCameraBinAvailable()
-{
- GstElementFactory *factory = gst_element_factory_find(QT_GSTREAMER_CAMERABIN_ELEMENT_NAME);
- if (factory) {
- gst_object_unref(GST_OBJECT(factory));
- return true;
- }
-
- return false;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinservice.h b/src/plugins/gstreamer/camerabin/camerabinservice.h
deleted file mode 100644
index 44afef25f..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinservice.h
+++ /dev/null
@@ -1,104 +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 CAMERABINCAPTURESERVICE_H
-#define CAMERABINCAPTURESERVICE_H
-
-#include <qmediaservice.h>
-
-#include <gst/gst.h>
-
-QT_BEGIN_NAMESPACE
-class QAudioInputSelectorControl;
-class QVideoDeviceSelectorControl;
-
-
-class CameraBinSession;
-class CameraBinControl;
-class QGstreamerMessage;
-class QGstreamerBusHelper;
-class QGstreamerVideoRenderer;
-class QGstreamerVideoWindow;
-class QGstreamerVideoWidgetControl;
-class QGstreamerElementFactory;
-class CameraBinMetaData;
-class CameraBinImageCapture;
-class CameraBinMetaData;
-class CameraBinViewfinderSettings;
-class CameraBinViewfinderSettings2;
-
-class CameraBinService : public QMediaService
-{
- Q_OBJECT
-
-public:
- CameraBinService(GstElementFactory *sourceFactory, QObject *parent = 0);
- virtual ~CameraBinService();
-
- QMediaControl *requestControl(const char *name) override;
- void releaseControl(QMediaControl *) override;
-
- static bool isCameraBinAvailable();
-
-private:
- void setAudioPreview(GstElement*);
-
- CameraBinSession *m_captureSession;
- CameraBinMetaData *m_metaDataControl;
-
- QAudioInputSelectorControl *m_audioInputSelector;
- QVideoDeviceSelectorControl *m_videoInputDevice;
-
- QMediaControl *m_videoOutput;
-
- QMediaControl *m_videoRenderer;
- QGstreamerVideoWindow *m_videoWindow;
-#if defined(HAVE_WIDGETS)
- QGstreamerVideoWidgetControl *m_videoWidgetControl;
-#endif
- CameraBinImageCapture *m_imageCaptureControl;
- QMediaControl *m_cameraInfoControl;
-
- CameraBinViewfinderSettings *m_viewfinderSettingsControl;
- CameraBinViewfinderSettings2 *m_viewfinderSettingsControl2;
-};
-
-QT_END_NAMESPACE
-
-#endif // CAMERABINCAPTURESERVICE_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp b/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp
deleted file mode 100644
index 4f45a0a2f..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp
+++ /dev/null
@@ -1,163 +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$
-**
-****************************************************************************/
-
-#include <QtCore/qstring.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/QDir>
-#include <QtCore/QDebug>
-
-#include "camerabinserviceplugin.h"
-
-#include "camerabinservice.h"
-#include <private/qgstutils_p.h>
-
-QT_BEGIN_NAMESPACE
-
-template <typename T, int N> static int lengthOf(const T(&)[N]) { return N; }
-
-CameraBinServicePlugin::CameraBinServicePlugin()
- : m_sourceFactory(0)
-{
-}
-
-CameraBinServicePlugin::~CameraBinServicePlugin()
-{
- if (m_sourceFactory)
- gst_object_unref(GST_OBJECT(m_sourceFactory));
-}
-
-QMediaService* CameraBinServicePlugin::create(const QString &key)
-{
- QGstUtils::initializeGst();
-
- if (key == QLatin1String(Q_MEDIASERVICE_CAMERA)) {
- if (!CameraBinService::isCameraBinAvailable()) {
- guint major, minor, micro, nano;
- gst_version(&major, &minor, &micro, &nano);
- qWarning("Error: cannot create camera service, the 'camerabin' plugin is missing for "
- "GStreamer %u.%u."
- "\nPlease install the 'bad' GStreamer plugin package.",
- major, minor);
- return nullptr;
- }
-
- return new CameraBinService(sourceFactory());
- }
-
- qWarning() << "Gstreamer camerabin service plugin: unsupported key:" << key;
- return 0;
-}
-
-void CameraBinServicePlugin::release(QMediaService *service)
-{
- delete service;
-}
-
-QMediaServiceProviderHint::Features CameraBinServicePlugin::supportedFeatures(
- const QByteArray &service) const
-{
- if (service == Q_MEDIASERVICE_CAMERA)
- return QMediaServiceProviderHint::VideoSurface;
-
- return QMediaServiceProviderHint::Features();
-}
-
-QByteArray CameraBinServicePlugin::defaultDevice(const QByteArray &service) const
-{
- return service == Q_MEDIASERVICE_CAMERA
- ? QGstUtils::enumerateCameras(sourceFactory()).value(0).name.toUtf8()
- : QByteArray();
-}
-
-QList<QByteArray> CameraBinServicePlugin::devices(const QByteArray &service) const
-{
-
- return service == Q_MEDIASERVICE_CAMERA
- ? QGstUtils::cameraDevices(m_sourceFactory)
- : QList<QByteArray>();
-}
-
-QString CameraBinServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &deviceName)
-{
- return service == Q_MEDIASERVICE_CAMERA
- ? QGstUtils::cameraDescription(deviceName, m_sourceFactory)
- : QString();
-}
-
-QVariant CameraBinServicePlugin::deviceProperty(const QByteArray &service, const QByteArray &device, const QByteArray &property)
-{
- Q_UNUSED(service);
- Q_UNUSED(device);
- Q_UNUSED(property);
- return QVariant();
-}
-
-QCamera::Position CameraBinServicePlugin::cameraPosition(const QByteArray &deviceName) const
-{
- return QGstUtils::cameraPosition(deviceName, m_sourceFactory);
-}
-
-int CameraBinServicePlugin::cameraOrientation(const QByteArray &deviceName) const
-{
- return QGstUtils::cameraOrientation(deviceName, m_sourceFactory);
-}
-
-GstElementFactory *CameraBinServicePlugin::sourceFactory() const
-{
- if (!m_sourceFactory) {
- GstElementFactory *factory = 0;
- const QByteArray envCandidate = qgetenv("QT_GSTREAMER_CAMERABIN_SRC");
- if (!envCandidate.isEmpty())
- factory = gst_element_factory_find(envCandidate.constData());
-
- static const char *candidates[] = { "subdevsrc", "wrappercamerabinsrc" };
- for (int i = 0; !factory && i < lengthOf(candidates); ++i)
- factory = gst_element_factory_find(candidates[i]);
-
- if (factory) {
- m_sourceFactory = GST_ELEMENT_FACTORY(gst_plugin_feature_load(
- GST_PLUGIN_FEATURE(factory)));
- gst_object_unref((GST_OBJECT(factory)));
- }
- }
-
- return m_sourceFactory;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinserviceplugin.h b/src/plugins/gstreamer/camerabin/camerabinserviceplugin.h
deleted file mode 100644
index b31e44459..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinserviceplugin.h
+++ /dev/null
@@ -1,89 +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 CAMERABINSERVICEPLUGIN_H
-#define CAMERABINSERVICEPLUGIN_H
-
-#include <qmediaserviceproviderplugin.h>
-#include <private/qgstreamervideoinputdevicecontrol_p.h>
-
-#include <gst/gst.h>
-
-QT_BEGIN_NAMESPACE
-
-class CameraBinServicePlugin
- : public QMediaServiceProviderPlugin
- , public QMediaServiceSupportedDevicesInterface
- , public QMediaServiceDefaultDeviceInterface
- , public QMediaServiceFeaturesInterface
- , public QMediaServiceCameraInfoInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
- Q_INTERFACES(QMediaServiceDefaultDeviceInterface)
- Q_INTERFACES(QMediaServiceFeaturesInterface)
- Q_INTERFACES(QMediaServiceCameraInfoInterface)
- Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "camerabin.json")
-public:
- CameraBinServicePlugin();
- ~CameraBinServicePlugin();
-
- QMediaService* create(const QString &key) override;
- void release(QMediaService *service) override;
-
- QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const override;
-
- QByteArray defaultDevice(const QByteArray &service) const override;
- QList<QByteArray> devices(const QByteArray &service) const override;
- QString deviceDescription(const QByteArray &service, const QByteArray &device) override;
- QVariant deviceProperty(const QByteArray &service, const QByteArray &device, const QByteArray &property);
-
- QCamera::Position cameraPosition(const QByteArray &device) const override;
- int cameraOrientation(const QByteArray &device) const override;
-
-private:
- GstElementFactory *sourceFactory() const;
-
- mutable GstElementFactory *m_sourceFactory;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGSTREAMERCAPTURESERVICEPLUGIN_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
deleted file mode 100644
index 22f5fb116..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp
+++ /dev/null
@@ -1,1587 +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$
-**
-****************************************************************************/
-
-#include <QtMultimedia/private/qtmultimediaglobal_p.h>
-#include "camerabinsession.h"
-#include "camerabincontrol.h"
-#include "camerabinrecorder.h"
-#include "camerabincontainer.h"
-#include "camerabinaudioencoder.h"
-#include "camerabinvideoencoder.h"
-#include "camerabinimageencoder.h"
-
-#if QT_CONFIG(gstreamer_photography)
-#include "camerabinexposure.h"
-#include "camerabinflash.h"
-#include "camerabinfocus.h"
-#include "camerabinlocks.h"
-#endif
-
-#include "camerabinzoom.h"
-#include "camerabinimageprocessing.h"
-#include "camerabinviewfindersettings.h"
-
-#include "camerabincapturedestination.h"
-#include "camerabincapturebufferformat.h"
-#include <private/qgstreamerbushelper_p.h>
-#include <private/qgstreamervideorendererinterface_p.h>
-#include <private/qgstutils_p.h>
-#include <qmediarecorder.h>
-#include <qvideosurfaceformat.h>
-
-#if QT_CONFIG(gstreamer_photography)
-#include <gst/interfaces/photography.h>
-#endif
-
-#include <gst/gsttagsetter.h>
-#include <gst/gstversion.h>
-
-#include <QtCore/qdebug.h>
-#include <QCoreApplication>
-#include <QtCore/qmetaobject.h>
-#include <QtGui/qdesktopservices.h>
-
-#include <QtGui/qimage.h>
-#include <QtCore/qdatetime.h>
-
-#include <algorithm>
-
-//#define CAMERABIN_DEBUG 1
-//#define CAMERABIN_DEBUG_DUMP_BIN 1
-#define ENUM_NAME(c,e,v) (c::staticMetaObject.enumerator(c::staticMetaObject.indexOfEnumerator(e)).valueToKey((v)))
-
-#define FILENAME_PROPERTY "location"
-#define MODE_PROPERTY "mode"
-#define MUTE_PROPERTY "mute"
-#define IMAGE_PP_PROPERTY "image-post-processing"
-#define IMAGE_ENCODER_PROPERTY "image-encoder"
-#define VIDEO_PP_PROPERTY "video-post-processing"
-#define VIEWFINDER_SINK_PROPERTY "viewfinder-sink"
-#define CAMERA_SOURCE_PROPERTY "camera-source"
-#define AUDIO_SOURCE_PROPERTY "audio-source"
-#define SUPPORTED_IMAGE_CAPTURE_CAPS_PROPERTY "image-capture-supported-caps"
-#define SUPPORTED_VIDEO_CAPTURE_CAPS_PROPERTY "video-capture-supported-caps"
-#define SUPPORTED_VIEWFINDER_CAPS_PROPERTY "viewfinder-supported-caps"
-#define AUDIO_CAPTURE_CAPS_PROPERTY "audio-capture-caps"
-#define IMAGE_CAPTURE_CAPS_PROPERTY "image-capture-caps"
-#define VIDEO_CAPTURE_CAPS_PROPERTY "video-capture-caps"
-#define VIEWFINDER_CAPS_PROPERTY "viewfinder-caps"
-#define PREVIEW_CAPS_PROPERTY "preview-caps"
-#define POST_PREVIEWS_PROPERTY "post-previews"
-
-
-#define CAPTURE_START "start-capture"
-#define CAPTURE_STOP "stop-capture"
-
-#define FILESINK_BIN_NAME "videobin-filesink"
-
-#define CAMERABIN_IMAGE_MODE 1
-#define CAMERABIN_VIDEO_MODE 2
-
-#define PREVIEW_CAPS_4_3 \
- "video/x-raw-rgb, width = (int) 640, height = (int) 480"
-
-QT_BEGIN_NAMESPACE
-
-CameraBinSession::CameraBinSession(GstElementFactory *sourceFactory, QObject *parent)
- :QObject(parent),
- m_recordingActive(false),
- m_status(QCamera::UnloadedStatus),
- m_pendingState(QCamera::UnloadedState),
- m_muted(false),
- m_busy(false),
- m_captureMode(QCamera::CaptureStillImage),
- m_audioInputFactory(0),
- m_videoInputFactory(0),
- m_viewfinder(0),
- m_viewfinderInterface(0),
-#if QT_CONFIG(gstreamer_photography)
- m_cameraExposureControl(0),
- m_cameraFlashControl(0),
- m_cameraFocusControl(0),
- m_cameraLocksControl(0),
-#endif
- m_cameraSrc(0),
- m_videoSrc(0),
- m_viewfinderElement(0),
- m_sourceFactory(sourceFactory),
- m_viewfinderHasChanged(true),
- m_inputDeviceHasChanged(true),
- m_usingWrapperCameraBinSrc(false),
- m_viewfinderProbe(this),
- m_audioSrc(0),
- m_audioConvert(0),
- m_capsFilter(0),
- m_fileSink(0),
- m_audioEncoder(0),
- m_videoEncoder(0),
- m_muxer(0)
-{
- if (m_sourceFactory)
- gst_object_ref(GST_OBJECT(m_sourceFactory));
- m_camerabin = gst_element_factory_make(QT_GSTREAMER_CAMERABIN_ELEMENT_NAME, "camerabin");
-
- g_signal_connect(G_OBJECT(m_camerabin), "notify::idle", G_CALLBACK(updateBusyStatus), this);
- g_signal_connect(G_OBJECT(m_camerabin), "element-added", G_CALLBACK(elementAdded), this);
- g_signal_connect(G_OBJECT(m_camerabin), "element-removed", G_CALLBACK(elementRemoved), this);
- qt_gst_object_ref_sink(m_camerabin);
-
- m_bus = gst_element_get_bus(m_camerabin);
-
- m_busHelper = new QGstreamerBusHelper(m_bus, this);
- m_busHelper->installMessageFilter(this);
-
- m_cameraControl = new CameraBinControl(this);
- m_audioEncodeControl = new CameraBinAudioEncoder(this);
- m_videoEncodeControl = new CameraBinVideoEncoder(this);
- m_imageEncodeControl = new CameraBinImageEncoder(this);
- m_recorderControl = new CameraBinRecorder(this);
- m_mediaContainerControl = new CameraBinContainer(this);
- m_cameraZoomControl = new CameraBinZoom(this);
- m_imageProcessingControl = new CameraBinImageProcessing(this);
- m_captureDestinationControl = new CameraBinCaptureDestination(this);
- m_captureBufferFormatControl = new CameraBinCaptureBufferFormat(this);
-
- QByteArray envFlags = qgetenv("QT_GSTREAMER_CAMERABIN_FLAGS");
- if (!envFlags.isEmpty())
- g_object_set(G_OBJECT(m_camerabin), "flags", envFlags.toInt(), NULL);
-
- //post image preview in RGB format
- g_object_set(G_OBJECT(m_camerabin), POST_PREVIEWS_PROPERTY, TRUE, NULL);
-
-#if GST_CHECK_VERSION(1,0,0)
- GstCaps *previewCaps = gst_caps_new_simple(
- "video/x-raw",
- "format", G_TYPE_STRING, "RGBx",
- NULL);
-#else
- GstCaps *previewCaps = gst_caps_from_string("video/x-raw-rgb");
-#endif
-
- g_object_set(G_OBJECT(m_camerabin), PREVIEW_CAPS_PROPERTY, previewCaps, NULL);
- gst_caps_unref(previewCaps);
-}
-
-CameraBinSession::~CameraBinSession()
-{
- if (m_camerabin) {
- if (m_viewfinderInterface)
- m_viewfinderInterface->stopRenderer();
-
- gst_element_set_state(m_camerabin, GST_STATE_NULL);
- gst_element_get_state(m_camerabin, NULL, NULL, GST_CLOCK_TIME_NONE);
- gst_object_unref(GST_OBJECT(m_bus));
- gst_object_unref(GST_OBJECT(m_camerabin));
- }
- if (m_viewfinderElement)
- gst_object_unref(GST_OBJECT(m_viewfinderElement));
-
- if (m_sourceFactory)
- gst_object_unref(GST_OBJECT(m_sourceFactory));
-
- if (m_cameraSrc)
- gst_object_unref(GST_OBJECT(m_cameraSrc));
-
- if (m_videoSrc)
- gst_object_unref(GST_OBJECT(m_videoSrc));
-}
-
-#if QT_CONFIG(gstreamer_photography)
-GstPhotography *CameraBinSession::photography()
-{
- if (GST_IS_PHOTOGRAPHY(m_camerabin)) {
- return GST_PHOTOGRAPHY(m_camerabin);
- }
-
- GstElement * const source = buildCameraSource();
-
- if (source && GST_IS_PHOTOGRAPHY(source))
- return GST_PHOTOGRAPHY(source);
-
- return 0;
-}
-
-CameraBinExposure *CameraBinSession::cameraExposureControl()
-{
- if (!m_cameraExposureControl && photography())
- m_cameraExposureControl = new CameraBinExposure(this);
- return m_cameraExposureControl;
-}
-
-CameraBinFlash *CameraBinSession::cameraFlashControl()
-{
- if (!m_cameraFlashControl && photography())
- m_cameraFlashControl = new CameraBinFlash(this);
- return m_cameraFlashControl;
-}
-
-CameraBinFocus *CameraBinSession::cameraFocusControl()
-{
- if (!m_cameraFocusControl && photography())
- m_cameraFocusControl = new CameraBinFocus(this);
- return m_cameraFocusControl;
-}
-
-CameraBinLocks *CameraBinSession::cameraLocksControl()
-{
- if (!m_cameraLocksControl && photography())
- m_cameraLocksControl = new CameraBinLocks(this);
- return m_cameraLocksControl;
-}
-#endif
-
-bool CameraBinSession::setupCameraBin()
-{
- if (!buildCameraSource())
- return false;
-
- if (m_viewfinderHasChanged) {
- if (m_viewfinderElement) {
- GstPad *pad = gst_element_get_static_pad(m_viewfinderElement, "sink");
- m_viewfinderProbe.removeProbeFromPad(pad);
- gst_object_unref(GST_OBJECT(pad));
- gst_object_unref(GST_OBJECT(m_viewfinderElement));
- }
-
- m_viewfinderElement = m_viewfinderInterface ? m_viewfinderInterface->videoSink() : 0;
-#if CAMERABIN_DEBUG
- qDebug() << Q_FUNC_INFO << "Viewfinder changed, reconfigure.";
-#endif
- m_viewfinderHasChanged = false;
- if (!m_viewfinderElement) {
- if (m_pendingState == QCamera::ActiveState)
- qWarning() << "Starting camera without viewfinder available";
- m_viewfinderElement = gst_element_factory_make("fakesink", NULL);
- }
-
- GstPad *pad = gst_element_get_static_pad(m_viewfinderElement, "sink");
- m_viewfinderProbe.addProbeToPad(pad);
- gst_object_unref(GST_OBJECT(pad));
-
- g_object_set(G_OBJECT(m_viewfinderElement), "sync", FALSE, NULL);
- qt_gst_object_ref_sink(GST_OBJECT(m_viewfinderElement));
- gst_element_set_state(m_camerabin, GST_STATE_NULL);
- g_object_set(G_OBJECT(m_camerabin), VIEWFINDER_SINK_PROPERTY, m_viewfinderElement, NULL);
- }
-
- return true;
-}
-
-static GstCaps *resolutionToCaps(const QSize &resolution,
- qreal frameRate = 0.0,
- QVideoFrame::PixelFormat pixelFormat = QVideoFrame::Format_Invalid)
-{
- GstCaps *caps = 0;
- if (pixelFormat == QVideoFrame::Format_Invalid)
- caps = QGstUtils::videoFilterCaps();
- else
- caps = QGstUtils::capsForFormats(QList<QVideoFrame::PixelFormat>() << pixelFormat);
-
- if (!resolution.isEmpty()) {
- gst_caps_set_simple(
- caps,
- "width", G_TYPE_INT, resolution.width(),
- "height", G_TYPE_INT, resolution.height(),
- NULL);
- }
-
- if (frameRate > 0.0) {
- gint numerator;
- gint denominator;
- qt_gst_util_double_to_fraction(frameRate, &numerator, &denominator);
-
- gst_caps_set_simple(
- caps,
- "framerate", GST_TYPE_FRACTION, numerator, denominator,
- NULL);
- }
-
- return caps;
-}
-
-void CameraBinSession::setupCaptureResolution()
-{
- QSize viewfinderResolution = m_viewfinderSettings.resolution();
- qreal viewfinderFrameRate = m_viewfinderSettings.maximumFrameRate();
- QVideoFrame::PixelFormat viewfinderPixelFormat = m_viewfinderSettings.pixelFormat();
- const QSize imageResolution = m_imageEncodeControl->imageSettings().resolution();
- const QSize videoResolution = m_videoEncodeControl->actualVideoSettings().resolution();
-
- // WrapperCameraBinSrc cannot have different caps on its imgsrc, vidsrc and vfsrc pads.
- // If capture resolution is specified, use it also for the viewfinder to avoid caps negotiation
- // to fail.
- if (m_usingWrapperCameraBinSrc) {
- if (viewfinderResolution.isEmpty()) {
- if (m_captureMode == QCamera::CaptureStillImage && !imageResolution.isEmpty())
- viewfinderResolution = imageResolution;
- else if (m_captureMode == QCamera::CaptureVideo && !videoResolution.isEmpty())
- viewfinderResolution = videoResolution;
- }
-
- // Make sure we don't use incompatible frame rate and pixel format with the new resolution
- if (viewfinderResolution != m_viewfinderSettings.resolution() &&
- (!qFuzzyIsNull(viewfinderFrameRate) || viewfinderPixelFormat != QVideoFrame::Format_Invalid)) {
-
- enum {
- Nothing = 0x0,
- OnlyFrameRate = 0x1,
- OnlyPixelFormat = 0x2,
- Both = 0x4
- };
- quint8 found = Nothing;
- auto viewfinderSettings = supportedViewfinderSettings();
- for (int i = 0; i < viewfinderSettings.count() && !(found & Both); ++i) {
- const QCameraViewfinderSettings &s = viewfinderSettings.at(i);
- if (s.resolution() == viewfinderResolution) {
- if ((qFuzzyIsNull(viewfinderFrameRate) || s.maximumFrameRate() == viewfinderFrameRate)
- && (viewfinderPixelFormat == QVideoFrame::Format_Invalid || s.pixelFormat() == viewfinderPixelFormat))
- found |= Both;
- else if (s.maximumFrameRate() == viewfinderFrameRate)
- found |= OnlyFrameRate;
- else if (s.pixelFormat() == viewfinderPixelFormat)
- found |= OnlyPixelFormat;
- }
- }
-
- if (found & Both) {
- // no-op
- } else if (found & OnlyPixelFormat) {
- viewfinderFrameRate = qreal(0);
- } else if (found & OnlyFrameRate) {
- viewfinderPixelFormat = QVideoFrame::Format_Invalid;
- } else {
- viewfinderPixelFormat = QVideoFrame::Format_Invalid;
- viewfinderFrameRate = qreal(0);
- }
- }
- }
-
- GstCaps *caps = resolutionToCaps(imageResolution);
- g_object_set(m_camerabin, IMAGE_CAPTURE_CAPS_PROPERTY, caps, NULL);
- gst_caps_unref(caps);
-
- qreal framerate = m_videoEncodeControl->videoSettings().frameRate();
- caps = resolutionToCaps(videoResolution, framerate);
- g_object_set(m_camerabin, VIDEO_CAPTURE_CAPS_PROPERTY, caps, NULL);
- gst_caps_unref(caps);
-
- caps = resolutionToCaps(viewfinderResolution, viewfinderFrameRate, viewfinderPixelFormat);
- g_object_set(m_camerabin, VIEWFINDER_CAPS_PROPERTY, caps, NULL);
- gst_caps_unref(caps);
-
- // Special case when using mfw_v4lsrc
- if (m_videoSrc && qstrcmp(qt_gst_element_get_factory_name(m_videoSrc), "mfw_v4lsrc") == 0) {
- int capMode = 0;
- if (viewfinderResolution == QSize(320, 240))
- capMode = 1;
- else if (viewfinderResolution == QSize(720, 480))
- capMode = 2;
- else if (viewfinderResolution == QSize(720, 576))
- capMode = 3;
- else if (viewfinderResolution == QSize(1280, 720))
- capMode = 4;
- else if (viewfinderResolution == QSize(1920, 1080))
- capMode = 5;
- g_object_set(G_OBJECT(m_videoSrc), "capture-mode", capMode, NULL);
-
- if (!qFuzzyIsNull(viewfinderFrameRate)) {
- int n, d;
- qt_gst_util_double_to_fraction(viewfinderFrameRate, &n, &d);
- g_object_set(G_OBJECT(m_videoSrc), "fps-n", n, NULL);
- g_object_set(G_OBJECT(m_videoSrc), "fps-d", d, NULL);
- }
- }
-
- if (m_videoEncoder)
- m_videoEncodeControl->applySettings(m_videoEncoder);
-}
-
-void CameraBinSession::setAudioCaptureCaps()
-{
- QAudioEncoderSettings settings = m_audioEncodeControl->audioSettings();
- const int sampleRate = settings.sampleRate();
- const int channelCount = settings.channelCount();
-
- if (sampleRate <= 0 && channelCount <=0)
- return;
-
-#if GST_CHECK_VERSION(1,0,0)
- GstStructure *structure = gst_structure_new_empty(QT_GSTREAMER_RAW_AUDIO_MIME);
-#else
- GstStructure *structure = gst_structure_new(
- QT_GSTREAMER_RAW_AUDIO_MIME,
- "endianness", G_TYPE_INT, 1234,
- "signed", G_TYPE_BOOLEAN, TRUE,
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- NULL);
-#endif
- if (sampleRate > 0)
- gst_structure_set(structure, "rate", G_TYPE_INT, sampleRate, NULL);
- if (channelCount > 0)
- gst_structure_set(structure, "channels", G_TYPE_INT, channelCount, NULL);
-
- GstCaps *caps = gst_caps_new_full(structure, NULL);
- g_object_set(G_OBJECT(m_camerabin), AUDIO_CAPTURE_CAPS_PROPERTY, caps, NULL);
- gst_caps_unref(caps);
-
- if (m_audioEncoder)
- m_audioEncodeControl->applySettings(m_audioEncoder);
-}
-
-GstElement *CameraBinSession::buildCameraSource()
-{
-#if CAMERABIN_DEBUG
- qDebug() << Q_FUNC_INFO;
-#endif
- if (m_inputDevice.isEmpty())
- return nullptr;
-
- if (!m_inputDeviceHasChanged)
- return m_cameraSrc;
-
- m_inputDeviceHasChanged = false;
- m_usingWrapperCameraBinSrc = false;
-
- GstElement *camSrc = 0;
- g_object_get(G_OBJECT(m_camerabin), CAMERA_SOURCE_PROPERTY, &camSrc, NULL);
-
- if (!m_cameraSrc && m_sourceFactory)
- m_cameraSrc = gst_element_factory_create(m_sourceFactory, "camera_source");
-
- // If gstreamer has set a default source use it.
- if (!m_cameraSrc)
- m_cameraSrc = camSrc;
-
- if (m_cameraSrc) {
-#if CAMERABIN_DEBUG
- qDebug() << "set camera device" << m_inputDevice;
-#endif
- m_usingWrapperCameraBinSrc = qstrcmp(qt_gst_element_get_factory_name(m_cameraSrc), "wrappercamerabinsrc") == 0;
-
- if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_cameraSrc), "video-source")) {
- if (!m_videoSrc) {
- /* QT_GSTREAMER_CAMERABIN_VIDEOSRC can be used to set the video source element.
-
- --- Usage
-
- QT_GSTREAMER_CAMERABIN_VIDEOSRC=[drivername=elementname[,drivername2=elementname2 ...],][elementname]
-
- --- Examples
-
- Always use 'somevideosrc':
- QT_GSTREAMER_CAMERABIN_VIDEOSRC="somevideosrc"
-
- Use 'somevideosrc' when the device driver is 'somedriver', otherwise use default:
- QT_GSTREAMER_CAMERABIN_VIDEOSRC="somedriver=somevideosrc"
-
- Use 'somevideosrc' when the device driver is 'somedriver', otherwise use 'somevideosrc2'
- QT_GSTREAMER_CAMERABIN_VIDEOSRC="somedriver=somevideosrc,somevideosrc2"
- */
- const QByteArray envVideoSource = qgetenv("QT_GSTREAMER_CAMERABIN_VIDEOSRC");
-
- if (!envVideoSource.isEmpty()) {
- const QList<QByteArray> sources = envVideoSource.split(',');
- for (const QByteArray &source : sources) {
- QList<QByteArray> keyValue = source.split('=');
- QByteArray name = keyValue.at(0);
- if (keyValue.count() > 1 && keyValue.at(0) == QGstUtils::cameraDriver(m_inputDevice, m_sourceFactory))
- name = keyValue.at(1);
-
- GError *error = NULL;
- GstElement *element = gst_parse_launch(name, &error);
-
- if (error) {
- g_printerr("ERROR: %s: %s\n", name.constData(), GST_STR_NULL(error->message));
- g_clear_error(&error);
- }
- if (element) {
- m_videoSrc = element;
- break;
- }
- }
- } else if (m_videoInputFactory) {
- m_videoSrc = m_videoInputFactory->buildElement();
- }
-
- if (!m_videoSrc)
- m_videoSrc = gst_element_factory_make("v4l2src", "camera_source");
-
- if (!m_videoSrc)
- m_videoSrc = gst_element_factory_make("ksvideosrc", "camera_source");
-
- if (!m_videoSrc)
- m_videoSrc = gst_element_factory_make("avfvideosrc", "camera_source");
-
- if (m_videoSrc)
- g_object_set(G_OBJECT(m_cameraSrc), "video-source", m_videoSrc, NULL);
- }
-
- if (m_videoSrc) {
- if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSrc), "device"))
- g_object_set(G_OBJECT(m_videoSrc), "device", m_inputDevice.toUtf8().constData(), NULL);
-
- if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSrc), "device-path"))
- g_object_set(G_OBJECT(m_videoSrc), "device-path", m_inputDevice.toUtf8().constData(), NULL);
-
- if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSrc), "device-index"))
- g_object_set(G_OBJECT(m_videoSrc), "device-index", m_inputDevice.toInt(), NULL);
- }
- } else if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_cameraSrc), "camera-device")) {
- if (m_inputDevice == QLatin1String("secondary")) {
- g_object_set(G_OBJECT(m_cameraSrc), "camera-device", 1, NULL);
- } else {
- g_object_set(G_OBJECT(m_cameraSrc), "camera-device", 0, NULL);
- }
- }
- }
-
- if (m_cameraSrc != camSrc) {
- g_object_set(G_OBJECT(m_camerabin), CAMERA_SOURCE_PROPERTY, m_cameraSrc, NULL);
- // Unref only if camSrc is not m_cameraSrc to prevent double unrefing.
- if (camSrc)
- gst_object_unref(GST_OBJECT(camSrc));
- }
-
- return m_cameraSrc;
-}
-
-void CameraBinSession::captureImage(int requestId, const QString &fileName)
-{
- const QString actualFileName = m_mediaStorageLocation.generateFileName(fileName,
- QMediaStorageLocation::Pictures,
- QLatin1String("IMG_"),
- QLatin1String("jpg"));
-
- m_requestId = requestId;
-
-#if CAMERABIN_DEBUG
- qDebug() << Q_FUNC_INFO << m_requestId << fileName << "actual file name:" << actualFileName;
-#endif
-
- g_object_set(G_OBJECT(m_camerabin), FILENAME_PROPERTY, actualFileName.toLocal8Bit().constData(), NULL);
-
- g_signal_emit_by_name(G_OBJECT(m_camerabin), CAPTURE_START, NULL);
-
- m_imageFileName = actualFileName;
-}
-
-void CameraBinSession::setCaptureMode(QCamera::CaptureModes mode)
-{
- m_captureMode = mode;
-
- switch (m_captureMode) {
- case QCamera::CaptureStillImage:
- g_object_set(m_camerabin, MODE_PROPERTY, CAMERABIN_IMAGE_MODE, NULL);
- break;
- case QCamera::CaptureVideo:
- g_object_set(m_camerabin, MODE_PROPERTY, CAMERABIN_VIDEO_MODE, NULL);
- break;
- }
-
- m_recorderControl->updateStatus();
-}
-
-QUrl CameraBinSession::outputLocation() const
-{
- //return the location service wrote data to, not one set by user, it can be empty.
- return m_actualSink;
-}
-
-bool CameraBinSession::setOutputLocation(const QUrl& sink)
-{
- if (!sink.isRelative() && !sink.isLocalFile()) {
- qWarning("Output location must be a local file");
- return false;
- }
-
- m_sink = m_actualSink = sink;
- return true;
-}
-
-void CameraBinSession::setDevice(const QString &device)
-{
- if (m_inputDevice != device) {
- m_inputDevice = device;
- m_inputDeviceHasChanged = true;
- }
-}
-
-void CameraBinSession::setAudioInput(QGstreamerElementFactory *audioInput)
-{
- m_audioInputFactory = audioInput;
-}
-
-void CameraBinSession::setVideoInput(QGstreamerElementFactory *videoInput)
-{
- m_videoInputFactory = videoInput;
- m_inputDeviceHasChanged = true;
-}
-
-bool CameraBinSession::isReady() const
-{
- //it's possible to use QCamera without any viewfinder attached
- return !m_viewfinderInterface || m_viewfinderInterface->isReady();
-}
-
-void CameraBinSession::setViewfinder(QObject *viewfinder)
-{
- if (m_viewfinderInterface)
- m_viewfinderInterface->stopRenderer();
-
- m_viewfinderInterface = qobject_cast<QGstreamerVideoRendererInterface*>(viewfinder);
- if (!m_viewfinderInterface)
- viewfinder = 0;
-
- if (m_viewfinder != viewfinder) {
- bool oldReady = isReady();
-
- if (m_viewfinder) {
- disconnect(m_viewfinder, SIGNAL(sinkChanged()),
- this, SLOT(handleViewfinderChange()));
- disconnect(m_viewfinder, SIGNAL(readyChanged(bool)),
- this, SIGNAL(readyChanged(bool)));
-
- m_busHelper->removeMessageFilter(m_viewfinder);
- }
-
- m_viewfinder = viewfinder;
- m_viewfinderHasChanged = true;
-
- if (m_viewfinder) {
- connect(m_viewfinder, SIGNAL(sinkChanged()),
- this, SLOT(handleViewfinderChange()));
- connect(m_viewfinder, SIGNAL(readyChanged(bool)),
- this, SIGNAL(readyChanged(bool)));
-
- m_busHelper->installMessageFilter(m_viewfinder);
- }
-
- emit viewfinderChanged();
- if (oldReady != isReady())
- emit readyChanged(isReady());
- }
-}
-
-static QList<QCameraViewfinderSettings> capsToViewfinderSettings(GstCaps *supportedCaps)
-{
- QList<QCameraViewfinderSettings> settings;
-
- if (!supportedCaps)
- return settings;
-
- supportedCaps = qt_gst_caps_normalize(supportedCaps);
-
- // Convert caps to QCameraViewfinderSettings
- for (uint i = 0; i < gst_caps_get_size(supportedCaps); ++i) {
- const GstStructure *structure = gst_caps_get_structure(supportedCaps, i);
-
- QCameraViewfinderSettings s;
- s.setResolution(QGstUtils::structureResolution(structure));
- s.setPixelFormat(QGstUtils::structurePixelFormat(structure));
- s.setPixelAspectRatio(QGstUtils::structurePixelAspectRatio(structure));
-
- QPair<qreal, qreal> frameRateRange = QGstUtils::structureFrameRateRange(structure);
- s.setMinimumFrameRate(frameRateRange.first);
- s.setMaximumFrameRate(frameRateRange.second);
-
- if (!s.resolution().isEmpty()
- && s.pixelFormat() != QVideoFrame::Format_Invalid
- && !settings.contains(s)) {
- settings.append(s);
- }
- }
-
- gst_caps_unref(supportedCaps);
- return settings;
-}
-
-QList<QCameraViewfinderSettings> CameraBinSession::supportedViewfinderSettings() const
-{
- if (m_status >= QCamera::LoadedStatus && m_supportedViewfinderSettings.isEmpty()) {
- m_supportedViewfinderSettings =
- capsToViewfinderSettings(supportedCaps(QCamera::CaptureViewfinder));
- }
-
- return m_supportedViewfinderSettings;
-}
-
-QCameraViewfinderSettings CameraBinSession::viewfinderSettings() const
-{
- return m_status == QCamera::ActiveStatus ? m_actualViewfinderSettings : m_viewfinderSettings;
-}
-
-void CameraBinSession::ViewfinderProbe::probeCaps(GstCaps *caps)
-{
- QGstreamerVideoProbeControl::probeCaps(caps);
-
- // Update actual viewfinder settings on viewfinder caps change
- const GstStructure *s = gst_caps_get_structure(caps, 0);
- const QPair<qreal, qreal> frameRate = QGstUtils::structureFrameRateRange(s);
- session->m_actualViewfinderSettings.setResolution(QGstUtils::structureResolution(s));
- session->m_actualViewfinderSettings.setMinimumFrameRate(frameRate.first);
- session->m_actualViewfinderSettings.setMaximumFrameRate(frameRate.second);
- session->m_actualViewfinderSettings.setPixelFormat(QGstUtils::structurePixelFormat(s));
- session->m_actualViewfinderSettings.setPixelAspectRatio(QGstUtils::structurePixelAspectRatio(s));
-}
-
-void CameraBinSession::handleViewfinderChange()
-{
- //the viewfinder will be reloaded
- //shortly when the pipeline is started
- m_viewfinderHasChanged = true;
- emit viewfinderChanged();
-}
-
-void CameraBinSession::setStatus(QCamera::Status status)
-{
- if (m_status == status)
- return;
-
- m_status = status;
- emit statusChanged(m_status);
-
- setStateHelper(m_pendingState);
-}
-
-QCamera::Status CameraBinSession::status() const
-{
- return m_status;
-}
-
-QCamera::State CameraBinSession::pendingState() const
-{
- return m_pendingState;
-}
-
-void CameraBinSession::setState(QCamera::State newState)
-{
- if (newState == m_pendingState)
- return;
-
- m_pendingState = newState;
- emit pendingStateChanged(m_pendingState);
-
-#if CAMERABIN_DEBUG
- qDebug() << Q_FUNC_INFO << newState;
-#endif
-
- setStateHelper(newState);
-}
-
-void CameraBinSession::setStateHelper(QCamera::State state)
-{
- switch (state) {
- case QCamera::UnloadedState:
- unload();
- break;
- case QCamera::LoadedState:
- if (m_status == QCamera::ActiveStatus)
- stop();
- else if (m_status == QCamera::UnloadedStatus)
- load();
- break;
- case QCamera::ActiveState:
- // If the viewfinder changed while in the loaded state, we need to reload the pipeline
- if (m_status == QCamera::LoadedStatus && !m_viewfinderHasChanged)
- start();
- else if (m_status == QCamera::UnloadedStatus || m_viewfinderHasChanged)
- load();
- }
-}
-
-void CameraBinSession::setError(int err, const QString &errorString)
-{
- // Emit only first error
- if (m_pendingState == QCamera::UnloadedState)
- return;
-
- setState(QCamera::UnloadedState);
- emit error(err, errorString);
- setStatus(QCamera::UnloadedStatus);
-}
-
-void CameraBinSession::load()
-{
- if (m_status != QCamera::UnloadedStatus && !m_viewfinderHasChanged)
- return;
-
- setStatus(QCamera::LoadingStatus);
-
- gst_element_set_state(m_camerabin, GST_STATE_NULL);
-
- if (!setupCameraBin()) {
- setError(QCamera::CameraError, QStringLiteral("No camera source available"));
- return;
- }
-
- m_recorderControl->applySettings();
-
-#if QT_CONFIG(gstreamer_encodingprofiles)
- GstEncodingContainerProfile *profile = m_recorderControl->videoProfile();
- if (profile) {
- g_object_set (G_OBJECT(m_camerabin),
- "video-profile",
- profile,
- NULL);
- gst_encoding_profile_unref(profile);
- }
-#endif
-
- gst_element_set_state(m_camerabin, GST_STATE_READY);
-}
-
-void CameraBinSession::unload()
-{
- if (m_status == QCamera::UnloadedStatus || m_status == QCamera::UnloadingStatus)
- return;
-
- setStatus(QCamera::UnloadingStatus);
-
- if (m_recordingActive)
- stopVideoRecording();
-
- if (m_viewfinderInterface)
- m_viewfinderInterface->stopRenderer();
-
- gst_element_set_state(m_camerabin, GST_STATE_NULL);
-
- if (m_busy)
- emit busyChanged(m_busy = false);
-
- m_supportedViewfinderSettings.clear();
-
- setStatus(QCamera::UnloadedStatus);
-}
-
-void CameraBinSession::start()
-{
- if (m_status != QCamera::LoadedStatus)
- return;
-
- setStatus(QCamera::StartingStatus);
-
- setAudioCaptureCaps();
-
- setupCaptureResolution();
-
- gst_element_set_state(m_camerabin, GST_STATE_PLAYING);
-}
-
-void CameraBinSession::stop()
-{
- if (m_status != QCamera::ActiveStatus)
- return;
-
- setStatus(QCamera::StoppingStatus);
-
- if (m_recordingActive)
- stopVideoRecording();
-
- if (m_viewfinderInterface)
- m_viewfinderInterface->stopRenderer();
-
- gst_element_set_state(m_camerabin, GST_STATE_READY);
-}
-
-bool CameraBinSession::isBusy() const
-{
- return m_busy;
-}
-
-void CameraBinSession::updateBusyStatus(GObject *o, GParamSpec *p, gpointer d)
-{
- Q_UNUSED(p);
- CameraBinSession *session = reinterpret_cast<CameraBinSession *>(d);
-
- gboolean idle = false;
- g_object_get(o, "idle", &idle, NULL);
- bool busy = !idle;
-
- if (session->m_busy != busy) {
- session->m_busy = busy;
- QMetaObject::invokeMethod(session, "busyChanged",
- Qt::QueuedConnection,
- Q_ARG(bool, busy));
- }
-}
-
-qint64 CameraBinSession::duration() const
-{
- if (m_camerabin) {
- GstElement *fileSink = gst_bin_get_by_name(GST_BIN(m_camerabin), FILESINK_BIN_NAME);
- if (fileSink) {
- GstFormat format = GST_FORMAT_TIME;
- gint64 duration = 0;
- bool ret = qt_gst_element_query_position(fileSink, format, &duration);
- gst_object_unref(GST_OBJECT(fileSink));
- if (ret)
- return duration / 1000000;
- }
- }
-
- return 0;
-}
-
-bool CameraBinSession::isMuted() const
-{
- return m_muted;
-}
-
-void CameraBinSession::setMuted(bool muted)
-{
- if (m_muted != muted) {
- m_muted = muted;
-
- if (m_camerabin)
- g_object_set(G_OBJECT(m_camerabin), MUTE_PROPERTY, m_muted, NULL);
- emit mutedChanged(m_muted);
- }
-}
-
-void CameraBinSession::setCaptureDevice(const QString &deviceName)
-{
- m_captureDevice = deviceName;
-}
-
-void CameraBinSession::setMetaData(const QMap<QByteArray, QVariant> &data)
-{
- m_metaData = data;
-
- if (m_camerabin)
- QGstUtils::setMetaData(m_camerabin, data);
-}
-
-bool CameraBinSession::processSyncMessage(const QGstreamerMessage &message)
-{
- GstMessage* gm = message.rawMessage();
-
- if (gm && GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) {
- const GstStructure *st = gst_message_get_structure(gm);
- const GValue *sampleValue = 0;
- if (m_captureMode == QCamera::CaptureStillImage
- && gst_structure_has_name(st, "preview-image")
-#if GST_CHECK_VERSION(1,0,0)
- && gst_structure_has_field_typed(st, "sample", GST_TYPE_SAMPLE)
- && (sampleValue = gst_structure_get_value(st, "sample"))) {
- GstSample * const sample = gst_value_get_sample(sampleValue);
- GstCaps * const previewCaps = gst_sample_get_caps(sample);
- GstBuffer * const buffer = gst_sample_get_buffer(sample);
-#else
- && gst_structure_has_field_typed(st, "buffer", GST_TYPE_BUFFER)
- && (sampleValue = gst_structure_get_value(st, "buffer"))) {
- GstBuffer * const buffer = gst_value_get_buffer(sampleValue);
-#endif
-
- QImage image;
-#if GST_CHECK_VERSION(1,0,0)
- GstVideoInfo previewInfo;
- if (gst_video_info_from_caps(&previewInfo, previewCaps))
- image = QGstUtils::bufferToImage(buffer, previewInfo);
-#else
- image = QGstUtils::bufferToImage(buffer);
- gst_buffer_unref(buffer);
-#endif
- if (!image.isNull()) {
- static QMetaMethod exposedSignal = QMetaMethod::fromSignal(&CameraBinSession::imageExposed);
- exposedSignal.invoke(this,
- Qt::QueuedConnection,
- Q_ARG(int,m_requestId));
-
- static QMetaMethod capturedSignal = QMetaMethod::fromSignal(&CameraBinSession::imageCaptured);
- capturedSignal.invoke(this,
- Qt::QueuedConnection,
- Q_ARG(int,m_requestId),
- Q_ARG(QImage,image));
- }
- return true;
- }
-#if QT_CONFIG(gstreamer_photography)
- if (gst_structure_has_name(st, GST_PHOTOGRAPHY_AUTOFOCUS_DONE))
- m_cameraFocusControl->handleFocusMessage(gm);
-#endif
- }
-
- return false;
-}
-
-bool CameraBinSession::processBusMessage(const QGstreamerMessage &message)
-{
- GstMessage* gm = message.rawMessage();
-
- if (gm) {
- if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ERROR) {
- GError *err;
- gchar *debug;
- gst_message_parse_error (gm, &err, &debug);
-
- QString message;
-
- if (err && err->message) {
- message = QString::fromUtf8(err->message);
- qWarning() << "CameraBin error:" << message;
-#if CAMERABIN_DEBUG
- qWarning() << QString::fromUtf8(debug);
-#endif
- }
-
- // Only report error messages from camerabin or video source
- if (GST_MESSAGE_SRC(gm) == GST_OBJECT_CAST(m_camerabin)
- || GST_MESSAGE_SRC(gm) == GST_OBJECT_CAST(m_videoSrc)) {
- if (message.isEmpty())
- message = tr("Camera error");
-
- setError(int(QMediaRecorder::ResourceError), message);
- }
-
-#ifdef CAMERABIN_DEBUG_DUMP_BIN
- _gst_debug_bin_to_dot_file_with_ts(GST_BIN(m_camerabin),
- GstDebugGraphDetails(GST_DEBUG_GRAPH_SHOW_ALL /* GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE | GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS | GST_DEBUG_GRAPH_SHOW_STATES*/),
- "camerabin_error");
-#endif
-
-
- if (err)
- g_error_free (err);
-
- if (debug)
- g_free (debug);
- }
-
- if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_WARNING) {
- GError *err;
- gchar *debug;
- gst_message_parse_warning (gm, &err, &debug);
-
- if (err && err->message)
- qWarning() << "CameraBin warning:" << QString::fromUtf8(err->message);
-
- if (err)
- g_error_free (err);
- if (debug)
- g_free (debug);
- }
-
- if (GST_MESSAGE_SRC(gm) == GST_OBJECT_CAST(m_camerabin)) {
- switch (GST_MESSAGE_TYPE(gm)) {
- case GST_MESSAGE_DURATION:
- break;
-
- case GST_MESSAGE_STATE_CHANGED:
- {
-
- GstState oldState;
- GstState newState;
- GstState pending;
-
- gst_message_parse_state_changed(gm, &oldState, &newState, &pending);
-
-
-#if CAMERABIN_DEBUG
- QStringList states;
- states << "GST_STATE_VOID_PENDING" << "GST_STATE_NULL" << "GST_STATE_READY" << "GST_STATE_PAUSED" << "GST_STATE_PLAYING";
-
-
- qDebug() << QString("state changed: old: %1 new: %2 pending: %3") \
- .arg(states[oldState]) \
- .arg(states[newState]) \
- .arg(states[pending]);
-#endif
-
-#ifdef CAMERABIN_DEBUG_DUMP_BIN
- _gst_debug_bin_to_dot_file_with_ts(GST_BIN(m_camerabin),
- GstDebugGraphDetails(GST_DEBUG_GRAPH_SHOW_ALL /*GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE | GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS | GST_DEBUG_GRAPH_SHOW_STATES*/),
- "camerabin");
-#endif
-
- switch (newState) {
- case GST_STATE_VOID_PENDING:
- case GST_STATE_NULL:
- setStatus(QCamera::UnloadedStatus);
- break;
- case GST_STATE_READY:
- if (oldState == GST_STATE_NULL)
- m_supportedViewfinderSettings.clear();
-
- setMetaData(m_metaData);
- setStatus(QCamera::LoadedStatus);
- break;
- case GST_STATE_PLAYING:
- setStatus(QCamera::ActiveStatus);
- break;
- case GST_STATE_PAUSED:
- default:
- break;
- }
- }
- break;
- default:
- break;
- }
- }
- }
-
- return false;
-}
-
-QGstreamerVideoProbeControl *CameraBinSession::videoProbe()
-{
- return &m_viewfinderProbe;
-}
-
-QString CameraBinSession::currentContainerFormat() const
-{
- if (!m_muxer)
- return QString();
-
- QString format;
-
- if (GstPad *srcPad = gst_element_get_static_pad(m_muxer, "src")) {
- if (GstCaps *caps = qt_gst_pad_get_caps(srcPad)) {
- gchar *capsString = gst_caps_to_string(caps);
- format = QString::fromLatin1(capsString);
- if (capsString)
- g_free(capsString);
- gst_caps_unref(caps);
- }
- gst_object_unref(GST_OBJECT(srcPad));
- }
-
- return format;
-}
-
-void CameraBinSession::recordVideo()
-{
- QString format = currentContainerFormat();
- if (format.isEmpty())
- format = m_mediaContainerControl->actualContainerFormat();
-
- const QString fileName = m_sink.isLocalFile() ? m_sink.toLocalFile() : m_sink.toString();
- const QFileInfo fileInfo(fileName);
- const QString extension = fileInfo.suffix().isEmpty()
- ? QGstUtils::fileExtensionForMimeType(format)
- : fileInfo.suffix();
-
- const QString actualFileName = m_mediaStorageLocation.generateFileName(fileName,
- QMediaStorageLocation::Movies,
- QLatin1String("clip_"),
- extension);
-
- m_recordingActive = true;
- m_actualSink = QUrl::fromLocalFile(actualFileName);
-
- g_object_set(G_OBJECT(m_camerabin), FILENAME_PROPERTY, QFile::encodeName(actualFileName).constData(), NULL);
-
- g_signal_emit_by_name(G_OBJECT(m_camerabin), CAPTURE_START, NULL);
-}
-
-void CameraBinSession::stopVideoRecording()
-{
- m_recordingActive = false;
- g_signal_emit_by_name(G_OBJECT(m_camerabin), CAPTURE_STOP, NULL);
-}
-
-//internal, only used by CameraBinSession::supportedFrameRates.
-//recursively fills the list of framerates res from value data.
-static void readValue(const GValue *value, QList< QPair<int,int> > *res, bool *continuous)
-{
- if (GST_VALUE_HOLDS_FRACTION(value)) {
- int num = gst_value_get_fraction_numerator(value);
- int denum = gst_value_get_fraction_denominator(value);
-
- *res << QPair<int,int>(num, denum);
- } else if (GST_VALUE_HOLDS_FRACTION_RANGE(value)) {
- const GValue *rateValueMin = gst_value_get_fraction_range_min(value);
- const GValue *rateValueMax = gst_value_get_fraction_range_max(value);
-
- if (continuous)
- *continuous = true;
-
- readValue(rateValueMin, res, continuous);
- readValue(rateValueMax, res, continuous);
- } else if (GST_VALUE_HOLDS_LIST(value)) {
- for (uint i=0; i<gst_value_list_get_size(value); i++) {
- readValue(gst_value_list_get_value(value, i), res, continuous);
- }
- }
-}
-
-static bool rateLessThan(const QPair<int,int> &r1, const QPair<int,int> &r2)
-{
- return r1.first*r2.second < r2.first*r1.second;
-}
-
-GstCaps *CameraBinSession::supportedCaps(QCamera::CaptureModes mode) const
-{
- GstCaps *supportedCaps = 0;
-
- // When using wrappercamerabinsrc, get the supported caps directly from the video source element.
- // This makes sure we only get the caps actually supported by the video source element.
- if (m_videoSrc) {
- GstPad *pad = gst_element_get_static_pad(m_videoSrc, "src");
- if (pad) {
- supportedCaps = qt_gst_pad_get_caps(pad);
- gst_object_unref(GST_OBJECT(pad));
- }
- }
-
- // Otherwise, let the camerabin handle this.
- if (!supportedCaps) {
- const gchar *prop;
- switch (mode) {
- case QCamera::CaptureStillImage:
- prop = SUPPORTED_IMAGE_CAPTURE_CAPS_PROPERTY;
- break;
- case QCamera::CaptureVideo:
- prop = SUPPORTED_VIDEO_CAPTURE_CAPS_PROPERTY;
- break;
- case QCamera::CaptureViewfinder:
- default:
- prop = SUPPORTED_VIEWFINDER_CAPS_PROPERTY;
- break;
- }
-
- g_object_get(G_OBJECT(m_camerabin), prop, &supportedCaps, NULL);
- }
-
- return supportedCaps;
-}
-
-QList< QPair<int,int> > CameraBinSession::supportedFrameRates(const QSize &frameSize, bool *continuous) const
-{
- QList< QPair<int,int> > res;
-
- GstCaps *supportedCaps = this->supportedCaps(QCamera::CaptureVideo);
-
- if (!supportedCaps)
- return res;
-
- GstCaps *caps = 0;
-
- if (frameSize.isEmpty()) {
- caps = gst_caps_copy(supportedCaps);
- } else {
- GstCaps *filter = QGstUtils::videoFilterCaps();
- gst_caps_set_simple(
- filter,
- "width", G_TYPE_INT, frameSize.width(),
- "height", G_TYPE_INT, frameSize.height(),
- NULL);
-
- caps = gst_caps_intersect(supportedCaps, filter);
- gst_caps_unref(filter);
- }
- gst_caps_unref(supportedCaps);
-
- //simplify to the list of rates only:
- caps = gst_caps_make_writable(caps);
- for (uint i=0; i<gst_caps_get_size(caps); i++) {
- GstStructure *structure = gst_caps_get_structure(caps, i);
- gst_structure_set_name(structure, "video/x-raw");
-#if GST_CHECK_VERSION(1,2,0)
- gst_caps_set_features(caps, i, NULL);
-#endif
- const GValue *oldRate = gst_structure_get_value(structure, "framerate");
- if (!oldRate)
- continue;
-
- GValue rate;
- memset(&rate, 0, sizeof(rate));
- g_value_init(&rate, G_VALUE_TYPE(oldRate));
- g_value_copy(oldRate, &rate);
- gst_structure_remove_all_fields(structure);
- gst_structure_set_value(structure, "framerate", &rate);
- g_value_unset(&rate);
- }
-#if GST_CHECK_VERSION(1,0,0)
- caps = gst_caps_simplify(caps);
-#else
- gst_caps_do_simplify(caps);
-#endif
-
- for (uint i=0; i<gst_caps_get_size(caps); i++) {
- GstStructure *structure = gst_caps_get_structure(caps, i);
- const GValue *rateValue = gst_structure_get_value(structure, "framerate");
- if (!rateValue)
- continue;
-
- readValue(rateValue, &res, continuous);
- }
-
- std::sort(res.begin(), res.end(), rateLessThan);
-
-#if CAMERABIN_DEBUG
- qDebug() << "Supported rates:" << caps;
- qDebug() << res;
-#endif
-
- gst_caps_unref(caps);
-
- return res;
-}
-
-//internal, only used by CameraBinSession::supportedResolutions
-//recursively find the supported resolutions range.
-static QPair<int,int> valueRange(const GValue *value, bool *continuous)
-{
- int minValue = 0;
- int maxValue = 0;
-
- if (g_value_type_compatible(G_VALUE_TYPE(value), G_TYPE_INT)) {
- minValue = maxValue = g_value_get_int(value);
- } else if (GST_VALUE_HOLDS_INT_RANGE(value)) {
- minValue = gst_value_get_int_range_min(value);
- maxValue = gst_value_get_int_range_max(value);
- *continuous = true;
- } else if (GST_VALUE_HOLDS_LIST(value)) {
- for (uint i=0; i<gst_value_list_get_size(value); i++) {
- QPair<int,int> res = valueRange(gst_value_list_get_value(value, i), continuous);
-
- if (res.first > 0 && minValue > 0)
- minValue = qMin(minValue, res.first);
- else //select non 0 valid value
- minValue = qMax(minValue, res.first);
-
- maxValue = qMax(maxValue, res.second);
- }
- }
-
- return QPair<int,int>(minValue, maxValue);
-}
-
-static bool resolutionLessThan(const QSize &r1, const QSize &r2)
-{
- return qlonglong(r1.width()) * r1.height() < qlonglong(r2.width()) * r2.height();
-}
-
-
-QList<QSize> CameraBinSession::supportedResolutions(QPair<int,int> rate,
- bool *continuous,
- QCamera::CaptureModes mode) const
-{
- QList<QSize> res;
-
- if (continuous)
- *continuous = false;
-
- GstCaps *supportedCaps = this->supportedCaps(mode);
-
-#if CAMERABIN_DEBUG
- qDebug() << "Source caps:" << supportedCaps;
-#endif
-
- if (!supportedCaps)
- return res;
-
- GstCaps *caps = 0;
- bool isContinuous = false;
-
- if (rate.first <= 0 || rate.second <= 0) {
- caps = gst_caps_copy(supportedCaps);
- } else {
- GstCaps *filter = QGstUtils::videoFilterCaps();
- gst_caps_set_simple(
- filter,
- "framerate" , GST_TYPE_FRACTION , rate.first, rate.second,
- NULL);
- caps = gst_caps_intersect(supportedCaps, filter);
- gst_caps_unref(filter);
- }
- gst_caps_unref(supportedCaps);
-
- //simplify to the list of resolutions only:
- caps = gst_caps_make_writable(caps);
- for (uint i=0; i<gst_caps_get_size(caps); i++) {
- GstStructure *structure = gst_caps_get_structure(caps, i);
- gst_structure_set_name(structure, "video/x-raw");
-#if GST_CHECK_VERSION(1,2,0)
- gst_caps_set_features(caps, i, NULL);
-#endif
- const GValue *oldW = gst_structure_get_value(structure, "width");
- const GValue *oldH = gst_structure_get_value(structure, "height");
- if (!oldW || !oldH)
- continue;
-
- GValue w;
- memset(&w, 0, sizeof(GValue));
- GValue h;
- memset(&h, 0, sizeof(GValue));
- g_value_init(&w, G_VALUE_TYPE(oldW));
- g_value_init(&h, G_VALUE_TYPE(oldH));
- g_value_copy(oldW, &w);
- g_value_copy(oldH, &h);
- gst_structure_remove_all_fields(structure);
- gst_structure_set_value(structure, "width", &w);
- gst_structure_set_value(structure, "height", &h);
- g_value_unset(&w);
- g_value_unset(&h);
- }
-
-#if GST_CHECK_VERSION(1,0,0)
- caps = gst_caps_simplify(caps);
-#else
- gst_caps_do_simplify(caps);
-#endif
-
-
- for (uint i=0; i<gst_caps_get_size(caps); i++) {
- GstStructure *structure = gst_caps_get_structure(caps, i);
- const GValue *wValue = gst_structure_get_value(structure, "width");
- const GValue *hValue = gst_structure_get_value(structure, "height");
- if (!wValue || !hValue)
- continue;
-
- QPair<int,int> wRange = valueRange(wValue, &isContinuous);
- QPair<int,int> hRange = valueRange(hValue, &isContinuous);
-
- QSize minSize(wRange.first, hRange.first);
- QSize maxSize(wRange.second, hRange.second);
-
- if (!minSize.isEmpty())
- res << minSize;
-
- if (minSize != maxSize && !maxSize.isEmpty())
- res << maxSize;
- }
-
-
- std::sort(res.begin(), res.end(), resolutionLessThan);
-
- //if the range is continuos, populate is with the common rates
- if (isContinuous && res.size() >= 2) {
- //fill the ragne with common value
- static const QList<QSize> commonSizes =
- QList<QSize>() << QSize(128, 96)
- << QSize(160,120)
- << QSize(176, 144)
- << QSize(320, 240)
- << QSize(352, 288)
- << QSize(640, 480)
- << QSize(848, 480)
- << QSize(854, 480)
- << QSize(1024, 768)
- << QSize(1280, 720) // HD 720
- << QSize(1280, 1024)
- << QSize(1600, 1200)
- << QSize(1920, 1080) // HD
- << QSize(1920, 1200)
- << QSize(2048, 1536)
- << QSize(2560, 1600)
- << QSize(2580, 1936);
- QSize minSize = res.first();
- QSize maxSize = res.last();
- res.clear();
-
- for (const QSize &candidate : commonSizes) {
- int w = candidate.width();
- int h = candidate.height();
-
- if (w > maxSize.width() && h > maxSize.height())
- break;
-
- if (w >= minSize.width() && h >= minSize.height() &&
- w <= maxSize.width() && h <= maxSize.height())
- res << candidate;
- }
-
- if (res.isEmpty() || res.first() != minSize)
- res.prepend(minSize);
-
- if (res.last() != maxSize)
- res.append(maxSize);
- }
-
-#if CAMERABIN_DEBUG
- qDebug() << "Supported resolutions:" << gst_caps_to_string(caps);
- qDebug() << res;
-#endif
-
- gst_caps_unref(caps);
-
- if (continuous)
- *continuous = isContinuous;
-
- return res;
-}
-
-void CameraBinSession::elementAdded(GstBin *, GstElement *element, CameraBinSession *session)
-{
- GstElementFactory *factory = gst_element_get_factory(element);
-
- if (GST_IS_BIN(element)) {
- g_signal_connect(G_OBJECT(element), "element-added", G_CALLBACK(elementAdded), session);
- g_signal_connect(G_OBJECT(element), "element-removed", G_CALLBACK(elementRemoved), session);
- } else if (!factory) {
- // no-op
-#if GST_CHECK_VERSION(0,10,31)
- } else if (gst_element_factory_list_is_type(factory, GST_ELEMENT_FACTORY_TYPE_AUDIO_ENCODER)) {
-#else
- } else if (strstr(gst_element_factory_get_klass(factory), "Encoder/Audio") != NULL) {
-#endif
- session->m_audioEncoder = element;
-
- session->m_audioEncodeControl->applySettings(element);
-#if GST_CHECK_VERSION(0,10,31)
- } else if (gst_element_factory_list_is_type(factory, GST_ELEMENT_FACTORY_TYPE_VIDEO_ENCODER)) {
-#else
- } else if (strstr(gst_element_factory_get_klass(factory), "Encoder/Video") != NULL) {
-#endif
- session->m_videoEncoder = element;
-
- session->m_videoEncodeControl->applySettings(element);
-#if GST_CHECK_VERSION(0,10,31)
- } else if (gst_element_factory_list_is_type(factory, GST_ELEMENT_FACTORY_TYPE_MUXER)) {
-#else
- } else if (strstr(gst_element_factory_get_klass(factory), "Muxer") != NULL) {
-#endif
- session->m_muxer = element;
- }
-}
-
-void CameraBinSession::elementRemoved(GstBin *, GstElement *element, CameraBinSession *session)
-{
- if (element == session->m_audioEncoder)
- session->m_audioEncoder = 0;
- else if (element == session->m_videoEncoder)
- session->m_videoEncoder = 0;
- else if (element == session->m_muxer)
- session->m_muxer = 0;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.h b/src/plugins/gstreamer/camerabin/camerabinsession.h
deleted file mode 100644
index 999398fa4..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinsession.h
+++ /dev/null
@@ -1,291 +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 CAMERABINCAPTURESESSION_H
-#define CAMERABINCAPTURESESSION_H
-
-#include <QtMultimedia/private/qtmultimediaglobal_p.h>
-#include <qmediarecordercontrol.h>
-
-#include <QtCore/qurl.h>
-#include <QtCore/qdir.h>
-
-#include <gst/gst.h>
-#if QT_CONFIG(gstreamer_photography)
-#include <gst/interfaces/photography.h>
-#endif
-
-#include <private/qgstreamerbushelper_p.h>
-#include <private/qgstreamervideoprobecontrol_p.h>
-#include <private/qmediastoragelocation_p.h>
-#include "qcamera.h"
-
-QT_BEGIN_NAMESPACE
-
-class QGstreamerMessage;
-class QGstreamerBusHelper;
-class CameraBinControl;
-class CameraBinAudioEncoder;
-class CameraBinVideoEncoder;
-class CameraBinImageEncoder;
-class CameraBinRecorder;
-class CameraBinContainer;
-class CameraBinExposure;
-class CameraBinFlash;
-class CameraBinFocus;
-class CameraBinImageProcessing;
-class CameraBinLocks;
-class CameraBinZoom;
-class CameraBinCaptureDestination;
-class CameraBinCaptureBufferFormat;
-class QGstreamerVideoRendererInterface;
-class CameraBinViewfinderSettings;
-
-class QGstreamerElementFactory
-{
-public:
- virtual GstElement *buildElement() = 0;
-};
-
-class CameraBinSession : public QObject,
- public QGstreamerBusMessageFilter,
- public QGstreamerSyncMessageFilter
-{
- Q_OBJECT
- Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged)
- Q_INTERFACES(QGstreamerBusMessageFilter QGstreamerSyncMessageFilter)
-public:
- CameraBinSession(GstElementFactory *sourceFactory, QObject *parent);
- ~CameraBinSession();
-
-#if QT_CONFIG(gstreamer_photography)
- GstPhotography *photography();
-#endif
- GstElement *cameraBin() { return m_camerabin; }
- GstElement *cameraSource() { return m_cameraSrc; }
- QGstreamerBusHelper *bus() { return m_busHelper; }
-
- QList< QPair<int,int> > supportedFrameRates(const QSize &frameSize, bool *continuous) const;
- QList<QSize> supportedResolutions(QPair<int,int> rate, bool *continuous, QCamera::CaptureModes mode) const;
-
- QCamera::CaptureModes captureMode() { return m_captureMode; }
- void setCaptureMode(QCamera::CaptureModes mode);
-
- QUrl outputLocation() const;
- bool setOutputLocation(const QUrl& sink);
-
- GstElement *buildCameraSource();
- GstElementFactory *sourceFactory() const { return m_sourceFactory; }
-
- CameraBinControl *cameraControl() const { return m_cameraControl; }
- CameraBinAudioEncoder *audioEncodeControl() const { return m_audioEncodeControl; }
- CameraBinVideoEncoder *videoEncodeControl() const { return m_videoEncodeControl; }
- CameraBinImageEncoder *imageEncodeControl() const { return m_imageEncodeControl; }
-
-#if QT_CONFIG(gstreamer_photography)
- CameraBinExposure *cameraExposureControl();
- CameraBinFlash *cameraFlashControl();
- CameraBinFocus *cameraFocusControl();
- CameraBinLocks *cameraLocksControl();
-#endif
-
- CameraBinZoom *cameraZoomControl() const { return m_cameraZoomControl; }
- CameraBinImageProcessing *imageProcessingControl() const { return m_imageProcessingControl; }
- CameraBinCaptureDestination *captureDestinationControl() const { return m_captureDestinationControl; }
- CameraBinCaptureBufferFormat *captureBufferFormatControl() const { return m_captureBufferFormatControl; }
-
- CameraBinRecorder *recorderControl() const { return m_recorderControl; }
- CameraBinContainer *mediaContainerControl() const { return m_mediaContainerControl; }
-
- QGstreamerElementFactory *audioInput() const { return m_audioInputFactory; }
- void setAudioInput(QGstreamerElementFactory *audioInput);
-
- QGstreamerElementFactory *videoInput() const { return m_videoInputFactory; }
- void setVideoInput(QGstreamerElementFactory *videoInput);
- bool isReady() const;
-
- QObject *viewfinder() const { return m_viewfinder; }
- void setViewfinder(QObject *viewfinder);
-
- QList<QCameraViewfinderSettings> supportedViewfinderSettings() const;
- QCameraViewfinderSettings viewfinderSettings() const;
- void setViewfinderSettings(const QCameraViewfinderSettings &settings) { m_viewfinderSettings = settings; }
-
- void captureImage(int requestId, const QString &fileName);
-
- QCamera::Status status() const;
- QCamera::State pendingState() const;
- bool isBusy() const;
-
- qint64 duration() const;
-
- void recordVideo();
- void stopVideoRecording();
-
- bool isMuted() const;
-
- QString device() const { return m_inputDevice; }
-
- bool processSyncMessage(const QGstreamerMessage &message) override;
- bool processBusMessage(const QGstreamerMessage &message) override;
-
- QGstreamerVideoProbeControl *videoProbe();
-
-signals:
- void statusChanged(QCamera::Status status);
- void pendingStateChanged(QCamera::State state);
- void durationChanged(qint64 duration);
- void error(int error, const QString &errorString);
- void imageExposed(int requestId);
- void imageCaptured(int requestId, const QImage &img);
- void mutedChanged(bool);
- void viewfinderChanged();
- void readyChanged(bool);
- void busyChanged(bool);
-
-public slots:
- void setDevice(const QString &device);
- void setState(QCamera::State);
- void setCaptureDevice(const QString &deviceName);
- void setMetaData(const QMap<QByteArray, QVariant>&);
- void setMuted(bool);
-
-private slots:
- void handleViewfinderChange();
- void setupCaptureResolution();
-
-private:
- void load();
- void unload();
- void start();
- void stop();
-
- void setStatus(QCamera::Status status);
- void setStateHelper(QCamera::State state);
- void setError(int error, const QString &errorString);
-
- bool setupCameraBin();
- void setAudioCaptureCaps();
- GstCaps *supportedCaps(QCamera::CaptureModes mode) const;
- static void updateBusyStatus(GObject *o, GParamSpec *p, gpointer d);
-
- QString currentContainerFormat() const;
-
- static void elementAdded(GstBin *bin, GstElement *element, CameraBinSession *session);
- static void elementRemoved(GstBin *bin, GstElement *element, CameraBinSession *session);
-
- QUrl m_sink;
- QUrl m_actualSink;
- bool m_recordingActive;
- QString m_captureDevice;
- QCamera::Status m_status;
- QCamera::State m_pendingState;
- QString m_inputDevice;
- bool m_muted;
- bool m_busy;
- QMediaStorageLocation m_mediaStorageLocation;
-
- QCamera::CaptureModes m_captureMode;
- QMap<QByteArray, QVariant> m_metaData;
-
- QGstreamerElementFactory *m_audioInputFactory;
- QGstreamerElementFactory *m_videoInputFactory;
- QObject *m_viewfinder;
- QGstreamerVideoRendererInterface *m_viewfinderInterface;
- mutable QList<QCameraViewfinderSettings> m_supportedViewfinderSettings;
- QCameraViewfinderSettings m_viewfinderSettings;
- QCameraViewfinderSettings m_actualViewfinderSettings;
-
- CameraBinControl *m_cameraControl;
- CameraBinAudioEncoder *m_audioEncodeControl;
- CameraBinVideoEncoder *m_videoEncodeControl;
- CameraBinImageEncoder *m_imageEncodeControl;
- CameraBinRecorder *m_recorderControl;
- CameraBinContainer *m_mediaContainerControl;
-#if QT_CONFIG(gstreamer_photography)
- CameraBinExposure *m_cameraExposureControl;
- CameraBinFlash *m_cameraFlashControl;
- CameraBinFocus *m_cameraFocusControl;
- CameraBinLocks *m_cameraLocksControl;
-#endif
- CameraBinZoom *m_cameraZoomControl;
- CameraBinImageProcessing *m_imageProcessingControl;
- CameraBinCaptureDestination *m_captureDestinationControl;
- CameraBinCaptureBufferFormat *m_captureBufferFormatControl;
-
- QGstreamerBusHelper *m_busHelper;
- GstBus* m_bus;
- GstElement *m_camerabin;
- GstElement *m_cameraSrc;
- GstElement *m_videoSrc;
- GstElement *m_viewfinderElement;
- GstElementFactory *m_sourceFactory;
- bool m_viewfinderHasChanged;
- bool m_inputDeviceHasChanged;
- bool m_usingWrapperCameraBinSrc;
-
- class ViewfinderProbe : public QGstreamerVideoProbeControl {
- public:
- ViewfinderProbe(CameraBinSession *s)
- : QGstreamerVideoProbeControl(s)
- , session(s)
- {}
-
- void probeCaps(GstCaps *caps) override;
-
- private:
- CameraBinSession * const session;
- } m_viewfinderProbe;
-
- GstElement *m_audioSrc;
- GstElement *m_audioConvert;
- GstElement *m_capsFilter;
- GstElement *m_fileSink;
- GstElement *m_audioEncoder;
- GstElement *m_videoEncoder;
- GstElement *m_muxer;
-
-public:
- QString m_imageFileName;
- int m_requestId;
-};
-
-QT_END_NAMESPACE
-
-#endif // CAMERABINCAPTURESESSION_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinv4limageprocessing.cpp b/src/plugins/gstreamer/camerabin/camerabinv4limageprocessing.cpp
deleted file mode 100644
index 5b0c0d234..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinv4limageprocessing.cpp
+++ /dev/null
@@ -1,316 +0,0 @@
-/****************************************************************************
-**
-** 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 "camerabinv4limageprocessing.h"
-#include "camerabinsession.h"
-
-#include <QDebug>
-
-#include <private/qcore_unix_p.h>
-#include <linux/videodev2.h>
-
-QT_BEGIN_NAMESPACE
-
-CameraBinV4LImageProcessing::CameraBinV4LImageProcessing(CameraBinSession *session)
- : QCameraImageProcessingControl(session)
- , m_session(session)
-{
-}
-
-CameraBinV4LImageProcessing::~CameraBinV4LImageProcessing()
-{
-}
-
-bool CameraBinV4LImageProcessing::isParameterSupported(
- ProcessingParameter parameter) const
-{
- return m_parametersInfo.contains(parameter);
-}
-
-bool CameraBinV4LImageProcessing::isParameterValueSupported(
- ProcessingParameter parameter, const QVariant &value) const
-{
- QMap<ProcessingParameter, SourceParameterValueInfo>::const_iterator sourceValueInfo =
- m_parametersInfo.constFind(parameter);
- if (sourceValueInfo == m_parametersInfo.constEnd())
- return false;
-
- switch (parameter) {
-
- case QCameraImageProcessingControl::WhiteBalancePreset: {
- const QCameraImageProcessing::WhiteBalanceMode checkedValue =
- value.value<QCameraImageProcessing::WhiteBalanceMode>();
- const QCameraImageProcessing::WhiteBalanceMode firstAllowedValue =
- (*sourceValueInfo).minimumValue ? QCameraImageProcessing::WhiteBalanceAuto
- : QCameraImageProcessing::WhiteBalanceManual;
- const QCameraImageProcessing::WhiteBalanceMode secondAllowedValue =
- (*sourceValueInfo).maximumValue ? QCameraImageProcessing::WhiteBalanceAuto
- : QCameraImageProcessing::WhiteBalanceManual;
- if (checkedValue != firstAllowedValue
- && checkedValue != secondAllowedValue) {
- return false;
- }
- }
- break;
-
- case QCameraImageProcessingControl::ColorTemperature: {
- const qint32 checkedValue = value.toInt();
- if (checkedValue < (*sourceValueInfo).minimumValue
- || checkedValue > (*sourceValueInfo).maximumValue) {
- return false;
- }
- }
- break;
-
- case QCameraImageProcessingControl::ContrastAdjustment: // falling back
- case QCameraImageProcessingControl::SaturationAdjustment: // falling back
- case QCameraImageProcessingControl::BrightnessAdjustment: // falling back
- case QCameraImageProcessingControl::SharpeningAdjustment: {
- const qint32 sourceValue = sourceImageProcessingParameterValue(
- value.toReal(), (*sourceValueInfo));
- if (sourceValue < (*sourceValueInfo).minimumValue
- || sourceValue > (*sourceValueInfo).maximumValue) {
- return false;
- }
- }
- break;
-
- default:
- return false;
- }
-
- return true;
-}
-
-QVariant CameraBinV4LImageProcessing::parameter(
- ProcessingParameter parameter) const
-{
- QMap<ProcessingParameter, SourceParameterValueInfo>::const_iterator sourceValueInfo =
- m_parametersInfo.constFind(parameter);
- if (sourceValueInfo == m_parametersInfo.constEnd()) {
- if (!m_parametersInfo.empty())
- qWarning() << "Unable to get the unsupported parameter:" << parameter;
- return QVariant();
- }
-
- const QString deviceName = m_session->device();
- const int fd = qt_safe_open(deviceName.toLocal8Bit().constData(), O_RDONLY);
- if (fd == -1) {
- qWarning() << "Unable to open the camera" << deviceName
- << "for read to get the parameter value:" << qt_error_string(errno);
- return QVariant();
- }
-
- struct v4l2_control control;
- ::memset(&control, 0, sizeof(control));
- control.id = (*sourceValueInfo).cid;
-
- const bool ret = (::ioctl(fd, VIDIOC_G_CTRL, &control) == 0);
-
- qt_safe_close(fd);
-
- if (!ret) {
- qWarning() << "Unable to get the parameter value:" << parameter << ":" << qt_error_string(errno);
- return QVariant();
- }
-
- switch (parameter) {
-
- case QCameraImageProcessingControl::WhiteBalancePreset:
- return QVariant::fromValue<QCameraImageProcessing::WhiteBalanceMode>(
- control.value ? QCameraImageProcessing::WhiteBalanceAuto
- : QCameraImageProcessing::WhiteBalanceManual);
-
- case QCameraImageProcessingControl::ColorTemperature:
- return QVariant::fromValue<qint32>(control.value);
-
- case QCameraImageProcessingControl::ContrastAdjustment: // falling back
- case QCameraImageProcessingControl::SaturationAdjustment: // falling back
- case QCameraImageProcessingControl::BrightnessAdjustment: // falling back
- case QCameraImageProcessingControl::SharpeningAdjustment: {
- return scaledImageProcessingParameterValue(
- control.value, (*sourceValueInfo));
- }
-
- default:
- return QVariant();
- }
-}
-
-void CameraBinV4LImageProcessing::setParameter(
- ProcessingParameter parameter, const QVariant &value)
-{
- QMap<ProcessingParameter, SourceParameterValueInfo>::const_iterator sourceValueInfo =
- m_parametersInfo.constFind(parameter);
- if (sourceValueInfo == m_parametersInfo.constEnd()) {
- if (!m_parametersInfo.empty())
- qWarning() << "Unable to set the unsupported parameter:" << parameter;
- return;
- }
-
- const QString deviceName = m_session->device();
- const int fd = qt_safe_open(deviceName.toLocal8Bit().constData(), O_WRONLY);
- if (fd == -1) {
- qWarning() << "Unable to open the camera" << deviceName
- << "for write to set the parameter value:" << qt_error_string(errno);
- return;
- }
-
- struct v4l2_control control;
- ::memset(&control, 0, sizeof(control));
- control.id = (*sourceValueInfo).cid;
-
- switch (parameter) {
-
- case QCameraImageProcessingControl::WhiteBalancePreset: {
- const QCameraImageProcessing::WhiteBalanceMode m =
- value.value<QCameraImageProcessing::WhiteBalanceMode>();
- if (m != QCameraImageProcessing::WhiteBalanceAuto
- && m != QCameraImageProcessing::WhiteBalanceManual) {
- qt_safe_close(fd);
- return;
- }
-
- control.value = (m == QCameraImageProcessing::WhiteBalanceAuto) ? true : false;
- }
- break;
-
- case QCameraImageProcessingControl::ColorTemperature:
- control.value = value.toInt();
- break;
-
- case QCameraImageProcessingControl::ContrastAdjustment: // falling back
- case QCameraImageProcessingControl::SaturationAdjustment: // falling back
- case QCameraImageProcessingControl::BrightnessAdjustment: // falling back
- case QCameraImageProcessingControl::SharpeningAdjustment:
- control.value = sourceImageProcessingParameterValue(
- value.toReal(), (*sourceValueInfo));
- break;
-
- default:
- qt_safe_close(fd);
- return;
- }
-
- if (::ioctl(fd, VIDIOC_S_CTRL, &control) != 0)
- qWarning() << "Unable to set the parameter value:" << parameter << ":" << qt_error_string(errno);
-
- qt_safe_close(fd);
-}
-
-void CameraBinV4LImageProcessing::updateParametersInfo(
- QCamera::Status cameraStatus)
-{
- if (cameraStatus == QCamera::UnloadedStatus)
- m_parametersInfo.clear();
- else if (cameraStatus == QCamera::LoadedStatus) {
- const QString deviceName = m_session->device();
- 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;
- }
-
- static const struct SupportedParameterEntry {
- quint32 cid;
- QCameraImageProcessingControl::ProcessingParameter parameter;
- } supportedParametersEntries[] = {
- { V4L2_CID_AUTO_WHITE_BALANCE, QCameraImageProcessingControl::WhiteBalancePreset },
- { V4L2_CID_WHITE_BALANCE_TEMPERATURE, QCameraImageProcessingControl::ColorTemperature },
- { V4L2_CID_CONTRAST, QCameraImageProcessingControl::ContrastAdjustment },
- { V4L2_CID_SATURATION, QCameraImageProcessingControl::SaturationAdjustment },
- { V4L2_CID_BRIGHTNESS, QCameraImageProcessingControl::BrightnessAdjustment },
- { V4L2_CID_SHARPNESS, QCameraImageProcessingControl::SharpeningAdjustment }
- };
-
- for (int i = 0; i < int(sizeof(supportedParametersEntries) / sizeof(SupportedParameterEntry)); ++i) {
- struct v4l2_queryctrl queryControl;
- ::memset(&queryControl, 0, sizeof(queryControl));
- queryControl.id = supportedParametersEntries[i].cid;
-
- if (::ioctl(fd, VIDIOC_QUERYCTRL, &queryControl) != 0) {
- qWarning() << "Unable to query the parameter info:" << supportedParametersEntries[i].parameter
- << ":" << qt_error_string(errno);
- continue;
- }
-
- SourceParameterValueInfo sourceValueInfo;
- sourceValueInfo.cid = queryControl.id;
- sourceValueInfo.defaultValue = queryControl.default_value;
- sourceValueInfo.maximumValue = queryControl.maximum;
- sourceValueInfo.minimumValue = queryControl.minimum;
-
- m_parametersInfo.insert(supportedParametersEntries[i].parameter, sourceValueInfo);
- }
-
- qt_safe_close(fd);
- }
-}
-
-qreal CameraBinV4LImageProcessing::scaledImageProcessingParameterValue(
- qint32 sourceValue, const SourceParameterValueInfo &sourceValueInfo)
-{
- if (sourceValue == sourceValueInfo.defaultValue) {
- return 0.0f;
- } else if (sourceValue < sourceValueInfo.defaultValue) {
- return ((sourceValue - sourceValueInfo.minimumValue)
- / qreal(sourceValueInfo.defaultValue - sourceValueInfo.minimumValue))
- + (-1.0f);
- } else {
- return ((sourceValue - sourceValueInfo.defaultValue)
- / qreal(sourceValueInfo.maximumValue - sourceValueInfo.defaultValue));
- }
-}
-
-qint32 CameraBinV4LImageProcessing::sourceImageProcessingParameterValue(
- qreal scaledValue, const SourceParameterValueInfo &valueRange)
-{
- if (qFuzzyIsNull(scaledValue)) {
- return valueRange.defaultValue;
- } else if (scaledValue < 0.0f) {
- return ((scaledValue - (-1.0f)) * (valueRange.defaultValue - valueRange.minimumValue))
- + valueRange.minimumValue;
- } else {
- return (scaledValue * (valueRange.maximumValue - valueRange.defaultValue))
- + valueRange.defaultValue;
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinv4limageprocessing.h b/src/plugins/gstreamer/camerabin/camerabinv4limageprocessing.h
deleted file mode 100644
index a38dc78da..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinv4limageprocessing.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#ifndef CAMERABINV4LIMAGEPROCESSINGCONTROL_H
-#define CAMERABINV4LIMAGEPROCESSINGCONTROL_H
-
-#include <qcamera.h>
-#include <qcameraimageprocessingcontrol.h>
-
-QT_BEGIN_NAMESPACE
-
-class CameraBinSession;
-
-class CameraBinV4LImageProcessing : public QCameraImageProcessingControl
-{
- Q_OBJECT
-
-public:
- CameraBinV4LImageProcessing(CameraBinSession *session);
- virtual ~CameraBinV4LImageProcessing();
-
- bool isParameterSupported(ProcessingParameter) const override;
- bool isParameterValueSupported(ProcessingParameter parameter, const QVariant &value) const override;
- QVariant parameter(ProcessingParameter parameter) const override;
- void setParameter(ProcessingParameter parameter, const QVariant &value) override;
-
-public slots:
- void updateParametersInfo(QCamera::Status cameraStatus);
-
-private:
- struct SourceParameterValueInfo {
- SourceParameterValueInfo()
- : cid(0)
- {
- }
-
- qint32 defaultValue;
- qint32 minimumValue;
- qint32 maximumValue;
- quint32 cid; // V4L control id
- };
-
- static qreal scaledImageProcessingParameterValue(
- qint32 sourceValue, const SourceParameterValueInfo &sourceValueInfo);
- static qint32 sourceImageProcessingParameterValue(
- qreal scaledValue, const SourceParameterValueInfo &valueRange);
-private:
- CameraBinSession *m_session;
- QMap<ProcessingParameter, SourceParameterValueInfo> m_parametersInfo;
-};
-
-QT_END_NAMESPACE
-
-#endif // CAMERABINV4LIMAGEPROCESSINGCONTROL_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp b/src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp
deleted file mode 100644
index 5bba2ddb5..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp
+++ /dev/null
@@ -1,239 +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$
-**
-****************************************************************************/
-
-#include <QtMultimedia/private/qtmultimediaglobal_p.h>
-#include "camerabinvideoencoder.h"
-#include "camerabinsession.h"
-#include "camerabincontainer.h"
-#include <private/qgstutils_p.h>
-
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-CameraBinVideoEncoder::CameraBinVideoEncoder(CameraBinSession *session)
- :QVideoEncoderSettingsControl(session)
- , m_session(session)
-#if QT_CONFIG(gstreamer_encodingprofiles)
- , m_codecs(QGstCodecsInfo::VideoEncoder)
-#endif
-{
-}
-
-CameraBinVideoEncoder::~CameraBinVideoEncoder()
-{
-}
-
-QList<QSize> CameraBinVideoEncoder::supportedResolutions(const QVideoEncoderSettings &settings, bool *continuous) const
-{
- if (continuous)
- *continuous = false;
-
- QPair<int,int> rate = rateAsRational(settings.frameRate());
-
- //select the closest supported rational rate to settings.frameRate()
-
- return m_session->supportedResolutions(rate, continuous, QCamera::CaptureVideo);
-}
-
-QList< qreal > CameraBinVideoEncoder::supportedFrameRates(const QVideoEncoderSettings &settings, bool *continuous) const
-{
- if (continuous)
- *continuous = false;
-
- QList< qreal > res;
-
- const auto rates = m_session->supportedFrameRates(settings.resolution(), continuous);
- for (const auto &rate : rates) {
- if (rate.second > 0)
- res << qreal(rate.first)/rate.second;
- }
-
- return res;
-}
-
-QStringList CameraBinVideoEncoder::supportedVideoCodecs() const
-{
-#if QT_CONFIG(gstreamer_encodingprofiles)
- return m_codecs.supportedCodecs();
-#else
- return QStringList();
-#endif
-}
-
-QString CameraBinVideoEncoder::videoCodecDescription(const QString &codecName) const
-{
-#if QT_CONFIG(gstreamer_encodingprofiles)
- return m_codecs.codecDescription(codecName);
-#else
- Q_UNUSED(codecName);
- return QString();
-#endif
-}
-
-QVideoEncoderSettings CameraBinVideoEncoder::videoSettings() const
-{
- return m_videoSettings;
-}
-
-void CameraBinVideoEncoder::setVideoSettings(const QVideoEncoderSettings &settings)
-{
- if (m_videoSettings != settings) {
- m_actualVideoSettings = settings;
- m_videoSettings = settings;
- emit settingsChanged();
- }
-}
-
-QVideoEncoderSettings CameraBinVideoEncoder::actualVideoSettings() const
-{
- return m_actualVideoSettings;
-}
-
-void CameraBinVideoEncoder::setActualVideoSettings(const QVideoEncoderSettings &settings)
-{
- m_actualVideoSettings = settings;
-}
-
-void CameraBinVideoEncoder::resetActualSettings()
-{
- m_actualVideoSettings = m_videoSettings;
-}
-
-
-QPair<int,int> CameraBinVideoEncoder::rateAsRational(qreal frameRate) const
-{
- if (frameRate > 0.001) {
- //convert to rational number
- QList<int> denumCandidates;
- denumCandidates << 1 << 2 << 3 << 5 << 10 << 25 << 30 << 50 << 100 << 1001 << 1000;
-
- qreal error = 1.0;
- int num = 1;
- int denum = 1;
-
- for (int curDenum : qAsConst(denumCandidates)) {
- int curNum = qRound(frameRate*curDenum);
- qreal curError = qAbs(qreal(curNum)/curDenum - frameRate);
-
- if (curError < error) {
- error = curError;
- num = curNum;
- denum = curDenum;
- }
-
- if (curError < 1e-8)
- break;
- }
-
- return QPair<int,int>(num,denum);
- }
-
- return QPair<int,int>();
-}
-
-#if QT_CONFIG(gstreamer_encodingprofiles)
-
-GstEncodingProfile *CameraBinVideoEncoder::createProfile()
-{
- QString codec = m_actualVideoSettings.codec();
- GstCaps *caps = !codec.isEmpty() ? gst_caps_from_string(codec.toLatin1()) : nullptr;
-
- if (!caps)
- return nullptr;
-
- QString preset = m_actualVideoSettings.encodingOption(QStringLiteral("preset")).toString();
- GstEncodingVideoProfile *profile = gst_encoding_video_profile_new(
- caps,
- !preset.isEmpty() ? preset.toLatin1().constData() : NULL, //preset
- NULL, //restriction
- 1); //presence
-
- gst_caps_unref(caps);
-
- gst_encoding_video_profile_set_pass(profile, 0);
- gst_encoding_video_profile_set_variableframerate(profile, TRUE);
-
- return (GstEncodingProfile *)profile;
-}
-
-#endif
-
-void CameraBinVideoEncoder::applySettings(GstElement *encoder)
-{
- GObjectClass * const objectClass = G_OBJECT_GET_CLASS(encoder);
- const char * const name = qt_gst_element_get_factory_name(encoder);
-
- const int bitRate = m_actualVideoSettings.bitRate();
- if (bitRate == -1) {
- // Bit rate is invalid, don't evaluate the remaining conditions.
- } else if (g_object_class_find_property(objectClass, "bitrate")) {
- g_object_set(G_OBJECT(encoder), "bitrate", bitRate, NULL);
- } else if (g_object_class_find_property(objectClass, "target-bitrate")) {
- g_object_set(G_OBJECT(encoder), "target-bitrate", bitRate, NULL);
- }
-
- if (qstrcmp(name, "theoraenc") == 0) {
- static const int qualities[] = { 8, 16, 32, 45, 60 };
- g_object_set(G_OBJECT(encoder), "quality", qualities[m_actualVideoSettings.quality()], NULL);
- } else if (qstrncmp(name, "avenc_", 6) == 0) {
- if (g_object_class_find_property(objectClass, "pass")) {
- static const int modes[] = { 0, 2, 512, 1024 };
- g_object_set(G_OBJECT(encoder), "pass", modes[m_actualVideoSettings.encodingMode()], NULL);
- }
- if (g_object_class_find_property(objectClass, "quantizer")) {
- static const double qualities[] = { 20, 8.0, 3.0, 2.5, 2.0 };
- g_object_set(G_OBJECT(encoder), "quantizer", qualities[m_actualVideoSettings.quality()], NULL);
- }
- } else if (qstrncmp(name, "omx", 3) == 0) {
- if (!g_object_class_find_property(objectClass, "control-rate")) {
- } else switch (m_actualVideoSettings.encodingMode()) {
- case QMultimedia::ConstantBitRateEncoding:
- g_object_set(G_OBJECT(encoder), "control-rate", 2, NULL);
- break;
- case QMultimedia::AverageBitRateEncoding:
- g_object_set(G_OBJECT(encoder), "control-rate", 1, NULL);
- break;
- default:
- g_object_set(G_OBJECT(encoder), "control-rate", 0, NULL);
- }
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinvideoencoder.h b/src/plugins/gstreamer/camerabin/camerabinvideoencoder.h
deleted file mode 100644
index 24013ceab..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinvideoencoder.h
+++ /dev/null
@@ -1,109 +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 CAMERABINVIDEOENCODE_H
-#define CAMERABINVIDEOENCODE_H
-
-#include <QtMultimedia/private/qtmultimediaglobal_p.h>
-#include <qvideoencodersettingscontrol.h>
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmap.h>
-#include <QtCore/qset.h>
-
-#include <gst/gst.h>
-#include <gst/pbutils/pbutils.h>
-
-#if QT_CONFIG(gstreamer_encodingprofiles)
-#include <gst/pbutils/encoding-profile.h>
-#include <private/qgstcodecsinfo_p.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class CameraBinSession;
-
-class CameraBinVideoEncoder : public QVideoEncoderSettingsControl
-{
- Q_OBJECT
-public:
- CameraBinVideoEncoder(CameraBinSession *session);
- virtual ~CameraBinVideoEncoder();
-
- QList<QSize> supportedResolutions(const QVideoEncoderSettings &settings = QVideoEncoderSettings(),
- bool *continuous = 0) const override;
-
- QList< qreal > supportedFrameRates(const QVideoEncoderSettings &settings = QVideoEncoderSettings(),
- bool *continuous = 0) const override;
-
- QPair<int,int> rateAsRational(qreal) const;
-
- QStringList supportedVideoCodecs() const override;
- QString videoCodecDescription(const QString &codecName) const override;
-
- QVideoEncoderSettings videoSettings() const override;
- void setVideoSettings(const QVideoEncoderSettings &settings) override;
-
- QVideoEncoderSettings actualVideoSettings() const;
- void setActualVideoSettings(const QVideoEncoderSettings&);
- void resetActualSettings();
-
-#if QT_CONFIG(gstreamer_encodingprofiles)
- GstEncodingProfile *createProfile();
-#endif
-
- void applySettings(GstElement *encoder);
-
-Q_SIGNALS:
- void settingsChanged();
-
-private:
- CameraBinSession *m_session;
-
-#if QT_CONFIG(gstreamer_encodingprofiles)
- QGstCodecsInfo m_codecs;
-#endif
-
- QVideoEncoderSettings m_actualVideoSettings;
- QVideoEncoderSettings m_videoSettings;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.cpp b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.cpp
deleted file mode 100644
index 0e14a15e5..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd.
-** 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$
-**
-****************************************************************************/
-
-
-#include "camerabinviewfindersettings.h"
-#include "camerabinsession.h"
-
-QT_BEGIN_NAMESPACE
-
-
-CameraBinViewfinderSettings::CameraBinViewfinderSettings(CameraBinSession *session)
- : QCameraViewfinderSettingsControl(session)
- , m_session(session)
-{
-}
-
-CameraBinViewfinderSettings::~CameraBinViewfinderSettings()
-{
-}
-
-bool CameraBinViewfinderSettings::isViewfinderParameterSupported(ViewfinderParameter parameter) const
-{
- switch (parameter) {
- case Resolution:
- case PixelAspectRatio:
- case MinimumFrameRate:
- case MaximumFrameRate:
- case PixelFormat:
- return true;
- case UserParameter:
- return false;
- }
- return false;
-}
-
-QVariant CameraBinViewfinderSettings::viewfinderParameter(ViewfinderParameter parameter) const
-{
- switch (parameter) {
- case Resolution:
- return m_session->viewfinderSettings().resolution();
- case PixelAspectRatio:
- return m_session->viewfinderSettings().pixelAspectRatio();
- case MinimumFrameRate:
- return m_session->viewfinderSettings().minimumFrameRate();
- case MaximumFrameRate:
- return m_session->viewfinderSettings().maximumFrameRate();
- case PixelFormat:
- return m_session->viewfinderSettings().pixelFormat();
- case UserParameter:
- return QVariant();
- }
- return false;
-}
-
-void CameraBinViewfinderSettings::setViewfinderParameter(ViewfinderParameter parameter, const QVariant &value)
-{
- QCameraViewfinderSettings settings = m_session->viewfinderSettings();
-
- switch (parameter) {
- case Resolution:
- settings.setResolution(value.toSize());
- break;
- case PixelAspectRatio:
- settings.setPixelAspectRatio(value.toSize());
- break;
- case MinimumFrameRate:
- settings.setMinimumFrameRate(value.toReal());
- break;
- case MaximumFrameRate:
- settings.setMaximumFrameRate(value.toReal());
- break;
- case PixelFormat:
- settings.setPixelFormat(qvariant_cast<QVideoFrame::PixelFormat>(value));
- case UserParameter:
- break;
- }
-
- m_session->setViewfinderSettings(settings);
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.h b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.h
deleted file mode 100644
index 59a0ca8a9..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd.
-** 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 CAMERABINVIEWFINDERSETTINGS_H
-#define CAMERABINVIEWFINDERSETTINGS_H
-
-#include <qcameraviewfindersettingscontrol.h>
-
-QT_BEGIN_NAMESPACE
-
-class CameraBinSession;
-
-class CameraBinViewfinderSettings : public QCameraViewfinderSettingsControl
-{
- Q_OBJECT
-public:
- CameraBinViewfinderSettings(CameraBinSession *session);
- ~CameraBinViewfinderSettings();
-
- bool isViewfinderParameterSupported(ViewfinderParameter parameter) const override;
- QVariant viewfinderParameter(ViewfinderParameter parameter) const override;
- void setViewfinderParameter(ViewfinderParameter parameter, const QVariant &value) override;
-
-private:
- CameraBinSession *m_session;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.cpp b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.cpp
deleted file mode 100644
index a7199216e..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.cpp
+++ /dev/null
@@ -1,73 +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$
-**
-****************************************************************************/
-
-#include "camerabinviewfindersettings2.h"
-#include "camerabinsession.h"
-
-QT_BEGIN_NAMESPACE
-
-CameraBinViewfinderSettings2::CameraBinViewfinderSettings2(CameraBinSession *session)
- : QCameraViewfinderSettingsControl2(session)
- , m_session(session)
-{
-
-}
-
-CameraBinViewfinderSettings2::~CameraBinViewfinderSettings2()
-{
-
-}
-
-QList<QCameraViewfinderSettings> CameraBinViewfinderSettings2::supportedViewfinderSettings() const
-{
- return m_session->supportedViewfinderSettings();
-}
-
-QCameraViewfinderSettings CameraBinViewfinderSettings2::viewfinderSettings() const
-{
- return m_session->viewfinderSettings();
-}
-
-void CameraBinViewfinderSettings2::setViewfinderSettings(const QCameraViewfinderSettings &settings)
-{
- m_session->setViewfinderSettings(settings);
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.h b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.h
deleted file mode 100644
index 5e03b007a..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.h
+++ /dev/null
@@ -1,67 +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 CAMERABINVIEWFINDERSETTINGS2_H
-#define CAMERABINVIEWFINDERSETTINGS2_H
-
-#include <qcameraviewfindersettingscontrol.h>
-
-QT_BEGIN_NAMESPACE
-
-class CameraBinSession;
-
-class CameraBinViewfinderSettings2 : public QCameraViewfinderSettingsControl2
-{
- Q_OBJECT
-public:
- CameraBinViewfinderSettings2(CameraBinSession *session);
- ~CameraBinViewfinderSettings2();
-
- QList<QCameraViewfinderSettings> supportedViewfinderSettings() const override;
-
- QCameraViewfinderSettings viewfinderSettings() const override;
- void setViewfinderSettings(const QCameraViewfinderSettings &settings) override;
-
-private:
- CameraBinSession *m_session;
-};
-
-QT_END_NAMESPACE
-
-#endif // CAMERABINVIEWFINDERSETTINGS2_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinzoom.cpp b/src/plugins/gstreamer/camerabin/camerabinzoom.cpp
deleted file mode 100644
index 401e13207..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinzoom.cpp
+++ /dev/null
@@ -1,147 +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$
-**
-****************************************************************************/
-
-#include "camerabinzoom.h"
-#include "camerabinsession.h"
-
-#define ZOOM_PROPERTY "zoom"
-#define MAX_ZOOM_PROPERTY "max-zoom"
-
-QT_BEGIN_NAMESPACE
-
-CameraBinZoom::CameraBinZoom(CameraBinSession *session)
- : QCameraZoomControl(session)
- , m_session(session)
- , m_requestedOpticalZoom(1.0)
- , m_requestedDigitalZoom(1.0)
-{
- GstElement *camerabin = m_session->cameraBin();
- g_signal_connect(G_OBJECT(camerabin), "notify::zoom", G_CALLBACK(updateZoom), this);
- g_signal_connect(G_OBJECT(camerabin), "notify::max-zoom", G_CALLBACK(updateMaxZoom), this);
-}
-
-CameraBinZoom::~CameraBinZoom()
-{
-}
-
-qreal CameraBinZoom::maximumOpticalZoom() const
-{
- return 1.0;
-}
-
-qreal CameraBinZoom::maximumDigitalZoom() const
-{
- gfloat zoomFactor = 1.0;
- g_object_get(GST_BIN(m_session->cameraBin()), MAX_ZOOM_PROPERTY, &zoomFactor, NULL);
- return zoomFactor;
-}
-
-qreal CameraBinZoom::requestedDigitalZoom() const
-{
- return m_requestedDigitalZoom;
-}
-
-qreal CameraBinZoom::requestedOpticalZoom() const
-{
- return m_requestedOpticalZoom;
-}
-
-qreal CameraBinZoom::currentOpticalZoom() const
-{
- return 1.0;
-}
-
-qreal CameraBinZoom::currentDigitalZoom() const
-{
- gfloat zoomFactor = 1.0;
- g_object_get(GST_BIN(m_session->cameraBin()), ZOOM_PROPERTY, &zoomFactor, NULL);
- return zoomFactor;
-}
-
-void CameraBinZoom::zoomTo(qreal optical, qreal digital)
-{
- qreal oldDigitalZoom = currentDigitalZoom();
-
- if (m_requestedDigitalZoom != digital) {
- m_requestedDigitalZoom = digital;
- emit requestedDigitalZoomChanged(digital);
- }
-
- if (m_requestedOpticalZoom != optical) {
- m_requestedOpticalZoom = optical;
- emit requestedOpticalZoomChanged(optical);
- }
-
- digital = qBound(qreal(1.0), digital, maximumDigitalZoom());
- g_object_set(GST_BIN(m_session->cameraBin()), ZOOM_PROPERTY, digital, NULL);
-
- qreal newDigitalZoom = currentDigitalZoom();
- if (!qFuzzyCompare(oldDigitalZoom, newDigitalZoom))
- emit currentDigitalZoomChanged(digital);
-}
-
-void CameraBinZoom::updateZoom(GObject *o, GParamSpec *p, gpointer d)
-{
- Q_UNUSED(p);
-
- gfloat zoomFactor = 1.0;
- g_object_get(o, ZOOM_PROPERTY, &zoomFactor, NULL);
-
- CameraBinZoom *zoom = reinterpret_cast<CameraBinZoom *>(d);
-
- QMetaObject::invokeMethod(zoom, "currentDigitalZoomChanged",
- Qt::QueuedConnection,
- Q_ARG(qreal, zoomFactor));
-}
-
-void CameraBinZoom::updateMaxZoom(GObject *o, GParamSpec *p, gpointer d)
-{
- Q_UNUSED(p);
-
- gfloat zoomFactor = 1.0;
- g_object_get(o, MAX_ZOOM_PROPERTY, &zoomFactor, NULL);
-
- CameraBinZoom *zoom = reinterpret_cast<CameraBinZoom *>(d);
-
- QMetaObject::invokeMethod(zoom, "maximumDigitalZoomChanged",
- Qt::QueuedConnection,
- Q_ARG(qreal, zoomFactor));
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinzoom.h b/src/plugins/gstreamer/camerabin/camerabinzoom.h
deleted file mode 100644
index 858ada2da..000000000
--- a/src/plugins/gstreamer/camerabin/camerabinzoom.h
+++ /dev/null
@@ -1,78 +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 CAMERABINZOOMCONTROL_H
-#define CAMERABINZOOMCONTROL_H
-
-#include <qcamerazoomcontrol.h>
-#include <gst/gst.h>
-
-QT_BEGIN_NAMESPACE
-
-class CameraBinSession;
-
-class CameraBinZoom : public QCameraZoomControl
-{
- Q_OBJECT
-public:
- CameraBinZoom(CameraBinSession *session);
- virtual ~CameraBinZoom();
-
- qreal maximumOpticalZoom() const override;
- qreal maximumDigitalZoom() const override;
-
- qreal requestedOpticalZoom() const override;
- qreal requestedDigitalZoom() const override;
- qreal currentOpticalZoom() const override;
- qreal currentDigitalZoom() const override;
-
- void zoomTo(qreal optical, qreal digital) override;
-
-private:
- static void updateZoom(GObject *o, GParamSpec *p, gpointer d);
- static void updateMaxZoom(GObject *o, GParamSpec *p, gpointer d);
-
- CameraBinSession *m_session;
- qreal m_requestedOpticalZoom;
- qreal m_requestedDigitalZoom;
-};
-
-QT_END_NAMESPACE
-
-#endif // CAMERABINZOOMCONTROL_H