[MPlayer-dev-eng] [PATCH] {...} removal in SAMI subtitles

Salvatore Falco sfalco at studenti.ing.uniroma1.it
Fri Feb 27 12:48:15 CET 2004


This small patch eliminates the commands and comments between
{ and } in SAMI subtitle files.
It is also compliant with the -sub-no-text-pp switch.

Best regards, Salvatore Falco
-------------- next part --------------
--- subreader.c.old	2004-02-26 21:46:03.000000000 +0100
+++ subreader.c	2004-02-26 21:47:42.000000000 +0100
@@ -144,6 +144,7 @@
 		    current->text[current->lines++] = strdup (text);
 		s += 4;
 	    }
+	    else if ((*s == '{') && !sub_no_text_pp) { state = 5; ++s; continue; }
 	    else if (*s == '<') { state = 4; }
 	    else if (!strncasecmp (s, "&nbsp;", 6)) { *p++ = ' '; s += 6; }
 	    else if (*s == '\t') { *p++ = ' '; s++; }
@@ -168,6 +169,11 @@
 	    s = strchr (s, '>');
 	    if (s) { s++; state = 3; continue; }
 	    break;
+	case 5: /* get rid of {...} text */
+	    if (*s == '}') state = 3;
+	    ++s;
+	    continue;
+	    break;
 	}
 
 	/* read next line */


More information about the MPlayer-dev-eng mailing list