summaryrefslogtreecommitdiffstats
path: root/src/plugins/gstreamer
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/gstreamer')
-rw-r--r--src/plugins/gstreamer/audiodecoder/audiodecoder.json4
-rw-r--r--src/plugins/gstreamer/audiodecoder/audiodecoder.pro24
-rw-r--r--src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodercontrol.cpp139
-rw-r--r--src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodercontrol.h95
-rw-r--r--src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderservice.cpp73
-rw-r--r--src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderservice.h69
-rw-r--r--src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.cpp99
-rw-r--r--src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.h72
-rw-r--r--src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.cpp614
-rw-r--r--src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.h157
-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
-rw-r--r--src/plugins/gstreamer/common.pri15
-rw-r--r--src/plugins/gstreamer/gstreamer.json4
-rw-r--r--src/plugins/gstreamer/gstreamer.pro10
-rw-r--r--src/plugins/gstreamer/mediacapture/mediacapture.json4
-rw-r--r--src/plugins/gstreamer/mediacapture/mediacapture.pro52
-rw-r--r--src/plugins/gstreamer/mediacapture/mediacapturecamera.json4
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp239
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreameraudioencode.h94
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.cpp197
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.h94
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.cpp158
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.h71
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.cpp227
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h103
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.cpp142
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.h95
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp1032
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercapturesession.h244
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.cpp113
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.h74
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerimageencode.cpp88
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerimageencode.h81
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.cpp60
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.h80
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp372
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.h97
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.cpp286
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.h83
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamervideoencode.cpp296
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamervideoencode.h97
-rw-r--r--src/plugins/gstreamer/mediaplayer/mediaplayer.json4
-rw-r--r--src/plugins/gstreamer/mediaplayer/mediaplayer.pro26
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.cpp64
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.h65
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp190
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.h72
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp193
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h99
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp113
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.h78
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.cpp87
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.h71
102 files changed, 0 insertions, 16011 deletions
diff --git a/src/plugins/gstreamer/audiodecoder/audiodecoder.json b/src/plugins/gstreamer/audiodecoder/audiodecoder.json
deleted file mode 100644
index 4314f2efa..000000000
--- a/src/plugins/gstreamer/audiodecoder/audiodecoder.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "Keys": ["gstreameraudiodecode"],
- "Services": ["org.qt-project.qt.audiodecode"]
-}
diff --git a/src/plugins/gstreamer/audiodecoder/audiodecoder.pro b/src/plugins/gstreamer/audiodecoder/audiodecoder.pro
deleted file mode 100644
index 4e816e920..000000000
--- a/src/plugins/gstreamer/audiodecoder/audiodecoder.pro
+++ /dev/null
@@ -1,24 +0,0 @@
-TARGET = gstaudiodecoder
-
-include(../common.pri)
-
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/qgstreameraudiodecodercontrol.h \
- $$PWD/qgstreameraudiodecoderservice.h \
- $$PWD/qgstreameraudiodecodersession.h \
- $$PWD/qgstreameraudiodecoderserviceplugin.h
-
-SOURCES += \
- $$PWD/qgstreameraudiodecodercontrol.cpp \
- $$PWD/qgstreameraudiodecoderservice.cpp \
- $$PWD/qgstreameraudiodecodersession.cpp \
- $$PWD/qgstreameraudiodecoderserviceplugin.cpp
-
-OTHER_FILES += \
- audiodecoder.json
-
-PLUGIN_TYPE = mediaservice
-PLUGIN_CLASS_NAME = QGstreamerAudioDecoderServicePlugin
-load(qt_plugin)
diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodercontrol.cpp b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodercontrol.cpp
deleted file mode 100644
index e9a7a5332..000000000
--- a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodercontrol.cpp
+++ /dev/null
@@ -1,139 +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 "qgstreameraudiodecodercontrol.h"
-#include "qgstreameraudiodecodersession.h"
-
-#include <QtCore/qdir.h>
-#include <QtCore/qsocketnotifier.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qdebug.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-QT_BEGIN_NAMESPACE
-
-QGstreamerAudioDecoderControl::QGstreamerAudioDecoderControl(QGstreamerAudioDecoderSession *session, QObject *parent)
- : QAudioDecoderControl(parent)
- , m_session(session)
-{
- connect(m_session, SIGNAL(bufferAvailableChanged(bool)), this, SIGNAL(bufferAvailableChanged(bool)));
- connect(m_session, SIGNAL(bufferReady()), this, SIGNAL(bufferReady()));
- connect(m_session, SIGNAL(error(int,QString)), this, SIGNAL(error(int,QString)));
- connect(m_session, SIGNAL(formatChanged(QAudioFormat)), this, SIGNAL(formatChanged(QAudioFormat)));
- connect(m_session, SIGNAL(sourceChanged()), this, SIGNAL(sourceChanged()));
- connect(m_session, SIGNAL(stateChanged(QAudioDecoder::State)), this, SIGNAL(stateChanged(QAudioDecoder::State)));
- connect(m_session, SIGNAL(finished()), this, SIGNAL(finished()));
- connect(m_session, SIGNAL(positionChanged(qint64)), this, SIGNAL(positionChanged(qint64)));
- connect(m_session, SIGNAL(durationChanged(qint64)), this, SIGNAL(durationChanged(qint64)));
-}
-
-QGstreamerAudioDecoderControl::~QGstreamerAudioDecoderControl()
-{
-
-}
-
-QAudioDecoder::State QGstreamerAudioDecoderControl::state() const
-{
- return m_session->pendingState();
-}
-
-QString QGstreamerAudioDecoderControl::sourceFilename() const
-{
- return m_session->sourceFilename();
-}
-
-void QGstreamerAudioDecoderControl::setSourceFilename(const QString &fileName)
-{
- m_session->setSourceFilename(fileName);
-}
-
-QIODevice* QGstreamerAudioDecoderControl::sourceDevice() const
-{
- return m_session->sourceDevice();
-}
-
-void QGstreamerAudioDecoderControl::setSourceDevice(QIODevice *device)
-{
- m_session->setSourceDevice(device);
-}
-
-void QGstreamerAudioDecoderControl::start()
-{
- m_session->start();
-}
-
-void QGstreamerAudioDecoderControl::stop()
-{
- m_session->stop();
-}
-
-QAudioFormat QGstreamerAudioDecoderControl::audioFormat() const
-{
- return m_session->audioFormat();
-}
-
-void QGstreamerAudioDecoderControl::setAudioFormat(const QAudioFormat &format)
-{
- m_session->setAudioFormat(format);
-}
-
-QAudioBuffer QGstreamerAudioDecoderControl::read()
-{
- return m_session->read();
-}
-
-bool QGstreamerAudioDecoderControl::bufferAvailable() const
-{
- return m_session->bufferAvailable();
-}
-
-qint64 QGstreamerAudioDecoderControl::position() const
-{
- return m_session->position();
-}
-
-qint64 QGstreamerAudioDecoderControl::duration() const
-{
- return m_session->duration();
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodercontrol.h b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodercontrol.h
deleted file mode 100644
index f5e26e553..000000000
--- a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodercontrol.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 QGSTREAMERPLAYERCONTROL_H
-#define QGSTREAMERPLAYERCONTROL_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qstack.h>
-
-#include <qaudioformat.h>
-#include <qaudiobuffer.h>
-#include <qaudiodecoder.h>
-#include <qaudiodecodercontrol.h>
-
-#include <limits.h>
-
-
-QT_BEGIN_NAMESPACE
-
-class QGstreamerAudioDecoderSession;
-class QGstreamerAudioDecoderService;
-
-class QGstreamerAudioDecoderControl : public QAudioDecoderControl
-{
- Q_OBJECT
-
-public:
- QGstreamerAudioDecoderControl(QGstreamerAudioDecoderSession *session, QObject *parent = 0);
- ~QGstreamerAudioDecoderControl();
-
- QAudioDecoder::State state() const override;
-
- QString sourceFilename() const override;
- void setSourceFilename(const QString &fileName) override;
-
- QIODevice* sourceDevice() const override;
- void setSourceDevice(QIODevice *device) override;
-
- void start() override;
- void stop() override;
-
- QAudioFormat audioFormat() const override;
- void setAudioFormat(const QAudioFormat &format) override;
-
- QAudioBuffer read() override;
- bool bufferAvailable() const override;
-
- qint64 position() const override;
- qint64 duration() const override;
-
-private:
- // Stuff goes here
-
- QGstreamerAudioDecoderSession *m_session;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderservice.cpp b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderservice.cpp
deleted file mode 100644
index 67b49be7e..000000000
--- a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderservice.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 <QtCore/qvariant.h>
-#include <QtCore/qdebug.h>
-
-#include "qgstreameraudiodecoderservice.h"
-#include "qgstreameraudiodecodercontrol.h"
-#include "qgstreameraudiodecodersession.h"
-
-QT_BEGIN_NAMESPACE
-
-QGstreamerAudioDecoderService::QGstreamerAudioDecoderService(QObject *parent)
- : QMediaService(parent)
-{
- m_session = new QGstreamerAudioDecoderSession(this);
- m_control = new QGstreamerAudioDecoderControl(m_session, this);
-}
-
-QGstreamerAudioDecoderService::~QGstreamerAudioDecoderService()
-{
-}
-
-QMediaControl *QGstreamerAudioDecoderService::requestControl(const char *name)
-{
- if (qstrcmp(name, QAudioDecoderControl_iid) == 0)
- return m_control;
-
- return 0;
-}
-
-void QGstreamerAudioDecoderService::releaseControl(QMediaControl *control)
-{
- Q_UNUSED(control);
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderservice.h b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderservice.h
deleted file mode 100644
index 6e52b9d87..000000000
--- a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderservice.h
+++ /dev/null
@@ -1,69 +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 QGSTREAMERAUDIODECODERSERVICE_H
-#define QGSTREAMERAUDIODECODERSERVICE_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qiodevice.h>
-
-#include <qmediaservice.h>
-
-QT_BEGIN_NAMESPACE
-class QGstreamerAudioDecoderControl;
-class QGstreamerAudioDecoderSession;
-
-class QGstreamerAudioDecoderService : public QMediaService
-{
- Q_OBJECT
-public:
- QGstreamerAudioDecoderService(QObject *parent = 0);
- ~QGstreamerAudioDecoderService();
-
- QMediaControl *requestControl(const char *name) override;
- void releaseControl(QMediaControl *control) override;
-
-private:
- QGstreamerAudioDecoderControl *m_control;
- QGstreamerAudioDecoderSession *m_session;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.cpp b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.cpp
deleted file mode 100644
index 463ed2d92..000000000
--- a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.cpp
+++ /dev/null
@@ -1,99 +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 "qgstreameraudiodecoderserviceplugin.h"
-
-#include "qgstreameraudiodecoderservice.h"
-#include <private/qgstutils_p.h>
-
-#include <QtCore/qstring.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/QDir>
-#include <QtCore/QDebug>
-
-// #define QT_SUPPORTEDMIMETYPES_DEBUG
-
-QMediaService* QGstreamerAudioDecoderServicePlugin::create(const QString &key)
-{
- QGstUtils::initializeGst();
-
- if (key == QLatin1String(Q_MEDIASERVICE_AUDIODECODER))
- return new QGstreamerAudioDecoderService;
-
- qWarning() << "Gstreamer audio decoder service plugin: unsupported key:" << key;
- return 0;
-}
-
-void QGstreamerAudioDecoderServicePlugin::release(QMediaService *service)
-{
- delete service;
-}
-
-QMultimedia::SupportEstimate QGstreamerAudioDecoderServicePlugin::hasSupport(const QString &mimeType,
- const QStringList &codecs) const
-{
- if (m_supportedMimeTypeSet.isEmpty())
- updateSupportedMimeTypes();
-
- return QGstUtils::hasSupport(mimeType, codecs, m_supportedMimeTypeSet);
-}
-
-static bool isDecoderOrDemuxer(GstElementFactory *factory)
-{
-#if GST_CHECK_VERSION(0, 10, 31)
- return gst_element_factory_list_is_type(factory, GST_ELEMENT_FACTORY_TYPE_DEMUXER)
- || gst_element_factory_list_is_type(factory, GST_ELEMENT_FACTORY_TYPE_DECODER
- | GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO);
-#else
- return (factory
- && (qstrcmp(factory->details.klass, "Codec/Decoder/Audio") == 0
- || qstrcmp(factory->details.klass, "Codec/Demux") == 0));
-#endif
-}
-
-void QGstreamerAudioDecoderServicePlugin::updateSupportedMimeTypes() const
-{
- m_supportedMimeTypeSet = QGstUtils::supportedMimeTypes(isDecoderOrDemuxer);
-}
-
-QStringList QGstreamerAudioDecoderServicePlugin::supportedMimeTypes() const
-{
- return QStringList();
-}
-
diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.h b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.h
deleted file mode 100644
index d1b96043b..000000000
--- a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.h
+++ /dev/null
@@ -1,72 +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 QGSTREAMERAUDIODECODERSERVICEPLUGIN_H
-#define QGSTREAMERAUDIODECODERSERVICEPLUGIN_H
-
-#include <qmediaserviceproviderplugin.h>
-#include <QtCore/qset.h>
-#include <QtCore/QObject>
-
-QT_BEGIN_NAMESPACE
-
-class QGstreamerAudioDecoderServicePlugin
- : public QMediaServiceProviderPlugin
- , public QMediaServiceSupportedFormatsInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaServiceSupportedFormatsInterface)
- Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "audiodecoder.json")
-
-public:
- QMediaService* create(const QString &key) override;
- void release(QMediaService *service) override;
-
- QMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList &codecs) const override;
- QStringList supportedMimeTypes() const override;
-
-private:
- void updateSupportedMimeTypes() const;
-
- mutable QSet<QString> m_supportedMimeTypeSet;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGSTREAMERAUDIODECODERSERVICEPLUGIN_H
diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.cpp b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.cpp
deleted file mode 100644
index d6b8ad759..000000000
--- a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.cpp
+++ /dev/null
@@ -1,614 +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$
-**
-****************************************************************************/
-//#define DEBUG_DECODER
-
-#include "qgstreameraudiodecodersession.h"
-#include <private/qgstreamerbushelper_p.h>
-
-#include <private/qgstutils_p.h>
-
-#include <gst/gstvalue.h>
-#include <gst/base/gstbasesrc.h>
-
-#include <QtCore/qdatetime.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qsize.h>
-#include <QtCore/qtimer.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qdir.h>
-#include <QtCore/qstandardpaths.h>
-#include <QtCore/qurl.h>
-
-#define MAX_BUFFERS_IN_QUEUE 4
-
-QT_BEGIN_NAMESPACE
-
-typedef enum {
- GST_PLAY_FLAG_VIDEO = 0x00000001,
- GST_PLAY_FLAG_AUDIO = 0x00000002,
- GST_PLAY_FLAG_TEXT = 0x00000004,
- GST_PLAY_FLAG_VIS = 0x00000008,
- GST_PLAY_FLAG_SOFT_VOLUME = 0x00000010,
- GST_PLAY_FLAG_NATIVE_AUDIO = 0x00000020,
- GST_PLAY_FLAG_NATIVE_VIDEO = 0x00000040,
- GST_PLAY_FLAG_DOWNLOAD = 0x00000080,
- GST_PLAY_FLAG_BUFFERING = 0x000000100
-} GstPlayFlags;
-
-QGstreamerAudioDecoderSession::QGstreamerAudioDecoderSession(QObject *parent)
- : QObject(parent),
- m_state(QAudioDecoder::StoppedState),
- m_pendingState(QAudioDecoder::StoppedState),
- m_busHelper(0),
- m_bus(0),
- m_playbin(0),
- m_outputBin(0),
- m_audioConvert(0),
- m_appSink(0),
-#if QT_CONFIG(gstreamer_app)
- m_appSrc(0),
-#endif
- mDevice(0),
- m_buffersAvailable(0),
- m_position(-1),
- m_duration(-1),
- m_durationQueries(0)
-{
- // Create pipeline here
- m_playbin = gst_element_factory_make(QT_GSTREAMER_PLAYBIN_ELEMENT_NAME, NULL);
-
- if (m_playbin != 0) {
- // Sort out messages
- m_bus = gst_element_get_bus(m_playbin);
- m_busHelper = new QGstreamerBusHelper(m_bus, this);
- m_busHelper->installMessageFilter(this);
-
- // Set the rest of the pipeline up
- setAudioFlags(true);
-
- m_audioConvert = gst_element_factory_make("audioconvert", NULL);
-
- m_outputBin = gst_bin_new("audio-output-bin");
- gst_bin_add(GST_BIN(m_outputBin), m_audioConvert);
-
- // add ghostpad
- GstPad *pad = gst_element_get_static_pad(m_audioConvert, "sink");
- Q_ASSERT(pad);
- gst_element_add_pad(GST_ELEMENT(m_outputBin), gst_ghost_pad_new("sink", pad));
- gst_object_unref(GST_OBJECT(pad));
-
- g_object_set(G_OBJECT(m_playbin), "audio-sink", m_outputBin, NULL);
-#if QT_CONFIG(gstreamer_app)
- g_signal_connect(G_OBJECT(m_playbin), "deep-notify::source", (GCallback) &QGstreamerAudioDecoderSession::configureAppSrcElement, (gpointer)this);
-#endif
-
- // Set volume to 100%
- gdouble volume = 1.0;
- g_object_set(G_OBJECT(m_playbin), "volume", volume, NULL);
- }
-}
-
-QGstreamerAudioDecoderSession::~QGstreamerAudioDecoderSession()
-{
- if (m_playbin) {
- stop();
-
- delete m_busHelper;
-#if QT_CONFIG(gstreamer_app)
- delete m_appSrc;
-#endif
- gst_object_unref(GST_OBJECT(m_bus));
- gst_object_unref(GST_OBJECT(m_playbin));
- }
-}
-
-#if QT_CONFIG(gstreamer_app)
-void QGstreamerAudioDecoderSession::configureAppSrcElement(GObject* object, GObject *orig, GParamSpec *pspec, QGstreamerAudioDecoderSession* self)
-{
- Q_UNUSED(object);
- Q_UNUSED(pspec);
-
- // In case we switch from appsrc to not
- if (!self->appsrc())
- return;
-
- GstElement *appsrc;
- g_object_get(orig, "source", &appsrc, NULL);
-
- if (!self->appsrc()->setup(appsrc))
- qWarning()<<"Could not setup appsrc element";
-
- g_object_unref(G_OBJECT(appsrc));
-}
-#endif
-
-bool QGstreamerAudioDecoderSession::processBusMessage(const QGstreamerMessage &message)
-{
- GstMessage* gm = message.rawMessage();
- if (gm) {
- if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_DURATION) {
- updateDuration();
- } else if (GST_MESSAGE_SRC(gm) == GST_OBJECT_CAST(m_playbin)) {
- switch (GST_MESSAGE_TYPE(gm)) {
- case GST_MESSAGE_STATE_CHANGED:
- {
- GstState oldState;
- GstState newState;
- GstState pending;
-
- gst_message_parse_state_changed(gm, &oldState, &newState, &pending);
-
-#ifdef DEBUG_DECODER
- 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]) << "internal" << m_state;
-#endif
-
- QAudioDecoder::State prevState = m_state;
-
- switch (newState) {
- case GST_STATE_VOID_PENDING:
- case GST_STATE_NULL:
- m_state = QAudioDecoder::StoppedState;
- break;
- case GST_STATE_READY:
- m_state = QAudioDecoder::StoppedState;
- break;
- case GST_STATE_PLAYING:
- m_state = QAudioDecoder::DecodingState;
- break;
- case GST_STATE_PAUSED:
- m_state = QAudioDecoder::DecodingState;
-
- //gstreamer doesn't give a reliable indication the duration
- //information is ready, GST_MESSAGE_DURATION is not sent by most elements
- //the duration is queried up to 5 times with increasing delay
- m_durationQueries = 5;
- updateDuration();
- break;
- }
-
- if (prevState != m_state)
- emit stateChanged(m_state);
- }
- break;
-
- case GST_MESSAGE_EOS:
- m_pendingState = m_state = QAudioDecoder::StoppedState;
- emit finished();
- emit stateChanged(m_state);
- break;
-
- case GST_MESSAGE_ERROR: {
- GError *err;
- gchar *debug;
- gst_message_parse_error(gm, &err, &debug);
- if (err->domain == GST_STREAM_ERROR && err->code == GST_STREAM_ERROR_CODEC_NOT_FOUND)
- processInvalidMedia(QAudioDecoder::FormatError, tr("Cannot play stream of type: <unknown>"));
- else
- processInvalidMedia(QAudioDecoder::ResourceError, QString::fromUtf8(err->message));
- qWarning() << "Error:" << QString::fromUtf8(err->message);
- g_error_free(err);
- g_free(debug);
- }
- break;
- case GST_MESSAGE_WARNING:
- {
- GError *err;
- gchar *debug;
- gst_message_parse_warning (gm, &err, &debug);
- qWarning() << "Warning:" << QString::fromUtf8(err->message);
- g_error_free (err);
- g_free (debug);
- }
- break;
-#ifdef DEBUG_DECODER
- case GST_MESSAGE_INFO:
- {
- GError *err;
- gchar *debug;
- gst_message_parse_info (gm, &err, &debug);
- qDebug() << "Info:" << QString::fromUtf8(err->message);
- g_error_free (err);
- g_free (debug);
- }
- break;
-#endif
- default:
- break;
- }
- } else if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ERROR) {
- GError *err;
- gchar *debug;
- gst_message_parse_error(gm, &err, &debug);
- QAudioDecoder::Error qerror = QAudioDecoder::ResourceError;
- if (err->domain == GST_STREAM_ERROR) {
- switch (err->code) {
- case GST_STREAM_ERROR_DECRYPT:
- case GST_STREAM_ERROR_DECRYPT_NOKEY:
- qerror = QAudioDecoder::AccessDeniedError;
- break;
- case GST_STREAM_ERROR_FORMAT:
- case GST_STREAM_ERROR_DEMUX:
- case GST_STREAM_ERROR_DECODE:
- case GST_STREAM_ERROR_WRONG_TYPE:
- case GST_STREAM_ERROR_TYPE_NOT_FOUND:
- case GST_STREAM_ERROR_CODEC_NOT_FOUND:
- qerror = QAudioDecoder::FormatError;
- break;
- default:
- break;
- }
- } else if (err->domain == GST_CORE_ERROR) {
- switch (err->code) {
- case GST_CORE_ERROR_MISSING_PLUGIN:
- qerror = QAudioDecoder::FormatError;
- break;
- default:
- break;
- }
- }
-
- processInvalidMedia(qerror, QString::fromUtf8(err->message));
- g_error_free(err);
- g_free(debug);
- }
- }
-
- return false;
-}
-
-QString QGstreamerAudioDecoderSession::sourceFilename() const
-{
- return mSource;
-}
-
-void QGstreamerAudioDecoderSession::setSourceFilename(const QString &fileName)
-{
- stop();
- mDevice = 0;
-#if QT_CONFIG(gstreamer_app)
- if (m_appSrc)
- m_appSrc->deleteLater();
- m_appSrc = 0;
-#endif
-
- bool isSignalRequired = (mSource != fileName);
- mSource = fileName;
- if (isSignalRequired)
- emit sourceChanged();
-}
-
-QIODevice *QGstreamerAudioDecoderSession::sourceDevice() const
-{
- return mDevice;
-}
-
-void QGstreamerAudioDecoderSession::setSourceDevice(QIODevice *device)
-{
- stop();
- mSource.clear();
- bool isSignalRequired = (mDevice != device);
- mDevice = device;
- if (isSignalRequired)
- emit sourceChanged();
-}
-
-void QGstreamerAudioDecoderSession::start()
-{
- if (!m_playbin) {
- processInvalidMedia(QAudioDecoder::ResourceError, "Playbin element is not valid");
- return;
- }
-
- addAppSink();
-
- if (!mSource.isEmpty()) {
- g_object_set(G_OBJECT(m_playbin), "uri", QUrl::fromLocalFile(mSource).toEncoded().constData(), NULL);
- } else if (mDevice) {
-#if QT_CONFIG(gstreamer_app)
- // make sure we can read from device
- if (!mDevice->isOpen() || !mDevice->isReadable()) {
- processInvalidMedia(QAudioDecoder::AccessDeniedError, "Unable to read from specified device");
- return;
- }
-
- if (!m_appSrc)
- m_appSrc = new QGstAppSrc(this);
- m_appSrc->setStream(mDevice);
-
- g_object_set(G_OBJECT(m_playbin), "uri", "appsrc://", NULL);
-#endif
- } else {
- return;
- }
-
- // Set audio format
- if (m_appSink) {
- if (mFormat.isValid()) {
- setAudioFlags(false);
- GstCaps *caps = QGstUtils::capsForAudioFormat(mFormat);
- gst_app_sink_set_caps(m_appSink, caps);
- gst_caps_unref(caps);
- } else {
- // We want whatever the native audio format is
- setAudioFlags(true);
- gst_app_sink_set_caps(m_appSink, NULL);
- }
- }
-
- m_pendingState = QAudioDecoder::DecodingState;
- if (gst_element_set_state(m_playbin, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
- qWarning() << "GStreamer; Unable to start decoding process";
- m_pendingState = m_state = QAudioDecoder::StoppedState;
-
- emit stateChanged(m_state);
- }
-}
-
-void QGstreamerAudioDecoderSession::stop()
-{
- if (m_playbin) {
- gst_element_set_state(m_playbin, GST_STATE_NULL);
- removeAppSink();
-
- QAudioDecoder::State oldState = m_state;
- m_pendingState = m_state = QAudioDecoder::StoppedState;
-
- // GStreamer thread is stopped. Can safely access m_buffersAvailable
- if (m_buffersAvailable != 0) {
- m_buffersAvailable = 0;
- emit bufferAvailableChanged(false);
- }
-
- if (m_position != -1) {
- m_position = -1;
- emit positionChanged(m_position);
- }
-
- if (m_duration != -1) {
- m_duration = -1;
- emit durationChanged(m_duration);
- }
-
- if (oldState != m_state)
- emit stateChanged(m_state);
- }
-}
-
-QAudioFormat QGstreamerAudioDecoderSession::audioFormat() const
-{
- return mFormat;
-}
-
-void QGstreamerAudioDecoderSession::setAudioFormat(const QAudioFormat &format)
-{
- if (mFormat != format) {
- mFormat = format;
- emit formatChanged(mFormat);
- }
-}
-
-QAudioBuffer QGstreamerAudioDecoderSession::read()
-{
- QAudioBuffer audioBuffer;
-
- int buffersAvailable;
- {
- QMutexLocker locker(&m_buffersMutex);
- buffersAvailable = m_buffersAvailable;
-
- // need to decrement before pulling a buffer
- // to make sure assert in QGstreamerAudioDecoderSession::new_buffer works
- m_buffersAvailable--;
- }
-
-
- if (buffersAvailable) {
- if (buffersAvailable == 1)
- emit bufferAvailableChanged(false);
-
- const char* bufferData = 0;
- int bufferSize = 0;
-
-#if GST_CHECK_VERSION(1,0,0)
- GstSample *sample = gst_app_sink_pull_sample(m_appSink);
- GstBuffer *buffer = gst_sample_get_buffer(sample);
- GstMapInfo mapInfo;
- gst_buffer_map(buffer, &mapInfo, GST_MAP_READ);
- bufferData = (const char*)mapInfo.data;
- bufferSize = mapInfo.size;
- QAudioFormat format = QGstUtils::audioFormatForSample(sample);
-#else
- GstBuffer *buffer = gst_app_sink_pull_buffer(m_appSink);
- bufferData = (const char*)buffer->data;
- bufferSize = buffer->size;
- QAudioFormat format = QGstUtils::audioFormatForBuffer(buffer);
-#endif
-
- if (format.isValid()) {
- // XXX At the moment we have to copy data from GstBuffer into QAudioBuffer.
- // We could improve performance by implementing QAbstractAudioBuffer for GstBuffer.
- qint64 position = getPositionFromBuffer(buffer);
- audioBuffer = QAudioBuffer(QByteArray((const char*)bufferData, bufferSize), format, position);
- position /= 1000; // convert to milliseconds
- if (position != m_position) {
- m_position = position;
- emit positionChanged(m_position);
- }
- }
-#if GST_CHECK_VERSION(1,0,0)
- gst_buffer_unmap(buffer, &mapInfo);
- gst_sample_unref(sample);
-#else
- gst_buffer_unref(buffer);
-#endif
- }
-
- return audioBuffer;
-}
-
-bool QGstreamerAudioDecoderSession::bufferAvailable() const
-{
- QMutexLocker locker(&m_buffersMutex);
- return m_buffersAvailable > 0;
-}
-
-qint64 QGstreamerAudioDecoderSession::position() const
-{
- return m_position;
-}
-
-qint64 QGstreamerAudioDecoderSession::duration() const
-{
- return m_duration;
-}
-
-void QGstreamerAudioDecoderSession::processInvalidMedia(QAudioDecoder::Error errorCode, const QString& errorString)
-{
- stop();
- emit error(int(errorCode), errorString);
-}
-
-GstFlowReturn QGstreamerAudioDecoderSession::new_sample(GstAppSink *, gpointer user_data)
-{
- // "Note that the preroll buffer will also be returned as the first buffer when calling gst_app_sink_pull_buffer()."
- QGstreamerAudioDecoderSession *session = reinterpret_cast<QGstreamerAudioDecoderSession*>(user_data);
-
- int buffersAvailable;
- {
- QMutexLocker locker(&session->m_buffersMutex);
- buffersAvailable = session->m_buffersAvailable;
- session->m_buffersAvailable++;
- Q_ASSERT(session->m_buffersAvailable <= MAX_BUFFERS_IN_QUEUE);
- }
-
- if (!buffersAvailable)
- QMetaObject::invokeMethod(session, "bufferAvailableChanged", Qt::QueuedConnection, Q_ARG(bool, true));
- QMetaObject::invokeMethod(session, "bufferReady", Qt::QueuedConnection);
- return GST_FLOW_OK;
-}
-
-void QGstreamerAudioDecoderSession::setAudioFlags(bool wantNativeAudio)
-{
- int flags = 0;
- if (m_playbin) {
- g_object_get(G_OBJECT(m_playbin), "flags", &flags, NULL);
- // make sure not to use GST_PLAY_FLAG_NATIVE_AUDIO unless desired
- // it prevents audio format conversion
- flags &= ~(GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_NATIVE_VIDEO | GST_PLAY_FLAG_TEXT | GST_PLAY_FLAG_VIS | GST_PLAY_FLAG_NATIVE_AUDIO);
- flags |= GST_PLAY_FLAG_AUDIO;
- if (wantNativeAudio)
- flags |= GST_PLAY_FLAG_NATIVE_AUDIO;
- g_object_set(G_OBJECT(m_playbin), "flags", flags, NULL);
- }
-}
-
-void QGstreamerAudioDecoderSession::addAppSink()
-{
- if (m_appSink)
- return;
-
- m_appSink = (GstAppSink*)gst_element_factory_make("appsink", NULL);
-
- GstAppSinkCallbacks callbacks;
- memset(&callbacks, 0, sizeof(callbacks));
-#if GST_CHECK_VERSION(1,0,0)
- callbacks.new_sample = &new_sample;
-#else
- callbacks.new_buffer = &new_sample;
-#endif
- gst_app_sink_set_callbacks(m_appSink, &callbacks, this, NULL);
- gst_app_sink_set_max_buffers(m_appSink, MAX_BUFFERS_IN_QUEUE);
- gst_base_sink_set_sync(GST_BASE_SINK(m_appSink), FALSE);
-
- gst_bin_add(GST_BIN(m_outputBin), GST_ELEMENT(m_appSink));
- gst_element_link(m_audioConvert, GST_ELEMENT(m_appSink));
-}
-
-void QGstreamerAudioDecoderSession::removeAppSink()
-{
- if (!m_appSink)
- return;
-
- gst_element_unlink(m_audioConvert, GST_ELEMENT(m_appSink));
- gst_bin_remove(GST_BIN(m_outputBin), GST_ELEMENT(m_appSink));
-
- m_appSink = 0;
-}
-
-void QGstreamerAudioDecoderSession::updateDuration()
-{
- gint64 gstDuration = 0;
- int duration = -1;
-
- if (m_playbin && qt_gst_element_query_duration(m_playbin, GST_FORMAT_TIME, &gstDuration))
- duration = gstDuration / 1000000;
-
- if (m_duration != duration) {
- m_duration = duration;
- emit durationChanged(m_duration);
- }
-
- if (m_duration > 0)
- m_durationQueries = 0;
-
- if (m_durationQueries > 0) {
- //increase delay between duration requests
- int delay = 25 << (5 - m_durationQueries);
- QTimer::singleShot(delay, this, SLOT(updateDuration()));
- m_durationQueries--;
- }
-}
-
-qint64 QGstreamerAudioDecoderSession::getPositionFromBuffer(GstBuffer* buffer)
-{
- qint64 position = GST_BUFFER_TIMESTAMP(buffer);
- if (position >= 0)
- position = position / G_GINT64_CONSTANT(1000); // microseconds
- else
- position = -1;
- return position;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.h b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.h
deleted file mode 100644
index 385908cbd..000000000
--- a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.h
+++ /dev/null
@@ -1,157 +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 QGSTREAMERPLAYERSESSION_H
-#define QGSTREAMERPLAYERSESSION_H
-
-#include <QtMultimedia/private/qtmultimediaglobal_p.h>
-#include <QObject>
-#include <QtCore/qmutex.h>
-#include "qgstreameraudiodecodercontrol.h"
-#include <private/qgstreamerbushelper_p.h>
-#include "qaudiodecoder.h"
-
-#if QT_CONFIG(gstreamer_app)
-#include <private/qgstappsrc_p.h>
-#endif
-
-#include <gst/gst.h>
-#include <gst/app/gstappsink.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGstreamerBusHelper;
-class QGstreamerMessage;
-
-class QGstreamerAudioDecoderSession : public QObject,
- public QGstreamerBusMessageFilter
-{
-Q_OBJECT
-Q_INTERFACES(QGstreamerBusMessageFilter)
-
-public:
- QGstreamerAudioDecoderSession(QObject *parent);
- virtual ~QGstreamerAudioDecoderSession();
-
- QGstreamerBusHelper *bus() const { return m_busHelper; }
-
- QAudioDecoder::State state() const { return m_state; }
- QAudioDecoder::State pendingState() const { return m_pendingState; }
-
- bool processBusMessage(const QGstreamerMessage &message) override;
-
-#if QT_CONFIG(gstreamer_app)
- QGstAppSrc *appsrc() const { return m_appSrc; }
- static void configureAppSrcElement(GObject*, GObject*, GParamSpec*,QGstreamerAudioDecoderSession* _this);
-#endif
-
- QString sourceFilename() const;
- void setSourceFilename(const QString &fileName);
-
- QIODevice* sourceDevice() const;
- void setSourceDevice(QIODevice *device);
-
- void start();
- void stop();
-
- QAudioFormat audioFormat() const;
- void setAudioFormat(const QAudioFormat &format);
-
- QAudioBuffer read();
- bool bufferAvailable() const;
-
- qint64 position() const;
- qint64 duration() const;
-
- static GstFlowReturn new_sample(GstAppSink *sink, gpointer user_data);
-
-signals:
- void stateChanged(QAudioDecoder::State newState);
- void formatChanged(const QAudioFormat &format);
- void sourceChanged();
-
- void error(int error, const QString &errorString);
-
- void bufferReady();
- void bufferAvailableChanged(bool available);
- void finished();
-
- void positionChanged(qint64 position);
- void durationChanged(qint64 duration);
-
-private slots:
- void updateDuration();
-
-private:
- void setAudioFlags(bool wantNativeAudio);
- void addAppSink();
- void removeAppSink();
-
- void processInvalidMedia(QAudioDecoder::Error errorCode, const QString& errorString);
- static qint64 getPositionFromBuffer(GstBuffer* buffer);
-
- QAudioDecoder::State m_state;
- QAudioDecoder::State m_pendingState;
- QGstreamerBusHelper *m_busHelper;
- GstBus *m_bus;
- GstElement *m_playbin;
- GstElement *m_outputBin;
- GstElement *m_audioConvert;
- GstAppSink *m_appSink;
-
-#if QT_CONFIG(gstreamer_app)
- QGstAppSrc *m_appSrc;
-#endif
-
- QString mSource;
- QIODevice *mDevice; // QWeakPointer perhaps
- QAudioFormat mFormat;
-
- mutable QMutex m_buffersMutex;
- int m_buffersAvailable;
-
- qint64 m_position;
- qint64 m_duration;
-
- int m_durationQueries;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGSTREAMERPLAYERSESSION_H
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
diff --git a/src/plugins/gstreamer/common.pri b/src/plugins/gstreamer/common.pri
deleted file mode 100644
index d0c5c7bdd..000000000
--- a/src/plugins/gstreamer/common.pri
+++ /dev/null
@@ -1,15 +0,0 @@
-QT += core-private multimedia-private multimediagsttools-private network
-
-qtHaveModule(widgets) {
- QT += widgets multimediawidgets-private
- DEFINES += HAVE_WIDGETS
-}
-
-QMAKE_USE += gstreamer
-
-qtConfig(resourcepolicy): \
- QMAKE_USE += libresourceqt5
-
-qtConfig(gstreamer_app): \
- QMAKE_USE += gstreamer_app
-
diff --git a/src/plugins/gstreamer/gstreamer.json b/src/plugins/gstreamer/gstreamer.json
deleted file mode 100644
index 0656cce4f..000000000
--- a/src/plugins/gstreamer/gstreamer.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "Keys": ["gstreamer"],
- "Services": ["org.qt-project.qt.mediaplayer", "org.qt-project.qt.audiosource", "org.qt-project.qt.camera", "org.qt-project.qt.audiodecode"]
-}
diff --git a/src/plugins/gstreamer/gstreamer.pro b/src/plugins/gstreamer/gstreamer.pro
deleted file mode 100644
index 5fb8f83c6..000000000
--- a/src/plugins/gstreamer/gstreamer.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += \
- audiodecoder \
- camerabin \
- mediaplayer \
- mediacapture
-
-OTHER_FILES += \
- gstreamer.json
diff --git a/src/plugins/gstreamer/mediacapture/mediacapture.json b/src/plugins/gstreamer/mediacapture/mediacapture.json
deleted file mode 100644
index 68ca3f55b..000000000
--- a/src/plugins/gstreamer/mediacapture/mediacapture.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "Keys": ["gstreamermediacapture"],
- "Services": ["org.qt-project.qt.audiosource"]
-}
diff --git a/src/plugins/gstreamer/mediacapture/mediacapture.pro b/src/plugins/gstreamer/mediacapture/mediacapture.pro
deleted file mode 100644
index 17248a495..000000000
--- a/src/plugins/gstreamer/mediacapture/mediacapture.pro
+++ /dev/null
@@ -1,52 +0,0 @@
-TARGET = gstmediacapture
-
-include(../common.pri)
-
-INCLUDEPATH += $$PWD
-
-HEADERS += $$PWD/qgstreamercaptureservice.h \
- $$PWD/qgstreamercapturesession.h \
- $$PWD/qgstreameraudioencode.h \
- $$PWD/qgstreamervideoencode.h \
- $$PWD/qgstreamerrecordercontrol.h \
- $$PWD/qgstreamermediacontainercontrol.h \
- $$PWD/qgstreamercameracontrol.h \
- $$PWD/qgstreamercapturemetadatacontrol.h \
- $$PWD/qgstreamerimagecapturecontrol.h \
- $$PWD/qgstreamerimageencode.h \
- $$PWD/qgstreamercaptureserviceplugin.h
-
-SOURCES += $$PWD/qgstreamercaptureservice.cpp \
- $$PWD/qgstreamercapturesession.cpp \
- $$PWD/qgstreameraudioencode.cpp \
- $$PWD/qgstreamervideoencode.cpp \
- $$PWD/qgstreamerrecordercontrol.cpp \
- $$PWD/qgstreamermediacontainercontrol.cpp \
- $$PWD/qgstreamercameracontrol.cpp \
- $$PWD/qgstreamercapturemetadatacontrol.cpp \
- $$PWD/qgstreamerimagecapturecontrol.cpp \
- $$PWD/qgstreamerimageencode.cpp \
- $$PWD/qgstreamercaptureserviceplugin.cpp
-
-# Camera usage with gstreamer needs to have
-#CONFIG += use_gstreamer_camera
-
-use_gstreamer_camera:qtConfig(linux_v4l) {
- DEFINES += USE_GSTREAMER_CAMERA
-
- OTHER_FILES += \
- mediacapturecamera.json
-
- HEADERS += \
- $$PWD/qgstreamerv4l2input.h
- SOURCES += \
- $$PWD/qgstreamerv4l2input.cpp
-
-} else {
- OTHER_FILES += \
- mediacapture.json
-}
-
-PLUGIN_TYPE = mediaservice
-PLUGIN_CLASS_NAME = QGstreamerCaptureServicePlugin
-load(qt_plugin)
diff --git a/src/plugins/gstreamer/mediacapture/mediacapturecamera.json b/src/plugins/gstreamer/mediacapture/mediacapturecamera.json
deleted file mode 100644
index f5fba17e6..000000000
--- a/src/plugins/gstreamer/mediacapture/mediacapturecamera.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "Keys": ["gstreamermediacapture"],
- "Services": ["org.qt-project.qt.audiosource", "org.qt-project.qt.camera"]
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp b/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp
deleted file mode 100644
index 1a35c5cf6..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.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 "qgstreameraudioencode.h"
-#include "qgstreamercapturesession.h"
-#include "qgstreamermediacontainercontrol.h"
-#include <private/qgstutils_p.h>
-
-#include <QtCore/qdebug.h>
-
-#include <math.h>
-
-QGstreamerAudioEncode::QGstreamerAudioEncode(QObject *parent)
- :QAudioEncoderSettingsControl(parent)
- , m_codecs(QGstCodecsInfo::AudioEncoder)
-{
-}
-
-QGstreamerAudioEncode::~QGstreamerAudioEncode()
-{
-}
-
-QStringList QGstreamerAudioEncode::supportedAudioCodecs() const
-{
- return m_codecs.supportedCodecs();
-}
-
-QString QGstreamerAudioEncode::codecDescription(const QString &codecName) const
-{
- return m_codecs.codecDescription(codecName);
-}
-
-QStringList QGstreamerAudioEncode::supportedEncodingOptions(const QString &codec) const
-{
- return m_codecs.codecOptions(codec);
-}
-
-QVariant QGstreamerAudioEncode::encodingOption(
- const QString &codec, const QString &name) const
-{
- return m_options[codec].value(name);
-}
-
-void QGstreamerAudioEncode::setEncodingOption(
- const QString &codec, const QString &name, const QVariant &value)
-{
- m_options[codec][name] = value;
-}
-
-QList<int> QGstreamerAudioEncode::supportedSampleRates(const QAudioEncoderSettings &, bool *) const
-{
- //TODO check element caps to find actual values
-
- return QList<int>();
-}
-
-QAudioEncoderSettings QGstreamerAudioEncode::audioSettings() const
-{
- return m_audioSettings;
-}
-
-void QGstreamerAudioEncode::setAudioSettings(const QAudioEncoderSettings &settings)
-{
- m_audioSettings = settings;
-}
-
-
-GstElement *QGstreamerAudioEncode::createEncoder()
-{
- QString codec = m_audioSettings.codec();
- GstElement *encoderElement = gst_element_factory_make(m_codecs.codecElement(codec).constData(), NULL);
- if (!encoderElement)
- return 0;
-
- GstBin * encoderBin = GST_BIN(gst_bin_new("audio-encoder-bin"));
-
- GstElement *sinkCapsFilter = gst_element_factory_make("capsfilter", NULL);
- GstElement *srcCapsFilter = gst_element_factory_make("capsfilter", NULL);
-
- gst_bin_add_many(encoderBin, sinkCapsFilter, encoderElement, srcCapsFilter, NULL);
- gst_element_link_many(sinkCapsFilter, encoderElement, srcCapsFilter, NULL);
-
- // add ghostpads
- GstPad *pad = gst_element_get_static_pad(sinkCapsFilter, "sink");
- gst_element_add_pad(GST_ELEMENT(encoderBin), gst_ghost_pad_new("sink", pad));
- gst_object_unref(GST_OBJECT(pad));
-
- pad = gst_element_get_static_pad(srcCapsFilter, "src");
- gst_element_add_pad(GST_ELEMENT(encoderBin), gst_ghost_pad_new("src", pad));
- gst_object_unref(GST_OBJECT(pad));
-
- if (m_audioSettings.sampleRate() > 0 || m_audioSettings.channelCount() > 0) {
- GstCaps *caps = gst_caps_new_empty();
- GstStructure *structure = qt_gst_structure_new_empty(QT_GSTREAMER_RAW_AUDIO_MIME);
-
- if (m_audioSettings.sampleRate() > 0)
- gst_structure_set(structure, "rate", G_TYPE_INT, m_audioSettings.sampleRate(), NULL );
-
- if (m_audioSettings.channelCount() > 0)
- gst_structure_set(structure, "channels", G_TYPE_INT, m_audioSettings.channelCount(), NULL );
-
- gst_caps_append_structure(caps,structure);
-
- g_object_set(G_OBJECT(sinkCapsFilter), "caps", caps, NULL);
-
- gst_caps_unref(caps);
- }
-
- // Some encoders support several codecs. Setting a caps filter downstream with the desired
- // codec (which is actually a string representation of the caps) will make sure we use the
- // correct codec.
- GstCaps *caps = gst_caps_from_string(codec.toUtf8().constData());
- g_object_set(G_OBJECT(srcCapsFilter), "caps", caps, NULL);
- gst_caps_unref(caps);
-
- if (encoderElement) {
- if (m_audioSettings.encodingMode() == QMultimedia::ConstantQualityEncoding) {
- QMultimedia::EncodingQuality qualityValue = m_audioSettings.quality();
-
- if (codec == QLatin1String("audio/x-vorbis")) {
- double qualityTable[] = {
- 0.1, //VeryLow
- 0.3, //Low
- 0.5, //Normal
- 0.7, //High
- 1.0 //VeryHigh
- };
- g_object_set(G_OBJECT(encoderElement), "quality", qualityTable[qualityValue], NULL);
- } else if (codec == QLatin1String("audio/mpeg")) {
- g_object_set(G_OBJECT(encoderElement), "target", 0, NULL); //constant quality mode
- qreal quality[] = {
- 1, //VeryLow
- 3, //Low
- 5, //Normal
- 7, //High
- 9 //VeryHigh
- };
- g_object_set(G_OBJECT(encoderElement), "quality", quality[qualityValue], NULL);
- } else if (codec == QLatin1String("audio/x-speex")) {
- //0-10 range with default 8
- double qualityTable[] = {
- 2, //VeryLow
- 5, //Low
- 8, //Normal
- 9, //High
- 10 //VeryHigh
- };
- g_object_set(G_OBJECT(encoderElement), "quality", qualityTable[qualityValue], NULL);
- } else if (codec.startsWith("audio/AMR")) {
- int band[] = {
- 0, //VeryLow
- 2, //Low
- 4, //Normal
- 6, //High
- 7 //VeryHigh
- };
-
- g_object_set(G_OBJECT(encoderElement), "band-mode", band[qualityValue], NULL);
- }
- } else {
- int bitrate = m_audioSettings.bitRate();
- if (bitrate > 0) {
- if (codec == QLatin1String("audio/mpeg")) {
- g_object_set(G_OBJECT(encoderElement), "target", 1, NULL); //constant bitrate mode
- }
- g_object_set(G_OBJECT(encoderElement), "bitrate", bitrate, NULL);
- }
- }
-
- QMap<QString, QVariant> options = m_options.value(codec);
- for (auto it = options.cbegin(), end = options.cend(); it != end; ++it) {
- const QString &option = it.key();
- const QVariant &value = it.value();
-
- switch (value.type()) {
- case QVariant::Int:
- g_object_set(G_OBJECT(encoderElement), option.toLatin1(), value.toInt(), NULL);
- break;
- case QVariant::Bool:
- g_object_set(G_OBJECT(encoderElement), option.toLatin1(), value.toBool(), NULL);
- break;
- case QVariant::Double:
- g_object_set(G_OBJECT(encoderElement), option.toLatin1(), value.toDouble(), NULL);
- break;
- case QVariant::String:
- g_object_set(G_OBJECT(encoderElement), option.toLatin1(), value.toString().toUtf8().constData(), NULL);
- break;
- default:
- qWarning() << "unsupported option type:" << option << value;
- break;
- }
-
- }
- }
-
- return GST_ELEMENT(encoderBin);
-}
-
-
-QSet<QString> QGstreamerAudioEncode::supportedStreamTypes(const QString &codecName) const
-{
- return m_codecs.supportedStreamTypes(codecName);
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.h b/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.h
deleted file mode 100644
index 0cfbb4e91..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.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 QGSTREAMERAUDIOENCODE_H
-#define QGSTREAMERAUDIOENCODE_H
-
-#include <qaudioencodersettingscontrol.h>
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmap.h>
-#include <QtCore/qset.h>
-
-#include <gst/gst.h>
-
-#include <qaudioformat.h>
-#include <private/qgstcodecsinfo_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGstreamerCaptureSession;
-
-class QGstreamerAudioEncode : public QAudioEncoderSettingsControl
-{
- Q_OBJECT
-public:
- QGstreamerAudioEncode(QObject *parent);
- virtual ~QGstreamerAudioEncode();
-
- 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;
-
- GstElement *createEncoder();
-
- QSet<QString> supportedStreamTypes(const QString &codecName) const;
-
-private:
- QGstCodecsInfo m_codecs;
-
- QMap<QString, QMap<QString, QVariant> > m_options;
-
- QAudioEncoderSettings m_audioSettings;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.cpp
deleted file mode 100644
index 601a09e31..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.cpp
+++ /dev/null
@@ -1,197 +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 "qgstreamercameracontrol.h"
-#include "qgstreamerimageencode.h"
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qfile.h>
-
-
-QGstreamerCameraControl::QGstreamerCameraControl(QGstreamerCaptureSession *session)
- :QCameraControl(session),
- m_captureMode(QCamera::CaptureStillImage),
- m_session(session),
- m_state(QCamera::UnloadedState),
- m_status(QCamera::UnloadedStatus),
- m_reloadPending(false)
-
-{
- connect(m_session, SIGNAL(stateChanged(QGstreamerCaptureSession::State)),
- this, SLOT(updateStatus()));
-
- connect(m_session->imageEncodeControl(), SIGNAL(settingsChanged()),
- SLOT(reloadLater()));
- connect(m_session, SIGNAL(viewfinderChanged()),
- SLOT(reloadLater()));
- connect(m_session, SIGNAL(readyChanged(bool)),
- SLOT(reloadLater()));
-
- m_session->setCaptureMode(QGstreamerCaptureSession::Image);
-}
-
-QGstreamerCameraControl::~QGstreamerCameraControl()
-{
-}
-
-void QGstreamerCameraControl::setCaptureMode(QCamera::CaptureModes mode)
-{
- if (m_captureMode == mode || !isCaptureModeSupported(mode))
- return;
-
- m_captureMode = mode;
-
- switch (mode) {
- case QCamera::CaptureViewfinder:
- case QCamera::CaptureStillImage:
- m_session->setCaptureMode(QGstreamerCaptureSession::Image);
- break;
- case QCamera::CaptureVideo:
- m_session->setCaptureMode(QGstreamerCaptureSession::AudioAndVideo);
- break;
- case QCamera::CaptureVideo | QCamera::CaptureStillImage:
- m_session->setCaptureMode(QGstreamerCaptureSession::AudioAndVideoAndImage);
- break;
- }
-
- emit captureModeChanged(mode);
- updateStatus();
- reloadLater();
-}
-
-bool QGstreamerCameraControl::isCaptureModeSupported(QCamera::CaptureModes mode) const
-{
- //only CaptureStillImage and CaptureVideo bits are allowed
- return (mode & (QCamera::CaptureStillImage | QCamera::CaptureVideo)) == mode;
-}
-
-void QGstreamerCameraControl::setState(QCamera::State state)
-{
- if (m_state == state)
- return;
-
- m_state = state;
- switch (state) {
- case QCamera::UnloadedState:
- case QCamera::LoadedState:
- m_session->setState(QGstreamerCaptureSession::StoppedState);
- break;
- case QCamera::ActiveState:
- //postpone changing to Active if the session is nor ready yet
- if (m_session->isReady()) {
- m_session->setState(QGstreamerCaptureSession::PreviewState);
- } else {
-#ifdef CAMEABIN_DEBUG
- qDebug() << "Camera session is not ready yet, postpone activating";
-#endif
- }
- break;
- default:
- emit error(QCamera::NotSupportedFeatureError, tr("State not supported."));
- }
-
- updateStatus();
- emit stateChanged(m_state);
-}
-
-QCamera::State QGstreamerCameraControl::state() const
-{
- return m_state;
-}
-
-void QGstreamerCameraControl::updateStatus()
-{
- QCamera::Status oldStatus = m_status;
-
- switch (m_state) {
- case QCamera::UnloadedState:
- m_status = QCamera::UnloadedStatus;
- break;
- case QCamera::LoadedState:
- m_status = QCamera::LoadedStatus;
- break;
- case QCamera::ActiveState:
- if (m_session->state() == QGstreamerCaptureSession::StoppedState)
- m_status = QCamera::StartingStatus;
- else
- m_status = QCamera::ActiveStatus;
- break;
- }
-
- if (oldStatus != m_status) {
- //qDebug() << "Status changed:" << m_status;
- emit statusChanged(m_status);
- }
-}
-
-void QGstreamerCameraControl::reloadLater()
-{
- //qDebug() << "reload pipeline requested";
- if (!m_reloadPending && m_state == QCamera::ActiveState) {
- m_reloadPending = true;
- m_session->setState(QGstreamerCaptureSession::StoppedState);
- QMetaObject::invokeMethod(this, "reloadPipeline", Qt::QueuedConnection);
- }
-}
-
-void QGstreamerCameraControl::reloadPipeline()
-{
- //qDebug() << "reload pipeline";
- if (m_reloadPending) {
- m_reloadPending = false;
- if (m_state == QCamera::ActiveState && m_session->isReady()) {
- m_session->setState(QGstreamerCaptureSession::PreviewState);
- }
- }
-}
-
-bool QGstreamerCameraControl::canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const
-{
- Q_UNUSED(status);
-
- switch (changeType) {
- case QCameraControl::CaptureMode:
- case QCameraControl::ImageEncodingSettings:
- case QCameraControl::VideoEncodingSettings:
- case QCameraControl::Viewfinder:
- return true;
- default:
- return false;
- }
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.h b/src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.h
deleted file mode 100644
index 0e53f0890..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.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 QGSTREAMERCAMERACONTROL_H
-#define QGSTREAMERCAMERACONTROL_H
-
-#include <QHash>
-#include <qcameracontrol.h>
-#include "qgstreamercapturesession.h"
-
-QT_BEGIN_NAMESPACE
-
-class QGstreamerCameraControl : public QCameraControl
-{
- Q_OBJECT
-public:
- QGstreamerCameraControl( QGstreamerCaptureSession *session );
- virtual ~QGstreamerCameraControl();
-
- bool isValid() const { return true; }
-
- QCamera::State state() const override;
- void setState(QCamera::State state) override;
-
- QCamera::Status status() const override { return m_status; }
-
- QCamera::CaptureModes captureMode() const override { return m_captureMode; }
- void setCaptureMode(QCamera::CaptureModes mode) override;
-
- bool isCaptureModeSupported(QCamera::CaptureModes mode) const override;
-
- QCamera::LockTypes supportedLocks() const
- {
- return QCamera::NoLock;
- }
-
- bool canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const override;
-
-public slots:
- void reloadLater();
-
-private slots:
- void updateStatus();
- void reloadPipeline();
-
-
-private:
- QCamera::CaptureModes m_captureMode;
- QGstreamerCaptureSession *m_session;
- QCamera::State m_state;
- QCamera::Status m_status;
- bool m_reloadPending;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGSTREAMERCAMERACONTROL_H
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.cpp
deleted file mode 100644
index 6139c57bf..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.cpp
+++ /dev/null
@@ -1,158 +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 "qgstreamercapturemetadatacontrol.h"
-
-#include <QtMultimedia/qmediametadata.h>
-
-#include <gst/gst.h>
-#include <gst/gstversion.h>
-
-
-typedef QMap<QString, QByteArray> QGstreamerMetaDataKeyLookup;
-Q_GLOBAL_STATIC(QGstreamerMetaDataKeyLookup, metadataKeys)
-
-static const QGstreamerMetaDataKeyLookup *qt_gstreamerMetaDataKeys()
-{
- if (metadataKeys->isEmpty()) {
- metadataKeys->insert(QMediaMetaData::Title, GST_TAG_TITLE);
- metadataKeys->insert(QMediaMetaData::SubTitle, 0);
- //metadataKeys->insert(QMediaMetaData::Author, 0);
- metadataKeys->insert(QMediaMetaData::Comment, GST_TAG_COMMENT);
- metadataKeys->insert(QMediaMetaData::Description, GST_TAG_DESCRIPTION);
- //metadataKeys->insert(QMediaMetaData::Category, 0);
- metadataKeys->insert(QMediaMetaData::Genre, GST_TAG_GENRE);
- //metadataKeys->insert(QMediaMetaData::Year, 0);
- //metadataKeys->insert(QMediaMetaData::UserRating, 0);
-
- metadataKeys->insert(QMediaMetaData::Language, GST_TAG_LANGUAGE_CODE);
-
- metadataKeys->insert(QMediaMetaData::Publisher, GST_TAG_ORGANIZATION);
- metadataKeys->insert(QMediaMetaData::Copyright, GST_TAG_COPYRIGHT);
- //metadataKeys->insert(QMediaMetaData::ParentalRating, 0);
- //metadataKeys->insert(QMediaMetaData::RatingOrganisation, 0);
-
- // Media
- //metadataKeys->insert(QMediaMetaData::Size, 0);
- //metadataKeys->insert(QMediaMetaData::MediaType, 0);
- metadataKeys->insert(QMediaMetaData::Duration, GST_TAG_DURATION);
-
- // Audio
- metadataKeys->insert(QMediaMetaData::AudioBitRate, GST_TAG_BITRATE);
- metadataKeys->insert(QMediaMetaData::AudioCodec, GST_TAG_AUDIO_CODEC);
- //metadataKeys->insert(QMediaMetaData::ChannelCount, 0);
- //metadataKeys->insert(QMediaMetaData::SampleRate, 0);
-
- // Music
- metadataKeys->insert(QMediaMetaData::AlbumTitle, GST_TAG_ALBUM);
- metadataKeys->insert(QMediaMetaData::AlbumArtist, GST_TAG_ARTIST);
- metadataKeys->insert(QMediaMetaData::ContributingArtist, GST_TAG_PERFORMER);
- metadataKeys->insert(QMediaMetaData::Composer, GST_TAG_COMPOSER);
- //metadataKeys->insert(QMediaMetaData::Conductor, 0);
- //metadataKeys->insert(QMediaMetaData::Lyrics, 0);
- //metadataKeys->insert(QMediaMetaData::Mood, 0);
- metadataKeys->insert(QMediaMetaData::TrackNumber, GST_TAG_TRACK_NUMBER);
-
- //metadataKeys->insert(QMediaMetaData::CoverArtUrlSmall, 0);
- //metadataKeys->insert(QMediaMetaData::CoverArtUrlLarge, 0);
-
- // Image/Video
- //metadataKeys->insert(QMediaMetaData::Resolution, 0);
- //metadataKeys->insert(QMediaMetaData::PixelAspectRatio, 0);
-
- // Video
- //metadataKeys->insert(QMediaMetaData::VideoFrameRate, 0);
- //metadataKeys->insert(QMediaMetaData::VideoBitRate, 0);
- metadataKeys->insert(QMediaMetaData::VideoCodec, GST_TAG_VIDEO_CODEC);
-
- //metadataKeys->insert(QMediaMetaData::PosterUrl, 0);
-
- // Movie
- //metadataKeys->insert(QMediaMetaData::ChapterNumber, 0);
- //metadataKeys->insert(QMediaMetaData::Director, 0);
- metadataKeys->insert(QMediaMetaData::LeadPerformer, GST_TAG_PERFORMER);
- //metadataKeys->insert(QMediaMetaData::Writer, 0);
-
- // Photos
- //metadataKeys->insert(QMediaMetaData::CameraManufacturer, 0);
- //metadataKeys->insert(QMediaMetaData::CameraModel, 0);
- //metadataKeys->insert(QMediaMetaData::Event, 0);
- //metadataKeys->insert(QMediaMetaData::Subject, 0 }
- }
-
- return metadataKeys;
-}
-
-QGstreamerCaptureMetaDataControl::QGstreamerCaptureMetaDataControl(QObject *parent)
- :QMetaDataWriterControl(parent)
-{
-}
-
-QVariant QGstreamerCaptureMetaDataControl::metaData(const QString &key) const
-{
- QGstreamerMetaDataKeyLookup::const_iterator it = qt_gstreamerMetaDataKeys()->find(key);
- if (it != qt_gstreamerMetaDataKeys()->constEnd())
- return m_values.value(it.value());
-
- return QVariant();
-}
-
-void QGstreamerCaptureMetaDataControl::setMetaData(const QString &key, const QVariant &value)
-{
- QGstreamerMetaDataKeyLookup::const_iterator it = qt_gstreamerMetaDataKeys()->find(key);
- if (it != qt_gstreamerMetaDataKeys()->constEnd()) {
- m_values.insert(it.value(), value);
-
- emit QMetaDataWriterControl::metaDataChanged();
- emit QMetaDataWriterControl::metaDataChanged(key, value);
- emit metaDataChanged(m_values);
- }
-}
-
-QStringList QGstreamerCaptureMetaDataControl::availableMetaData() const
-{
- QStringList res;
- for (auto it = m_values.keyBegin(), end = m_values.keyEnd(); it != end; ++it) {
- QString tag = qt_gstreamerMetaDataKeys()->key(*it);
- if (!tag.isEmpty())
- res.append(tag);
- }
-
- return res;
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.h b/src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.h
deleted file mode 100644
index 6839bbe68..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.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 QGSTREAMERCAPTUREMETADATACONTROL_H
-#define QGSTREAMERCAPTUREMETADATACONTROL_H
-
-#include <qmetadatawritercontrol.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGstreamerCaptureMetaDataControl : public QMetaDataWriterControl
-{
- Q_OBJECT
-public:
- QGstreamerCaptureMetaDataControl(QObject *parent);
- ~QGstreamerCaptureMetaDataControl() {}
-
-
- 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 // QGSTREAMERCAPTUREMETADATACONTROL_H
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.cpp
deleted file mode 100644
index dc99cbe0e..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.cpp
+++ /dev/null
@@ -1,227 +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 "qgstreamercaptureservice.h"
-#include "qgstreamercapturesession.h"
-#include "qgstreamerrecordercontrol.h"
-#include "qgstreamermediacontainercontrol.h"
-#include "qgstreameraudioencode.h"
-#include "qgstreamervideoencode.h"
-#include "qgstreamerimageencode.h"
-#include "qgstreamercameracontrol.h"
-#include <private/qgstreamerbushelper_p.h>
-#include "qgstreamercapturemetadatacontrol.h"
-
-#if defined(USE_GSTREAMER_CAMERA)
-#include "qgstreamerv4l2input.h"
-#endif
-
-#include "qgstreamerimagecapturecontrol.h"
-#include <private/qgstreameraudioinputselector_p.h>
-#include <private/qgstreamervideoinputdevicecontrol_p.h>
-#include <private/qgstreameraudioprobecontrol_p.h>
-
-#include <private/qgstreamervideorenderer_p.h>
-#include <private/qgstreamervideowindow_p.h>
-
-#if defined(HAVE_WIDGETS)
-#include <private/qgstreamervideowidget_p.h>
-#endif
-
-#include <qmediaserviceproviderplugin.h>
-
-QT_BEGIN_NAMESPACE
-
-QGstreamerCaptureService::QGstreamerCaptureService(const QString &service, QObject *parent)
- : QMediaService(parent)
- , m_captureSession(0)
- , m_cameraControl(0)
-#if defined(USE_GSTREAMER_CAMERA)
- , m_videoInput(0)
-#endif
- , 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_audioProbeControl(0)
-{
- if (service == Q_MEDIASERVICE_AUDIOSOURCE) {
- m_captureSession = new QGstreamerCaptureSession(QGstreamerCaptureSession::Audio, this);
- }
-
-#if defined(USE_GSTREAMER_CAMERA)
- if (service == Q_MEDIASERVICE_CAMERA) {
- m_captureSession = new QGstreamerCaptureSession(QGstreamerCaptureSession::AudioAndVideo, this);
- m_cameraControl = new QGstreamerCameraControl(m_captureSession);
- m_videoInput = new QGstreamerV4L2Input(this);
- m_captureSession->setVideoInput(m_videoInput);
- m_videoInputDevice = new QGstreamerVideoInputDeviceControl(this);
-
- connect(m_videoInputDevice, SIGNAL(selectedDeviceChanged(QString)),
- m_videoInput, SLOT(setDevice(QString)));
-
- if (m_videoInputDevice->deviceCount())
- m_videoInput->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_imageCaptureControl = new QGstreamerImageCaptureControl(m_captureSession);
- }
-#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 QGstreamerCaptureMetaDataControl(this);
- connect(m_metaDataControl, SIGNAL(metaDataChanged(QMap<QByteArray,QVariant>)),
- m_captureSession, SLOT(setMetaData(QMap<QByteArray,QVariant>)));
-}
-
-QGstreamerCaptureService::~QGstreamerCaptureService()
-{
-}
-
-QMediaControl *QGstreamerCaptureService::requestControl(const char *name)
-{
- if (!m_captureSession)
- return 0;
-
- 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_cameraControl;
-
- if (qstrcmp(name,QMetaDataWriterControl_iid) == 0)
- return m_metaDataControl;
-
- if (qstrcmp(name, QCameraImageCaptureControl_iid) == 0)
- return m_imageCaptureControl;
-
- if (qstrcmp(name,QMediaAudioProbeControl_iid) == 0) {
- if (!m_audioProbeControl) {
- m_audioProbeControl = new QGstreamerAudioProbeControl(this);
- m_captureSession->addProbe(m_audioProbeControl);
- }
- m_audioProbeControl->ref.ref();
- return m_audioProbeControl;
- }
-
- 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->setVideoPreview(m_videoOutput);
- return m_videoOutput;
- }
- }
-
- return 0;
-}
-
-void QGstreamerCaptureService::releaseControl(QMediaControl *control)
-{
- if (!control) {
- return;
- } else if (control == m_videoOutput) {
- m_videoOutput = 0;
- m_captureSession->setVideoPreview(0);
- } else if (control == m_audioProbeControl && !m_audioProbeControl->ref.deref()) {
- m_captureSession->removeProbe(m_audioProbeControl);
- delete m_audioProbeControl;
- m_audioProbeControl = 0;
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h b/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h
deleted file mode 100644
index aba98d495..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h
+++ /dev/null
@@ -1,103 +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 QGSTREAMERCAPTURESERVICE_H
-#define QGSTREAMERCAPTURESERVICE_H
-
-#include <qmediaservice.h>
-#include <qmediacontrol.h>
-
-#include <gst/gst.h>
-
-QT_BEGIN_NAMESPACE
-class QAudioInputSelectorControl;
-class QVideoDeviceSelectorControl;
-
-class QGstreamerAudioProbeControl;
-class QGstreamerCaptureSession;
-class QGstreamerCameraControl;
-class QGstreamerMessage;
-class QGstreamerBusHelper;
-class QGstreamerVideoRenderer;
-class QGstreamerVideoWindow;
-class QGstreamerVideoWidgetControl;
-class QGstreamerElementFactory;
-class QGstreamerCaptureMetaDataControl;
-class QGstreamerImageCaptureControl;
-class QGstreamerV4L2Input;
-
-class QGstreamerCaptureService : public QMediaService
-{
- Q_OBJECT
-
-public:
- QGstreamerCaptureService(const QString &service, QObject *parent = 0);
- virtual ~QGstreamerCaptureService();
-
- QMediaControl *requestControl(const char *name) override;
- void releaseControl(QMediaControl *) override;
-
-private:
- void setAudioPreview(GstElement *);
-
- QGstreamerCaptureSession *m_captureSession;
- QGstreamerCameraControl *m_cameraControl;
-#if defined(USE_GSTREAMER_CAMERA)
- QGstreamerV4L2Input *m_videoInput;
-#endif
- QGstreamerCaptureMetaDataControl *m_metaDataControl;
-
- QAudioInputSelectorControl *m_audioInputSelector;
- QVideoDeviceSelectorControl *m_videoInputDevice;
-
- QMediaControl *m_videoOutput;
-
- QGstreamerVideoRenderer *m_videoRenderer;
- QGstreamerVideoWindow *m_videoWindow;
-#if defined(HAVE_WIDGETS)
- QGstreamerVideoWidgetControl *m_videoWidgetControl;
-#endif
- QGstreamerImageCaptureControl *m_imageCaptureControl;
-
- QGstreamerAudioProbeControl *m_audioProbeControl;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGSTREAMERCAPTURESERVICE_H
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.cpp
deleted file mode 100644
index 2a2dec60a..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.cpp
+++ /dev/null
@@ -1,142 +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 "qgstreamercaptureserviceplugin.h"
-
-//#define QT_SUPPORTEDMIMETYPES_DEBUG
-
-#include "qgstreamercaptureservice.h"
-#include <private/qgstutils_p.h>
-
-QMediaService* QGstreamerCaptureServicePlugin::create(const QString &key)
-{
- QGstUtils::initializeGst();
-
- if (key == QLatin1String(Q_MEDIASERVICE_AUDIOSOURCE))
- return new QGstreamerCaptureService(key);
-
-#if defined(USE_GSTREAMER_CAMERA)
- if (key == QLatin1String(Q_MEDIASERVICE_CAMERA))
- return new QGstreamerCaptureService(key);
-#endif
-
- qWarning() << "Gstreamer capture service plugin: unsupported key:" << key;
- return 0;
-}
-
-void QGstreamerCaptureServicePlugin::release(QMediaService *service)
-{
- delete service;
-}
-
-#if defined(USE_GSTREAMER_CAMERA)
-QMediaServiceProviderHint::Features QGstreamerCaptureServicePlugin::supportedFeatures(
- const QByteArray &service) const
-{
- if (service == Q_MEDIASERVICE_CAMERA)
- return QMediaServiceProviderHint::VideoSurface;
-
- return QMediaServiceProviderHint::Features();
-}
-
-QByteArray QGstreamerCaptureServicePlugin::defaultDevice(const QByteArray &service) const
-{
- return service == Q_MEDIASERVICE_CAMERA
- ? QGstUtils::enumerateCameras().value(0).name.toUtf8()
- : QByteArray();
-}
-
-QList<QByteArray> QGstreamerCaptureServicePlugin::devices(const QByteArray &service) const
-{
- return service == Q_MEDIASERVICE_CAMERA ? QGstUtils::cameraDevices() : QList<QByteArray>();
-}
-
-QString QGstreamerCaptureServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device)
-{
- return service == Q_MEDIASERVICE_CAMERA ? QGstUtils::cameraDescription(device) : QString();
-}
-
-QVariant QGstreamerCaptureServicePlugin::deviceProperty(const QByteArray &service, const QByteArray &device, const QByteArray &property)
-{
- Q_UNUSED(service);
- Q_UNUSED(device);
- Q_UNUSED(property);
- return QVariant();
-}
-
-#endif
-
-QMultimedia::SupportEstimate QGstreamerCaptureServicePlugin::hasSupport(const QString &mimeType,
- const QStringList& codecs) const
-{
- if (m_supportedMimeTypeSet.isEmpty())
- updateSupportedMimeTypes();
-
- return QGstUtils::hasSupport(mimeType, codecs, m_supportedMimeTypeSet);
-}
-
-
-static bool isEncoderOrMuxer(GstElementFactory *factory)
-{
-#if GST_CHECK_VERSION(0, 10, 31)
- return gst_element_factory_list_is_type(factory, GST_ELEMENT_FACTORY_TYPE_MUXER)
- || gst_element_factory_list_is_type(factory, GST_ELEMENT_FACTORY_TYPE_ENCODER);
-#else
- return (factory
- && (qstrcmp(factory->details.klass, "Codec/Encoder/Audio") == 0
- || qstrcmp(factory->details.klass, "Codec/Encoder/Video") == 0
- || qstrcmp(factory->details.klass, "Codec/Muxer") == 0 ));
-#endif
-}
-
-void QGstreamerCaptureServicePlugin::updateSupportedMimeTypes() const
-{
- m_supportedMimeTypeSet = QGstUtils::supportedMimeTypes(isEncoderOrMuxer);
-}
-
-QStringList QGstreamerCaptureServicePlugin::supportedMimeTypes() const
-{
- return QStringList();
-}
-
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.h b/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.h
deleted file mode 100644
index d8b7e9768..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.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 QGSTREAMERCAPTURESERVICEPLUGIN_H
-#define QGSTREAMERCAPTURESERVICEPLUGIN_H
-
-#include <qmediaserviceproviderplugin.h>
-#include <QtCore/qset.h>
-#include <QtCore/QObject>
-
-QT_BEGIN_NAMESPACE
-
-class QGstreamerCaptureServicePlugin
- : public QMediaServiceProviderPlugin
-#if defined(USE_GSTREAMER_CAMERA)
- , public QMediaServiceSupportedDevicesInterface
- , public QMediaServiceDefaultDeviceInterface
- , public QMediaServiceFeaturesInterface
-#endif
- , public QMediaServiceSupportedFormatsInterface
-{
- Q_OBJECT
-#if defined(USE_GSTREAMER_CAMERA)
- Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
- Q_INTERFACES(QMediaServiceDefaultDeviceInterface)
- Q_INTERFACES(QMediaServiceFeaturesInterface)
-#endif
- Q_INTERFACES(QMediaServiceSupportedFormatsInterface)
-#if defined(USE_GSTREAMER_CAMERA)
- Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "mediacapturecamera.json")
-#else
- Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "mediacapture.json")
-#endif
-public:
- QMediaService* create(const QString &key) override;
- void release(QMediaService *service) override;
-
-#if defined(USE_GSTREAMER_CAMERA)
- 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);
-#endif
-
- QMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList &codecs) const override;
- QStringList supportedMimeTypes() const override;
-
-private:
- void updateSupportedMimeTypes() const;
-
- mutable QSet<QString> m_supportedMimeTypeSet; //for fast access
-};
-
-QT_END_NAMESPACE
-
-#endif // QGSTREAMERCAPTURESERVICEPLUGIN_H
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp
deleted file mode 100644
index 4363f6d3b..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp
+++ /dev/null
@@ -1,1032 +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 "qgstreamercapturesession.h"
-#include "qgstreamerrecordercontrol.h"
-#include "qgstreamermediacontainercontrol.h"
-#include "qgstreameraudioencode.h"
-#include "qgstreamervideoencode.h"
-#include "qgstreamerimageencode.h"
-#include <qmediarecorder.h>
-#include <private/qgstreamervideorendererinterface_p.h>
-#include <private/qgstreameraudioprobecontrol_p.h>
-#include <private/qgstreamerbushelper_p.h>
-#include <private/qgstutils_p.h>
-
-#include <gst/gsttagsetter.h>
-#include <gst/gstversion.h>
-#include <gst/video/video.h>
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qset.h>
-#include <QCoreApplication>
-#include <QtCore/qmetaobject.h>
-#include <QtCore/qfile.h>
-#include <QtGui/qimage.h>
-
-QT_BEGIN_NAMESPACE
-
-QGstreamerCaptureSession::QGstreamerCaptureSession(QGstreamerCaptureSession::CaptureMode captureMode, QObject *parent)
- :QObject(parent),
- m_state(StoppedState),
- m_pendingState(StoppedState),
- m_waitingForEos(false),
- m_pipelineMode(EmptyPipeline),
- m_captureMode(captureMode),
- m_audioProbe(0),
- m_audioInputFactory(0),
- m_audioPreviewFactory(0),
- m_videoInputFactory(0),
- m_viewfinder(0),
- m_viewfinderInterface(0),
- m_audioSrc(0),
- m_audioTee(0),
- m_audioPreviewQueue(0),
- m_audioPreview(0),
- m_audioVolume(0),
- m_muted(false),
- m_volume(1.0),
- m_videoSrc(0),
- m_videoTee(0),
- m_videoPreviewQueue(0),
- m_videoPreview(0),
- m_imageCaptureBin(0),
- m_encodeBin(0),
- m_passImage(false),
- m_passPrerollImage(false)
-{
- m_pipeline = gst_pipeline_new("media-capture-pipeline");
- qt_gst_object_ref_sink(m_pipeline);
-
- m_bus = gst_element_get_bus(m_pipeline);
- m_busHelper = new QGstreamerBusHelper(m_bus, this);
- m_busHelper->installMessageFilter(this);
-
- m_audioEncodeControl = new QGstreamerAudioEncode(this);
- m_videoEncodeControl = new QGstreamerVideoEncode(this);
- m_imageEncodeControl = new QGstreamerImageEncode(this);
- m_recorderControl = new QGstreamerRecorderControl(this);
- connect(m_recorderControl, &QGstreamerRecorderControl::error, [](int e, const QString &str) {
- qWarning() << QMediaRecorder::Error(e) << ":" << str.toLatin1().constData();
- });
- m_mediaContainerControl = new QGstreamerMediaContainerControl(this);
-}
-
-QGstreamerCaptureSession::~QGstreamerCaptureSession()
-{
- setState(StoppedState);
- gst_element_set_state(m_pipeline, GST_STATE_NULL);
- gst_object_unref(GST_OBJECT(m_bus));
- gst_object_unref(GST_OBJECT(m_pipeline));
-}
-
-void QGstreamerCaptureSession::setCaptureMode(CaptureMode mode)
-{
- m_captureMode = mode;
-}
-
-GstElement *QGstreamerCaptureSession::buildEncodeBin()
-{
- GstElement *encodeBin = gst_bin_new("encode-bin");
-
- GstElement *muxer = gst_element_factory_make( m_mediaContainerControl->formatElementName().constData(), "muxer");
- if (!muxer) {
- qWarning() << "Could not create a media muxer element:" << m_mediaContainerControl->formatElementName();
- gst_object_unref(encodeBin);
- return 0;
- }
-
- // Output location was rejected in setOutputlocation() if not a local file
- QUrl actualSink = QUrl::fromLocalFile(QDir::currentPath()).resolved(m_sink);
- GstElement *fileSink = gst_element_factory_make("filesink", "filesink");
- g_object_set(G_OBJECT(fileSink), "location", QFile::encodeName(actualSink.toLocalFile()).constData(), NULL);
- gst_bin_add_many(GST_BIN(encodeBin), muxer, fileSink, NULL);
-
- if (!gst_element_link(muxer, fileSink)) {
- gst_object_unref(encodeBin);
- return 0;
- }
-
- if (m_captureMode & Audio) {
- GstElement *audioConvert = gst_element_factory_make("audioconvert", "audioconvert");
- GstElement *audioQueue = gst_element_factory_make("queue", "audio-encode-queue");
- m_audioVolume = gst_element_factory_make("volume", "volume");
- gst_bin_add_many(GST_BIN(encodeBin), audioConvert, audioQueue, m_audioVolume, NULL);
-
- GstElement *audioEncoder = m_audioEncodeControl->createEncoder();
- if (!audioEncoder) {
- gst_object_unref(encodeBin);
- qWarning() << "Could not create an audio encoder element:" << m_audioEncodeControl->audioSettings().codec();
- return 0;
- }
-
- gst_bin_add(GST_BIN(encodeBin), audioEncoder);
-
- if (!gst_element_link_many(audioConvert, audioQueue, m_audioVolume, audioEncoder, muxer, NULL)) {
- m_audioVolume = 0;
- gst_object_unref(encodeBin);
- return 0;
- }
-
- g_object_set(G_OBJECT(m_audioVolume), "mute", m_muted, NULL);
- g_object_set(G_OBJECT(m_audioVolume), "volume", m_volume, NULL);
-
- // add ghostpads
- GstPad *pad = gst_element_get_static_pad(audioConvert, "sink");
- gst_element_add_pad(GST_ELEMENT(encodeBin), gst_ghost_pad_new("audiosink", pad));
- gst_object_unref(GST_OBJECT(pad));
- }
-
- if (m_captureMode & Video) {
- GstElement *videoQueue = gst_element_factory_make("queue", "video-encode-queue");
- GstElement *colorspace = gst_element_factory_make(QT_GSTREAMER_COLORCONVERSION_ELEMENT_NAME, "videoconvert-encoder");
- GstElement *videoscale = gst_element_factory_make("videoscale","videoscale-encoder");
- gst_bin_add_many(GST_BIN(encodeBin), videoQueue, colorspace, videoscale, NULL);
-
- GstElement *videoEncoder = m_videoEncodeControl->createEncoder();
- if (!videoEncoder) {
- gst_object_unref(encodeBin);
- qWarning() << "Could not create a video encoder element:" << m_videoEncodeControl->videoSettings().codec();
- return 0;
- }
-
- gst_bin_add(GST_BIN(encodeBin), videoEncoder);
-
- if (!gst_element_link_many(videoQueue, colorspace, videoscale, videoEncoder, muxer, NULL)) {
- gst_object_unref(encodeBin);
- return 0;
- }
-
- // add ghostpads
- GstPad *pad = gst_element_get_static_pad(videoQueue, "sink");
- gst_element_add_pad(GST_ELEMENT(encodeBin), gst_ghost_pad_new("videosink", pad));
- gst_object_unref(GST_OBJECT(pad));
- }
-
- return encodeBin;
-}
-
-GstElement *QGstreamerCaptureSession::buildAudioSrc()
-{
- GstElement *audioSrc = 0;
- if (m_audioInputFactory)
- audioSrc = m_audioInputFactory->buildElement();
- else {
- QString elementName = "alsasrc";
- QString device;
-
- if (m_captureDevice.startsWith("alsa:")) {
- device = m_captureDevice.mid(QString("alsa:").length());
- } else if (m_captureDevice.startsWith("oss:")) {
- elementName = "osssrc";
- device = m_captureDevice.mid(QString("oss:").length());
- } else if (m_captureDevice.startsWith("pulseaudio:")) {
- elementName = "pulsesrc";
- } else {
- elementName = "autoaudiosrc";
- }
-
- audioSrc = gst_element_factory_make(elementName.toLatin1().constData(), "audio_src");
- if (audioSrc && !device.isEmpty())
- g_object_set(G_OBJECT(audioSrc), "device", device.toLocal8Bit().constData(), NULL);
- }
-
- if (!audioSrc) {
- emit error(int(QMediaRecorder::ResourceError), tr("Could not create an audio source element"));
- audioSrc = gst_element_factory_make("fakesrc", NULL);
- }
-
- return audioSrc;
-}
-
-GstElement *QGstreamerCaptureSession::buildAudioPreview()
-{
- GstElement *previewElement = 0;
-
- if (m_audioPreviewFactory) {
- previewElement = m_audioPreviewFactory->buildElement();
- } else {
-
-
-#if 1
- previewElement = gst_element_factory_make("fakesink", "audio-preview");
-#else
- GstElement *bin = gst_bin_new("audio-preview-bin");
- GstElement *visual = gst_element_factory_make("libvisual_lv_scope", "audio-preview");
- GstElement *sink = gst_element_factory_make("ximagesink", NULL);
- gst_bin_add_many(GST_BIN(bin), visual, sink, NULL);
- gst_element_link_many(visual,sink, NULL);
-
-
- // add ghostpads
- GstPad *pad = gst_element_get_static_pad(visual, "sink");
- Q_ASSERT(pad);
- gst_element_add_pad(GST_ELEMENT(bin), gst_ghost_pad_new("audiosink", pad));
- gst_object_unref(GST_OBJECT(pad));
-
- previewElement = bin;
-#endif
- }
-
- return previewElement;
-}
-
-GstElement *QGstreamerCaptureSession::buildVideoSrc()
-{
- GstElement *videoSrc = 0;
- if (m_videoInputFactory) {
- videoSrc = m_videoInputFactory->buildElement();
- } else {
- videoSrc = gst_element_factory_make("videotestsrc", "video_test_src");
- //videoSrc = gst_element_factory_make("v4l2src", "video_test_src");
- }
-
- return videoSrc;
-}
-
-GstElement *QGstreamerCaptureSession::buildVideoPreview()
-{
- GstElement *previewElement = 0;
-
- if (m_viewfinderInterface) {
- GstElement *bin = gst_bin_new("video-preview-bin");
- GstElement *colorspace = gst_element_factory_make(QT_GSTREAMER_COLORCONVERSION_ELEMENT_NAME, "videoconvert-preview");
- GstElement *capsFilter = gst_element_factory_make("capsfilter", "capsfilter-video-preview");
- GstElement *preview = m_viewfinderInterface->videoSink();
-
- gst_bin_add_many(GST_BIN(bin), colorspace, capsFilter, preview, NULL);
- gst_element_link(colorspace,capsFilter);
- gst_element_link(capsFilter,preview);
-
- QSize resolution;
- qreal frameRate = 0;
-
- if (m_captureMode & Video) {
- QVideoEncoderSettings videoSettings = m_videoEncodeControl->videoSettings();
- resolution = videoSettings.resolution();
- frameRate = videoSettings.frameRate();
- } else if (m_captureMode & Image) {
- resolution = m_imageEncodeControl->imageSettings().resolution();
- }
-
- GstCaps *caps = QGstUtils::videoFilterCaps();
-
- if (!resolution.isEmpty()) {
- gst_caps_set_simple(caps, "width", G_TYPE_INT, resolution.width(), NULL);
- gst_caps_set_simple(caps, "height", G_TYPE_INT, resolution.height(), NULL);
- }
- if (frameRate > 0.001) {
- QPair<int,int> rate = m_videoEncodeControl->rateAsRational();
-
- //qDebug() << "frame rate:" << num << denum;
-
- gst_caps_set_simple(caps, "framerate", GST_TYPE_FRACTION, rate.first, rate.second, NULL);
- }
-
- //qDebug() << "set video preview caps filter:" << gst_caps_to_string(caps);
-
- g_object_set(G_OBJECT(capsFilter), "caps", caps, NULL);
-
- gst_caps_unref(caps);
-
- // add ghostpads
- GstPad *pad = gst_element_get_static_pad(colorspace, "sink");
- Q_ASSERT(pad);
- gst_element_add_pad(GST_ELEMENT(bin), gst_ghost_pad_new("videosink", pad));
- gst_object_unref(GST_OBJECT(pad));
-
- previewElement = bin;
- } else {
-#if 1
- previewElement = gst_element_factory_make("fakesink", "video-preview");
-#else
- GstElement *bin = gst_bin_new("video-preview-bin");
- GstElement *colorspace = gst_element_factory_make(QT_GSTREAMER_COLORCONVERSION_ELEMENT_NAME, "videoconvert-preview");
- GstElement *preview = gst_element_factory_make("ximagesink", "video-preview");
- gst_bin_add_many(GST_BIN(bin), colorspace, preview, NULL);
- gst_element_link(colorspace,preview);
-
- // add ghostpads
- GstPad *pad = gst_element_get_static_pad(colorspace, "sink");
- Q_ASSERT(pad);
- gst_element_add_pad(GST_ELEMENT(bin), gst_ghost_pad_new("videosink", pad));
- gst_object_unref(GST_OBJECT(pad));
-
- previewElement = bin;
-#endif
- }
-
- return previewElement;
-}
-
-void QGstreamerCaptureSession::probeCaps(GstCaps *caps)
-{
-#if GST_CHECK_VERSION(1,0,0)
- gst_video_info_from_caps(&m_previewInfo, caps);
-#else
- Q_UNUSED(caps);
-#endif
-}
-
-bool QGstreamerCaptureSession::probeBuffer(GstBuffer *buffer)
-{
- if (m_passPrerollImage) {
- m_passImage = false;
- m_passPrerollImage = false;
-
- return true;
- } else if (!m_passImage) {
- return false;
- }
-
- m_passImage = false;
-
-#if GST_CHECK_VERSION(1,0,0)
- QImage img = QGstUtils::bufferToImage(buffer, m_previewInfo);
-#else
- QImage img = QGstUtils::bufferToImage(buffer);
-#endif
-
- if (img.isNull())
- return true;
-
- static QMetaMethod exposedSignal = QMetaMethod::fromSignal(&QGstreamerCaptureSession::imageExposed);
- exposedSignal.invoke(this,
- Qt::QueuedConnection,
- Q_ARG(int,m_imageRequestId));
-
- static QMetaMethod capturedSignal = QMetaMethod::fromSignal(&QGstreamerCaptureSession::imageCaptured);
- capturedSignal.invoke(this,
- Qt::QueuedConnection,
- Q_ARG(int,m_imageRequestId),
- Q_ARG(QImage,img));
-
- return true;
-}
-
-static gboolean saveImageFilter(GstElement *element,
- GstBuffer *buffer,
- GstPad *pad,
- void *appdata)
-{
- Q_UNUSED(element);
- Q_UNUSED(pad);
- QGstreamerCaptureSession *session = (QGstreamerCaptureSession *)appdata;
-
- QString fileName = session->m_imageFileName;
-
- if (!fileName.isEmpty()) {
- QFile f(fileName);
- if (f.open(QFile::WriteOnly)) {
-#if GST_CHECK_VERSION(1,0,0)
- GstMapInfo info;
- if (gst_buffer_map(buffer, &info, GST_MAP_READ)) {
- f.write(reinterpret_cast<const char *>(info.data), info.size);
- gst_buffer_unmap(buffer, &info);
- }
-#else
- f.write(reinterpret_cast<const char *>(buffer->data), buffer->size);
-#endif
- f.close();
-
- static QMetaMethod savedSignal = QMetaMethod::fromSignal(&QGstreamerCaptureSession::imageSaved);
- savedSignal.invoke(session,
- Qt::QueuedConnection,
- Q_ARG(int,session->m_imageRequestId),
- Q_ARG(QString,fileName));
- }
- }
-
- return TRUE;
-}
-
-GstElement *QGstreamerCaptureSession::buildImageCapture()
-{
- GstElement *bin = gst_bin_new("image-capture-bin");
- GstElement *queue = gst_element_factory_make("queue", "queue-image-capture");
- GstElement *colorspace = gst_element_factory_make(QT_GSTREAMER_COLORCONVERSION_ELEMENT_NAME, "videoconvert-image-capture");
- GstElement *encoder = gst_element_factory_make("jpegenc", "image-encoder");
- GstElement *sink = gst_element_factory_make("fakesink","sink-image-capture");
-
- GstPad *pad = gst_element_get_static_pad(queue, "src");
- Q_ASSERT(pad);
-
- addProbeToPad(pad, false);
-
- gst_object_unref(GST_OBJECT(pad));
-
- g_object_set(G_OBJECT(sink), "signal-handoffs", TRUE, NULL);
- g_signal_connect(G_OBJECT(sink), "handoff", G_CALLBACK(saveImageFilter), this);
-
- gst_bin_add_many(GST_BIN(bin), queue, colorspace, encoder, sink, NULL);
- gst_element_link_many(queue, colorspace, encoder, sink, NULL);
-
- // add ghostpads
- pad = gst_element_get_static_pad(queue, "sink");
- Q_ASSERT(pad);
- gst_element_add_pad(GST_ELEMENT(bin), gst_ghost_pad_new("imagesink", pad));
- gst_object_unref(GST_OBJECT(pad));
-
- m_passImage = false;
- m_passPrerollImage = true;
- m_imageFileName = QString();
-
- return bin;
-}
-
-void QGstreamerCaptureSession::captureImage(int requestId, const QString &fileName)
-{
- m_imageRequestId = requestId;
- m_imageFileName = fileName;
- m_passImage = true;
-}
-
-
-#define REMOVE_ELEMENT(element) { if (element) {gst_bin_remove(GST_BIN(m_pipeline), element); element = 0;} }
-#define UNREF_ELEMENT(element) { if (element) { gst_object_unref(GST_OBJECT(element)); element = 0; } }
-
-bool QGstreamerCaptureSession::rebuildGraph(QGstreamerCaptureSession::PipelineMode newMode)
-{
- removeAudioBufferProbe();
- REMOVE_ELEMENT(m_audioSrc);
- REMOVE_ELEMENT(m_audioPreview);
- REMOVE_ELEMENT(m_audioPreviewQueue);
- REMOVE_ELEMENT(m_audioTee);
- REMOVE_ELEMENT(m_videoSrc);
- REMOVE_ELEMENT(m_videoPreview);
- REMOVE_ELEMENT(m_videoPreviewQueue);
- REMOVE_ELEMENT(m_videoTee);
- REMOVE_ELEMENT(m_encodeBin);
- REMOVE_ELEMENT(m_imageCaptureBin);
- m_audioVolume = 0;
-
- bool ok = true;
-
- switch (newMode) {
- case EmptyPipeline:
- break;
- case PreviewPipeline:
- if (m_captureMode & Audio) {
- m_audioSrc = buildAudioSrc();
- m_audioPreview = buildAudioPreview();
-
- ok &= m_audioSrc && m_audioPreview;
-
- if (ok) {
- gst_bin_add_many(GST_BIN(m_pipeline), m_audioSrc, m_audioPreview, NULL);
- ok &= gst_element_link(m_audioSrc, m_audioPreview);
- } else {
- UNREF_ELEMENT(m_audioSrc);
- UNREF_ELEMENT(m_audioPreview);
- }
- }
- if (m_captureMode & Video || m_captureMode & Image) {
- m_videoSrc = buildVideoSrc();
- m_videoTee = gst_element_factory_make("tee", "video-preview-tee");
- m_videoPreviewQueue = gst_element_factory_make("queue", "video-preview-queue");
- m_videoPreview = buildVideoPreview();
- m_imageCaptureBin = buildImageCapture();
-
- ok &= m_videoSrc && m_videoTee && m_videoPreviewQueue && m_videoPreview && m_imageCaptureBin;
-
- if (ok) {
- gst_bin_add_many(GST_BIN(m_pipeline), m_videoSrc, m_videoTee,
- m_videoPreviewQueue, m_videoPreview,
- m_imageCaptureBin, NULL);
-
- ok &= gst_element_link(m_videoSrc, m_videoTee);
- ok &= gst_element_link(m_videoTee, m_videoPreviewQueue);
- ok &= gst_element_link(m_videoPreviewQueue, m_videoPreview);
- ok &= gst_element_link(m_videoTee, m_imageCaptureBin);
- } else {
- UNREF_ELEMENT(m_videoSrc);
- UNREF_ELEMENT(m_videoTee);
- UNREF_ELEMENT(m_videoPreviewQueue);
- UNREF_ELEMENT(m_videoPreview);
- UNREF_ELEMENT(m_imageCaptureBin);
- }
- }
- break;
- case RecordingPipeline:
- m_encodeBin = buildEncodeBin();
- gst_bin_add(GST_BIN(m_pipeline), m_encodeBin);
-
- if (m_captureMode & Audio) {
- m_audioSrc = buildAudioSrc();
- ok &= m_audioSrc != 0;
-
- gst_bin_add(GST_BIN(m_pipeline), m_audioSrc);
- ok &= gst_element_link(m_audioSrc, m_encodeBin);
- }
-
- if (m_captureMode & Video) {
- m_videoSrc = buildVideoSrc();
- ok &= m_videoSrc != 0;
-
- gst_bin_add(GST_BIN(m_pipeline), m_videoSrc);
- ok &= gst_element_link(m_videoSrc, m_encodeBin);
- }
-
- if (!m_metaData.isEmpty())
- setMetaData(m_metaData);
-
- break;
- case PreviewAndRecordingPipeline:
- m_encodeBin = buildEncodeBin();
- if (m_encodeBin)
- gst_bin_add(GST_BIN(m_pipeline), m_encodeBin);
-
- ok &= m_encodeBin != 0;
-
- if (ok && m_captureMode & Audio) {
- m_audioSrc = buildAudioSrc();
- m_audioPreview = buildAudioPreview();
- m_audioTee = gst_element_factory_make("tee", NULL);
- m_audioPreviewQueue = gst_element_factory_make("queue", NULL);
-
- ok &= m_audioSrc && m_audioPreview && m_audioTee && m_audioPreviewQueue;
-
- if (ok) {
- gst_bin_add_many(GST_BIN(m_pipeline), m_audioSrc, m_audioTee,
- m_audioPreviewQueue, m_audioPreview, NULL);
- ok &= gst_element_link(m_audioSrc, m_audioTee);
- ok &= gst_element_link(m_audioTee, m_audioPreviewQueue);
- ok &= gst_element_link(m_audioPreviewQueue, m_audioPreview);
- ok &= gst_element_link(m_audioTee, m_encodeBin);
- } else {
- UNREF_ELEMENT(m_audioSrc);
- UNREF_ELEMENT(m_audioPreview);
- UNREF_ELEMENT(m_audioTee);
- UNREF_ELEMENT(m_audioPreviewQueue);
- }
- }
-
- if (ok && (m_captureMode & Video || m_captureMode & Image)) {
- m_videoSrc = buildVideoSrc();
- m_videoPreview = buildVideoPreview();
- m_videoTee = gst_element_factory_make("tee", NULL);
- m_videoPreviewQueue = gst_element_factory_make("queue", NULL);
-
- ok &= m_videoSrc && m_videoPreview && m_videoTee && m_videoPreviewQueue;
-
- if (ok) {
- gst_bin_add_many(GST_BIN(m_pipeline), m_videoSrc, m_videoTee,
- m_videoPreviewQueue, m_videoPreview, NULL);
- ok &= gst_element_link(m_videoSrc, m_videoTee);
- ok &= gst_element_link(m_videoTee, m_videoPreviewQueue);
- ok &= gst_element_link(m_videoPreviewQueue, m_videoPreview);
- } else {
- UNREF_ELEMENT(m_videoSrc);
- UNREF_ELEMENT(m_videoTee);
- UNREF_ELEMENT(m_videoPreviewQueue);
- UNREF_ELEMENT(m_videoPreview);
- }
-
- if (ok && (m_captureMode & Video))
- ok &= gst_element_link(m_videoTee, m_encodeBin);
- }
-
- if (!m_metaData.isEmpty())
- setMetaData(m_metaData);
-
-
- break;
- }
-
- if (!ok) {
- emit error(int(QMediaRecorder::FormatError),tr("Failed to build media capture pipeline."));
- }
-
- dumpGraph( QString("rebuild_graph_%1_%2").arg(m_pipelineMode).arg(newMode) );
-#ifdef QT_GST_CAPTURE_DEBUG
- if (m_encodeBin) {
- QString fileName = QString("rebuild_graph_encode_%1_%2").arg(m_pipelineMode).arg(newMode);
- GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(m_encodeBin), GST_DEBUG_GRAPH_SHOW_ALL, fileName.toLatin1());
- }
-#endif
-
- if (ok) {
- addAudioBufferProbe();
- m_pipelineMode = newMode;
- } else {
- m_pipelineMode = EmptyPipeline;
-
- REMOVE_ELEMENT(m_audioSrc);
- REMOVE_ELEMENT(m_audioPreview);
- REMOVE_ELEMENT(m_audioPreviewQueue);
- REMOVE_ELEMENT(m_audioTee);
- REMOVE_ELEMENT(m_videoSrc);
- REMOVE_ELEMENT(m_videoPreview);
- REMOVE_ELEMENT(m_videoPreviewQueue);
- REMOVE_ELEMENT(m_videoTee);
- REMOVE_ELEMENT(m_encodeBin);
- }
-
- return ok;
-}
-
-void QGstreamerCaptureSession::dumpGraph(const QString &fileName)
-{
-#ifdef QT_GST_CAPTURE_DEBUG
- GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(m_pipeline),
- GstDebugGraphDetails(/*GST_DEBUG_GRAPH_SHOW_ALL |*/ GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE | GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS | GST_DEBUG_GRAPH_SHOW_STATES),
- fileName.toLatin1());
-#else
- Q_UNUSED(fileName);
-#endif
-}
-
-QUrl QGstreamerCaptureSession::outputLocation() const
-{
- return m_sink;
-}
-
-bool QGstreamerCaptureSession::setOutputLocation(const QUrl& sink)
-{
- if (!sink.isRelative() && !sink.isLocalFile()) {
- qWarning("Output location must be a local file");
- return false;
- }
-
- m_sink = sink;
- return true;
-}
-
-void QGstreamerCaptureSession::setAudioInput(QGstreamerElementFactory *audioInput)
-{
- m_audioInputFactory = audioInput;
-}
-
-void QGstreamerCaptureSession::setAudioPreview(QGstreamerElementFactory *audioPreview)
-{
- m_audioPreviewFactory = audioPreview;
-}
-
-void QGstreamerCaptureSession::setVideoInput(QGstreamerVideoInput *videoInput)
-{
- m_videoInputFactory = videoInput;
-}
-
-void QGstreamerCaptureSession::setVideoPreview(QObject *viewfinder)
-{
- 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, SIGNAL(viewfinderChanged()));
- 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, SIGNAL(viewfinderChanged()));
- connect(m_viewfinder, SIGNAL(readyChanged(bool)),
- this, SIGNAL(readyChanged(bool)));
-
- m_busHelper->installMessageFilter(m_viewfinder);
- }
-
- emit viewfinderChanged();
- if (oldReady != isReady())
- emit readyChanged(isReady());
- }
-}
-
-bool QGstreamerCaptureSession::isReady() const
-{
- //it's possible to use QCamera without any viewfinder attached
- return !m_viewfinderInterface || m_viewfinderInterface->isReady();
-}
-
-QGstreamerCaptureSession::State QGstreamerCaptureSession::state() const
-{
- return m_state;
-}
-
-QGstreamerCaptureSession::State QGstreamerCaptureSession::pendingState() const
-{
- return m_pendingState;
-}
-
-void QGstreamerCaptureSession::setState(QGstreamerCaptureSession::State newState)
-{
- if (newState == m_pendingState && !m_waitingForEos)
- return;
-
- m_pendingState = newState;
-
- PipelineMode newMode = EmptyPipeline;
-
- switch (newState) {
- case PausedState:
- case RecordingState:
- newMode = PreviewAndRecordingPipeline;
- break;
- case PreviewState:
- newMode = PreviewPipeline;
- break;
- case StoppedState:
- newMode = EmptyPipeline;
- break;
- }
-
- if (newMode != m_pipelineMode) {
- if (m_pipelineMode == PreviewAndRecordingPipeline) {
- if (!m_waitingForEos) {
- m_waitingForEos = true;
- //qDebug() << "Waiting for EOS";
- // Unless gstreamer is in GST_STATE_PLAYING our EOS message will not be received.
- gst_element_set_state(m_pipeline, GST_STATE_PLAYING);
- //with live sources it's necessary to send EOS even to pipeline
- //before going to STOPPED state
- gst_element_send_event(m_pipeline, gst_event_new_eos());
-
- return;
- } else {
- m_waitingForEos = false;
- //qDebug() << "EOS received";
- }
- }
-
- //select suitable default codecs/containers, if necessary
- m_recorderControl->applySettings();
-
- gst_element_set_state(m_pipeline, GST_STATE_NULL);
-
- if (!rebuildGraph(newMode)) {
- m_pendingState = StoppedState;
- m_state = StoppedState;
- emit stateChanged(StoppedState);
-
- return;
- }
- }
-
- switch (newState) {
- case PausedState:
- gst_element_set_state(m_pipeline, GST_STATE_PAUSED);
- break;
- case RecordingState:
- case PreviewState:
- gst_element_set_state(m_pipeline, GST_STATE_PLAYING);
- break;
- case StoppedState:
- gst_element_set_state(m_pipeline, GST_STATE_NULL);
- }
-
- //we have to do it here, since gstreamer will not emit bus messages any more
- if (newState == StoppedState) {
- m_state = StoppedState;
- emit stateChanged(StoppedState);
- }
-}
-
-
-qint64 QGstreamerCaptureSession::duration() const
-{
- gint64 duration = 0;
- if (m_encodeBin && qt_gst_element_query_position(m_encodeBin, GST_FORMAT_TIME, &duration))
- return duration / 1000000;
- else
- return 0;
-}
-
-void QGstreamerCaptureSession::setCaptureDevice(const QString &deviceName)
-{
- m_captureDevice = deviceName;
-}
-
-void QGstreamerCaptureSession::setMetaData(const QMap<QByteArray, QVariant> &data)
-{
- //qDebug() << "QGstreamerCaptureSession::setMetaData" << data;
- m_metaData = data;
-
- if (m_encodeBin)
- QGstUtils::setMetaData(GST_BIN(m_encodeBin), data);
-}
-
-bool QGstreamerCaptureSession::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);
- emit error(int(QMediaRecorder::ResourceError),QString::fromUtf8(err->message));
- g_error_free (err);
- g_free (debug);
- }
-
- if (GST_MESSAGE_SRC(gm) == GST_OBJECT_CAST(m_pipeline)) {
- switch (GST_MESSAGE_TYPE(gm)) {
- case GST_MESSAGE_DURATION:
- break;
-
- case GST_MESSAGE_EOS:
- if (m_waitingForEos)
- setState(m_pendingState);
- break;
-
- case GST_MESSAGE_STATE_CHANGED:
- {
-
- GstState oldState;
- GstState newState;
- GstState pending;
-
- gst_message_parse_state_changed(gm, &oldState, &newState, &pending);
-
- 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]);
-
- #define ENUM_NAME(c,e,v) (c::staticMetaObject.enumerator(c::staticMetaObject.indexOfEnumerator(e)).valueToKey((v)))
-
- qDebug() << "Current session state:" << ENUM_NAME(QGstreamerCaptureSession,"State",m_state);
- qDebug() << "Pending session state:" << ENUM_NAME(QGstreamerCaptureSession,"State",m_pendingState);
- */
-
- switch (newState) {
- case GST_STATE_VOID_PENDING:
- case GST_STATE_NULL:
- case GST_STATE_READY:
- if (m_state != StoppedState && m_pendingState == StoppedState) {
- emit stateChanged(m_state = StoppedState);
- dumpGraph("stopped");
- }
- break;
- case GST_STATE_PAUSED:
- if (m_state != PausedState && m_pendingState == PausedState)
- emit stateChanged(m_state = PausedState);
- dumpGraph("paused");
-
- if (m_pipelineMode == RecordingPipeline && !m_metaData.isEmpty())
- setMetaData(m_metaData);
- break;
- case GST_STATE_PLAYING:
- {
- if ((m_pendingState == PreviewState || m_pendingState == RecordingState) &&
- m_state != m_pendingState)
- {
- m_state = m_pendingState;
- emit stateChanged(m_state);
- }
-
- if (m_pipelineMode == PreviewPipeline)
- dumpGraph("preview");
- else
- dumpGraph("recording");
- }
- break;
- }
- }
- break;
- default:
- break;
- }
- //qDebug() << "New session state:" << ENUM_NAME(QGstreamerCaptureSession,"State",m_state);
- }
- }
- return false;
-}
-
-void QGstreamerCaptureSession::setMuted(bool muted)
-{
- if (bool(m_muted) != muted) {
- m_muted = muted;
- if (m_audioVolume)
- g_object_set(G_OBJECT(m_audioVolume), "mute", m_muted, NULL);
-
- emit mutedChanged(muted);
- }
-}
-
-void QGstreamerCaptureSession::setVolume(qreal volume)
-{
- if (!qFuzzyCompare(double(volume), m_volume)) {
- m_volume = volume;
- if (m_audioVolume)
- g_object_set(G_OBJECT(m_audioVolume), "volume", m_volume, NULL);
-
- emit volumeChanged(volume);
- }
-}
-
-void QGstreamerCaptureSession::addProbe(QGstreamerAudioProbeControl* probe)
-{
- Q_ASSERT(!m_audioProbe);
- m_audioProbe = probe;
- addAudioBufferProbe();
-}
-
-void QGstreamerCaptureSession::removeProbe(QGstreamerAudioProbeControl* probe)
-{
- Q_ASSERT(m_audioProbe == probe);
- removeAudioBufferProbe();
- m_audioProbe = 0;
-}
-
-GstPad *QGstreamerCaptureSession::getAudioProbePad()
-{
- // first see if preview element is available
- if (m_audioPreview) {
- GstPad *pad = gst_element_get_static_pad(m_audioPreview, "sink");
- if (pad)
- return pad;
- }
-
- // preview element is not available,
- // try to use sink pin of audio encoder.
- if (m_encodeBin) {
- GstElement *audioEncoder = gst_bin_get_by_name(GST_BIN(m_encodeBin), "audio-encoder-bin");
- if (audioEncoder) {
- GstPad *pad = gst_element_get_static_pad(audioEncoder, "sink");
- gst_object_unref(audioEncoder);
- if (pad)
- return pad;
- }
- }
-
- return 0;
-}
-
-void QGstreamerCaptureSession::removeAudioBufferProbe()
-{
- if (!m_audioProbe)
- return;
-
- GstPad *pad = getAudioProbePad();
- if (pad) {
- m_audioProbe->removeProbeFromPad(pad);
- gst_object_unref(GST_OBJECT(pad));
- }
-}
-
-void QGstreamerCaptureSession::addAudioBufferProbe()
-{
- if (!m_audioProbe)
- return;
-
- GstPad *pad = getAudioProbePad();
- if (pad) {
- m_audioProbe->addProbeToPad(pad);
- gst_object_unref(GST_OBJECT(pad));
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.h b/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.h
deleted file mode 100644
index e0c9107a7..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.h
+++ /dev/null
@@ -1,244 +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 QGSTREAMERCAPTURESESSION_H
-#define QGSTREAMERCAPTURESESSION_H
-
-#include <qmediarecordercontrol.h>
-#include <qmediarecorder.h>
-
-#include <QtCore/qmutex.h>
-#include <QtCore/qurl.h>
-
-#include <gst/gst.h>
-#include <gst/video/video.h>
-
-#include <private/qgstreamerbushelper_p.h>
-#include <private/qgstreamerbufferprobe_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGstreamerMessage;
-class QGstreamerBusHelper;
-class QGstreamerAudioEncode;
-class QGstreamerVideoEncode;
-class QGstreamerImageEncode;
-class QGstreamerRecorderControl;
-class QGstreamerMediaContainerControl;
-class QGstreamerVideoRendererInterface;
-class QGstreamerAudioProbeControl;
-
-class QGstreamerElementFactory
-{
-public:
- virtual GstElement *buildElement() = 0;
- virtual void prepareWinId() {}
-};
-
-class QGstreamerVideoInput : public QGstreamerElementFactory
-{
-public:
- virtual QList<qreal> supportedFrameRates(const QSize &frameSize = QSize()) const = 0;
- virtual QList<QSize> supportedResolutions(qreal frameRate = -1) const = 0;
-};
-
-class QGstreamerCaptureSession
- : public QObject
- , public QGstreamerBusMessageFilter
- , private QGstreamerBufferProbe
-{
- Q_OBJECT
- Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged)
- Q_ENUMS(State)
- Q_ENUMS(CaptureMode)
- Q_INTERFACES(QGstreamerBusMessageFilter)
-public:
- enum CaptureMode { Audio = 1,
- Video = 2,
- Image = 4,
- AudioAndVideo = Audio | Video,
- AudioAndVideoAndImage = Audio | Video | Image
- };
- enum State { StoppedState, PreviewState, PausedState, RecordingState };
-
- QGstreamerCaptureSession(CaptureMode captureMode, QObject *parent);
- ~QGstreamerCaptureSession();
-
- QGstreamerBusHelper *bus() { return m_busHelper; }
-
- CaptureMode captureMode() const { return m_captureMode; }
- void setCaptureMode(CaptureMode);
-
- QUrl outputLocation() const;
- bool setOutputLocation(const QUrl& sink);
-
- QGstreamerAudioEncode *audioEncodeControl() const { return m_audioEncodeControl; }
- QGstreamerVideoEncode *videoEncodeControl() const { return m_videoEncodeControl; }
- QGstreamerImageEncode *imageEncodeControl() const { return m_imageEncodeControl; }
-
- QGstreamerRecorderControl *recorderControl() const { return m_recorderControl; }
- QGstreamerMediaContainerControl *mediaContainerControl() const { return m_mediaContainerControl; }
-
- QGstreamerElementFactory *audioInput() const { return m_audioInputFactory; }
- void setAudioInput(QGstreamerElementFactory *audioInput);
-
- QGstreamerElementFactory *audioPreview() const { return m_audioPreviewFactory; }
- void setAudioPreview(QGstreamerElementFactory *audioPreview);
-
- QGstreamerVideoInput *videoInput() const { return m_videoInputFactory; }
- void setVideoInput(QGstreamerVideoInput *videoInput);
-
- QObject *videoPreview() const { return m_viewfinder; }
- void setVideoPreview(QObject *viewfinder);
-
- void captureImage(int requestId, const QString &fileName);
-
- State state() const;
- State pendingState() const;
-
- qint64 duration() const;
- bool isMuted() const { return m_muted; }
- qreal volume() const { return m_volume; }
-
- bool isReady() const;
-
- bool processBusMessage(const QGstreamerMessage &message) override;
-
- void addProbe(QGstreamerAudioProbeControl* probe);
- void removeProbe(QGstreamerAudioProbeControl* probe);
-
-signals:
- void stateChanged(QGstreamerCaptureSession::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 imageSaved(int requestId, const QString &path);
- void mutedChanged(bool);
- void volumeChanged(qreal);
- void readyChanged(bool);
- void viewfinderChanged();
-
-public slots:
- void setState(QGstreamerCaptureSession::State);
- void setCaptureDevice(const QString &deviceName);
-
- void dumpGraph(const QString &fileName);
-
- void setMetaData(const QMap<QByteArray, QVariant>&);
- void setMuted(bool);
- void setVolume(qreal volume);
-
-private:
- void probeCaps(GstCaps *caps) override;
- bool probeBuffer(GstBuffer *buffer) override;
-
- enum PipelineMode { EmptyPipeline, PreviewPipeline, RecordingPipeline, PreviewAndRecordingPipeline };
-
- GstElement *buildEncodeBin();
- GstElement *buildAudioSrc();
- GstElement *buildAudioPreview();
- GstElement *buildVideoSrc();
- GstElement *buildVideoPreview();
- GstElement *buildImageCapture();
-
- bool rebuildGraph(QGstreamerCaptureSession::PipelineMode newMode);
-
- GstPad *getAudioProbePad();
- void removeAudioBufferProbe();
- void addAudioBufferProbe();
-
- QUrl m_sink;
- QString m_captureDevice;
- State m_state;
- State m_pendingState;
- bool m_waitingForEos;
- PipelineMode m_pipelineMode;
- QGstreamerCaptureSession::CaptureMode m_captureMode;
- QMap<QByteArray, QVariant> m_metaData;
-
- QGstreamerAudioProbeControl *m_audioProbe;
-
- QGstreamerElementFactory *m_audioInputFactory;
- QGstreamerElementFactory *m_audioPreviewFactory;
- QGstreamerVideoInput *m_videoInputFactory;
- QObject *m_viewfinder;
- QGstreamerVideoRendererInterface *m_viewfinderInterface;
-
- QGstreamerAudioEncode *m_audioEncodeControl;
- QGstreamerVideoEncode *m_videoEncodeControl;
- QGstreamerImageEncode *m_imageEncodeControl;
- QGstreamerRecorderControl *m_recorderControl;
- QGstreamerMediaContainerControl *m_mediaContainerControl;
-
- QGstreamerBusHelper *m_busHelper;
- GstBus* m_bus;
- GstElement *m_pipeline;
-
- GstElement *m_audioSrc;
- GstElement *m_audioTee;
- GstElement *m_audioPreviewQueue;
- GstElement *m_audioPreview;
- GstElement *m_audioVolume;
- gboolean m_muted;
- double m_volume;
-
- GstElement *m_videoSrc;
- GstElement *m_videoTee;
- GstElement *m_videoPreviewQueue;
- GstElement *m_videoPreview;
-
- GstElement *m_imageCaptureBin;
-
- GstElement *m_encodeBin;
-
-#if GST_CHECK_VERSION(1,0,0)
- GstVideoInfo m_previewInfo;
-#endif
-
-public:
- bool m_passImage;
- bool m_passPrerollImage;
- QString m_imageFileName;
- int m_imageRequestId;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGSTREAMERCAPTURESESSION_H
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.cpp b/src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.cpp
deleted file mode 100644
index 120c19af6..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.cpp
+++ /dev/null
@@ -1,113 +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 "qgstreamerimagecapturecontrol.h"
-#include <QtCore/QDebug>
-#include <QtCore/QDir>
-
-QGstreamerImageCaptureControl::QGstreamerImageCaptureControl(QGstreamerCaptureSession *session)
- :QCameraImageCaptureControl(session), m_session(session), m_ready(false), m_lastId(0)
-{
- connect(m_session, SIGNAL(stateChanged(QGstreamerCaptureSession::State)), 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, SIGNAL(imageSaved(int,QString)), this, SIGNAL(imageSaved(int,QString)));
-}
-
-QGstreamerImageCaptureControl::~QGstreamerImageCaptureControl()
-{
-}
-
-bool QGstreamerImageCaptureControl::isReadyForCapture() const
-{
- return m_ready;
-}
-
-int QGstreamerImageCaptureControl::capture(const QString &fileName)
-{
- m_lastId++;
-
- //it's allowed to request image capture while camera is starting
- if (m_session->pendingState() == QGstreamerCaptureSession::StoppedState ||
- !(m_session->captureMode() & QGstreamerCaptureSession::Image)) {
- //emit error in the next event loop,
- //so application can associate it with returned request id.
- QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
- Q_ARG(int, m_lastId),
- Q_ARG(int, QCameraImageCapture::NotReadyError),
- Q_ARG(QString,tr("Not ready to capture")));
-
- return m_lastId;
- }
-
- QString path = fileName;
- if (path.isEmpty()) {
- int lastImage = 0;
- QDir outputDir = QDir::currentPath();
- const auto list = outputDir.entryList(QStringList() << "img_*.jpg");
- for (const QString &fileName : list) {
- int imgNumber = QStringView{fileName}.mid(4, fileName.size()-8).toInt();
- lastImage = qMax(lastImage, imgNumber);
- }
-
- path = QString("img_%1.jpg").arg(lastImage+1,
- 4, //fieldWidth
- 10,
- QLatin1Char('0'));
- }
-
- m_session->captureImage(m_lastId, path);
-
- return m_lastId;
-}
-
-void QGstreamerImageCaptureControl::cancelCapture()
-{
-
-}
-
-void QGstreamerImageCaptureControl::updateState()
-{
- bool ready = (m_session->state() == QGstreamerCaptureSession::PreviewState) &&
- (m_session->captureMode() & QGstreamerCaptureSession::Image);
-
- if (m_ready != ready) {
- emit readyForCaptureChanged(m_ready = ready);
- }
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.h b/src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.h
deleted file mode 100644
index f58cf09c5..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.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 QGSTREAMERIMAGECAPTURECONTROL_H
-#define QGSTREAMERIMAGECAPTURECONTROL_H
-
-#include <qcameraimagecapturecontrol.h>
-#include "qgstreamercapturesession.h"
-
-QT_BEGIN_NAMESPACE
-
-class QGstreamerImageCaptureControl : public QCameraImageCaptureControl
-{
- Q_OBJECT
-public:
- QGstreamerImageCaptureControl(QGstreamerCaptureSession *session);
- virtual ~QGstreamerImageCaptureControl();
-
- 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;
-
-private slots:
- void updateState();
-
-private:
- QGstreamerCaptureSession *m_session;
- bool m_ready;
- int m_lastId;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGSTREAMERCAPTURECORNTROL_H
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerimageencode.cpp b/src/plugins/gstreamer/mediacapture/qgstreamerimageencode.cpp
deleted file mode 100644
index f9e6ce9ef..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamerimageencode.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 "qgstreamerimageencode.h"
-#include "qgstreamercapturesession.h"
-
-#include <QtCore/qdebug.h>
-
-#include <math.h>
-
-QGstreamerImageEncode::QGstreamerImageEncode(QGstreamerCaptureSession *session)
- :QImageEncoderControl(session), m_session(session)
-{
-}
-
-QGstreamerImageEncode::~QGstreamerImageEncode()
-{
-}
-
-QList<QSize> QGstreamerImageEncode::supportedResolutions(const QImageEncoderSettings &, bool *continuous) const
-{
- if (continuous)
- *continuous = m_session->videoInput() != 0;
-
- return m_session->videoInput() ? m_session->videoInput()->supportedResolutions() : QList<QSize>();
-}
-
-QStringList QGstreamerImageEncode::supportedImageCodecs() const
-{
- return QStringList() << "jpeg";
-}
-
-QString QGstreamerImageEncode::imageCodecDescription(const QString &codecName) const
-{
- if (codecName == "jpeg")
- return tr("JPEG image encoder");
-
- return QString();
-}
-
-QImageEncoderSettings QGstreamerImageEncode::imageSettings() const
-{
- return m_settings;
-}
-
-void QGstreamerImageEncode::setImageSettings(const QImageEncoderSettings &settings)
-{
- if (m_settings != settings) {
- m_settings = settings;
- emit settingsChanged();
- }
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerimageencode.h b/src/plugins/gstreamer/mediacapture/qgstreamerimageencode.h
deleted file mode 100644
index f3ebd3e90..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamerimageencode.h
+++ /dev/null
@@ -1,81 +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 QGSTREAMERIMAGEENCODE_H
-#define QGSTREAMERIMAGEENCODE_H
-
-#include <qimageencodercontrol.h>
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmap.h>
-
-#include <gst/gst.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGstreamerCaptureSession;
-
-class QGstreamerImageEncode : public QImageEncoderControl
-{
- Q_OBJECT
-public:
- QGstreamerImageEncode(QGstreamerCaptureSession *session);
- virtual ~QGstreamerImageEncode();
-
- QList<QSize> supportedResolutions(const QImageEncoderSettings &settings = QImageEncoderSettings(),
- bool *continuous = 0) const override;
-
- QStringList supportedImageCodecs() const override;
- QString imageCodecDescription(const QString &codecName) const override;
-
- QImageEncoderSettings imageSettings() const override;
- void setImageSettings(const QImageEncoderSettings &settings) override;
-
-Q_SIGNALS:
- void settingsChanged();
-
-private:
- QImageEncoderSettings m_settings;
-
- QGstreamerCaptureSession *m_session;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.cpp b/src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.cpp
deleted file mode 100644
index 33351476d..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.cpp
+++ /dev/null
@@ -1,60 +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 "qgstreamermediacontainercontrol.h"
-
-#include <private/qgstutils_p.h>
-
-#include <QtCore/qdebug.h>
-
-QGstreamerMediaContainerControl::QGstreamerMediaContainerControl(QObject *parent)
- :QMediaContainerControl(parent)
- , m_containers(QGstCodecsInfo::Muxer)
-{
-}
-
-QSet<QString> QGstreamerMediaContainerControl::supportedStreamTypes(const QString &container) const
-{
- return m_containers.supportedStreamTypes(container);
-}
-
-QString QGstreamerMediaContainerControl::containerExtension() const
-{
- return QGstUtils::fileExtensionForMimeType(m_format);
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.h b/src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.h
deleted file mode 100644
index 02c7346b1..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.h
+++ /dev/null
@@ -1,80 +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 QGSTREAMERMEDIACONTAINERCONTROL_H
-#define QGSTREAMERMEDIACONTAINERCONTROL_H
-
-#include <qmediacontainercontrol.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qset.h>
-
-#include <private/qgstcodecsinfo_p.h>
-
-#include <gst/gst.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGstreamerMediaContainerControl : public QMediaContainerControl
-{
-Q_OBJECT
-public:
- QGstreamerMediaContainerControl(QObject *parent);
- ~QGstreamerMediaContainerControl() {}
-
- QStringList supportedContainers() const override { return m_containers.supportedCodecs(); }
- QString containerFormat() const override { return m_format; }
- void setContainerFormat(const QString &formatMimeType) override { m_format = formatMimeType; }
-
- QString containerDescription(const QString &formatMimeType) const override { return m_containers.codecDescription(formatMimeType); }
-
- QByteArray formatElementName() const { return m_containers.codecElement(containerFormat()); }
-
- QSet<QString> supportedStreamTypes(const QString &container) const;
-
- QString containerExtension() const;
-
-private:
- QString m_format;
- QGstCodecsInfo m_containers;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGSTREAMERMEDIACONTAINERCONTROL_H
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp b/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp
deleted file mode 100644
index d7f4ec035..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp
+++ /dev/null
@@ -1,372 +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 "qgstreamerrecordercontrol.h"
-#include "qgstreameraudioencode.h"
-#include "qgstreamervideoencode.h"
-#include "qgstreamermediacontainercontrol.h"
-#include <QtCore/QDebug>
-#include <QtGui/qdesktopservices.h>
-#include <QStandardPaths>
-
-QGstreamerRecorderControl::QGstreamerRecorderControl(QGstreamerCaptureSession *session)
- :QMediaRecorderControl(session),
- m_session(session),
- m_state(QMediaRecorder::StoppedState),
- m_status(QMediaRecorder::UnloadedStatus)
-{
- connect(m_session, SIGNAL(stateChanged(QGstreamerCaptureSession::State)), SLOT(updateStatus()));
- connect(m_session, SIGNAL(error(int,QString)), SLOT(handleSessionError(int,QString)));
- connect(m_session, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged(qint64)));
- connect(m_session, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged(bool)));
- connect(m_session, SIGNAL(volumeChanged(qreal)), SIGNAL(volumeChanged(qreal)));
- m_hasPreviewState = m_session->captureMode() != QGstreamerCaptureSession::Audio;
-}
-
-QGstreamerRecorderControl::~QGstreamerRecorderControl()
-{
-}
-
-QUrl QGstreamerRecorderControl::outputLocation() const
-{
- return m_session->outputLocation();
-}
-
-bool QGstreamerRecorderControl::setOutputLocation(const QUrl &sink)
-{
- m_outputLocation = sink;
- m_session->setOutputLocation(sink);
- return true;
-}
-
-
-QMediaRecorder::State QGstreamerRecorderControl::state() const
-{
- return m_state;
-}
-
-QMediaRecorder::Status QGstreamerRecorderControl::status() const
-{
- static QMediaRecorder::Status statusTable[3][3] = {
- //Stopped recorder state:
- { QMediaRecorder::LoadedStatus, QMediaRecorder::FinalizingStatus, QMediaRecorder::FinalizingStatus },
- //Recording recorder state:
- { QMediaRecorder::StartingStatus, QMediaRecorder::RecordingStatus, QMediaRecorder::PausedStatus },
- //Paused recorder state:
- { QMediaRecorder::StartingStatus, QMediaRecorder::RecordingStatus, QMediaRecorder::PausedStatus }
- };
-
- QMediaRecorder::State sessionState = QMediaRecorder::StoppedState;
-
- switch ( m_session->state() ) {
- case QGstreamerCaptureSession::RecordingState:
- sessionState = QMediaRecorder::RecordingState;
- break;
- case QGstreamerCaptureSession::PausedState:
- sessionState = QMediaRecorder::PausedState;
- break;
- case QGstreamerCaptureSession::PreviewState:
- case QGstreamerCaptureSession::StoppedState:
- sessionState = QMediaRecorder::StoppedState;
- break;
- }
-
- return statusTable[m_state][sessionState];
-}
-
-void QGstreamerRecorderControl::updateStatus()
-{
- QMediaRecorder::Status newStatus = status();
- if (m_status != newStatus) {
- m_status = newStatus;
- emit statusChanged(m_status);
- // If stop has been called and session state became stopped.
- if (m_status == QMediaRecorder::LoadedStatus)
- emit stateChanged(m_state);
- }
-}
-
-void QGstreamerRecorderControl::handleSessionError(int code, const QString &description)
-{
- emit error(code, description);
- stop();
-}
-
-qint64 QGstreamerRecorderControl::duration() const
-{
- return m_session->duration();
-}
-
-void QGstreamerRecorderControl::setState(QMediaRecorder::State state)
-{
- switch (state) {
- case QMediaRecorder::StoppedState:
- stop();
- break;
- case QMediaRecorder::PausedState:
- pause();
- break;
- case QMediaRecorder::RecordingState:
- record();
- break;
- }
-}
-
-void QGstreamerRecorderControl::record()
-{
- if (m_state == QMediaRecorder::RecordingState)
- return;
-
- m_state = QMediaRecorder::RecordingState;
-
- if (m_outputLocation.isEmpty()) {
- QString container = m_session->mediaContainerControl()->containerExtension();
- if (container.isEmpty())
- container = "raw";
-
- m_session->setOutputLocation(QUrl(generateFileName(defaultDir(), container)));
- }
-
- m_session->dumpGraph("before-record");
- if (!m_hasPreviewState || m_session->state() != QGstreamerCaptureSession::StoppedState) {
- m_session->setState(QGstreamerCaptureSession::RecordingState);
- } else
- emit error(QMediaRecorder::ResourceError, tr("Service has not been started"));
-
- m_session->dumpGraph("after-record");
-
- emit stateChanged(m_state);
- updateStatus();
-
- emit actualLocationChanged(m_session->outputLocation());
-}
-
-void QGstreamerRecorderControl::pause()
-{
- if (m_state == QMediaRecorder::PausedState)
- return;
-
- m_state = QMediaRecorder::PausedState;
-
- m_session->dumpGraph("before-pause");
- if (!m_hasPreviewState || m_session->state() != QGstreamerCaptureSession::StoppedState) {
- m_session->setState(QGstreamerCaptureSession::PausedState);
- } else
- emit error(QMediaRecorder::ResourceError, tr("Service has not been started"));
-
- emit stateChanged(m_state);
- updateStatus();
-}
-
-void QGstreamerRecorderControl::stop()
-{
- if (m_state == QMediaRecorder::StoppedState)
- return;
-
- m_state = QMediaRecorder::StoppedState;
-
- if (!m_hasPreviewState) {
- m_session->setState(QGstreamerCaptureSession::StoppedState);
- } else {
- if (m_session->state() != QGstreamerCaptureSession::StoppedState)
- m_session->setState(QGstreamerCaptureSession::PreviewState);
- }
-
- updateStatus();
-}
-
-void QGstreamerRecorderControl::applySettings()
-{
- //Check the codecs are compatible with container,
- //and choose the compatible codecs/container if omitted
- QGstreamerAudioEncode *audioEncodeControl = m_session->audioEncodeControl();
- QGstreamerVideoEncode *videoEncodeControl = m_session->videoEncodeControl();
- QGstreamerMediaContainerControl *mediaContainerControl = m_session->mediaContainerControl();
-
- bool needAudio = m_session->captureMode() & QGstreamerCaptureSession::Audio;
- bool needVideo = m_session->captureMode() & QGstreamerCaptureSession::Video;
-
- QStringList containerCandidates;
- if (mediaContainerControl->containerFormat().isEmpty())
- containerCandidates = mediaContainerControl->supportedContainers();
- else
- containerCandidates << mediaContainerControl->containerFormat();
-
-
- QStringList audioCandidates;
- if (needAudio) {
- QAudioEncoderSettings audioSettings = audioEncodeControl->audioSettings();
- if (audioSettings.codec().isEmpty())
- audioCandidates = audioEncodeControl->supportedAudioCodecs();
- else
- audioCandidates << audioSettings.codec();
- }
-
- QStringList videoCandidates;
- if (needVideo) {
- QVideoEncoderSettings videoSettings = videoEncodeControl->videoSettings();
- if (videoSettings.codec().isEmpty())
- videoCandidates = videoEncodeControl->supportedVideoCodecs();
- else
- videoCandidates << videoSettings.codec();
- }
-
- QString container;
- QString audioCodec;
- QString videoCodec;
-
- for (const QString &containerCandidate : qAsConst(containerCandidates)) {
- QSet<QString> supportedTypes = mediaContainerControl->supportedStreamTypes(containerCandidate);
-
- audioCodec.clear();
- videoCodec.clear();
-
- if (needAudio) {
- bool found = false;
- for (const QString &audioCandidate : qAsConst(audioCandidates)) {
- QSet<QString> audioTypes = audioEncodeControl->supportedStreamTypes(audioCandidate);
- if (audioTypes.intersects(supportedTypes)) {
- found = true;
- audioCodec = audioCandidate;
- break;
- }
- }
- if (!found)
- continue;
- }
-
- if (needVideo) {
- bool found = false;
- for (const QString &videoCandidate : qAsConst(videoCandidates)) {
- QSet<QString> videoTypes = videoEncodeControl->supportedStreamTypes(videoCandidate);
- if (videoTypes.intersects(supportedTypes)) {
- found = true;
- videoCodec = videoCandidate;
- break;
- }
- }
- if (!found)
- continue;
- }
-
- container = containerCandidate;
- break;
- }
-
- if (container.isEmpty()) {
- emit error(QMediaRecorder::FormatError, tr("Not compatible codecs and container format."));
- } else {
- mediaContainerControl->setContainerFormat(container);
-
- if (needAudio) {
- QAudioEncoderSettings audioSettings = audioEncodeControl->audioSettings();
- audioSettings.setCodec(audioCodec);
- audioEncodeControl->setAudioSettings(audioSettings);
- }
-
- if (needVideo) {
- QVideoEncoderSettings videoSettings = videoEncodeControl->videoSettings();
- videoSettings.setCodec(videoCodec);
- videoEncodeControl->setVideoSettings(videoSettings);
- }
- }
-}
-
-
-bool QGstreamerRecorderControl::isMuted() const
-{
- return m_session->isMuted();
-}
-
-qreal QGstreamerRecorderControl::volume() const
-{
- return m_session->volume();
-}
-
-void QGstreamerRecorderControl::setMuted(bool muted)
-{
- m_session->setMuted(muted);
-}
-
-void QGstreamerRecorderControl::setVolume(qreal volume)
-{
- m_session->setVolume(volume);
-}
-
-QDir QGstreamerRecorderControl::defaultDir() const
-{
- QStringList dirCandidates;
-
- if (m_session->captureMode() & QGstreamerCaptureSession::Video)
- dirCandidates << QStandardPaths::writableLocation(QStandardPaths::MoviesLocation);
- else
- dirCandidates << QStandardPaths::writableLocation(QStandardPaths::MusicLocation);
-
- dirCandidates << QDir::home().filePath("Documents");
- dirCandidates << QDir::home().filePath("My Documents");
- dirCandidates << QDir::homePath();
- dirCandidates << QDir::currentPath();
- dirCandidates << QDir::tempPath();
-
- for (const QString &path : qAsConst(dirCandidates)) {
- QDir dir(path);
- if (dir.exists() && QFileInfo(path).isWritable())
- return dir;
- }
-
- return QDir();
-}
-
-QString QGstreamerRecorderControl::generateFileName(const QDir &dir, const QString &ext) const
-{
-
- int lastClip = 0;
- const auto list = dir.entryList(QStringList() << QString("clip_*.%1").arg(ext));
- for (const QString &fileName : list) {
- int imgNumber = QStringView{fileName}.mid(5, fileName.size()-6-ext.length()).toInt();
- lastClip = qMax(lastClip, imgNumber);
- }
-
- QString name = QString("clip_%1.%2").arg(lastClip+1,
- 4, //fieldWidth
- 10,
- QLatin1Char('0')).arg(ext);
-
- return dir.absoluteFilePath(name);
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.h b/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.h
deleted file mode 100644
index b80716f4c..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.h
+++ /dev/null
@@ -1,97 +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 QGSTREAMERRECORDERCONTROL_H
-#define QGSTREAMERRECORDERCONTROL_H
-
-#include <QtCore/QDir>
-
-#include <qmediarecordercontrol.h>
-#include "qgstreamercapturesession.h"
-
-QT_BEGIN_NAMESPACE
-
-class QGstreamerRecorderControl : public QMediaRecorderControl
-{
- Q_OBJECT
-
-public:
- QGstreamerRecorderControl(QGstreamerCaptureSession *session);
- virtual ~QGstreamerRecorderControl();
-
- 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;
-
-public slots:
- void setState(QMediaRecorder::State state) override;
- void record();
- void pause();
- void stop();
- void setMuted(bool) override;
- void setVolume(qreal volume) override;
-
-private slots:
- void updateStatus();
- void handleSessionError(int code, const QString &description);
-
-private:
- QDir defaultDir() const;
- QString generateFileName(const QDir &dir, const QString &ext) const;
-
- QUrl m_outputLocation;
- QGstreamerCaptureSession *m_session;
- QMediaRecorder::State m_state;
- QMediaRecorder::Status m_status;
- bool m_hasPreviewState;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGSTREAMERCAPTURECORNTROL_H
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.cpp b/src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.cpp
deleted file mode 100644
index ef0832f7e..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.cpp
+++ /dev/null
@@ -1,286 +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 "qgstreamerv4l2input.h"
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qfile.h>
-
-#include <private/qcore_unix_p.h>
-#include <linux/videodev2.h>
-
-#include <algorithm>
-
-QT_BEGIN_NAMESPACE
-static inline uint qHash(const QSize& key) { return uint(key.width()*256+key.height()); }
-
-static bool operator<(const QSize &s1, const QSize s2)
-{
- return s1.width()*s1.height() < s2.width()*s2.height();
-}
-QT_END_NAMESPACE
-
-QGstreamerV4L2Input::QGstreamerV4L2Input(QObject *parent)
- :QObject(parent)
-{
-}
-
-QGstreamerV4L2Input::~QGstreamerV4L2Input()
-{
-}
-
-GstElement *QGstreamerV4L2Input::buildElement()
-{
- GstElement *camera = gst_element_factory_make("v4l2src", "camera_source");
- if (camera && !m_device.isEmpty() )
- g_object_set(G_OBJECT(camera), "device", m_device.constData(), NULL);
-
- return camera;
-}
-
-void QGstreamerV4L2Input::setDevice(const QByteArray &newDevice)
-{
- if (m_device != newDevice) {
- m_device = newDevice;
- updateSupportedResolutions(newDevice);
- }
-}
-
-void QGstreamerV4L2Input::setDevice(const QString &device)
-{
- setDevice(QFile::encodeName(device));
-}
-
-void QGstreamerV4L2Input::updateSupportedResolutions(const QByteArray &device)
-{
- m_frameRates.clear();
- m_resolutions.clear();
- m_ratesByResolution.clear();
-
- QSet<QSize> allResolutions;
- QSet<int> allFrameRates;
-
- QFile f(device);
-
- if (!f.open(QFile::ReadOnly))
- return;
-
- int fd = f.handle();
-
- //get the list of formats:
- QList<quint32> supportedFormats;
-
- {
- v4l2_fmtdesc fmt;
- memset(&fmt, 0, sizeof(v4l2_fmtdesc));
-
- fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- int sanity = 0;
-
- for (fmt.index = 0;; fmt.index++) {
- if (sanity++ > 8)
- break;
- if( ::ioctl(fd, VIDIOC_ENUM_FMT, &fmt) == -1) {
- if(errno == EINVAL)
- break;
- }
- supportedFormats.append(fmt.pixelformat);
- }
- }
-
- QList<QSize> commonSizes;
- commonSizes << QSize(128, 96)
- <<QSize(160,120)
- <<QSize(176, 144)
- <<QSize(320, 240)
- <<QSize(352, 288)
- <<QSize(640, 480)
- <<QSize(1024, 768)
- <<QSize(1280, 1024)
- <<QSize(1600, 1200)
- <<QSize(1920, 1200)
- <<QSize(2048, 1536)
- <<QSize(2560, 1600)
- <<QSize(2580, 1936);
-
- QList<int> commonRates;
- commonRates << 05*1000 << 75*1000 << 10*1000 << 15*1000 << 20*1000
- << 24*1000 << 25*1000 << 30*1000 << 50*1000 << 60*1000;
-
-
- //get the list of resolutions:
-
- for (quint32 format : qAsConst(supportedFormats)) {
- struct v4l2_frmsizeenum formatSize;
- memset(&formatSize, 0, sizeof(formatSize));
- formatSize.pixel_format = format;
-
- QList<QSize> sizeList;
-
- if (0) {
- char formatStr[5];
- memcpy(formatStr, &format, 4);
- formatStr[4] = 0;
- //qDebug() << "trying format" << formatStr;
- }
-
- for (int i=0;;i++) {
- formatSize.index = i;
- if (ioctl (fd, VIDIOC_ENUM_FRAMESIZES, &formatSize) < 0)
- break;
-
- if (formatSize.type == V4L2_FRMSIZE_TYPE_DISCRETE) {
- sizeList.append(QSize(formatSize.discrete.width, formatSize.discrete.height));
- } else {
-
- for (const QSize& candidate : qAsConst(commonSizes)) {
- if (candidate.width() <= (int)formatSize.stepwise.max_width &&
- candidate.height() >= (int)formatSize.stepwise.min_width &&
- candidate.width() % formatSize.stepwise.step_width == 0 &&
- candidate.height() <= (int)formatSize.stepwise.max_height &&
- candidate.height() >= (int)formatSize.stepwise.min_height &&
- candidate.height() % formatSize.stepwise.step_height == 0) {
- sizeList.append(candidate);
- }
- }
-
- if (!sizeList.contains(QSize(formatSize.stepwise.min_width, formatSize.stepwise.min_height)))
- sizeList.prepend(QSize(formatSize.stepwise.min_width, formatSize.stepwise.min_height));
-
- if (!sizeList.contains(QSize(formatSize.stepwise.max_width, formatSize.stepwise.max_height)))
- sizeList.append(QSize(formatSize.stepwise.max_width, formatSize.stepwise.max_height));
-
- break; //stepwise values are returned only for index 0
- }
-
- }
-
- //and frameRates for each resolution.
-
- for (const QSize &s : qAsConst(sizeList)) {
- allResolutions.insert(s);
-
- struct v4l2_frmivalenum formatInterval;
- memset(&formatInterval, 0, sizeof(formatInterval));
- formatInterval.pixel_format = format;
- formatInterval.width = s.width();
- formatInterval.height = s.height();
-
- QList<int> frameRates; //in 1/1000 of fps
-
- for (int i=0; ; i++) {
- formatInterval.index = i;
-
- if (ioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, &formatInterval) < 0)
- break;
-
- if (formatInterval.type == V4L2_FRMIVAL_TYPE_DISCRETE) {
- //converts seconds to fps*1000
- if (formatInterval.discrete.numerator)
- frameRates.append(qRound(formatInterval.discrete.denominator*1000.0 / formatInterval.discrete.numerator));
- } else {
- if (formatInterval.stepwise.min.numerator == 0 ||
- formatInterval.stepwise.max.numerator == 0) {
- qWarning() << "received invalid frame interval";
- break;
- }
-
-
- int minRate = qRound(formatInterval.stepwise.min.denominator*1000.0 /
- formatInterval.stepwise.min.numerator);
-
- int maxRate = qRound(formatInterval.stepwise.max.denominator*1000.0 /
- formatInterval.stepwise.max.numerator);
-
-
- for (int candidate : qAsConst(commonRates)) {
- if (candidate >= minRate && candidate <= maxRate)
- frameRates.append(candidate);
- }
-
- if (!frameRates.contains(minRate))
- frameRates.prepend(minRate);
-
- if (!frameRates.contains(maxRate))
- frameRates.append(maxRate);
-
- break; //stepwise values are returned only for index 0
- }
- }
- allFrameRates.unite(frameRates.toSet());
- m_ratesByResolution[s].unite(frameRates.toSet());
- }
- }
-
- f.close();
-
- for (int rate : qAsConst(allFrameRates)) {
- m_frameRates.append(rate/1000.0);
- }
-
- std::sort(m_frameRates.begin(), m_frameRates.end());
-
- m_resolutions = allResolutions.toList();
- std::sort(m_resolutions.begin(), m_resolutions.end());
-
- //qDebug() << "frame rates:" << m_frameRates;
- //qDebug() << "resolutions:" << m_resolutions;
-}
-
-
-QList<qreal> QGstreamerV4L2Input::supportedFrameRates(const QSize &frameSize) const
-{
- if (frameSize.isEmpty())
- return m_frameRates;
- else {
- QList<qreal> res;
- const auto rates = m_ratesByResolution[frameSize];
- res.reserve(rates.size());
- for (int rate : rates) {
- res.append(rate/1000.0);
- }
- return res;
- }
-}
-
-QList<QSize> QGstreamerV4L2Input::supportedResolutions(qreal frameRate) const
-{
- Q_UNUSED(frameRate);
- return m_resolutions;
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.h b/src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.h
deleted file mode 100644
index a82c7cf4b..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.h
+++ /dev/null
@@ -1,83 +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 QGSTREAMERV4L2INPUT_H
-#define QGSTREAMERV4L2INPUT_H
-
-#include <QtCore/qhash.h>
-#include <QtCore/qbytearray.h>
-#include <QtCore/qlist.h>
-#include <QtCore/qsize.h>
-#include "qgstreamercapturesession.h"
-
-QT_BEGIN_NAMESPACE
-
-class QGstreamerV4L2Input : public QObject, public QGstreamerVideoInput
-{
- Q_OBJECT
-public:
- QGstreamerV4L2Input(QObject *parent = 0);
- virtual ~QGstreamerV4L2Input();
-
- GstElement *buildElement() override;
-
- QList<qreal> supportedFrameRates(const QSize &frameSize = QSize()) const override;
- QList<QSize> supportedResolutions(qreal frameRate = -1) const override;
-
- QByteArray device() const;
-
-public slots:
- void setDevice(const QByteArray &device);
- void setDevice(const QString &device);
-
-private:
- void updateSupportedResolutions(const QByteArray &device);
-
- QList<qreal> m_frameRates;
- QList<QSize> m_resolutions;
-
- QHash<QSize, QSet<int> > m_ratesByResolution;
-
- QByteArray m_device;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGSTREAMERV4L2INPUT_H
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.cpp b/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.cpp
deleted file mode 100644
index a2ed1d288..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.cpp
+++ /dev/null
@@ -1,296 +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 "qgstreamervideoencode.h"
-#include "qgstreamercapturesession.h"
-#include "qgstreamermediacontainercontrol.h"
-#include <private/qgstutils_p.h>
-#include <QtCore/qdebug.h>
-
-#include <math.h>
-
-QGstreamerVideoEncode::QGstreamerVideoEncode(QGstreamerCaptureSession *session)
- :QVideoEncoderSettingsControl(session), m_session(session)
- , m_codecs(QGstCodecsInfo::VideoEncoder)
-{
-}
-
-QGstreamerVideoEncode::~QGstreamerVideoEncode()
-{
-}
-
-QList<QSize> QGstreamerVideoEncode::supportedResolutions(const QVideoEncoderSettings &, bool *continuous) const
-{
- if (continuous)
- *continuous = m_session->videoInput() != 0;
-
- return m_session->videoInput() ? m_session->videoInput()->supportedResolutions() : QList<QSize>();
-}
-
-QList< qreal > QGstreamerVideoEncode::supportedFrameRates(const QVideoEncoderSettings &, bool *continuous) const
-{
- if (continuous)
- *continuous = false;
-
- return m_session->videoInput() ? m_session->videoInput()->supportedFrameRates() : QList<qreal>();
-}
-
-QStringList QGstreamerVideoEncode::supportedVideoCodecs() const
-{
- return m_codecs.supportedCodecs();
-}
-
-QString QGstreamerVideoEncode::videoCodecDescription(const QString &codecName) const
-{
- return m_codecs.codecDescription(codecName);
-}
-
-QStringList QGstreamerVideoEncode::supportedEncodingOptions(const QString &codec) const
-{
- return m_codecs.codecOptions(codec);
-}
-
-QVariant QGstreamerVideoEncode::encodingOption(const QString &codec, const QString &name) const
-{
- return m_options[codec].value(name);
-}
-
-void QGstreamerVideoEncode::setEncodingOption(
- const QString &codec, const QString &name, const QVariant &value)
-{
- m_options[codec][name] = value;
-}
-
-QVideoEncoderSettings QGstreamerVideoEncode::videoSettings() const
-{
- return m_videoSettings;
-}
-
-void QGstreamerVideoEncode::setVideoSettings(const QVideoEncoderSettings &settings)
-{
- m_videoSettings = settings;
-}
-
-GstElement *QGstreamerVideoEncode::createEncoder()
-{
- QString codec = m_videoSettings.codec();
- GstElement *encoderElement = gst_element_factory_make(m_codecs.codecElement(codec).constData(), "video-encoder");
- if (!encoderElement)
- return 0;
-
- GstBin *encoderBin = GST_BIN(gst_bin_new("video-encoder-bin"));
-
- GstElement *sinkCapsFilter = gst_element_factory_make("capsfilter", "capsfilter-video");
- GstElement *srcCapsFilter = gst_element_factory_make("capsfilter", "capsfilter-video");
- gst_bin_add_many(encoderBin, sinkCapsFilter, srcCapsFilter, NULL);
-
- GstElement *colorspace = gst_element_factory_make(QT_GSTREAMER_COLORCONVERSION_ELEMENT_NAME, NULL);
- gst_bin_add(encoderBin, colorspace);
- gst_bin_add(encoderBin, encoderElement);
-
- gst_element_link_many(sinkCapsFilter, colorspace, encoderElement, srcCapsFilter, NULL);
-
- // add ghostpads
- GstPad *pad = gst_element_get_static_pad(sinkCapsFilter, "sink");
- gst_element_add_pad(GST_ELEMENT(encoderBin), gst_ghost_pad_new("sink", pad));
- gst_object_unref(GST_OBJECT(pad));
-
- pad = gst_element_get_static_pad(srcCapsFilter, "src");
- gst_element_add_pad(GST_ELEMENT(encoderBin), gst_ghost_pad_new("src", pad));
- gst_object_unref(GST_OBJECT(pad));
-
- if (encoderElement) {
- if (m_videoSettings.encodingMode() == QMultimedia::ConstantQualityEncoding) {
- QMultimedia::EncodingQuality qualityValue = m_videoSettings.quality();
-
- if (codec == QLatin1String("video/x-h264")) {
- //constant quantizer mode
- g_object_set(G_OBJECT(encoderElement), "pass", 4, NULL);
- int qualityTable[] = {
- 50, //VeryLow
- 35, //Low
- 21, //Normal
- 15, //High
- 8 //VeryHigh
- };
- g_object_set(G_OBJECT(encoderElement), "quantizer", qualityTable[qualityValue], NULL);
- } else if (codec == QLatin1String("video/x-xvid")) {
- //constant quantizer mode
- g_object_set(G_OBJECT(encoderElement), "pass", 3, NULL);
- int qualityTable[] = {
- 32, //VeryLow
- 12, //Low
- 5, //Normal
- 3, //High
- 2 //VeryHigh
- };
- int quant = qualityTable[qualityValue];
- g_object_set(G_OBJECT(encoderElement), "quantizer", quant, NULL);
- } else if (codec.startsWith(QLatin1String("video/mpeg"))) {
- //constant quantizer mode
- g_object_set(G_OBJECT(encoderElement), "pass", 2, NULL);
- //quant from 1 to 30, default ~3
- double qualityTable[] = {
- 20, //VeryLow
- 8.0, //Low
- 3.0, //Normal
- 2.5, //High
- 2.0 //VeryHigh
- };
- double quant = qualityTable[qualityValue];
- g_object_set(G_OBJECT(encoderElement), "quantizer", quant, NULL);
- } else if (codec == QLatin1String("video/x-theora")) {
- int qualityTable[] = {
- 8, //VeryLow
- 16, //Low
- 32, //Normal
- 45, //High
- 60 //VeryHigh
- };
- //quality from 0 to 63
- int quality = qualityTable[qualityValue];
- g_object_set(G_OBJECT(encoderElement), "quality", quality, NULL);
- }
- } else {
- int bitrate = m_videoSettings.bitRate();
- if (bitrate > 0) {
- g_object_set(G_OBJECT(encoderElement), "bitrate", bitrate, NULL);
- }
- }
-
- QMap<QString,QVariant> options = m_options.value(codec);
- for (auto it = options.cbegin(), end = options.cend(); it != end; ++it) {
- const QString &option = it.key();
- const QVariant &value = it.value();
-
- switch (value.type()) {
- case QVariant::Int:
- g_object_set(G_OBJECT(encoderElement), option.toLatin1(), value.toInt(), NULL);
- break;
- case QVariant::Bool:
- g_object_set(G_OBJECT(encoderElement), option.toLatin1(), value.toBool(), NULL);
- break;
- case QVariant::Double:
- g_object_set(G_OBJECT(encoderElement), option.toLatin1(), value.toDouble(), NULL);
- break;
- case QVariant::String:
- g_object_set(G_OBJECT(encoderElement), option.toLatin1(), value.toString().toUtf8().constData(), NULL);
- break;
- default:
- qWarning() << "unsupported option type:" << option << value;
- break;
- }
-
- }
- }
-
- if (!m_videoSettings.resolution().isEmpty() || m_videoSettings.frameRate() > 0.001) {
- GstCaps *caps = QGstUtils::videoFilterCaps();
-
- if (!m_videoSettings.resolution().isEmpty()) {
- gst_caps_set_simple(
- caps,
- "width", G_TYPE_INT, m_videoSettings.resolution().width(),
- "height", G_TYPE_INT, m_videoSettings.resolution().height(),
- NULL);
- }
-
- if (m_videoSettings.frameRate() > 0.001) {
- QPair<int,int> rate = rateAsRational();
- gst_caps_set_simple(
- caps,
- "framerate", GST_TYPE_FRACTION, rate.first, rate.second,
- NULL);
- }
-
- //qDebug() << "set video caps filter:" << gst_caps_to_string(caps);
-
- g_object_set(G_OBJECT(sinkCapsFilter), "caps", caps, NULL);
-
- gst_caps_unref(caps);
- }
-
- // Some encoders support several codecs. Setting a caps filter downstream with the desired
- // codec (which is actually a string representation of the caps) will make sure we use the
- // correct codec.
- GstCaps *caps = gst_caps_from_string(codec.toUtf8().constData());
- g_object_set(G_OBJECT(srcCapsFilter), "caps", caps, NULL);
- gst_caps_unref(caps);
-
- return GST_ELEMENT(encoderBin);
-}
-
-QPair<int,int> QGstreamerVideoEncode::rateAsRational() const
-{
- qreal frameRate = m_videoSettings.frameRate();
-
- if (frameRate > 0.001) {
- //convert to rational number
- QList<int> denumCandidates;
- denumCandidates << 1 << 2 << 3 << 5 << 10 << 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>();
-}
-
-
-QSet<QString> QGstreamerVideoEncode::supportedStreamTypes(const QString &codecName) const
-{
- return m_codecs.supportedStreamTypes(codecName);
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.h b/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.h
deleted file mode 100644
index a35e2b456..000000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.h
+++ /dev/null
@@ -1,97 +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 QGSTREAMERVIDEOENCODE_H
-#define QGSTREAMERVIDEOENCODE_H
-
-#include <qvideoencodersettingscontrol.h>
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmap.h>
-#include <QtCore/qset.h>
-
-#include <private/qgstcodecsinfo_p.h>
-
-#include <gst/gst.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGstreamerCaptureSession;
-
-class QGstreamerVideoEncode : public QVideoEncoderSettingsControl
-{
- Q_OBJECT
-public:
- QGstreamerVideoEncode(QGstreamerCaptureSession *session);
- virtual ~QGstreamerVideoEncode();
-
- 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() const;
-
- QStringList supportedVideoCodecs() const override;
- QString videoCodecDescription(const QString &codecName) const override;
-
- QVideoEncoderSettings videoSettings() const override;
- void setVideoSettings(const QVideoEncoderSettings &settings) 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);
-
- GstElement *createEncoder();
-
- QSet<QString> supportedStreamTypes(const QString &codecName) const;
-
-private:
- QGstreamerCaptureSession *m_session;
-
- QGstCodecsInfo m_codecs;
-
- QVideoEncoderSettings m_videoSettings;
- QMap<QString, QMap<QString, QVariant> > m_options;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/gstreamer/mediaplayer/mediaplayer.json b/src/plugins/gstreamer/mediaplayer/mediaplayer.json
deleted file mode 100644
index bd1a7e64d..000000000
--- a/src/plugins/gstreamer/mediaplayer/mediaplayer.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "Keys": ["gstreamermediaplayer"],
- "Services": ["org.qt-project.qt.mediaplayer"]
-}
diff --git a/src/plugins/gstreamer/mediaplayer/mediaplayer.pro b/src/plugins/gstreamer/mediaplayer/mediaplayer.pro
deleted file mode 100644
index 8150d8f5b..000000000
--- a/src/plugins/gstreamer/mediaplayer/mediaplayer.pro
+++ /dev/null
@@ -1,26 +0,0 @@
-TARGET = gstmediaplayer
-
-include(../common.pri)
-
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/qgstreamerplayerservice.h \
- $$PWD/qgstreamerstreamscontrol.h \
- $$PWD/qgstreamermetadataprovider.h \
- $$PWD/qgstreameravailabilitycontrol.h \
- $$PWD/qgstreamerplayerserviceplugin.h
-
-SOURCES += \
- $$PWD/qgstreamerplayerservice.cpp \
- $$PWD/qgstreamerstreamscontrol.cpp \
- $$PWD/qgstreamermetadataprovider.cpp \
- $$PWD/qgstreameravailabilitycontrol.cpp \
- $$PWD/qgstreamerplayerserviceplugin.cpp
-
-OTHER_FILES += \
- mediaplayer.json
-
-PLUGIN_TYPE = mediaservice
-PLUGIN_CLASS_NAME = QGstreamerPlayerServicePlugin
-load(qt_plugin)
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.cpp b/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.cpp
deleted file mode 100644
index d2bfbb03a..000000000
--- a/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.cpp
+++ /dev/null
@@ -1,64 +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 "qgstreameravailabilitycontrol.h"
-#include <private/qmediaresourceset_p.h>
-
-QT_BEGIN_NAMESPACE
-
-QGStreamerAvailabilityControl::QGStreamerAvailabilityControl(
- QMediaPlayerResourceSetInterface *resources, QObject *parent)
- : QMediaAvailabilityControl(parent)
- , m_resources(resources)
-{
- Q_ASSERT(m_resources);
- connect(m_resources, SIGNAL(availabilityChanged(bool)), this, SLOT(handleAvailabilityChanged()));
-}
-
-void QGStreamerAvailabilityControl::handleAvailabilityChanged()
-{
- emit availabilityChanged(this->availability());
-}
-
-QMultimedia::AvailabilityStatus QGStreamerAvailabilityControl::availability() const
-{
- return m_resources->isAvailable() ? QMultimedia::Available : QMultimedia::Busy;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.h b/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.h
deleted file mode 100644
index e100fccc8..000000000
--- a/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.h
+++ /dev/null
@@ -1,65 +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 QGSTREAMERAVAILABILITYCONTROL_H
-#define QGSTREAMERAVAILABILITYCONTROL_H
-
-#include <QObject>
-#include <qmediaavailabilitycontrol.h>
-
-QT_BEGIN_NAMESPACE
-
-class QMediaPlayerResourceSetInterface;
-class QGStreamerAvailabilityControl : public QMediaAvailabilityControl
-{
- Q_OBJECT
-public:
- QGStreamerAvailabilityControl(QMediaPlayerResourceSetInterface *resources, QObject *parent = 0);
- QMultimedia::AvailabilityStatus availability() const override;
-
-private Q_SLOTS:
- void handleAvailabilityChanged();
-
-private:
- QMediaPlayerResourceSetInterface *m_resources = nullptr;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGSTREAMERAVAILABILITYCONTROL_H
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp
deleted file mode 100644
index bd503d3a1..000000000
--- a/src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp
+++ /dev/null
@@ -1,190 +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 "qgstreamermetadataprovider.h"
-#include <private/qgstreamerplayersession_p.h>
-#include <QDebug>
-#include <QtMultimedia/qmediametadata.h>
-
-#include <gst/gstversion.h>
-#include <private/qgstutils_p.h>
-
-QT_BEGIN_NAMESPACE
-
-typedef QMap<QByteArray, QString> QGstreamerMetaDataKeyLookup;
-Q_GLOBAL_STATIC(QGstreamerMetaDataKeyLookup, metadataKeys)
-
-static const QGstreamerMetaDataKeyLookup *qt_gstreamerMetaDataKeys()
-{
- if (metadataKeys->isEmpty()) {
- metadataKeys->insert(GST_TAG_TITLE, QMediaMetaData::Title);
- //metadataKeys->insert(0, QMediaMetaData::SubTitle);
- //metadataKeys->insert(0, QMediaMetaData::Author);
- metadataKeys->insert(GST_TAG_COMMENT, QMediaMetaData::Comment);
- metadataKeys->insert(GST_TAG_DESCRIPTION, QMediaMetaData::Description);
- //metadataKeys->insert(0, QMediaMetaData::Category);
- metadataKeys->insert(GST_TAG_GENRE, QMediaMetaData::Genre);
- metadataKeys->insert("year", QMediaMetaData::Year);
- //metadataKeys->insert(0, QMediaMetaData::UserRating);
-
- metadataKeys->insert(GST_TAG_LANGUAGE_CODE, QMediaMetaData::Language);
-
- metadataKeys->insert(GST_TAG_ORGANIZATION, QMediaMetaData::Publisher);
- metadataKeys->insert(GST_TAG_COPYRIGHT, QMediaMetaData::Copyright);
- //metadataKeys->insert(0, QMediaMetaData::ParentalRating);
- //metadataKeys->insert(0, QMediaMetaData::RatingOrganisation);
-
- // Media
- //metadataKeys->insert(0, QMediaMetaData::Size);
- //metadataKeys->insert(0,QMediaMetaData::MediaType );
- metadataKeys->insert(GST_TAG_DURATION, QMediaMetaData::Duration);
-
- // Audio
- metadataKeys->insert(GST_TAG_BITRATE, QMediaMetaData::AudioBitRate);
- metadataKeys->insert(GST_TAG_AUDIO_CODEC, QMediaMetaData::AudioCodec);
- //metadataKeys->insert(0, QMediaMetaData::ChannelCount);
- //metadataKeys->insert(0, QMediaMetaData::SampleRate);
-
- // Music
- metadataKeys->insert(GST_TAG_ALBUM, QMediaMetaData::AlbumTitle);
-#if GST_CHECK_VERSION(0, 10, 25)
- metadataKeys->insert(GST_TAG_ALBUM_ARTIST, QMediaMetaData::AlbumArtist);
-#endif
- metadataKeys->insert(GST_TAG_ARTIST, QMediaMetaData::ContributingArtist);
- //metadataKeys->insert(0, QMediaMetaData::Conductor);
- //metadataKeys->insert(0, QMediaMetaData::Lyrics);
- //metadataKeys->insert(0, QMediaMetaData::Mood);
- metadataKeys->insert(GST_TAG_TRACK_NUMBER, QMediaMetaData::TrackNumber);
-
- //metadataKeys->insert(0, QMediaMetaData::CoverArtUrlSmall);
- //metadataKeys->insert(0, QMediaMetaData::CoverArtUrlLarge);
- metadataKeys->insert(GST_TAG_PREVIEW_IMAGE, QMediaMetaData::ThumbnailImage);
- metadataKeys->insert(GST_TAG_IMAGE, QMediaMetaData::CoverArtImage);
-
- // Image/Video
- metadataKeys->insert("resolution", QMediaMetaData::Resolution);
- metadataKeys->insert("pixel-aspect-ratio", QMediaMetaData::PixelAspectRatio);
-#if GST_CHECK_VERSION(0,10,30)
- metadataKeys->insert(GST_TAG_IMAGE_ORIENTATION, QMediaMetaData::Orientation);
-#endif
-
- // Video
- //metadataKeys->insert(0, QMediaMetaData::VideoFrameRate);
- //metadataKeys->insert(0, QMediaMetaData::VideoBitRate);
- metadataKeys->insert(GST_TAG_VIDEO_CODEC, QMediaMetaData::VideoCodec);
-
- //metadataKeys->insert(0, QMediaMetaData::PosterUrl);
-
- // Movie
- //metadataKeys->insert(0, QMediaMetaData::ChapterNumber);
- //metadataKeys->insert(0, QMediaMetaData::Director);
- metadataKeys->insert(GST_TAG_PERFORMER, QMediaMetaData::LeadPerformer);
- //metadataKeys->insert(0, QMediaMetaData::Writer);
-
- // Photos
- //metadataKeys->insert(0, QMediaMetaData::CameraManufacturer);
- //metadataKeys->insert(0, QMediaMetaData::CameraModel);
- //metadataKeys->insert(0, QMediaMetaData::Event);
- //metadataKeys->insert(0, QMediaMetaData::Subject);
- }
-
- return metadataKeys;
-}
-
-QGstreamerMetaDataProvider::QGstreamerMetaDataProvider(QGstreamerPlayerSession *session, QObject *parent)
- :QMetaDataReaderControl(parent), m_session(session)
-{
- connect(m_session, SIGNAL(tagsChanged()), SLOT(updateTags()));
-}
-
-QGstreamerMetaDataProvider::~QGstreamerMetaDataProvider()
-{
-}
-
-bool QGstreamerMetaDataProvider::isMetaDataAvailable() const
-{
- return !m_session->tags().isEmpty();
-}
-
-bool QGstreamerMetaDataProvider::isWritable() const
-{
- return false;
-}
-
-QVariant QGstreamerMetaDataProvider::metaData(const QString &key) const
-{
-#if GST_CHECK_VERSION(0,10,30)
- if (key == QMediaMetaData::Orientation)
- return QGstUtils::fromGStreamerOrientation(m_tags.value(key));
-#endif
- return m_tags.value(key);
-}
-
-QStringList QGstreamerMetaDataProvider::availableMetaData() const
-{
- return m_tags.keys();
-}
-
-void QGstreamerMetaDataProvider::updateTags()
-{
- QVariantMap oldTags = m_tags;
- m_tags.clear();
- bool changed = false;
-
- const auto tags = m_session->tags();
- for (auto i = tags.cbegin(), end = tags.cend(); i != end; ++i) {
- //use gstreamer native keys for elements not in our key map
- QString key = qt_gstreamerMetaDataKeys()->value(i.key(), i.key());
- m_tags.insert(key, i.value());
- if (i.value() != oldTags.value(key)) {
- changed = true;
- emit metaDataChanged(key, i.value());
- }
- }
-
- if (oldTags.isEmpty() != m_tags.isEmpty()) {
- emit metaDataAvailableChanged(isMetaDataAvailable());
- changed = true;
- }
-
- if (changed)
- emit metaDataChanged();
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.h b/src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.h
deleted file mode 100644
index 691453a42..000000000
--- a/src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.h
+++ /dev/null
@@ -1,72 +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 QGSTREAMERMETADATAPROVIDER_H
-#define QGSTREAMERMETADATAPROVIDER_H
-
-#include <qmetadatareadercontrol.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGstreamerPlayerSession;
-
-class QGstreamerMetaDataProvider : public QMetaDataReaderControl
-{
- Q_OBJECT
-public:
- QGstreamerMetaDataProvider( QGstreamerPlayerSession *session, QObject *parent );
- virtual ~QGstreamerMetaDataProvider();
-
- bool isMetaDataAvailable() const override;
- bool isWritable() const;
-
- QVariant metaData(const QString &key) const override;
- QStringList availableMetaData() const override;
-
-private slots:
- void updateTags();
-
-private:
- QGstreamerPlayerSession *m_session = nullptr;
- QVariantMap m_tags;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGSTREAMERMETADATAPROVIDER_H
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp
deleted file mode 100644
index 4bf4a0a57..000000000
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp
+++ /dev/null
@@ -1,193 +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 <QtCore/qvariant.h>
-#include <QtCore/qdebug.h>
-
-#if defined(HAVE_WIDGETS)
-#include <QtWidgets/qwidget.h>
-#endif
-
-#include "qgstreamerplayerservice.h"
-#include "qgstreamermetadataprovider.h"
-#include "qgstreameravailabilitycontrol.h"
-
-#if defined(HAVE_WIDGETS)
-#include <private/qgstreamervideowidget_p.h>
-#endif
-#include <private/qgstreamervideowindow_p.h>
-#include <private/qgstreamervideorenderer_p.h>
-
-#include "qgstreamerstreamscontrol.h"
-#include <private/qgstreameraudioprobecontrol_p.h>
-#include <private/qgstreamervideoprobecontrol_p.h>
-#include <private/qgstreamerplayersession_p.h>
-#include <private/qgstreamerplayercontrol_p.h>
-
-#include <private/qmediaplaylistnavigator_p.h>
-#include <qmediaplaylist.h>
-#include <private/qmediaresourceset_p.h>
-
-QT_BEGIN_NAMESPACE
-
-QGstreamerPlayerService::QGstreamerPlayerService(QObject *parent)
- : QMediaService(parent)
-{
- m_session = new QGstreamerPlayerSession(this);
- m_control = new QGstreamerPlayerControl(m_session, this);
- m_metaData = new QGstreamerMetaDataProvider(m_session, this);
- m_streamsControl = new QGstreamerStreamsControl(m_session,this);
- m_availabilityControl = new QGStreamerAvailabilityControl(m_control->resources(), this);
- 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_videoWidget = 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_videoWidget->videoSink()) {
- delete m_videoWidget;
- m_videoWidget = 0;
- }
-#endif
-}
-
-QGstreamerPlayerService::~QGstreamerPlayerService()
-{
-}
-
-QMediaControl *QGstreamerPlayerService::requestControl(const char *name)
-{
- if (qstrcmp(name,QMediaPlayerControl_iid) == 0)
- return m_control;
-
- if (qstrcmp(name,QMetaDataReaderControl_iid) == 0)
- return m_metaData;
-
- if (qstrcmp(name,QMediaStreamsControl_iid) == 0)
- return m_streamsControl;
-
- if (qstrcmp(name, QMediaAvailabilityControl_iid) == 0)
- return m_availabilityControl;
-
- if (qstrcmp(name, QMediaVideoProbeControl_iid) == 0) {
- if (!m_videoProbeControl) {
- increaseVideoRef();
- m_videoProbeControl = new QGstreamerVideoProbeControl(this);
- m_session->addProbe(m_videoProbeControl);
- }
- m_videoProbeControl->ref.ref();
- return m_videoProbeControl;
- }
-
- if (qstrcmp(name, QMediaAudioProbeControl_iid) == 0) {
- if (!m_audioProbeControl) {
- m_audioProbeControl = new QGstreamerAudioProbeControl(this);
- m_session->addProbe(m_audioProbeControl);
- }
- m_audioProbeControl->ref.ref();
- return m_audioProbeControl;
- }
-
- 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_videoWidget;
-#endif
-
- if (m_videoOutput) {
- increaseVideoRef();
- m_control->setVideoOutput(m_videoOutput);
- return m_videoOutput;
- }
- }
-
- return 0;
-}
-
-void QGstreamerPlayerService::releaseControl(QMediaControl *control)
-{
- if (!control) {
- return;
- } else if (control == m_videoOutput) {
- m_videoOutput = 0;
- m_control->setVideoOutput(0);
- decreaseVideoRef();
- } else if (control == m_videoProbeControl && !m_videoProbeControl->ref.deref()) {
- m_session->removeProbe(m_videoProbeControl);
- delete m_videoProbeControl;
- m_videoProbeControl = 0;
- decreaseVideoRef();
- } else if (control == m_audioProbeControl && !m_audioProbeControl->ref.deref()) {
- m_session->removeProbe(m_audioProbeControl);
- delete m_audioProbeControl;
- m_audioProbeControl = 0;
- }
-}
-
-void QGstreamerPlayerService::increaseVideoRef()
-{
- m_videoReferenceCount++;
- if (m_videoReferenceCount == 1) {
- m_control->resources()->setVideoEnabled(true);
- }
-}
-
-void QGstreamerPlayerService::decreaseVideoRef()
-{
- m_videoReferenceCount--;
- if (m_videoReferenceCount == 0) {
- m_control->resources()->setVideoEnabled(false);
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h
deleted file mode 100644
index f88f0ae38..000000000
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h
+++ /dev/null
@@ -1,99 +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 QGSTREAMERPLAYERSERVICE_H
-#define QGSTREAMERPLAYERSERVICE_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qiodevice.h>
-
-#include <qmediaservice.h>
-
-QT_BEGIN_NAMESPACE
-class QMediaPlayerControl;
-class QMediaPlaylist;
-class QMediaPlaylistNavigator;
-
-class QGstreamerMetaData;
-class QGstreamerPlayerControl;
-class QGstreamerPlayerSession;
-class QGstreamerMetaDataProvider;
-class QGstreamerStreamsControl;
-class QGstreamerVideoRenderer;
-class QGstreamerVideoWindow;
-class QGstreamerVideoWidgetControl;
-class QGStreamerAvailabilityControl;
-class QGstreamerAudioProbeControl;
-class QGstreamerVideoProbeControl;
-
-class QGstreamerPlayerService : public QMediaService
-{
- Q_OBJECT
-public:
- QGstreamerPlayerService(QObject *parent = 0);
- ~QGstreamerPlayerService();
-
- QMediaControl *requestControl(const char *name) override;
- void releaseControl(QMediaControl *control) override;
-
-private:
- QGstreamerPlayerControl *m_control = nullptr;
- QGstreamerPlayerSession *m_session = nullptr;
- QGstreamerMetaDataProvider *m_metaData = nullptr;
- QGstreamerStreamsControl *m_streamsControl = nullptr;
- QGStreamerAvailabilityControl *m_availabilityControl = nullptr;
-
- QGstreamerAudioProbeControl *m_audioProbeControl = nullptr;
- QGstreamerVideoProbeControl *m_videoProbeControl = nullptr;
-
- QMediaControl *m_videoOutput = nullptr;
- QMediaControl *m_videoRenderer = nullptr;
- QGstreamerVideoWindow *m_videoWindow = nullptr;
-#if defined(HAVE_WIDGETS)
- QGstreamerVideoWidgetControl *m_videoWidget = nullptr;
-#endif
-
- void increaseVideoRef();
- void decreaseVideoRef();
- int m_videoReferenceCount = 0;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp
deleted file mode 100644
index db266a10e..000000000
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp
+++ /dev/null
@@ -1,113 +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 <QtCore/qstring.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/QDir>
-#include <QtCore/QDebug>
-
-#include "qgstreamerplayerserviceplugin.h"
-
-//#define QT_SUPPORTEDMIMETYPES_DEBUG
-
-#include "qgstreamerplayerservice.h"
-#include <private/qgstutils_p.h>
-
-QMediaService* QGstreamerPlayerServicePlugin::create(const QString &key)
-{
- QGstUtils::initializeGst();
-
- if (key == QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER))
- return new QGstreamerPlayerService;
-
- qWarning() << "Gstreamer service plugin: unsupported key:" << key;
- return 0;
-}
-
-void QGstreamerPlayerServicePlugin::release(QMediaService *service)
-{
- delete service;
-}
-
-QMediaServiceProviderHint::Features QGstreamerPlayerServicePlugin::supportedFeatures(
- const QByteArray &service) const
-{
- if (service == Q_MEDIASERVICE_MEDIAPLAYER)
- return
-#if QT_CONFIG(gstreamer_app)
- QMediaServiceProviderHint::StreamPlayback |
-#endif
- QMediaServiceProviderHint::VideoSurface;
- else
- return QMediaServiceProviderHint::Features();
-}
-
-QMultimedia::SupportEstimate QGstreamerPlayerServicePlugin::hasSupport(const QString &mimeType,
- const QStringList &codecs) const
-{
- if (m_supportedMimeTypeSet.isEmpty())
- updateSupportedMimeTypes();
-
- return QGstUtils::hasSupport(mimeType, codecs, m_supportedMimeTypeSet);
-}
-
-static bool isDecoderOrDemuxer(GstElementFactory *factory)
-{
-#if GST_CHECK_VERSION(0, 10 ,31)
- return gst_element_factory_list_is_type(factory, GST_ELEMENT_FACTORY_TYPE_DEMUXER)
- || gst_element_factory_list_is_type(factory, GST_ELEMENT_FACTORY_TYPE_DECODER);
-#else
- return (factory
- && (qstrcmp(factory->details.klass, "Codec/Decoder/Audio") == 0
- || qstrcmp(factory->details.klass, "Codec/Decoder/Video") == 0
- || qstrcmp(factory->details.klass, "Codec/Demux") == 0 ));
-#endif
-}
-
-void QGstreamerPlayerServicePlugin::updateSupportedMimeTypes() const
-{
- m_supportedMimeTypeSet = QGstUtils::supportedMimeTypes(isDecoderOrDemuxer);
-}
-
-QStringList QGstreamerPlayerServicePlugin::supportedMimeTypes() const
-{
- return QStringList();
-}
-
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.h b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.h
deleted file mode 100644
index 71eece23e..000000000
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.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 QGSTREAMERPLAYERSERVICEPLUGIN_H
-#define QGSTREAMERPLAYERSERVICEPLUGIN_H
-
-#include <qmediaserviceproviderplugin.h>
-#include <QtCore/qset.h>
-#include <QtCore/QObject>
-
-QT_BEGIN_NAMESPACE
-
-
-class QGstreamerPlayerServicePlugin
- : public QMediaServiceProviderPlugin
- , public QMediaServiceFeaturesInterface
- , public QMediaServiceSupportedFormatsInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaServiceFeaturesInterface)
- Q_INTERFACES(QMediaServiceSupportedFormatsInterface)
- Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "mediaplayer.json")
-public:
- QMediaService* create(const QString &key) override;
- void release(QMediaService *service) override;
-
- QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const override;
-
- QMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList &codecs) const override;
- QStringList supportedMimeTypes() const override;
-
-private:
- void updateSupportedMimeTypes() const;
-
- mutable QSet<QString> m_supportedMimeTypeSet; //for fast access
-};
-
-QT_END_NAMESPACE
-
-#endif // QGSTREAMERPLAYERSERVICEPLUGIN_H
-
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.cpp
deleted file mode 100644
index 4f5c3f0b2..000000000
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.cpp
+++ /dev/null
@@ -1,87 +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 "qgstreamerstreamscontrol.h"
-#include <private/qgstreamerplayersession_p.h>
-
-QGstreamerStreamsControl::QGstreamerStreamsControl(QGstreamerPlayerSession *session, QObject *parent)
- :QMediaStreamsControl(parent), m_session(session)
-{
- connect(m_session, SIGNAL(streamsChanged()), SIGNAL(streamsChanged()));
-}
-
-QGstreamerStreamsControl::~QGstreamerStreamsControl()
-{
-}
-
-int QGstreamerStreamsControl::streamCount()
-{
- return m_session->streamCount();
-}
-
-QMediaStreamsControl::StreamType QGstreamerStreamsControl::streamType(int streamNumber)
-{
- return m_session->streamType(streamNumber);
-}
-
-QVariant QGstreamerStreamsControl::metaData(int streamNumber, const QString &key)
-{
- return m_session->streamProperties(streamNumber).value(key);
-}
-
-bool QGstreamerStreamsControl::isActive(int streamNumber)
-{
- return streamNumber != -1 && streamNumber == m_session->activeStream(streamType(streamNumber));
-}
-
-void QGstreamerStreamsControl::setActive(int streamNumber, bool state)
-{
- QMediaStreamsControl::StreamType type = m_session->streamType(streamNumber);
- if (type == QMediaStreamsControl::UnknownStream)
- return;
-
- if (state)
- m_session->setActiveStream(type, streamNumber);
- else {
- //only one active stream of certain type is supported
- if (m_session->activeStream(type) == streamNumber)
- m_session->setActiveStream(type, -1);
- }
-}
-
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.h b/src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.h
deleted file mode 100644
index 41932095c..000000000
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.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 QGSTREAMERSTREAMSCONTROL_H
-#define QGSTREAMERSTREAMSCONTROL_H
-
-#include <qmediastreamscontrol.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGstreamerPlayerSession;
-
-class QGstreamerStreamsControl : public QMediaStreamsControl
-{
- Q_OBJECT
-public:
- QGstreamerStreamsControl(QGstreamerPlayerSession *session, QObject *parent);
- virtual ~QGstreamerStreamsControl();
-
- int streamCount() override;
- StreamType streamType(int streamNumber) override;
-
- QVariant metaData(int streamNumber, const QString &key) override;
-
- bool isActive(int streamNumber) override;
- void setActive(int streamNumber, bool state) override;
-
-private:
- QGstreamerPlayerSession *m_session = nullptr;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGSTREAMERSTREAMSCONTROL_H
-