Skip to content

Commit

Permalink
Add support for pulseaudio backend
Browse files Browse the repository at this point in the history
This work is done by Nikita Krupenko which sent a patch to
rdesktop in 2010 for version 1.6.0. I have now ported it
over to trunk and it seems to work as expected.
  • Loading branch information
hean01-cendio committed Sep 26, 2017
1 parent 8cb4149 commit 9b98c3b
Show file tree
Hide file tree
Showing 4 changed files with 1,411 additions and 3 deletions.
23 changes: 21 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")

sound="yes"
AC_ARG_WITH(sound,
[ --with-sound select sound system ("oss", "sgi", "sun", "alsa" or "libao") ],
[ --with-sound select sound system ("oss", "sgi", "sun", "alsa", "pulse" or "libao") ],
[
sound="$withval"
])
Expand All @@ -272,6 +272,7 @@ AC_ARG_ENABLE(static-libsamplerate,

if test -n "$PKG_CONFIG"; then
PKG_CHECK_MODULES(LIBAO, ao, [HAVE_LIBAO=1], [HAVE_LIBAO=0])
PKG_CHECK_MODULES(PULSE, libpulse, [HAVE_PULSE=1], [HAVE_PULSE=0])
PKG_CHECK_MODULES(ALSA, alsa, [HAVE_ALSA=1], [HAVE_ALSA=0])
PKG_CHECK_MODULES(LIBSAMPLERATE, samplerate, [HAVE_LIBSAMPLERATE=1], [HAVE_LIBSAMPLERATE=0])
if test x"$HAVE_LIBSAMPLERATE" = "x1"; then
Expand Down Expand Up @@ -316,6 +317,13 @@ case $sound in
AC_DEFINE(RDPSND_ALSA)
fi

if test x"$HAVE_PULSE" = "x1"; then
SOUNDOBJ="$SOUNDOBJ rdpsnd_pulse.o"
CFLAGS="$CFLAGS $PULSE_CFLAGS"
LIBS="$LIBS $PULSE_LIBS"
AC_DEFINE(RDPSND_PULSE)
fi

if test x"$HAVE_LIBAO" = "x1"; then
SOUNDOBJ="$SOUNDOBJ rdpsnd_libao.o"
CFLAGS="$CFLAGS $LIBAO_CFLAGS"
Expand Down Expand Up @@ -364,6 +372,17 @@ case $sound in
fi
;;

pulse)
if test x"$HAVE_PULSE" = "x1"; then
SOUNDOBJ="$SOUNDOBJ rdpsnd_pulse.o"
CFLAGS="$CFLAGS $PULSE_CFLAGS"
LIBS="$LIBS $PULSE_LIBS"
AC_DEFINE(RDPSND_PULSE)
else
AC_MSG_ERROR([Selected sound system is not available.])
fi
;;

libao)
if test x"$HAVE_LIBAO" = "x1"; then
SOUNDOBJ="$SOUNDOBJ rdpsnd_libao.o"
Expand All @@ -380,7 +399,7 @@ case $sound in

*)
AC_MSG_WARN([sound support disabled])
AC_MSG_WARN([Currently supported systems are Open Sound System (oss), SGI AL (sgi), Sun/BSD (sun), ALSA (alsa) and libao])
AC_MSG_WARN([Currently supported systems are Open Sound System (oss), SGI AL (sgi), Sun/BSD (sun), ALSA (alsa), PulseAudio (pulse) and libao])
;;
esac

Expand Down
8 changes: 7 additions & 1 deletion rdpsnd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Sound Channel Process Functions
Copyright 2006-2010 Pierre Ossman <[email protected]> for Cendio AB
Copyright 2009-2011 Peter Astrand <[email protected]> for Cendio AB
Copyright 2017 Henrik Andersson <[email protected]> for Cendio AB
Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 2003-2008
Copyright (C) GuoJunBo <[email protected]> 2003
Expand Down Expand Up @@ -119,7 +120,7 @@ rdpsnd_auto_select(void)
current_driver->name);
if (current_driver->wave_out_open())
{
logger(Sound, Debug, "rdpsnd_auto_select(), using driver '%s'",
logger(Sound, Verbose, "rdpsnd_auto_select(), using driver '%s'",
current_driver->name);
current_driver->wave_out_close();
return True;
Expand Down Expand Up @@ -451,6 +452,11 @@ rdpsnd_register_drivers(char *options)
/* The order of registrations define the probe-order
when opening the device for the first time */
reg = &drivers;
#if defined(RDPSND_PULSE)
*reg = pulse_register(options);
assert(*reg);
reg = &((*reg)->next);
#endif
#if defined(RDPSND_ALSA)
*reg = alsa_register(options);
assert(*reg);
Expand Down
1 change: 1 addition & 0 deletions rdpsnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ struct audio_driver
};

/* Driver register functions */
struct audio_driver *pulse_register(char *options);
struct audio_driver *alsa_register(char *options);
struct audio_driver *libao_register(char *options);
struct audio_driver *oss_register(char *options);
Expand Down
Loading

0 comments on commit 9b98c3b

Please sign in to comment.