]> git.sesse.net Git - vlc/commitdiff
Forward port podcast fixes [15462] and [15465].
authorAntoine Cellerier <dionoea@videolan.org>
Sun, 30 Apr 2006 16:37:30 +0000 (16:37 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Sun, 30 Apr 2006 16:37:30 +0000 (16:37 +0000)
modules/demux/playlist/podcast.c
modules/services_discovery/podcast.c

index 50df38a08d78951a7495f616c505679f57acb27e..8122d967ded59f210d6e1766e9d06ccedd3270bd 100644 (file)
@@ -147,9 +147,9 @@ static int Demux( demux_t *p_demux )
     p_xml = p_sys->p_xml = xml_Create( p_demux );
     if( !p_xml ) return -1;
 
-    psz_elname = stream_ReadLine( p_demux->s );
+/*    psz_elname = stream_ReadLine( p_demux->s );
     if( psz_elname ) free( psz_elname );
-    psz_elname = 0;
+    psz_elname = 0;*/
 
     p_xml_reader = xml_ReaderCreate( p_xml, p_demux->s );
     if( !p_xml_reader ) return -1;
index 8de24f55d168d9d35b5f87306351f1ca61cc3c82..8e18b3af97e26da0d3bbdb6e1c2d9354396d510d 100644 (file)
@@ -81,7 +81,7 @@ struct services_discovery_sys_t
 {
     /* playlist node */
     playlist_item_t *p_node;
-    input_thread_t *p_input;
+    input_thread_t **pp_input;
 
     char **ppsz_urls;
     int i_urls;
@@ -153,6 +153,7 @@ static int Open( vlc_object_t *p_this )
     p_view = playlist_ViewFind( p_playlist, VIEW_CATEGORY );
     p_sys->p_node = playlist_NodeCreate( p_playlist, VIEW_CATEGORY,
                                          _("Podcast"), p_view->p_root );
+    p_sys->pp_input = malloc( p_sys->i_urls * sizeof( input_thread_t * ) );
     for( i = 0; i < p_sys->i_urls; i++ )
     {
         asprintf( &psz_buf, "%s", p_sys->ppsz_urls[i] );
@@ -168,10 +169,9 @@ static int Open( vlc_object_t *p_this )
         /* We need to declare the parents of the node as the same of the
          * parent's ones */
         playlist_CopyParents( p_sys->p_node, p_item );
-        p_sys->p_input = input_CreateThread( p_playlist, &p_item->input );
+        p_sys->pp_input[i] = input_CreateThread( p_playlist, &p_item->input );
     }
 
-
     p_sys->p_node->i_flags |= PLAYLIST_RO_FLAG;
     val.b_bool = VLC_TRUE;
     var_Set( p_playlist, "intf-change", val );
@@ -191,13 +191,16 @@ static void Close( vlc_object_t *p_this )
     playlist_t *p_playlist =  (playlist_t *) vlc_object_find( p_sd,
                                  VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
     int i;
-    if( p_sd->p_sys->p_input )
+    for( i = 0; i < p_sys->i_urls; i++ )
     {
-        input_StopThread( p_sd->p_sys->p_input );
-        input_DestroyThread( p_sd->p_sys->p_input );
-        vlc_object_detach( p_sd->p_sys->p_input );
-        vlc_object_destroy( p_sd->p_sys->p_input );
-        p_sd->p_sys->p_input = NULL;
+        if( p_sd->p_sys->pp_input[i] )
+        {
+            input_StopThread( p_sd->p_sys->pp_input[i] );
+            input_DestroyThread( p_sd->p_sys->pp_input[i] );
+            vlc_object_detach( p_sd->p_sys->pp_input[i] );
+            vlc_object_destroy( p_sd->p_sys->pp_input[i] );
+            p_sd->p_sys->pp_input[i] = NULL;
+        }
     }
     if( p_playlist )
     {
@@ -216,14 +219,19 @@ static void Run( services_discovery_t *p_sd )
 {
     while( !p_sd->b_die )
     {
-        if( p_sd->p_sys->p_input &&
-            ( p_sd->p_sys->p_input->b_eof || p_sd->p_sys->p_input->b_error ) )
+        int i;
+        for( i = 0; i < p_sd->p_sys->i_urls; i++ )
         {
-            input_StopThread( p_sd->p_sys->p_input );
-            input_DestroyThread( p_sd->p_sys->p_input );
-            vlc_object_detach( p_sd->p_sys->p_input );
-            vlc_object_destroy( p_sd->p_sys->p_input );
-            p_sd->p_sys->p_input = NULL;
+            if( p_sd->p_sys->pp_input[i] &&
+                ( p_sd->p_sys->pp_input[i]->b_eof
+                  || p_sd->p_sys->pp_input[i]->b_error ) )
+            {
+                input_StopThread( p_sd->p_sys->pp_input[i] );
+                input_DestroyThread( p_sd->p_sys->pp_input[i] );
+                vlc_object_detach( p_sd->p_sys->pp_input[i] );
+                vlc_object_destroy( p_sd->p_sys->pp_input[i] );
+                p_sd->p_sys->pp_input[i] = NULL;
+            }
         }
         msleep( 100000 );
     }