Re: [PATCH] fix libass fails with -subcp enca: and external subtitles try 2

Basin Ilya <[email protected]>
Newsgroups gmane.comp.video.mplayer.devel
Message-ID <[email protected]>
Attached.

Strange, a couple of years ago I configured Thunderbird to not mangle patches.
Must be caused by the new version.

On 02/13/2016 02:03 PM, Reimar Döffinger wrote:
> On Sat, Feb 13, 2016 at 01:55:01PM +0300, Basin Ilya wrote:
>> Hi.
>> Here's a proposed patch for https://trac.mplayerhq.hu/ticket/2281
> 
> It looks fine to me, except that the patch is still mangled
> with extra whitespace and line breaks.
> Assuming you don't have any idea how to prevent that,
> can you send it as attachment instead?
> It's not huge so we can apply it manually but it would
> be more convenient if we didn't have to.
> 
> Thanks,
> Reimar
> _______________________________________________
> MPlayer-dev-eng mailing list
> [email protected]
> https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
>

_______________________________________________
MPlayer-dev-eng mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
0001-fix-libass-fails-with-subcp-enca-and-external-subtit.patch (text/x-patch, 2.6 KB)
From 87c17d17088395298f30bcbd3486bccb737f6af2 Mon Sep 17 00:00:00 2001
From: Ilya Basin <[email protected]>
Date: Tue, 2 Feb 2016 14:48:27 +0300
Subject: [PATCH] fix libass fails with -subcp enca: and external subtitles

---
 mplayer.c       | 3 ++-
 sub/subreader.c | 8 ++++----
 sub/subreader.h | 1 +
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/mplayer.c b/mplayer.c
index aa5ca33..017e149 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -1085,11 +1085,12 @@ void add_subtitles(char *filename, float fps, int noerr)
     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
diff --git a/sub/subreader.c b/sub/subreader.c
index ecc5ff5..510c43a 100644
--- a/sub/subreader.c
+++ b/sub/subreader.c
@@ -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
diff --git a/sub/subreader.h b/sub/subreader.h
index 0760081..554dbd7 100644
--- a/sub/subreader.h
+++ b/sub/subreader.h
@@ -33,6 +33,7 @@ extern int sub_no_text_pp;  // disable text post-processing
 extern int sub_match_fuzziness;
 extern int sub_format;
 extern char *sub_cp;
+extern char *enca_sub_cp;
 
 // subtitle formats
 #define SUB_INVALID   -1
-- 
2.7.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.