[Spice-commits] 3 commits - configure.ac src/Makefile.am src/spice-audio.c

Christophe Fergau teuf at kemper.freedesktop.org
Tue Dec 8 06:51:22 PST 2015


 configure.ac      |   78 +++++++++++++++++++++++++++++-------------------------
 src/Makefile.am   |    4 +-
 src/spice-audio.c |   11 ++++---
 3 files changed, 50 insertions(+), 43 deletions(-)

New commits:
commit 983984f2760c5df84556fc72d69d76f778effa7d
Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Wed Dec 2 14:56:04 2015 +0100

    build-sys: Warn about missing GStreamer 1.0 audio runtime elements
    
    Their absence should not be reported as an error since they are not
    needed for the build, but the developer will need them to test the code
    so it's appropriate to warn him.
    
    Signed-off-by: Francois Gouget <fgouget at codeweavers.com>

diff --git a/configure.ac b/configure.ac
index d716467..4860fef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -324,7 +324,11 @@ AC_ARG_ENABLE([gstaudio],
   [enable_gstaudio="auto"])
 AS_IF([test "x$enable_gstaudio" != "xno"],
       [SPICE_CHECK_GSTREAMER(GSTAUDIO, 1.0, [gstreamer-1.0 gstreamer-base-1.0 gstreamer-app-1.0 gstreamer-audio-1.0],
-         [],
+         [SPICE_CHECK_GSTREAMER_ELEMENTS($GST_INSPECT_1_0, [gst-plugins-base 1.0], [audioconvert audioresample appsink])
+          SPICE_CHECK_GSTREAMER_ELEMENTS($GST_INSPECT_1_0, [gst-plugins-good 1.0], [autoaudiosrc])
+          AS_IF([test x"$missing_gstreamer_elements" = "xyes"],
+                SPICE_WARNING([The GStreamer 1.0 audio backend can be built but may not work.]))
+         ],
          [AS_IF([test "x$enable_gstaudio" = "xyes"],
                 AC_MSG_ERROR([GStreamer 1.0 audio requested but not found]))
          ])
commit 077024454c7d3b6c8e6a35446ca51f2db4a3ab71
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Thu Dec 3 12:07:13 2015 +0100

    build-sys: Check for GStreamer 1.0 audio with SPICE_CHECK_GSTREAMER()
    
    Signed-off-by: Francois Gouget <fgouget at codeweavers.com>

diff --git a/configure.ac b/configure.ac
index 2943bab..d716467 100644
--- a/configure.ac
+++ b/configure.ac
@@ -323,19 +323,16 @@ AC_ARG_ENABLE([gstaudio],
   [],
   [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"],
+      [SPICE_CHECK_GSTREAMER(GSTAUDIO, 1.0, [gstreamer-1.0 gstreamer-base-1.0 gstreamer-app-1.0 gstreamer-audio-1.0],
+         [],
          [AS_IF([test "x$enable_gstaudio" = "xyes"],
                 AC_MSG_ERROR([GStreamer 1.0 audio requested but not found]))
-          enable_gstaudio="no"
-      ])
-])
-AM_CONDITIONAL([HAVE_GSTAUDIO], [test "x$enable_gstaudio" = "xyes"])
-AC_SUBST(GSTAUDIO_CFLAGS)
-AC_SUBST(GSTAUDIO_LIBS)
+         ])
+      ], [have_gstaudio="no"]
+)
+AM_CONDITIONAL([HAVE_GSTAUDIO], [test "x$have_gstaudio" = "xyes"])
 
-AS_IF([test "x$enable_pulse$enable_gstaudio" = "xnono"],
+AS_IF([test "x$enable_pulse$have_gstaudio" = "xnono"],
       [SPICE_WARNING([No PulseAudio or GStreamer 1.0 audio decoder, audio will not be streamed])
 ])
 
@@ -745,7 +742,7 @@ AC_MSG_NOTICE([
         Gtk:                      ${with_gtk}
         Coroutine:                ${with_coroutine}
         PulseAudio:               ${enable_pulse}
-        GStreamer Audio:          ${enable_gstaudio}
+        GStreamer Audio:          ${have_gstaudio}
         SASL support:             ${enable_sasl}
         Smartcard support:        ${have_smartcard}
         USB redirection support:  ${have_usbredir} ${with_usbredir_hotplug}
commit 538625415afc23bb48778f6b21ed2c5fe8a3da6f
Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Wed Dec 2 14:54:55 2015 +0100

    build-sys: Allow simultaneous support for Pulse and GStreamer audio
    
    Rather than GStreamer/PulseAudio backend being mutually exclusive at
    compile-time, this commit allows to enable both at the same time.
    PulseAudio will then be favoured, with a fallback to GStreamer if it's
    not available.
    Note that --with-audio is kept for backward compatibility.
    
    Signed-off-by: Francois Gouget <fgouget at codeweavers.com>

diff --git a/configure.ac b/configure.ac
index 9c141a0..2943bab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -292,49 +292,53 @@ 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@:>@]),
-  [],
-  [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_HELP_STRING([--with-audio=@<:@gstreamer/pulse/auto/no@:>@], [For legacy compatibility only]),
+  [SPICE_WARNING([--with-audio is deprecated. Use --enable-pulse and/or --enable-gstaudio instead])
+   case "$with_audio" in
+   pulse)     enable_pulse="yes"; enable_gstaudio="no" ;;
+   gstreamer) enable_pulse="no";  enable_gstaudio="yes" ;;
+   no)        enable_pulse="no";  enable_gstaudio="no" ;;
+   esac
+])
 
-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])
+AC_ARG_ENABLE([pulse],
+  AS_HELP_STRING([--enable-pulse=@<:@yes/auto/no@:>@], [Enable the PulseAudio backend @<:@default=auto@:>@]),
+  [],
+  [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([HAVE_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([HAVE_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(
@@ -740,7 +744,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..46162b3 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 HAVE_PULSE
 libspice_client_glib_2_0_la_SOURCES +=	\
 	spice-pulse.c			\
 	spice-pulse.h			\
 	$(NULL)
 endif
 
-if WITH_GSTAUDIO
+if HAVE_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;


More information about the Spice-commits mailing list