From 335c6259d2f2460e9a0e4d7fbc885cab2d70b114 Mon Sep 17 00:00:00 2001 From: mplayer-svn Date: Mon, 15 Aug 2011 20:19:39 +0000 Subject: subreader: 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. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33993 b3059339-0415-0410-9bf9-f77b7e298cf2 Author: reimar --- sub/subreader.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'sub/subreader.c') diff --git a/sub/subreader.c b/sub/subreader.c index 18b2e53bf7..275c8abba9 100644 --- a/sub/subreader.c +++ b/sub/subreader.c @@ -820,6 +820,7 @@ static subtitle *sub_read_line_aqt(stream_t *st,subtitle *current, int utf16 = args->utf16; char line[LINE_LEN+1]; +retry: while (1) { // try to locate next subtitle if (!stream_read_line (st, line, LINE_LEN, utf16)) @@ -829,6 +830,7 @@ static subtitle *sub_read_line_aqt(stream_t *st,subtitle *current, } #ifdef CONFIG_SORTSUB + if (!previous_sub_end) previous_sub_end = (current->start) ? current->start - 1 : 0; #else if (previous_aqt_sub != NULL) @@ -851,13 +853,11 @@ static subtitle *sub_read_line_aqt(stream_t *st,subtitle *current, 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; @@ -875,6 +875,7 @@ static subtitle *sub_read_line_subrip09(stream_t *st,subtitle *current, int a1,a2,a3; int len; +retry: while (1) { // try to locate next subtitle if (!stream_read_line (st, line, LINE_LEN, utf16)) @@ -886,6 +887,7 @@ static subtitle *sub_read_line_subrip09(stream_t *st,subtitle *current, 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) @@ -903,13 +905,11 @@ static subtitle *sub_read_line_subrip09(stream_t *st,subtitle *current, 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; -- cgit v1.2.3