Skip to content
Browse files

Do no suspend PulseAudio if the ALSA device contains a hint with the …

…word 'pulse'.

This allows distribution that uses the 'default' ALSA device as a plug to pulse. It just needs to add a hint containing the word pulse ; which will prevent pulseaudio to be suspended
  • Loading branch information...
1 parent a2a57df commit 057b017e94630cbd13c73018c5edc8a5a4f58c47 @jyavenard jyavenard committed Feb 27, 2011
Showing with 31 additions and 3 deletions.
  1. +31 −3 mythtv/libs/libmyth/audiooutput.cpp
View
34 mythtv/libs/libmyth/audiooutput.cpp
@@ -103,10 +103,38 @@ AudioOutput *AudioOutput::OpenAudio(AudioSettings &settings,
}
#ifdef USING_PULSE
- if (willsuspendpa &&
- !main_device.contains("pulse", Qt::CaseInsensitive))
+ if (willsuspendpa)
{
- pulsestatus = PulseHandler::Suspend(PulseHandler::kPulseSuspend);
+ bool ispulse = false;
+#ifdef USE_ALSA
+ // Check if using ALSA, that the device doesn't contain the word
+ // "pulse" in its hint
+ if (main_device.startsWith("ALSA:"))
+ {
+ QString device_name = main_device;
+
+ device_name.remove(0, 5);
+ QMap<QString, QString> *alsadevs =
+ AudioOutputALSA::GetALSADevices("pcm");
+ if (!alsadevs->empty() && alsadevs->contains(device_name))
+ {
+ if (alsadevs->value(device_name).contains("pulse",
+ Qt::CaseInsensitive))
+ {
+ ispulse = true;
+ }
+ }
+ delete alsadevs;
+ }
+#endif
+ if (main_device.contains("pulse", Qt::CaseInsensitive))
+ {
+ ispulse = true;
+ }
+ if (!ispulse)
+ {
+ pulsestatus = PulseHandler::Suspend(PulseHandler::kPulseSuspend);
+ }
}
#endif

0 comments on commit 057b017

Please sign in to comment.
Something went wrong with that request. Please try again.