[packages/sox] - rel 2; ffmpeg build fix from gentoo
arekm
arekm at pld-linux.org
Sun Nov 4 14:57:28 CET 2012
commit 0a5b1ea93cda0fbe0fd5404f05dbd98dcf974c32
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Sun Nov 4 14:57:25 2012 +0100
- rel 2; ffmpeg build fix from gentoo
sox-14.4.0-avcodec54.patch | 103 +++++++++++++++++++++++++++++++++++++++++++++
sox-14.4.0-ffmpeg.patch | 11 +++++
sox.spec | 6 ++-
3 files changed, 119 insertions(+), 1 deletion(-)
---
diff --git a/sox.spec b/sox.spec
index 9fb7a77..481a8e2 100644
--- a/sox.spec
+++ b/sox.spec
@@ -16,13 +16,15 @@ Summary(tr.UTF-8): Genel amaçlı ses dosyası çevirme aracı
Summary(uk.UTF-8): Утиліта загального призначення для роботи із звуковими файлами
Name: sox
Version: 14.4.0
-Release: 1
+Release: 2
License: GPL v2+ (sox), LGPL v2+ (libsox)
Group: Applications/Sound
Source0: http://downloads.sourceforge.net/sox/%{name}-%{version}.tar.gz
# Source0-md5: b0c15cff7a4ba0ec17fdc74e6a1f9cf1
Patch0: %{name}-system-lpc10.patch
Patch1: %{name}-dyn.patch
+Patch2: sox-14.4.0-avcodec54.patch
+Patch3: sox-14.4.0-ffmpeg.patch
URL: http://sox.sourceforge.net/
%{?with_alsa:BuildRequires: alsa-lib-devel}
BuildRequires: autoconf >= 2.50
@@ -176,6 +178,8 @@ bibliotekę libmad, a do kodowania - LAME.
%setup -q
%patch0 -p1
%patch1 -p1
+%patch2 -p1
+%patch3 -p1
%build
%{__libtoolize}
diff --git a/sox-14.4.0-avcodec54.patch b/sox-14.4.0-avcodec54.patch
new file mode 100644
index 0000000..a9551f8
--- /dev/null
+++ b/sox-14.4.0-avcodec54.patch
@@ -0,0 +1,103 @@
+Fix build with ffmpeg 0.11.
+https://bugs.gentoo.org/show_bug.cgi?id=407621
+
+Index: sox-14.4.0/m4/ffmpeg.m4
+===================================================================
+--- sox-14.4.0.orig/m4/ffmpeg.m4
++++ sox-14.4.0/m4/ffmpeg.m4
+@@ -49,7 +49,7 @@ then
+ LIBS="$LIBS $FFMPEG_LIBS"
+ have_ffmpeg="no"
+ AC_CHECK_HEADERS([libavformat/avformat.h ffmpeg/avformat.h],
+- [AC_CHECK_LIB(avformat, av_open_input_file,
++ [AC_CHECK_LIB(avformat, avformat_open_input,
+ [AC_CHECK_HEADERS([libavcodec/avcodec.h ffmpeg/avcodec.h],
+ [AC_CHECK_LIB(avcodec, avcodec_decode_audio3, have_ffmpeg=yes)])])
+ break])
+Index: sox-14.4.0/src/ffmpeg.c
+===================================================================
+--- sox-14.4.0.orig/src/ffmpeg.c
++++ sox-14.4.0/src/ffmpeg.c
+@@ -92,8 +92,10 @@ static int stream_component_open(priv_t
+ enc->workaround_bugs = 1;
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+ enc->error_resilience = 1;
+-#else
++#elif LIBAVCODEC_VERSION_INT < ((54<<16)+(0<<8)+0)
+ enc->error_recognition = 1;
++#else
++ ic->error_recognition = 1;
+ #endif
+
+ if (!codec || avcodec_open(enc, codec) < 0)
+@@ -157,7 +159,7 @@ static int audio_decode_frame(priv_t * f
+ static int startread(sox_format_t * ft)
+ {
+ priv_t * ffmpeg = (priv_t *)ft->priv;
+- AVFormatParameters params;
++ AVDictionary *params;
+ int ret;
+ int i;
+
+@@ -172,7 +174,7 @@ static int startread(sox_format_t * ft)
+
+ /* 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 +233,7 @@ static size_t read_samples(sox_format_t
+ /* 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 && 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 +375,6 @@ static int startwrite(sox_format_t * ft)
+ 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 +386,14 @@ static int startwrite(sox_format_t * ft)
+
+ /* 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;
+ }
+@@ -475,11 +470,7 @@ static int stopwrite(sox_format_t * ft)
+
+ if (!(ffmpeg->fmt->flags & AVFMT_NOFILE)) {
+ /* close the output file */
+-#if (LIBAVFORMAT_VERSION_INT < 0x340000)
+- url_fclose(&ffmpeg->ctxt->pb);
+-#else
+- url_fclose(ffmpeg->ctxt->pb);
+-#endif
++ avio_close(ffmpeg->ctxt->pb);
+ }
+
+ /* Free the output context */
diff --git a/sox-14.4.0-ffmpeg.patch b/sox-14.4.0-ffmpeg.patch
new file mode 100644
index 0000000..74dcc57
--- /dev/null
+++ b/sox-14.4.0-ffmpeg.patch
@@ -0,0 +1,11 @@
+--- sox-14.4.0/src/ffmpeg.h
++++ sox-14.4.0/src/ffmpeg.h
+@@ -27,6 +27,8 @@
+ #include <ffmpeg/avformat.h>
+ #endif
+
++#include <libavutil/mathematics.h>
++
+ #if defined __SUNPRO_C
+ #pragma enable_warn
+ #elif defined _MSC_VER
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/sox.git/commitdiff/0a5b1ea93cda0fbe0fd5404f05dbd98dcf974c32
More information about the pld-cvs-commit
mailing list