diff options
Diffstat (limited to 'src/multimedia/platform/gstreamer')
8 files changed, 12 insertions, 189 deletions
diff --git a/src/multimedia/platform/gstreamer/mediacapture/mediacapture.pri b/src/multimedia/platform/gstreamer/mediacapture/mediacapture.pri index 3f3b10f2c..81d77cf6c 100644 --- a/src/multimedia/platform/gstreamer/mediacapture/mediacapture.pri +++ b/src/multimedia/platform/gstreamer/mediacapture/mediacapture.pri @@ -5,14 +5,12 @@ HEADERS += $$PWD/qgstreamercaptureservice_p.h \ $$PWD/qgstreamerrecordercontrol_p.h \ $$PWD/qgstreamercameracontrol_p.h \ $$PWD/qgstreamerimagecapturecontrol_p.h \ - $$PWD/qgstreamervideoinput_p.h SOURCES += $$PWD/qgstreamercaptureservice.cpp \ $$PWD/qgstreamercapturesession.cpp \ $$PWD/qgstreamerrecordercontrol.cpp \ $$PWD/qgstreamercameracontrol.cpp \ $$PWD/qgstreamerimagecapturecontrol.cpp \ - $$PWD/qgstreamervideoinput.cpp # Camera usage with gstreamer needs to have CONFIG += use_gstreamer_camera diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameracontrol.cpp b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameracontrol.cpp index 87d432b3e..93e4f77ed 100644 --- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameracontrol.cpp +++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameracontrol.cpp @@ -39,7 +39,6 @@ #include "qgstreamercameracontrol_p.h" #include "qgstreamerimagecapturecontrol_p.h" -#include "qgstreamervideoinput_p.h" #include <qcamerainfo.h> @@ -132,7 +131,8 @@ void QGstreamerCameraControl::setState(QCamera::State state) void QGstreamerCameraControl::setCamera(const QCameraInfo &camera) { - m_session->videoInput()->setDevice(camera); + m_session->setVideoDevice(camera); + reloadLater(); } QCamera::State QGstreamerCameraControl::state() const diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice.cpp b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice.cpp index 56ba1da3e..6a8815e66 100644 --- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice.cpp +++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice.cpp @@ -43,10 +43,6 @@ #include "qgstreamercameracontrol_p.h" #include <private/qgstreamerbushelper_p.h> -#if defined(USE_GSTREAMER_CAMERA) -#include "qgstreamervideoinput_p.h" -#endif - #include "qgstreamerimagecapturecontrol_p.h" #include <private/qgstreamervideorenderer_p.h> @@ -58,14 +54,9 @@ QGstreamerCaptureService::QGstreamerCaptureService(QMediaRecorder::CaptureMode m { if (mode == QMediaRecorder::AudioOnly) { m_captureSession = new QGstreamerCaptureSession(QGstreamerCaptureSession::Audio, this); - } - -#if defined(USE_GSTREAMER_CAMERA) - else { + } else { m_captureSession = new QGstreamerCaptureSession(QGstreamerCaptureSession::AudioAndVideo, this); m_cameraControl = new QGstreamerCameraControl(m_captureSession); - m_videoInput = new QGstreamerVideoInput; - m_captureSession->setVideoInput(m_videoInput); m_videoRenderer = new QGstreamerVideoRenderer(this); @@ -77,12 +68,10 @@ QGstreamerCaptureService::QGstreamerCaptureService(QMediaRecorder::CaptureMode m m_videoWindow = 0; } } -#endif } QGstreamerCaptureService::~QGstreamerCaptureService() { - delete m_videoInput; } QObject *QGstreamerCaptureService::requestControl(const char *name) diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice_p.h b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice_p.h index f3848c8c3..238716681 100644 --- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice_p.h +++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice_p.h @@ -82,9 +82,6 @@ private: QGstreamerCaptureSession *m_captureSession = nullptr; QGstreamerCameraControl *m_cameraControl = nullptr; -#if defined(USE_GSTREAMER_CAMERA) - QGstreamerVideoInput *m_videoInput = nullptr; -#endif QObject *m_videoOutput = nullptr; diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession.cpp b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession.cpp index 45ed2afba..f8eb1c5c8 100644 --- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession.cpp +++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession.cpp @@ -40,7 +40,7 @@ #include "qgstreamercapturesession_p.h" #include "qgstreamerrecordercontrol_p.h" #include "qgstreamerimagecapturecontrol_p.h" -#include "qgstreamervideoinput_p.h" +#include "private/qgstreamerdevicemanager_p.h" #include <qmediarecorder.h> #include <qmediadevicemanager.h> #include <private/qgstreamervideorendererinterface_p.h> @@ -71,7 +71,6 @@ QGstreamerCaptureSession::QGstreamerCaptureSession(QGstreamerCaptureSession::Cap m_waitingForEos(false), m_pipelineMode(EmptyPipeline), m_captureMode(captureMode), - m_videoInputFactory(0), m_viewfinder(0), m_viewfinderInterface(0), m_audioSrc(0), @@ -272,14 +271,12 @@ GstElement *QGstreamerCaptureSession::buildAudioPreview() GstElement *QGstreamerCaptureSession::buildVideoSrc() { - GstElement *videoSrc = 0; - if (m_videoInputFactory) { - videoSrc = m_videoInputFactory->buildElement(); - } else { - videoSrc = gst_element_factory_make("videotestsrc", "video_test_src"); - } + if (m_camera.isNull()) + return nullptr; - return videoSrc; + auto *deviceManager = static_cast<QGstreamerDeviceManager *>(QGstreamerIntegration::instance()->deviceManager()); + auto *device = deviceManager->videoDevice(m_camera.id()); + return gst_device_create_element(device, "camerasrc"); } GstElement *QGstreamerCaptureSession::buildVideoPreview() @@ -705,11 +702,6 @@ bool QGstreamerCaptureSession::setOutputLocation(const QUrl& sink) return true; } -void QGstreamerCaptureSession::setVideoInput(QGstreamerVideoInput *videoInput) -{ - m_videoInputFactory = videoInput; -} - void QGstreamerCaptureSession::setVideoPreview(QObject *viewfinder) { m_viewfinderInterface = qobject_cast<QGstreamerVideoRendererInterface*>(viewfinder); diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession_p.h b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession_p.h index eb8c3a3bd..bcb786ab2 100644 --- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession_p.h +++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession_p.h @@ -54,6 +54,7 @@ #include <qmediarecordercontrol.h> #include <qmediarecorder.h> #include <qaudiodeviceinfo.h> +#include <qcamerainfo.h> #include <QtCore/qmutex.h> #include <QtCore/qurl.h> @@ -109,8 +110,7 @@ public: QGstreamerRecorderControl *recorderControl() const { return m_recorderControl; } - QGstreamerVideoInput *videoInput() const { return m_videoInputFactory; } - void setVideoInput(QGstreamerVideoInput *videoInput); + void setVideoDevice(const QCameraInfo &camera) { m_camera = camera; } QObject *videoPreview() const { return m_viewfinder; } void setVideoPreview(QObject *viewfinder); @@ -169,6 +169,7 @@ private: bool rebuildGraph(QGstreamerCaptureSession::PipelineMode newMode); QAudioDeviceInfo m_audioDevice; + QCameraInfo m_camera; QUrl m_sink; State m_state; State m_pendingState; @@ -177,7 +178,6 @@ private: QGstreamerCaptureSession::CaptureMode m_captureMode; QGstreamerMetaData m_metaData; - QGstreamerVideoInput *m_videoInputFactory; QObject *m_viewfinder; QGstreamerVideoRendererInterface *m_viewfinderInterface; diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamervideoinput.cpp b/src/multimedia/platform/gstreamer/mediacapture/qgstreamervideoinput.cpp deleted file mode 100644 index 0f87339df..000000000 --- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamervideoinput.cpp +++ /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$ -** -****************************************************************************/ - -#include "qgstreamervideoinput_p.h" - -#include <QtCore/qdebug.h> -#include <QtCore/qfile.h> - -#include <private/qgstreamerintegration_p.h> -#include <private/qgstreamerdevicemanager_p.h> -#include <private/qgstutils_p.h> -#include <algorithm> - -QGstreamerVideoInput::QGstreamerVideoInput() -{ -} - -QGstreamerVideoInput::~QGstreamerVideoInput() -{ -} - -GstElement *QGstreamerVideoInput::buildElement() -{ - auto *deviceManager = static_cast<QGstreamerDeviceManager *>(QGstreamerIntegration::instance()->deviceManager()); - GstDevice *videoDevice = deviceManager->videoDevice(m_cameraInfo.id()); - return gst_device_create_element(videoDevice, "camerasrc"); -} - -void QGstreamerVideoInput::setDevice(const QCameraInfo &newDevice) -{ - if (m_cameraInfo != newDevice) - m_cameraInfo = newDevice; -} diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamervideoinput_p.h b/src/multimedia/platform/gstreamer/mediacapture/qgstreamervideoinput_p.h deleted file mode 100644 index 07f5ce166..000000000 --- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamervideoinput_p.h +++ /dev/null @@ -1,84 +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 QGSTREAMERVIDEOINPUT_H -#define QGSTREAMERVIDEOINPUT_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtCore/qhash.h> -#include <QtCore/qbytearray.h> -#include <QtCore/qlist.h> -#include <QtCore/qsize.h> -#include <qcamerainfo.h> - -#include "qgstreamercapturesession_p.h" - -QT_BEGIN_NAMESPACE - -class QGstreamerVideoInput -{ -public: - QGstreamerVideoInput(); - virtual ~QGstreamerVideoInput(); - - GstElement *buildElement() override; - - QCameraInfo device() const { return m_cameraInfo; } - void setDevice(const QCameraInfo &device); - -private: - QCameraInfo m_cameraInfo; - - QHash<QSize, QSet<int> > m_ratesByResolution; -}; - -QT_END_NAMESPACE - -#endif // QGSTREAMERVIDEOINPUT_H |