Skip to content

Commit

Permalink
demux: ttml: probe without creating xmlreader
Browse files Browse the repository at this point in the history
we need to peek only
  • Loading branch information
fcartegnie committed Oct 7, 2015
1 parent 8acf172 commit df5bb18
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions modules/demux/ttml.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <vlc_strings.h>
#include <vlc_memory.h>
#include <vlc_es_out.h>
#include <vlc_fixups.h>

static int Open( vlc_object_t* p_this );
static void Close( demux_t* p_demux );
Expand Down Expand Up @@ -451,12 +452,18 @@ static int Open( vlc_object_t* p_this )
{
demux_t *p_demux = (demux_t*)p_this;
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 ) );
if ( unlikely( p_sys == NULL ) )
return VLC_ENOMEM;

uint8_t *p_peek;
ssize_t i_peek = stream_Peek( p_demux->s, (const uint8_t **) &p_peek, 2048 );
i_peek = stream_Peek( p_demux->s, (const uint8_t **) &p_peek, 2048 );

if( unlikely( i_peek <= 0 ) )
{
Expand Down

0 comments on commit df5bb18

Please sign in to comment.