PDA

View Full Version : Qt with pulseaudio - How to omit it?



SeeLook
13th February 2013, 17:15
It seems like new fashion to compile Qt libs with pulseaudio flag under Linux.
When I'm using QAudio it hangs up if pulseaudio is not running.
(running applicatins waits for it)
It occurs f.e under Bodhi Linux - it has Qt with pulseaudio but pulseaudio is not installed by default.
I understand - it is distibution problem but maybe I can avoid this.
Is there any way to use this compiled pulse support in code?

SeeLook
15th February 2013, 13:53
I looked for some solutions and what I found:
My application hangs in this place:

QAudioDeviceInfo::availableDevices(QAudio::AudioOu tput);
- when it tries to get devices list.
Also I found that Qt pulseaudio support works by plug-in.
QtMultimedia framework loads plug-in and it hangs when pa is not running.
I tried to remove that plugin from Qt plugins dir and then my app started but it was deaf and muted - no audio devices were available.
Maybe is there a way to unload that plugin from my app?

wysota
15th February 2013, 16:53
If you want audio to work without pulseaudio then you need another plugin that will take care of playback.

SeeLook
15th February 2013, 21:23
You mean to write it myself?
I didn't find any audio plugins under Arch Linux or Fedora.
QtMultimedia and QAudioInput and QAudioOutput that I'm using just work out of the box.
With and without pulseaudio.
Problem exist under Ubuntu where Qt is compiled with pulseaudio as a plugin. As long as pulseaudio is running "QAudio" classes work but when naughty user turn it off....
See above...

Ubuntu derivatives goes forward. Bodhi Linux has ubuntish QtMultimedia with pulseaudio and no pulseaudio installed by default.
KXStudio is pulseaudioless distro with JACK but it is based on Ubuntu and has Qtmultimedia with pulseaudio built-in.

I have an idea how to detect Qt with pulseaudio plugin and check is pulse running - if not, to run my app without sound with some warnings for user.
But I'm humble asking for some more user-frendly solution if any exist.

To write my own plugin doesn't look good. If it is only way it will be better to switch to Portaudio instead of QtMultimedia.

wysota
15th February 2013, 21:46
You mean to write it myself?
No, I mean you have to have some means to play audio. If you can't use pulseaudio as the playback system then you need to have some other audio system (like alsa or whatever) if you want to have sound. If your Qt is built with a rule that "audio playback is provided by plugins" then without a working plugin it will not function properly.


I have an idea how to detect Qt with pulseaudio plugin and check is pulse running - if not, to run my app without sound with some warnings for user.
But I'm humble asking for some more user-frendly solution if any exist.
I'd say you shouldn't try to be too smart. There are always cases you just can't forsee.

SeeLook
15th February 2013, 22:19
If your Qt is built with a rule that "audio playback is provided by plugins" then without a working plugin it will not function properly.
Thanks - this is very clear part but sometimes You speak riddles...


So, is there some Ubuntu package that provides alternative for pulseaudio-qt-plugin?
Pulseaudio plugin is part of qtmultimedia.deb package and I can't just remove it as pulseaudio package dependence but maybe I can add as a dependence of my app.deb some package that has such pugin?
I know, this forum is not the best place to ask such question but everyone developer using QtMultimedia for/under Linux can has similar problem.

wysota
16th February 2013, 00:44
So, is there some Ubuntu package that provides alternative for pulseaudio-qt-plugin?
I have no idea. I'm using Kubuntu myself and I can't see any pulseaudio plugin for QtMultimedia in my system.


Pulseaudio plugin is part of qtmultimedia.deb package and I can't just remove it as pulseaudio package dependence but maybe I can add as a dependence of my app.deb some package that has such pugin?
I know, this forum is not the best place to ask such question but everyone developer using QtMultimedia for/under Linux can has similar problem.
I think you should ask this to the Ubuntu Qt package maintainer. This seems strictly related to Ubuntu and not Qt itself.