# HG changeset patch # User atlka # Date 1010487823 0 # Node ID 654419a9a228e55b970702dfafd2eaee7b5bacdc # Parent 961c7085cf71648457a23eb726fb972e2c81071d changed subreader.c to read microdvd lines in form "{%ld}{}[^\r\n]" too diff -r 961c7085cf71 -r 654419a9a228 subreader.c --- 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; }