static int Control( demux_t *p_demux, int i_query, va_list args );
static int DemuxGenre( demux_t *p_demux, xml_reader_t *p_xml_reader,
- input_item_t *p_current_input );
+ input_item_node_t *p_input_node );
static int DemuxStation( demux_t *p_demux, xml_reader_t *p_xml_reader,
- input_item_t *p_current_input, bool b_adult );
+ input_item_node_t *p_input_node, bool b_adult );
/*****************************************************************************
* Import_Shoutcast: main import function
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_input_node = input_item_node_Create( p_current_input );
+
if( !strcmp( psz_eltname, "genrelist" ) )
{
/* we're reading a genre list */
- if( DemuxGenre( p_demux, p_xml_reader, p_current_input ) )
+ if( DemuxGenre( p_demux, p_xml_reader, p_input_node ) )
goto error;
}
else
{
/* we're reading a station list */
- if( DemuxStation( p_demux, p_xml_reader, p_current_input,
- var_CreateGetBool( p_demux, "shoutcast-show-adult" ) ) )
+ if( DemuxStation( p_demux, p_xml_reader, p_input_node,
+ var_InheritBool( p_demux, "shoutcast-show-adult" ) ) )
goto error;
}
+ input_item_node_PostAndDelete( p_input_node );
+ p_input_node = NULL;
+
i_ret = 0; /* Needed for correct operation of go back */
error:
if( p_xml_reader )
- xml_ReaderDelete( p_xml, 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);
return i_ret;
}
* </genrelist>
**/
static int DemuxGenre( demux_t *p_demux, xml_reader_t *p_xml_reader,
- input_item_t *p_current_input )
+ input_item_node_t *p_input_node )
{
char *psz_name = NULL; /* genre name */
int i_ret = -1;
else
{
msg_Warn( p_demux,
- "unexpected attribure %s in element %s",
+ "unexpected attribute %s in element %s",
psz_attrname, psz_eltname );
free( psz_attrvalue );
}
{
input_item_t *p_input;
p_input = input_item_New( p_demux, psz_mrl, psz_name );
- input_item_CopyOptions( p_current_input, p_input );
+ input_item_CopyOptions( p_input_node->p_item, p_input );
free( psz_mrl );
- input_item_AddSubItem( p_current_input, p_input );
+ input_item_node_AppendItem( p_input_node, p_input );
vlc_gc_decref( p_input );
}
FREENULL( psz_name );
* </stationlist>
**/
static int DemuxStation( demux_t *p_demux, xml_reader_t *p_xml_reader,
- input_item_t *p_current_input, bool b_adult )
+ input_item_node_t *p_input_node, bool b_adult )
{
char *psz_base = NULL; /* */
else
{
msg_Warn( p_demux,
- "unexpected attribure %s in element %s",
+ "unexpected attribute %s in element %s",
psz_attrname, psz_eltname );
free( psz_attrvalue );
}
/* Create the item */
input_item_t *p_input;
p_input = input_item_New( p_demux, psz_mrl, psz_name );
- input_item_CopyOptions( p_current_input, p_input );
+ input_item_CopyOptions( p_input_node->p_item, p_input );
free( psz_mrl );
#define SADD_INFO( type, field ) \
input_item_SetNowPlaying( p_input, psz_ct );
if( psz_rt )
input_item_SetRating( p_input, psz_rt );
- input_item_AddSubItem( p_current_input, p_input );
+ input_item_node_AppendItem( p_input_node, p_input );
vlc_gc_decref( p_input );
FREENULL( psz_base );
FREENULL( psz_name );