| 1 | /* smplayer, GUI front-end for mplayer.
|
|---|
| 2 | Copyright (C) 2006-2010 Ricardo Villalba <rvm@escomposlinux.org>
|
|---|
| 3 |
|
|---|
| 4 | This program is free software; you can redistribute it and/or modify
|
|---|
| 5 | it under the terms of the GNU General Public License as published by
|
|---|
| 6 | the Free Software Foundation; either version 2 of the License, or
|
|---|
| 7 | (at your option) any later version.
|
|---|
| 8 |
|
|---|
| 9 | This program is distributed in the hope that it will be useful,
|
|---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 12 | GNU General Public License for more details.
|
|---|
| 13 |
|
|---|
| 14 | You should have received a copy of the GNU General Public License
|
|---|
| 15 | along with this program; if not, write to the Free Software
|
|---|
| 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 17 | */
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 | #ifndef _INFOREADER_H_
|
|---|
| 21 | #define _INFOREADER_H_
|
|---|
| 22 |
|
|---|
| 23 | #include <QObject>
|
|---|
| 24 | #include <QList>
|
|---|
| 25 |
|
|---|
| 26 | #define USE_QPROCESS 1
|
|---|
| 27 |
|
|---|
| 28 | #if USE_QPROCESS
|
|---|
| 29 | class QProcess;
|
|---|
| 30 | #else
|
|---|
| 31 | class MyProcess;
|
|---|
| 32 | #endif
|
|---|
| 33 |
|
|---|
| 34 | class InfoData {
|
|---|
| 35 |
|
|---|
| 36 | public:
|
|---|
| 37 | InfoData() {};
|
|---|
| 38 | InfoData( QString name, QString desc) {
|
|---|
| 39 | _name = name;
|
|---|
| 40 | _desc = desc;
|
|---|
| 41 | };
|
|---|
| 42 | ~InfoData() {};
|
|---|
| 43 |
|
|---|
| 44 | void setName(QString name) { _name = name; };
|
|---|
| 45 | void setDesc(QString desc) { _desc = desc; };
|
|---|
| 46 |
|
|---|
| 47 | QString name() { return _name; };
|
|---|
| 48 | QString desc() { return _desc; };
|
|---|
| 49 |
|
|---|
| 50 | private:
|
|---|
| 51 | QString _name, _desc;
|
|---|
| 52 | };
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 | typedef QList<InfoData> InfoList;
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 | class InfoReader : QObject {
|
|---|
| 59 | Q_OBJECT
|
|---|
| 60 |
|
|---|
| 61 | public:
|
|---|
| 62 | InfoReader( QString mplayer_bin, QObject * parent = 0 );
|
|---|
| 63 | ~InfoReader();
|
|---|
| 64 |
|
|---|
| 65 | void getInfo();
|
|---|
| 66 |
|
|---|
| 67 | InfoList voList() { return vo_list; };
|
|---|
| 68 | InfoList aoList() { return ao_list; };
|
|---|
| 69 | InfoList demuxerList() { return demuxer_list; };
|
|---|
| 70 | InfoList vcList() { return vc_list; };
|
|---|
| 71 | InfoList acList() { return ac_list; };
|
|---|
| 72 |
|
|---|
| 73 | int mplayerVersion() { return mplayer_svn; };
|
|---|
| 74 |
|
|---|
| 75 | //! Returns an InfoReader objects. If it didn't exist before, one
|
|---|
| 76 | //! is created and getInfo() is called.
|
|---|
| 77 | static InfoReader * obj();
|
|---|
| 78 |
|
|---|
| 79 | protected slots:
|
|---|
| 80 | virtual void readLine(QByteArray);
|
|---|
| 81 |
|
|---|
| 82 | protected:
|
|---|
| 83 | bool run(QString options);
|
|---|
| 84 | void list();
|
|---|
| 85 |
|
|---|
| 86 | protected:
|
|---|
| 87 | #if USE_QPROCESS
|
|---|
| 88 | QProcess * proc;
|
|---|
| 89 | #else
|
|---|
| 90 | MyProcess * proc;
|
|---|
| 91 | #endif
|
|---|
| 92 | QString mplayerbin;
|
|---|
| 93 |
|
|---|
| 94 | InfoList vo_list;
|
|---|
| 95 | InfoList ao_list;
|
|---|
| 96 | InfoList demuxer_list;
|
|---|
| 97 | InfoList vc_list;
|
|---|
| 98 | InfoList ac_list;
|
|---|
| 99 |
|
|---|
| 100 | int mplayer_svn;
|
|---|
| 101 |
|
|---|
| 102 | private:
|
|---|
| 103 | bool waiting_for_key;
|
|---|
| 104 | int reading_type;
|
|---|
| 105 |
|
|---|
| 106 | static InfoReader * static_obj;
|
|---|
| 107 | };
|
|---|
| 108 |
|
|---|
| 109 | #endif
|
|---|