Qmmp
abstractengine.h
1 /***************************************************************************
2  * Copyright (C) 2009-2021 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 
35 
39 class QMMP_EXPORT AbstractEngine : public QThread
40 {
41  Q_OBJECT
42 public:
47  AbstractEngine(QObject *parent = nullptr);
51  virtual ~AbstractEngine();
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 EngineFactory *findByFilePath(const QString &path);
102  static void setEnabled(EngineFactory *factory, bool enable = true);
108  static bool isEnabled(const EngineFactory *factory);
113  static bool isEnabled(const AbstractEngine *engine);
118  static QString file(const EngineFactory *factory);
123  static QStringList protocols();
124 
125 protected:
129  QMutex *mutex();
130 
131 private:
132  QMutex m_mutex;
133  static void loadPlugins();
134  static QList<QmmpPluginCache*> *m_cache;
135  static QStringList m_disabledNames;
136 };
137 
138 
139 #endif // ABSTRACTENGINE_H
The InputSource class provides the base interface class of transports.
Definition: inputsource.h:38
The AbstractEngine class provides the base interface class of audio audio engines.
Definition: abstractengine.h:39
Engine plugin interface.
Definition: enginefactory.h:54