[MPlayer-cvslog] r33993 - trunk/sub/subreader.c

reimar subversion at mplayerhq.hu
Mon Aug 15 22:19:39 CEST 2011


Author: reimar
Date: Mon Aug 15 22:19:39 2011
New Revision: 33993

Log:
Fix reading of aqr/subrip09 subtitles.
NULL return would indicate EOF, thus the "clear subtitle" entries
would cause sub file parsing to stop.
In addition the wrong sub end times would be used with CONFIG_SORTSUB.

Modified:
   trunk/sub/subreader.c

Modified: trunk/sub/subreader.c
==============================================================================
--- trunk/sub/subreader.c	Mon Aug 15 22:05:09 2011	(r33992)
+++ trunk/sub/subreader.c	Mon Aug 15 22:19:39 2011	(r33993)
@@ -790,6 +790,7 @@ subtitle *previous_aqt_sub = NULL;
 static subtitle *sub_read_line_aqt(stream_t *st,subtitle *current, int utf16) {
     char line[LINE_LEN+1];
 
+retry:
     while (1) {
     // try to locate next subtitle
         if (!stream_read_line (st, line, LINE_LEN, utf16))
@@ -799,6 +800,7 @@ static subtitle *sub_read_line_aqt(strea
     }
 
 #ifdef CONFIG_SORTSUB
+    if (!previous_sub_end)
     previous_sub_end = (current->start) ? current->start - 1 : 0;
 #else
     if (previous_aqt_sub != NULL)
@@ -821,13 +823,11 @@ static subtitle *sub_read_line_aqt(strea
         return ERR;
 
     if (!strlen(current->text[0]) && !strlen(current->text[1])) {
-#ifdef CONFIG_SORTSUB
-	previous_sub_end = 0;
-#else
+#ifndef CONFIG_SORTSUB
 	// void subtitle -> end of previous marked and exit
 	previous_aqt_sub = NULL;
 #endif
-	return NULL;
+	goto retry;
 	}
 
     return current;
@@ -842,6 +842,7 @@ static subtitle *sub_read_line_subrip09(
     int a1,a2,a3;
     int len;
 
+retry:
     while (1) {
     // try to locate next subtitle
         if (!stream_read_line (st, line, LINE_LEN, utf16))
@@ -853,6 +854,7 @@ static subtitle *sub_read_line_subrip09(
     current->start = a1*360000+a2*6000+a3*100;
 
 #ifdef CONFIG_SORTSUB
+    if (!previous_sub_end)
     previous_sub_end = (current->start) ? current->start - 1 : 0;
 #else
     if (previous_subrip09_sub != NULL)
@@ -870,13 +872,11 @@ static subtitle *sub_read_line_subrip09(
         return ERR;
 
     if (!strlen(current->text[0]) && current->lines <= 1) {
-#ifdef CONFIG_SORTSUB
-	previous_sub_end = 0;
-#else
+#ifndef CONFIG_SORTSUB
 	// void subtitle -> end of previous marked and exit
 	previous_subrip09_sub = NULL;
 #endif
-	return NULL;
+	goto retry;
 	}
 
     return current;


More information about the MPlayer-cvslog mailing list