From f7813a5324be39d13ab536c245d15dfc602a7849 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Sun, 29 Dec 2013 12:19:38 +0000 Subject: basic type mechanism working --- ffmpeg/libavformat/srtdec.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ffmpeg/libavformat/srtdec.c') diff --git a/ffmpeg/libavformat/srtdec.c b/ffmpeg/libavformat/srtdec.c index 76e06e4..7f911bd 100644 --- a/ffmpeg/libavformat/srtdec.c +++ b/ffmpeg/libavformat/srtdec.c @@ -37,12 +37,14 @@ 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) return AVPROBE_SCORE_MAX; num = atoi(ptr); - ptr += strcspn(ptr, "\n") + 1; + ptr += ff_subtitles_next_line(ptr); } return 0; } @@ -63,10 +65,10 @@ static int64_t get_pts(const char **buf, int *duration, int64_t start = (hh1*3600LL + mm1*60LL + ss1) * 1000LL + ms1; int64_t end = (hh2*3600LL + mm2*60LL + ss2) * 1000LL + ms2; *duration = end - start; - *buf += strcspn(*buf, "\n") + 1; + *buf += ff_subtitles_next_line(*buf); return start; } - *buf += strcspn(*buf, "\n") + 1; + *buf += ff_subtitles_next_line(*buf); } return AV_NOPTS_VALUE; } -- cgit v1.2.3