Based-on code by: Carl Eugen Hoyos and Andrey Utkin
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -185,10 +185,18 @@ static int mjpeg_probe(AVProbeData *p) |
185 | 185 |
} |
186 | 186 |
} |
187 | 187 |
|
188 |
- if (nb_invalid == 0 && nb_frames > 2) |
|
189 |
- return AVPROBE_SCORE_EXTENSION / 2; |
|
190 |
- if (nb_invalid*4 + 1 < nb_frames) |
|
188 |
+ if (nb_invalid*4 + 1 < nb_frames) { |
|
189 |
+ static const char ct_jpeg[] = "\r\nContent-Type: image/jpeg\r\n\r\n"; |
|
190 |
+ int i; |
|
191 |
+ |
|
192 |
+ for (i=0; i<FFMIN(p->buf_size - sizeof(ct_jpeg), 100); i++) |
|
193 |
+ if (!memcmp(p->buf + i, ct_jpeg, sizeof(ct_jpeg) - 1)) |
|
194 |
+ return AVPROBE_SCORE_EXTENSION; |
|
195 |
+ |
|
196 |
+ if (nb_invalid == 0 && nb_frames > 2) |
|
197 |
+ return AVPROBE_SCORE_EXTENSION / 2; |
|
191 | 198 |
return AVPROBE_SCORE_EXTENSION / 4; |
199 |
+ } |
|
192 | 200 |
|
193 | 201 |
return 0; |
194 | 202 |
} |