summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Yves Avenard <jyavenard@mythtv.org>2011-02-27 09:51:14 (GMT)
committer Jean-Yves Avenard <jyavenard@mythtv.org>2011-02-27 09:51:14 (GMT)
commit93d8997236e6ad617a5cab5f45e465de184f6080 (patch)
tree34b0a62e464d0e88cf2e4979c52833c5a40211ac
parente91e0abeea1de386027128c4bb021be33c1861e3 (diff)
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
-rw-r--r--mythtv/libs/libmyth/audio/audiooutput.cpp34
1 files changed, 31 insertions, 3 deletions
diff --git a/mythtv/libs/libmyth/audio/audiooutput.cpp b/mythtv/libs/libmyth/audio/audiooutput.cpp
index 31c7966..ed799fa 100644
--- a/mythtv/libs/libmyth/audio/audiooutput.cpp
+++ b/mythtv/libs/libmyth/audio/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