X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fvplayerdec.c;h=897c4083b6c694319ae7ccef880d02d02e03565b;hb=8cd1323103d3a287eeba5cac32e00cd7314c02bd;hp=860b7785c9c86444b53ad6b35ac43f6c9cfcc37f;hpb=063b26d35857f72b4f9bd24ea509808291f5d6b8;p=ffmpeg diff --git a/libavformat/vplayerdec.c b/libavformat/vplayerdec.c index 860b7785c9c..897c4083b6c 100644 --- a/libavformat/vplayerdec.c +++ b/libavformat/vplayerdec.c @@ -36,7 +36,8 @@ static int vplayer_probe(AVProbeData *p) char c; const unsigned char *ptr = p->buf; - if (sscanf(ptr, "%*d:%*d:%*d.%*d%c", &c) == 1 && strchr(": =", c)) + if ((sscanf(ptr, "%*d:%*d:%*d.%*d%c", &c) == 1 || + sscanf(ptr, "%*d:%*d:%*d%c", &c) == 1) && strchr(": =", c)) return AVPROBE_SCORE_MAX; return 0; } @@ -44,12 +45,12 @@ static int vplayer_probe(AVProbeData *p) static int64_t read_ts(char **line) { char c; - int hh, mm, ss, ms, len; + int hh, mm, ss, ms, n, len; - if (sscanf(*line, "%d:%d:%d.%d%c%n", - &hh, &mm, &ss, &ms, &c, &len) >= 5) { + if (((n = sscanf(*line, "%d:%d:%d.%d%c%n", &hh, &mm, &ss, &ms, &c, &len)) >= 5 || + (n = sscanf(*line, "%d:%d:%d%c%n", &hh, &mm, &ss, &c, &len)) >= 4) && strchr(": =", c)) { *line += len; - return (hh*3600LL + mm*60LL + ss) * 100LL + ms; + return (hh*3600LL + mm*60LL + ss) * 100LL + (n < 5 ? 0 : ms); } return AV_NOPTS_VALUE; } @@ -62,8 +63,8 @@ static int vplayer_read_header(AVFormatContext *s) if (!st) return AVERROR(ENOMEM); avpriv_set_pts_info(st, 64, 1, 100); - st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; - st->codec->codec_id = AV_CODEC_ID_VPLAYER; + st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; + st->codecpar->codec_id = AV_CODEC_ID_VPLAYER; while (!avio_feof(s->pb)) { char line[4096];