- Large update to 14.2.0.

- Drop snprintf() patches that were not accepted upstream.
- Drop flavors and just add most external libraries sox supports.
- Don't modularize the format converters.
This commit is contained in:
naddy 2009-01-08 19:48:21 +00:00
parent 6e00ab9876
commit 09d564af17
15 changed files with 96 additions and 376 deletions

View File

@ -1,45 +1,65 @@
# $OpenBSD: Makefile,v 1.37 2008/07/08 15:03:37 naddy Exp $
# $OpenBSD: Makefile,v 1.38 2009/01/08 19:48:21 naddy Exp $
COMMENT= SOund eXchange - universal sound sample translator
COMMENT= Sound eXchange, the Swiss Army knife of audio manipulation
DISTNAME= sox-12.18.2
PKGNAME= ${DISTNAME} # also see below
DISTNAME= sox-14.2.0
SHARED_LIBS += sox 0.0 # .0.0
SHARED_LIBS += sfx 0.0 # .0.0
CATEGORIES= audio
HOMEPAGE= http://sox.sourceforge.net/
MAINTAINER= Christian Weisgerber <naddy@openbsd.org>
# gsm library has bad license
# GPLv2, but the included gsm library was originally distributed with an
# incomplete license.
PERMIT_PACKAGE_CDROM= no redistribution
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= no redistribution
PERMIT_DISTFILES_FTP= Yes
WANTLIB= c m
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=sox/}
CONFIGURE_STYLE=gnu dest
CONFIGURE_ARGS= --disable-oss-dsp
CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
# see CONFIGURE_ARGS below
LIB_DEPENDS= vorbis.>=6,vorbisenc.>=2,vorbisfile.>=5::audio/libvorbis \
FLAC.>=9::audio/flac \
magic.>=1::devel/libmagic \
mad.>=2::audio/libmad \
id3tag.>=3::audio/libid3tag \
mp3lame.>=2::audio/lame \
png.>=8::graphics/png \
samplerate.>=2::audio/libsamplerate
WANTLIB= c m ogg z
USE_LIBTOOL= Yes
CONFIGURE_STYLE=gnu
CONFIGURE_ARGS= ${CONFIGURE_SHARED} \
--disable-silent-libtool
# Don't use modules
CONFIGURE_ARGS+=--without-libltdl
# Sound drivers
CONFIGURE_ARGS+=--disable-libao \
--disable-oss \
--enable-sun-audio
# Additional file formats
CONFIGURE_ARGS+=--without-sndfile \
--with-ogg \
--with-flac \
--without-ffmpeg \
--with-magic \
--with-mad \
--with-id3tag \
--with-lame \
--without-amr-wb \
--without-amr-nb \
--without-wavpack \
--with-png \
--with-samplerate \
--without-ladspa
CONFIGURE_ENV= \
CPPFLAGS="-I${LOCALBASE}/include -I${LOCALBASE}/include/libpng" \
LDFLAGS="-L${LOCALBASE}/lib"
MAKE_ENV= PLAY_SUPPORT=1
FLAVORS= mp3 vorbis
FLAVOR?=
.if ${FLAVOR:L:Mvorbis}
LIB_DEPENDS+= vorbis.>=3,vorbisenc.>=2,vorbisfile.>=4::audio/libvorbis
WANTLIB+= ogg
.else
CONFIGURE_ARGS+= --disable-ogg-vorbis
.endif
.if ${FLAVOR:L:Mmp3}
PKGNAME= ${DISTNAME}p0
LIB_DEPENDS+= mad.>=2::audio/libmad mp3lame::audio/lame
.else
CONFIGURE_ARGS+= --disable-mad --disable-lame
.endif
do-regress:
@cd ${WRKSRC}/src && ./tests.sh && ./testall.sh

View File

@ -1,5 +1,5 @@
MD5 (sox-12.18.2.tar.gz) = uiXlEqbIJNblbXZ2ehivmQ==
RMD160 (sox-12.18.2.tar.gz) = z4XsQFimZoetCjm7hf8GLXxI578=
SHA1 (sox-12.18.2.tar.gz) = P1dCy+2Y3q+8+AJRwpIkyanvXIk=
SHA256 (sox-12.18.2.tar.gz) = gyv5jJVYCvh5/lExHIYbp8V/B6V5FigQjvKaAn8Ccf8=
SIZE (sox-12.18.2.tar.gz) = 486814
MD5 (sox-14.2.0.tar.gz) = evwOhdFL4BTwjn07fujCTg==
RMD160 (sox-14.2.0.tar.gz) = fHai21xYOPw9n4tUAuR9VI/QlNU=
SHA1 (sox-14.2.0.tar.gz) = G2Dlr0P0SlEkf7l48kI/Defic2M=
SHA256 (sox-14.2.0.tar.gz) = jRuOszpyoYE2lHXJ2l/cvl9oIOavPYag6E9pOeYancE=
SIZE (sox-14.2.0.tar.gz) = 964800

View File

@ -0,0 +1,24 @@
$OpenBSD: patch-src_Makefile_in,v 1.3 2009/01/08 19:48:21 naddy Exp $
Make sure libsox is picked up from ./.libs and not /usr/local/lib.
--- src/Makefile.in.orig Sat Dec 27 21:23:49 2008
+++ src/Makefile.in Sat Dec 27 21:25:01 2008
@@ -720,7 +720,7 @@ LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(L
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+ -o $@
SOURCES = $(libsox_la_SOURCES) $(libsox_fmt_aifc_la_SOURCES) \
$(libsox_fmt_aiff_la_SOURCES) $(libsox_fmt_al_la_SOURCES) \
$(libsox_fmt_alsa_la_SOURCES) $(libsox_fmt_amr_nb_la_SOURCES) \
@@ -999,7 +999,7 @@ lib_LTLIBRARIES = libsox.la
include_HEADERS = sox.h
nodist_include_HEADERS = soxstdint.h
sox_SOURCES = sox.c
-sox_LDADD = libsox.la $(am__append_22) $(am__append_25) \
+sox_LDADD = libsox.la $(LDFLAGS) $(am__append_22) $(am__append_25) \
$(am__append_28) $(am__append_32) $(am__append_35) \
$(am__append_38) $(am__append_41) $(am__append_44) \
$(am__append_47) $(am__append_50) $(am__append_53) \

View File

@ -1,35 +0,0 @@
$OpenBSD: patch-src_dat_c,v 1.2 2006/10/18 15:41:06 naddy Exp $
--- src/dat.c.orig Wed Oct 18 15:57:26 2006
+++ src/dat.c Wed Oct 18 15:58:46 2006
@@ -90,9 +90,9 @@ int st_datstartwrite(ft_t ft)
dat->timevalue = 0.0;
dat->deltat = 1.0 / (double)ft->info.rate;
/* Write format comments to start of file */
- sprintf(s,"; Sample Rate %ld\015\n", (long)ft->info.rate);
+ snprintf(s, sizeof(s), "; Sample Rate %ld\015\n", (long)ft->info.rate);
st_writes(ft, s);
- sprintf(s,"; Channels %d\015\n", (int)ft->info.channels);
+ snprintf(s, sizeof(s), "; Channels %d\015\n", (int)ft->info.channels);
st_writes(ft, s);
return (ST_SUCCESS);
@@ -159,16 +159,16 @@ st_ssize_t st_datwrite(ft_t ft, st_sampl
/* Write time, then sample values, then CRLF newline */
while(done < nsamp) {
- sprintf(s," %15.8g ",dat->timevalue);
+ snprintf(s, sizeof(s), " %15.8g ",dat->timevalue);
st_writes(ft, s);
for (i=0; i<ft->info.channels; i++) {
sampval = *buf++ ;
sampval = sampval * LONGTOFLOAT;
- sprintf(s," %15.8g", sampval);
+ snprintf(s, sizeof(s), " %15.8g", sampval);
st_writes(ft, s);
done++;
}
- sprintf(s," \015\n");
+ snprintf(s, sizeof(s), " \015\n");
st_writes(ft, s);
dat->timevalue += dat->deltat;
}

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-src_misc_c,v 1.2 2006/10/18 15:41:06 naddy Exp $
--- src/misc.c.orig Mon Aug 28 01:48:49 2006
+++ src/misc.c Wed Oct 18 16:25:00 2006
@@ -481,7 +481,7 @@ const char *st_version()
{
static char versionstr[20];
- sprintf(versionstr, "%d.%d.%d",
+ snprintf(versionstr, sizeof(versionstr), "%d.%d.%d",
(ST_LIB_VERSION_CODE & 0xff0000) >> 16,
(ST_LIB_VERSION_CODE & 0x00ff00) >> 8,
(ST_LIB_VERSION_CODE & 0x0000ff));

View File

@ -1,97 +0,0 @@
$OpenBSD: patch-src_mp3_c,v 1.1 2008/07/08 15:03:37 naddy Exp $
--- src/mp3.c.orig Sun Jun 29 18:37:31 2008
+++ src/mp3.c Sun Jun 29 18:51:20 2008
@@ -423,31 +423,56 @@ st_ssize_t st_mp3write(ft_t ft, st_sample_t *buf, st_s
struct mp3priv *p = (struct mp3priv *) ft->priv;
char *mp3buffer;
int mp3buffer_size;
- long *buffer_l, *buffer_r;
+ short signed int *buffer_l, *buffer_r = NULL;
int nsamples = samp/ft->info.channels;
int i,j;
st_ssize_t done = 0;
int written;
- if ( (buffer_r=(long*)malloc(nsamples*sizeof(long))) == NULL){
+ /* NOTE: This logic assumes that "short int" is 16-bits
+ * on all platforms. It happens to be for all that I know
+ * about.
+ *
+ * Lame ultimately wants data scaled to 16-bit samples
+ * and assumes for the majority of cases that your passing
+ * in something scaled based on passed in datatype
+ * (16, 32, 64, and float).
+ *
+ * If we used long buffers then this means it expects
+ * different scalling between 32-bit and 64-bit CPU's.
+ *
+ * We might as well scale it ourselfs to 16-bit to allow
+ * malloc()'ing a smaller buffer and call a consistent
+ * interface.
+ */
+ if ((buffer_l =
+ (short signed int *)malloc(nsamples*
+ sizeof(short signed int))) == NULL){
st_fail_errno(ft,ST_ENOMEM,"Memory allocation failed");
goto end4;
}
- if (ft->info.channels==2){ /* Why isn't there a lame_encode_buffer_long_interleaved? */
- if ( (buffer_l=(long*)malloc(nsamples*sizeof(long))) == NULL){
+ if (ft->info.channels == 2){
+ /* lame doesn't support iterleaved samples so we must break
+ * them out into seperate buffers.
+ */
+ if ((buffer_r =
+ (short signed int *)malloc(nsamples*
+ sizeof(short signed int))) == NULL){
st_fail_errno(ft,ST_ENOMEM,"Memory allocation failed");
goto end3;
}
+
j=0;
- for (i=0;i<nsamples;i++){
- buffer_l[i]=(long)buf[j++]; /* Should we paranoically check whether long is actually 32 bits? */
- buffer_r[i]=(long)buf[j++];
+ for (i=0; i<nsamples; i++){
+ buffer_l[i]=ST_SAMPLE_TO_SIGNED_WORD(buf[j++]);
+ buffer_r[i]=ST_SAMPLE_TO_SIGNED_WORD(buf[j++]);
}
}
else{
- buffer_l=(long*)buf;
- memset(buffer_r,0,nsamples*sizeof(long));
+ j=0;
+ for (i=0; i<nsamples; i++)
+ buffer_l[i]=ST_SAMPLE_TO_SIGNED_WORD(buf[j++]);
}
mp3buffer_size=1.25*nsamples + 7200;
@@ -456,12 +481,9 @@ st_ssize_t st_mp3write(ft_t ft, st_sample_t *buf, st_s
goto end2;
}
- if ( (written = lame_encode_buffer_long2(p->gfp,
- buffer_l,
- buffer_r,
- nsamples,
- (unsigned char *)mp3buffer,
- mp3buffer_size)) < 0){
+ if ( (written = lame_encode_buffer(p->gfp, buffer_l, buffer_r,
+ nsamples, (unsigned char *)mp3buffer,
+ mp3buffer_size)) < 0){
st_fail_errno(ft,ST_EOF,"Encoding failed");
goto end;
}
@@ -477,9 +499,9 @@ st_ssize_t st_mp3write(ft_t ft, st_sample_t *buf, st_s
free(mp3buffer);
end2:
if (ft->info.channels == 2)
- free(buffer_l);
+ free(buffer_r);
end3:
- free(buffer_r);
+ free(buffer_l);
end4:
return done;
}

View File

@ -1,28 +0,0 @@
$OpenBSD: patch-src_smp_c,v 1.2 2006/10/18 15:41:06 naddy Exp $
--- src/smp.c.orig Sat Sep 2 04:12:36 2006
+++ src/smp.c Wed Oct 18 16:22:27 2006
@@ -251,8 +251,9 @@ int st_smpstartread(ft_t ft)
for (commentlen = COMMENTLEN-1;
commentlen >= 0 && header.comments[commentlen] == ' '; commentlen--)
;
- sprintf(smp->comment, "%.*s: %.*s", namelen+1, header.name,
- commentlen+1, header.comments);
+ snprintf(smp->comment, sizeof(smp->comment),
+ "%.*s: %.*s", namelen+1, header.name,
+ commentlen+1, header.comments);
ft->comment = smp->comment;
st_report("SampleVision file name and comments: %s", ft->comment);
@@ -382,8 +383,10 @@ int st_smpstartwrite(ft_t ft)
strcpy(header.Id, SVmagic);
strcpy(header.version, SVvers);
- sprintf(header.comments, "%-*s", COMMENTLEN, "Converted using Sox.");
- sprintf(header.name, "%-*.*s", NAMELEN, NAMELEN, ft->comment);
+ snprintf(header.comments, sizeof(header.comments),
+ "%-*s", COMMENTLEN, "Converted using Sox.");
+ snprintf(header.name, sizeof(header.name),
+ "%-*.*s", NAMELEN, NAMELEN, ft->comment);
/* Write file header */
if(st_writebuf(ft, &header, 1, HEADERSIZE) != HEADERSIZE)

View File

@ -1,13 +0,0 @@
$OpenBSD: patch-src_sndrtool_c,v 1.2 2006/10/18 15:41:06 naddy Exp $
--- src/sndrtool.c.orig Sat Sep 2 04:12:36 2006
+++ src/sndrtool.c Wed Oct 18 16:27:38 2006
@@ -252,7 +252,8 @@ static void sndtwriteheader(ft_t ft, st_
st_writew (ft,10);
st_writew (ft,4);
memset (name_buf, 0, 96);
- sprintf (name_buf,"%.62s - File created by Sound Exchange",ft->filename);
+ snprintf (name_buf, sizeof(name_buf),
+ "%.62s - File created by Sound Exchange", ft->filename);
st_writebuf(ft, name_buf, 1, 96);
}

View File

@ -1,39 +0,0 @@
$OpenBSD: patch-src_sphere_c,v 1.1 2005/07/02 16:27:56 naddy Exp $
--- src/sphere.c.orig Tue Sep 28 04:33:09 2004
+++ src/sphere.c Fri Jun 24 11:50:27 2005
@@ -276,27 +276,29 @@ int st_spherestopwrite(ft_t ft)
st_writes(ft, " 1024\n");
samples = sphere->numSamples/ft->info.channels;
- sprintf(buf, "sample_count -i %ld\n", samples);
+ snprintf(buf, sizeof(buf), "sample_count -i %ld\n", samples);
st_writes(ft, buf);
- sprintf(buf, "sample_n_bytes -i %d\n", ft->info.size);
+ snprintf(buf, sizeof(buf), "sample_n_bytes -i %d\n", ft->info.size);
st_writes(ft, buf);
- sprintf(buf, "channel_count -i %d\n", ft->info.channels);
+ snprintf(buf, sizeof(buf), "channel_count -i %d\n", ft->info.channels);
st_writes(ft, buf);
if (ft->swap)
{
- sprintf(buf, "sample_byte_format -s2 %s\n", ST_IS_BIGENDIAN ? "01" : "10");
+ snprintf(buf, sizeof(buf), "sample_byte_format -s2 %s\n",
+ ST_IS_BIGENDIAN ? "01" : "10");
}
else
{
- sprintf(buf, "sample_byte_format -s2 %s\n", ST_IS_BIGENDIAN ? "10" : "01");
+ snprintf(buf, sizeof(buf), "sample_byte_format -s2 %s\n",
+ ST_IS_BIGENDIAN ? "10" : "01");
}
st_writes(ft, buf);
rate = ft->info.rate;
- sprintf(buf, "sample_rate -i %ld\n", rate);
+ snprintf(buf, sizeof(buf), "sample_rate -i %ld\n", rate);
st_writes(ft, buf);
if (ft->info.encoding == ST_ENCODING_ULAW)

View File

@ -1,63 +0,0 @@
$OpenBSD: patch-src_stretch_c,v 1.1 2006/10/18 15:41:06 naddy Exp $
--- src/stretch.c.orig Wed Oct 18 16:38:57 2006
+++ src/stretch.c Wed Oct 18 16:39:57 2006
@@ -115,14 +115,14 @@ int st_stretch_getopts(eff_t effp, int n
if (n>0 && !sscanf(argv[0], STRETCH_FLOAT_SCAN, &stretch->factor))
{
- sprintf (usage, "%s\n\terror while parsing factor", st_stretch_effect.usage);
+ snprintf (usage, sizeof(usage), "%s\n\terror while parsing factor", st_stretch_effect.usage);
st_fail(usage);
return ST_EOF;
}
if (n>1 && !sscanf(argv[1], STRETCH_FLOAT_SCAN, &stretch->window))
{
- sprintf (usage, "%s\n\terror while parsing window size", st_stretch_effect.usage);
+ snprintf (usage, sizeof(usage), "%s\n\terror while parsing window size", st_stretch_effect.usage);
st_fail(usage);
return ST_EOF;
}
@@ -136,7 +136,7 @@ int st_stretch_getopts(eff_t effp, int n
stretch->fade = st_linear_fading;
break;
default:
- sprintf (usage, "%s\n\terror while parsing fade type", st_stretch_effect.usage);
+ snprintf (usage, sizeof(usage), "%s\n\terror while parsing fade type", st_stretch_effect.usage);
st_fail(usage);
return ST_EOF;
}
@@ -148,14 +148,14 @@ int st_stretch_getopts(eff_t effp, int n
if (n>3 && !sscanf(argv[3], STRETCH_FLOAT_SCAN, &stretch->shift))
{
- sprintf (usage, "%s\n\terror while parsing shift ratio", st_stretch_effect.usage);
+ snprintf (usage, sizeof(usage), "%s\n\terror while parsing shift ratio", st_stretch_effect.usage);
st_fail(usage);
return ST_EOF;
}
if (stretch->shift > ONE || stretch->shift <= ZERO)
{
- sprintf (usage, "%s\n\terror with shift ratio value", st_stretch_effect.usage);
+ snprintf (usage, sizeof(usage), "%s\n\terror with shift ratio value", st_stretch_effect.usage);
st_fail(usage);
return ST_EOF;
}
@@ -171,14 +171,14 @@ int st_stretch_getopts(eff_t effp, int n
if (n>4 && !sscanf(argv[4], STRETCH_FLOAT_SCAN, &stretch->fading))
{
- sprintf (usage, "%s\n\terror while parsing fading ratio", st_stretch_effect.usage);
+ snprintf (usage, sizeof(usage), "%s\n\terror while parsing fading ratio", st_stretch_effect.usage);
st_fail(usage);
return ST_EOF;
}
if (stretch->fading > HALF || stretch->fading < ZERO)
{
- sprintf (usage, "%s\n\terror with fading ratio value", st_stretch_effect.usage);
+ snprintf (usage, sizeof(usage), "%s\n\terror with fading ratio value", st_stretch_effect.usage);
st_fail(usage);
return ST_EOF;
}

View File

@ -1,33 +0,0 @@
$OpenBSD: patch-src_trim_c,v 1.1 2005/07/02 16:27:56 naddy Exp $
--- src/trim.c.orig Tue Sep 28 04:33:09 2004
+++ src/trim.c Fri Jun 24 10:50:35 2005
@@ -46,13 +46,12 @@ int st_trim_getopts(eff_t effp, int n, c
*/
switch (n) {
case 2:
- trim->length_str = (char *)malloc(strlen(argv[1])+1);
+ trim->length_str = strdup(argv[1]);
if (!trim->length_str)
{
st_fail("Could not allocate memory");
return(ST_EOF);
}
- strcpy(trim->length_str,argv[1]);
/* Do a dummy parse to see if it will fail */
if (st_parsesamples(0, trim->length_str,
&trim->length, 't') != ST_SUCCESS)
@@ -61,13 +60,12 @@ int st_trim_getopts(eff_t effp, int n, c
return(ST_EOF);
}
case 1:
- trim->start_str = (char *)malloc(strlen(argv[0])+1);
+ trim->start_str = strdup(argv[0]);
if (!trim->start_str)
{
st_fail("Could not allocate memory");
return(ST_EOF);
}
- strcpy(trim->start_str,argv[0]);
/* Do a dummy parse to see if it will fail */
if (st_parsesamples(0, trim->start_str,
&trim->start, 't') != ST_SUCCESS)

View File

@ -1,14 +0,0 @@
$OpenBSD: patch-src_util_c,v 1.1 2005/07/02 16:27:56 naddy Exp $
--- src/util.c.orig Wed Sep 8 00:25:24 2004
+++ src/util.c Fri Jun 24 10:45:22 2005
@@ -88,9 +88,8 @@ void st_fail_errno(ft_t ft, int st_errno
ft->st_errno = st_errno;
va_start(args, fmt);
- vsprintf(ft->st_errstr, fmt, args);
+ vsnprintf(ft->st_errstr, sizeof(ft->st_errstr), fmt, args);
va_end(args);
- ft->st_errstr[255] = '\0';
}
int st_is_bigendian(void)

View File

@ -3,8 +3,3 @@ different file formats, and optionally applies various sound effects.
SoX is intended as the Swiss Army knife of sound processing tools.
It doesn't do anything very well, but sooner or later it comes in
very handy.
Available flavors that add support for additional file formats:
* vorbis Ogg Vorbis compressed audio
* mp3 MP3 compressed audio

View File

@ -0,0 +1,2 @@
@comment $OpenBSD: PFRAG.shared,v 1.1 2009/01/08 19:48:21 naddy Exp $
@lib lib/libsox.so.${LIBsox_VERSION}

View File

@ -1,10 +1,23 @@
@comment $OpenBSD: PLIST,v 1.5 2004/08/09 15:58:46 espie Exp $
@comment $OpenBSD: PLIST,v 1.6 2009/01/08 19:48:21 naddy Exp $
@pkgpath audio/sox,mp3
@pkgpath audio/sox,mp3,vorbis
@pkgpath audio/sox,vorbis
%%SHARED%%
bin/play
bin/rec
bin/sox
bin/soxmix
@bin bin/sox
bin/soxi
include/sox.h
include/soxstdint.h
lib/libsox.a
lib/libsox.la
lib/pkgconfig/
lib/pkgconfig/sox.pc
@comment lib/sox/
@man man/man1/play.1
@man man/man1/rec.1
@man man/man1/sox.1
@man man/man1/soxexam.1
@man man/man1/soxmix.1
@man man/man1/soxi.1
@man man/man3/libsox.3
@man man/man7/soxeffect.7
@man man/man7/soxformat.7