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.
Any idea? Could you help me, please? Thank you in advance.