0

I want sound output at the 3.5mm ear phone connector. It works with any application (mplayer, aplay, ...) and even with gstreamer (gst-launch-1.0 filesrc location=test.mp3 ! mad ! audioconvert ! alsasink)

QMediaPlayer runs properly (no error messages from the (qt-)plugins) and I get positionChanged(qint64) signaling while playing the sound file.

QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
qDebug() << "deviceName " << info.deviceName();
qDebug() << " supportedCodecs" << info.supportedCodecs();

for(int i=0; i < info.availableDevices(QAudio::AudioOutput).size(); i++)
{
  qDebug() << "out" << info.availableDevices(QAudio::AudioOutput).at(i).deviceName() << "----"
           << info.availableDevices(QAudio::AudioOutput).at(i).supportedCodecs() <<
            info.availableDevices(QAudio::AudioOutput).at(i).supportedSampleRates();
}

mMediaPlayer = new QMediaPlayer(this/*, QMediaPlayer::LowLatency*/);
mMediaPlaylist = new QMediaPlaylist(mMediaPlayer);
mMediaPlayer->setMedia(QUrl::fromLocalFile("/mnt/music/test.wav"));
mMediaPlayer->play();
mMediaPlayer->setVolume(100);
qDebug() << "state:" << mMediaPlayer->state();

Output after GST_DEBUG=3,alsa:5 ./prog:

deviceName  ""
supportedCodecs ()
state: QMediaPlayer::PlayingState

What is going wrong here? Has anybody a working configuration? I have spend a lot of time figuring out the problem (last kernel 4.1(?) and Qt5.4 had already the same issue).

Thanks

  • you can analyze whats going on with usage of `GST_DEBUG=3,alsa:5` env variable.. you need to check which output was choosed for alsasink or so.. – nayana May 24 '16 at 09:59
  • thanks for the response, but how do I enable this debug output? I tried it with export and by prepending it my executable. No output. Don't know if debug output is possible with the standard buildroot setup. – darth small May 26 '16 at 12:27
  • can you add code where you run QMediaPlayer? exporting is fine.. or you can just run `GST_DEBUG=4 ./your_app` .. if its using Gstreamer the debug logs will be definitely outputed to stderr/stdout (I do not remember).. check ldd if there are some gst libraries `ldd ./your_app | grep gst` - I hope that its linked directly (not some runtime Qt magic..) – nayana May 26 '16 at 14:11
  • I tried it one again, no gstreamer debug output on the Pi. My Laptop spits out the debug log and the sound is playing (with same source code). I will try to recompile gstreamer manually to enable debug output. – darth small May 28 '16 at 20:11
  • little more info but no solution [here](https://forum.qt.io/topic/31676/raspberry-qt5-play-mp3-problem/11) - they say there that the GStreamer is not detected by Qt on RPI for some reason.. IMHO you may have to crosscompile Qt with some flag enabling GStreamer.. also check [this](http://stackoverflow.com/questions/18609597/qtmultimedia-compilation-for-raspberry-pi).. also check gst-omx which speed-up decoding/enc.. – nayana May 30 '16 at 06:39

0 Answers0