From 628ff29c5fdc4ff8352443d01c8b85bd89821683 Mon Sep 17 00:00:00 2001
From: Juho Vähä-Herttua <juhovh@iki.fi>
Date: Fri, 08 Jun 2012 06:47:03 +0000
Subject: OTHER: Fix some deprecated warnings in libavcodec

--- a/src/plugins/avcodec/avcodec.c
+++ b/src/plugins/avcodec/avcodec.c
@@ -200,7 +200,7 @@
 		}
 	}
 
-	data->codecctx = avcodec_alloc_context ();
+	data->codecctx = avcodec_alloc_context3 (codec);
 	data->codecctx->sample_rate = data->samplerate;
 	data->codecctx->channels = data->channels;
 	data->codecctx->bit_rate = data->bitrate;
@@ -211,7 +211,7 @@
 	data->codecctx->codec_id = codec->id;
 	data->codecctx->codec_type = codec->type;
 
-	if (avcodec_open (data->codecctx, codec) < 0) {
+	if (avcodec_open2 (data->codecctx, codec, NULL) < 0) {
 		XMMS_DBG ("Opening decoder '%s' failed", codec->name);
 		goto err;
 	} else {
--- a/src/plugins/avcodec/avcodec_compat.h
+++ b/src/plugins/avcodec/avcodec_compat.h
@@ -69,3 +69,17 @@
 #if LIBAVCODEC_VERSION_INT >= 0x350400
 # define avcodec_init()
 #endif
+
+/* Map avcodec_alloc_context3 into the deprecated version
+ * avcodec_alloc_context in versions earlier than 53.04 (ffmpeg 0.9) */
+#if LIBAVCODEC_VERSION_INT < 0x350400
+# define avcodec_alloc_context3(codec) \
+    avcodec_alloc_context()
+#endif
+
+/* Map avcodec_open2 into the deprecated version
+ * avcodec_open in versions earlier than 53.04 (ffmpeg 0.9) */
+#if LIBAVCODEC_VERSION_INT < 0x350400
+# define avcodec_open2(avctx, codec, options) \
+    avcodec_open(avctx, codec)
+#endif
