summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-12-15 17:24:21 +0100
committerLars Knoll <lars.knoll@qt.io>2021-01-20 15:11:26 +0000
commit3fcc619cb4300e2e07b3615b0b887938532c22cc (patch)
treec82b97737e9a6c141692744ec43c8763d8b8b461 /src/plugins
parent1aceb4feb8ffab96773d919fa49408af8dc24e12 (diff)
Clean up playlist handling
Remove the whole plugin infrastructure and all the complexity that came with it and some other architectural decisions. Change-Id: I86bc2f1a5bddf5ba90881990c5cf49463d12ed65 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp1
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h1
-rw-r--r--src/plugins/m3u/m3u.json3
-rw-r--r--src/plugins/m3u/m3u.pro12
-rw-r--r--src/plugins/m3u/qm3uhandler.cpp229
-rw-r--r--src/plugins/m3u/qm3uhandler.h68
-rw-r--r--src/plugins/plugins.pro2
7 files changed, 0 insertions, 316 deletions
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp
index 320d6801c..1e3eec554 100644
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp
+++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp
@@ -60,7 +60,6 @@
#include <private/qgstreamerplayersession_p.h>
#include <private/qgstreamerplayercontrol_p.h>
-#include <private/qmediaplaylistnavigator_p.h>
#include <qmediaplaylist.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h
index 3d4923d93..f95ebc658 100644
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h
+++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h
@@ -48,7 +48,6 @@
QT_BEGIN_NAMESPACE
class QMediaPlayerControl;
class QMediaPlaylist;
-class QMediaPlaylistNavigator;
class QGstreamerMetaData;
class QGstreamerPlayerControl;
diff --git a/src/plugins/m3u/m3u.json b/src/plugins/m3u/m3u.json
deleted file mode 100644
index 2d69fab8e..000000000
--- a/src/plugins/m3u/m3u.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "Keys": ["m3u"]
-}
diff --git a/src/plugins/m3u/m3u.pro b/src/plugins/m3u/m3u.pro
deleted file mode 100644
index d46911e0d..000000000
--- a/src/plugins/m3u/m3u.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TARGET = qtmultimedia_m3u
-QT += multimedia-private
-
-HEADERS += qm3uhandler.h
-SOURCES += qm3uhandler.cpp
-
-OTHER_FILES += \
- m3u.json
-
-PLUGIN_TYPE = playlistformats
-PLUGIN_CLASS_NAME = QM3uPlaylistPlugin
-load(qt_plugin)
diff --git a/src/plugins/m3u/qm3uhandler.cpp b/src/plugins/m3u/qm3uhandler.cpp
deleted file mode 100644
index b88e3e292..000000000
--- a/src/plugins/m3u/qm3uhandler.cpp
+++ /dev/null
@@ -1,229 +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 "qm3uhandler.h"
-#include <QtCore/qiodevice.h>
-#include <QtCore/qfileinfo.h>
-#include <QtCore/qtextstream.h>
-#include <QFile>
-#include <QUrl>
-
-
-class QM3uPlaylistReader : public QMediaPlaylistReader
-{
-public:
- QM3uPlaylistReader(QIODevice *device)
- :m_ownDevice(false), m_device(device), m_textStream(new QTextStream(m_device))
- {
- readItem();
- }
-
- QM3uPlaylistReader(const QUrl& location)
- :m_location(location), m_ownDevice(true)
- {
- QFile *f = new QFile(location.toLocalFile());
- if (f->open(QIODevice::ReadOnly | QIODevice::Text)) {
- m_device = f;
- m_textStream = new QTextStream(m_device);
- readItem();
- } else {
- delete f;
- m_device = 0;
- m_textStream = 0;
- }
- }
-
- virtual ~QM3uPlaylistReader()
- {
- if (m_ownDevice) {
- delete m_device;
- }
- delete m_textStream;
- }
-
- bool atEnd() const override
- {
- //we can't just use m_textStream->atEnd(),
- //for files with empty lines/comments at end
- return nextResource.isNull();
- }
-
- QMediaContent readItem() override
- {
- QMediaContent item;
- if (!nextResource.isNull())
- item = QMediaContent(nextResource);
-
- nextResource = QMediaContent();
-
- while (m_textStream && !m_textStream->atEnd()) {
- QString line = m_textStream->readLine().trimmed();
- if (line.isEmpty() || line[0] == '#' || line.size() > 4096)
- continue;
-
- QUrl fileUrl = QUrl::fromLocalFile(line);
- QUrl url(line);
-
- //m3u may contain url encoded entries or absolute/relative file names
- //prefer existing file if any
- QList<QUrl> candidates;
- if (!m_location.isEmpty()) {
- candidates << m_location.resolved(fileUrl);
- candidates << m_location.resolved(url);
- }
- candidates << fileUrl;
- candidates << url;
-
- for (const QUrl &candidate : qAsConst(candidates)) {
- if (QFile::exists(candidate.toLocalFile())) {
- nextResource = candidate;
- break;
- }
- }
-
- if (nextResource.isNull()) {
- //assume the relative urls are file names, not encoded urls if m3u is local file
- if (!m_location.isEmpty() && url.isRelative()) {
- if (m_location.scheme() == QLatin1String("file"))
- nextResource = m_location.resolved(fileUrl);
- else
- nextResource = m_location.resolved(url);
- } else {
- nextResource = QMediaContent(QUrl::fromUserInput(line));
- }
- }
-
- break;
- }
-
- return item;
- }
-
- void close() override
- {
- }
-
-private:
- QUrl m_location;
- bool m_ownDevice;
- QIODevice *m_device;
- QTextStream *m_textStream;
- QMediaContent nextResource;
-};
-
-class QM3uPlaylistWriter : public QMediaPlaylistWriter
-{
-public:
- QM3uPlaylistWriter(QIODevice *device)
- :m_device(device), m_textStream(new QTextStream(m_device))
- {
- }
-
- virtual ~QM3uPlaylistWriter()
- {
- delete m_textStream;
- }
-
- bool writeItem(const QMediaContent& item) override
- {
- *m_textStream << item.request().url().toString() << Qt::endl;
- return true;
- }
-
- void close() override
- {
- }
-
-private:
- QIODevice *m_device;
- QTextStream *m_textStream;
-};
-
-
-QM3uPlaylistPlugin::QM3uPlaylistPlugin(QObject *parent)
- :QMediaPlaylistIOPlugin(parent)
-{
-}
-
-QM3uPlaylistPlugin::~QM3uPlaylistPlugin()
-{
-}
-
-bool QM3uPlaylistPlugin::canRead(QIODevice *device, const QByteArray &format) const
-{
- return device->isReadable() && (format == "m3u" || format == "m3u8" || format.isEmpty());
-}
-
-bool QM3uPlaylistPlugin::canRead(const QUrl& location, const QByteArray &format) const
-{
- if (!QFileInfo(location.toLocalFile()).isReadable())
- return false;
-
- if (format == "m3u" || format == "m3u8")
- return true;
-
- if (!format.isEmpty())
- return false;
- QString localFile = location.toLocalFile().toLower();
- return localFile.endsWith(QLatin1String("m3u")) || localFile.endsWith(QLatin1String("m3u8"));
-}
-
-bool QM3uPlaylistPlugin::canWrite(QIODevice *device, const QByteArray &format) const
-{
- return device->isOpen() && device->isWritable() && (format == "m3u" || format == "m3u8");
-}
-
-QMediaPlaylistReader *QM3uPlaylistPlugin::createReader(QIODevice *device, const QByteArray &format)
-{
- Q_UNUSED(format);
- return new QM3uPlaylistReader(device);
-}
-
-QMediaPlaylistReader *QM3uPlaylistPlugin::createReader(const QUrl& location, const QByteArray &format)
-{
- Q_UNUSED(format);
- return new QM3uPlaylistReader(location);
-}
-
-QMediaPlaylistWriter *QM3uPlaylistPlugin::createWriter(QIODevice *device, const QByteArray &format)
-{
- Q_UNUSED(format);
- return new QM3uPlaylistWriter(device);
-}
-
diff --git a/src/plugins/m3u/qm3uhandler.h b/src/plugins/m3u/qm3uhandler.h
deleted file mode 100644
index 1bc0684d3..000000000
--- a/src/plugins/m3u/qm3uhandler.h
+++ /dev/null
@@ -1,68 +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 QM3UHANDLER_H
-#define QM3UHANDLER_H
-
-#include <private/qmediaplaylistioplugin_p.h>
-#include <QtCore/QObject>
-
-QT_USE_NAMESPACE
-
-class QM3uPlaylistPlugin : public QMediaPlaylistIOPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaplaylistio/5.0" FILE "m3u.json")
-
-public:
- explicit QM3uPlaylistPlugin(QObject *parent = 0);
- virtual ~QM3uPlaylistPlugin();
-
- bool canRead(QIODevice *device, const QByteArray &format = QByteArray()) const override;
- bool canRead(const QUrl& location, const QByteArray &format = QByteArray()) const override;
-
- bool canWrite(QIODevice *device, const QByteArray &format) const override;
-
- QMediaPlaylistReader *createReader(QIODevice *device, const QByteArray &format = QByteArray()) override;
- QMediaPlaylistReader *createReader(const QUrl& location, const QByteArray &format = QByteArray()) override;
-
- QMediaPlaylistWriter *createWriter(QIODevice *device, const QByteArray &format) override;
-};
-
-#endif // QM3UHANDLER_H
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 94592f013..6ddc58e7d 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -7,8 +7,6 @@
TEMPLATE = subdirs
QT_FOR_CONFIG += multimedia-private
-SUBDIRS += m3u
-
qtHaveModule(quick) {
SUBDIRS += videonode
}