Branch oldpackages for 14.07
[14.07/packages.git] / sound / sox / patches / 020-ffmpeg-0.11.patch
1 --- a/configure
2 +++ b/configure
3 @@ -15825,9 +15825,9 @@
4    cat >>confdefs.h <<_ACEOF
5  #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
6  _ACEOF
7 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for av_open_input_file in -lavformat" >&5
8 -$as_echo_n "checking for av_open_input_file in -lavformat... " >&6; }
9 -if ${ac_cv_lib_avformat_av_open_input_file+:} false; then :
10 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for avformat_open_input in -lavformat" >&5
11 +$as_echo_n "checking for avformat_open_input in -lavformat... " >&6; }
12 +if ${ac_cv_lib_avformat_avformat_open_input+:} false; then :
13    $as_echo_n "(cached) " >&6
14  else
15    ac_check_lib_save_LIBS=$LIBS
16 @@ -15841,27 +15841,27 @@
17  #ifdef __cplusplus
18  extern "C"
19  #endif
20 -char av_open_input_file ();
21 +char avformat_open_input ();
22  int
23  main ()
24  {
25 -return av_open_input_file ();
26 +return avformat_open_input ();
27    ;
28    return 0;
29  }
30  _ACEOF
31  if ac_fn_c_try_link "$LINENO"; then :
32 -  ac_cv_lib_avformat_av_open_input_file=yes
33 +  ac_cv_lib_avformat_avformat_open_input=yes
34  else
35 -  ac_cv_lib_avformat_av_open_input_file=no
36 +  ac_cv_lib_avformat_avformat_open_input=no
37  fi
38  rm -f core conftest.err conftest.$ac_objext \
39      conftest$ac_exeext conftest.$ac_ext
40  LIBS=$ac_check_lib_save_LIBS
41  fi
42 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avformat_av_open_input_file" >&5
43 -$as_echo "$ac_cv_lib_avformat_av_open_input_file" >&6; }
44 -if test "x$ac_cv_lib_avformat_av_open_input_file" = xyes; then :
45 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avformat_avformat_open_input" >&5
46 +$as_echo "$ac_cv_lib_avformat_avformat_open_input" >&6; }
47 +if test "x$ac_cv_lib_avformat_avformat_open_input" = xyes; then :
48    for ac_header in libavcodec/avcodec.h ffmpeg/avcodec.h
49  do :
50    as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
51 diff -Naur sox-14.4.0-orig/src/ffmpeg.c sox-14.4.0/src/ffmpeg.c
52 --- sox-14.4.0-orig/src/ffmpeg.c        2012-06-12 00:35:53.459027469 -0400
53 +++ sox-14.4.0/src/ffmpeg.c     2012-06-12 00:36:26.539028545 -0400
54 @@ -93,7 +93,7 @@
55  #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
56    enc->error_resilience = 1;
57  #else
58 -  enc->error_recognition = 1;
59 +  enc->err_recognition = 1;
60  #endif
61  
62    if (!codec || avcodec_open(enc, codec) < 0)
63 @@ -157,7 +157,7 @@
64  static int startread(sox_format_t * ft)
65  {
66    priv_t * ffmpeg = (priv_t *)ft->priv;
67 -  AVFormatParameters params;
68 +  AVDictionary *params;
69    int ret;
70    int i;
71  
72 @@ -172,7 +172,7 @@
73  
74    /* Open file and get format */
75    memset(&params, 0, sizeof(params));
76 -  if ((ret = av_open_input_file(&ffmpeg->ctxt, ft->filename, NULL, 0, &params)) < 0) {
77 +  if ((ret = avformat_open_input(&ffmpeg->ctxt, ft->filename, NULL, &params)) < 0) {
78      lsx_fail("ffmpeg cannot open file for reading: %s (code %d)", ft->filename, ret);
79      return SOX_EOF;
80    }
81 @@ -231,7 +231,7 @@
82      /* If input buffer empty, read more data */
83      if (ffmpeg->audio_buf_index * 2 >= ffmpeg->audio_buf_size) {
84        if ((ret = av_read_frame(ffmpeg->ctxt, pkt)) < 0 &&
85 -         (ret == AVERROR_EOF || url_ferror(ffmpeg->ctxt->pb)))
86 +         (ret == AVERROR_EOF || ffmpeg->ctxt->pb->error))
87         break;
88        ffmpeg->audio_buf_size = audio_decode_frame(ffmpeg, ffmpeg->audio_buf_aligned, AVCODEC_MAX_AUDIO_FRAME_SIZE);
89        ffmpeg->audio_buf_index = 0;
90 @@ -373,13 +373,6 @@
91        return SOX_EOF;
92    }
93  
94 -  /* set the output parameters (must be done even if no
95 -     parameters). */
96 -  if (av_set_parameters(ffmpeg->ctxt, NULL) < 0) {
97 -    lsx_fail("ffmpeg invalid output format parameters");
98 -    return SOX_EOF;
99 -  }
100 -
101    /* Next line for debugging */
102    /* dump_format(ffmpeg->ctxt, 0, ft->filename, 1); */
103  
104 @@ -391,14 +384,14 @@
105  
106    /* open the output file, if needed */
107    if (!(ffmpeg->fmt->flags & AVFMT_NOFILE)) {
108 -    if (url_fopen(&ffmpeg->ctxt->pb, ft->filename, URL_WRONLY) < 0) {
109 +    if (avio_open(&ffmpeg->ctxt->pb, ft->filename, AVIO_FLAG_WRITE) < 0) {
110        lsx_fail("ffmpeg could not open `%s'", ft->filename);
111        return SOX_EOF;
112      }
113    }
114  
115    /* write the stream header, if any */
116 -  av_write_header(ffmpeg->ctxt);
117 +  avformat_write_header(ffmpeg->ctxt, NULL);
118  
119    return SOX_SUCCESS;
120  }
121 @@ -478,7 +471,7 @@
122  #if (LIBAVFORMAT_VERSION_INT < 0x340000)
123      url_fclose(&ffmpeg->ctxt->pb);
124  #else
125 -    url_fclose(ffmpeg->ctxt->pb);
126 +    avio_close(ffmpeg->ctxt->pb);
127  #endif
128    }
129