Unified · Split
| @@ -34,6 +34,7 @@ · 33 unmodified lines | ||
| 34 | 34 | #include "internal.h" |
| 35 | 35 | #include "img2.h" |
| 36 | 36 | #include "libavcodec/mjpeg.h" |
| 37 | +#include "subtitles.h" | |
| 37 | 38 | |
| 38 | 39 | #if HAVE_GLOB |
| 39 | 40 | /* Locally define as 0 (bitwise-OR no-op) any missing glob options that |
| @@ -875,8 +876,17 @@ static int sunrast_probe(AVProbeData *p) · 835 unmodified lines | ||
| 875 | 876 | |
| 876 | 877 | static int svg_probe(AVProbeData *p) |
| 877 | 878 | { |
| 878 | − if (av_match_ext(p->filename, "svg") || av_match_ext(p->filename, "svgz")) | |
| 879 | − return AVPROBE_SCORE_EXTENSION + 1; | |
| 879 | + const uint8_t *b = p->buf; | |
| 880 | + const uint8_t *end = p->buf + p->buf_size; | |
| 881 | + if (memcmp(p->buf, "<?xml", 5)) | |
| 882 | + return 0; | |
| 883 | + while (b < end) { | |
| 884 | + b += ff_subtitles_next_line(b); | |
| 885 | + if (b >= end - 4) | |
| 886 | + return 0; | |
| 887 | + if (!memcmp(b, "<svg", 4)) | |
| 888 | + return AVPROBE_SCORE_EXTENSION + 1; | |
| 889 | + } | |
| 880 | 890 | return 0; |
| 881 | 891 | } |
| 882 | 892 | |