]> code.delx.au - pulseaudio/commitdiff
add esd compatible startup script
authorLennart Poettering <lennart@poettering.net>
Wed, 1 Sep 2004 17:36:46 +0000 (17:36 +0000)
committerLennart Poettering <lennart@poettering.net>
Wed, 1 Sep 2004 17:36:46 +0000 (17:36 +0000)
add default configuration script

git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@172 fefdeb5f-60dc-0310-8127-8f9354f1896f

configure.ac
doc/todo
polyp/Makefile.am
polyp/cmdline.c
polyp/esdcompat.sh.in [new file with mode: 0755]
polyp/main.c
polyp/polypaudio.pa

index 7aa6c5d4893be2912142db84be152099ae41cce5..2c470435ead6ab9be222bc27457d8fb83b467a93 100644 (file)
@@ -115,5 +115,8 @@ AM_CONDITIONAL([USE_LYNX], [test "x$lynx" = xyes])
 
 AM_CONDITIONAL(BUILD_LIBPOLYPCORE, false)
 
-AC_CONFIG_FILES([Makefile polyp/Makefile polyplib.pc polyplib-simple.pc polyplib-mainloop.pc polyplib-error.pc polyplib-glib-mainloop.pc polyplib-glib12-mainloop.pc doc/Makefile doc/README.html doc/cli.html doc/daemon.html doc/modules.html doxygen/Makefile doxygen/doxygen.conf polyp/polyplib-version.h])
+ESDCOMPAT_BINARY=$(bindir)/polypaudio
+AC_SUBST(ESDCOMPAT_BINARY)
+
+AC_CONFIG_FILES([Makefile polyp/Makefile polyplib.pc polyplib-simple.pc polyplib-mainloop.pc polyplib-error.pc polyplib-glib-mainloop.pc polyplib-glib12-mainloop.pc doc/Makefile doc/README.html doc/cli.html doc/daemon.html doc/modules.html doxygen/Makefile doxygen/doxygen.conf polyp/polyplib-version.h polyp/esdcompat.sh])
 AC_OUTPUT
index 8ad59f1b86f0aa66cc2875649327ecf8e4231e24..e9c8256259888d8172290445664f7473fb964b8e 100644 (file)
--- a/doc/todo
+++ b/doc/todo
@@ -12,8 +12,8 @@
 - daemon autostart
 - cleanup tagstruct and modargs (add s32, pa_volume_t, pa_usec_t)
 - remove all gcc warnings
-- esd compatible startup script or personality
 - add total sample cache size to stat
+- make fragments settings runtime configurable
 
 ** later ***
 - xmlrpc/http
index cd369657aaedf2af33004058227fcacb82027dd6..7d6d9bb3fbabcab78e6a82a0eb4e9582913b119a 100644 (file)
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 # USA.
 
+polypincludedir=$(includedir)/polyp
+polypconfdir=$(sysconfdir)/polyp
+
 AM_CFLAGS=-D_GNU_SOURCE -I$(top_srcdir) $(PTHREAD_CFLAGS)
-#AM_CFLAGS+= -DDLSEARCHDIR=\"$(pkglibdir)\" 
+#AM_CFLAGS+= -DPA_DLSEARCHDIR=\"$(pkglibdir)\" 
+AM_CFLAGS+= -DPA_DEFAULT_CONFIG_FILE=\"$(polypconfdir)/polypaudio.pa\"
 AM_LDADD=$(PTHREAD_LIBS) -lm
 AM_LIBADD=$(PTHREAD_LIBS) -lm
 
-polypincludedir=$(includedir)/polyp
 
 EXTRA_DIST = polypaudio.pa depmod.py
 bin_PROGRAMS = polypaudio pacat pactl
 noinst_PROGRAMS = mainloop-test mainloop-test-glib mainloop-test-glib12 pacat-simple parec-simple 
 
+polypconf_DATA=polypaudio.pa 
+
 BUILT_SOURCES=polyplib-version.h
 
 polypinclude_HEADERS=polyplib.h \
index 9935e7b66de3a84a20f41e6136274790648b1f26..6538b93016005790520e066fd91b2d6eeb99c247 100644 (file)
@@ -48,6 +48,7 @@ void pa_cmdline_help(const char *argv0) {
            "  -L MODULE  Load the specified plugin module with the specified argument\n"
            "  -F FILE    Run the specified script\n"
            "  -C         Open a command line on the running TTY\n"
+           "  -n         Don't load configuration file ("PA_DEFAULT_CONFIG_FILE")\n"
            "  -D         Daemonize after loading the modules\n"
            "  -f         Dont quit when the startup fails\n"
            "  -v         Verbose startup\n"
@@ -59,6 +60,7 @@ struct pa_cmdline* pa_cmdline_parse(int argc, char * const argv []) {
     char c;
     struct pa_cmdline *cmdline = NULL;
     struct pa_strbuf *buf = NULL;
+    int no_default_config_file = 0;
     assert(argc && argv);
 
     cmdline = pa_xmalloc(sizeof(struct pa_cmdline));
@@ -68,7 +70,7 @@ struct pa_cmdline* pa_cmdline_parse(int argc, char * const argv []) {
     buf = pa_strbuf_new();
     assert(buf);
     
-    while ((c = getopt(argc, argv, "L:F:CDhfvrRV")) != -1) {
+    while ((c = getopt(argc, argv, "L:F:CDhfvrRVn")) != -1) {
         switch (c) {
             case 'L':
                 pa_strbuf_printf(buf, "load %s\n", optarg);
@@ -100,12 +102,19 @@ struct pa_cmdline* pa_cmdline_parse(int argc, char * const argv []) {
             case 'V':
                 cmdline->version = 1;
                 break;
+            case 'n':
+                no_default_config_file =1;
+                break;
                 
             default:
                 goto fail;
         }
     }
 
+    if (!no_default_config_file)
+        pa_strbuf_puts(buf, ".include "PA_DEFAULT_CONFIG_FILE"\n");
+    
+
     cmdline->cli_commands = pa_strbuf_tostring_free(buf);
     return cmdline;
     
diff --git a/polyp/esdcompat.sh.in b/polyp/esdcompat.sh.in
new file mode 100755 (executable)
index 0000000..1033930
--- /dev/null
@@ -0,0 +1,83 @@
+#!/bin/sh
+
+# $Id$
+#
+# This file is part of polypaudio.
+#
+# polypaudio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# polypaudio is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with polypaudio; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA.
+
+VERSION_STRING="@PACKAGE_NAME@ esd wrapper @PACKAGE_VERSION@"
+
+fail() {
+    echo "$1" > /dev/stderr
+    exit 1
+}
+
+for N in $(seq $#) ; do
+
+    case "$1" in
+
+        -v|--version)
+            echo "$VERSION_STRING"
+            exit 0
+            ;;
+
+        -h|--help)
+            cat <<EOF
+$VERSION_STRING
+
+Usage: $0 [options]
+
+  -v --version  print version information
+  -h --help     show this help
+
+Ignored directives:
+
+  -tcp          use tcp/ip sockets in addition to unix domain
+  -promiscuous  don't require authentication
+  -d DEVICE     force esd to use sound device DEVICE
+  -b            run server in 8 bit sound mode
+  -r RATE       run server at sample rate of RATE
+  -as SECS      free audio device after SECS of inactivity
+  -unix         use unix domain sockets instead of tcp/ip
+  -public       make tcp/ip access public (other than localhost)
+  -terminate    terminate esd daemone after last client exits
+  -nobeeps      disable startup beeps
+  -trust        start esd even if use of /tmp/.esd can be insecure
+  -port PORT   listen for connections at PORT (only for tcp/ip)
+  -bind ADDRESS binds to ADDRESS (only for tcp/ip)
+EOF
+            exit 0
+            ;;
+        
+        -unix|-b|-public|-terminate|-nobeeps|-trust|-tcp|-promiscuous)  
+            # Ignore these commands
+            ;; 
+
+        -d|-r|-as|-port|-bind)
+            # Ignore these commands and their arguments
+            shift
+            ;;
+
+        *)
+            fail "Unknown command: $1"
+            ;;
+    esac
+
+    shift
+done
+
+exec "@ESDCOMPAT_BINARY@" -r
index 526bf74492ca82b656d2b4326d27b51dea88016c..e41a106f62b70e8d5469e6ec8d5e934bb97113c6 100644 (file)
@@ -145,8 +145,8 @@ int main(int argc, char *argv[]) {
     
     r = lt_dlinit();
     assert(r == 0);
-#ifdef DLSEARCHDIR
-    lt_dladdsearchdir(DLSEARCHDIR);
+#ifdef PA_DLSEARCHDIR
+    lt_dladdsearchdir(PA_DLSEARCHDIR);
 #endif
 
     mainloop = pa_mainloop_new();
index 8c5157a1d35d4eb4071cf47bafd1ec99ecdf041f..0c69893a46cc9ec3c8f59c5f9fb539f9c139d0d4 100755 (executable)
@@ -1,4 +1,4 @@
-#!./polypaudio -rF 
+#!./polypaudio -rn
 
 #
 # This file is part of polypaudio.