summaryrefslogtreecommitdiffstats
path: root/subreader.c
diff options
context:
space:
mode:
authoratlka <atlka@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-01-08 11:03:43 +0000
committeratlka <atlka@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-01-08 11:03:43 +0000
commit8da82b8b0e33e46d63677ad0f2bc60c43a52a081 (patch)
treeefb7a80268f7e0629cdebea0b278cdec7368ad08 /subreader.c
parent9e128e3e82ab796f72122f177287f75eff54a2f7 (diff)
downloadmpv-8da82b8b0e33e46d63677ad0f2bc60c43a52a081.tar.bz2
mpv-8da82b8b0e33e46d63677ad0f2bc60c43a52a081.tar.xz
changed subreader.c to read microdvd lines in form "{%ld}{}[^\r\n]" too
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4049 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'subreader.c')
-rw-r--r--subreader.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/subreader.c b/subreader.c
index aca02e82d8..4bbd412ab5 100644
--- a/subreader.c
+++ b/subreader.c
@@ -171,12 +171,19 @@ subtitle *sub_read_line_microdvd(FILE *fd,subtitle *current) {
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 @@ subtitle *sub_read_line_microdvd(FILE *fd,subtitle *current) {
}
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;
}