]> git.sesse.net Git - vlc/blobdiff - modules/demux/playlist/shoutcast.c
xml_ReaderDelete: remove useless parameter
[vlc] / modules / demux / playlist / shoutcast.c
index b6935c83709e0bb1173b4b4fd0dec440641a905a..2534c7c2daf30b246c89c2a7f7ca3b1823ca99b0 100644 (file)
@@ -48,9 +48,9 @@ static int Demux( demux_t *p_demux);
 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
@@ -84,6 +84,7 @@ static int Demux( demux_t *p_demux )
     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 )
@@ -110,28 +111,34 @@ static int Demux( demux_t *p_demux )
         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;
 }
@@ -148,7 +155,7 @@ error:
  * </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;
@@ -189,7 +196,7 @@ static int DemuxGenre( demux_t *p_demux, xml_reader_t *p_xml_reader,
                         else
                         {
                             msg_Warn( p_demux,
-                                      "unexpected attribure %s in element %s",
+                                      "unexpected attribute %s in element %s",
                                       psz_attrname, psz_eltname );
                             free( psz_attrvalue );
                         }
@@ -219,9 +226,9 @@ static int DemuxGenre( demux_t *p_demux, xml_reader_t *p_xml_reader,
                     {
                         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 );
@@ -264,7 +271,7 @@ error:
  * </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; /* */
 
@@ -320,7 +327,7 @@ static int DemuxStation( demux_t *p_demux, xml_reader_t *p_xml_reader,
                         else
                         {
                             msg_Warn( p_demux,
-                                      "unexpected attribure %s in element %s",
+                                      "unexpected attribute %s in element %s",
                                       psz_attrname, psz_eltname );
                             free( psz_attrvalue );
                         }
@@ -395,7 +402,7 @@ static int DemuxStation( demux_t *p_demux, xml_reader_t *p_xml_reader,
                     /* 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 ) \
@@ -412,7 +419,7 @@ static int DemuxStation( demux_t *p_demux, xml_reader_t *p_xml_reader,
                         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 );