[FFmpeg-cvslog] avformat/srtdec: skip initial random line breaks.

Clément Bœsch git at videolan.org
Sun Sep 15 22:20:39 CEST 2013


ffmpeg | branch: release/2.0 | Clément Bœsch <u at pkh.me> | Sun Sep  8 16:17:46 2013 +0200| [59147be24f4bdf16fd8b96217af49e55a1810725] | committer: Alexander Strasser

avformat/srtdec: skip initial random line breaks.

I found a bunch of (recent) SRT files in the wild with 3 to 10 line
breaks at the beginning.

(cherry picked from commit cfcd55db164e0acc0c30b2cf084e6eebe9741d34)

Signed-off-by: Alexander Strasser <eclipse7 at gmx.net>

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

 libavformat/srtdec.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c
index dbf1866..ac783d9 100644
--- a/libavformat/srtdec.c
+++ b/libavformat/srtdec.c
@@ -37,6 +37,8 @@ static int srt_probe(AVProbeData *p)
     if (AV_RB24(ptr) == 0xEFBBBF)
         ptr += 3;  /* skip UTF-8 BOM */
 
+    while (*ptr == '\r' || *ptr == '\n')
+        ptr++;
     for (i=0; i<2; i++) {
         if ((num == i || num + 1 == i)
             && sscanf(ptr, "%*d:%*2d:%*2d%*1[,.]%*3d --> %*d:%*2d:%*2d%*1[,.]%3d", &v) == 1)



More information about the ffmpeg-cvslog mailing list