View | Details | Raw Unified | Return to bug 199567 | Differences between
and this patch

Collapse All | Expand All

(-)./Makefile (-14 / +15 lines)
Lines 2-9 Link Here
2
# $FreeBSD: head/audio/sox/Makefile 382272 2015-03-25 21:37:39Z marino $
2
# $FreeBSD: head/audio/sox/Makefile 382272 2015-03-25 21:37:39Z marino $
3
3
4
PORTNAME=	sox
4
PORTNAME=	sox
5
PORTVERSION=	14.4.1
5
PORTVERSION=	14.4.2
6
PORTREVISION=	7
6
#PORTREVISION=	0
7
CATEGORIES=	audio
7
CATEGORIES=	audio
8
MASTER_SITES=	SF
8
MASTER_SITES=	SF
9
9
Lines 21-29 Link Here
21
USES=		autoreconf pkgconfig libtool
21
USES=		autoreconf pkgconfig libtool
22
USE_LDCONFIG=	yes
22
USE_LDCONFIG=	yes
23
23
24
OPTIONS_DEFINE=	ALSA AO AMRNB AMRWB FFMPEG FLAC GSM ID3TAG LADSPA LAME \
24
OPTIONS_DEFINE=	ALSA AO AMRNB AMRWB FLAC GSM ID3TAG LADSPA LAME \
25
		MAD PNG PULSEAUDIO SNDFILE VORBIS WAVPACK
25
		MAD OPUS PNG PULSEAUDIO SNDFILE TWOLAME VORBIS WAVPACK
26
OPTIONS_DEFAULT=	AO FFMPEG FLAC GSM ID3TAG MAD PNG SNDFILE VORBIS
26
OPTIONS_DEFAULT=	AO FLAC GSM ID3TAG MAD OPUS PNG SNDFILE VORBIS
27
# Default LAME to off for packages so we don't end up RESTRICTED
27
# Default LAME to off for packages so we don't end up RESTRICTED
28
.if !defined(PACKAGE_BUILDING)
28
.if !defined(PACKAGE_BUILDING)
29
OPTIONS_DEFAULT+=	LAME
29
OPTIONS_DEFAULT+=	LAME
Lines 37-44 Link Here
37
CPPFLAGS+=	-I${LOCALBASE}/include
37
CPPFLAGS+=	-I${LOCALBASE}/include
38
LDFLAGS+=	-lpthread -L${LOCALBASE}/lib
38
LDFLAGS+=	-lpthread -L${LOCALBASE}/lib
39
CONFIGURE_ARGS+=	--with-pkgconfigdir="${PREFIX}/libdata/pkgconfig"
39
CONFIGURE_ARGS+=	--with-pkgconfigdir="${PREFIX}/libdata/pkgconfig"
40
CONFIGURE_ARGS+=	--with-distro="${CONFIGURE_TARGET} ${PKGNAME}" \
40
CONFIGURE_ARGS+=	--with-distro="${CONFIGURE_TARGET} ${PKGNAME}"
41
			--with-gsm
41
CONFIGURE_ARGS+=	--with-gsm
42
CONFIGURE_ARGS+=	--disable-stack-protector
42
43
43
ALSA_CONFIGURE_WITH=	alsa
44
ALSA_CONFIGURE_WITH=	alsa
44
ALSA_LIB_DEPENDS=	libasound.so:${PORTSDIR}/audio/alsa-lib
45
ALSA_LIB_DEPENDS=	libasound.so:${PORTSDIR}/audio/alsa-lib
Lines 53-61 Link Here
53
AMRWB_CONFIGURE_WITH=	amrwb
54
AMRWB_CONFIGURE_WITH=	amrwb
54
AMRWB_LIB_DEPENDS=	libamrwb.so:${PORTSDIR}/audio/libamrwb
55
AMRWB_LIB_DEPENDS=	libamrwb.so:${PORTSDIR}/audio/libamrwb
55
56
56
FFMPEG_CONFIGURE_WITH=	ffmpeg
57
FFMPEG_LIB_DEPENDS=	libavcodec.so:${PORTSDIR}/multimedia/ffmpeg
58
59
VORBIS_CONFIGURE_WITH=	oggvorbis
57
VORBIS_CONFIGURE_WITH=	oggvorbis
60
VORBIS_LIB_DEPENDS=	libvorbis.so:${PORTSDIR}/audio/libvorbis
58
VORBIS_LIB_DEPENDS=	libvorbis.so:${PORTSDIR}/audio/libvorbis
61
59
Lines 89-94 Link Here
89
WAVPACK_CONFIGURE_WITH=	wavpack
87
WAVPACK_CONFIGURE_WITH=	wavpack
90
WAVPACK_LIB_DEPENDS=	libwavpack.so:${PORTSDIR}/audio/wavpack
88
WAVPACK_LIB_DEPENDS=	libwavpack.so:${PORTSDIR}/audio/wavpack
91
89
90
TWOLAME_CONFIGURE_WITH=	twolame
91
TWOLAME_LIB_DEPENDS=	libtwolame.so:${PORTSDIR}/audio/twolame
92
93
OPUS_CONFIGURE_WITH=	opus
94
OPUS_LIB_DEPENDS=	libopusfile.so:${PORTSDIR}/audio/opusfile
95
92
.include <bsd.port.options.mk>
96
.include <bsd.port.options.mk>
93
97
94
.if ! ${PORT_OPTIONS:MGSM}
98
.if ! ${PORT_OPTIONS:MGSM}
Lines 98-106 Link Here
98
		ac_cv_lib_gsm_gsm_create=no
102
		ac_cv_lib_gsm_gsm_create=no
99
.endif
103
.endif
100
104
101
post-patch:
105
INSTALL_TARGET=		install-strip
102
	@${REINPLACE_CMD} -e 's/ CODEC_ID/ AV_CODEC_ID/g' \
103
		-e 's/ CodecID/ AVCodecID/g' \
104
		${WRKSRC}/src/ffmpeg.c
105
106
106
.include <bsd.port.mk>
107
.include <bsd.port.mk>
(-)./distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (sox-14.4.1.tar.gz) = 9a8c2c6fe51e608da346a157e111508a957af9e3ecf3de26781d36e9a67fa89b
1
SHA256 (sox-14.4.2.tar.gz) = b45f598643ffbd8e363ff24d61166ccec4836fea6d3888881b8df53e3bb55f6c
2
SIZE (sox-14.4.1.tar.gz) = 1111653
2
SIZE (sox-14.4.2.tar.gz) = 1134299
(-)./files/patch-Makefile.am (-14 lines)
Lines 1-14 Link Here
1
Work around a ports bug wrt symlinking manpages in different
2
categories, by copying the manpage instead.
3
4
--- Makefile.am.orig	2013-01-30 11:40:06.000000000 +0900
5
+++ Makefile.am	2014-02-08 01:46:11.000000000 +0900
6
@@ -118,7 +118,7 @@
7
 install-data-hook:
8
 	cd $(DESTDIR)$(mandir)/man1 && $(RM) play.1 && $(LN_S) sox.1 play.1
9
 	cd $(DESTDIR)$(mandir)/man1 && $(RM) rec.1 && $(LN_S) sox.1 rec.1
10
-	cd $(DESTDIR)$(mandir)/man7 && $(RM) soxeffect.7 && $(LN_S) ../man1/sox.1 soxeffect.7
11
+	cd $(DESTDIR)$(mandir)/man7 && $(RM) soxeffect.7 && cp ../man1/sox.1 soxeffect.7
12
 
13
 uninstall-hook:
14
 	$(RM) $(DESTDIR)$(mandir)/man1/play.1
(-)./files/patch-avcodec54 (-100 lines)
Lines 1-100 Link Here
1
Index: m4/ffmpeg.m4
2
===================================================================
3
--- m4/ffmpeg.m4.orig
4
+++ m4/ffmpeg.m4
5
@@ -49,7 +49,7 @@ then
6
   LIBS="$LIBS $FFMPEG_LIBS"
7
   have_ffmpeg="no"
8
   AC_CHECK_HEADERS([libavformat/avformat.h ffmpeg/avformat.h],
9
-    [AC_CHECK_LIB(avformat, av_open_input_file,
10
+    [AC_CHECK_LIB(avformat, avformat_open_input,
11
       [AC_CHECK_HEADERS([libavcodec/avcodec.h ffmpeg/avcodec.h],
12
         [AC_CHECK_LIB(avcodec, avcodec_decode_audio3, have_ffmpeg=yes)])])
13
     break])
14
Index: src/ffmpeg.c
15
===================================================================
16
--- src/ffmpeg.c.orig
17
+++ src/ffmpeg.c
18
@@ -92,8 +92,10 @@ static int stream_component_open(priv_t
19
   enc->workaround_bugs = 1;
20
 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
21
   enc->error_resilience = 1;
22
-#else
23
+#elif LIBAVCODEC_VERSION_INT < ((54<<16)+(0<<8)+0)
24
   enc->error_recognition = 1;
25
+#else
26
+  ic->error_recognition = 1;
27
 #endif
28
 
29
   if (!codec || avcodec_open(enc, codec) < 0)
30
@@ -157,7 +159,7 @@ static int audio_decode_frame(priv_t * f
31
 static int startread(sox_format_t * ft)
32
 {
33
   priv_t * ffmpeg = (priv_t *)ft->priv;
34
-  AVFormatParameters params;
35
+  AVDictionary *params;
36
   int ret;
37
   int i;
38
 
39
@@ -172,7 +174,7 @@ static int startread(sox_format_t * ft)
40
 
41
   /* Open file and get format */
42
   memset(&params, 0, sizeof(params));
43
-  if ((ret = av_open_input_file(&ffmpeg->ctxt, ft->filename, NULL, 0, &params)) < 0) {
44
+  if ((ret = avformat_open_input(&ffmpeg->ctxt, ft->filename, NULL, &params)) < 0) {
45
     lsx_fail("ffmpeg cannot open file for reading: %s (code %d)", ft->filename, ret);
46
     return SOX_EOF;
47
   }
48
@@ -231,7 +233,7 @@ static size_t read_samples(sox_format_t
49
     /* If input buffer empty, read more data */
50
     if (ffmpeg->audio_buf_index * 2 >= ffmpeg->audio_buf_size) {
51
       if ((ret = av_read_frame(ffmpeg->ctxt, pkt)) < 0 &&
52
-	  (ret == AVERROR_EOF || url_ferror(ffmpeg->ctxt->pb)))
53
+	  (ret == AVERROR_EOF || ( ffmpeg->ctxt->pb && ffmpeg->ctxt->pb->error)))
54
 	break;
55
       ffmpeg->audio_buf_size = audio_decode_frame(ffmpeg, ffmpeg->audio_buf_aligned, AVCODEC_MAX_AUDIO_FRAME_SIZE);
56
       ffmpeg->audio_buf_index = 0;
57
@@ -373,13 +375,6 @@ static int startwrite(sox_format_t * ft)
58
       return SOX_EOF;
59
   }
60
 
61
-  /* set the output parameters (must be done even if no
62
-     parameters). */
63
-  if (av_set_parameters(ffmpeg->ctxt, NULL) < 0) {
64
-    lsx_fail("ffmpeg invalid output format parameters");
65
-    return SOX_EOF;
66
-  }
67
-
68
   /* Next line for debugging */
69
   /* dump_format(ffmpeg->ctxt, 0, ft->filename, 1); */
70
 
71
@@ -391,14 +386,14 @@ static int startwrite(sox_format_t * ft)
72
 
73
   /* open the output file, if needed */
74
   if (!(ffmpeg->fmt->flags & AVFMT_NOFILE)) {
75
-    if (url_fopen(&ffmpeg->ctxt->pb, ft->filename, URL_WRONLY) < 0) {
76
+    if (avio_open(&ffmpeg->ctxt->pb, ft->filename, AVIO_FLAG_WRITE) < 0) {
77
       lsx_fail("ffmpeg could not open `%s'", ft->filename);
78
       return SOX_EOF;
79
     }
80
   }
81
 
82
   /* write the stream header, if any */
83
-  av_write_header(ffmpeg->ctxt);
84
+  avformat_write_header(ffmpeg->ctxt, NULL);
85
 
86
   return SOX_SUCCESS;
87
 }
88
@@ -475,11 +470,7 @@ static int stopwrite(sox_format_t * ft)
89
 
90
   if (!(ffmpeg->fmt->flags & AVFMT_NOFILE)) {
91
     /* close the output file */
92
-#if (LIBAVFORMAT_VERSION_INT < 0x340000)
93
-    url_fclose(&ffmpeg->ctxt->pb);
94
-#else
95
-    url_fclose(ffmpeg->ctxt->pb);
96
-#endif
97
+    avio_close(ffmpeg->ctxt->pb);
98
   }
99
 
100
   /* Free the output context */
(-)./files/patch-ffmpeg (-11 lines)
Lines 1-11 Link Here
1
--- src/ffmpeg.h.orig
2
+++ src/ffmpeg.h
3
@@ -27,6 +27,8 @@
4
 #include <ffmpeg/avformat.h>
5
 #endif
6
 
7
+#include <libavutil/mathematics.h>
8
+
9
 #if defined __SUNPRO_C
10
   #pragma enable_warn
11
 #elif defined _MSC_VER
(-)./files/patch-ffmpeg2 (-16 lines)
Lines 1-16 Link Here
1
Index: src/ffmpeg.c
2
===================================================================
3
--- src/ffmpeg.c.orig
4
+++ src/ffmpeg.c
5
@@ -57,6 +57,11 @@
6
 #define PKT_FLAG_KEY AV_PKT_FLAG_KEY
7
 #endif
8
 
9
+#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE
10
+#define AVCODEC_MAX_AUDIO_FRAME_SIZE (192000 * 4)
11
+#endif
12
+
13
+
14
 /* Private data for ffmpeg files */
15
 typedef struct {
16
   int audio_index;
(-)./files/patch-libav9 (-39 lines)
Lines 1-39 Link Here
1
diff -burN src/ffmpeg.c sox-14.4.0/src/ffmpeg.c
2
--- src/ffmpeg.c.orig	2012-11-25 21:59:45.990825656 +0100
3
+++ src/ffmpeg.c	2012-11-25 22:07:06.436809624 +0100
4
@@ -98,7 +98,7 @@
5
   ic->error_recognition = 1;
6
 #endif
7
 
8
-  if (!codec || avcodec_open(enc, codec) < 0)
9
+  if (!codec || avcodec_open2(enc, codec, NULL) < 0)
10
     return -1;
11
   if (enc->codec_type != AVMEDIA_TYPE_AUDIO) {
12
     lsx_fail("ffmpeg CODEC %x is not an audio CODEC", enc->codec_type);
13
@@ -180,7 +180,7 @@
14
   }
15
 
16
   /* Get CODEC parameters */
17
-  if ((ret = av_find_stream_info(ffmpeg->ctxt)) < 0) {
18
+  if ((ret = avformat_find_stream_info(ffmpeg->ctxt, NULL)) < 0) {
19
     lsx_fail("ffmpeg could not find CODEC parameters for %s", ft->filename);
20
     return SOX_EOF;
21
   }
22
@@ -274,7 +274,7 @@
23
   AVCodecContext *c;
24
   AVStream *st;
25
 
26
-  st = av_new_stream(oc, 1);
27
+  st = avformat_new_stream(oc, NULL);
28
   if (!st) {
29
     lsx_fail("ffmpeg could not alloc stream");
30
     return NULL;
31
@@ -308,7 +308,7 @@
32
   }
33
 
34
   /* open it */
35
-  if (avcodec_open(c, codec) < 0) {
36
+  if (avcodec_open2(c, codec, NULL) < 0) {
37
     lsx_fail("ffmpeg could not open CODEC");
38
     return SOX_EOF;
39
   }
(-)./pkg-plist (-2 / +2 lines)
Lines 5-12 Link Here
5
include/sox.h
5
include/sox.h
6
lib/libsox.a
6
lib/libsox.a
7
lib/libsox.so
7
lib/libsox.so
8
lib/libsox.so.2
8
lib/libsox.so.3
9
lib/libsox.so.2.0.1
9
lib/libsox.so.3.0.0
10
man/man1/play.1.gz
10
man/man1/play.1.gz
11
man/man1/rec.1.gz
11
man/man1/rec.1.gz
12
man/man1/sox.1.gz
12
man/man1/sox.1.gz

Return to bug 199567