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

Till Oliver Knoll till.oliver.knoll at gmail.com
Mon Mar 25 14:25:22 CET 2013


2013/3/22 Till Oliver Knoll <till.oliver.knoll at gmail.com>:
> Hi,
>
> I am trying to learn OpenAL. For that I need to read simple *.wav files
> and thought the QAudioDecoder (Qt 5.0.1 - OS X 10.8.2) would be a
> perfect fit.
>
> I have:
>
>   m_audioDecoder = new QAudioDecoder;
>   qDebug("Error: %s", qPrintable(m_audioDecoder->errorString()));
>   connect(m_audioDecoder, SIGNAL(bufferReady()),
>             this, SLOT(handleBufferReady()));
>   ...
>   // select WAV file
>   ...
>   m_audioDecoder->setSourceFilename(filePath);
>   m_audioDecoder->start();
>   ...
>
> When I run my application from within Qt Creator (in debug mode) I
> immediatelly get on the console ("Application Output"):
>
>   defaultServiceProvider::requestService(): no service found for -
> "org.qt-project.qt.audiodecode"

Okay, so I have done some google research: it seems that the
Q_MEDIASERVICE_AUDIODECODER ("org.qt-project.qt.audiodecode")
interface is simply not implemented on Mac (OS X), e.g.in the
QuickTime 7 based plugin:

  http://qt.gitorious.org/qt/qtmultimedia/blobs/stable/src/plugins/qt7/qt7serviceplugin.mm

or in the AV Foundation based plugin:

  http://qt.gitorious.org/qt/qtmultimedia/blobs/stable/src/plugins/avfoundation/mediaplayer/avfmediaplayerserviceplugin.mm

Note that in the create() method the only supported key seems to be
Q_MEDIASERVICE_MEDIAPLAYER.

As opposed to e.g. the GStreamer based plugin implementation:

  http://qt.gitorious.org/qt/qtmultimedia/blobs/stable/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.cpp

which seems to have a dedicated QAudioDecoder plugin (the create()
method reacts upon the Q_MEDIASERVICE_AUDIODECODER key.

The supported key(s) for the GStreamer based AudioDecorder plugin are
also listed here, as I just figured out:

  http://qt.gitorious.org/qt/qtmultimedia/blobs/stable/src/plugins/gstreamer/audiodecoder/audiodecoder.json


However I don't find any such key in the AV Foundation based Mac plugins:

  http://qt.gitorious.org/qt/qtmultimedia/trees/stable/src/plugins/avfoundation

(Nor in the QuickTime 7 based plugin:
http://qt.gitorious.org/qt/qtmultimedia/trees/stable/src/plugins/qt7
which is probably outdated anyway: AV Foundation seems to be the way
to go now).

(I assume the above links point to the latest Master branch ;)).


That seems to strongly imply that there is no QAudioDecoder support on
Mac for now :( And as QMultimedia was last maintained in Australia
(http://qt-project.org/wiki/Maintainers) I am not sure if anyone is
still working on that one (Michael Goddard)? Well, at least there are
still commits to QMultimedia:

  https://qt.gitorious.org/qt/qtmultimedia

(Hint hint: we want audio decoding support on Mac ;))


In the meantime I will probably totally *mis-use* the private
https://qt.gitorious.org/qt/qtmultimedia/blobs/stable/src/multimedia/audio/qwavedecoder_p.h,
as decoding simple (Mono, 16bit 44 KHz PCM data) WAVE files is all I
really need for now >:)


For anyone who wants to jump in: in the "OpenAL Example"

  http://developer.apple.com/library/mac/#samplecode/OpenALExample/Listings/MyOpenALSupport_c.html#//apple_ref/doc/uid/DTS10003587-MyOpenALSupport_c-DontLinkElementID_5

I stumbled over the function "ExtAduioFileOpen" that they use in that example:

  https://developer.apple.com/library/mac/#documentation/MusicAudio/Reference/ExtendedAudioFileServicesReference/Reference/reference.html

"Extended Audio File Services provides simplified audio file access,
combining features of Audio File Services and Audio Converter
Services. It provides a unified interface for reading and writing
compressed as well as linear PCM audio files."

That API looks pretty straight-forward to me. Maybe I'll try to come
up with a "proof-of-concept" Qt Mac AudioDecoder plugin using that
API...

I am not sure whether that is the proper way nowadays to decode audio
files on Mac (I am not a Cocoa expert by no means ;)) or whether the
AV Foundation classes provide a better way.


Cheers, Oliver



More information about the Interest mailing list