Commit 168e56b0 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Subtitles: basic support for {y:i}, {y:b} and {y:u}

This is not fully working, though...
See #1825
parent 39b85ca6
...@@ -981,10 +981,31 @@ static char *CreateHtmlSubtitle( int *pi_align, char *psz_subtitle ) ...@@ -981,10 +981,31 @@ static char *CreateHtmlSubtitle( int *pi_align, char *psz_subtitle )
/* Hide {\stupidity} */ /* Hide {\stupidity} */
psz_subtitle = strchr( psz_subtitle, '}' ) + 1; 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, '}' ) ) && 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; psz_subtitle = strchr( psz_subtitle, '}' ) + 1;
} }
else if( psz_subtitle[0] == '\\' && psz_subtitle[1] ) else if( psz_subtitle[0] == '\\' && psz_subtitle[1] )
......
...@@ -1681,7 +1681,7 @@ static int ParseJSS( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx ) ...@@ -1681,7 +1681,7 @@ static int ParseJSS( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
continue; continue;
} }
} }
while( psz_text[ strlen( psz_text ) - 1 ] == '\\' ) while( psz_text[ strlen( psz_text ) - 1 ] == '\\' )
{ {
const char *s2 = TextGetLine( txt ); const char *s2 = TextGetLine( txt );
...@@ -1702,7 +1702,7 @@ static int ParseJSS( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx ) ...@@ -1702,7 +1702,7 @@ static int ParseJSS( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
if( !psz_text ) if( !psz_text )
return VLC_ENOMEM; return VLC_ENOMEM;
psz_orig = psz_text; psz_orig = psz_text;
strcat( psz_text, s2 ); strcat( psz_text, s2 );
} }
...@@ -1787,7 +1787,7 @@ static int ParseJSS( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx ) ...@@ -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' || else if( *(psz_text + 1 ) == '\r' || *(psz_text + 1 ) == '\n' ||
*(psz_text + 1 ) == '\0' ) *(psz_text + 1 ) == '\0' )
{ {
psz_text++; psz_text++;
} }
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment