/************************************************************************** * Delete a media descriptor object **************************************************************************/ void libvlc_media_release( libvlc_media_t *p_md ) { if (!p_md) return; p_md->i_refcount--; if( p_md->i_refcount > 0 ) return; if( p_md->p_subitems ) libvlc_media_list_release( p_md->p_subitems ); uninstall_input_item_observer( p_md ); vlc_gc_decref( p_md->p_input_item ); vlc_cond_destroy( &p_md->parsed_cond ); vlc_mutex_destroy( &p_md->parsed_lock ); /* Construct the event */ libvlc_event_t event; event.type = libvlc_MediaFreed; event.u.media_freed.md = p_md; /* Send the event */ libvlc_event_send( p_md->p_event_manager, &event ); libvlc_event_manager_release( p_md->p_event_manager ); free( p_md ); }
/** * Release an item * * \param p_item item to delete * \return VLC_SUCCESS */ int playlist_ItemRelease( playlist_item_t *p_item ) { /* For the assert */ playlist_t *p_playlist = p_item->p_playlist; PL_ASSERT_LOCKED; /* 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? */ uninstall_input_item_observer( p_item ); ARRAY_APPEND( pl_priv(p_playlist)->items_to_delete, p_item); return VLC_SUCCESS; }