[MPlayer-cvslog] r26921 - trunk/subreader.c

eugeni subversion at mplayerhq.hu
Thu May 29 20:35:17 CEST 2008


Author: eugeni
Date: Thu May 29 20:35:17 2008
New Revision: 26921

Log:
Clear iconv conversion state after each subtitle line.

This fixes a bug when the last character on a subtitle line
is sometimes moved to the beginning of the next line.

Patch by Guy Shapiro, bugs sguy org.


Modified:
   trunk/subreader.c

Modified: trunk/subreader.c
==============================================================================
--- trunk/subreader.c	(original)
+++ trunk/subreader.c	Thu May 29 20:35:17 2008
@@ -1133,6 +1133,11 @@ subtitle* subcp_recode (subtitle *sub)
 			free(ot);
 			continue;
 		}
+		// In some stateful encodings, we must clear the state to handle the last character
+		if (iconv(icdsc, NULL, NULL,
+			  &op, &oleft) == (size_t)(-1)) {
+			mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: error recoding line, can't clear encoding state.\n");
+		}
 		*op='\0' ;
 		free (sub->text[l]);
 		sub->text[l] = ot;



More information about the MPlayer-cvslog mailing list