X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fcontrol%2Fhierarchical_media_list_view.c;h=1283fad0646ef26b91c3e7ab7c74394f1a09f75f;hb=7228b1b132936ab5d7744a804f89b0155f56bc3c;hp=1b23283988ced991db14980b5f14a627531db9be;hpb=9bc4f8f52b06e6bad53cfb38eb8aab51f524c143;p=vlc diff --git a/src/control/hierarchical_media_list_view.c b/src/control/hierarchical_media_list_view.c index 1b23283988..1283fad064 100644 --- a/src/control/hierarchical_media_list_view.c +++ b/src/control/hierarchical_media_list_view.c @@ -21,10 +21,17 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ -#include "libvlc_internal.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include -#include -#include "vlc_arrays.h" +#include +#include +#include + +#include "media_list_internal.h" +#include "media_list_view_internal.h" //#define DEBUG_HIERARCHICAL_VIEW @@ -34,11 +41,6 @@ # define trace( ... ) #endif -struct libvlc_media_list_view_private_t -{ - vlc_array_t array; -}; - /* * Private functions */ @@ -51,14 +53,15 @@ static int hierarch_media_list_view_count( libvlc_media_list_view_t * p_mlv, libvlc_exception_t * p_e ) { - return libvlc_media_list_count( p_mlv->p_mlist, p_e ); + VLC_UNUSED(p_e); + return libvlc_media_list_count( p_mlv->p_mlist ); } /************************************************************************** * flat_media_list_view_item_at_index (private) * (called by flat_media_list_view_item_at_index) **************************************************************************/ -static libvlc_media_descriptor_t * +static libvlc_media_t * hierarch_media_list_view_item_at_index( libvlc_media_list_view_t * p_mlv, int index, libvlc_exception_t * p_e ) @@ -75,14 +78,18 @@ hierarch_media_list_view_children_at_index( libvlc_media_list_view_t * p_mlv, int index, libvlc_exception_t * p_e ) { - libvlc_media_descriptor_t * p_md; + libvlc_media_t * p_md; libvlc_media_list_t * p_submlist; + libvlc_media_list_view_t * p_ret; p_md = libvlc_media_list_item_at_index( p_mlv->p_mlist, index, p_e ); if( !p_md ) return NULL; - p_submlist = libvlc_media_descriptor_subitems( p_md, p_e ); - libvlc_media_descriptor_release( p_md ); + p_submlist = libvlc_media_subitems( p_md ); + libvlc_media_release( p_md ); if( !p_submlist ) return NULL; - return libvlc_media_list_hierarchical_view( p_submlist, p_e ); + p_ret = libvlc_media_list_hierarchical_view( p_submlist ); + libvlc_media_list_release( p_submlist ); + + return p_ret; } /************************************************************************** @@ -91,7 +98,7 @@ hierarch_media_list_view_children_at_index( libvlc_media_list_view_t * p_mlv, static void media_list_item_added( const libvlc_event_t * p_event, void * user_data ) { - libvlc_media_descriptor_t * p_md; + libvlc_media_t * p_md; libvlc_media_list_view_t * p_mlv = user_data; int index = p_event->u.media_list_item_added.index; p_md = p_event->u.media_list_item_added.item; @@ -100,7 +107,7 @@ media_list_item_added( const libvlc_event_t * p_event, void * user_data ) static void media_list_will_add_item( const libvlc_event_t * p_event, void * user_data ) { - libvlc_media_descriptor_t * p_md; + libvlc_media_t * p_md; libvlc_media_list_view_t * p_mlv = user_data; int index = p_event->u.media_list_will_add_item.index; p_md = p_event->u.media_list_will_add_item.item; @@ -109,7 +116,7 @@ media_list_will_add_item( const libvlc_event_t * p_event, void * user_data ) static void media_list_item_deleted( const libvlc_event_t * p_event, void * user_data ) { - libvlc_media_descriptor_t * p_md; + libvlc_media_t * p_md; libvlc_media_list_view_t * p_mlv = user_data; int index = p_event->u.media_list_item_deleted.index; p_md = p_event->u.media_list_item_deleted.item; @@ -118,7 +125,7 @@ media_list_item_deleted( const libvlc_event_t * p_event, void * user_data ) static void media_list_will_delete_item( const libvlc_event_t * p_event, void * user_data ) { - libvlc_media_descriptor_t * p_md; + libvlc_media_t * p_md; libvlc_media_list_view_t * p_mlv = user_data; int index = p_event->u.media_list_will_delete_item.index; p_md = p_event->u.media_list_will_delete_item.item; @@ -139,24 +146,23 @@ hierarch_media_list_view_release( libvlc_media_list_view_t * p_mlv ) { libvlc_event_detach( p_mlv->p_mlist->p_event_manager, libvlc_MediaListItemAdded, - media_list_item_added, p_mlv, NULL ); + media_list_item_added, p_mlv ); libvlc_event_detach( p_mlv->p_mlist->p_event_manager, libvlc_MediaListWillAddItem, - media_list_will_add_item, p_mlv, NULL ); + media_list_will_add_item, p_mlv ); libvlc_event_detach( p_mlv->p_mlist->p_event_manager, libvlc_MediaListItemDeleted, - media_list_item_deleted, p_mlv, NULL ); + media_list_item_deleted, p_mlv ); libvlc_event_detach( p_mlv->p_mlist->p_event_manager, libvlc_MediaListWillDeleteItem, - media_list_will_delete_item, p_mlv, NULL ); + media_list_will_delete_item, p_mlv ); } /************************************************************************** * libvlc_media_list_flat_view (Public) **************************************************************************/ libvlc_media_list_view_t * -libvlc_media_list_hierarchical_view( libvlc_media_list_t * p_mlist, - libvlc_exception_t * p_e ) +libvlc_media_list_hierarchical_view( libvlc_media_list_t * p_mlist ) { trace("\n"); libvlc_media_list_view_t * p_mlv; @@ -164,22 +170,22 @@ libvlc_media_list_hierarchical_view( libvlc_media_list_t * p_mlist, hierarch_media_list_view_count, hierarch_media_list_view_item_at_index, hierarch_media_list_view_children_at_index, + libvlc_media_list_hierarchical_view, hierarch_media_list_view_release, - NULL, - p_e ); + NULL ); libvlc_media_list_lock( p_mlist ); libvlc_event_attach( p_mlv->p_mlist->p_event_manager, libvlc_MediaListItemAdded, - media_list_item_added, p_mlv, NULL ); + media_list_item_added, p_mlv ); libvlc_event_attach( p_mlv->p_mlist->p_event_manager, libvlc_MediaListWillAddItem, - media_list_will_add_item, p_mlv, NULL ); + media_list_will_add_item, p_mlv ); libvlc_event_attach( p_mlv->p_mlist->p_event_manager, libvlc_MediaListItemDeleted, - media_list_item_deleted, p_mlv, NULL ); + media_list_item_deleted, p_mlv ); libvlc_event_attach( p_mlv->p_mlist->p_event_manager, libvlc_MediaListWillDeleteItem, - media_list_will_delete_item, p_mlv, NULL ); + media_list_will_delete_item, p_mlv ); libvlc_media_list_unlock( p_mlist ); return p_mlv; }