Commit c149ea80 authored by Rémi Duraffort's avatar Rémi Duraffort

xspf: simplify.

parent 55f81512
......@@ -79,7 +79,7 @@ void Close_xspf( vlc_object_t *p_this )
*/
int Demux( demux_t *p_demux )
{
int i_ret = 1;
int i_ret = -1;
xml_t *p_xml = NULL;
xml_reader_t *p_xml_reader = NULL;
char *psz_name = NULL;
......@@ -92,45 +92,35 @@ int Demux( demux_t *p_demux )
/* create new xml parser from stream */
p_xml = xml_Create( p_demux );
if( !p_xml )
i_ret = -1;
else
{
p_xml_reader = xml_ReaderCreate( p_xml, p_demux->s );
if( !p_xml_reader )
i_ret = -1;
}
goto end;
p_xml_reader = xml_ReaderCreate( p_xml, p_demux->s );
if( !p_xml_reader )
goto end;
/* locating the root node */
if( i_ret == 1 )
do
{
do
if( xml_ReaderRead( p_xml_reader ) != 1 )
{
if( xml_ReaderRead( p_xml_reader ) != 1 )
{
msg_Err( p_demux, "can't read xml stream" );
i_ret = -1;
}
} while( i_ret == VLC_SUCCESS &&
xml_ReaderNodeType( p_xml_reader ) != XML_READER_STARTELEM );
}
msg_Err( p_demux, "can't read xml stream" );
goto end;
}
} while( xml_ReaderNodeType( p_xml_reader ) != XML_READER_STARTELEM );
/* checking root node name */
if( i_ret == 1 )
psz_name = xml_ReaderName( p_xml_reader );
if( !psz_name || strcmp( psz_name, "playlist" ) )
{
psz_name = xml_ReaderName( p_xml_reader );
if( !psz_name || strcmp( psz_name, "playlist" ) )
{
msg_Err( p_demux, "invalid root node name: %s", psz_name );
i_ret = -1;
}
FREE_NAME();
msg_Err( p_demux, "invalid root node name: %s", psz_name );
goto end;
}
free( psz_name );
if( i_ret == 1 )
i_ret = parse_playlist_node( p_demux, p_current_input,
p_xml_reader, "playlist" ) ? 0 : -1;
i_ret = parse_playlist_node( p_demux, p_current_input,
p_xml_reader, "playlist" ) ? 0 : -1;
int i;
for( i = 0 ; i < p_demux->p_sys->i_tracklist_entries ; i++ )
for( int i = 0 ; i < p_demux->p_sys->i_tracklist_entries ; i++ )
{
input_item_t *p_new_input = p_demux->p_sys->pp_tracklist[i];
if( p_new_input )
......@@ -139,6 +129,7 @@ int Demux( demux_t *p_demux )
}
}
end:
HANDLE_PLAY_AND_RELEASE;
if( p_xml_reader )
xml_ReaderDelete( p_xml, p_xml_reader );
......
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