commit 4781c507be338fe151e08af7d13267a24cbd7572 Author: Juho Vähä-Herttua 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