[vlc-devel] Re: [PATCH] Subtitle Support Again

Aaron Mady Aaron.Mady at DrakeSoftware.com
Thu Feb 8 03:23:33 CET 2007


Subtitles can have embedded tags, which start with {\ and end with a }.
If the section begins with a { and ends with a } but does not have the
backslash at the start then it is just a comment.

Therefore, this reads until the tag ends with a } or the buffer ends
with a \0.

> +				while ( psz_buffer_sub[0] != '\0' &&
> +                        psz_buffer_sub[0] != '}' )
> +				{
> +                    if ( psz_buffer_sub[0] == '\\' && (
psz_buffer_sub[1] == 'n' || psz_buffer_sub[1] == 'N' ) )
> +                    {
> +                        psz_buffer_sub += 2;
> +                        break;
> +                    }

This checks for \n or \N within the comment/tag and breaks out of the
loop if it runs into either.  I don't believe it would normally happen
with a properly formatted tag that you would have a new line within a
comment, but it was an attempt to handle an improperly-formatted
comments/tags.  It's also quite possible that I missed the part of the
specs that stated you could have new lines within comments, in which
case, that would be incorrect (but I did look through and didn't see
anything about such a case).

> +					psz_buffer_sub++;
> +				}
> +                psz_buffer_sub++;
> +			}
> +            

Honestly though, maybe one of the previous patches would be a better
idea.  Looks like I may be looking at trying to integrate the asa
project () into VLC for subtitle support instead of continuing to hack
at the current code, so using my (or rataime's) previous patch might be
a better stopgap solution for un-breaking GG fansubs and hiding comments
properly.

Aaron Mady

-----Original Message-----
From: vlc-devel-bounce at videolan.org
[mailto:vlc-devel-bounce at videolan.org] On Behalf Of Christophe Mutricy
Sent: 02/07/2007 5:38 PM
To: vlc-devel at videolan.org
Subject: [vlc-devel] Re: [PATCH] Subtitle Support Again

On Wed, Feb 07, 07 at 16:22 -0500, Aaron Mady wrote:
>                Took some further time looking at stripping out
subtitle
>    comments and so here is the new patch.  This version now also finds
>    embedded formatting tags, but for the time being just prints them
out as a
>    message.  That should be useful for future work on formatting,
however.
> 



> +				while ( psz_buffer_sub[0] != '\0' &&
> +                        psz_buffer_sub[0] != '}' )
> +				{
> +                    if ( psz_buffer_sub[0] == '\\' && (
psz_buffer_sub[1] == 'n' || psz_buffer_sub[1] == 'N' ) )
> +                    {
> +                        psz_buffer_sub += 2;
> +                        break;
> +                    }
What is this bit doing  ?

> +					psz_buffer_sub++;
> +				}
> +                psz_buffer_sub++;
> +			}
> +            


-- 
Xtophe

-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html

-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html



More information about the vlc-devel mailing list