[FFmpeg-devel] [PATCH 249/281] qdm2: convert to new channel layout API

James Almer jamrial at gmail.com
Thu Jan 13 04:06:53 EET 2022


From: Anton Khirnov <anton at khirnov.net>

Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>
Signed-off-by: Anton Khirnov <anton at khirnov.net>
Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/qdm2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index 5e4e741e59..de68e651cd 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -1687,13 +1687,13 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
 
     bytestream2_skip(&gb, 4);
 
-    avctx->channels = s->nb_channels = s->channels = bytestream2_get_be32(&gb);
+    s->nb_channels = s->channels = bytestream2_get_be32(&gb);
     if (s->channels <= 0 || s->channels > MPA_MAX_CHANNELS) {
         av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n");
         return AVERROR_INVALIDDATA;
     }
-    avctx->channel_layout = avctx->channels == 2 ? AV_CH_LAYOUT_STEREO :
-                                                   AV_CH_LAYOUT_MONO;
+    av_channel_layout_uninit(&avctx->ch_layout);
+    av_channel_layout_default(&avctx->ch_layout, s->channels);
 
     avctx->sample_rate = bytestream2_get_be32(&gb);
     avctx->bit_rate = bytestream2_get_be32(&gb);
-- 
2.34.1



More information about the ffmpeg-devel mailing list