[vlc-devel] [PATCH] Make USF subtitles conform better to spec

Bernie Purcell b.purcell at adbglobal.com
Sat Jul 7 03:48:09 CEST 2007

On Sat, 2007-06-30 at 01:49 +0200, Laurent Aimar wrote: 
> On Fri, Jun 22, 2007, Bernie Purcell wrote:
> > This patch is a tidied up version of code that was originally submitted
> > in a much larger patch. It is still a large patch, but now, at least,
> > most of the work centres solely on the subsdec.c module.
> > [....]
>  Is there any comment about this patch ?
>  If no I will commit it in a few days (3-4, with remarks below fixed).
> A few remarks:
>  - The code that removes multiple-spaces exists in quartztext and subsdec.
>   Is that wanted ? And if so why it is not also in freetype renderer ?
Sorry - it's taken me a bit longer to get to this than planned. The
changes needed to be made to freetype have now been committed. The
changes for subsdec and quartztext are still pending in this patch. The
whitespace removal code is only present when rendering HTML based
subtitles (treating multiple whitespace as single whitespace is part of
how html should be treated) - Text based subtitles should continue to be
parsed the same as normal - the trouble I think you are envisioning
comes from a function I added some time ago to turn plain text SRT, SUBS
etc subtitles into html subtitles. To get around this I've slightly
modified this function now to encode second and subsequent whitespace
characters, in the string being transformed to html, into
non-breaking-spaces. I think this should get the behaviour desired (ie.
preserve current behaviour when rendering subs, srt etc) while still
having a html renderer that does what it is supposed to (when eg passing
native XML format subtitles such as USF).

>  - memcpy( &ptr[x], &ptr[y], size ) is wrong.
>   You have to use memmove when source and destination overlaps. It is used in
>   quartztext and subsdec when removing multiple-spaces
The change has been made to this patch
>  - You can use strlcpy(p,s,l) instead of strncpy( p, s, l); p[l] = 0;
As has this one.

On a side note I broke up this patch into a number of smaller files
because I misunderstood a question Jean-Baptiste asked me. This had a
few problems with it, not the least of which was that some of them
conflicted with each other due to modifying lines very close together.
It also seemed very confusing. I've returned to putting everything into
the same patch here - hope that is ok with everyone.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: usf-enhancements.svn-diff
Type: text/x-patch
Size: 59500 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20070707/f2a020fa/attachment.bin>
-------------- next part --------------
vlc-devel mailing list
vlc-devel at videolan.org

More information about the vlc-devel mailing list