Qmmp
/usr/src/RPM/BUILD/qmmp-0.8-svn/src/qmmp/inputsource.h
00001 /***************************************************************************
00002  *   Copyright (C) 2009-2013 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 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
 All Classes Functions Variables Enumerations Enumerator