1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-13 18:45:25 +00:00

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
This commit is contained in:
mplayer-svn 2011-08-15 20:19:39 +00:00 committed by wm4
parent c5b0ec92f9
commit 335c6259d2

View File

@ -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;