[vlc-devel] [vlc-commits] demux: ttml: probe without creating xmlreader
dheitmueller at kernellabs.com
Wed Oct 7 21:40:37 CEST 2015
On Wed, Oct 7, 2015 at 3:32 PM, Jean-Baptiste Kempf <jb at videolan.org> wrote:
> On 07 Oct, Francois Cartegnie wrote :
>> Le 07/10/2015 19:28, Jean-Baptiste Kempf a écrit :
>> > On 07 Oct, Francois Cartegnie wrote :
>> >> + uint8_t *p_peek;
>> >> + ssize_t i_peek = stream_Peek( p_demux->s, (const uint8_t **) &p_peek, 128 );
>> >> + if( i_peek < 32 || memcmp( p_peek, "<?xml", 5 ) ||
>> >> + !strnstr( (const char *) p_peek, "<tt ", i_peek ) )
>> > That matches <tt in the first 128 characters, right?
>> but starting with xml header tag
> Yes, but does anything in the spec says that it must start from byte
> 1(0) with a "<?xml"?
> Can't it have spaces before "<?" ?
> I'm seriously asking, I don't know.
> Thanks for the precision.
The XML tag if present cannot have preceding whitespace. That said,
the xml tag itself is optional according to the XML spec (although it
may be mandatory in the TTML spec). Also, does TTML support the
presence of a BOM? Do you need to support any encodings other than
It's always scary to see people write their own XML parser, because
there are so many different places things can go wrong. I'm trying to
remember where I read it, but I believe "The first rule of writing
your own XML parser: don't!".
Devin J. Heitmueller - Kernel Labs
More information about the vlc-devel