Qt5.6 Playing .wav file

  • I'm trying, without success, to use QAudio/QMediaPlayer to play .wav file on a board based on Atmel's SAMA5D2. Running Qt multimedia example 'audiooutput', just opens a GUI and print null device error to the serial console.

    The error messages are:
    If using QAudio - null device found.
    If using QMediaPlayer - no service found for - "org.qt-project.qt.mediaplayer".

    From the command-line there is no problem to play the same .wav file by using 'aplay' or 'tinyplay' command, so it's not an hardware problem.

    Technical details:
    Qt version: 5.6.2
    Driver: wm8523
    Installed packages (among others): qt5multimedia, gstreamer, alsa

    Any suggestions how can I play a .wav file with Qt5? Maybe add phonon package?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You should start your application with the QT_DEBUG_PLUGINS environment variable set to 1. That should show you what happens with the multimedia plugins.

  • I re-built the file system image, this time with Buildroot-2017.02 and Qt version 5.6.2.

    I ran, on the target board, the audiooutput example that Qt provides and got a lots of pulseaudio warnings.

    Remembering the above QT_DEBUG_PLUGINS hint, I took a look inside the /usr/lib/qt/plugins/audio directory on the target board and found two plugins: libqtmedia_pulse.so and libqtaudio_alsa.so .

    Removing the libqtmedia_pulse.so plugin solved the race condition with libqtaudio_alsa.so and solved the problem.

    In addition, make sure that alsa-lib builds before qt5multimedia (commit 8d7dd837e5e from mainline Buildroot: "qt5multimedia: conditionally add alsa-lib to dependencies").

Log in to reply