diff --git a/src/plugins/avcodec/avcodec.c b/src/plugins/avcodec/avcodec.c
index f9558461..1f0d9b76 100644
--- a/src/plugins/avcodec/avcodec.c
+++ b/src/plugins/avcodec/avcodec.c
@@ -222,7 +222,7 @@ xmms_avcodec_init (xmms_xform_t *xform)
 
 	data->codecctx = avcodec_alloc_context3 (codec);
 	data->codecctx->sample_rate = data->samplerate;
-	data->codecctx->channels = data->channels;
+	data->codecctx->ch_layout.nb_channels = data->channels;
 	data->codecctx->bit_rate = data->bitrate;
 	data->codecctx->bits_per_coded_sample = data->samplebits;
 	data->codecctx->block_align = data->block_align;
@@ -250,7 +250,7 @@ xmms_avcodec_init (xmms_xform_t *xform)
 	}
 
 	data->samplerate = data->codecctx->sample_rate;
-	data->channels = data->codecctx->channels;
+	data->channels = data->codecctx->ch_layout.nb_channels;
 	data->sampleformat = xmms_avcodec_translate_sample_format (data->codecctx->sample_fmt);
 	if (data->sampleformat == XMMS_SAMPLE_FORMAT_UNKNOWN) {
 		avcodec_close (data->codecctx);
@@ -270,7 +270,7 @@ xmms_avcodec_init (xmms_xform_t *xform)
 
 	XMMS_DBG ("Decoder %s at rate %d with %d channels of format %s initialized",
 	          codec->name, data->codecctx->sample_rate,
-	          data->codecctx->channels,
+	          data->codecctx->ch_layout.nb_channels,
 	          av_get_sample_fmt_name (data->codecctx->sample_fmt));
 
 	return TRUE;
@@ -504,7 +504,7 @@ xmms_avcodec_internal_append (xmms_avcodec_data_t *data)
 {
 	enum AVSampleFormat fmt = (enum AVSampleFormat) data->read_out_frame->format;
 	int samples = data->read_out_frame->nb_samples;
-	int channels = data->codecctx->channels;
+	int channels = data->codecctx->ch_layout.nb_channels;
 	int bps = av_get_bytes_per_sample (fmt);
 
 	if (av_sample_fmt_is_planar (fmt)) {
