[Spice-devel] [client 07/11] build-sys: Allow simultaneous support for Pulse and GStreamer audio
Christophe Fergeau
cfergeau at redhat.com
Wed Nov 4 02:47:05 PST 2015
Can you explain in the commit log why this is a good thing/why you need
to do that?
Thanks,
Christophe
On Tue, Nov 03, 2015 at 01:06:10PM +0100, Francois Gouget wrote:
> Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
> ---
> configure.ac | 63 +++++++++++++++++++++++++------------------------------
> src/Makefile.am | 4 ++--
> src/spice-audio.c | 11 +++++-----
> 3 files changed, 37 insertions(+), 41 deletions(-)
>
> This patch only depends on [client 07/11].
>
> diff --git a/configure.ac b/configure.ac
> index dea9a30..ddaab2a 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -291,50 +291,44 @@ AS_IF([test "x$have_phodav" = "xyes"],
>
> AM_CONDITIONAL([WITH_PHODAV], [test "x$have_phodav" = "xyes"])
>
> -AC_ARG_WITH([audio],
> - AS_HELP_STRING([--with-audio=@<:@gstreamer/pulse/auto/no@:>@], [Select audio backend @<:@default=auto@:>@]),
> +AC_ARG_ENABLE([pulse],
> + AS_HELP_STRING([--enable-pulse=@<:@yes/auto/no@:>@], [Enable the PulseAudio backend @<:@default=auto@:>@]),
> [],
> - [with_audio="auto"])
> -
> -case "$with_audio" in
> - gstreamer|pulse|auto*)
> - PKG_CHECK_MODULES(GSTAUDIO, gstreamer-1.0 gstreamer-base-1.0 gstreamer-app-1.0 gstreamer-audio-1.0, [have_gstaudio=yes], [have_gstaudio=no])
> - PKG_CHECK_MODULES(PULSE, libpulse libpulse-mainloop-glib, [have_pulse=yes], [have_pulse=no])
> - ;;
> - no*)
> - ;;
> - *) AC_MSG_ERROR(Unsupported audio backend)
> -esac
> -
> -AS_IF([test "x$with_audio" = "xauto" && test "x$have_pulse" = "xyes"],
> - [with_audio=pulse])
> -
> -AS_IF([test "x$with_audio" = "xauto" && test "x$have_gstaudio" = "xyes"],
> - [with_audio=gstreamer])
> -
> -AS_IF([test "x$with_audio" = "xauto"],
> - [with_audio=no])
> -
> -AS_IF([test "x$with_audio" = "xpulse"],
> - [AS_IF([test "x$have_pulse" = "xyes"],
> - [AC_DEFINE([WITH_PULSE], 1, [Have pulseaudio?])],
> - [AC_MSG_ERROR([PulseAudio requested but not found])
> + [enable_pulse="auto"])
> +AS_IF([test "x$enable_pulse" != "xno"],
> + [PKG_CHECK_MODULES(PULSE, [libpulse libpulse-mainloop-glib],
> + [AC_DEFINE([HAVE_PULSE], 1, [Have PulseAudio support?])
> + enable_pulse="yes"],
> + [AS_IF([test "x$enable_pulse" = "xyes"],
> + AC_MSG_ERROR([PulseAudio requested but not found]))
> + enable_pulse="no"
> ])
> ])
> -AM_CONDITIONAL([WITH_PULSE], [test "x$have_pulse" = "xyes"])
> +AM_CONDITIONAL([SUPPORT_PULSE], [test "x$enable_pulse" = "xyes"])
> AC_SUBST(PULSE_CFLAGS)
> AC_SUBST(PULSE_LIBS)
>
> -AS_IF([test "x$with_audio" = "xgstreamer"],
> - [AS_IF([test "x$have_gstaudio" = "xyes"],
> - [AC_DEFINE([WITH_GSTAUDIO], 1, [Have GStreamer 1.0 audio?])],
> - [AC_MSG_ERROR([GStreamer 1.0 audio requested but not found])
> +AC_ARG_ENABLE([gstaudio],
> + AS_HELP_STRING([--enable-gstaudio=@<:@yes/auto/no@:>@], [Enable the GStreamer 1.0 audio backend @<:@default=auto@:>@]),
> + [],
> + [enable_gstaudio="auto"])
> +AS_IF([test "x$enable_gstaudio" != "xno"],
> + [PKG_CHECK_MODULES(GSTAUDIO, [gstreamer-1.0 gstreamer-base-1.0 gstreamer-app-1.0 gstreamer-audio-1.0],
> + [AC_DEFINE([HAVE_GSTAUDIO], 1, [Have GStreamer 1.0 audio support?])
> + enable_gstaudio="yes"],
> + [AS_IF([test "x$enable_gstaudio" = "xyes"],
> + AC_MSG_ERROR([GStreamer 1.0 audio requested but not found]))
> + enable_gstaudio="no"
> ])
> ])
> -AM_CONDITIONAL([WITH_GSTAUDIO], [test "x$have_gstaudio" = "xyes"])
> +AM_CONDITIONAL([SUPPORT_GSTAUDIO], [test "x$enable_gstaudio" = "xyes"])
> AC_SUBST(GSTAUDIO_CFLAGS)
> AC_SUBST(GSTAUDIO_LIBS)
>
> +AS_IF([test "x$enable_pulse$enable_gstaudio" = "xnono"],
> + [SPICE_WARNING([No PulseAudio or GStreamer 1.0 audio decoder, audio will not be streamed])
> +])
> +
> AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
> AC_MSG_CHECKING([for jpeglib.h])
> AC_TRY_CPP(
> @@ -741,7 +735,8 @@ AC_MSG_NOTICE([
>
> Gtk: ${with_gtk}
> Coroutine: ${with_coroutine}
> - Audio: ${with_audio}
> + PulseAudio: ${enable_pulse}
> + GStreamer Audio: ${enable_gstaudio}
> SASL support: ${enable_sasl}
> Smartcard support: ${have_smartcard}
> USB redirection support: ${have_usbredir} ${with_usbredir_hotplug}
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 99a8a1f..af95562 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -330,14 +330,14 @@ dist_libspice_client_glibinclude_DATA = \
> spice-channel-enums.h \
> $(NULL)
>
> -if WITH_PULSE
> +if SUPPORT_PULSE
> libspice_client_glib_2_0_la_SOURCES += \
> spice-pulse.c \
> spice-pulse.h \
> $(NULL)
> endif
>
> -if WITH_GSTAUDIO
> +if SUPPORT_GSTAUDIO
> libspice_client_glib_2_0_la_SOURCES += \
> spice-gstaudio.c \
> spice-gstaudio.h \
> diff --git a/src/spice-audio.c b/src/spice-audio.c
> index 75742d7..550d02a 100644
> --- a/src/spice-audio.c
> +++ b/src/spice-audio.c
> @@ -42,10 +42,10 @@
> #include "spice-channel-priv.h"
> #include "spice-audio-priv.h"
>
> -#ifdef WITH_PULSE
> +#ifdef HAVE_PULSE
> #include "spice-pulse.h"
> #endif
> -#if defined(WITH_GSTAUDIO)
> +#ifdef HAVE_GST_AUDIO
> #include "spice-gstaudio.h"
> #endif
>
> @@ -261,11 +261,12 @@ SpiceAudio *spice_audio_new(SpiceSession *session, GMainContext *context,
> if (name == NULL)
> name = g_get_application_name();
>
> -#ifdef WITH_PULSE
> +#ifdef HAVE_PULSE
> self = SPICE_AUDIO(spice_pulse_new(session, context, name));
> #endif
> -#if defined(WITH_GSTAUDIO)
> - self = SPICE_AUDIO(spice_gstaudio_new(session, context, name));
> +#ifdef HAVE_GST_AUDIO
> + if (!self)
> + self = SPICE_AUDIO(spice_gstaudio_new(session, context, name));
> #endif
> if (!self)
> return NULL;
> --
> 2.6.1
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20151104/450967f2/attachment-0001.sig>
More information about the Spice-devel
mailing list