Commit a84069e128 for ffmpeg

commit a84069e12829188bc1d54ebb540bfbc9b1cb6c50
Author: Niklas Haas <git@haasn.dev>
Date:   Fri Oct 23 19:02:17 2026 +0200

    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 <noreply@anthropic.com>
    Signed-off-by: Niklas Haas <git@haasn.dev>

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)