[FFmpeg-cvslog] lavf/mpsub: remove sscanf from probing.

Clément Bœsch git at videolan.org
Mon May 6 22:54:19 CEST 2013


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Mon May  6 22:48:36 2013 +0200| [a82cc54fb5ce3774ac7f4a646e6c3a2388d528bd] | committer: Clément Bœsch

lavf/mpsub: remove sscanf from probing.

This should make probing faster.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a82cc54fb5ce3774ac7f4a646e6c3a2388d528bd
---

 libavformat/mpsubdec.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavformat/mpsubdec.c b/libavformat/mpsubdec.c
index 11b8e2e..6a0cefb 100644
--- a/libavformat/mpsubdec.c
+++ b/libavformat/mpsubdec.c
@@ -37,11 +37,10 @@ static int mpsub_probe(AVProbeData *p)
     const char *ptr_end = p->buf + p->buf_size;
 
     while (ptr < ptr_end) {
-        int n;
-
-        if (!memcmp(ptr, "FORMAT=TIME", 11) ||
-            sscanf(ptr, "FORMAT=%d", &n) == 1)
+        if (!memcmp(ptr, "FORMAT=TIME", 11))
             return AVPROBE_SCORE_EXTENSION;
+        if (!memcmp(ptr, "FORMAT=", 7))
+            return AVPROBE_SCORE_EXTENSION / 3;
         ptr += strcspn(ptr, "\n") + 1;
     }
     return 0;



More information about the ffmpeg-cvslog mailing list