This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit a84069e12829188bc1d54ebb540bfbc9b1cb6c50 Author: Niklas Haas <[email protected]> AuthorDate: Fri Oct 23 19:02:17 2026 +0200 Commit: James Almer <[email protected]> CommitDate: Fri Oct 23 20:33:53 2026 +0000 avformat/img2dec: only probe image demuxers for the codec When the codec is not specified, image2 probes the first file with av_probe_input_format3() and only uses the result if the winner is an image demuxer. Any other format scoring higher for the same file thus leaves the codec unset, even if an image demuxer would match. Probe only the image demuxers instead. This is needed for the upcoming jpeg_mpf demuxer, which outscores jpeg_pipe on MPF files. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Niklas Haas <[email protected]> --- libavformat/img2dec.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c index ccfea62d15..707e63696e 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -421,10 +421,11 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt) if (par->codec_id == AV_CODEC_ID_NONE) { AVProbeData pd = { 0 }; - const FFInputFormat *ifmt; + const AVInputFormat *fmt; + void *opaque = NULL; uint8_t header[PROBE_BUF_MIN + AVPROBE_PADDING_SIZE]; int ret; - int score = 0; + int score_max = 0; ret = avio_read(f[0], header, PROBE_BUF_MIN); if (ret < 0) { @@ -437,9 +438,20 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt) pd.buf_size = ret; pd.filename = filename.str; - ifmt = ffifmt(av_probe_input_format3(&pd, 1, &score)); - if (ifmt && ifmt->read_packet == ff_img_read_packet && ifmt->raw_codec_id) - par->codec_id = ifmt->raw_codec_id; + /* Only consider image demuxers, so that other formats claiming + * the same file don't shadow them */ + while ((fmt = av_demuxer_iterate(&opaque))) { + const FFInputFormat *ifmt = ffifmt(fmt); + if (ifmt->read_packet != ff_img_read_packet || !ifmt->raw_codec_id) + continue; + int score = ifmt->read_probe(&pd); + if (score > score_max) { + score_max = score; + par->codec_id = ifmt->raw_codec_id; + } else if (score == score_max) { + par->codec_id = AV_CODEC_ID_NONE; + } + } } if (par->codec_id == AV_CODEC_ID_RAWVIDEO && !par->width) -- 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]
