jacosub_probe: speedup by making only one call to sscanf
authorClément Bœsch <ubitux@gmail.com>
Thu, 31 May 2012 19:12:25 +0000 (21:12 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 6 Jun 2012 22:55:24 +0000 (00:55 +0200)
(cherry picked from commit 908293d1bcaa0e059561bec8ae0b3ad1fde2d196)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/jacosubdec.c

index 30c4f63..615191e 100644 (file)
@@ -63,10 +63,13 @@ static int jacosub_probe(AVProbeData *p)
         ptr += 3; /* skip UTF-8 BOM */
 
     while (ptr < ptr_end) {
-        if (timed_line(ptr))
-            return AVPROBE_SCORE_MAX / 2;
         while (jss_whitespace(*ptr))
             ptr++;
+        if (*ptr != '#' && *ptr != '\n') {
+            if (timed_line(ptr))
+                return AVPROBE_SCORE_MAX / 2;
+            return 0;
+        }
         ptr += strcspn(ptr, "\n") + 1;
     }
     return 0;