00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef INPUTSOURCE_H
00022 #define INPUTSOURCE_H
00023
00024 #include <QObject>
00025 #include <QString>
00026 #include <QStringList>
00027 #include <QIODevice>
00028 #include <QMap>
00029 #include <QHash>
00030 #include "qmmp.h"
00031 #include "inputsourcefactory.h"
00032
00033 class QmmpPluginCache;
00034
00038 class InputSource : public QObject
00039 {
00040 Q_OBJECT
00041 public:
00047 InputSource(const QString &url, QObject *parent = 0);
00052 virtual QIODevice *ioDevice() = 0;
00057 virtual bool initialize() = 0;
00061 virtual bool isReady() = 0;
00067 virtual bool isWaiting();
00071 virtual QString contentType() const;
00075 const QString url() const;
00079 qint64 offset() const;
00083 void setOffset(qint64 offset);
00089 void addMetaData(const QMap<Qmmp::MetaData, QString> &metaData);
00093 bool hasMetaData() const;
00098 QMap<Qmmp::MetaData, QString> takeMetaData();
00104 void addStreamInfo(const QHash<QString, QString> &info);
00108 bool hasStreamInfo() const;
00113 QHash<QString, QString> takeStreamInfo();
00120 static InputSource *create(const QString &url, QObject *parent = 0);
00124 static QList<InputSourceFactory *> factories();
00128 static QList<InputSourceFactory *> enabledFactories();
00133 static QString file(InputSourceFactory *factory);
00137 static QStringList protocols();
00143 static void setEnabled(InputSourceFactory* factory, bool enable = true);
00148 static bool isEnabled(InputSourceFactory* factory);
00149
00150 signals:
00154 void ready();
00158 void error();
00159
00160 private:
00161 QString m_url;
00162 qint64 m_offset;
00163 QMap<Qmmp::MetaData, QString> m_metaData;
00164 QHash<QString, QString> m_streamInfo;
00165 bool m_hasMetaData, m_hasStreamInfo;
00166 static void loadPlugins();
00167 static QList<QmmpPluginCache*> *m_cache;
00168 static QStringList m_disabledNames;
00169 };
00170
00171 #endif // INPUTSOURCE_H