[MPlayer-cvslog] r37744 - in trunk: mplayer.c sub/subreader.c sub/subreader.h

reimar subversion at mplayerhq.hu
Sat Feb 20 11:38:30 CET 2016


Author: reimar
Date: Sat Feb 20 11:38:30 2016
New Revision: 37744

Log:
Fix -subcp enca: with external ASS subtitles.

Do not pass the raw -subcp including "enca:"
to libass.
Fix for issue #2281.

Patch by Basin Ilya [basinilya gmail.com]

Modified:
   trunk/mplayer.c
   trunk/sub/subreader.c
   trunk/sub/subreader.h

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	Sat Feb 20 11:32:06 2016	(r37743)
+++ trunk/mplayer.c	Sat Feb 20 11:38:30 2016	(r37744)
@@ -1085,11 +1085,12 @@ void add_subtitles(char *filename, float
     if (filename == NULL || mpctx->set_of_sub_size >= MAX_SUBTITLE_FILES)
         return;
 
+    enca_sub_cp = NULL;
     subd = sub_read_file(filename, fps);
 #ifdef CONFIG_ASS
     if (ass_enabled)
 #ifdef CONFIG_ICONV
-        asst = ass_read_stream(ass_library, filename, sub_cp);
+        asst = ass_read_stream(ass_library, filename, (enca_sub_cp ? enca_sub_cp : sub_cp));
 #else
         asst = ass_read_stream(ass_library, filename, 0);
 #endif

Modified: trunk/sub/subreader.c
==============================================================================
--- trunk/sub/subreader.c	Sat Feb 20 11:32:06 2016	(r37743)
+++ trunk/sub/subreader.c	Sat Feb 20 11:38:30 2016	(r37744)
@@ -54,6 +54,7 @@
 #include <iconv.h>
 #endif
 char *sub_cp=NULL;
+char *enca_sub_cp=NULL;
 #ifdef CONFIG_FRIBIDI
 #include <fribidi/fribidi.h>
 char *fribidi_charset = NULL;   ///character set that will be passed to FriBiDi
@@ -1212,21 +1213,20 @@ void	subcp_open (stream_t *st)
 	char *tocp = "UTF-8";
 
 	if (sub_cp){
-		const char *cp_tmp = sub_cp;
 #ifdef CONFIG_ENCA
 		char enca_lang[3], enca_fallback[100];
 		if (sscanf(sub_cp, "enca:%2s:%99s", enca_lang, enca_fallback) == 2
 		     || sscanf(sub_cp, "ENCA:%2s:%99s", enca_lang, enca_fallback) == 2) {
 		  if (st && st->flags & MP_STREAM_SEEK ) {
-		    cp_tmp = guess_cp(st, enca_lang, enca_fallback);
+		    enca_sub_cp = guess_cp(st, enca_lang, enca_fallback);
 		  } else {
-		    cp_tmp = enca_fallback;
+		    enca_sub_cp = enca_fallback;
 		    if (st)
 		      mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: enca failed, stream must be seekable.\n");
 		  }
 		}
 #endif
-		if ((icdsc = iconv_open (tocp, cp_tmp)) != (iconv_t)(-1)){
+		if ((icdsc = iconv_open (tocp, enca_sub_cp)) != (iconv_t)(-1)){
 			mp_msg(MSGT_SUBREADER,MSGL_V,"SUB: opened iconv descriptor.\n");
 			sub_utf8 = 2;
 		} else

Modified: trunk/sub/subreader.h
==============================================================================
--- trunk/sub/subreader.h	Sat Feb 20 11:32:06 2016	(r37743)
+++ trunk/sub/subreader.h	Sat Feb 20 11:38:30 2016	(r37744)
@@ -33,6 +33,7 @@ extern int sub_no_text_pp;  // disable t
 extern int sub_match_fuzziness;
 extern int sub_format;
 extern char *sub_cp;
+extern char *enca_sub_cp;
 
 // subtitle formats
 #define SUB_INVALID   -1


More information about the MPlayer-cvslog mailing list