Mercurial > mplayer.hg
changeset 17308:59452efe579c
Improved handling of text subs in Matroska files with adjacent newlines (\N) resulting in more than SUB_MAX_TEXT lines to display. Patch by Robert Henney (robh () rut ! org).
author | mosu |
---|---|
date | Wed, 04 Jan 2006 12:05:15 +0000 |
parents | d6983ae72e0e |
children | af441715a83c |
files | libmpdemux/demux_mkv.c subreader.h |
diffstat | 2 files changed, 15 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demux_mkv.c Wed Jan 04 11:26:15 2006 +0000 +++ b/libmpdemux/demux_mkv.c Wed Jan 04 12:05:15 2006 +0000 @@ -2546,16 +2546,19 @@ ptr1++; /* Newline */ - if (*ptr1 == '\\' && ptr1+1-block < size && (*(ptr1+1)|0x20) == 'n') + while (*ptr1 == '\\' && ptr1+1-block < size && (*(ptr1+1)|0x20) == 'n') { mkv_d->clear_subs_at[mkv_d->subs.lines++] = timecode + block_duration; *ptr2 = '\0'; if (mkv_d->subs.lines >= SUB_MAX_TEXT) { - mp_msg (MSGT_DEMUX, MSGL_WARN, "[mkv] Warning: too many " - "sublines to render, skipping\n"); - return; + mp_msg (MSGT_DEMUX, MSGL_WARN, "\n[mkv] Warning: too many " + "sublines to render, skipping after first %i\n", + SUB_MAX_TEXT); + mkv_d->subs.lines--; + ptr1=block+size; + break; } ptr2 = mkv_d->subs.text[mkv_d->subs.lines]; ptr1 += 2; @@ -2568,7 +2571,7 @@ } else { - while (ptr1 - block != size) + while (ptr1 - block < size) { if (*ptr1 == '\n' || *ptr1 == '\r') { @@ -2579,9 +2582,12 @@ = timecode + block_duration; if (mkv_d->subs.lines >= SUB_MAX_TEXT) { - mp_msg (MSGT_DEMUX, MSGL_WARN, "[mkv] Warning: too many " - "sublines to render, skipping\n"); - return; + mp_msg (MSGT_DEMUX, MSGL_WARN, "\n[mkv] Warning: too many " + "sublines to render, skipping after first %i\n", + SUB_MAX_TEXT); + mkv_d->subs.lines--; + ptr1=block+size; + break; } ptr2 = mkv_d->subs.text[mkv_d->subs.lines]; state = 1;
--- a/subreader.h Wed Jan 04 11:26:15 2006 +0000 +++ b/subreader.h Wed Jan 04 12:05:15 2006 +0000 @@ -29,7 +29,7 @@ #define MAX_SUBTITLE_FILES 128 -#define SUB_MAX_TEXT 10 +#define SUB_MAX_TEXT 12 #define SUB_ALIGNMENT_BOTTOMLEFT 1 #define SUB_ALIGNMENT_BOTTOMCENTER 2 #define SUB_ALIGNMENT_BOTTOMRIGHT 3