--- /dev/null
+--- sox-14.4.1/src/ffmpeg.c.orig 2013-08-28 21:02:16.835128774 +0200
++++ sox-14.4.1/src/ffmpeg.c 2013-08-28 21:17:33.048423663 +0200
+@@ -98,7 +98,7 @@
+ ic->error_recognition = 1;
+ #endif
+
+- if (!codec || avcodec_open(enc, codec) < 0)
++ if (!codec || avcodec_open2(enc, codec, NULL) < 0)
+ return -1;
+ if (enc->codec_type != AVMEDIA_TYPE_AUDIO) {
+ lsx_fail("ffmpeg CODEC %x is not an audio CODEC", enc->codec_type);
+@@ -163,7 +163,7 @@
+ int ret;
+ int i;
+
+- ffmpeg->audio_buf_raw = lsx_calloc(1, (size_t)AVCODEC_MAX_AUDIO_FRAME_SIZE + 32);
++ ffmpeg->audio_buf_raw = lsx_calloc(1, (size_t)192000 /* AVCODEC_MAX_AUDIO_FRAME_SIZE */ + 32);
+ ffmpeg->audio_buf_aligned = ALIGN16(ffmpeg->audio_buf_raw);
+
+ /* Signal audio stream not found */
+@@ -235,7 +235,7 @@
+ if ((ret = av_read_frame(ffmpeg->ctxt, pkt)) < 0 &&
+ (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_size = audio_decode_frame(ffmpeg, ffmpeg->audio_buf_aligned, 192000 /* AVCODEC_MAX_AUDIO_FRAME_SIZE */ );
+ ffmpeg->audio_buf_index = 0;
+ }
+
+@@ -269,7 +269,7 @@
+ /*
+ * add an audio output stream
+ */
+-static AVStream *add_audio_stream(sox_format_t * ft, AVFormatContext *oc, enum CodecID codec_id)
++static AVStream *add_audio_stream(sox_format_t * ft, AVFormatContext *oc, enum AVCodecID codec_id)
+ {
+ AVCodecContext *c;
+ AVStream *st;
+@@ -308,18 +308,18 @@
+ }
+
+ /* open it */
+- if (avcodec_open(c, codec) < 0) {
++ if (avcodec_open2(c, codec, NULL) < 0) {
+ lsx_fail("ffmpeg could not open CODEC");
+ return SOX_EOF;
+ }
+
+- ffmpeg->audio_buf_raw = lsx_malloc((size_t)AVCODEC_MAX_AUDIO_FRAME_SIZE + 32);
++ ffmpeg->audio_buf_raw = lsx_malloc((size_t)192000 /* AVCODEC_MAX_AUDIO_FRAME_SIZE */ + 32);
+ ffmpeg->audio_buf_aligned = ALIGN16(ffmpeg->audio_buf_raw);
+
+ /* ugly hack for PCM codecs (will be removed ASAP with new PCM
+ support to compute the input frame size in samples */
+ if (c->frame_size <= 1) {
+- ffmpeg->audio_input_frame_size = AVCODEC_MAX_AUDIO_FRAME_SIZE / c->channels;
++ ffmpeg->audio_input_frame_size = 192000 /* AVCODEC_MAX_AUDIO_FRAME_SIZE */ / c->channels;
+ switch(st->codec->codec_id) {
+ case CODEC_ID_PCM_S16LE:
+ case CODEC_ID_PCM_S16BE:
+@@ -423,7 +423,7 @@
+ AVPacket pkt;
+
+ av_init_packet(&pkt);
+- pkt.size = avcodec_encode_audio(c, ffmpeg->audio_buf_aligned, AVCODEC_MAX_AUDIO_FRAME_SIZE, ffmpeg->samples);
++ pkt.size = avcodec_encode_audio(c, ffmpeg->audio_buf_aligned, 192000 /* AVCODEC_MAX_AUDIO_FRAME_SIZE */, ffmpeg->samples);
+ pkt.pts = av_rescale_q(c->coded_frame->pts, c->time_base, ffmpeg->audio_st->time_base);
+ pkt.flags |= AV_PKT_FLAG_KEY;
+ pkt.stream_index = ffmpeg->audio_st->index;