diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index 543bb6ba13..ca9b2829d6 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -185,10 +185,18 @@ static int mjpeg_probe(AVProbeData *p) } } - if (nb_invalid == 0 && nb_frames > 2) - return AVPROBE_SCORE_EXTENSION / 2; - if (nb_invalid*4 + 1 < nb_frames) + if (nb_invalid*4 + 1 < nb_frames) { + static const char ct_jpeg[] = "\r\nContent-Type: image/jpeg\r\n\r\n"; + int i; + + for (i=0; ibuf_size - sizeof(ct_jpeg), 100); i++) + if (!memcmp(p->buf + i, ct_jpeg, sizeof(ct_jpeg) - 1)) + return AVPROBE_SCORE_EXTENSION; + + if (nb_invalid == 0 && nb_frames > 2) + return AVPROBE_SCORE_EXTENSION / 2; return AVPROBE_SCORE_EXTENSION / 4; + } return 0; }