Question

I am trying to decode a .wav file using QAudioDecoder class. Even though I had included the QtMultimedia module into my .pro file by adding QT += multimedia I am receiving an error that service for the QAudioDecoder was not found. I am not able to see where to problem lies.

I am using Qt 5.1.0 with MingGW 4.8 32 bit on Windows 7.

Error message:

defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.audiodecode"

.pro file:

QT       += core
QT       += multimedia
QT       -= gui

TARGET = test
CONFIG   += console
CONFIG   -= app_bundle

TEMPLATE = app
SOURCES += main.cpp

main file:

#include <QCoreApplication>
#include <QAudioDecoder>
#include <QAudioBuffer>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    QString pathToFile = "C:/Users/Mateusz/Documents/Szkola/Sound Processing/Lab1/artificial/easy/506Hz.wav";

    QAudioDecoder decoder;
    decoder.setSourceFilename(pathToFile);

    decoder.start();
    while(decoder.bufferAvailable()) {
        QAudioBuffer buffer = decoder.read();
        qDebug() << "Buffer size: " << buffer.byteCount();
    }

    return a.exec();
}
Was it helpful?

Solution

The Multimedia module uses plugins that are different on each platform (or compiler).

See http://qt-project.org/wiki/Qt_Multimedia_Backends

On Windows you have DirectShow and MediaFoundation (WMF). Only the WMF plugin implements audio decoding features. WMF plugin is only available with MSVC compiler.

See http://qt-project.org/doc/qt-5.1/qtmultimedia/platform-notes-windows.html

OTHER TIPS

I had the same problem in Qt5.5 running under Linux. The problem disappeared after upgrade to Qt5.5.1 using their MaintenanceTool.

I also struggled with this issue and finally got it to work by using the MS visual studio compiler in QT Creator, like Fernando Pelliccioni suggested.

Steps were:

-Use the Qt MaintenanceTool to add support for msvc2013

-Install Visual Studio 2013

-In Qt Creator go to Projects->Manage Kits and add msvc2013

-Build and run. Now QAudioDecoder works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top