[vlc-commits] Subtitles: basic support for {y:i}, {y:b} and {y:u}
Jean-Baptiste Kempf
git at videolan.org
Sun Apr 3 02:21:17 CEST 2011
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Apr 3 02:16:58 2011 +0200| [168e56b088523cfd923a2fb76363947ce7708779] | committer: Jean-Baptiste Kempf
Subtitles: basic support for {y:i}, {y:b} and {y:u}
This is not fully working, though...
See #1825
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=168e56b088523cfd923a2fb76363947ce7708779
---
modules/codec/subsdec.c | 25 +++++++++++++++++++++++--
modules/demux/subtitle.c | 6 +++---
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/modules/codec/subsdec.c b/modules/codec/subsdec.c
index 2d74b63..21f2211 100644
--- a/modules/codec/subsdec.c
+++ b/modules/codec/subsdec.c
@@ -981,10 +981,31 @@ static char *CreateHtmlSubtitle( int *pi_align, char *psz_subtitle )
/* Hide {\stupidity} */
psz_subtitle = strchr( psz_subtitle, '}' ) + 1;
}
- else if( psz_subtitle[0] == '{' && ( psz_subtitle[1] == 'Y' || psz_subtitle[1] == 'y' )
+ else if( psz_subtitle[0] == '{' &&
+ ( psz_subtitle[1] == 'Y' || psz_subtitle[1] == 'y' )
&& psz_subtitle[2] == ':' && strchr( psz_subtitle, '}' ) )
{
- /* Hide {Y:stupidity} */
+ // FIXME: We don't do difference between Y and y, and we should.
+ if( psz_subtitle[3] == 'i' )
+ {
+ HtmlPut( &psz_html, "<i>" );
+ strcat( psz_tag, "i" );
+ }
+ if( psz_subtitle[3] == 'b' )
+ {
+ HtmlPut( &psz_html, "<b>" );
+ strcat( psz_tag, "b" );
+ }
+ if( psz_subtitle[3] == 'u' )
+ {
+ HtmlPut( &psz_html, "<u>" );
+ strcat( psz_tag, "u" );
+ }
+ psz_subtitle = strchr( psz_subtitle, '}' ) + 1;
+ }
+ else if( psz_subtitle[0] == '{' && psz_subtitle[2] == ':' && strchr( psz_subtitle, '}' ) )
+ {
+ // Hide other {x:y} atrocities, like {c:$bbggrr} or {P:x}
psz_subtitle = strchr( psz_subtitle, '}' ) + 1;
}
else if( psz_subtitle[0] == '\\' && psz_subtitle[1] )
diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
index f0f7e03..7fcd8d6 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -1681,7 +1681,7 @@ static int ParseJSS( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
continue;
}
}
-
+
while( psz_text[ strlen( psz_text ) - 1 ] == '\\' )
{
const char *s2 = TextGetLine( txt );
@@ -1702,7 +1702,7 @@ static int ParseJSS( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
if( !psz_text )
return VLC_ENOMEM;
- psz_orig = psz_text;
+ psz_orig = psz_text;
strcat( psz_text, s2 );
}
@@ -1787,7 +1787,7 @@ static int ParseJSS( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
else if( *(psz_text + 1 ) == '\r' || *(psz_text + 1 ) == '\n' ||
*(psz_text + 1 ) == '\0' )
{
- psz_text++;
+ psz_text++;
}
break;
default:
More information about the vlc-commits
mailing list