PDA

View Full Version : Playing MP3 with Qt/Phonon libs



tcampos
9th May 2012, 11:36
Hi there,

I've been trying to play MP3 files using simply:


Phonon::MediaObject *music =
Phonon::createPlayer(Phonon::MusicCategory,
Phonon::MediaSource("file.mp3"));
music->play();

I'm getting these linker errors:


1>app.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Phonon::MediaObject::play(void)" (__imp_?play@MediaObject@Phonon@@QAEXXZ) referenced in function "public: __thiscall app::app(class QWidget *,class QFlags<enum Qt::WindowType>)" (??0app@@QAE@PAVQWidget@@V?$QFlags@W4WindowType@Qt @@@@@Z)
1>app.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Phonon::MediaSource::~MediaSource(void)" (__imp_??1MediaSource@Phonon@@QAE@XZ) referenced in function "public: __thiscall app::app(class QWidget *,class QFlags<enum Qt::WindowType>)" (??0app@@QAE@PAVQWidget@@V?$QFlags@W4WindowType@Qt @@@@@Z)
1>app.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class Phonon::MediaObject * __cdecl Phonon::createPlayer(enum Phonon::Category,class Phonon::MediaSource const &)" (__imp_?createPlayer@Phonon@@YAPAVMediaObject@1@W4 Category@1@ABVMediaSource@1@@Z) referenced in function "public: __thiscall app::app(class QWidget *,class QFlags<enum Qt::WindowType>)" (??0app@@QAE@PAVQWidget@@V?$QFlags@W4WindowType@Qt @@@@@Z)
1>app.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Phonon::MediaSource::MediaSource(class QString const &)" (__imp_??0MediaSource@Phonon@@QAE@ABVQString@@@Z) referenced in function "public: __thiscall app::app(class QWidget *,class QFlags<enum Qt::WindowType>)" (??0app@@QAE@PAVQWidget@@V?$QFlags@W4WindowType@Qt @@@@@Z)

When I try to build the Phonon example applications that come with the Qt source, I cannot build the capabilities example. The qmusicplayer is compiled but does not really opens the audio files, returning the following message:

WARNING: bool __thiscall Phonon::FactoryPrivate::createBackend(void) phonon backend plugin could not be loaded

I've built Qt static with MSVC2010. Do you have any idea why is this happening?
Do you recommend any other way to play MP3 using other libs or something else...?

Thanks for your help.