]> git.sesse.net Git - vlc/blobdiff - modules/demux/playlist/xspf.c
Renamed input_item_AddOpt to input_item_AddOption.
[vlc] / modules / demux / playlist / xspf.c
index ea51cf93d037645894608399ec8267ede094d56f..852db24a7850b1594b0a7e549fb0843ae9506007 100644 (file)
@@ -394,7 +394,6 @@ static bool parse_tracklist_node COMPLEX_INTERFACE
  */
 static bool parse_track_node COMPLEX_INTERFACE
 {
-    input_item_t *p_new_input = NULL;
     int i_node;
     char *psz_name = NULL;
     char *psz_value = NULL;
@@ -417,6 +416,14 @@ static bool parse_track_node COMPLEX_INTERFACE
           {NULL,           UNKNOWN_CONTENT, {NULL} }
         };
 
+    input_item_t *p_new_input = input_item_NewExt( p_demux, NULL, NULL, 0, NULL, -1 );
+
+    if( !p_new_input )
+    {
+        /* malloc has failed for input_item_NewExt, so bailout early */
+        return false;
+    }
+
     /* reset i_track_id */
     p_demux->p_sys->i_track_id = -1;
 
@@ -503,11 +510,8 @@ static bool parse_track_node COMPLEX_INTERFACE
 
                     if( p_demux->p_sys->i_track_id < 0 )
                     {
-                        if( p_new_input )
-                        {
-                            input_item_AddSubItem( p_input_item, p_new_input );
-                            vlc_gc_decref( p_new_input );
-                        }
+                        input_item_AddSubItem( p_input_item, p_new_input );
+                        vlc_gc_decref( p_new_input );
                         return true;
                     }
 
@@ -543,14 +547,6 @@ static bool parse_track_node COMPLEX_INTERFACE
                 if( !strcmp( p_handler->name, "location" ) )
                 {
                     char *psz_uri = NULL;
-                    /* there MUST NOT be an item */
-                    if( p_new_input )
-                    {
-                        msg_Err( p_demux, "item <%s> already created",
-                                 psz_name );
-                        FREE_ATT();
-                        return false;
-                    }
                     psz_uri = decode_URI_duplicate( psz_value );
 
                     if( !psz_uri )
@@ -572,8 +568,7 @@ static bool parse_track_node COMPLEX_INTERFACE
                         free( psz_uri );
                         psz_uri = psz_tmp;
                     }
-                    p_new_input = input_item_NewExt( p_demux, psz_uri,
-                                                        NULL, 0, NULL, -1 );
+                    input_item_SetURI( p_new_input, psz_uri );
                     free( psz_uri );
                     input_item_CopyOptions( p_input_item, p_new_input );
                     psz_uri = NULL;
@@ -676,7 +671,7 @@ static bool set_option SIMPLE_INTERFACE
     /* re-convert xml special characters inside psz_value */
     resolve_xml_special_chars( psz_value );
 
-    input_item_AddOpt( p_input, psz_value, 0 );
+    input_item_AddOption( p_input, psz_value, 0 );
 
     return true;
 }