source: smplayer/trunk/src/infoprovider.cpp@ 181

Last change on this file since 181 was 181, checked in by Silvan Scherrer, 9 years ago

smplayer: update trunk to version 16.8.0

  • Property svn:eol-style set to LF
File size: 2.0 KB
Line 
1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2016 Ricardo Villalba <rvm@users.sourceforge.net>
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 "infoprovider.h"
20#include "global.h"
21#include "preferences.h"
22#include "playerprocess.h"
23#include "playerid.h"
24#include <QFileInfo>
25
26MediaData InfoProvider::getInfo(QString mplayer_bin, QString filename) {
27 qDebug("InfoProvider::getInfo: %s", filename.toUtf8().data());
28
29 QFileInfo fi(mplayer_bin);
30 if (fi.exists() && fi.isExecutable() && !fi.isDir()) {
31 mplayer_bin = fi.absoluteFilePath();
32 }
33
34 PlayerProcess * proc = PlayerProcess::createPlayerProcess(mplayer_bin, 0);
35
36 proc->setExecutable(mplayer_bin);
37 proc->setFixedOptions();
38 QString nframes = "1";
39 if (proc->isMPlayer()) nframes = "0";
40 proc->setOption("frames", nframes);
41 proc->setOption("vo", "null");
42 proc->setOption("ao", "null");
43 #ifdef Q_OS_WIN
44 proc->setOption("fontconfig", false);
45 #endif
46 proc->setMedia(filename);
47
48 QString commandline = proc->arguments().join(" ");
49 qDebug("InfoProvider::getInfo: command: '%s'", commandline.toUtf8().data());
50
51 proc->start();
52 if (!proc->waitForFinished()) {
53 qWarning("InfoProvider::getInfo: process didn't finish. Killing it...");
54 proc->kill();
55 }
56
57 MediaData md = proc->mediaData();
58 delete proc;
59
60 return md;
61}
62
63MediaData InfoProvider::getInfo(QString filename) {
64 return getInfo( Global::pref->mplayer_bin, filename );
65}
Note: See TracBrowser for help on using the repository browser.