[MPlayer-dev-eng] patch for SAMI subtitles file [fwd: codedj at echo.ru: Re: [MPlayer-users] small SAMI bugs]

pl p_l at gmx.fr
Fri Nov 9 14:46:26 CET 2001


Hi,

I found this patch on the -userlist and it has not yet been forwarded to
this list.

Consider applying if it's OK.
(I've never seen any SAMI subtitles files so I can't say...)

----- Forwarded message from Evgeny Chukreev <codedj at echo.ru> -----

Date: Tue, 30 Oct 2001 09:40:15 +0600
To: mplayer-users at mplayer.dev.hu
From: Evgeny Chukreev <codedj at echo.ru>
Subject: Re: [MPlayer-users] small SAMI bugs

On Tue, 30 Oct 2001 00:53:52 +0600 Evgeny Chukreev <codedj at echo.ru> wrote:

What a...? Where is the patch which I sent? (in MIME format)

Just again:

diff -urN MPlayer-20011028/subreader.c MPlayer-20011028.new/subreader.c
--- MPlayer-20011028/subreader.c	Sat Oct 27 05:14:19 2001
+++ MPlayer-20011028.new/subreader.c	Tue Oct 30 00:15:28 2001
@@ -89,16 +89,21 @@
  
 	case 3: /* get all text until '<' appears */
 	    if (*s == '\0') { break; }
-	    else if (*s == '<') { state = 4; }
-	    else if (!strncasecmp (s, "&nbsp;", 6)) { *p++ = ' '; s += 6; }
-	    else if (*s == '\r') { s++; }
-	    else if (!strncasecmp (s, "<br>", 4) || *s == '\n') {
+	    else if (!strncasecmp (s, "<br>", 4)) {
 		*p = '\0'; p = text; trail_space (text);
 		if (text[0] != '\0')
 		    current->text[current->lines++] = strdup (text);
-		if (*s == '\n') s++; else s += 4;
+		s += 4;
 	    }
+	    else if (*s == '<') { state = 4; }
+	    else if (!strncasecmp (s, "&nbsp;", 6)) { *p++ = ' '; s += 6; }
+	    else if (*s == '\t' || *s == '\n') { *p++ = ' '; s++; }
+	    else if (*s == '\r') { s++; }
 	    else *p++ = *s++;
+
+	    /* skip duplicated space */
+	    if (p > text + 2) if (*(p-1) == ' ' && *(p-2) == ' ') p--;
+	    
 	    continue;
 
 	case 4: /* get current->end or skip <TAG> */

EC> There is the fix for the SAMI reader.
EC> Fixes: <BR> breaks text, \t and \n are spaces,
EC> duplicated spaces goes to be replaced by one.

--
... Evgeny ... [finntroll - Bakom Varje Fura]
_______________________________________________
RTFM!!!  http://www.MPlayerHQ.hu/DOCS
Search:  http://www.MPlayerHQ.hu/cgi-bin/htsearch
http://mplayerhq.hu/mailman/listinfo/mplayer-users


----- End forwarded message -----

--
Regards,
  pl



More information about the MPlayer-dev-eng mailing list