From 8521643835451e9009ce66387d9711f4d4e731b4 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 12 Sep 2004 19:36:34 +0000 Subject: build system fix update to polypaudio 0.5 show program name in client name git-svn-id: file:///home/lennart/svn/public/libao-pulse/trunk@10 a8d83910-18e2-0310-866c-8ed7f9518005 --- configure.ac | 10 +++++++++- src/Makefile.am | 4 ++-- src/ao_polyp.c | 25 ++++++++++++++++++++++--- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 17ad984..4a1da8e 100644 --- a/configure.ac +++ b/configure.ac @@ -46,7 +46,7 @@ AC_FUNC_MALLOC if test -d ../polypaudio ; then POLYP_CFLAGS='-I$(top_srcdir)/../polypaudio' - POLYP_LIBS='-L$(top_srcdir)/../polypaudio/polyp -lpolyp-simple-0.5' + POLYP_LIBS='-L$(top_srcdir)/../polypaudio/polyp -lpolyp-simple-0.5 -lpolyp-0.5' echo "*** Found polypaudio in ../polypaudio, using that version ***" else PKG_CHECK_MODULES(POLYP, [ polyplib-simple >= 0.5 ]) @@ -55,6 +55,14 @@ fi AC_SUBST(POLYP_LIBS) AC_SUBST(POLYP_CFLAGS) +PKG_CHECK_MODULES(LIBAO, [ ao >= 0.8.5 ]) +LIBAO_MODDIR=`pkg-config --variable=libdir ao`/ao/plugins-2 +echo "*** Installing libao plugin to $LIBAO_MODDIR ***" + +AC_SUBST(LIBAO_LIBS) +AC_SUBST(LIBAO_CFLAGS) +AC_SUBST(LIBAO_MODDIR) + # If using GCC specifiy some additional parameters if test "x$GCC" = "xyes" ; then CFLAGS="$CFLAGS -pipe -Wall -W -Wno-unused-parameter" diff --git a/src/Makefile.am b/src/Makefile.am index 9dbfc39..8ba4980 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -17,11 +17,11 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA. -aolibdir=$(libdir)/ao/plugins-2 +aolibdir=$(LIBAO_MODDIR) aolib_LTLIBRARIES=libpolyp.la libpolyp_la_SOURCES=ao_polyp.c libpolyp_la_LDFLAGS=-module -avoid-version libpolyp_la_LIBADD=$(AM_LIBADD) $(POLYP_LIBS) -libpolyp_la_CFLAGS=$(AM_CFLAGS) $(POLYP_CFLAGS) +libpolyp_la_CFLAGS=$(AM_CFLAGS) $(POLYP_CFLAGS) $(LIBAO_CFLAGS) diff --git a/src/ao_polyp.c b/src/ao_polyp.c index b50c4ef..23e7844 100644 --- a/src/ao_polyp.c +++ b/src/ao_polyp.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -54,7 +55,11 @@ typedef struct ao_polyp_internal { char *server, *sink; } ao_polyp_internal; -/* Yes, this is very ugly, but required... */ +/* Dirty trick: import these two functions from polyplib */ +char *pa_get_binary_name(char *s, size_t l); +char *pa_path_get_filename(const char *p); + +/* Yes, this is very ugly, but required nonetheless... */ static void disable_sigpipe(void) { struct sigaction sa; @@ -68,6 +73,7 @@ static void disable_sigpipe(void) { } int ao_plugin_test(void) { + char p[PATH_MAX], t[256], t2[256], *fn = NULL; struct pa_simple *s; static const struct pa_sample_spec ss = { .format = PA_SAMPLE_S16LE, @@ -80,7 +86,13 @@ int ao_plugin_test(void) { if (getenv("POLYP_SERVER") || getenv("POLYP_SINK")) return 1; - if (!(s = pa_simple_new(NULL, "libao", PA_STREAM_PLAYBACK, NULL, "libao test", &ss, NULL, NULL))) + if (pa_get_binary_name(p, sizeof(p))) { + fn = pa_path_get_filename(p); + snprintf(t, sizeof(t), "libao[%s]", fn); + snprintf(t2, sizeof(t2), "libao[%s] test", fn); + } + + if (!(s = pa_simple_new(NULL, fn ? t : "libao", PA_STREAM_PLAYBACK, NULL, fn ? t2 : "libao test", &ss, NULL, NULL))) return 0; pa_simple_free(s); @@ -126,6 +138,7 @@ int ao_plugin_set_option(ao_device *device, const char *key, const char *value) } int ao_plugin_open(ao_device *device, ao_sample_format *format) { + char p[PATH_MAX], t[256], t2[256], *fn = NULL; ao_polyp_internal *internal; struct pa_sample_spec ss; @@ -147,8 +160,14 @@ int ao_plugin_open(ao_device *device, ao_sample_format *format) { ss.rate = format->rate; disable_sigpipe(); + + if (pa_get_binary_name(p, sizeof(p))) { + fn = pa_path_get_filename(p); + snprintf(t, sizeof(t), "libao[%s]", fn); + snprintf(t2, sizeof(t2), "libao[%s] playback stream", fn); + } - if (!(internal->simple = pa_simple_new(internal->server, "libao", PA_STREAM_PLAYBACK, internal->sink, "libao Playback Stream", &ss, NULL, NULL))) + if (!(internal->simple = pa_simple_new(internal->server, fn ? t : "libao", PA_STREAM_PLAYBACK, internal->sink, fn ? t2 : "libao playback stream", &ss, NULL, NULL))) return 0; device->driver_byte_format = AO_FMT_NATIVE; -- cgit