[vlc-devel] [PATCH] UTF-16 chapter titles (reworked)
Rémi Denis-Courmont
remi at remlab.net
Mon Jul 4 14:36:18 CEST 2016
Le 2016-07-03 21:05, Donald Campbell a écrit :
> Suggestions applied, using FromCharset now instead. Tested on OS X,
> no warnings, properly shows text and is much cleaner.
>
> Thanks,
> -DC
> P.S. I’ve turned off digest mode so I can properly continue the
> thread from now on.
>
> ---
> modules/demux/mp4/mp4.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
> index 79c28a7..998196f 100644
> --- a/modules/demux/mp4/mp4.c
> +++ b/modules/demux/mp4/mp4.c
> @@ -1854,7 +1854,12 @@ static void LoadChapterApple( demux_t
> *p_demux, mp4_track_t *tk )
> {
> seekpoint_t *s = vlc_seekpoint_New();
>
> - s->psz_name = strndup( &p_buffer[2], i_len );
> + if(*(&p_buffer[2])==(char)255 &&
> *(&p_buffer[2]+1)==(char)254){ // UTF-16 BOM
This expression is needless complicated, but and worse
implementation-defined.
No thank you.
> + s->psz_name = FromCharset("UTF-16LE",
> &p_buffer[2], i_len);
> + } else { // non UTF-16 strings
> + s->psz_name = strndup( &p_buffer[2], i_len );
> + }
> +
> EnsureUTF8( s->psz_name );
>
> s->i_time_offset = i_dts + __MAX( i_pts_delta, 0 );
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list