Add a sndio output module.

From ratchov@ with some tweaks by yours truly.
This commit is contained in:
naddy 2008-10-30 19:25:31 +00:00
parent df5325e661
commit cbc777a29a
11 changed files with 221 additions and 58 deletions

View File

@ -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 <bsd.port.mk>

View File

@ -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

View File

@ -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 <sndio.h>
#include <ao/ao.h>
#include <ao/plugin.h>
ao_info ao_sndio_info = {
AO_TYPE_LIVE,
"sndio audio output",
"sndio",
"Alexandre Ratchov <alex@caoua.org>",
"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);
}

View File

@ -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"

View File

@ -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)

View File

@ -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.

View File

@ -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@

View File

@ -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"

View File

@ -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 \

View File

@ -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)

View File

@ -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}