p_item = (playlist_item_t *)va_arg( args, playlist_item_t * );
if ( p_node == NULL )
{
- p_node = p_playlist->status.p_node;
+ p_node = get_current_status_node( p_playlist );
assert( p_node );
}
p_playlist->request.i_status = PLAYLIST_RUNNING;
default:
msg_Err( p_playlist, "unknown playlist query" );
return VLC_EBADVAR;
- break;
}
vlc_object_signal_unlocked( p_playlist );
int playlist_PreparseEnqueue( playlist_t *p_playlist,
input_item_t *p_item )
{
- vlc_object_lock( p_playlist->p_preparse );
- if( !vlc_object_alive( p_playlist->p_preparse ) )
- {
- vlc_object_unlock( p_playlist->p_preparse );
- return VLC_EGENERIC;
- }
+ playlist_preparse_t *p_preparse = &pl_priv(p_playlist)->preparse;
+
vlc_gc_incref( p_item );
- INSERT_ELEM( p_playlist->p_preparse->pp_waiting,
- p_playlist->p_preparse->i_waiting,
- p_playlist->p_preparse->i_waiting,
- p_item );
- vlc_object_signal_unlocked( p_playlist->p_preparse );
- vlc_object_unlock( p_playlist->p_preparse );
+
+ vlc_mutex_lock( &p_preparse->lock );
+ INSERT_ELEM( p_preparse->pp_waiting, p_preparse->i_waiting,
+ p_preparse->i_waiting, p_item );
+ vlc_cond_signal( &p_preparse->wait );
+ vlc_mutex_unlock( &p_preparse->lock );
return VLC_SUCCESS;
}
-/** Enqueue a playlist item or a node for peparsing.
- * This function should be entered without playlist and preparser locks */
+/** Enqueue a playlist item or a node for preparsing.
+ * This function shall be called without playlist and preparser locks */
int playlist_PreparseEnqueueItem( playlist_t *p_playlist,
playlist_item_t *p_item )
{
+ playlist_preparse_t *p_preparse = &pl_priv(p_playlist)->preparse;
+
vlc_object_lock( p_playlist );
- vlc_object_lock( p_playlist->p_preparse );
- if( !vlc_object_alive( p_playlist->p_preparse ) )
- {
- vlc_object_unlock( p_playlist->p_preparse );
- vlc_object_unlock( p_playlist );
- return VLC_EGENERIC;
- }
+ vlc_mutex_lock( &p_preparse->lock );
PreparseEnqueueItemSub( p_playlist, p_item );
- vlc_object_unlock( p_playlist->p_preparse );
+ vlc_mutex_unlock( &p_preparse->lock );
vlc_object_unlock( p_playlist );
return VLC_SUCCESS;
}
int playlist_AskForArtEnqueue( playlist_t *p_playlist,
input_item_t *p_item )
{
- vlc_object_lock( p_playlist->p_fetcher );
- if( !vlc_object_alive( p_playlist->p_fetcher ) )
+ playlist_fetcher_t *p_fetcher = pl_priv(p_playlist)->p_fetcher;
+ vlc_object_lock( p_fetcher );
+ if( !vlc_object_alive( p_fetcher ) )
{
- vlc_object_unlock( p_playlist->p_fetcher );
+ vlc_object_unlock( p_fetcher );
return VLC_EGENERIC;
}
vlc_gc_incref( p_item );
- INSERT_ELEM( p_playlist->p_fetcher->pp_waiting,
- p_playlist->p_fetcher->i_waiting,
- p_playlist->p_fetcher->i_waiting, p_item );
- vlc_object_signal_unlocked( p_playlist->p_fetcher );
- vlc_object_unlock( p_playlist->p_fetcher );
+ INSERT_ELEM( p_fetcher->pp_waiting, p_fetcher->i_waiting,
+ p_fetcher->i_waiting, p_item );
+ vlc_object_signal_unlocked( p_fetcher );
+ vlc_object_unlock( p_fetcher );
return VLC_SUCCESS;
}
static void PreparseEnqueueItemSub( playlist_t *p_playlist,
playlist_item_t *p_item )
{
- int i;
+ playlist_preparse_t *p_preparse = &pl_priv(p_playlist)->preparse;
+
if( p_item->i_children == -1 )
{
+ /* Leaf item */
vlc_gc_incref( p_item->p_input );
- INSERT_ELEM( p_playlist->p_preparse->pp_waiting,
- p_playlist->p_preparse->i_waiting,
- p_playlist->p_preparse->i_waiting,
+ INSERT_ELEM( p_preparse->pp_waiting,
+ p_preparse->i_waiting,
+ p_preparse->i_waiting,
p_item->p_input );
}
else
{
- for( i = 0; i < p_item->i_children; i++)
+ /* Non-leaf item: recurse */
+ for( int i = 0; i < p_item->i_children; i++)
{
PreparseEnqueueItemSub( p_playlist, p_item->pp_children[i] );
}
int playlist_PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
{
input_item_t *p_input = p_item->p_input;
- sout_instance_t **pp_sout = &libvlc_priv(p_playlist->p_libvlc)->p_sout;
+ sout_instance_t **pp_sout = &pl_priv(p_playlist)->p_sout;
int i_activity = var_GetInteger( p_playlist, "activity" ) ;
msg_Dbg( p_playlist, "creating new input thread" );
}
free( psz_uri );
- if( p_playlist->p_fetcher &&
- p_playlist->p_fetcher->i_art_policy == ALBUM_ART_WHEN_PLAYED )
+ if( pl_priv(p_playlist)->p_fetcher &&
+ pl_priv(p_playlist)->p_fetcher->i_art_policy == ALBUM_ART_WHEN_PLAYED )
{
bool b_has_art;