[MPlayer-dev-eng] SSA in mkv with adjacent \N patch

Robert Henney robh at rut.org
Thu Feb 17 17:31:02 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

new patch incorporating those changes.  there is another block of 
very similar code a page further down (for non-SSA subs maybe) in 
demux_mkv.c that could probably use similar changes, but I'll have 
to look more closely at that.

of course SUB_MAX_TEXT is really just a sanity limit, and ideally 
the maximum lines of sub text that get onto the screen should be
based on sub font size, vertical alignment, and of course window 
height.  but that is a bit non-trivial.

also, adjusted SUB_MAX_TEXT again, this time to 12.  found that to
be better than 14.  my choice of the particular value is based on 
what works best among the scripts and video I have tried and surely 
won't be ideal for everyone and all cases.


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 16:00:51 -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 16:00:53 -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;

-- 
robh




More information about the MPlayer-dev-eng mailing list