input_item_changed, p_item );
vlc_event_attach( p_em, vlc_InputItemInfoChanged,
input_item_changed, p_item );
+ vlc_event_attach( p_em, vlc_InputItemErrorWhenReadingChanged,
+ input_item_changed, p_item );
}
static void uninstall_input_item_observer( playlist_item_t * p_item )
input_item_changed, p_item );
vlc_event_detach( p_em, vlc_InputItemInfoChanged,
input_item_changed, p_item );
+ vlc_event_detach( p_em, vlc_InputItemErrorWhenReadingChanged,
+ input_item_changed, p_item );
}
/*****************************************************************************
***************************************************************************/
/**
- * Delete item
+ * Release an item
*
- * Delete a playlist item and detach its input item
* \param p_item item to delete
* \return VLC_SUCCESS
*/
-int playlist_ItemDelete( playlist_item_t *p_item )
+int playlist_ItemRelease( playlist_item_t *p_item )
{
- uninstall_input_item_observer( p_item );
-
- vlc_gc_decref( p_item->p_input );
- free( p_item );
+ /* Surprise, we can't actually do more because we
+ * don't do refcounting, or eauivalent.
+ * Because item are not only accessed by their id
+ * using playlist_item outside the PL_LOCK isn't safe.
+ * Most of the modules does that.
+ *
+ * Who wants to add proper memory management? */
+ ARRAY_APPEND( p_item->p_playlist->items_to_delete, p_item);
return VLC_SUCCESS;
}
{
ChangeToNode( p_playlist, p_item );
PL_UNLOCK_IF( !b_locked );
- return NULL;
+ return p_item;
}
}
{
int i;
int i_id = p_item->i_id;
- bool b_delay_deletion = false;
if( p_item->i_children > -1 )
{
msg_Info( p_playlist, "stopping playback" );
vlc_object_signal_maybe( VLC_OBJECT(p_playlist) );
}
- b_delay_deletion = true;
}
PL_DEBUG( "deleting item `%s'", p_item->p_input->psz_name );
/* Remove the item from its parent */
playlist_NodeRemoveItem( p_playlist, p_item, p_item->p_parent );
- if( !b_delay_deletion )
- playlist_ItemDelete( p_item );
- else
- {
- PL_DEBUG( "marking %s for further deletion", PLI_NAME( p_item ) );
- p_item->i_flags |= PLAYLIST_REMOVE_FLAG;
- }
+ playlist_ItemRelease( p_item );
return VLC_SUCCESS;
}