They do not create threads anymore (unless they have work to do).
LibVLC needs this because we are sloppy programmers^W^W^W^Wit still
depends on the playlist for item meta infos (it should probably
instantiate the fetcher and preparser directly).
Also, do not create the preparser if there is no fetcher.
}
#endif
- /* Free playlist now */
- msg_Dbg( p_libvlc, "removing playlist" );
- vlc_object_release( p_playlist );
+ /* Free playlist now, all threads are gone */
+ playlist_Destroy( p_playlist );
stats_TimersDumpAll( p_libvlc );
stats_TimersCleanAll( p_libvlc );
pl_priv(p_playlist)->b_auto_preparse =
var_InheritBool( p_parent, "auto-preparse" );
+ /* Fetcher */
+ p->p_fetcher = playlist_fetcher_New( p_playlist );
+ if( unlikely(p->p_fetcher == NULL) )
+ {
+ msg_Err( p_playlist, "cannot create fetcher" );
+ p->p_preparser = NULL;
+ }
+ else
+ { /* Preparse */
+ p->p_preparser = playlist_preparser_New( p_playlist, p->p_fetcher );
+ if( unlikely(p->p_preparser == NULL) )
+ msg_Err( p_playlist, "cannot create preparser" );
+ }
+
/* Create the root node */
PL_LOCK;
p_playlist->p_root = playlist_NodeCreate( p_playlist, NULL, NULL,
return p_playlist;
}
+void playlist_Destroy( playlist_t *p_playlist )
+{
+ playlist_private_t *p_sys = pl_priv(p_playlist);
+
+ msg_Dbg( p_playlist, "destroying" );
+ if( p_sys->p_preparser )
+ playlist_preparser_Delete( p_sys->p_preparser );
+ if( p_sys->p_fetcher )
+ playlist_fetcher_Delete( p_sys->p_fetcher );
+ vlc_object_release( p_playlist );
+}
+
/**
* Destroy playlist
*
assert( !p_sys->p_input );
assert( !p_sys->p_input_resource );
- assert( !p_sys->p_preparser );
- assert( !p_sys->p_fetcher );
vlc_cond_destroy( &p_sys->signal );
vlc_mutex_destroy( &p_sys->lock );
/* Creation/Deletion */
playlist_t *playlist_Create( vlc_object_t * );
+void playlist_Destroy( playlist_t * );
/* */
void playlist_Activate( playlist_t * );
/* */
playlist_private_t *p_sys = pl_priv(p_playlist);
- /* Fetcher */
- p_sys->p_fetcher = playlist_fetcher_New( p_playlist );
- if( !p_sys->p_fetcher )
- msg_Err( p_playlist, "cannot create playlist fetcher" );
-
- /* Preparse */
- p_sys->p_preparser = playlist_preparser_New( p_playlist, p_sys->p_fetcher );
- if( !p_sys->p_preparser )
- msg_Err( p_playlist, "cannot create playlist preparser" );
-
/* Start the playlist thread */
if( vlc_clone( &p_sys->thread, Thread, p_playlist,
VLC_THREAD_PRIORITY_LOW ) )
vlc_join( p_sys->thread, NULL );
assert( !p_sys->p_input );
- PL_LOCK;
- playlist_preparser_t *p_preparser = p_sys->p_preparser;
- playlist_fetcher_t *p_fetcher = p_sys->p_fetcher;
-
- p_sys->p_preparser = NULL;
- p_sys->p_fetcher = NULL;
- PL_UNLOCK;
-
- if( p_preparser )
- playlist_preparser_Delete( p_preparser );
- if( p_fetcher )
- playlist_fetcher_Delete( p_fetcher );
-
/* release input resources */
if( p_sys->p_input_resource )
input_resource_Delete( p_sys->p_input_resource );