source: smplayer/vendor/0.6.9/src/inforeader.cpp@ 154

Last change on this file since 154 was 90, checked in by Silvan Scherrer, 16 years ago

smplayer: import 0.6.9

File size: 7.3 KB
Line 
1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2010 Ricardo Villalba <[email protected]>
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#include "inforeader.h"
20#include <QStringList>
21#include <QApplication>
22#include <QRegExp>
23
24#include "colorutils.h"
25#include "global.h"
26#include "preferences.h"
27#include "mplayerversion.h"
28
29#if USE_QPROCESS
30#include <QProcess>
31#else
32#include "myprocess.h"
33#endif
34
35using namespace Global;
36
37#define NOME 0
38#define VO 1
39#define AO 2
40#define DEMUXER 3
41#define VC 4
42#define AC 5
43
44InfoReader * InfoReader::static_obj = 0;
45
46InfoReader * InfoReader::obj() {
47 if (!static_obj) {
48 static_obj = new InfoReader( pref->mplayer_bin );
49 static_obj->getInfo();
50 }
51 return static_obj;
52}
53
54InfoReader::InfoReader( QString mplayer_bin, QObject * parent )
55 : QObject(parent)
56{
57 mplayerbin = mplayer_bin;
58
59#if USE_QPROCESS
60 proc = new QProcess(this);
61 proc->setProcessChannelMode( QProcess::MergedChannels );
62#else
63 proc = new MyProcess(this);
64
65 connect( proc, SIGNAL(lineAvailable(QByteArray)),
66 this, SLOT(readLine(QByteArray)) );
67#endif
68}
69
70InfoReader::~InfoReader() {
71}
72
73void InfoReader::getInfo() {
74 waiting_for_key = TRUE;
75 vo_list.clear();
76 ao_list.clear();
77 demuxer_list.clear();
78 mplayer_svn = -1;
79
80 run("-identify -vo help -ao help -demuxer help -vc help -ac help");
81
82 //list();
83}
84
85void InfoReader::list() {
86 qDebug("InfoReader::list");
87
88 InfoList::iterator it;
89
90 qDebug(" vo_list:");
91 for ( it = vo_list.begin(); it != vo_list.end(); ++it ) {
92 qDebug( "driver: '%s', desc: '%s'", (*it).name().toUtf8().data(), (*it).desc().toUtf8().data());
93 }
94
95 qDebug(" ao_list:");
96 for ( it = ao_list.begin(); it != ao_list.end(); ++it ) {
97 qDebug( "driver: '%s', desc: '%s'", (*it).name().toUtf8().data(), (*it).desc().toUtf8().data());
98 }