From 0263f8f47b1f3838850d8d4262409469535f35de Mon Sep 17 00:00:00 2001 From: Antoine Cellerier Date: Sun, 30 Apr 2006 16:37:30 +0000 Subject: [PATCH] Forward port podcast fixes [15462] and [15465]. --- modules/demux/playlist/podcast.c | 4 +-- modules/services_discovery/podcast.c | 40 +++++++++++++++++----------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/modules/demux/playlist/podcast.c b/modules/demux/playlist/podcast.c index 50df38a08d..8122d967de 100644 --- a/modules/demux/playlist/podcast.c +++ b/modules/demux/playlist/podcast.c @@ -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; diff --git a/modules/services_discovery/podcast.c b/modules/services_discovery/podcast.c index 8de24f55d1..8e18b3af97 100644 --- a/modules/services_discovery/podcast.c +++ b/modules/services_discovery/podcast.c @@ -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 ); } -- 2.39.2