Commit 15172e68 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

XML: simplify demuxers

parent 5330c52a
......@@ -989,7 +989,6 @@ static subpicture_region_t *ParseUSFString( decoder_t *p_dec,
static void ParseUSFHeader( decoder_t *p_dec )
{
stream_t *p_sub = NULL;
xml_t *p_xml = NULL;
xml_reader_t *p_xml_reader = NULL;
p_sub = stream_MemoryNew( VLC_OBJECT(p_dec),
......@@ -999,26 +998,20 @@ static void ParseUSFHeader( decoder_t *p_dec )
if( !p_sub )
return;
p_xml = xml_Create( p_dec );
if( p_xml )
p_xml_reader = xml_ReaderCreate( p_dec, p_sub );
if( p_xml_reader )
{
p_xml_reader = xml_ReaderCreate( p_xml, p_sub );
if( p_xml_reader )
/* Look for Root Node */
if( xml_ReaderRead( p_xml_reader ) == 1 )
{
/* Look for Root Node */
if( xml_ReaderRead( p_xml_reader ) == 1 )
{
char *psz_node = xml_ReaderName( p_xml_reader );
if( !strcasecmp( "usfsubtitles", psz_node ) )
ParseUSFHeaderTags( p_dec, p_xml_reader );
char *psz_node = xml_ReaderName( p_xml_reader );
free( psz_node );
}
if( !strcasecmp( "usfsubtitles", psz_node ) )
ParseUSFHeaderTags( p_dec, p_xml_reader );
xml_ReaderDelete( p_xml_reader );
free( psz_node );
}
xml_Delete( p_xml );
xml_ReaderDelete( p_xml_reader );
}
stream_Delete( p_sub );
}
......
......@@ -71,7 +71,6 @@ static int Demux( demux_t *p_demux )
{
int i_ret = -1;
xml_t *p_xml;
xml_reader_t *p_xml_reader = NULL;
char *psz_elname = NULL;
input_item_t *p_input;
......@@ -81,15 +80,11 @@ static int Demux( demux_t *p_demux )
input_item_t *p_current_input = GetCurrentItem(p_demux);
p_xml = xml_Create( p_demux );
if( !p_xml )
goto end;
psz_elname = stream_ReadLine( p_demux->s );
free( psz_elname );
psz_elname = NULL;
p_xml_reader = xml_ReaderCreate( p_xml, p_demux->s );
p_xml_reader = xml_ReaderCreate( p_demux, p_demux->s );
if( !p_xml_reader )
goto end;
......@@ -296,8 +291,6 @@ end:
vlc_gc_decref( p_current_input );
if( p_xml_reader )
xml_ReaderDelete( p_xml_reader );
if( p_xml )
xml_Delete( p_xml );
return i_ret;
}
......
......@@ -67,19 +67,14 @@ void Close_iTML( vlc_object_t *p_this )
*/
int Demux( demux_t *p_demux )
{
xml_t *p_xml;
xml_reader_t *p_xml_reader = NULL;
xml_reader_t *p_xml_reader;
char *psz_name = NULL;
input_item_t *p_current_input = GetCurrentItem(p_demux);
p_demux->p_sys->i_ntracks = 0;
/* create new xml parser from stream */
p_xml = xml_Create( p_demux );
if( !p_xml )
goto end;
p_xml_reader = xml_ReaderCreate( p_xml, p_demux->s );
p_xml_reader = xml_ReaderCreate( p_demux, p_demux->s );
if( !p_xml_reader )
goto end;
......@@ -114,8 +109,6 @@ end:
free( psz_name );
if( p_xml_reader )
xml_ReaderDelete( p_xml_reader );
if( p_xml )
xml_Delete( p_xml );
/* Needed for correct operation of go back */
return 0;
......
......@@ -73,8 +73,7 @@ static int Demux( demux_t *p_demux )
bool b_image = false;
int i_ret;
xml_t *p_xml;
xml_reader_t *p_xml_reader = NULL;
xml_reader_t *p_xml_reader;
char *psz_elname = NULL;
char *psz_item_mrl = NULL;
char *psz_item_size = NULL;
......@@ -94,11 +93,7 @@ static int Demux( demux_t *p_demux )
input_item_t *p_current_input = GetCurrentItem(p_demux);
p_xml = xml_Create( p_demux );
if( !p_xml )
goto error;
p_xml_reader = xml_ReaderCreate( p_xml, p_demux->s );
p_xml_reader = xml_ReaderCreate( p_demux, p_demux->s );
if( !p_xml_reader )
goto error;
......@@ -366,7 +361,6 @@ static int Demux( demux_t *p_demux )
free( psz_art_url );
free( psz_elname );
xml_ReaderDelete( p_xml_reader );
xml_Delete( p_xml );
input_item_node_PostAndDelete( p_subitems );
vlc_gc_decref(p_current_input);
......@@ -389,8 +383,6 @@ error:
if( p_xml_reader )
xml_ReaderDelete( p_xml_reader );
if( p_xml )
xml_Delete( p_xml );
if( p_subitems )
input_item_node_Delete( p_subitems );
......
......@@ -102,8 +102,7 @@ void Close_QTL( vlc_object_t *p_this )
static int Demux( demux_t *p_demux )
{
xml_t *p_xml;
xml_reader_t *p_xml_reader = NULL;
xml_reader_t *p_xml_reader;
char *psz_eltname = NULL;
input_item_t *p_input;
int i_ret = -1;
......@@ -126,11 +125,7 @@ static int Demux( demux_t *p_demux )
input_item_t *p_current_input = GetCurrentItem(p_demux);
p_xml = xml_Create( p_demux );
if( !p_xml )
goto error;
p_xml_reader = xml_ReaderCreate( p_xml, p_demux->s );
p_xml_reader = xml_ReaderCreate( p_demux, p_demux->s );
if( !p_xml_reader )
goto error;
......@@ -326,8 +321,6 @@ static int Demux( demux_t *p_demux )
error:
if( p_xml_reader )
xml_ReaderDelete( p_xml_reader );
if( p_xml )
xml_Delete( p_xml );
vlc_gc_decref(p_current_input);
......
......@@ -79,18 +79,13 @@ void Close_Shoutcast( vlc_object_t *p_this )
static int Demux( demux_t *p_demux )
{
xml_t *p_xml;
xml_reader_t *p_xml_reader = NULL;
char *psz_eltname = NULL;
int i_ret = -1;
input_item_t *p_current_input = GetCurrentItem(p_demux);
input_item_node_t *p_input_node = NULL;
p_xml = xml_Create( p_demux );
if( !p_xml )
goto error;
p_xml_reader = xml_ReaderCreate( p_xml, p_demux->s );
p_xml_reader = xml_ReaderCreate( p_demux, p_demux->s );
if( !p_xml_reader )
goto error;
......@@ -135,8 +130,6 @@ static int Demux( demux_t *p_demux )
error:
if( p_xml_reader )
xml_ReaderDelete( p_xml_reader );
if( p_xml )
xml_Delete( p_xml );
free( psz_eltname );
if( p_input_node ) input_item_node_Delete( p_input_node );
vlc_gc_decref(p_current_input);
......
......@@ -80,7 +80,6 @@ void Close_xspf( vlc_object_t *p_this )
int Demux( demux_t *p_demux )
{
int i_ret = -1;
xml_t *p_xml = NULL;
xml_reader_t *p_xml_reader = NULL;
char *psz_name = NULL;
input_item_t *p_current_input = GetCurrentItem(p_demux);
......@@ -90,11 +89,7 @@ int Demux( demux_t *p_demux )
p_demux->p_sys->psz_base = NULL;
/* create new xml parser from stream */
p_xml = xml_Create( p_demux );
if( !p_xml )
goto end;
p_xml_reader = xml_ReaderCreate( p_xml, p_demux->s );
p_xml_reader = xml_ReaderCreate( p_demux, p_demux->s );
if( !p_xml_reader )
goto end;
......@@ -139,8 +134,6 @@ end:
vlc_gc_decref(p_current_input);
if( p_xml_reader )
xml_ReaderDelete( p_xml_reader );
if( p_xml )
xml_Delete( p_xml );
return i_ret; /* Needed for correct operation of go back */
}
......
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