From a522a5f63f3b5726081698bf742801fb1d242817 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 8 Jul 2012 00:04:04 +0000 Subject: Sun Jul 8 00:04:04 UTC 2012 --- testing/sox/PKGBUILD | 45 +++++++ testing/sox/sox-ffmpeg0.11.patch | 130 +++++++++++++++++++++ .../sox/sox_default_audio_driver_fallback.patch | 51 ++++++++ 3 files changed, 226 insertions(+) create mode 100644 testing/sox/PKGBUILD create mode 100644 testing/sox/sox-ffmpeg0.11.patch create mode 100644 testing/sox/sox_default_audio_driver_fallback.patch (limited to 'testing/sox') diff --git a/testing/sox/PKGBUILD b/testing/sox/PKGBUILD new file mode 100644 index 000000000..8613aa777 --- /dev/null +++ b/testing/sox/PKGBUILD @@ -0,0 +1,45 @@ +# $Id: PKGBUILD 163066 2012-07-06 15:22:11Z ibiru $ +# Maintainer: Eric BĂ©langer + +pkgname=sox +pkgver=14.4.0 +pkgrel=3 +pkgdesc="The Swiss Army knife of sound processing tools" +arch=('i686' 'x86_64') +url="http://sox.sourceforge.net/" +license=('GPL' 'LGPL') +depends=('libltdl' 'file' 'libsndfile' 'libpng' 'lame' 'opencore-amr' 'gsm') +makedepends=('ffmpeg' 'libao' 'libmad' 'libid3tag' 'wavpack' 'libpulse') +checkdepends=('time') +optdepends=('libao: for ao plugin' + 'ffmpeg: for ffmpeg plugin' + 'libmad: for mp3 plugin' + 'libid3tag: for mp3 plugin' + 'wavpack: for wavpack plugin' + 'libpulse: for pulse plugin') +options=('!libtool') +source=(http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.bz2 + sox_default_audio_driver_fallback.patch sox-ffmpeg0.11.patch) +sha1sums=('12dfc57e503ed4e18cedcac292cdae7982281978' + 'ab304f1fc17269262dbc4977aa9b7e97ec805ae4' + '2f92bcaebcaf300782396f106cdd27c72048a851') + +build() { + cd "${srcdir}/${pkgname}-${pkgver}" + patch -p0 -i "${srcdir}/sox_default_audio_driver_fallback.patch" + patch -p1 -i "${srcdir}/sox-ffmpeg0.11.patch" + sed -i 's|man1/sox.1 soxeffect.7|man1/sox.1.gz soxeffect.7.gz|' Makefile.in + ./configure --prefix=/usr --sysconfdir=/etc \ + --with-dyn-default --with-distro="Arch Linux" + make +} + +check() { + cd "${srcdir}/${pkgname}-${pkgver}" + make bindir=. installcheck +} + +package() { + cd "${srcdir}/${pkgname}-${pkgver}" + make DESTDIR="${pkgdir}" install +} diff --git a/testing/sox/sox-ffmpeg0.11.patch b/testing/sox/sox-ffmpeg0.11.patch new file mode 100644 index 000000000..901c81582 --- /dev/null +++ b/testing/sox/sox-ffmpeg0.11.patch @@ -0,0 +1,130 @@ +diff -Naur sox-14.4.0-orig/configure sox-14.4.0/configure +--- sox-14.4.0-orig/configure 2012-06-12 00:35:53.462360803 -0400 ++++ sox-14.4.0/configure 2012-06-12 00:36:08.572361294 -0400 +@@ -15781,9 +15781,9 @@ + cat >>confdefs.h <<_ACEOF + #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 + _ACEOF +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for av_open_input_file in -lavformat" >&5 +-$as_echo_n "checking for av_open_input_file in -lavformat... " >&6; } +-if ${ac_cv_lib_avformat_av_open_input_file+:} false; then : ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for avformat_open_input in -lavformat" >&5 ++$as_echo_n "checking for avformat_open_input in -lavformat... " >&6; } ++if ${ac_cv_lib_avformat_avformat_open_input+:} false; then : + $as_echo_n "(cached) " >&6 + else + ac_check_lib_save_LIBS=$LIBS +@@ -15797,27 +15797,27 @@ + #ifdef __cplusplus + extern "C" + #endif +-char av_open_input_file (); ++char avformat_open_input (); + int + main () + { +-return av_open_input_file (); ++return avformat_open_input (); + ; + return 0; + } + _ACEOF + if ac_fn_c_try_link "$LINENO"; then : +- ac_cv_lib_avformat_av_open_input_file=yes ++ ac_cv_lib_avformat_avformat_open_input=yes + else +- ac_cv_lib_avformat_av_open_input_file=no ++ ac_cv_lib_avformat_avformat_open_input=no + fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_lib_save_LIBS + fi +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avformat_av_open_input_file" >&5 +-$as_echo "$ac_cv_lib_avformat_av_open_input_file" >&6; } +-if test "x$ac_cv_lib_avformat_av_open_input_file" = xyes; then : ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avformat_avformat_open_input" >&5 ++$as_echo "$ac_cv_lib_avformat_avformat_open_input" >&6; } ++if test "x$ac_cv_lib_avformat_avformat_open_input" = xyes; then : + for ac_header in libavcodec/avcodec.h ffmpeg/avcodec.h + do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +diff -Naur sox-14.4.0-orig/src/ffmpeg.c sox-14.4.0/src/ffmpeg.c +--- sox-14.4.0-orig/src/ffmpeg.c 2012-06-12 00:35:53.459027469 -0400 ++++ sox-14.4.0/src/ffmpeg.c 2012-06-12 00:36:26.539028545 -0400 +@@ -93,7 +93,7 @@ + #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) + enc->error_resilience = 1; + #else +- enc->error_recognition = 1; ++ enc->err_recognition = 1; + #endif + + if (!codec || avcodec_open(enc, codec) < 0) +@@ -157,7 +157,7 @@ + static int startread(sox_format_t * ft) + { + priv_t * ffmpeg = (priv_t *)ft->priv; +- AVFormatParameters params; ++ AVDictionary *params; + int ret; + int i; + +@@ -172,7 +172,7 @@ + + /* Open file and get format */ + memset(¶ms, 0, sizeof(params)); +- if ((ret = av_open_input_file(&ffmpeg->ctxt, ft->filename, NULL, 0, ¶ms)) < 0) { ++ if ((ret = avformat_open_input(&ffmpeg->ctxt, ft->filename, NULL, ¶ms)) < 0) { + lsx_fail("ffmpeg cannot open file for reading: %s (code %d)", ft->filename, ret); + return SOX_EOF; + } +@@ -231,7 +231,7 @@ + /* If input buffer empty, read more data */ + if (ffmpeg->audio_buf_index * 2 >= ffmpeg->audio_buf_size) { + if ((ret = av_read_frame(ffmpeg->ctxt, pkt)) < 0 && +- (ret == AVERROR_EOF || url_ferror(ffmpeg->ctxt->pb))) ++ (ret == AVERROR_EOF || ffmpeg->ctxt->pb->error)) + break; + ffmpeg->audio_buf_size = audio_decode_frame(ffmpeg, ffmpeg->audio_buf_aligned, AVCODEC_MAX_AUDIO_FRAME_SIZE); + ffmpeg->audio_buf_index = 0; +@@ -373,13 +373,6 @@ + return SOX_EOF; + } + +- /* set the output parameters (must be done even if no +- parameters). */ +- if (av_set_parameters(ffmpeg->ctxt, NULL) < 0) { +- lsx_fail("ffmpeg invalid output format parameters"); +- return SOX_EOF; +- } +- + /* Next line for debugging */ + /* dump_format(ffmpeg->ctxt, 0, ft->filename, 1); */ + +@@ -391,14 +384,14 @@ + + /* open the output file, if needed */ + if (!(ffmpeg->fmt->flags & AVFMT_NOFILE)) { +- if (url_fopen(&ffmpeg->ctxt->pb, ft->filename, URL_WRONLY) < 0) { ++ if (avio_open(&ffmpeg->ctxt->pb, ft->filename, AVIO_FLAG_WRITE) < 0) { + lsx_fail("ffmpeg could not open `%s'", ft->filename); + return SOX_EOF; + } + } + + /* write the stream header, if any */ +- av_write_header(ffmpeg->ctxt); ++ avformat_write_header(ffmpeg->ctxt, NULL); + + return SOX_SUCCESS; + } +@@ -478,7 +471,7 @@ + #if (LIBAVFORMAT_VERSION_INT < 0x340000) + url_fclose(&ffmpeg->ctxt->pb); + #else +- url_fclose(ffmpeg->ctxt->pb); ++ avio_close(ffmpeg->ctxt->pb); + #endif + } + diff --git a/testing/sox/sox_default_audio_driver_fallback.patch b/testing/sox/sox_default_audio_driver_fallback.patch new file mode 100644 index 000000000..9f9060e17 --- /dev/null +++ b/testing/sox/sox_default_audio_driver_fallback.patch @@ -0,0 +1,51 @@ +--- src/sox.c.old 2012-05-06 22:45:45.380564154 -0400 ++++ src/sox.c 2012-05-06 22:47:11.948248987 -0400 +@@ -2538,20 +2538,38 @@ + return name? from_env? from_env : name : NULL; + } + ++static char const * try_device(char const * name) ++{ ++ sox_format_handler_t const * handler = sox_find_format(name, sox_false); ++ if (handler) { ++ sox_format_t format, * ft = &format; ++ memset(ft, 0, sizeof(*ft)); ++ ft->filename = (char *)device_name(name); ++ ft->priv = lsx_calloc(1, handler->priv_size); ++ if (handler->startwrite(ft) == SOX_SUCCESS) { ++ handler->stopwrite(ft); ++ free(ft->priv); ++ return name; ++ } ++ free(ft->priv); ++ } ++ return NULL; ++} ++ + static char const * set_default_device(file_t * f) + { + /* Default audio driver type in order of preference: */ + if (!f->filetype) f->filetype = getenv("AUDIODRIVER"); +- if (!f->filetype && sox_find_format("coreaudio", sox_false)) f->filetype = "coreaudio"; +- if (!f->filetype && sox_find_format("pulseaudio" , sox_false)) f->filetype = "pulseaudio"; +- if (!f->filetype && sox_find_format("alsa", sox_false)) f->filetype = "alsa"; +- if (!f->filetype && sox_find_format("waveaudio" , sox_false)) f->filetype = "waveaudio"; +- if (!f->filetype && sox_find_format("sndio", sox_false)) f->filetype = "sndio"; +- if (!f->filetype && sox_find_format("oss" , sox_false)) f->filetype = "oss"; +- if (!f->filetype && sox_find_format("sunau",sox_false)) f->filetype = "sunau"; +- if (!f->filetype && sox_find_format("ao" , sox_false) && file_count) /*!rec*/ +- f->filetype = "ao"; +- ++ if (!f->filetype) f->filetype = try_device("coreaudio"); ++ if (!f->filetype) f->filetype = try_device("pulseaudio"); ++ if (!f->filetype) f->filetype = try_device("alsa"); ++ if (!f->filetype) f->filetype = try_device("waveaudio"); ++ if (!f->filetype) f->filetype = try_device("sndio"); ++ if (!f->filetype) f->filetype = try_device("oss"); ++ if (!f->filetype) f->filetype = try_device("sunau"); ++ if (!f->filetype && file_count) /*!rec*/ ++ f->filetype = try_device("ao"); ++ + if (!f->filetype) { + lsx_fail("Sorry, there is no default audio device configured"); + exit(1); -- cgit v1.2.3-54-g00ecf