Skip to content

Commit

Permalink
Do no suspend PulseAudio if the ALSA device contains a hint with the …
Browse files Browse the repository at this point in the history
…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
jyavenard committed Feb 27, 2011
1 parent a2a57df commit 057b017
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions mythtv/libs/libmyth/audiooutput.cpp
Expand Up @@ -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

Expand Down

0 comments on commit 057b017

Please sign in to comment.