summaryrefslogtreecommitdiff
blob: db55bc8a6933a396c884c5d1212373ff51a98044 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
commit 4781c507be338fe151e08af7d13267a24cbd7572
Author: Juho Vähä-Herttua <juhovh@iki.fi>
Date:   Fri Jun 8 09:47:03 2012 +0300

    OTHER: Fix some deprecated warnings in libavcodec

diff --git a/src/plugins/avcodec/avcodec.c b/src/plugins/avcodec/avcodec.c
index 242e333..c846d64 100644
--- a/src/plugins/avcodec/avcodec.c
+++ b/src/plugins/avcodec/avcodec.c
@@ -208,7 +208,7 @@ xmms_avcodec_init (xmms_xform_t *xform)
 		}
 	}
 
-	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;
@@ -219,7 +219,7 @@ xmms_avcodec_init (xmms_xform_t *xform)
 	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 {
diff --git a/src/plugins/avcodec/avcodec_compat.h b/src/plugins/avcodec/avcodec_compat.h
index f1b1af7..bc770f2 100644
--- a/src/plugins/avcodec/avcodec_compat.h
+++ b/src/plugins/avcodec/avcodec_compat.h
@@ -69,3 +69,17 @@ typedef struct AVPacket {
 #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