[MPlayer-dev-eng] [PATCHES] Various improvements in subreader.c

ubitux ubitux at gmail.com
Wed Apr 28 00:58:01 CEST 2010


Hi,

Here is a few small patches to improve a little subtitles.c

- patch-dvdsublang.diff:

"dvdsublang" is inappropriate since this code is not specific to DVD
subtitles. Also, tmpresult always contain the target subtitle, and not the
current tested one. This can produce the same message to be printed
several times if you have multiple movies and subtitles in the same
directory; something like this:

dvdsublang...mononoke hime fr,en
dvdsublang...mononoke hime fr,en
dvdsublang...mononoke hime fr,en
dvdsublang...mononoke hime fr,en
dvdsublang...mononoke hime fr,en
dvdsublang...mononoke hime fr,en
...

Adn finally, as this message is really not important, it should belong to debug
so MSGL_INFO has been changed to MSGL_DBG2

- patch-dead-code-priority.diff:

Transform dead fprintf code into debug message as it may be interesting to
get the actual priority of the sub while debugging.

- patch-fribidi-type.diff:

Just a fix about a FriBidi type mistake.

Also, I saw quiete a few potential issues in the SAMI parsing code; does
anyone has a sample SAMI subtitle file so I can test and maybe improve the
support?

Regards,

-- 
ubitux
-------------- next part --------------
Index: subreader.c
===================================================================
--- subreader.c	(revision 31104)
+++ subreader.c	(working copy)
@@ -1922,7 +1922,8 @@
 		    if (!prio && tmp_sub_id)
 		    {
 			sprintf(tmpresult, "%s %s", f_fname_trim, tmp_sub_id);
-			mp_msg(MSGT_SUBREADER,MSGL_INFO,"dvdsublang...%s\n", tmpresult);
+			mp_msg(MSGT_SUBREADER, MSGL_DBG2, "Potential sub: %s\n", tmp_fname_trim);
 			if (strcmp(tmp_fname_trim, tmpresult) == 0 && sub_match_fuzziness >= 1) {
 			    // matches the movie name + lang extension
 			    prio = 5;
-------------- next part --------------
Index: subreader.c
===================================================================
--- subreader.c	(revision 31104)
+++ subreader.c	(working copy)
@@ -1962,7 +1963,7 @@
 			}
 #endif
 			sprintf(tmpresult, "%s%s", j == 0 ? f_dir : path, de->d_name);
-//			fprintf(stderr, "%s priority %d\n", tmpresult, prio);
+			mp_msg(MSGT_SUBREADER, MSGL_DBG2, "%s (priority %d)\n", tmpresult, prio);
 			if ((f = fopen(tmpresult, "rt"))) {
 			    fclose(f);
 			    result[subcnt].priority = prio;
-------------- next part --------------
Index: subreader.c
===================================================================
--- subreader.c	(revision 31104)
+++ subreader.c	(working copy)
@@ -1172,7 +1172,7 @@
 {
   FriBidiChar logical[LINE_LEN+1], visual[LINE_LEN+1]; // Hopefully these two won't smash the stack
   char        *ip      = NULL, *op     = NULL;
-  FriBidiCharType base;
+  FriBidiParType base;
   size_t len,orig_len;
   int l=sub->lines;
   int char_set_num;


More information about the MPlayer-dev-eng mailing list