diff options
author | Paul B Mahol <onemda@gmail.com> | 2023-09-08 23:47:00 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2023-09-09 12:09:29 +0200 |
commit | dcd92aa01ad67c9d63078cb97e47d570f986041e (patch) | |
tree | e1da64fb5dbc73f9845f2f735277cebe954c4cc2 /libavcodec/hcadec.c | |
parent | a234e5cd80224c95a205c1f3e297d8c04a1374c3 (diff) | |
download | ffmpeg-dcd92aa01ad67c9d63078cb97e47d570f986041e.tar.gz |
avcodec/hcadec: do not hardcode max number of channels
Diffstat (limited to 'libavcodec/hcadec.c')
-rw-r--r-- | libavcodec/hcadec.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/hcadec.c b/libavcodec/hcadec.c index 96e9a909a9..c6dfa19c60 100644 --- a/libavcodec/hcadec.c +++ b/libavcodec/hcadec.c @@ -28,6 +28,8 @@ #include "get_bits.h" #include "hca_data.h" +#define MAX_CHANNELS 16 + typedef struct ChannelContext { float base[128]; DECLARE_ALIGNED(32, float, imdct_in)[128]; @@ -44,7 +46,7 @@ typedef struct ChannelContext { typedef struct HCAContext { const AVCRC *crc_table; - ChannelContext ch[16]; + ChannelContext ch[MAX_CHANNELS]; uint8_t ath[128]; @@ -249,7 +251,7 @@ static av_cold int decode_init(AVCodecContext *avctx) avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; c->crc_table = av_crc_get_table(AV_CRC_16_ANSI); - if (avctx->ch_layout.nb_channels <= 0 || avctx->ch_layout.nb_channels > 16) + if (avctx->ch_layout.nb_channels <= 0 || avctx->ch_layout.nb_channels > FF_ARRAY_ELEMS(c->ch)) return AVERROR(EINVAL); c->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT); |