]> git.pld-linux.org Git - packages/sox.git/blame - sox-14.4.0-avcodec54.patch
- rel 2; ffmpeg build fix from gentoo
[packages/sox.git] / sox-14.4.0-avcodec54.patch
CommitLineData
0a5b1ea9
AM
1Fix build with ffmpeg 0.11.
2https://bugs.gentoo.org/show_bug.cgi?id=407621
3
4Index: sox-14.4.0/m4/ffmpeg.m4
5===================================================================
6--- sox-14.4.0.orig/m4/ffmpeg.m4
7+++ sox-14.4.0/m4/ffmpeg.m4
8@@ -49,7 +49,7 @@ then
9 LIBS="$LIBS $FFMPEG_LIBS"
10 have_ffmpeg="no"
11 AC_CHECK_HEADERS([libavformat/avformat.h ffmpeg/avformat.h],
12- [AC_CHECK_LIB(avformat, av_open_input_file,
13+ [AC_CHECK_LIB(avformat, avformat_open_input,
14 [AC_CHECK_HEADERS([libavcodec/avcodec.h ffmpeg/avcodec.h],
15 [AC_CHECK_LIB(avcodec, avcodec_decode_audio3, have_ffmpeg=yes)])])
16 break])
17Index: sox-14.4.0/src/ffmpeg.c
18===================================================================
19--- sox-14.4.0.orig/src/ffmpeg.c
20+++ sox-14.4.0/src/ffmpeg.c
21@@ -92,8 +92,10 @@ static int stream_component_open(priv_t
22 enc->workaround_bugs = 1;
23 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
24 enc->error_resilience = 1;
25-#else
26+#elif LIBAVCODEC_VERSION_INT < ((54<<16)+(0<<8)+0)
27 enc->error_recognition = 1;
28+#else
29+ ic->error_recognition = 1;
30 #endif
31
32 if (!codec || avcodec_open(enc, codec) < 0)
33@@ -157,7 +159,7 @@ static int audio_decode_frame(priv_t * f
34 static int startread(sox_format_t * ft)
35 {
36 priv_t * ffmpeg = (priv_t *)ft->priv;
37- AVFormatParameters params;
38+ AVDictionary *params;
39 int ret;
40 int i;
41
42@@ -172,7 +174,7 @@ static int startread(sox_format_t * ft)
43
44 /* Open file and get format */
45 memset(&params, 0, sizeof(params));
46- if ((ret = av_open_input_file(&ffmpeg->ctxt, ft->filename, NULL, 0, &params)) < 0) {
47+ if ((ret = avformat_open_input(&ffmpeg->ctxt, ft->filename, NULL, &params)) < 0) {
48 lsx_fail("ffmpeg cannot open file for reading: %s (code %d)", ft->filename, ret);
49 return SOX_EOF;
50 }
51@@ -231,7 +233,7 @@ static size_t read_samples(sox_format_t
52 /* If input buffer empty, read more data */
53 if (ffmpeg->audio_buf_index * 2 >= ffmpeg->audio_buf_size) {
54 if ((ret = av_read_frame(ffmpeg->ctxt, pkt)) < 0 &&
55- (ret == AVERROR_EOF || url_ferror(ffmpeg->ctxt->pb)))
56+ (ret == AVERROR_EOF || ( ffmpeg->ctxt->pb && ffmpeg->ctxt->pb->error)))
57 break;
58 ffmpeg->audio_buf_size = audio_decode_frame(ffmpeg, ffmpeg->audio_buf_aligned, AVCODEC_MAX_AUDIO_FRAME_SIZE);
59 ffmpeg->audio_buf_index = 0;
60@@ -373,13 +375,6 @@ static int startwrite(sox_format_t * ft)
61 return SOX_EOF;
62 }
63
64- /* set the output parameters (must be done even if no
65- parameters). */
66- if (av_set_parameters(ffmpeg->ctxt, NULL) < 0) {
67- lsx_fail("ffmpeg invalid output format parameters");
68- return SOX_EOF;
69- }
70-
71 /* Next line for debugging */
72 /* dump_format(ffmpeg->ctxt, 0, ft->filename, 1); */
73
74@@ -391,14 +386,14 @@ static int startwrite(sox_format_t * ft)
75
76 /* open the output file, if needed */
77 if (!(ffmpeg->fmt->flags & AVFMT_NOFILE)) {
78- if (url_fopen(&ffmpeg->ctxt->pb, ft->filename, URL_WRONLY) < 0) {
79+ if (avio_open(&ffmpeg->ctxt->pb, ft->filename, AVIO_FLAG_WRITE) < 0) {
80 lsx_fail("ffmpeg could not open `%s'", ft->filename);
81 return SOX_EOF;
82 }
83 }
84
85 /* write the stream header, if any */
86- av_write_header(ffmpeg->ctxt);
87+ avformat_write_header(ffmpeg->ctxt, NULL);
88
89 return SOX_SUCCESS;
90 }
91@@ -475,11 +470,7 @@ static int stopwrite(sox_format_t * ft)
92
93 if (!(ffmpeg->fmt->flags & AVFMT_NOFILE)) {
94 /* close the output file */
95-#if (LIBAVFORMAT_VERSION_INT < 0x340000)
96- url_fclose(&ffmpeg->ctxt->pb);
97-#else
98- url_fclose(ffmpeg->ctxt->pb);
99-#endif
100+ avio_close(ffmpeg->ctxt->pb);
101 }
102
103 /* Free the output context */
This page took 0.242403 seconds and 4 git commands to generate.