VariablesInit( p_playlist );
/* Initialise data structures */
- vlc_mutex_init( &p_playlist->gc_lock );
p_playlist->i_last_playlist_id = 0;
p_playlist->p_input = NULL;
return;
}
- vlc_mutex_lock( &p_playlist->gc_lock );
p_playlist->b_cant_sleep = false;
- vlc_mutex_unlock( &p_playlist->gc_lock );
}
/* Input Callback */
/**
* Main loop
*
- * Main loop for the playlist
+ * Main loop for the playlist. It should be entered with the
+ * playlist lock (otherwise input event may be lost)
* \param p_playlist the playlist object
* \return nothing
*/
{
playlist_item_t *p_item = NULL;
bool b_playexit = var_GetBool( p_playlist, "play-and-exit" );
- PL_LOCK;
+
+ PL_ASSERT_LOCKED;
if( p_playlist->b_reset_currently_playing &&
mdate() - p_playlist->last_rebuild_date > 30000 ) // 30 ms
p_playlist->gc_date = mdate();
p_playlist->b_cant_sleep = true;
- set_current_status_item( p_playlist, NULL );
-
i_activity= var_GetInteger( p_playlist, "activity" );
var_SetInteger( p_playlist, "activity", i_activity -
DEFAULT_INPUT_ACTIVITY );
}
else if( p_playlist->p_input->i_state != INIT_S )
{
- PL_UNLOCK;
ObjectGarbageCollector( p_playlist, false );
- PL_LOCK;
}
}
else
{
msg_Dbg( p_playlist, "nothing to play" );
p_playlist->status.i_status = PLAYLIST_STOPPED;
- PL_UNLOCK;
if( b_playexit == true )
{
return;
}
playlist_PlayItem( p_playlist, p_item );
+ /* playlist_PlayItem loose input event, we need to recheck */
+ goto check_input;
}
else
{
const bool b_gc_forced = p_playlist->status.i_status != PLAYLIST_STOPPED;
p_playlist->status.i_status = PLAYLIST_STOPPED;
- set_current_status_item( p_playlist, NULL );
/* Collect garbage */
- PL_UNLOCK;
ObjectGarbageCollector( p_playlist, b_gc_forced );
- PL_LOCK;
}
}
- PL_UNLOCK;
}
/**