Mercurial > mplayer.hg
changeset 4048:654419a9a228
changed subreader.c to read microdvd lines in form "{%ld}{}[^\r\n]" too
author | atlka |
---|---|
date | Tue, 08 Jan 2002 11:03:43 +0000 |
parents | 961c7085cf71 |
children | d6f8feeac656 |
files | subreader.c |
diffstat | 1 files changed, 17 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/subreader.c Tue Jan 08 09:35:50 2002 +0000 +++ b/subreader.c Tue Jan 08 11:03:43 2002 +0000 @@ -171,12 +171,19 @@ char *p, *next; int i; +static subtitle *prevsub = NULL; + memset(current, 0, sizeof(subtitle)); do { if (!fgets (line, LINE_LEN, fd)) return NULL; - } while (sscanf (line, "{%ld}{%ld}%[^\r\n]", &(current->start), &(current->end),line2) <3); - + } while ((sscanf (line, + "{%ld}{}%[^\r\n]", + &(current->start), line2) < 2) && + (sscanf (line, + "{%ld}{%ld}%[^\r\n]", + &(current->start), &(current->end), line2) < 3)); + p=line2; next=p, i=0; @@ -187,6 +194,14 @@ } current->lines= ++i; + if (!current->end) + current->end = current->start + 150; /* approx 6 sec */ + + if (prevsub && (prevsub->end >= current->start)) + prevsub->end = current->start - 1; /* correct previous end time */ + + prevsub = current; + return current; }