* update to 1.0.21

* use sndio instead of ossaudio

with jakemsr@
This commit is contained in:
naddy 2010-01-02 17:53:27 +00:00
parent b8bfcd2111
commit daece9aad1
13 changed files with 125 additions and 209 deletions

View File

@ -1,24 +1,21 @@
# $OpenBSD: Makefile,v 1.17 2009/05/31 17:31:13 jasper Exp $
# $OpenBSD: Makefile,v 1.18 2010/01/02 17:53:27 naddy Exp $
COMMENT= library to handle various audio file formats
DISTNAME= libsndfile-1.0.20
PKGNAME= ${DISTNAME}p1
DISTNAME= libsndfile-1.0.21
CATEGORIES= audio
HOMEPAGE= http://www.mega-nerd.com/libsndfile/
SHARED_LIBS += sndfile 3.1 # .1.20
SHARED_LIBS += sndfile 3.2 # .1.21
MAINTAINER= Christian Weisgerber <naddy@openbsd.org>
# LGPLv2.1 or v3.
# LGPLv2.1
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
MASTER_SITES= ${HOMEPAGE}
MASTER_SITES= ${HOMEPAGE}files/
WANTLIB= c m
WANTLIB= c m sndio
USE_LIBTOOL= Yes
CONFIGURE_STYLE=gnu
@ -26,7 +23,10 @@ CONFIGURE_ARGS= ${CONFIGURE_SHARED} \
--disable-alsa \
--disable-external-libs \
--disable-octave \
--disable-sqlite
--disable-sqlite \
--disable-shave
CONFIGURE_ENV= CPPFLAGS="-DUSE_SNDIO"
MODGNU_CONFIG_GUESS_DIRS=${WRKSRC}/Cfg
FAKE_FLAGS= htmldocdir=${PREFIX}/share/doc/libsndfile

View File

@ -1,5 +1,5 @@
MD5 (libsndfile-1.0.20.tar.gz) = 4FU+EsekZ69EaT6V4urGaA==
RMD160 (libsndfile-1.0.20.tar.gz) = hzgC76o/HjMDFn/htzAv4qtMvVk=
SHA1 (libsndfile-1.0.20.tar.gz) = 1PiLkZxkT1TdQDjEz0+y57DTL3s=
SHA256 (libsndfile-1.0.20.tar.gz) = dRfrlmV5+IFLXv4wfLkZxbTntcZykgm6HalfMeg2jcc=
SIZE (libsndfile-1.0.20.tar.gz) = 927422
MD5 (libsndfile-1.0.21.tar.gz) = iApA7GNqshhbl/iScpmykg==
RMD160 (libsndfile-1.0.21.tar.gz) = P000cq6/JLAsLOPzcAI/UAlsH70=
SHA1 (libsndfile-1.0.21.tar.gz) = E2hFqLtWeeAz+PU/uY3ete6PHZc=
SHA256 (libsndfile-1.0.21.tar.gz) = fpCDolUf80cnbYLNth8rT5zRN8C3ZDOADpkVg97Y6mc=
SIZE (libsndfile-1.0.21.tar.gz) = 1014722

View File

@ -1,21 +0,0 @@
$OpenBSD: patch-configure,v 1.1 2009/05/18 21:37:09 kili Exp $
--- configure.orig Thu May 14 11:44:39 2009
+++ configure Mon May 18 23:21:00 2009
@@ -24823,7 +24823,7 @@ _ACEOF
#====================================================================================
# Check for JACK (only used for examples/sndfile-jackplay).
-
+if false; then # disable jack test
pkg_failed=no
{ $as_echo "$as_me:$LINENO: checking for jack >= 0.100 " >&5
$as_echo_n "checking for jack >= 0.100 ... " >&6; }
@@ -24905,6 +24905,8 @@ else
cat >>confdefs.h <<_ACEOF
#define HAVE_JACK $HAVE_JACK
_ACEOF
+fi # disable jack test
+HAVE_JACK=0
#====================================================================================

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-man_Makefile_in,v 1.1 2010/01/02 17:53:27 naddy Exp $
--- man/Makefile.in.orig Tue Dec 29 21:14:33 2009
+++ man/Makefile.in Tue Dec 29 21:14:44 2009
@@ -505,7 +505,7 @@ uninstall-man: uninstall-man1
# Same manpage for both programs.
sndfile-metadata-set.1 : sndfile-metadata-get.1
- $(LN_S) $< $@
+ $(LN_S) $? $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-programs_Makefile_in,v 1.1 2010/01/02 17:53:27 naddy Exp $
--- programs/Makefile.in.orig Tue Dec 29 13:49:47 2009
+++ programs/Makefile.in Tue Dec 29 13:50:08 2009
@@ -301,7 +301,7 @@ EXTRA_DIST = sndfile-play-beos.cpp test-sndfile-metada
sndfile_info_SOURCES = sndfile-info.c
sndfile_info_LDADD = $(top_builddir)/src/libsndfile.la
sndfile_play_SOURCES = sndfile-play.c
-sndfile_play_LDADD = $(top_builddir)/src/libsndfile.la $(OS_SPECIFIC_LINKS) $(ALSA_LIBS)
+sndfile_play_LDADD = $(top_builddir)/src/libsndfile.la $(OS_SPECIFIC_LINKS) $(ALSA_LIBS) -lsndio
sndfile_convert_SOURCES = sndfile-convert.c common.c common.h
sndfile_convert_LDADD = $(top_builddir)/src/libsndfile.la
sndfile_cmp_SOURCES = sndfile-cmp.c

View File

@ -1,42 +1,90 @@
$OpenBSD: patch-programs_sndfile-play_c,v 1.1 2009/04/26 17:18:42 jasper Exp $
--- programs/sndfile-play.c.orig Wed Apr 22 13:56:05 2009
+++ programs/sndfile-play.c Wed Apr 22 14:00:49 2009
@@ -57,7 +57,7 @@
$OpenBSD: patch-programs_sndfile-play_c,v 1.2 2010/01/02 17:53:27 naddy Exp $
--- programs/sndfile-play.c.orig Wed Dec 2 10:45:39 2009
+++ programs/sndfile-play.c Thu Dec 31 02:41:17 2009
@@ -57,6 +57,9 @@
#include <Carbon.h>
#include <CoreAudio/AudioHardware.h>
-#elif (defined (sun) && defined (unix))
+#elif (defined (__OpenBSD__) || (defined (sun) && defined (unix)))
+#elif defined(USE_SNDIO)
+ #include <sndio.h>
+
#elif (defined (sun) && defined (unix))
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/audioio.h>
@@ -823,7 +823,7 @@ win32_play (int argc, char *argv [])
@@ -820,6 +823,67 @@ win32_play (int argc, char *argv [])
#endif /* Win32 */
/*------------------------------------------------------------------------------
+** Sndio.
+*/
+
+#if defined (USE_SNDIO)
+
+static void
+sndio_play (int argc, char *argv [])
+{
+ struct sio_hdl *hdl;
+ struct sio_par par;
+ short buffer[BUFFER_LEN];
+ SNDFILE *sndfile;
+ SF_INFO sfinfo;
+ int k, readcount;
+
+ for (k = 1; k < argc; k++)
+ { printf ("Playing %s\n", argv [k]) ;
+ if (! (sndfile = sf_open (argv [k], SFM_READ, &sfinfo)))
+ { puts (sf_strerror (NULL)) ;
+ continue ;
+ } ;
+
+ if (sfinfo.channels < 1 || sfinfo.channels > 2)
+ { printf ("Error : channels = %d.\n", sfinfo.channels) ;
+ continue ;
+ } ;
+
+ if ((hdl = sio_open(NULL, SIO_PLAY, 0)) == NULL)
+ { fprintf(stderr, "open sndio device failed") ;
+ return ;
+ } ;
+
+ sio_initpar(&par);
+ par.rate = sfinfo.samplerate ;
+ par.pchan = sfinfo.channels ;
+ par.bits = 16 ;
+ par.sig = 1;
+ par.le = SIO_LE_NATIVE;
+
+ if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par))
+ { fprintf (stderr, "set sndio params failed") ;
+ return ;
+ } ;
+
+ if (!sio_start(hdl))
+ { fprintf (stderr, "sndio start failed") ;
+ return ;
+ } ;
+
+ while ((readcount = sf_read_short (sndfile, buffer, BUFFER_LEN)))
+ sio_write (hdl, buffer, readcount * sizeof (short)) ;
+
+ sio_close (hdl) ;
+ } ;
+
+ return ;
+} /* sndio_play */
+
+#endif /* sndio */
+
+/*------------------------------------------------------------------------------
** Solaris.
*/
-#if (defined (sun) && defined (unix)) /* ie Solaris */
+#if (defined (__OpenBSD__) || (defined (sun) && defined (unix))) /* ie Solaris */
static void
solaris_play (int argc, char *argv [])
@@ -860,9 +860,10 @@ solaris_play (int argc, char *argv [])
audio_info.play.channels = sfinfo.channels ;
audio_info.play.precision = 16 ;
audio_info.play.encoding = AUDIO_ENCODING_LINEAR ;
+#if !defined(__OpenBSD__)
audio_info.play.gain = AUDIO_MAX_GAIN ;
audio_info.play.balance = AUDIO_MID_BALANCE ;
-
+#endif
if ((error = ioctl (audio_fd, AUDIO_SETINFO, &audio_info)))
{ perror ("ioctl (AUDIO_SETINFO) failed") ;
return ;
@@ -939,7 +940,7 @@ main (int argc, char *argv [])
linux_play (argc, argv) ;
@@ -941,6 +1005,8 @@ main (int argc, char *argv [])
opensoundsys_play (argc, argv) ;
#elif (defined (__MACH__) && defined (__APPLE__))
macosx_play (argc, argv) ;
-#elif (defined (sun) && defined (unix))
+#elif (defined (__OpenBSD__) || (defined (sun) && defined (unix)))
+#elif defined USE_SNDIO
+ sndio_play (argc, argv) ;
#elif (defined (sun) && defined (unix))
solaris_play (argc, argv) ;
#elif (OS_IS_WIN32 == 1)
win32_play (argc, argv) ;

View File

@ -1,15 +0,0 @@
$OpenBSD: patch-src_alaw_c,v 1.1 2009/05/31 17:31:13 jasper Exp $
Security fix for SA35266.
--- src/alaw.c.orig Sun Mar 22 13:17:13 2009
+++ src/alaw.c Sun May 31 10:21:16 2009
@@ -69,7 +69,7 @@ alaw_init (SF_PRIVATE *psf)
else
psf->datalength = 0 ;
- psf->sf.frames = psf->datalength / psf->blockwidth ;
+ psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
return 0 ;
} /* alaw_init */

View File

@ -1,15 +0,0 @@
$OpenBSD: patch-src_float32_c,v 1.1 2009/05/31 17:31:13 jasper Exp $
Security fix for SA35266.
--- src/float32.c.orig Tue Mar 24 20:59:47 2009
+++ src/float32.c Sun May 31 10:21:16 2009
@@ -241,7 +241,7 @@ float32_init (SF_PRIVATE *psf)
else
psf->datalength = 0 ;
- psf->sf.frames = psf->datalength / psf->blockwidth ;
+ psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
return 0 ;
} /* float32_init */

View File

@ -1,27 +0,0 @@
$OpenBSD: patch-src_htk_c,v 1.1 2009/05/31 17:31:13 jasper Exp $
Security fix for SA35266.
--- src/htk.c.orig Sun Mar 22 13:17:14 2009
+++ src/htk.c Sun May 31 10:21:16 2009
@@ -195,10 +195,17 @@ htk_read_header (SF_PRIVATE *psf)
return SFE_HTK_NOT_WAVEFORM ;
psf->sf.channels = 1 ;
- psf->sf.samplerate = 10000000 / sample_period ;
- psf_log_printf (psf, "HTK Waveform file\n Sample Count : %d\n Sample Period : %d => %d Hz\n",
- sample_count, sample_period, psf->sf.samplerate) ;
+ if (sample_period > 0)
+ { psf->sf.samplerate = 10000000 / sample_period ;
+ psf_log_printf (psf, "HTK Waveform file\n Sample Count : %d\n Sample Period : %d => %d Hz\n",
+ sample_count, sample_period, psf->sf.samplerate) ;
+ }
+ else
+ { psf->sf.samplerate = 16000 ;
+ psf_log_printf (psf, "HTK Waveform file\n Sample Count : %d\n Sample Period : %d (should be > 0) => Guessed sample rate %d Hz\n",
+ sample_count, sample_period, psf->sf.samplerate) ;
+ } ;
psf->sf.format = SF_FORMAT_HTK | SF_FORMAT_PCM_16 ;
psf->bytewidth = 2 ;

View File

@ -1,15 +0,0 @@
$OpenBSD: patch-src_pcm_c,v 1.1 2009/05/31 17:31:13 jasper Exp $
Security fix for SA35266.
--- src/pcm.c.orig Sun Mar 22 13:17:14 2009
+++ src/pcm.c Sun May 31 10:21:16 2009
@@ -271,7 +271,7 @@ pcm_init (SF_PRIVATE *psf)
else
psf->datalength = 0 ;
- psf->sf.frames = psf->datalength / psf->blockwidth ;
+ psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
return 0 ;
} /* pcm_init */

View File

@ -1,54 +0,0 @@
$OpenBSD: patch-src_sds_c,v 1.1 2009/05/31 17:31:13 jasper Exp $
Security fix for SA35266.
--- src/sds.c.orig Sun Mar 22 13:17:14 2009
+++ src/sds.c Sun May 31 10:21:16 2009
@@ -219,21 +219,40 @@ sds_read_header (SF_PRIVATE *psf, SDS_PRIVATE *psds)
if (marker != 0xF07E || byte != 0x01)
return SFE_SDS_NOT_SDS ;
- psf_log_printf (psf, "Midi Sample Dump Standard (.sds)\nF07E\n Midi Channel : %d\n", channel) ;
+ bytesread += psf_binheader_readf (psf, "e2", &sample_no) ;
+ sample_no = SDS_3BYTE_TO_INT_DECODE (sample_no) ;
- bytesread += psf_binheader_readf (psf, "e213", &sample_no, &bitwidth, &samp_period) ;
+ psf_log_printf (psf, "Midi Sample Dump Standard (.sds)\nF07E\n"
+ " Midi Channel : %d\n Sample Number : %d\n",
+ channel, sample_no) ;
- sample_no = SDS_3BYTE_TO_INT_DECODE (sample_no) ;
+ bytesread += psf_binheader_readf (psf, "e13", &bitwidth, &samp_period) ;
+
samp_period = SDS_3BYTE_TO_INT_DECODE (samp_period) ;
psds->bitwidth = bitwidth ;
- psf->sf.samplerate = 1000000000 / samp_period ;
+ if (psds->bitwidth > 1)
+ psf_log_printf (psf, " Bit Width : %d\n", psds->bitwidth) ;
+ else
+ { psf_log_printf (psf, " Bit Width : %d (should be > 1)\n", psds->bitwidth) ;
+ return SFE_SDS_BAD_BIT_WIDTH ;
+ } ;
- psf_log_printf (psf, " Sample Number : %d\n"
- " Bit Width : %d\n"
+ if (samp_period > 0)
+ { psf->sf.samplerate = 1000000000 / samp_period ;
+
+ psf_log_printf (psf, " Sample Period : %d\n"
" Sample Rate : %d\n",
- sample_no, psds->bitwidth, psf->sf.samplerate) ;
+ samp_period, psf->sf.samplerate) ;
+ }
+ else
+ { psf->sf.samplerate = 16000 ;
+
+ psf_log_printf (psf, " Sample Period : %d (should be > 0)\n"
+ " Sample Rate : %d (guessed)\n",
+ samp_period, psf->sf.samplerate) ;
+ } ;
bytesread += psf_binheader_readf (psf, "e3331", &data_length, &sustain_loop_start, &sustain_loop_end, &loop_type) ;

View File

@ -1,15 +0,0 @@
$OpenBSD: patch-src_ulaw_c,v 1.1 2009/05/31 17:31:13 jasper Exp $
Security fix for SA35266.
--- src/ulaw.c.orig Sun Mar 22 13:17:14 2009
+++ src/ulaw.c Sun May 31 10:21:16 2009
@@ -59,7 +59,7 @@ ulaw_init (SF_PRIVATE *psf)
else
psf->datalength = 0 ;
- psf->sf.frames = psf->datalength / psf->blockwidth ;
+ psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
return 0 ;
} /* ulaw_init */

View File

@ -1,9 +1,11 @@
@comment $OpenBSD: PLIST,v 1.8 2009/04/26 17:18:42 jasper Exp $
@comment $OpenBSD: PLIST,v 1.9 2010/01/02 17:53:27 naddy Exp $
%%SHARED%%
@bin bin/sndfile-cmp
@bin bin/sndfile-concat
@bin bin/sndfile-convert
@bin bin/sndfile-deinterleave
@bin bin/sndfile-info
@bin bin/sndfile-jackplay
@bin bin/sndfile-interleave
@bin bin/sndfile-metadata-get
@bin bin/sndfile-metadata-set
@bin bin/sndfile-play
@ -14,8 +16,12 @@ lib/libsndfile.a
lib/libsndfile.la
lib/pkgconfig/
lib/pkgconfig/sndfile.pc
@man man/man1/sndfile-cmp.1
@man man/man1/sndfile-concat.1
@man man/man1/sndfile-convert.1
@man man/man1/sndfile-info.1
@man man/man1/sndfile-metadata-get.1
@man man/man1/sndfile-metadata-set.1
@man man/man1/sndfile-play.1
share/doc/libsndfile/
share/doc/libsndfile/FAQ.html