update to 1.7.3; 32-bit audio is now supported

This commit is contained in:
naddy 2009-04-28 19:07:26 +00:00
parent 5ff4780e4c
commit f71d0d7090
7 changed files with 69 additions and 284 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.41 2009/01/11 17:36:34 naddy Exp $
# $OpenBSD: Makefile,v 1.42 2009/04/28 19:07:26 naddy Exp $
COMMENT= MPEG-1/2 audio layer 1, 2, and 3 player
DISTNAME= mpg123-1.6.4
SHARED_LIBS= mpg123 0.1 # .11.3
DISTNAME= mpg123-1.7.3
SHARED_LIBS= mpg123 1.0 # .14.4
CATEGORIES= audio
HOMEPAGE= http://www.mpg123.de/
@ -16,14 +16,14 @@ PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=mpg123/}
EXTRACT_SUFX= .tar.bz2
WANTLIB= c m sndio
LIB_DEPENDS= ltdl::devel/libtool,-ltdl
USE_LIBTOOL= Yes
AUTOCONF_VERSION=2.62
AUTOMAKE_VERSION=1.9
CONFIGURE_STYLE=autoconf automake
SEPARATE_BUILD= simple
CONFIGURE_STYLE=gnu
CONFIGURE_ARGS= ${CONFIGURE_SHARED} --enable-static \
--with-audio=sndio \
--with-optimization=0
@ -39,18 +39,4 @@ CONFIGURE_ARGS+=--with-cpu=x86
CONFIGURE_ARGS+=--with-cpu=generic_fpu
.endif
post-extract:
@cp ${FILESDIR}/sndio.c ${WRKSRC}/src/output
AUTO_ENV= AUTOCONF_VERSION=${AUTOCONF_VERSION} \
AUTOMAKE_VERSION=${AUTOMAKE_VERSION}
post-patch:
@echo "Running aclocal-${AUTOMAKE_VERSION} in ${WRKSRC}"
@cd ${WRKSRC}; ${AUTO_ENV} aclocal
pre-configure:
@echo "Running automake-${AUTOMAKE_VERSION} in ${WRKSRC}"
@cd ${WRKSRC}; ${AUTO_ENV} automake --foreign
.include <bsd.port.mk>

View File

@ -1,5 +1,5 @@
MD5 (mpg123-1.6.4.tar.gz) = vObkv4LGpbMmh5cAeFEZ6g==
RMD160 (mpg123-1.6.4.tar.gz) = 3EMfEZCaZM+zYxNwKIWWBWf+UmE=
SHA1 (mpg123-1.6.4.tar.gz) = kJsaXJrwOs7XXYn5Un/n+c5TzLI=
SHA256 (mpg123-1.6.4.tar.gz) = hZ1qT0UxRdDAw8CiX2wdVRyi14rFhl3/4MlvgLbW9NM=
SIZE (mpg123-1.6.4.tar.gz) = 1291496
MD5 (mpg123-1.7.3.tar.bz2) = ISPbFsIqH+PFUXwVUaqdiw==
RMD160 (mpg123-1.7.3.tar.bz2) = WukfV6pmYzbtGywj07dp4Ceo6Rc=
SHA1 (mpg123-1.7.3.tar.bz2) = nw0oh4PaVTnmfKkawSCX7wiNWvM=
SHA256 (mpg123-1.7.3.tar.bz2) = uJNaj0gdSbB9Of4NOqLuy/f2MQArZNKeCZ3htb6G6do=
SIZE (mpg123-1.7.3.tar.bz2) = 1152707

View File

@ -1,140 +0,0 @@
/*
* sndio: sndio audio output
*
* Copyright (c) 2008 Christian Weisgerber <naddy@openbsd.org>,
* Alexandre Ratchov <alex@caoua.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "mpg123app.h"
#include <sndio.h>
#include "debug.h"
static int open_sndio(audio_output_t *ao)
{
struct sio_hdl *hdl;
struct sio_par par;
hdl = sio_open(ao->device /* NULL is fine */, SIO_PLAY, 0);
if (hdl == NULL)
return -1;
sio_initpar(&par);
par.rate = ao->rate;
par.pchan = ao->channels;
par.le = SIO_LE_NATIVE;
switch(ao->format) {
case MPG123_ENC_SIGNED_16:
case -1: /* query mode */
par.sig = 1;
par.bits = 16;
break;
case MPG123_ENC_UNSIGNED_16:
par.sig = 0;
par.bits = 16;
break;
case MPG123_ENC_UNSIGNED_8:
par.sig = 0;
par.bits = 8;
break;
case MPG123_ENC_SIGNED_8:
par.sig = 1;
par.bits = 8;
break;
default:
if (!AOQUIET)
error1("open_sndio: invalid sample format %d",
ao->format);
sio_close(hdl);
return -1;
}
if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par) ||
!sio_start(hdl)) {
sio_close(hdl);
return -1;
}
if ((par.bits != 8 && par.bits != 16) || par.le != SIO_LE_NATIVE) {
sio_close(hdl);
return -1;
}
ao->rate = par.rate;
ao->channels = par.pchan;
ao->format = (par.bits == 8) ?
(par.sig ? MPG123_ENC_SIGNED_8 : MPG123_ENC_UNSIGNED_8) :
(par.sig ? MPG123_ENC_SIGNED_16 : MPG123_ENC_UNSIGNED_16);
ao->userptr = hdl;
return 0;
}
static int get_formats_sndio(audio_output_t *ao)
{
return (MPG123_ENC_SIGNED_16|MPG123_ENC_UNSIGNED_16|
MPG123_ENC_UNSIGNED_8|MPG123_ENC_SIGNED_8);
}
static int write_sndio(audio_output_t *ao, unsigned char *buf, int len)
{
struct sio_hdl *hdl = (struct sio_hdl *)ao->userptr;
int count;
count = (int)sio_write(hdl, buf, len);
if (count == 0 && sio_eof(hdl))
return -1;
return count;
}
static void flush_sndio(audio_output_t *ao)
{
return;
}
static int close_sndio(audio_output_t *ao)
{
struct sio_hdl *hdl = (struct sio_hdl *)ao->userptr;
sio_close(hdl);
return 0;
}
static int init_sndio(audio_output_t* ao)
{
if (ao == NULL)
return -1;
/* Set callbacks */
ao->open = open_sndio;
ao->flush = flush_sndio; /* required */
ao->write = write_sndio;
ao->get_formats = get_formats_sndio;
ao->close = close_sndio;
/* Success */
return 0;
}
/*
Module information data structure
*/
mpg123_module_t mpg123_output_module_info = {
/* api_version */ MPG123_MODULE_API_VERSION,
/* name */ "sndio",
/* description */ "Output audio using sndio library",
/* revision */ "$Rev:$",
/* handle */ NULL,
/* init_output */ init_sndio,
};

View File

@ -1,79 +0,0 @@
$OpenBSD: patch-configure_ac,v 1.2 2008/12/22 20:55:49 naddy Exp $
--- configure.ac.orig Mon Nov 10 00:43:42 2008
+++ configure.ac Mon Nov 10 20:32:05 2008
@@ -308,6 +308,7 @@ AC_ARG_WITH([default-audio], [
--with-default-audio=pulse Use Pulse audio server as default audio output sub-system
--with-default-audio=sdl Use SDL as default audio output sub-system (Simple DirectMedia Layer)
--with-default-audio=sgi Use SGI as default audio output sub-system (IRIX)
+ --with-default-audio=sndio Use sndio as default audio output sub-system
--with-default-audio=sun Use Sun as default audio output sub-system (/dev/audio)
--with-default-audio=arts Use aRts as default audio output sub-system (KDE sound server)
])
@@ -793,7 +794,7 @@ fi
dnl ############## Output module choice
# The full list of supported modules to check, first come, first serve.
-check_modules="alsa oss coreaudio sun win32 esd jack portaudio pulse sdl nas arts dummy"
+check_modules="alsa oss coreaudio sndio sun win32 esd jack portaudio pulse sdl nas arts dummy"
# The final list.
output_modules=
@@ -913,6 +914,17 @@ do
WIN32_LIBS=-lwinmm
AC_CHECK_HEADERS([windows.h], output_modules="$output_modules win32" HAVE_WIN32=yes, HAVE_WIN32=no check_failed=yes)
;;
+ sndio)
+ SNDIO_LIBS=-lsndio
+ AC_CHECK_LIB([sndio], [sio_open],
+ [AC_CHECK_HEADERS([sndio.h],
+ [output_modules="$output_modules sndio" HAVE_SNDIO="yes"])
+ ]
+ )
+ if test "x$HAVE_SNDIO" != xyes; then
+ check_failed=yes
+ fi
+ ;;
sun)
AC_CHECK_HEADERS([sun/audioio.h sys/audioio.h asm/audioio.h sys/audio.h])
if test "x${ac_cv_header_sun_audioio_h}" = "xyes" \
@@ -1020,7 +1032,7 @@ if test "x$check_forced" = xyes -a "x$check_failed" =
fi
# When you extend check_modules, you should extend this:
-#for i in alsa oss coreaudio sun win32 esd jack portaudio pulse sdl nas aix alib arts hp os2 sgi mint dummy; do echo $i; done |
+#for i in alsa oss coreaudio sndio sun win32 esd jack portaudio pulse sdl nas aix alib arts hp os2 sgi mint dummy; do echo $i; done |
#perl -ne 'chomp; $big = uc($_); print <<EOT;
#AC_SUBST(${big}_LIBS)
#AC_SUBST(${big}_LDFLAGS)
@@ -1040,6 +1052,10 @@ AC_SUBST(COREAUDIO_LIBS)
AC_SUBST(COREAUDIO_LDFLAGS)
AC_SUBST(COREAUDIO_CFLAGS)
AM_CONDITIONAL( [HAVE_COREAUDIO], [test "x$HAVE_COREAUDIO" = xyes] )
+AC_SUBST(SNDIO_LIBS)
+AC_SUBST(SNDIO_LDFLAGS)
+AC_SUBST(SNDIO_CFLAGS)
+AM_CONDITIONAL( [HAVE_SNDIO], [test "x$HAVE_SNDIO" = xyes] )
AC_SUBST(SUN_LIBS)
AC_SUBST(SUN_LDFLAGS)
AC_SUBST(SUN_CFLAGS)
@@ -1132,7 +1148,7 @@ then
# That feels stupid... what about hashed arrays?
case $OUTPUT_MOD in
# Here's a script for that tedious list, perhaps to be outsourced together with the one in src/output/Makefile.am
-#for i in alsa coreaudio esd jack nas oss portaudio pulse sdl sun win32 aix alib arts hp os2 sgi mint; do echo $i; done |
+#for i in alsa coreaudio esd jack nas oss portaudio pulse sdl sndio sun win32 aix alib arts hp os2 sgi mint; do echo $i; done |
#perl -ne 'chomp; $big = uc($_); print <<EOT;
# $_)
# OUTPUT_LIBS="\$${big}_LIBS"
@@ -1185,6 +1201,11 @@ then
OUTPUT_LIBS="$SDL_LIBS"
OUTPUT_LDFLAGS="$SDL_LDFLAGS"
OUTPUT_CFLAGS="$SDL_CFLAGS"
+ ;;
+ sndio)
+ OUTPUT_LIBS="$SNDIO_LIBS"
+ OUTPUT_LDFLAGS="$SNDIO_LDFLAGS"
+ OUTPUT_CFLAGS="$SNDIO_CFLAGS"
;;
sun)
OUTPUT_LIBS="$SUN_LIBS"

View File

@ -1,13 +0,0 @@
$OpenBSD: patch-src_Makefile_am,v 1.1 2008/11/11 20:35:49 naddy Exp $
--- src/Makefile.am.orig Wed Nov 5 00:47:09 2008
+++ src/Makefile.am Thu Nov 6 18:50:23 2008
@@ -125,6 +125,9 @@ output/alsa.$(OBJEXT): output/alsa.c audio.h module.h
output/hp.$(OBJEXT): output/hp.c audio.h module.h
cd output && $(MAKE)
+output/sndio.$(OBJEXT): output/sndio.c audio.h module.h
+ cd output && $(MAKE)
+
# Would have to mention _all_ source files... Dammit, that's what the libmpg123/Makefile.am does!
# But again, the a make $something here needs that stupid rule... WHY???

View File

@ -1,27 +0,0 @@
$OpenBSD: patch-src_output_Makefile_am,v 1.1 2008/11/11 20:35:49 naddy Exp $
--- src/output/Makefile.am.orig Fri Oct 31 12:05:34 2008
+++ src/output/Makefile.am Fri Oct 31 12:07:41 2008
@@ -15,7 +15,7 @@ pkglib_LTLIBRARIES =
# These are not tested and _very_ likely need work: aix alib hp os2 sgi mint
# Use that sh/perl script to generate the module entries:
-#for i in alsa coreaudio esd jack nas oss portaudio pulse sdl sun win32 aix alib arts hp os2 sgi mint dummy; do echo $i; done |
+#for i in alsa coreaudio esd jack nas oss portaudio pulse sdl sndio sun win32 aix alib arts hp os2 sgi mint dummy; do echo $i; done |
#perl -ne 'chomp; $big = uc($_); print <<EOT;
#
#if HAVE_$big
@@ -98,6 +98,14 @@ output_sdl_la_SOURCES = sdl.c
output_sdl_la_LDFLAGS = -module -avoid-version -export-dynamic @SDL_LDFLAGS@
output_sdl_la_CFLAGS = @SDL_CFLAGS@
output_sdl_la_LIBADD = @SDL_LIBS@
+endif
+
+if HAVE_SNDIO
+pkglib_LTLIBRARIES += output_sndio.la
+output_sndio_la_SOURCES = sndio.c
+output_sndio_la_LDFLAGS = -module -avoid-version -export-dynamic @SNDIO_LDFLAGS@
+output_sndio_la_CFLAGS = @SNDIO_CFLAGS@
+output_sndio_la_LIBADD = @SNDIO_LIBS@
endif
if HAVE_SUN

View File

@ -0,0 +1,58 @@
$OpenBSD: patch-src_output_sndio_c,v 1.1 2009/04/28 19:07:26 naddy Exp $
--- src/output/sndio.c.orig Wed Mar 25 00:36:02 2009
+++ src/output/sndio.c Tue Mar 31 22:32:09 2009
@@ -46,6 +46,14 @@ static int open_sndio(audio_output_t *ao)
par.sig = 0;
par.bits = 16;
break;
+ case MPG123_ENC_SIGNED_32:
+ par.sig = 1;
+ par.bits = 32;
+ break;
+ case MPG123_ENC_UNSIGNED_32:
+ par.sig = 0;
+ par.bits = 32;
+ break;
case MPG123_ENC_UNSIGNED_8:
par.sig = 0;
par.bits = 8;
@@ -67,15 +75,27 @@ static int open_sndio(audio_output_t *ao)
sio_close(hdl);
return -1;
}
- if ((par.bits != 8 && par.bits != 16) || par.le != SIO_LE_NATIVE) {
+ if ((par.bits != 8 && par.bits != 16 && par.bits != 32) ||
+ par.le != SIO_LE_NATIVE) {
sio_close(hdl);
return -1;
}
ao->rate = par.rate;
ao->channels = par.pchan;
- ao->format = (par.bits == 8) ?
- (par.sig ? MPG123_ENC_SIGNED_8 : MPG123_ENC_UNSIGNED_8) :
- (par.sig ? MPG123_ENC_SIGNED_16 : MPG123_ENC_UNSIGNED_16);
+ switch (par.bits) {
+ case 8:
+ ao->format = par.sig ? MPG123_ENC_SIGNED_8 :
+ MPG123_ENC_UNSIGNED_8;
+ break;
+ case 16:
+ ao->format = par.sig ? MPG123_ENC_SIGNED_16 :
+ MPG123_ENC_UNSIGNED_16;
+ break;
+ case 32:
+ ao->format = par.sig ? MPG123_ENC_SIGNED_32 :
+ MPG123_ENC_UNSIGNED_32;
+ break;
+ }
ao->userptr = hdl;
return 0;
}
@@ -83,6 +103,7 @@ static int open_sndio(audio_output_t *ao)
static int get_formats_sndio(audio_output_t *ao)
{
return (MPG123_ENC_SIGNED_16|MPG123_ENC_UNSIGNED_16|
+ MPG123_ENC_SIGNED_32|MPG123_ENC_UNSIGNED_32|
MPG123_ENC_UNSIGNED_8|MPG123_ENC_SIGNED_8);
}