Commit cfcd55db authored by Clément Bœsch's avatar Clément Bœsch

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.
parent 7d7b4e8d
...@@ -37,6 +37,8 @@ static int srt_probe(AVProbeData *p) ...@@ -37,6 +37,8 @@ static int srt_probe(AVProbeData *p)
if (AV_RB24(ptr) == 0xEFBBBF) if (AV_RB24(ptr) == 0xEFBBBF)
ptr += 3; /* skip UTF-8 BOM */ ptr += 3; /* skip UTF-8 BOM */
while (*ptr == '\r' || *ptr == '\n')
ptr++;
for (i=0; i<2; i++) { for (i=0; i<2; i++) {
if ((num == i || num + 1 == i) if ((num == i || num + 1 == i)
&& sscanf(ptr, "%*d:%*2d:%*2d%*1[,.]%*3d --> %*d:%*2d:%*2d%*1[,.]%3d", &v) == 1) && sscanf(ptr, "%*d:%*2d:%*2d%*1[,.]%*3d --> %*d:%*2d:%*2d%*1[,.]%3d", &v) == 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment