[112] | 1 | /* smplayer, GUI front-end for mplayer.
|
---|
[188] | 2 | Copyright (C) 2006-2017 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
[112] | 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 |
|
---|
[176] | 20 | #ifndef INFOREADER_H
|
---|
| 21 | #define INFOREADER_H
|
---|
[112] | 22 |
|
---|
| 23 | #include <QObject>
|
---|
| 24 | #include <QList>
|
---|
[176] | 25 | #include <QStringList>
|
---|
| 26 | #include "config.h"
|
---|
[112] | 27 |
|
---|
| 28 | class InfoData {
|
---|
| 29 |
|
---|
| 30 | public:
|
---|
| 31 | InfoData() {};
|
---|
| 32 | InfoData( QString name, QString desc) {
|
---|
| 33 | _name = name;
|
---|
| 34 | _desc = desc;
|
---|
| 35 | };
|
---|
| 36 | ~InfoData() {};
|
---|
| 37 |
|
---|
| 38 | void setName(QString name) { _name = name; };
|
---|
| 39 | void setDesc(QString desc) { _desc = desc; };
|
---|
| 40 |
|
---|
[176] | 41 | QString name() const { return _name; };
|
---|
| 42 | QString desc() const { return _desc; };
|
---|
[112] | 43 |
|
---|
[176] | 44 | bool operator<(const InfoData & other) const {
|
---|
| 45 | return name() < other.name();
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | bool operator==(const InfoData & other) const {
|
---|
| 49 | return name() == other.name();
|
---|
| 50 | }
|
---|
| 51 |
|
---|
[112] | 52 | private:
|
---|
| 53 | QString _name, _desc;
|
---|
| 54 | };
|
---|
| 55 |
|
---|
| 56 |
|
---|
| 57 | typedef QList<InfoData> InfoList;
|
---|
| 58 |
|
---|
| 59 |
|
---|
| 60 | class InfoReader : QObject {
|
---|
| 61 | Q_OBJECT
|
---|
| 62 |
|
---|
| 63 | public:
|
---|
| 64 | InfoReader( QString mplayer_bin, QObject * parent = 0 );
|
---|
| 65 | ~InfoReader();
|
---|
| 66 |
|
---|
[176] | 67 | void setPlayerBin(const QString & bin);
|
---|
| 68 | QString playerBin() { return mplayerbin; }
|
---|
| 69 |
|
---|
[112] | 70 | void getInfo();
|
---|
| 71 |
|
---|
| 72 | InfoList voList() { return vo_list; };
|
---|
| 73 | InfoList aoList() { return ao_list; };
|
---|
[176] | 74 |
|
---|
| 75 | #if ALLOW_DEMUXER_CODEC_CHANGE
|
---|
[112] | 76 | InfoList demuxerList() { return demuxer_list; };
|
---|
| 77 | InfoList vcList() { return vc_list; };
|
---|
| 78 | InfoList acList() { return ac_list; };
|
---|
[176] | 79 | #endif
|
---|
| 80 | QStringList vfList() { return vf_list; };
|
---|
| 81 | QStringList optionList() { return option_list; };
|
---|
[112] | 82 |
|
---|
[176] | 83 | int mplayerSVN() { return mplayer_svn; };
|
---|
| 84 | QString mpvVersion() { return mpv_version; };
|
---|
| 85 | QString mplayer2Version() { return mplayer2_version; };
|
---|
| 86 | bool isMplayer2() { return is_mplayer2; };
|
---|
| 87 | bool isMPV() { return is_mpv; };
|
---|
[112] | 88 |
|
---|
[176] | 89 | QString playerVersion();
|
---|
[112] | 90 |
|
---|
[176] | 91 | //! Returns an InfoReader object. If it didn't exist before, one
|
---|
| 92 | //! is created.
|
---|
| 93 | static InfoReader * obj(const QString & mplayer_bin = QString::null);
|
---|
[112] | 94 |
|
---|
| 95 | protected:
|
---|
| 96 | QString mplayerbin;
|
---|
| 97 |
|
---|
| 98 | InfoList vo_list;
|
---|
| 99 | InfoList ao_list;
|
---|
[176] | 100 |
|
---|
| 101 | #if ALLOW_DEMUXER_CODEC_CHANGE
|
---|
[112] | 102 | InfoList demuxer_list;
|
---|
| 103 | InfoList vc_list;
|
---|
| 104 | InfoList ac_list;
|
---|
[176] | 105 | #endif
|
---|
| 106 | QStringList vf_list;
|
---|
| 107 | QStringList option_list;
|
---|
[112] | 108 |
|
---|
| 109 | int mplayer_svn;
|
---|
[176] | 110 | QString mpv_version;
|
---|
| 111 | QString mplayer2_version;
|
---|
| 112 | bool is_mplayer2, is_mpv;
|
---|
[112] | 113 |
|
---|
| 114 | private:
|
---|
| 115 | static InfoReader * static_obj;
|
---|
[176] | 116 | static QStringList convertInfoListToList(InfoList l);
|
---|
| 117 | static InfoList convertListToInfoList(QStringList l);
|
---|
[112] | 118 | };
|
---|
| 119 |
|
---|
| 120 | #endif
|
---|