/*****************************************************************************
* engine.c : Run the playlist and handle its control
*****************************************************************************
- * Copyright (C) 1999-2004 the VideoLAN team
+ * Copyright (C) 1999-2007 the VideoLAN team
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
static int RandomCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *a )
{
+ (void)psz_cmd; (void)oldval; (void)newval; (void)a;
+
((playlist_t*)p_this)->b_reset_currently_playing = VLC_TRUE;
playlist_Signal( ((playlist_t*)p_this) );
return VLC_SUCCESS;
p_playlist->b_auto_preparse =
var_CreateGetBool( p_playlist, "auto-preparse") ;
- p_playlist->p_root_category = playlist_NodeCreate( p_playlist, NULL, NULL);
- p_playlist->p_root_onelevel = playlist_NodeCreate( p_playlist, NULL, NULL);
+ p_playlist->p_root_category = playlist_NodeCreate( p_playlist, NULL, NULL,
+ 0 );
+ p_playlist->p_root_onelevel = playlist_NodeCreate( p_playlist, NULL, NULL,
+ 0 );
if( !p_playlist->p_root_category || !p_playlist->p_root_onelevel )
return NULL;
/* Create playlist and media library */
p_playlist->p_local_category = playlist_NodeCreate( p_playlist,
- _( "Playlist" ),p_playlist->p_root_category );
+ _( "Playlist" ),p_playlist->p_root_category, 0 );
p_playlist->p_local_onelevel = playlist_NodeCreate( p_playlist,
- _( "Playlist" ), p_playlist->p_root_onelevel );
+ _( "Playlist" ), p_playlist->p_root_onelevel, 0 );
p_playlist->p_local_category->i_flags |= PLAYLIST_RO_FLAG;
p_playlist->p_local_onelevel->i_flags |= PLAYLIST_RO_FLAG;
if( config_GetInt( p_playlist, "media-library") )
{
p_playlist->p_ml_category = playlist_NodeCreate( p_playlist,
- _( "Media Library" ), p_playlist->p_root_category );
+ _( "Media Library" ), p_playlist->p_root_category, 0 );
p_playlist->p_ml_onelevel = playlist_NodeCreate( p_playlist,
- _( "Media Library" ), p_playlist->p_root_onelevel );
+ _( "Media Library" ), p_playlist->p_root_onelevel, 0 );
if(!p_playlist->p_ml_category || !p_playlist->p_ml_onelevel)
return NULL;
p_playlist->i_sort = SORT_ID;
p_playlist->i_order = ORDER_NORMAL;
- vlc_object_attach( p_playlist, p_parent );
b_save = p_playlist->b_auto_preparse;
p_playlist->b_auto_preparse = VLC_FALSE;
playlist_MLLoad( p_playlist );
void playlist_Destroy( playlist_t *p_playlist )
{
- while( p_playlist->i_sds )
- {
- playlist_ServicesDiscoveryRemove( p_playlist,
- p_playlist->pp_sds[0]->psz_module );
- }
-
- playlist_MLDump( p_playlist );
-
- vlc_thread_join( p_playlist->p_preparse );
- vlc_thread_join( p_playlist->p_fetcher );
- vlc_thread_join( p_playlist );
-
- vlc_object_detach( p_playlist->p_preparse );
- vlc_object_detach( p_playlist->p_fetcher );
-
var_Destroy( p_playlist, "intf-change" );
var_Destroy( p_playlist, "item-change" );
var_Destroy( p_playlist, "playlist-current" );
var_Destroy( p_playlist, "loop" );
var_Destroy( p_playlist, "activity" );
- PL_LOCK;
- /* Go through all items, and simply free everything without caring
- * about the tree structure. Do not decref, it will be done by doing
- * the same thing on the input items array */
- FOREACH_ARRAY( playlist_item_t *p_del, p_playlist->all_items )
- free( p_del->pp_children );
- free( p_del );
- FOREACH_END();
- ARRAY_RESET( p_playlist->all_items );
-
- FOREACH_ARRAY( input_item_t *p_del, p_playlist->input_items )
- input_ItemClean( p_del );
- free( p_del );
- FOREACH_END();
- ARRAY_RESET( p_playlist->input_items );
-
- ARRAY_RESET( p_playlist->items );
- ARRAY_RESET( p_playlist->current );
-
- PL_UNLOCK;
-
- vlc_mutex_destroy( &p_playlist->p_stats->lock );
- if( p_playlist->p_stats )
- free( p_playlist->p_stats );
-
vlc_mutex_destroy( &p_playlist->gc_lock );
- vlc_object_destroy( p_playlist->p_preparse );
- vlc_object_destroy( p_playlist->p_fetcher );
vlc_object_detach( p_playlist );
vlc_object_destroy( p_playlist );
}
vlc_object_release( p_obj );
break;
}
+ msg_Dbg( p_playlist, "garbage collector destroying 1 sout" );
+ vlc_object_detach( p_obj );
vlc_object_release( p_obj );
sout_DeleteInstance( (sout_instance_t*)p_obj );
}
/* Destroy input */
input_DestroyThread( p_input );
- /* Unlink current input
- * (_after_ input_DestroyThread for vout garbage collector) */
- vlc_object_detach( p_input );
-
- /* Destroy object */
- vlc_object_destroy( p_input );
-
PL_LOCK;
p_playlist->gc_date = mdate();
else if( p_playlist->p_input->b_die )
{
PL_DEBUG( "dying input" );
+ PL_UNLOCK;
msleep( 25000 ); // 25 ms
+ PL_LOCK;
goto check_input;
}
/* This input has finished, ask it to die ! */
if( b_playexit == VLC_TRUE )
{
msg_Info( p_playlist, "end of playlist, exiting" );
- p_playlist->p_libvlc->b_die = VLC_TRUE;
+ vlc_object_kill( p_playlist->p_libvlc );
}
p_playlist->status.i_status = PLAYLIST_STOPPED;
PL_UNLOCK
/* Destroy input */
input_DestroyThread( p_input );
- /* Unlink current input (_after_ input_DestroyThread for vout
- * garbage collector)*/
- vlc_object_detach( p_input );
-
- /* Destroy object */
- vlc_object_destroy( p_input );
continue;
}
else if( p_playlist->p_input->b_die )
while( ( p_obj = vlc_object_find( p_playlist,
VLC_OBJECT_SOUT, FIND_CHILD ) ) )
{
+ vlc_object_detach( p_obj );
vlc_object_release( p_obj );
sout_DeleteInstance( (sout_instance_t*)p_obj );
}
vlc_object_release( p_obj );
vout_Destroy( (vout_thread_t *)p_obj );
}
+
+ while( p_playlist->i_sds )
+ {
+ playlist_ServicesDiscoveryRemove( p_playlist,
+ p_playlist->pp_sds[0]->psz_module );
+ }
+
+ playlist_MLDump( p_playlist );
+
+ PL_LOCK;
+ /* Go through all items, and simply free everything without caring
+ * about the tree structure. Do not decref, it will be done by doing
+ * the same thing on the input items array */
+ FOREACH_ARRAY( playlist_item_t *p_del, p_playlist->all_items )
+ free( p_del->pp_children );
+ free( p_del );
+ FOREACH_END();
+ ARRAY_RESET( p_playlist->all_items );
+
+ FOREACH_ARRAY( input_item_t *p_del, p_playlist->input_items )
+ input_ItemClean( p_del );
+ free( p_del );
+ FOREACH_END();
+ ARRAY_RESET( p_playlist->input_items );
+
+ ARRAY_RESET( p_playlist->items );
+ ARRAY_RESET( p_playlist->current );
+
+ PL_UNLOCK;
}
/** Main loop for preparser queue */