diff mbox series

[FFmpeg-devel,16/17] avcodec/dcaenc: Remove dead checks for unspec channel layouts

Message ID GV1P250MB0737FE06A91B6859BCA3EF348F4A9@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 66e297fc848a6ec90143b4ace005b4503665e909
Headers show
Series [FFmpeg-devel,01/17] avcodec/avcodec: Uninitialize AVChannelLayout before overwriting it | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 18, 2022, 8:27 p.m. UTC
This encoder has AVCodec.ch_layouts set, so ff_encode_preinit()
ensures that the used channel layout is equivalent to one of
these.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
The new channel layout API is more stricter wrt these checks than the
old one; the old one let you pass if channels was set and channel_layout
unset. If this was not intended (or only semi-intended), then setting
the channel layout based upon channel count should IMO be done
generically in ff_encode_preinit().

 libavcodec/dcaenc.c | 11 -----------
 1 file changed, 11 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
index d0de6d3eee..0996296d8c 100644
--- a/libavcodec/dcaenc.c
+++ b/libavcodec/dcaenc.c
@@ -222,13 +222,6 @@  static int encode_init(AVCodecContext *avctx)
     if (ff_dcaadpcm_init(&c->adpcm_ctx))
         return AVERROR(ENOMEM);
 
-    if (layout.order == AV_CHANNEL_ORDER_UNSPEC) {
-        av_log(avctx, AV_LOG_WARNING, "No channel layout specified. The "
-                                      "encoder will guess the layout, but it "
-                                      "might be incorrect.\n");
-        av_channel_layout_default(&layout, layout.nb_channels);
-    }
-
     if (!av_channel_layout_compare(&layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_MONO))
         c->channel_config = 0;
     else if (!av_channel_layout_compare(&layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO))
@@ -239,10 +232,6 @@  static int encode_init(AVCodecContext *avctx)
         c->channel_config = 9;
     else if (!av_channel_layout_compare(&layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1))
         c->channel_config = 9;
-    else {
-        av_log(avctx, AV_LOG_ERROR, "Unsupported channel layout!\n");
-        return AVERROR_PATCHWELCOME;
-    }
 
     if (c->lfe_channel) {
         c->fullband_channels--;