[vlc-commits] MP4: support chapter titles in UTF-16
Donald Campbell
git at videolan.org
Mon Jul 4 14:04:39 CEST 2016
vlc | branch: master | Donald Campbell <donaciano2000 at gmail.com> | Sun Jul 3 15:05:14 2016 -0400| [cb1498a94aef75c0fea1ca6098ef2813a102781d] | committer: Jean-Baptiste Kempf
MP4: support chapter titles in UTF-16
Close #17137
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cb1498a94aef75c0fea1ca6098ef2813a102781d
---
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
+ 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 );
More information about the vlc-commits
mailing list