QAudioDecoder returns not valid QAudioFormat on Xubuntu 18.04
-
Hi everybody,
I am not able to make QAudioDecoder (Qt 5.9.5) work on Xubuntu 18.04. Specifically, I always get that the audio format returned by QAudioDecoder::audioFormat() is not valid, no matter which file I try. For instance, the following trivial program ends at "Invalid original audio format":int main(int argc, char **argv) { QApplication app (argc, argv); const char sampleAudioFilename[] = "/home/alx/Downloads/M1F1-Alaw-AFsp.wav"; QAudioDecoder* track = new QAudioDecoder(); qInfo("%s%s","Opening ",sampleAudioFilename); track->setSourceFilename(sampleAudioFilename); track->start(); if (track->error() != QAudioDecoder::NoError) { qFatal("%s",track->errorString().toStdString().data()); } QAudioFormat originalFormat = track->audioFormat(); if (!originalFormat.isValid()) { qFatal("Not valid original audio format"); } return (0); }
Interestingly, track->error() does not return any issue even though the properties of originalFormat are not valid.
I previously installed all gstreamer and libgstreamer related packages available on my distro. Indeed, I am able to both play and to inspect successfully the test file by command line gstreamer's tools, e.g.,gst-play-1.0 -v /home/alx/Downloads/M1F1-Alaw-AFsp.wav
as well as to play it with VLC.
Setting QT_DEBUG_PLUGINS=1 and running the trivial program above provides the following output (I report only the part related to the multimedia stuff, please let me know if the remaining one is needed)(omitted parts).... QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib/x86_64-linux-gnu/qt5/plugins/mediaservice" ... QFactoryLoader::QFactoryLoader() looking at "/usr/lib/x86_64-linux-gnu/qt5/plugins/mediaservice/libgstaudiodecoder.so" Found metadata in lib /usr/lib/x86_64-linux-gnu/qt5/plugins/mediaservice/libgstaudiodecoder.so, metadata= { "IID": "org.qt-project.qt.mediaserviceproviderfactory/5.0", "MetaData": { "Keys": [ "gstreameraudiodecode" ], "Services": [ "org.qt-project.qt.audiodecode" ] }, "className": "QGstreamerAudioDecoderServicePlugin", "debug": false, "version": 329989 } Got keys from plugin meta data ("gstreameraudiodecode") QFactoryLoader::QFactoryLoader() looking at "/usr/lib/x86_64-linux-gnu/qt5/plugins/mediaservice/libgstcamerabin.so" Found metadata in lib /usr/lib/x86_64-linux-gnu/qt5/plugins/mediaservice/libgstcamerabin.so, metadata= { "IID": "org.qt-project.qt.mediaserviceproviderfactory/5.0", "MetaData": { "Keys": [ "gstreamercamerabin" ], "Services": [ "org.qt-project.qt.camera" ] }, "className": "CameraBinServicePlugin", "debug": false, "version": 329989 } Got keys from plugin meta data ("gstreamercamerabin") QFactoryLoader::QFactoryLoader() looking at "/usr/lib/x86_64-linux-gnu/qt5/plugins/mediaservice/libgstmediacapture.so" Found metadata in lib /usr/lib/x86_64-linux-gnu/qt5/plugins/mediaservice/libgstmediacapture.so, metadata= { "IID": "org.qt-project.qt.mediaserviceproviderfactory/5.0", "MetaData": { "Keys": [ "gstreamermediacapture" ], "Services": [ "org.qt-project.qt.audiosource" ] }, "className": "QGstreamerCaptureServicePlugin", "debug": false, "version": 329989 } Got keys from plugin meta data ("gstreamermediacapture") QFactoryLoader::QFactoryLoader() looking at "/usr/lib/x86_64-linux-gnu/qt5/plugins/mediaservice/libgstmediaplayer.so" Found metadata in lib /usr/lib/x86_64-linux-gnu/qt5/plugins/mediaservice/libgstmediaplayer.so, metadata= { "IID": "org.qt-project.qt.mediaserviceproviderfactory/5.0", "MetaData": { "Keys": [ "gstreamermediaplayer" ], "Services": [ "org.qt-project.qt.mediaplayer" ] }, "className": "QGstreamerPlayerServicePlugin", "debug": false, "version": 329989 } Got keys from plugin meta data ("gstreamermediaplayer") QFactoryLoader::QFactoryLoader() checking directory path "/home/alx/Documents/AudioLinux/Qt/build-FAPGUI-Desktop-Debug/mediaservice" ... loaded library "/usr/lib/x86_64-linux-gnu/qt5/plugins/mediaservice/libgstaudiodecoder.so" Opening /home/alx/Downloads/M1F1-Alaw-AFsp.wav Invalid original audio format
Any idea? Could you help me, please?
Thank you in advance.