[vlc-devel] [PATCH] Ignore comments in subtitles
Derk-Jan Hartman
hartman at videolan.org
Tue Sep 16 14:31:18 CEST 2008
On 14 sep 2008, at 17:11, Michael Meeuwisse wrote:
> Hi,
>
> This is an old problem: http://forum.videolan.org/viewtopic.php?
> t=31824 - but the proposed patches either never ended up in VLC, or
> the problem was reintroduced at some point. A lot of code seems to
> have changed so the latter is certainly a possibility. This patch
> should fix it again, however I can't get VLC to compile atm on Leopard
> (3rd party libs refuse to compile) so it's currently untested.
It was never fixed.
>
> HtH,
> Michael
>
> diff --git a/modules/codec/subtitles/subsass.c b/modules/codec/
> subtitles/subsass.c
> index 3725002..4921980 100644
> --- a/modules/codec/subtitles/subsass.c
> +++ b/modules/codec/subtitles/subsass.c
> @@ -93,16 +93,24 @@ void ParseSSAString( decoder_t *p_dec,
> i_text++;
> psz_buffer_sub += 2;
> }
> - else if( psz_buffer_sub[0] == '{' &&
> - psz_buffer_sub[1] == '\\' )
> + else if( psz_buffer_sub[1] == '{' )
> {
> - /* SSA control code */
> - while( psz_buffer_sub[0] != '\0' &&
> - psz_buffer_sub[0] != '}' )
> + if(psz_buffer_sub[0] == '\\' )
> {
> + /* SSA control code */
> + while( psz_buffer_sub[0] != '\0' &&
> + psz_buffer_sub[0] != '}' )
> + {
> + psz_buffer_sub++;
> + }
> psz_buffer_sub++;
> }
> - psz_buffer_sub++;
> + else
> + {
> + psz_new_subtitle[i_text] = '{';
> + i_text++;
> + psz_buffer_sub += 2;
> + }
> }
A control code in SSA subs is this:
{\code}
A comment however according to the original spec is a line starting
with ! in the file, or an event of the type Comment. The problem here
seems to be that VLC does not skip {REALLLY LONG STRING}. However
according to my documentation on SSA/ASS this is "nothing" it just has
no designated meaning and as such VLC thinks it should just display
the string.
Next, the patch is just plain wrong. It says:
IF 2nd char is '{' THEN IF the first char is '\' -> skip until we
reach the end of the line or we encounter } ELSE print { and skip two
chars. } ENDIF ENDIF
This simply is wrong.
If anything should be changed then it should skip {anything} and NOT
skip \{anything} (Where i assume that \ can escape { so that it is
still a usable character.
DJ
More information about the vlc-devel
mailing list