[MPlayer-dev-eng] [BUG][PATCH] Fribidi support broken - resubmit

Raindel Shachar raindel at techunix.technion.ac.il
Sat Aug 16 11:55:31 CEST 2003


Hi, I attach fixed patch, based on your feedback. Please commit or reject
(with reasone)

Cheers
Shachar
-------------- next part --------------
Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.118
diff -u -b -r1.118 subreader.c
--- subreader.c	10 Aug 2003 15:14:47 -0000	1.118
+++ subreader.c	16 Aug 2003 09:55:15 -0000
@@ -27,6 +27,8 @@
 #endif
 #ifdef USE_FRIBIDI
 #include <fribidi/fribidi.h>
+char *fribidi_charset = "ISO8859-8";
+int flip_hebrew=1;
 #endif
 
 extern char* dvdsub_lang;
@@ -1040,11 +1042,12 @@
   int l=sub->lines;
   int char_set_num;
   fribidi_boolean log2vis;
+  if(flip_hebrew) { // Please fix the indentation someday - 
   fribidi_set_mirroring (FRIBIDI_TRUE);
   fribidi_set_reorder_nsm (FRIBIDI_FALSE);
    
   if( sub_utf8 == 0 ) {
-    char_set_num = fribidi_parse_charset ("ISO8859-8");//We might want to make this a config option
+    char_set_num = fribidi_parse_charset (fribidi_charset);//We might want to make this a config option
   }else {
     char_set_num = fribidi_parse_charset ("UTF-8");
   }
@@ -1065,7 +1068,6 @@
       len = fribidi_remove_bidi_marks (visual, len, NULL, NULL,
 				       NULL);
       if((op = (char*)malloc(sizeof(char)*(max(2*orig_len,2*len) + 1))) == NULL) {
-      if((op = ALLOCATE(char,(max(2*orig_len,2*len) + 1))) == NULL) {
 	mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: error allocating mem.\n");
 	l++;
 	break;	
@@ -1079,6 +1081,7 @@
     for (l = sub->lines; l;)
       free (sub->text[--l]);
     return ERR;
+  }
   }
   return sub;
 }
Index: cfg-common.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-common.h,v
retrieving revision 1.107
diff -u -b -r1.107 cfg-common.h
--- cfg-common.h	13 Aug 2003 18:56:02 -0000	1.107
+++ cfg-common.h	16 Aug 2003 09:55:16 -0000
@@ -197,6 +197,15 @@
 
 #ifdef USE_SUB
 	{"sub", &sub_name, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
+#ifdef USE_FRIBIDI
+	{"fribidi_charset", &fribidi_charset, CONF_TYPE_STRING, 0, 0, 0, NULL},
+	{"flip_hebrew", &flip_hebrew, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+	{"noflip_hebrew", &flip_hebrew, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+#else 
+	{"fribidi_charset", "MPlayer wasn't compiled with FriBiDi support\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+	{"flip_hebrew", "MPlayer wasn't compiled with FriBiDi support\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+	{"noflip_hebrew", "MPlayer wasn't compiled with FriBiDi support\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+#endif
 #ifdef USE_ICONV
 	{"subcp", &sub_cp, CONF_TYPE_STRING, 0, 0, 0, NULL},
 #endif	


More information about the MPlayer-dev-eng mailing list