Qt, Phonon and multimedia codecs: how to bundle them?
Asked Answered
T

2

3

I am developing a multiplatform (Windows, Linux and Mac) Qt based Phonon C++ application and am aware that Phonon itself is only API, which relies on a backend to interact with installed codecs.

Logically, I should assume that the end user has no extra codecs installed, only those provided by OS.

So my question would be, is it possible to bundle an OGG (preferably) or AAC decoder with my application so that the backend would recognize it and be able to play audio files? What steps in general should I take and where to look for more information on this?

The application itself is not installable, it runs directly form physical media.

Trilateral answered 3/5, 2012 at 9:3 Comment(0)
J
0

Generally, you could supply the VLC Phonon backend for Windows. The default DirectX backend is unfortunately quite limited.

On Linux, you can assume that a suitable Phonon backend comes with the OS's Phonon installation. The two backends currently popular are GStreamer and VLC.

Jeanmariejeanna answered 15/5, 2012 at 20:49 Comment(1)
Unfortunately, on OSX, macports does not currently support phonon-backend-vlc. port search phonon reveals only gstreamerRacer
H
1

Sound Libraries for C++

As far as getting the right libraries for playing sound, it should just be a matter of finding out what libraries are used by Phonon on your system. I know Phonon is a pretty big project and each OS has a different set of drivers for playing media and using Codec, etc. I would suggest looking at Audacity and VLC and checking Google.

Plugins/Libraries and Qt

As far as getting Phonon to work with Qt, I have experience there...

I haven't done a ton of testing with Phonon on every major OS, but I have on a few different versions of Windows.

The deployment of a Qt Application is very straight forward, even with plugins and libraries like Phonon. But figuring it out the first time was a little painful, just because the jargon is a little weird.

My answer is in the context of a Windows Desktop Application with Dynamic Linking to the Qt Libraries, not static.

Here is the directory structure for windows and a short explanation of how dlls are found.

Deploying a Qt Application

Dynamic-Link Library Search Order in Windows

For Mingw on Windows in the Qt SDK there is a folder for its binaries, and in that folder there are the dlls that your application needs to be able to find at runtime (If you are doing Dynamic Linking). I usually put these DLL's in the same folder as the Application EXE that I build in Qt creator and then keep the "Working Directory" or the directory that the EXE is ran from to be the same directory as well.

For the additional plugins/libraries that are for specific media types, like image formats and for phonon, you need to have a specific structure that your application can find it in.

You can make some very specific ones for your application and add them using the functions related to this call. QStringList QCoreApplication::libraryPaths()

In general mimic the directory structure that you find in the MingW "plugins" folder for the additional dlls you need.

For example, I wanted to be able to show a system tray icon properly. Apparently you need the correct image format engine plugin to show the icon. (qgif4.dll, qico4.dll, and qjpeg4.dll)

Here is were the plugin was located on my developing machine:

"C:\QtSDK\Desktop\Qt\4.7.3\mingw\plugins\imageformats"

Here is where I place it so that it can be found at runtime:

"C:\path\to\my\EXE\imageformats"

or

".\imageformats" (relative to my working directory of my EXE)

What is one of the more annoying things about discovering this information, is that the plugins don't fail in the same way as the main Qt Libraries, so you don't see it broken until you get to the part of your program that is actually attempting to use them.

Hollerman answered 15/5, 2012 at 20:30 Comment(1)
OSX support for phonon is quite a bit more complicated unfortunatelyRacer
J
0

Generally, you could supply the VLC Phonon backend for Windows. The default DirectX backend is unfortunately quite limited.

On Linux, you can assume that a suitable Phonon backend comes with the OS's Phonon installation. The two backends currently popular are GStreamer and VLC.

Jeanmariejeanna answered 15/5, 2012 at 20:49 Comment(1)
Unfortunately, on OSX, macports does not currently support phonon-backend-vlc. port search phonon reveals only gstreamerRacer

© 2022 - 2024 — McMap. All rights reserved.