]> git.sesse.net Git - vlc/blobdiff - modules/demux/playlist/m3u.c
various modules: adjust to new playlist design
[vlc] / modules / demux / playlist / m3u.c
index cef756e0ed62d668d71b1adbb3b9330228f5a68b..e405b14a6305ca263ae169115ce650d9713cf521 100644 (file)
@@ -145,6 +145,7 @@ static int Demux( demux_t *p_demux )
     input_item_t *p_input;
 
     input_item_t *p_current_input = GetCurrentItem(p_demux);
+    input_item_node_t *p_subitems = input_item_node_Create( p_current_input );
 
     psz_line = stream_ReadLine( p_demux->s );
     while( psz_line )
@@ -170,6 +171,8 @@ static int Demux( demux_t *p_demux )
             {
                 /* Extended info */
                 psz_parse += sizeof("EXTINF:") - 1;
+                free(psz_name);
+                free(psz_artist);
                 parseEXTINF( psz_parse, &psz_artist, &psz_name, &i_parsed_duration );
                 if( i_parsed_duration >= 0 )
                     i_duration = i_parsed_duration * INT64_C(1000000);
@@ -208,7 +211,11 @@ static int Demux( demux_t *p_demux )
             psz_mrl = ProcessMRL( psz_parse, p_demux->p_sys->psz_prefix );
 
             b_cleanup = true;
-            if( !psz_mrl ) goto error;
+            if( !psz_mrl )
+            {
+                LocaleFree( psz_parse );
+                goto error;
+            }
 
             p_input = input_item_NewExt( p_demux, psz_mrl, psz_name,
                                         i_options, ppsz_options, 0, i_duration );
@@ -221,6 +228,7 @@ static int Demux( demux_t *p_demux )
             if( psz_name ) input_item_SetTitle( p_input, psz_name );
 
             input_item_AddSubItem( p_current_input, p_input );
+            input_item_node_AppendItem( p_subitems, p_input );
             vlc_gc_decref( p_input );
         }
 
@@ -247,6 +255,8 @@ static int Demux( demux_t *p_demux )
             b_cleanup = false;
         }
     }
+    input_item_AddSubItemTree( p_subitems );
+    input_item_node_Delete( p_subitems );
     vlc_gc_decref(p_current_input);
     var_Destroy( p_demux, "m3u-extvlcopt" );
     return 0; /* Needed for correct operation of go back */