Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to play mp3 file
In order to play mp3 files with QAudioOutput what should I install?
Currently only wav files are played.
I'm talking about a linux embedded environment. I cannot find in the doc which libraries it needs. I tried to install gstreamer 0.1 but it doesn't work.
With Qt 4, you need to use a 3rd party library to decode your MP3 files into raw PCM format. Once you have your audio in PCM format, you can pass it into QAudioOutput. Try http://www.mpg123.de/
Or, if you use Qt 5, QMediaPlayer can play MP3 files directly on Linux. All you need to do is install codecs on your system.
I'm using Qt5.2 and I've already have installed mpg123.
Whenever I try to play anything with QMediaPlayer I got the following warning and no audio:
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
Perhaps I miss something but I can't figure out...
What distro are you using? How did you install Qt 5?
I compiled a custom buildroot image.
Where might I find what QtMediaPlayer requires in order to work?
Did you build Qt 5 yourself too?
QMediaPlayer uses GStreamer 0.1 as the audio backend on Linux. You need to install GStreamer dev libraries, with the relevant GStreamer plugins for decoding MP3 data.
Buildroot compiled Qt5 for me ;-)
I included gstremer libraries but I'm afraid not the -dev ones. I will double check for this.
I can't find the correct package in buildroot to enable the support for QMediaPlayer!
Where did you get your custom buildroot from?
git clone git://git.buildroot.net/buildroot
and then I configured it using make nconfig.
Do you know what package(s) I need to add?
Looks like a neat project. I've never seen it or used it before unfortunately, so I don't have an exact solution.
But in general. you need GStreamer 0.1, plus a GStreamer MP3 decoding plugin. You need to make sure GStreamer (the dev libraries) is installed BEFORE you compile Qt.
If you need more help, perhaps the Buildroot developers/community know more details.
I've already written to the buildroot mailing list - still no answers on this topic. Thank you anyway,