[FFmpeg-devel] [PATCH v2 5/6] avformat/srtdec: speed up probing

wm4 nfxjfg at googlemail.com
Thu Sep 4 22:40:26 CEST 2014


---
As suggested by ubitux. Note that the change to ff_subtitles_read_line()
already cuts down the probing time a lot, so maybe this is not needed.
---
 libavformat/srtdec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c
index b63d344..f5f3933 100644
--- a/libavformat/srtdec.c
+++ b/libavformat/srtdec.c
@@ -43,6 +43,7 @@ static int srt_probe(AVProbeData *p)
         if (ff_subtitles_read_line(&tr, buf, sizeof(buf)) < 0)
             break;
         if ((num == i || num + 1 == i)
+            && buf[0] >= '0' && buf[1] <= '9' && strstr(buf, " --> ")
             && sscanf(buf, "%*d:%*2d:%*2d%*1[,.]%*3d --> %*d:%*2d:%*2d%*1[,.]%3d", &v) == 1)
             return AVPROBE_SCORE_MAX;
         num = atoi(buf);
-- 
2.1.0



More information about the ffmpeg-devel mailing list