This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 3e58a497dc0f778bb40d4d7c4027cffc321afa7c Author: Romain Beauxis <[email protected]> AuthorDate: Sat Oct 31 09:16:23 2026 -0500 Commit: Romain Beauxis <[email protected]> CommitDate: Thu Nov 5 13:37:08 2026 +0000 avcodec/flacdec: factor out applying a STREAMINFO Share the steps that initialization and an inline header both run to set the decoder up from a STREAMINFO. --- libavcodec/flacdec.c | 45 +++++++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index 0c88f577a1..b3e56df0a0 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -95,10 +95,25 @@ static void flac_set_bps(FLACContext *s) } } +static int apply_streaminfo(FLACContext *s, const uint8_t *streaminfo) +{ + int ret = ff_flac_parse_streaminfo(s->avctx, &s->stream_info, streaminfo); + if (ret < 0) + return ret; + ret = allocate_buffers(s); + if (ret < 0) + return ret; + flac_set_bps(s); + ff_flacdsp_init(&s->dsp, s->avctx->sample_fmt, + s->stream_info.channels); + s->got_streaminfo = 1; + + return 0; +} + static av_cold int flac_decode_init(AVCodecContext *avctx) { uint8_t *streaminfo; - int ret; FLACContext *s = avctx->priv_data; s->avctx = avctx; @@ -111,18 +126,7 @@ static av_cold int flac_decode_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; /* initialize based on the demuxer-supplied streamdata header */ - ret = ff_flac_parse_streaminfo(avctx, &s->stream_info, streaminfo); - if (ret < 0) - return ret; - ret = allocate_buffers(s); - if (ret < 0) - return ret; - flac_set_bps(s); - ff_flacdsp_init(&s->dsp, avctx->sample_fmt, - s->stream_info.channels); - s->got_streaminfo = 1; - - return 0; + return apply_streaminfo(s, streaminfo); } static void dump_headers(AVCodecContext *avctx, FLACStreaminfo *s) @@ -186,7 +190,7 @@ static int allocate_buffers(FLACContext *s) */ static int parse_streaminfo(FLACContext *s, const uint8_t *buf, int buf_size) { - int metadata_type, metadata_size, ret; + int metadata_type, metadata_size; if (buf_size < FLAC_STREAMINFO_SIZE+8) { /* need more data */ @@ -197,18 +201,7 @@ static int parse_streaminfo(FLACContext *s, const uint8_t *buf, int buf_size) metadata_size != FLAC_STREAMINFO_SIZE) { return AVERROR_INVALIDDATA; } - ret = ff_flac_parse_streaminfo(s->avctx, &s->stream_info, &buf[8]); - if (ret < 0) - return ret; - ret = allocate_buffers(s); - if (ret < 0) - return ret; - flac_set_bps(s); - ff_flacdsp_init(&s->dsp, s->avctx->sample_fmt, - s->stream_info.channels); - s->got_streaminfo = 1; - - return 0; + return apply_streaminfo(s, &buf[8]); } /** -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
