[Mplayer-cvslog] CVS: main mplayer.h,1.27,1.28 subreader.c,1.92,1.93

Zoltan Ponekker pontscho at mplayerhq.hu
Tue Jan 21 20:13:17 CET 2003


Update of /cvsroot/mplayer/main
In directory mail:/var/tmp.root/cvs-serv19043

Modified Files:
	mplayer.h subreader.c 
Log Message:


- add subcp 
- fix some 10l in gui
- fix one 10l bug in subreader


Index: mplayer.h
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- mplayer.h	21 Jan 2003 13:33:11 -0000	1.27
+++ mplayer.h	21 Jan 2003 19:12:34 -0000	1.28
@@ -34,6 +34,7 @@
 extern int    sub_auto;
 extern int    sub_pos;
 extern int    sub_unicode;
+extern char * sub_cp;
 extern subtitle* subtitles;
 extern subtitle* vo_sub;
 extern int    suboverlap_enabled;

Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -r1.92 -r1.93
--- subreader.c	19 Jan 2003 00:54:55 -0000	1.92
+++ subreader.c	21 Jan 2003 19:12:34 -0000	1.93
@@ -904,6 +904,7 @@
 int sub_utf8=0;
 #else
 extern int sub_utf8;
+int sub_utf8_prev=0;
 #endif
 
 extern float sub_delay;
@@ -916,9 +917,11 @@
 {
 	char *tocp = "UTF-8";
 	icdsc = (iconv_t)(-1);
+
 	if (sub_cp){
 		if ((icdsc = iconv_open (tocp, sub_cp)) != (iconv_t)(-1)){
 			mp_msg(MSGT_SUBREADER,MSGL_V,"SUB: opened iconv descriptor.\n");
+			sub_utf8_prev=sub_utf8;
 			sub_utf8 = 2;
 		} else
 			mp_msg(MSGT_SUBREADER,MSGL_ERR,"SUB: error opening iconv descriptor.\n");
@@ -929,6 +932,7 @@
 {
 	if (icdsc != (iconv_t)(-1)){
 		(void) iconv_close (icdsc);
+		sub_utf8=sub_utf8_prev;
 	   	mp_msg(MSGT_SUBREADER,MSGL_V,"SUB: closed iconv descriptor.\n");
 	}
 }
@@ -947,10 +951,10 @@
 		ip = sub->text[--l];
 		ileft = strlen(ip);
 		oleft = ICBUFFSIZE - 1;
-		
+
 		if (iconv(icdsc, &ip, &ileft,
 			  &op, &oleft) == (size_t)(-1)) {
-			mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: error recoding line.\n");
+			mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: error recoding line (1).\n");
 			l++;
 			break;
 		}
@@ -988,7 +992,7 @@
 		
      if (iconv(icdsc, &ip, &ileft,
 	      &op, &oleft) == (size_t)(-1)) {
-	mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: error recoding line.\n");
+	mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: error recoding line (2).\n");
 	return sub;
      }
      *op='\0' ;
@@ -1119,6 +1123,14 @@
 #ifdef USE_ICONV
 	if ((sub!=ERR) && (sub_utf8 & 2)) sub=subcp_recode(sub);
 #endif
+	if ( sub == ERR )
+	 {
+#ifdef USE_ICONV
+          subcp_close();
+#endif
+    	  if ( first ) free(first);
+	  return NULL; 
+	 }
         // Apply any post processing that needs recoding first
         if ((sub!=ERR) && srp->post) srp->post(sub);
 #ifdef USE_SORTSUB



More information about the MPlayer-cvslog mailing list