Commit df5bb189 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: ttml: probe without creating xmlreader

we need to peek only
parent 8acf172f
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <vlc_strings.h> #include <vlc_strings.h>
#include <vlc_memory.h> #include <vlc_memory.h>
#include <vlc_es_out.h> #include <vlc_es_out.h>
#include <vlc_fixups.h>
static int Open( vlc_object_t* p_this ); static int Open( vlc_object_t* p_this );
static void Close( demux_t* p_demux ); static void Close( demux_t* p_demux );
...@@ -451,12 +452,18 @@ static int Open( vlc_object_t* p_this ) ...@@ -451,12 +452,18 @@ static int Open( vlc_object_t* p_this )
{ {
demux_t *p_demux = (demux_t*)p_this; demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys; demux_sys_t *p_sys;
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 ) )
return VLC_EGENERIC;
p_demux->p_sys = p_sys = calloc( 1, sizeof( *p_sys ) ); p_demux->p_sys = p_sys = calloc( 1, sizeof( *p_sys ) );
if ( unlikely( p_sys == NULL ) ) if ( unlikely( p_sys == NULL ) )
return VLC_ENOMEM; return VLC_ENOMEM;
uint8_t *p_peek; i_peek = stream_Peek( p_demux->s, (const uint8_t **) &p_peek, 2048 );
ssize_t i_peek = stream_Peek( p_demux->s, (const uint8_t **) &p_peek, 2048 );
if( unlikely( i_peek <= 0 ) ) if( unlikely( i_peek <= 0 ) )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment