[vlc-commits] demux: ttml: probe document header less xml

Francois Cartegnie git at videolan.org
Fri May 26 11:49:37 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri May 26 11:00:06 2017 +0200| [ee1a36541b1826962339dbc7d40adf80fb035ba4] | committer: Francois Cartegnie

demux: ttml: probe document header less xml

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ee1a36541b1826962339dbc7d40adf80fb035ba4
---

 modules/demux/ttml.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index 6c81292bc4..0569e010a3 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -408,20 +408,26 @@ int OpenDemux( vlc_object_t* p_this )
     switch( GetQWBE(p_peek) )
     {
         /* See RFC 3023 Part 4 */
-        case 0xFFFE3C003F007800UL: /* UTF16 BOM<?xml */
-        case 0xFEFF003C003F0078UL: /* UTF16 BOM<?xml */
+        case 0xFFFE3C003F007800UL: /* UTF16 BOM<? */
+        case 0xFFFE3C003F007400UL: /* UTF16 BOM<t */
+        case 0xFEFF003C003F0078UL: /* UTF16 BOM<? */
+        case 0xFEFF003C003F0074UL: /* UTF16 BOM<t */
             psz_alloc = FromCharset( "UTF-16", p_peek, i_peek );
             break;
-        case 0x3C003F0078006D00UL: /* UTF16-LE <?xml */
+        case 0x3C003F0078006D00UL: /* UTF16-LE <?xm */
+        case 0x3C003F0074007400UL: /* UTF16-LE <tt */
             psz_alloc = FromCharset( "UTF-16LE", p_peek, i_peek );
             break;
-        case 0x003C003F0078006DUL: /* UTF16-BE <?xml */
+        case 0x003C003F0078006DUL: /* UTF16-BE <?xm */
+        case 0x003C003F00740074UL: /* UTF16-BE <tt */
             psz_alloc = FromCharset( "UTF-16BE", p_peek, i_peek );
             break;
-        case 0x3C3F786D6C207665UL: /* UTF8 <?xml */
+        case 0xEFBBBF3C3F786D20UL: /* UTF8 BOM<?xml */
+        case 0xEFBBBF3C74742078UL: /* UTF8 BOM<tt x*/
             break;
         default:
-            return VLC_EGENERIC;
+            if(GetDWBE(p_peek) != 0x3C747420U) /* tt node without xml document marker */
+                return VLC_EGENERIC;
     }
 
     if( psz_alloc )



More information about the vlc-commits mailing list