Web lists-archives.com

[MPlayer-dev-eng] Replace deprecated avctx->request_channels

The attached patch replaces the deprecated usage of
avctx->request_channels, and replaces it with
avctx->request_channel_layout, and also fills it with the default
layout for the given number of channels.

It should be equivalent for 1 and 2 channels; I have no idea if the
defaults for more channels are the same as before. The old
request_channels was used in ffmpeg only for ac3, aac, dca, and mpl.

It works for me, but I can test it only with stereo speakers.

Can anybody familiar with this code check if the behaviour is changed
in some cases?

Also if you have a multispeaker setup please test it.

Index: ad_ffmpeg.c
--- ad_ffmpeg.c	(revisione 37444)
+++ ad_ffmpeg.c	(copia locale)
@@ -46,6 +46,7 @@
 #include "libavcodec/avcodec.h"
 #include "libavutil/dict.h"
+#include "libavutil/channel_layout.h"
 struct adctx {
     int last_samplerate;
@@ -127,7 +128,7 @@
 	lavc_context->bits_per_coded_sample = sh_audio->wf->wBitsPerSample;
     lavc_context->channel_layout = sh_audio->channel_layout;
-    lavc_context->request_channels = audio_output_channels;
+    lavc_context->request_channel_layout = av_get_default_channel_layout(audio_output_channels);
     lavc_context->codec_tag = sh_audio->format; //FOURCC
     lavc_context->codec_id = lavc_codec->id; // not sure if required, imho not --A'rpi
MPlayer-dev-eng mailing list