1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

Revert "avcodec/decode: Fix avcodec parameters when bsfs are enable by decoder"

This reverts commit 1c17061397.

The commit intended to provide certain codecs using *_mp4toannexb
bitstream filters with updated (annex B) extradata (even when
the user-supplied one was ISOBMFF), yet BSFs are allowed to change
way more. The media100_to_mjpegb BSF used by the media100 decoder
changes the codec id; the commit being reverted therefore changed
AVCodecContext.codec_id which is an API violation and broke
media100 decoding with the FFmpeg cli tool.

This commit also made changes from the internal BSF externally
visible. extradata is documented to be "owned by the codec and
freed in avcodec_free_context()" which does not include replacing
it with something else in avcodec_open2() and may surprise users
who think that AVCodecContext.extradata is immutable before
avcodec_free_context(). It also incurred a memdup which is completely
unnecessary for most decoders.

Therefore this commit is reverted. The problem it tried to solve
will be solved differently in the next commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-06-11 14:52:47 +02:00
parent 730ffc5d35
commit 9102a90a95

View File

@ -202,9 +202,6 @@ static int decode_bsfs_init(AVCodecContext *avctx)
goto fail; goto fail;
ret = av_bsf_init(avci->bsf); ret = av_bsf_init(avci->bsf);
if (ret < 0)
goto fail;
ret = avcodec_parameters_to_context(avctx, avci->bsf->par_out);
if (ret < 0) if (ret < 0)
goto fail; goto fail;