diff mbox series

[FFmpeg-devel,242/281] nellymoser: convert to new channel layout API

Message ID 20220113020713.801-3-jamrial@gmail.com
State New
Headers show
Series New channel layout API
Related show

Commit Message

James Almer Jan. 13, 2022, 2:06 a.m. UTC
From: Anton Khirnov <anton@khirnov.net>

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/nellymoserdec.c | 4 ++--
 libavcodec/nellymoserenc.c | 6 +-----
 2 files changed, 3 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c
index ccfe881790..6870ffea0e 100644
--- a/libavcodec/nellymoserdec.c
+++ b/libavcodec/nellymoserdec.c
@@ -129,8 +129,8 @@  static av_cold int decode_init(AVCodecContext * avctx) {
     s->scale_bias = 1.0/(32768*8);
     avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
 
-    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;
 
     /* Generate overlap window */
     ff_init_ff_sine_windows(7);
diff --git a/libavcodec/nellymoserenc.c b/libavcodec/nellymoserenc.c
index 41d9117065..abf7d82160 100644
--- a/libavcodec/nellymoserenc.c
+++ b/libavcodec/nellymoserenc.c
@@ -171,11 +171,6 @@  static av_cold int encode_init(AVCodecContext *avctx)
     NellyMoserEncodeContext *s = avctx->priv_data;
     int ret;
 
-    if (avctx->channels != 1) {
-        av_log(avctx, AV_LOG_ERROR, "Nellymoser supports only 1 channel\n");
-        return AVERROR(EINVAL);
-    }
-
     if (avctx->sample_rate != 8000 && avctx->sample_rate != 16000 &&
         avctx->sample_rate != 11025 &&
         avctx->sample_rate != 22050 && avctx->sample_rate != 44100 &&
@@ -431,5 +426,6 @@  const AVCodec ff_nellymoser_encoder = {
     .close          = encode_end,
     .sample_fmts    = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT,
                                                      AV_SAMPLE_FMT_NONE },
+    .ch_layouts     = (const AVChannelLayout[]){ AV_CHANNEL_LAYOUT_MONO, { 0 } },
     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
 };