diff options
-rw-r--r-- | configure.ac | 10 | ||||
-rw-r--r-- | src/audio_out/audio_pulse_out.c | 16 |
2 files changed, 26 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index fc569a7d4..127e23c0d 100644 --- a/configure.ac +++ b/configure.ac @@ -1099,6 +1099,16 @@ AC_ARG_WITH([pulseaudio], if test "x$with_pulseaudio" != "xno"; then PKG_CHECK_MODULES([PULSEAUDIO], [libpulse], [have_pulseaudio="yes"], [have_pulseaudio="no"]) + if test x"$have_pulseaudio" = xyes; then + AC_MSG_CHECKING([for pulseaudio >= 0.9.7]) + PKG_CHECK_EXISTS([libpulse >= 0.9.7], + [have_pulseaudio_0_9_7="yes"], + [have_pulseaudio_0_9_7="no"]) + AC_MSG_RESULT([$have_pulseaudio_0_9_7]) + if test x"$have_pulseaudio_0_9_7" = xyes; then + AC_DEFINE([HAVE_PULSEAUDIO_0_9_7], 1, [define this if you have pulseaudio >= 0.9.7]) + fi + fi fi AM_CONDITIONAL(HAVE_PULSEAUDIO, [test "x$have_pulseaudio" = x"yes"]) diff --git a/src/audio_out/audio_pulse_out.c b/src/audio_out/audio_pulse_out.c index 05b61c309..fa58cf011 100644 --- a/src/audio_out/audio_pulse_out.c +++ b/src/audio_out/audio_pulse_out.c @@ -218,7 +218,11 @@ static void __xine_pa_sink_info_callback(pa_context *c, const pa_sink_input_info this->cvolume = info->volume; this->swvolume = pa_cvolume_avg(&info->volume); +#ifdef HAVE_PULSEAUDIO_0_9_7 this->muted = info->mute; +#else + this->muted = pa_cvolume_is_muted (&this->cvolume); +#endif } static int connect_context(pulse_driver_t *this) { @@ -661,9 +665,21 @@ static int ao_pulse_set_property (ao_driver_t *this_gen, int property, int value this->muted = value; +#ifdef HAVE_PULSEAUDIO_0_9_7 o = pa_context_set_sink_input_mute(this->context, pa_stream_get_index(this->stream), value, __xine_pa_context_success_callback, this); +#else + /* FIXME: breaks (volume=0 after unmuting) unless the volume is + * adjusted first (due to swvolume not being initialised properly) + */ + if ( value ) + pa_cvolume_mute(&this->cvolume, pa_stream_get_sample_spec(this->stream)->channels); + else + pa_cvolume_set(&this->cvolume, pa_stream_get_sample_spec(this->stream)->channels, this->swvolume); + o = pa_context_set_sink_input_volume(this->context, pa_stream_get_index(this->stream), + &this->cvolume, __xine_pa_context_success_callback, this); +#endif result = value; } |