[polypaudio-commits] r516 - in /trunk: configure.ac src/modules/module-detect.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Mon Feb 20 04:42:31 PST 2006


Author: ossman
Date: Mon Feb 20 13:42:28 2006
New Revision: 516

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=516&root=polypaudio&view=rev
Log:
Detect support for Solaris (/dev/audio).

Modified:
    trunk/configure.ac
    trunk/src/modules/module-detect.c

Modified: trunk/configure.ac
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/configure.ac?rev=516&root=polypaudio&r1=515&r2=516&view=diff
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Mon Feb 20 13:42:28 2006
@@ -309,7 +309,10 @@
 
 #### Solaris audio support (optional) ####
 
-AC_CHECK_HEADERS([sys/audio.h], [HAVE_SOLARIS=1], [HAVE_SOLARIS=0])
+AC_CHECK_HEADERS([sys/audio.h], [
+HAVE_SOLARIS=1
+AC_DEFINE([HAVE_SOLARIS], 1, [Have Solaris audio?])
+], [HAVE_SOLARIS=0])
 AC_SUBST(HAVE_SOLARIS)
 AM_CONDITIONAL([HAVE_SOLARIS], [test "x$HAVE_SOLARIS" = x1])
 

Modified: trunk/src/modules/module-detect.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-detect.c?rev=516&root=polypaudio&r1=515&r2=516&view=diff
==============================================================================
--- trunk/src/modules/module-detect.c (original)
+++ trunk/src/modules/module-detect.c Mon Feb 20 13:42:28 2006
@@ -171,6 +171,34 @@
 }
 #endif
 
+#ifdef HAVE_SOLARIS
+static int detect_solaris(pa_core *c, int just_one) {
+    struct stat s;
+    const char *dev;
+    char args[64];
+
+    dev = getenv("AUDIODEV");
+    if (!dev)
+        dev = "/dev/audio";
+
+    if (stat(dev, &s) < 0) {
+        if (errno != ENOENT)
+            pa_log_error(__FILE__": failed to open device %s: %s\n", dev, strerror(errno));
+        return -1;
+    }
+
+    if (!S_ISCHR(s))
+        return 0;
+
+    snprintf(args, sizeof(args), "device=%s", dev);
+
+    if (!pa_module_load(c, "module-solaris", args))
+        return 0;
+
+    return 1;
+}
+#endif
+
 int pa__init(pa_core *c, pa_module*m) {
     int just_one = 0, n = 0;
     pa_modargs *ma;
@@ -199,6 +227,9 @@
 #if HAVE_OSS
     if ((n = detect_oss(c, just_one)) <= 0)
 #endif
+#if HAVE_SOLARIS
+    if ((n = detect_solaris(c, just_one)) <= 0)
+#endif
     {
         pa_log_warn(__FILE__": failed to detect any sound hardware.\n");
         goto fail;




More information about the pulseaudio-commits mailing list