From cbc777a29acd3e71ad8bf16052cb67e3de8d9212 Mon Sep 17 00:00:00 2001 From: naddy Date: Thu, 30 Oct 2008 19:25:31 +0000 Subject: [PATCH] Add a sndio output module. From ratchov@ with some tweaks by yours truly. --- audio/libao/Makefile | 29 +++-- audio/libao/files/Makefile.am | 26 ++++ audio/libao/files/ao_sndio.c | 112 ++++++++++++++++++ audio/libao/patches/patch-configure | 25 ---- audio/libao/patches/patch-configure_ac | 34 ++++++ audio/libao/patches/patch-doc_Makefile_am | 12 ++ audio/libao/patches/patch-doc_Makefile_in | 12 -- .../patches/patch-src_plugins_Makefile_am | 10 ++ .../patches/patch-src_plugins_Makefile_in | 12 -- audio/libao/pkg/DESCR-main | 3 +- audio/libao/pkg/PFRAG.shared-main | 4 +- 11 files changed, 221 insertions(+), 58 deletions(-) create mode 100644 audio/libao/files/Makefile.am create mode 100644 audio/libao/files/ao_sndio.c delete mode 100644 audio/libao/patches/patch-configure create mode 100644 audio/libao/patches/patch-configure_ac create mode 100644 audio/libao/patches/patch-doc_Makefile_am delete mode 100644 audio/libao/patches/patch-doc_Makefile_in create mode 100644 audio/libao/patches/patch-src_plugins_Makefile_am delete mode 100644 audio/libao/patches/patch-src_plugins_Makefile_in diff --git a/audio/libao/Makefile b/audio/libao/Makefile index d25ee73108d..4067c53e86f 100644 --- a/audio/libao/Makefile +++ b/audio/libao/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.41 2007/12/11 22:02:11 naddy Exp $ +# $OpenBSD: Makefile,v 1.42 2008/10/30 19:25:31 naddy Exp $ COMMENT-main= portable audio output library COMMENT-arts= aRts module for portable audio output library @@ -6,7 +6,7 @@ COMMENT-esd= ESounD module for portable audio output library VERSION= 0.8.8 DISTNAME= libao-${VERSION} -PKGNAME-main= libao-${VERSION}p0 +PKGNAME-main= libao-${VERSION}p1 PKGNAME-arts= libao-arts-${VERSION} PKGNAME-esd= libao-esd-${VERSION} CATEGORIES= audio @@ -36,7 +36,10 @@ MULTI_PACKAGES+=-esd USE_LIBTOOL= Yes SEPARATE_BUILD= simple -CONFIGURE_STYLE=gnu +AUTOCONF_VERSION = 2.61 +AUTOMAKE_VERSION = 1.9 +CONFIGURE_STYLE= no-autoheader automake autoconf + CONFIGURE_ARGS= ${CONFIGURE_SHARED} --enable-static .if ${FLAVOR:L:Mno_arts} CONFIGURE_ARGS+=--disable-arts @@ -53,7 +56,7 @@ MODULES= devel/gettext LIB_DEPENDS-main= RUN_DEPENDS-main= -WANTLIB-main= pthread +WANTLIB-main= pthread sndio LIB_DEPENDS-arts= ${MODGETTEXT_LIB_DEPENDS} \ artsc::x11/kde/arts3 @@ -65,10 +68,22 @@ LIB_DEPENDS-esd= esd.>=2::audio/esound RUN_DEPENDS-esd= :libao-${VERSION}:audio/libao WANTLIB-esd= audiofile m pthread +post-patch: + mkdir ${WRKSRC}/src/plugins/sndio + cp ${FILESDIR}/Makefile.am ${FILESDIR}/ao_sndio.c \ + ${WRKSRC}/src/plugins/sndio + cd ${WRKSRC}; AUTOCONF_VERSION=${AUTOCONF_VERSION} \ + AUTOMAKE_VERSION=${AUTOMAKE_VERSION} aclocal + +pre-configure: + cd ${WRKSRC}; AUTOCONF_VERSION=${AUTOCONF_VERSION} \ + AUTOMAKE_VERSION=${AUTOMAKE_VERSION} automake \ + --foreign --add-missing --copy + pre-build: @perl -i -pe 's:/etc/libao.conf:${SYSCONFDIR}/libao.conf:g' \ - ${WRKDIST}/src/ao_private.h \ - ${WRKDIST}/libao.conf.5 \ - ${WRKDIST}/doc/config.html + ${WRKDIST}/src/ao_private.h \ + ${WRKDIST}/libao.conf.5 \ + ${WRKDIST}/doc/config.html .include diff --git a/audio/libao/files/Makefile.am b/audio/libao/files/Makefile.am new file mode 100644 index 00000000000..30b734c66d8 --- /dev/null +++ b/audio/libao/files/Makefile.am @@ -0,0 +1,26 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = foreign + +if HAVE_SNDIO_AUDIO + +sndioltlibs = libsndio.la +sndiosources = ao_sndio.c + +else + +sndioltlibs = +sndiosources = + +endif + +INCLUDES = -I$(top_builddir)/include/ao -I$(top_srcdir)/include + +libdir = $(plugindir) +lib_LTLIBRARIES = $(sndioltlibs) + +libsndio_la_LDFLAGS = @PLUGIN_LDFLAGS@ +libsndio_la_LIBADD = -lsndio +libsndio_la_SOURCES = $(sndiosources) + +EXTRA_DIST = ao_sndio.c diff --git a/audio/libao/files/ao_sndio.c b/audio/libao/files/ao_sndio.c new file mode 100644 index 00000000000..66e6f7832d0 --- /dev/null +++ b/audio/libao/files/ao_sndio.c @@ -0,0 +1,112 @@ +/* + * + * ao_sndio.c + * + * Copyright (C) Alexandre Ratchov - 2008 + * + * libao 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, or (at your option) + * any later version. + * + * libao 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 GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +#include +#include +#include + +ao_info ao_sndio_info = { + AO_TYPE_LIVE, + "sndio audio output", + "sndio", + "Alexandre Ratchov ", + "Outputs to the sndio library", + AO_FMT_NATIVE, + 30, + NULL, /* no options */ + 0 /* zero options */ +}; + +int ao_plugin_test() +{ + struct sio_hdl *hdl; + + hdl = sio_open(NULL, SIO_PLAY, 0); + if (hdl == NULL) + return 0; + sio_close(hdl); + return 1; +} + +ao_info *ao_plugin_driver_info(void) +{ + return &ao_sndio_info; +} + +int ao_plugin_device_init(ao_device *device) +{ + struct sio_hdl *hdl; + + hdl = sio_open(NULL, SIO_PLAY, 0); + if (hdl == NULL) + return 0; + device->internal = hdl; + return 1; +} + +int ao_plugin_set_option(ao_device *device, const char *key, const char *value) +{ + return 1; +} + +int ao_plugin_open(ao_device *device, ao_sample_format *format) +{ + struct sio_hdl *hdl = (struct sio_hdl *)device->internal; + struct sio_par par; + + sio_initpar(&par); + par.sig = 1; + par.le = SIO_LE_NATIVE; + par.bits = format->bits; + par.rate = format->rate; + par.pchan = format->channels; + if (!sio_setpar(hdl, &par)) + return 0; + device->driver_byte_format = AO_FMT_NATIVE; + if (!sio_start(hdl)) + return 0; + return 1; +} + +int ao_plugin_play(ao_device *device, const char *output_samples, uint_32 num_bytes) +{ + struct sio_hdl *hdl = (struct sio_hdl *)device->internal; + + if (!sio_write(hdl, output_samples, num_bytes)) + return 0; + return 1; +} + +int ao_plugin_close(ao_device *device) +{ + struct sio_hdl *hdl = (struct sio_hdl *)device->internal; + + if (!sio_stop(hdl)) + return 0; + return 1; +} + +void ao_plugin_device_clear(ao_device *device) +{ + struct sio_hdl *hdl = (struct sio_hdl *)device->internal; + + sio_close(hdl); +} diff --git a/audio/libao/patches/patch-configure b/audio/libao/patches/patch-configure deleted file mode 100644 index fa7b63431f0..00000000000 --- a/audio/libao/patches/patch-configure +++ /dev/null @@ -1,25 +0,0 @@ -$OpenBSD: patch-configure,v 1.9 2007/07/12 21:10:15 naddy Exp $ ---- configure.orig Thu May 24 12:51:52 2007 -+++ configure Wed Jul 11 21:58:16 2007 -@@ -20076,7 +20076,7 @@ if test -z "$GCC"; then - *) - PLUGIN_LDFLAGS="-export-dynamic -avoid-version" - DEBUG="-g" -- CFLAGS="-O" -+ CFLAGS="" - PROFILE="-g -p" ;; - esac - else -@@ -20099,9 +20099,9 @@ else - PROFILE="-g -pg -D__NO_MATH_INLINES -fsigned-char -Ddlsym=dlsym_auto_underscore" ;; - *) - PLUGIN_LDFLAGS="-export-dynamic -avoid-version" -- DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char" -- CFLAGS="-O20 -D__NO_MATH_INLINES -fsigned-char" -- PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;; -+ DEBUG="-g -Wall -fsigned-char" -+ CFLAGS="-fsigned-char" -+ PROFILE="-g -pg -fsigned-char" ;; - esac - fi - CFLAGS="$CFLAGS $cflags_save" diff --git a/audio/libao/patches/patch-configure_ac b/audio/libao/patches/patch-configure_ac new file mode 100644 index 00000000000..3c35650dc0f --- /dev/null +++ b/audio/libao/patches/patch-configure_ac @@ -0,0 +1,34 @@ +$OpenBSD: patch-configure_ac,v 1.1 2008/10/30 19:25:31 naddy Exp $ +--- configure.ac.orig Thu May 24 12:51:05 2007 ++++ configure.ac Wed Oct 29 17:25:35 2008 +@@ -90,9 +90,9 @@ else + PROFILE="-g -pg -D__NO_MATH_INLINES -fsigned-char -Ddlsym=dlsym_auto_underscore" ;; + *) + PLUGIN_LDFLAGS="-export-dynamic -avoid-version" +- DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char" +- CFLAGS="-O20 -D__NO_MATH_INLINES -fsigned-char" +- PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;; ++ DEBUG="-g -Wall -fsigned-char" ++ CFLAGS="-fsigned-char" ++ PROFILE="-g -pg -fsigned-char" ;; + esac + fi + CFLAGS="$CFLAGS $cflags_save" +@@ -300,6 +300,11 @@ dnl Check for Sun audio + AC_CHECK_HEADERS(sys/audioio.h) + AM_CONDITIONAL(HAVE_SUN_AUDIO,test "${ac_cv_header_sys_audioio_h}" = yes) + ++dnl Check for libsndio audio ++ ++AC_CHECK_HEADERS(sndio.h) ++AM_CONDITIONAL(HAVE_SNDIO_AUDIO,test "${ac_cv_header_sndio_h}" = yes) ++ + dnl Check for AIX audio + + case $host in +@@ -415,4 +420,4 @@ dnl Plugins get special LDFLAGS + 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/pulse/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 src/plugins/sndio/Makefile ao.pc) diff --git a/audio/libao/patches/patch-doc_Makefile_am b/audio/libao/patches/patch-doc_Makefile_am new file mode 100644 index 00000000000..bc77555c867 --- /dev/null +++ b/audio/libao/patches/patch-doc_Makefile_am @@ -0,0 +1,12 @@ +$OpenBSD: patch-doc_Makefile_am,v 1.3 2008/10/30 19:25:31 naddy Exp $ +--- doc/Makefile.am.orig Thu May 24 11:19:08 2007 ++++ doc/Makefile.am Wed Oct 29 17:25:35 2008 +@@ -2,7 +2,7 @@ + + AUTOMAKE_OPTIONS = foreign + +-docdir = $(datadir)/doc/$(PACKAGE)-$(VERSION) ++docdir = $(datadir)/doc/$(PACKAGE) + + # We list all of these as opposed to using a wildcard so that + # building outside the source directory works. diff --git a/audio/libao/patches/patch-doc_Makefile_in b/audio/libao/patches/patch-doc_Makefile_in deleted file mode 100644 index ec885147d37..00000000000 --- a/audio/libao/patches/patch-doc_Makefile_in +++ /dev/null @@ -1,12 +0,0 @@ -$OpenBSD: patch-doc_Makefile_in,v 1.7 2007/07/12 21:10:15 naddy Exp $ ---- doc/Makefile.in.orig Wed Jul 11 21:56:58 2007 -+++ doc/Makefile.in Wed Jul 11 21:57:09 2007 -@@ -161,7 +161,7 @@ build_vendor = @build_vendor@ - builddir = @builddir@ - datadir = @datadir@ - datarootdir = @datarootdir@ --docdir = $(datadir)/doc/$(PACKAGE)-$(VERSION) -+docdir = $(datadir)/doc/$(PACKAGE) - dvidir = @dvidir@ - exec_prefix = @exec_prefix@ - host = @host@ diff --git a/audio/libao/patches/patch-src_plugins_Makefile_am b/audio/libao/patches/patch-src_plugins_Makefile_am new file mode 100644 index 00000000000..494cfa1f2db --- /dev/null +++ b/audio/libao/patches/patch-src_plugins_Makefile_am @@ -0,0 +1,10 @@ +$OpenBSD: patch-src_plugins_Makefile_am,v 1.5 2008/10/30 19:25:31 naddy Exp $ +--- src/plugins/Makefile.am.orig Thu May 24 11:19:07 2007 ++++ src/plugins/Makefile.am Wed Oct 29 17:25:35 2008 +@@ -1,4 +1,5 @@ + ## Process this file with automake to produce Makefile.in + + AUTOMAKE_OPTIONS = foreign +-SUBDIRS = oss esd arts alsa alsa09 sun irix macosx nas pulse ++SUBDIRS = oss esd arts alsa alsa09 sun irix macosx nas pulse sndio ++AM_MAKEFLAGS = LIBTOOL="$(LIBTOOL) --tag=disable-static" diff --git a/audio/libao/patches/patch-src_plugins_Makefile_in b/audio/libao/patches/patch-src_plugins_Makefile_in deleted file mode 100644 index ef5242845c4..00000000000 --- a/audio/libao/patches/patch-src_plugins_Makefile_in +++ /dev/null @@ -1,12 +0,0 @@ -$OpenBSD: patch-src_plugins_Makefile_in,v 1.3 2007/07/12 21:10:15 naddy Exp $ ---- src/plugins/Makefile.in.orig Thu Jul 12 21:05:42 2007 -+++ src/plugins/Makefile.in Thu Jul 12 21:06:21 2007 -@@ -259,7 +259,7 @@ $(RECURSIVE_TARGETS): - else \ - local_target="$$target"; \ - fi; \ -- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ -+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) LIBTOOL="$(LIBTOOL) --tag=disable-static" $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ diff --git a/audio/libao/pkg/DESCR-main b/audio/libao/pkg/DESCR-main index 06c1805507a..935582ac911 100644 --- a/audio/libao/pkg/DESCR-main +++ b/audio/libao/pkg/DESCR-main @@ -5,4 +5,5 @@ it currently supports: * raw output * AU files * WAV files - * sun (OpenBSD's native sound system) + * sun + * sndio (OpenBSD's native sound system) diff --git a/audio/libao/pkg/PFRAG.shared-main b/audio/libao/pkg/PFRAG.shared-main index f29013e5b89..ef40c6bfef9 100644 --- a/audio/libao/pkg/PFRAG.shared-main +++ b/audio/libao/pkg/PFRAG.shared-main @@ -1,6 +1,8 @@ -@comment $OpenBSD: PFRAG.shared-main,v 1.2 2007/07/12 21:10:15 naddy Exp $ +@comment $OpenBSD: PFRAG.shared-main,v 1.3 2008/10/30 19:25:31 naddy Exp $ lib/ao/ lib/ao/plugins-2/ +@comment lib/ao/plugins-2/libsndio.la +lib/ao/plugins-2/libsndio.so @comment lib/ao/plugins-2/libsun.la lib/ao/plugins-2/libsun.so @lib lib/libao.so.${LIBao_VERSION}