Commit 0f0f6260 authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/rawdec: Increase probe score when "Content-Type: image/jpeg" is found at the file start

Based-on code by: Carl Eugen Hoyos and Andrey Utkin
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent ec2b6ee5
......@@ -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; i<FFMIN(p->buf_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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment