File indexing completed on 2024-05-12 05:46:54

0001 /*
0002  *  Copyright 2016  Andreas Cord-Landwehr <cordlandwehr@kde.org>
0003  *
0004  *  This library is free software; you can redistribute it and/or modify
0005  *  it under the terms of the GNU Lesser General Public License as published
0006  *  by the Free Software Foundation; either version 2.1 of the License, or
0007  *  (at your option) any later version.
0008  *
0009  *  This program is distributed in the hope that it will be useful,
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *  GNU Lesser General Public License for more details.
0013  *
0014  *  You should have received a copy of the GNU Lesser General Public License
0015  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0016  */
0017 
0018 #include "qtgstreamerbackend.h"
0019 #include "qtgstreamercapturebackend.h"
0020 #include "qtgstreameroutputbackend.h"
0021 #include <KPluginFactory>
0022 
0023 K_PLUGIN_FACTORY_WITH_JSON(BackendFactory, "qtgstreamerbackend.json", registerPlugin<QtGStreamerBackend>();)
0024 
0025 QtGStreamerBackend::QtGStreamerBackend(QObject *parent, const QList<QVariant> &)
0026     : BackendInterface("qtgstreamer", parent)
0027     , m_captureBackend(nullptr)
0028     , m_outputBackend(nullptr)
0029 {
0030 }
0031 
0032 QtGStreamerBackend::~QtGStreamerBackend()
0033 {
0034     if (m_captureBackend) {
0035         m_captureBackend->deleteLater();
0036         m_captureBackend = nullptr;
0037     }
0038     if (m_outputBackend) {
0039         m_outputBackend->deleteLater();
0040         m_outputBackend = nullptr;
0041     }
0042 }
0043 
0044 CaptureBackendInterface *QtGStreamerBackend::captureBackend() const
0045 {
0046     if (!m_captureBackend) {
0047         m_captureBackend = new QtGStreamerCaptureBackend();
0048     }
0049     return m_captureBackend;
0050 }
0051 
0052 OutputBackendInterface *QtGStreamerBackend::outputBackend() const
0053 {
0054     if (!m_outputBackend) {
0055         m_outputBackend = new QtGStreamerOutputBackend();
0056     }
0057     return m_outputBackend;
0058 }
0059 
0060 #include "qtgstreamerbackend.moc"