]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/sccdec.c
avformat/mpsubdec: Check pts / duration before cast
[ffmpeg] / libavformat / sccdec.c
index 89d21b9c1fb25a1cc8be842a2d3d41a53c22abf1..412d8aaf49e557265992f92adf81e4a8c291ccca 100644 (file)
@@ -29,7 +29,7 @@ typedef struct SCCContext {
     FFDemuxSubtitlesQueue q;
 } SCCContext;
 
-static int scc_probe(AVProbeData *p)
+static int scc_probe(const AVProbeData *p)
 {
     char buf[18];
     FFTextReader tr;
@@ -110,6 +110,7 @@ static int scc_read_header(AVFormatContext *s)
         ts_end = (hh2 * 3600LL + mm2 * 60LL + ss2) * 1000LL + fs2 * 33;
         count++;
 
+try_again:
         lline = (char *)&line;
         lline += 12;
 
@@ -138,9 +139,13 @@ static int scc_read_header(AVFormatContext *s)
         sub->pts = ts_start;
         sub->duration = FFMAX(1200, ts_end - ts_start);
         memmove(line, line2, sizeof(line));
+        line2[0] = 0;
         FFSWAP(ptrdiff_t, len, len2);
     }
 
+    if (line[0])
+        goto try_again;
+
     ff_subtitles_queue_finalize(s, &scc->q);
 
     return ret;