Qmmp
|
00001 /*************************************************************************** 00002 * Copyright (C) 2009-2012 by Ilya Kotov * 00003 * forkotov02@hotmail.ru * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 00019 ***************************************************************************/ 00020 00021 #ifndef ABSTRACTENGINE_H 00022 #define ABSTRACTENGINE_H 00023 00024 #include <QMutex> 00025 //#include <QWaitCondition> 00026 #include <QThread> 00027 #include <QStringList> 00028 #include "enginefactory.h" 00029 #include "qmmpsettings.h" 00030 00031 class QIODevice; 00032 class InputSource; 00033 00034 00038 class AbstractEngine : public QThread 00039 { 00040 Q_OBJECT 00041 public: 00046 AbstractEngine(QObject *parent = 0); 00051 virtual bool enqueue(InputSource *source) = 0; 00056 virtual qint64 totalTime() = 0; 00061 virtual bool play() = 0; 00065 virtual void seek(qint64 time) = 0; 00069 virtual void stop() = 0; 00073 virtual void pause() = 0; 00077 QMutex *mutex(); 00084 static AbstractEngine *create(InputSource *s, QObject *parent = 0); 00088 static QList<EngineFactory*> *factories(); 00092 static EngineFactory *findByPath(const QString &path); 00098 static void setEnabled(EngineFactory* factory, bool enable = true); 00103 static bool isEnabled(EngineFactory* factory); 00108 static QString file(EngineFactory *factory); 00113 static QStringList protocols(); 00114 00115 private: 00116 QMutex m_mutex; 00117 static void checkFactories(); 00118 static QList<EngineFactory*> *m_factories; 00119 static QList<EngineFactory*> *m_disabledFactories; 00120 static QHash <EngineFactory*, QString> *m_files; 00121 }; 00122 00123 00124 #endif // ABSTRACTENGINE_H