mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
avcodec/ac3dec: Check operations that can fail
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
277281ac8e
commit
10663312de
@ -184,22 +184,25 @@ static av_cold void ac3_tables_init(void)
|
||||
static av_cold int ac3_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
AC3DecodeContext *s = avctx->priv_data;
|
||||
int i;
|
||||
int i, ret;
|
||||
|
||||
s->avctx = avctx;
|
||||
|
||||
ac3_tables_init();
|
||||
ff_mdct_init(&s->imdct_256, 8, 1, 1.0);
|
||||
ff_mdct_init(&s->imdct_512, 9, 1, 1.0);
|
||||
if ((ret = ff_mdct_init(&s->imdct_256, 8, 1, 1.0)) < 0 ||
|
||||
(ret = ff_mdct_init(&s->imdct_512, 9, 1, 1.0)) < 0)
|
||||
return ret;
|
||||
AC3_RENAME(ff_kbd_window_init)(s->window, 5.0, 256);
|
||||
ff_bswapdsp_init(&s->bdsp);
|
||||
|
||||
#if (USE_FIXED)
|
||||
s->fdsp = avpriv_alloc_fixed_dsp(avctx->flags & AV_CODEC_FLAG_BITEXACT);
|
||||
#else
|
||||
s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
|
||||
ff_fmt_convert_init(&s->fmt_conv, avctx);
|
||||
s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
|
||||
#endif
|
||||
if (!s->fdsp)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
ff_ac3dsp_init(&s->ac3dsp, avctx->flags & AV_CODEC_FLAG_BITEXACT);
|
||||
av_lfg_init(&s->dith_state, 0);
|
||||
|
@ -182,4 +182,5 @@ AVCodec ff_ac3_fixed_decoder = {
|
||||
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
|
||||
AV_SAMPLE_FMT_NONE },
|
||||
.priv_class = &ac3_decoder_class,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
};
|
||||
|
@ -67,6 +67,7 @@ AVCodec ff_ac3_decoder = {
|
||||
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
|
||||
AV_SAMPLE_FMT_NONE },
|
||||
.priv_class = &ac3_decoder_class,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
};
|
||||
|
||||
#if CONFIG_EAC3_DECODER
|
||||
@ -91,5 +92,6 @@ AVCodec ff_eac3_decoder = {
|
||||
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
|
||||
AV_SAMPLE_FMT_NONE },
|
||||
.priv_class = &eac3_decoder_class,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
};
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user