You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

43 lines
1.2 KiB

--- a/src/ffmpeg.c
+++ b/src/ffmpeg.c
@@ -50,6 +50,10 @@
#include <ctype.h>
#include "ffmpeg.h"
+#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE
+#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000
+#endif
+
#ifndef CODEC_TYPE_AUDIO
#define CODEC_TYPE_AUDIO AVMEDIA_TYPE_AUDIO
#endif
@@ -96,7 +100,7 @@ static int stream_component_open(priv_t
enc->err_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);
@@ -267,7 +271,11 @@ static int stopread(sox_format_t * ft)
/*
* add an audio output stream
*/
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 28, 0)
+static AVStream *add_audio_stream(sox_format_t * ft, AVFormatContext *oc, enum AVCodecID codec_id)
+#else
static AVStream *add_audio_stream(sox_format_t * ft, AVFormatContext *oc, enum CodecID codec_id)
+#endif
{
AVCodecContext *c;
AVStream *st;
@@ -306,7 +314,7 @@ static int open_audio(priv_t * ffmpeg, A
}
/* 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;
}