X-Git-Url: https://git.piment-noir.org/?p=deb_ffmpeg.git;a=blobdiff_plain;f=ffmpeg%2Flibavcodec%2Fmpegaudiodec_template.c;h=bbd07c5f0bd79de3b4ba602976f80dc894e0c97d;hp=c4c03d910636855b0b2a3be251cae01166652591;hb=f6fa7814ccfe3e76514b36cf04f5cd3cb657c8cf;hpb=2ba45a602cbfa7b771effba9b11bb4245c21bc00 diff --git a/ffmpeg/libavcodec/mpegaudiodec_template.c b/ffmpeg/libavcodec/mpegaudiodec_template.c index c4c03d9..bbd07c5 100644 --- a/ffmpeg/libavcodec/mpegaudiodec_template.c +++ b/ffmpeg/libavcodec/mpegaudiodec_template.c @@ -85,7 +85,7 @@ typedef struct MPADecodeContext { int err_recognition; AVCodecContext* avctx; MPADSPContext mpadsp; - AVFloatDSPContext fdsp; + AVFloatDSPContext *fdsp; AVFrame *frame; } MPADecodeContext; @@ -406,6 +406,16 @@ static av_cold void decode_init_static(void) } } +#if USE_FLOATS +static av_cold int decode_close(AVCodecContext * avctx) +{ + MPADecodeContext *s = avctx->priv_data; + av_freep(&s->fdsp); + + return 0; +} +#endif + static av_cold int decode_init(AVCodecContext * avctx) { static int initialized_tables = 0; @@ -418,7 +428,10 @@ static av_cold int decode_init(AVCodecContext * avctx) s->avctx = avctx; - avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT); + s->fdsp = avpriv_float_dsp_alloc(avctx->flags & CODEC_FLAG_BITEXACT); + if (!s->fdsp) + return AVERROR(ENOMEM); + ff_mpadsp_init(&s->mpadsp); if (avctx->request_sample_fmt == OUT_FMT && @@ -1138,7 +1151,7 @@ found2: /* NOTE: the 1/sqrt(2) normalization factor is included in the global gain */ #if USE_FLOATS - s->fdsp.butterflies_float(g0->sb_hybrid, g1->sb_hybrid, 576); + s->fdsp->butterflies_float(g0->sb_hybrid, g1->sb_hybrid, 576); #else tab0 = g0->sb_hybrid; tab1 = g1->sb_hybrid; @@ -1819,7 +1832,7 @@ static av_cold int decode_close_mp3on4(AVCodecContext * avctx) int i; for (i = 0; i < s->frames; i++) - av_free(s->mp3decctx[i]); + av_freep(&s->mp3decctx[i]); return 0; }