[vlc-devel] commit: Don't wait location-node for creating input, and allow multiple ( Ilkka Ollakka )

git version control git at videolan.org
Wed Dec 17 22:20:23 CET 2008


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Wed Dec 17 23:07:22 2008 +0200| [c44336c87273fc2c55f018a8e2cd5847136a90b6] | committer: Ilkka Ollakka 

Don't wait location-node for creating input, and allow multiple
location nodes on track.

Use last location-node for uri (maybe first would be better instead ?).

check that input_item_NewExt doesn't return NULL

should fix ticket #2353

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c44336c87273fc2c55f018a8e2cd5847136a90b6
---

 modules/demux/playlist/xspf.c |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/modules/demux/playlist/xspf.c b/modules/demux/playlist/xspf.c
index ea51cf9..04f264e 100644
--- a/modules/demux/playlist/xspf.c
+++ b/modules/demux/playlist/xspf.c
@@ -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,13 @@ static bool parse_track_node COMPLEX_INTERFACE
 
                     if( p_demux->p_sys->i_track_id < 0 )
                     {
-                        if( p_new_input )
+                        char *psz_uri = input_item_GetURI( p_new_input );
+                        if( psz_uri && *psz_uri)
                         {
                             input_item_AddSubItem( p_input_item, p_new_input );
-                            vlc_gc_decref( p_new_input );
                         }
+                        vlc_gc_decref( p_new_input );
+                        free( psz_uri );
                         return true;
                     }
 
@@ -543,14 +552,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 +573,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;




More information about the vlc-devel mailing list