aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rawdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-10 14:23:06 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-10 14:42:19 +0200
commit0f0f6260484eddd5fcd569b692a8a928cd12fd80 (patch)
tree72b36aa435a76183549c334a29b76561c42cd1a3 /libavformat/rawdec.c
parentec2b6ee59afa22dbfcfedbc56d24873dbb8894e5 (diff)
downloadffmpeg-0f0f6260484eddd5fcd569b692a8a928cd12fd80.tar.gz
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>
Diffstat (limited to 'libavformat/rawdec.c')
-rw-r--r--libavformat/rawdec.c14
1 files changed, 11 insertions, 3 deletions
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; 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;
}