[MPlayer-cvslog] CVS: main/libmpdemux demux_mkv.c,1.53,1.54

Moritz Bunkus CVS syncmail at mplayerhq.hu
Wed Jan 4 13:05:17 CET 2006


CVS change done by Moritz Bunkus CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv10279/libmpdemux

Modified Files:
	demux_mkv.c 
Log Message:
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).

Index: demux_mkv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mkv.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- demux_mkv.c	18 Nov 2005 14:39:18 -0000	1.53
+++ demux_mkv.c	4 Jan 2006 12:05:15 -0000	1.54
@@ -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;




More information about the MPlayer-cvslog mailing list