[xiph-commits] r11706 - in trunk/ao: . debian src/plugins
src/plugins/pulse
giles at svn.xiph.org
giles at svn.xiph.org
Tue Jul 18 12:58:58 PDT 2006
Author: giles
Date: 2006-07-18 12:58:56 -0700 (Tue, 18 Jul 2006)
New Revision: 11706
Added:
trunk/ao/src/plugins/pulse/ao_pulse.c
Removed:
trunk/ao/src/plugins/pulse/ao_polyp.c
Modified:
trunk/ao/README
trunk/ao/configure.in
trunk/ao/debian/libao-dev.install
trunk/ao/debian/libao2.install
trunk/ao/src/plugins/Makefile.am
trunk/ao/src/plugins/pulse/Makefile.am
Log:
Update for polyp->pulse rename, part two.
Modified: trunk/ao/README
===================================================================
--- trunk/ao/README 2006-07-18 19:55:37 UTC (rev 11705)
+++ trunk/ao/README 2006-07-18 19:58:56 UTC (rev 11706)
@@ -3,7 +3,7 @@
Originally Copyright (C) Aaron Holtzman - May 1999
Changes Copyright (C) Jack Moffitt - October 2000
Changes Copyright (C) Stan Seibert - July 2000-March 2004
-libao-poly Copyright (C) Lennart Poettering 2004
+libao-pulse Copyright (C) Lennart Poettering 2004-2006
Changes Copyright (C) 2004-2005 Xiph.org Foundation
libao is free software; you can redistribute it and/or modify
@@ -32,7 +32,7 @@
* OSS (Open Sound System)
* ESD (ESounD or Enlightened Sound Daemon)
* ALSA (Advanced Linux Sound Architecture)
- * polypaudio (next generation GNOME sound server)
+ * PulseAudio (next generation GNOME sound server)
* AIX
* Solaris (untested)
* IRIX (untested)
Modified: trunk/ao/configure.in
===================================================================
--- trunk/ao/configure.in 2006-07-18 19:55:37 UTC (rev 11705)
+++ trunk/ao/configure.in 2006-07-18 19:58:56 UTC (rev 11706)
@@ -331,20 +331,20 @@
AC_SUBST(NAS_CFLAGS)
AC_SUBST(NAS_LIBS)
-dnl Check for polyp
+dnl Check for pulse
-AC_ARG_ENABLE(polyp, [ --enable-polyp include Polypaudio output plugin ],
-[ BUILD_POLYP="$enableval" ],[ BUILD_POLYP="yes" ])
+AC_ARG_ENABLE(pulse, [ --enable-pulse include PulseAudio output plugin ],
+[ BUILD_PULSE="$enableval" ],[ BUILD_PULSE="yes" ])
-have_polyp=no
-if test "x$BUILD_POLYP" = "xyes" ; then
- PKG_CHECK_MODULES(POLYP, [ polyplib-simple >= 0.6 ],
- [have_polyp=yes],[have_polyp=no])
- AC_SUBST(POLYP_LIBS)
- AC_SUBST(POLYP_CFLAGS)
+have_pulse=no
+if test "x$BUILD_PULSE" = "xyes" ; then
+ PKG_CHECK_MODULES(PULSE, [ libpulse-simple >= 0.9 ],
+ [have_pulse=yes],[have_pulse=no])
+ AC_SUBST(PULSE_LIBS)
+ AC_SUBST(PULSE_CFLAGS)
fi
-AM_CONDITIONAL(HAVE_POLYP,test "x$have_polyp" = xyes)
+AM_CONDITIONAL(HAVE_PULSE,test "x$have_pulse" = xyes)
dnl Orphaned driver. We'll probably dump it soon.
AM_CONDITIONAL(HAVE_SOLARIS,test "x$have_solaris" = xyes)
@@ -353,4 +353,4 @@
AC_SUBST(PLUGIN_LDFLAGS)
-AC_OUTPUT(Makefile src/Makefile doc/Makefile include/Makefile include/ao/Makefile include/ao/os_types.h src/plugins/Makefile src/plugins/esd/Makefile src/plugins/oss/Makefile src/plugins/alsa/Makefile src/plugins/alsa09/Makefile src/plugins/sun/Makefile src/plugins/irix/Makefile src/plugins/arts/Makefile src/plugins/macosx/Makefile src/plugins/nas/Makefile src/plugins/polyp/Makefile ao.pc)
+AC_OUTPUT(Makefile src/Makefile doc/Makefile include/Makefile include/ao/Makefile include/ao/os_types.h src/plugins/Makefile src/plugins/esd/Makefile src/plugins/oss/Makefile src/plugins/alsa/Makefile src/plugins/alsa09/Makefile src/plugins/sun/Makefile src/plugins/irix/Makefile src/plugins/arts/Makefile src/plugins/macosx/Makefile src/plugins/nas/Makefile src/plugins/pulse/Makefile ao.pc)
Modified: trunk/ao/debian/libao-dev.install
===================================================================
--- trunk/ao/debian/libao-dev.install 2006-07-18 19:55:37 UTC (rev 11705)
+++ trunk/ao/debian/libao-dev.install 2006-07-18 19:58:56 UTC (rev 11706)
@@ -11,7 +11,7 @@
debian/tmp/usr/lib/ao/plugins-2/libnas.la
debian/tmp/usr/lib/ao/plugins-2/liboss.a
debian/tmp/usr/lib/ao/plugins-2/liboss.la
-debian/tmp/usr/lib/ao/plugins-2/libpolyp.la
+debian/tmp/usr/lib/ao/plugins-2/libpulse.la
debian/tmp/usr/lib/libao.a
debian/tmp/usr/lib/libao.la
debian/tmp/usr/lib/libao.so
Modified: trunk/ao/debian/libao2.install
===================================================================
--- trunk/ao/debian/libao2.install 2006-07-18 19:55:37 UTC (rev 11705)
+++ trunk/ao/debian/libao2.install 2006-07-18 19:58:56 UTC (rev 11706)
@@ -4,5 +4,5 @@
debian/tmp/usr/lib/ao/plugins-2/libesd.so
debian/tmp/usr/lib/ao/plugins-2/libnas.so
debian/tmp/usr/lib/ao/plugins-2/liboss.so
-debian/tmp/usr/lib/ao/plugins-2/libpolyp.so
+debian/tmp/usr/lib/ao/plugins-2/libpulse.so
debian/tmp/usr/lib/libao.so.*
Modified: trunk/ao/src/plugins/Makefile.am
===================================================================
--- trunk/ao/src/plugins/Makefile.am 2006-07-18 19:55:37 UTC (rev 11705)
+++ trunk/ao/src/plugins/Makefile.am 2006-07-18 19:58:56 UTC (rev 11706)
@@ -1,4 +1,4 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = foreign
-SUBDIRS = oss esd arts alsa alsa09 sun irix macosx nas polyp
+SUBDIRS = oss esd arts alsa alsa09 sun irix macosx nas pulse
Modified: trunk/ao/src/plugins/pulse/Makefile.am
===================================================================
--- trunk/ao/src/plugins/pulse/Makefile.am 2006-07-18 19:55:37 UTC (rev 11705)
+++ trunk/ao/src/plugins/pulse/Makefile.am 2006-07-18 19:58:56 UTC (rev 11706)
@@ -2,26 +2,26 @@
AUTOMAKE_OPTIONS = foreign
-if HAVE_POLYP
+if HAVE_PULSE
-polypltlibs = libpolyp.la
-polypsources = ao_polyp.c
+pulseltlibs = libpulse.la
+pulsesources = ao_pulse.c
else
-polypltlibs =
-polypsources =
+pulseltlibs =
+pulsesources =
endif
INCLUDES = -I$(top_builddir)/include/ao -I$(top_srcdir)/include
libdir = $(plugindir)
-lib_LTLIBRARIES = $(polypltlibs)
+lib_LTLIBRARIES = $(pulseltlibs)
-libpolyp_la_LDFLAGS= @PLUGIN_LDFLAGS@
-libpolyp_la_SOURCES=$(polypsources)
-libpolyp_la_LIBADD=$(AM_LIBADD) $(POLYP_LIBS)
-libpolyp_la_CFLAGS=$(AM_CFLAGS) $(POLYP_CFLAGS)
+libpulse_la_LDFLAGS= @PLUGIN_LDFLAGS@
+libpulse_la_SOURCES=$(pulsesources)
+libpulse_la_LIBADD=$(AM_LIBADD) $(pulse_LIBS)
+libpulse_la_CFLAGS=$(AM_CFLAGS) $(pulse_CFLAGS)
-EXTRA_DIST = ao_polyp.c
+EXTRA_DIST = ao_pulse.c
Deleted: trunk/ao/src/plugins/pulse/ao_polyp.c
===================================================================
--- trunk/ao/src/plugins/pulse/ao_polyp.c 2006-07-18 19:55:37 UTC (rev 11705)
+++ trunk/ao/src/plugins/pulse/ao_polyp.c 2006-07-18 19:58:56 UTC (rev 11706)
@@ -1,204 +0,0 @@
-/* $Id: ao_polyp.c 13 2004-09-19 23:40:00Z lennart $ */
-
-/***
- This file is part of libao-polyp.
-
- libao-polyp 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.
-
- libao-polyp 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 libao-polyp; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <string.h>
-#include <signal.h>
-#include <limits.h>
-
-#include <polyp/polyplib-simple.h>
-#include <ao/ao.h>
-#include <ao/plugin.h>
-
-/* Unfortunately libao doesn't allow "const" for these structures... */
-static char * ao_polyp_options[] = {
- "server",
- "sink"
-};
-
-static ao_info ao_polyp_info = {
- AO_TYPE_LIVE,
- "polypaudio output",
- "polyp",
- PACKAGE_BUGREPORT,
- "Outputs to the Polypaudio Sound Server",
- AO_FMT_NATIVE,
- 41,
- ao_polyp_options,
- 2
-};
-
-typedef struct ao_polyp_internal {
- struct pa_simple *simple;
- char *server, *sink;
-} ao_polyp_internal;
-
-/* 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;
-
- sigaction(SIGPIPE, NULL, &sa);
- if (sa.sa_handler != SIG_IGN) {
- memset(&sa, 0, sizeof(sa));
- sa.sa_handler = SIG_IGN;
- sa.sa_flags = SA_RESTART;
- sigaction(SIGPIPE, &sa, NULL);
- }
-}
-
-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,
- .rate = 44100,
- .channels = 2
- };
-
- disable_sigpipe();
-
- if (getenv("POLYP_SERVER") || getenv("POLYP_SINK"))
- return 1;
-
- 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, PA_VOLUME_NORM, NULL)))
- return 0;
-
- pa_simple_free(s);
- return 1;
-}
-
-ao_info *ao_plugin_driver_info(void) {
- return &ao_polyp_info;
-}
-
-int ao_plugin_device_init(ao_device *device) {
- ao_polyp_internal *internal;
- assert(device);
-
- internal = (ao_polyp_internal *) malloc(sizeof(ao_polyp_internal));
-
- if (internal == NULL)
- return 0;
-
- internal->simple = NULL;
- internal->server = NULL;
- internal->sink = NULL;
- device->internal = internal;
-
- return 1;
-}
-
-int ao_plugin_set_option(ao_device *device, const char *key, const char *value) {
- ao_polyp_internal *internal;
- assert(device && device->internal && key && value);
- internal = (ao_polyp_internal *) device->internal;
-
- if (!strcmp(key, "server")) {
- free(internal->server);
- internal->server = strdup(value);
- } else if (!strcmp(key, "sink")) {
- free(internal->sink);
- internal->sink = strdup(value);
- } else
- return 0;
-
- return 1;
-}
-
-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;
-
- assert(device && device->internal && format);
-
- internal = (ao_polyp_internal *) device->internal;
-
- if (format->bits == 8)
- ss.format = PA_SAMPLE_U8;
- else if (format->bits == 16)
- ss.format = PA_SAMPLE_S16NE;
- else
- return 0;
-
- if (format->channels <= 0)
- return 0;
-
- ss.channels = format->channels;
- 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, fn ? t : "libao", PA_STREAM_PLAYBACK, internal->sink, fn ? t2 : "libao playback stream", &ss, NULL, PA_VOLUME_NORM, NULL)))
- return 0;
-
- device->driver_byte_format = AO_FMT_NATIVE;
- return 1;
-}
-
-int ao_plugin_play(ao_device *device, const char* output_samples, uint_32 num_bytes) {
- assert(device && device->internal);
- ao_polyp_internal *internal = (ao_polyp_internal *) device->internal;
-
- return pa_simple_write(internal->simple, output_samples, num_bytes, NULL) >= 0;
-}
-
-
-int ao_plugin_close(ao_device *device) {
- assert(device && device->internal);
- ao_polyp_internal *internal = (ao_polyp_internal *) device->internal;
-
- pa_simple_drain(internal->simple, NULL);
- pa_simple_free(internal->simple);
- internal->simple = NULL;
-
- return 1;
-}
-
-void ao_plugin_device_clear(ao_device *device) {
- assert(device && device->internal);
- ao_polyp_internal *internal = (ao_polyp_internal *) device->internal;
-
- free(internal->server);
- free(internal->sink);
- free(internal);
- device->internal = NULL;
-}
Copied: trunk/ao/src/plugins/pulse/ao_pulse.c (from rev 11705, trunk/ao/src/plugins/pulse/ao_polyp.c)
===================================================================
--- trunk/ao/src/plugins/pulse/ao_polyp.c 2006-07-18 19:55:37 UTC (rev 11705)
+++ trunk/ao/src/plugins/pulse/ao_pulse.c 2006-07-18 19:58:56 UTC (rev 11706)
@@ -0,0 +1,203 @@
+/* $Id: ao_pulse.c 36 2006-07-14 00:05:13Z lennart $ */
+
+/***
+ This file is part of libao-pulse.
+
+ libao-pulse 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.
+
+ libao-pulse 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 libao-pulse; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA.
+***/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <assert.h>
+#include <string.h>
+#include <signal.h>
+#include <limits.h>
+
+#include <pulse/simple.h>
+#include <pulse/util.h>
+
+#include <ao/ao.h>
+#include <ao/plugin.h>
+
+/* Unfortunately libao doesn't allow "const" for these structures... */
+static char * ao_pulse_options[] = {
+ "server",
+ "sink"
+};
+
+static ao_info ao_pulse_info = {
+ AO_TYPE_LIVE,
+ "PulseAudio Output",
+ "pulse",
+ PACKAGE_BUGREPORT,
+ "Outputs to the PulseAudio Sound Server",
+ AO_FMT_NATIVE,
+ 41,
+ ao_pulse_options,
+ 2
+};
+
+typedef struct ao_pulse_internal {
+ struct pa_simple *simple;
+ char *server, *sink;
+} ao_pulse_internal;
+
+/* Yes, this is very ugly, but required nonetheless... */
+static void disable_sigpipe(void) {
+ struct sigaction sa;
+
+ sigaction(SIGPIPE, NULL, &sa);
+ if (sa.sa_handler != SIG_IGN) {
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = SIG_IGN;
+ sa.sa_flags = SA_RESTART;
+ sigaction(SIGPIPE, &sa, NULL);
+ }
+}
+
+int ao_plugin_test(void) {
+ char p[PATH_MAX], t[256], t2[256];
+ const char *fn;
+ struct pa_simple *s;
+ static const struct pa_sample_spec ss = {
+ .format = PA_SAMPLE_S16LE,
+ .rate = 44100,
+ .channels = 2
+ };
+
+ disable_sigpipe();
+
+ if (getenv("PULSE_SERVER") || getenv("PULSE_SINK"))
+ return 1;
+
+ if ((fn = pa_get_binary_name(p, sizeof(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, NULL)))
+ return 0;
+
+ pa_simple_free(s);
+ return 1;
+}
+
+ao_info *ao_plugin_driver_info(void) {
+ return &ao_pulse_info;
+}
+
+int ao_plugin_device_init(ao_device *device) {
+ ao_pulse_internal *internal;
+ assert(device);
+
+ internal = (ao_pulse_internal *) malloc(sizeof(ao_pulse_internal));
+
+ if (internal == NULL)
+ return 0;
+
+ internal->simple = NULL;
+ internal->server = NULL;
+ internal->sink = NULL;
+ device->internal = internal;
+
+ return 1;
+}
+
+int ao_plugin_set_option(ao_device *device, const char *key, const char *value) {
+ ao_pulse_internal *internal;
+ assert(device && device->internal && key && value);
+ internal = (ao_pulse_internal *) device->internal;
+
+ if (!strcmp(key, "server")) {
+ free(internal->server);
+ internal->server = strdup(value);
+ } else if (!strcmp(key, "sink")) {
+ free(internal->sink);
+ internal->sink = strdup(value);
+ } else
+ return 0;
+
+ return 1;
+}
+
+int ao_plugin_open(ao_device *device, ao_sample_format *format) {
+ char p[PATH_MAX], t[256], t2[256];
+ const char *fn = NULL;
+ ao_pulse_internal *internal;
+ struct pa_sample_spec ss;
+
+ assert(device && device->internal && format);
+
+ internal = (ao_pulse_internal *) device->internal;
+
+ if (format->bits == 8)
+ ss.format = PA_SAMPLE_U8;
+ else if (format->bits == 16)
+ ss.format = PA_SAMPLE_S16NE;
+ else
+ return 0;
+
+ if (format->channels <= 0)
+ return 0;
+
+ ss.channels = format->channels;
+ 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, fn ? t : "libao", PA_STREAM_PLAYBACK, internal->sink, fn ? t2 : "libao playback stream", &ss, NULL, NULL, NULL)))
+ return 0;
+
+ device->driver_byte_format = AO_FMT_NATIVE;
+ return 1;
+}
+
+int ao_plugin_play(ao_device *device, const char* output_samples, uint_32 num_bytes) {
+ assert(device && device->internal);
+ ao_pulse_internal *internal = (ao_pulse_internal *) device->internal;
+
+ return pa_simple_write(internal->simple, output_samples, num_bytes, NULL) >= 0;
+}
+
+
+int ao_plugin_close(ao_device *device) {
+ assert(device && device->internal);
+ ao_pulse_internal *internal = (ao_pulse_internal *) device->internal;
+
+ pa_simple_drain(internal->simple, NULL);
+ pa_simple_free(internal->simple);
+ internal->simple = NULL;
+
+ return 1;
+}
+
+void ao_plugin_device_clear(ao_device *device) {
+ assert(device && device->internal);
+ ao_pulse_internal *internal = (ao_pulse_internal *) device->internal;
+
+ free(internal->server);
+ free(internal->sink);
+ free(internal);
+ device->internal = NULL;
+}
More information about the commits
mailing list