aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-01-04 21:41:28 +0100
committerMax Kellermann <max@duempel.org>2012-01-04 21:48:30 +0100
commit21caca4aeac78e6c791e6440e2003b2ab32bd37c (patch)
tree22bffdf5513fdf1287c19f0a13af53efe0822c89
parentfbf3edf07d55d722b114e5e33d02cb63ece6b627 (diff)
downloadmpd-21caca4aeac78e6c791e6440e2003b2ab32bd37c.tar.gz
mpd-21caca4aeac78e6c791e6440e2003b2ab32bd37c.tar.xz
mpd-21caca4aeac78e6c791e6440e2003b2ab32bd37c.zip
decoder/ffmpeg: use avcodec_open2() on newer ffmpeg versions
avcodec_open() has been deprecated.
-rw-r--r--src/decoder/ffmpeg_decoder_plugin.c7
1 files changed, 6 insertions, 1 deletions
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);