TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
abstractengine.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2009-2024 by Ilya Kotov *
3  * forkotov02@ya.ru *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 
21 #ifndef ABSTRACTENGINE_H
22 #define ABSTRACTENGINE_H
23 
24 #include <QMutex>
25 #include <QThread>
26 #include <QStringList>
27 #include "enginefactory.h"
28 #include "qmmpsettings.h"
29 
30 class QIODevice;
31 class InputSource;
32 class QmmpPluginCache;
33 class EngineFactory;
34 
38 class QMMP_EXPORT AbstractEngine : public QThread
39 {
40  Q_OBJECT
41 public:
46  explicit AbstractEngine(QObject *parent = nullptr);
50  virtual ~AbstractEngine() = default;
51 
56  virtual bool enqueue(InputSource *source) = 0;
61  virtual bool play() = 0;
65  virtual void seek(qint64 time) = 0;
69  virtual void stop() = 0;
73  virtual void pause() = 0;
80  static AbstractEngine *create(InputSource *s, QObject *parent = nullptr);
84  static QList<EngineFactory*> factories();
88  static QList<EngineFactory*> enabledFactories();
92  static QStringList nameFilters();
96  static QStringList contentTypes();
100  static EngineFactory *findByFilePath(const QString &path);
106  static void setEnabled(EngineFactory *factory, bool enable = true);
112  static bool isEnabled(const EngineFactory *factory);
117  static bool isEnabled(const AbstractEngine *engine);
122  static QString file(const EngineFactory *factory);
127  static QStringList protocols();
128 
129 protected:
133  QMutex *mutex();
134 
135 private:
136  QMutex m_mutex;
137  static void loadPlugins();
138  static QList<QmmpPluginCache*> *m_cache;
139  static QStringList m_disabledNames;
140 
141 };
142 
143 #endif
The InputSource class provides the base interface class of transports.
Definition: inputsource.h:35
static QStringList m_disabledNames
The AbstractEngine class provides the base interface class of audio audio engines.
#define QMMP_EXPORT
Definition: qmmp_export.h:29
Engine plugin interface.
Definition: enginefactory.h:51
static QList< QmmpPluginCache * > * m_cache