From 21caca4aeac78e6c791e6440e2003b2ab32bd37c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2012 21:41:28 +0100 Subject: [PATCH] decoder/ffmpeg: use avcodec_open2() on newer ffmpeg versions avcodec_open() has been deprecated. --- src/decoder/ffmpeg_decoder_plugin.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/decoder/ffmpeg_decoder_plugin.c b/src/decoder/ffmpeg_decoder_plugin.c index 6a746f94a..de545bded 100644 --- a/src/decoder/ffmpeg_decoder_plugin.c +++ b/src/decoder/ffmpeg_decoder_plugin.c @@ -433,7 +433,12 @@ ffmpeg_decode(struct decoder *decoder, struct input_stream *input) values into AVCodecContext.channels - a change that will be reverted later by avcodec_decode_audio3() */ - if (avcodec_open(codec_context, codec)<0) { +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,6,0) + const int open_result = avcodec_open2(codec_context, codec, NULL); +#else + const int open_result = avcodec_open(codec_context, codec); +#endif + if (open_result < 0) { g_warning("Could not open codec\n"); av_close_input_stream(format_context); mpd_ffmpeg_stream_close(stream);