[xiph-commits] r17765 - in trunk/ao: . src/plugins/roar

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Sun Dec 19 02:32:12 PST 2010


Author: xiphmont
Date: 2010-12-19 02:32:12 -0800 (Sun, 19 Dec 2010)
New Revision: 17765

Modified:
   trunk/ao/configure.ac
   trunk/ao/src/plugins/roar/Makefile.am
   trunk/ao/src/plugins/roar/ao_roar.c
Log:
Add SLP disable workaround to ao_roar, add necessary hooks to configure



Modified: trunk/ao/configure.ac
===================================================================
--- trunk/ao/configure.ac	2010-12-17 11:32:02 UTC (rev 17764)
+++ trunk/ao/configure.ac	2010-12-19 10:32:12 UTC (rev 17765)
@@ -179,6 +179,24 @@
 AC_SUBST(SIZE32)
 
 dnl ======================================
+dnl Disable default use of SLP in roar 
+dnl until such time as SLP doesn't block
+dnl indefinitely
+dnl ======================================
+
+use_slp="no"
+AC_ARG_ENABLE([roar-default-slp],
+    [AS_HELP_STRING(
+	[--enable-roar-default-slp],
+	[allow Roar driver to use SLP in default search])],
+	[use_slp="$enableval"],[use_slp="no"]
+)
+if test "x$use_slp" != "xyes"; then
+   SLP_DEF="-DROAR_LIBROAR_CONFIG_WAS_NO_SLP"
+fi
+AC_SUBST([SLP_DEF])
+
+dnl ======================================
 dnl Detect possible output devices 
 dnl ======================================
 
@@ -292,7 +310,25 @@
 dnl Check for roaraudio
 
 have_roar="no";
-AC_CHECK_HEADERS(roaraudio.h, have_roar=yes)
+AC_CHECK_HEADERS(libroar/config.h, have_roar=yes)
+if test "x$have_roar" = "xyes"; then
+   AC_MSG_CHECKING([if SLP lookup can be disabled in libroar])
+   AC_COMPILE_IFELSE([
+#include <libroar/config.h>
+int main(int a, char **b) {
+#ifdef ROAR_LIBROAR_CONFIG_WAS_NO_SLP
+       return 0;
+#else
+	ROAR_LIBROAR_CONFIG_WAS_NO_SLP required
+#endif
+}
+     ],
+     [AC_MSG_RESULT([yes])],
+     [
+	AC_MSG_RESULT([no])
+   	AC_MSG_RESULT([RoarAudio 0.4beta2 or later required to build Roar support])
+   	have_roar="no"])
+fi
 AM_CONDITIONAL(HAVE_ROAR_AUDIO,test "${have_roar}" = yes)
 
 dnl Check for AIX audio

Modified: trunk/ao/src/plugins/roar/Makefile.am
===================================================================
--- trunk/ao/src/plugins/roar/Makefile.am	2010-12-17 11:32:02 UTC (rev 17764)
+++ trunk/ao/src/plugins/roar/Makefile.am	2010-12-19 10:32:12 UTC (rev 17765)
@@ -19,6 +19,7 @@
 libdir = $(plugindir)
 lib_LTLIBRARIES = $(roarltlibs)
 
+libroar_la_CFLAGS = $(CFLAGS) @SLP_DEF@
 libroar_la_LDFLAGS = @PLUGIN_LDFLAGS@
 libroar_la_LIBADD = -lroar
 libroar_la_SOURCES = $(roarsources)

Modified: trunk/ao/src/plugins/roar/ao_roar.c
===================================================================
--- trunk/ao/src/plugins/roar/ao_roar.c	2010-12-17 11:32:02 UTC (rev 17764)
+++ trunk/ao/src/plugins/roar/ao_roar.c	2010-12-19 10:32:12 UTC (rev 17765)
@@ -66,12 +66,36 @@
   int    role;
 } ao_roar_internal;
 
+#ifdef ROAR_LIBROAR_CONFIG_WAS_NO_SLP
+static int workarounds_save;
 
+static void disable_slp (void) {
+  struct roar_libroar_config * config = roar_libroar_get_config();
+
+  workarounds_save = config->workaround.workarounds;
+
+  config->workaround.workarounds |= ROAR_LIBROAR_CONFIG_WAS_NO_SLP;
+}
+
+static void reenable_slp (void) {
+  struct roar_libroar_config * config = roar_libroar_get_config();
+
+  config->workaround.workarounds = workarounds_save;
+}
+#else
+#define disable_slp()
+#define reenable_slp()
+#endif
+
 int ao_plugin_test(void) {
   struct roar_connection con;
 
-  if ( roar_simple_connect(&con, NULL, DEFAULT_CLIENT_NAME) == -1 )
+  disable_slp();
+  if ( roar_simple_connect(&con, NULL, DEFAULT_CLIENT_NAME) == -1 ) {
+    reenable_slp();
     return 0;
+  }
+  reenable_slp();
 
   if (roar_get_standby(&con)) {
     roar_disconnect(&con);
@@ -167,8 +191,15 @@
   if ( internal->con_opened )
     return 1;
 
-  if ( roar_simple_connect(&(internal->con), internal->host, internal->client_name) == -1 )
+  if ( internal->host == NULL )
+    disable_slp();
+  if ( roar_simple_connect(&(internal->con), internal->host, internal->client_name) == -1 ) {
+    if ( internal->host == NULL )
+      reenable_slp();
     return 0;
+  }
+  if ( internal->host == NULL )
+    reenable_slp();
 
   internal->con_opened = 1;
 



More information about the commits mailing list