[FFmpeg-devel] [PATCH 212/281] g722: convert to new channel layout API

James Almer jamrial at gmail.com
Thu Jan 13 04:04:51 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/g722dec.c | 4 ++--
 libavcodec/g722enc.c | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavcodec/g722dec.c b/libavcodec/g722dec.c
index 5ca0d0e2b1..879ea296cb 100644
--- a/libavcodec/g722dec.c
+++ b/libavcodec/g722dec.c
@@ -59,8 +59,8 @@ static av_cold int g722_decode_init(AVCodecContext * avctx)
 {
     G722Context *c = avctx->priv_data;
 
-    avctx->channels       = 1;
-    avctx->channel_layout = AV_CH_LAYOUT_MONO;
+    av_channel_layout_uninit(&avctx->ch_layout);
+    avctx->ch_layout      = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
     avctx->sample_fmt     = AV_SAMPLE_FMT_S16;
 
     c->band[0].scale_factor = 8;
diff --git a/libavcodec/g722enc.c b/libavcodec/g722enc.c
index 75b926ef8e..6010a6d5ae 100644
--- a/libavcodec/g722enc.c
+++ b/libavcodec/g722enc.c
@@ -381,6 +381,11 @@ const AVCodec ff_adpcm_g722_encoder = {
     .close           = g722_encode_close,
     .encode2         = g722_encode_frame,
     .sample_fmts     = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE },
+#if FF_API_OLD_CHANNEL_LAYOUT
     .channel_layouts = (const uint64_t[]){ AV_CH_LAYOUT_MONO, 0 },
+#endif
+    .ch_layouts     = (const AVChannelLayout[]){
+        AV_CHANNEL_LAYOUT_MONO, { 0 }
+    },
     .caps_internal   = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
 };
-- 
2.34.1



More information about the ffmpeg-devel mailing list