return;
}
- b_play = b_play && p_item_in_category == p_playlist->status.p_item;
+ b_play = b_play &&
+ p_item_in_category == get_current_status_item( p_playlist );
/* If this item is already a node don't transform it */
if( p_item_in_category->i_children == -1 )
/*****************************************************************************
* Playlist item creation
*****************************************************************************/
-playlist_item_t * playlist_ItemNewWithType( vlc_object_t *p_obj,
- const char *psz_uri,
- const char *psz_name,
- int i_options,
- const char *const *ppsz_options,
- int i_duration, int i_type )
-{
- input_item_t *p_input;
- if( psz_uri == NULL ) return NULL;
- p_input = input_ItemNewWithType( p_obj, psz_uri,
- psz_name, i_options, ppsz_options,
- i_duration, i_type );
- return playlist_ItemNewFromInput( p_obj, p_input );
-}
-
-playlist_item_t *__playlist_ItemNewFromInput( vlc_object_t *p_obj,
+playlist_item_t *playlist_ItemNewFromInput( playlist_t *p_playlist,
input_item_t *p_input )
{
DECMALLOC_NULL( p_item, playlist_item_t );
- playlist_t *p_playlist = pl_Yield( p_obj );
p_item->p_input = p_input;
vlc_gc_incref( p_item->p_input );
install_input_item_observer( p_item );
- pl_Release( p_item->p_playlist );
-
return p_item;
}
+playlist_item_t * playlist_ItemNewWithType( playlist_t *p_playlist,
+ const char *psz_uri,
+ const char *psz_name,
+ int i_options,
+ const char *const *ppsz_options,
+ int i_duration, int i_type )
+{
+ input_item_t *p_input;
+ if( psz_uri == NULL ) return NULL;
+ p_input = input_ItemNewWithType( VLC_OBJECT(p_playlist), psz_uri,
+ psz_name, i_options, ppsz_options,
+ i_duration, i_type );
+ return playlist_ItemNewFromInput( p_playlist, p_input );
+}
+
/***************************************************************************
* Playlist item destruction
***************************************************************************/
playlist_item_t *p_item_cat, *p_item_one, *p_up;
int i_top;
assert( p_input );
- if( p_playlist->b_die ) return VLC_EGENERIC;
+
if( !b_locked ) PL_LOCK;
+ if( !vlc_object_alive( p_playlist ) )
+ {
+ if( !b_locked ) PL_UNLOCK;
+ return VLC_EGENERIC;
+ }
+
/* Add to category */
p_item_cat = playlist_ItemNewFromInput( p_playlist, p_input );
if( p_item_cat == NULL ) return VLC_ENOMEM;
p_playlist->p_root_onelevel, false );
}
p_playlist->b_reset_currently_playing = true;
- vlc_cond_signal( &p_playlist->object_wait );
+ vlc_object_signal_unlocked( p_playlist );
var_SetInteger( p_playlist, "item-change", p_item_in_category->
p_input->i_id );
if( !b_locked ) PL_UNLOCK;
else
i_ret = TreeMove( p_playlist, p_item, p_node, i_newpos );
p_playlist->b_reset_currently_playing = true;
- vlc_cond_signal( &p_playlist->object_wait );
+ vlc_object_signal_maybe( VLC_OBJECT(p_playlist) );
return i_ret;
}
val.p_address = p_add;
p_playlist->b_reset_currently_playing = true;
if( b_signal )
- vlc_cond_signal( &p_playlist->object_wait );
+ vlc_object_signal_maybe( VLC_OBJECT(p_playlist) );
var_Set( p_playlist, "item-append", val );
free( p_add );
}
if( p_playlist->p_input )
input_StopThread( p_playlist->p_input );
p_playlist->request.i_status = PLAYLIST_RUNNING;
- vlc_cond_signal( &p_playlist->object_wait );
+ vlc_object_signal_maybe( VLC_OBJECT(p_playlist) );
}
/* Preparse if PREPARSE or SPREPARSE & not enough meta */
char *psz_artist = input_item_GetArtist( p_item_cat->p_input );
ARRAY_REMOVE( p_playlist->items, i );
/* Check if it is the current item */
- if( p_playlist->status.p_item == p_item )
+ if( get_current_status_item( p_playlist ) == p_item )
{
/* Hack we don't call playlist_Control for lock reasons */
if( b_stop )
p_playlist->request.b_request = true;
p_playlist->request.p_item = NULL;
msg_Info( p_playlist, "stopping playback" );
- vlc_cond_signal( &p_playlist->object_wait );
+ vlc_object_signal_maybe( VLC_OBJECT(p_playlist) );
}
b_delay_deletion = true;
}