写了一个简单的test,在linux环境下编译qt4.4之后,用相应的qmake等生成makefile,代码如下:
#include <QApplication>
#include <videoplayer.h>
#include <QtGui>
#include <QtCore>
int main( int argc,char* argv[] )
{
QApplication app( argc,argv );
Phonon::VideoPlayer *player = new Phonon::VideoPlayer(Phonon::VideoCategory, 0);
QObject::connect(player, SIGNAL(finished()), player, SLOT(deleteLater()));
player->play(Phonon::MediaSource( "/home/guoqing/demo-episode1_cropped.avi" ));
player->show();
return app.exec();
}
运行是有一个warning:WARNING: Phonon needs QCoreApplication::applicationName to be set to export audio output names through the DBUS interface
只能播放出第一帧图像出来,而且没有声音