[MPlayer-dev-eng] SSA in mkv with adjacent \N patch
Robert Henney
robh at rut.org
Thu Feb 17 18:23:04 CET 2005
On Thu, Feb 17, 2005 at 11:02:07AM +0100, Moritz Bunkus wrote:
> Hey,
>
> please send unified diffs (created with "cvs diff -u").
>
> Also: I prefer that the situation "more lines than SUB_MAX_TEXT" simply
> results in the surplus lines being dropped -- but not the whole entry.
> Could you implement that, too, please?
>
> Mosu
updated patch. this one adds the same changes for the other sub type
as well. the surrounding code is almost identical in structure so I
think I have it correct, but someone with those particular alternative
type of subtitles on hand should give it some testing.
Index: subreader.h
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.h,v
retrieving revision 1.37
diff -u -r1.37 subreader.h
--- subreader.h 18 Oct 2004 20:41:05 -0000 1.37
+++ subreader.h 17 Feb 2005 17:14:11 -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
Index: libmpdemux/demux_mkv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mkv.c,v
retrieving revision 1.37
diff -u -r1.37 demux_mkv.c
--- libmpdemux/demux_mkv.c 21 Jan 2005 18:25:44 -0000 1.37
+++ libmpdemux/demux_mkv.c 17 Feb 2005 17:14:12 -0000
@@ -2583,16 +2583,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;
@@ -2605,7 +2608,7 @@
}
else
{
- while (ptr1 - block != size)
+ while (ptr1 - block < size)
{
if (*ptr1 == '\n' || *ptr1 == '\r')
{
@@ -2616,9 +2619,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;
--
robh
More information about the MPlayer-dev-eng
mailing list