[MPlayer-cvslog] r34574 - trunk/sub/subreader.c

reimar subversion at mplayerhq.hu
Sun Jan 15 13:08:27 CET 2012


Author: reimar
Date: Sun Jan 15 13:08:26 2012
New Revision: 34574

Log:
Eliminate duplicate subtitle lines which will most likely
be artefacts from ASS effects.

Modified:
   trunk/sub/subreader.c

Modified: trunk/sub/subreader.c
==============================================================================
--- trunk/sub/subreader.c	Sun Jan 15 12:18:13 2012	(r34573)
+++ trunk/sub/subreader.c	Sun Jan 15 13:08:26 2012	(r34574)
@@ -2565,6 +2565,16 @@ void sub_add_text(subtitle *sub, const c
   if (sub->lines < SUB_MAX_TEXT &&
       strlen(sub->text[sub->lines]))
     sub->lines++;
+  if (sub->lines > 1 &&
+      strcmp(sub->text[sub->lines-1], sub->text[sub->lines-2]) == 0) {
+    // remove duplicate lines. These can happen with some
+    // "clever" ASS effects.
+    sub->lines--;
+    sub->endpts[sub->lines-1] =
+      FFMAX(sub->endpts[sub->lines-1],
+            sub->endpts[sub->lines]);
+    free(sub->text[sub->lines]);
+  }
 #ifdef CONFIG_FRIBIDI
   sub = sub_fribidi(sub, sub_utf8, orig_lines);
 #endif


More information about the MPlayer-cvslog mailing list