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: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-06-10 14:23:06 +02:00
parent ec2b6ee59a
commit 0f0f626048

View File

@ -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;
}