control: Implement and export media_list_view_children_for_item()
authorPierre d'Herbemont <pdherbemont@videolan.org>
Wed, 13 Feb 2008 18:18:13 +0000 (18:18 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Wed, 13 Feb 2008 18:18:13 +0000 (18:18 +0000)
include/vlc/libvlc.h
src/control/flat_media_list_view.c
src/control/hierarchical_media_list_view.c
src/control/hierarchical_node_media_list_view.c
src/control/libvlc_internal.h
src/control/media_list_view.c

index 4d8df14..9d6774e 100644 (file)
@@ -616,6 +616,11 @@ VLC_PUBLIC_API libvlc_media_list_view_t *
                                            int index,
                                            libvlc_exception_t * p_e );
 
+VLC_PUBLIC_API libvlc_media_list_view_t *
+    libvlc_media_list_view_children_for_item(  libvlc_media_list_view_t * p_mlv,
+                                           libvlc_media_descriptor_t * p_md,
+                                           libvlc_exception_t * p_e );
+
 
 VLC_PUBLIC_API int
     libvlc_media_list_view_index_of_item(  libvlc_media_list_view_t * p_mlv,
index d9ca590..1a7170b 100644 (file)
@@ -113,6 +113,7 @@ flat_media_list_view_children_at_index( libvlc_media_list_view_t * p_mlv,
                                         int index,
                                         libvlc_exception_t * p_e )
 {
+    (void)p_mlv; (void)index; (void)p_e;
     return NULL;
 }
 
@@ -174,6 +175,7 @@ libvlc_media_list_flat_view( libvlc_media_list_t * p_mlist,
                                         flat_media_list_view_count,
                                         flat_media_list_view_item_at_index,
                                         flat_media_list_view_children_at_index,
+                                        libvlc_media_list_flat_view,
                                         flat_media_list_view_release,
                                         p_this_view_data,
                                         p_e );
index 9795e5e..3f18eb5 100644 (file)
@@ -168,6 +168,7 @@ 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 );
index f548c58..36a9147 100644 (file)
@@ -287,6 +287,7 @@ libvlc_media_list_hierarchical_node_view( libvlc_media_list_t * p_mlist,
                                         hierarch_node_media_list_view_count,
                                         hierarch_node_media_list_view_item_at_index,
                                         hierarch_node_media_list_view_children_at_index,
+                                        libvlc_media_list_hierarchical_node_view,
                                         hierarch_node_media_list_view_release,
                                         NULL,
                                         p_e );
index 524b793..9fdc5c6 100644 (file)
@@ -124,6 +124,7 @@ struct libvlc_media_list_t
     vlc_bool_t                  b_read_only;
 };
 
+typedef libvlc_media_list_view_t * (*libvlc_media_list_view_constructor_func_t)( libvlc_media_list_t * p_mlist, libvlc_exception_t * p_e ) ;
 typedef void (*libvlc_media_list_view_release_func_t)( libvlc_media_list_view_t * p_mlv ) ;
 
 typedef int (*libvlc_media_list_view_count_func_t)( libvlc_media_list_view_t * p_mlv,
@@ -158,6 +159,7 @@ struct libvlc_media_list_view_t
     libvlc_media_list_view_item_at_index_func_t      pf_item_at_index;
     libvlc_media_list_view_children_at_index_func_t  pf_children_at_index;
 
+    libvlc_media_list_view_constructor_func_t         pf_constructor;
     libvlc_media_list_view_release_func_t            pf_release;
 
     /* Notification callback */
@@ -326,6 +328,7 @@ VLC_EXPORT ( libvlc_media_list_view_t *, libvlc_media_list_view_new,
                             libvlc_media_list_view_count_func_t pf_count,
                             libvlc_media_list_view_item_at_index_func_t pf_item_at_index,
                             libvlc_media_list_view_children_at_index_func_t pf_children_at_index,
+                            libvlc_media_list_view_constructor_func_t pf_constructor,
                             libvlc_media_list_view_release_func_t pf_release,
                             void * this_view_data,
                             libvlc_exception_t * p_e ) );
index 8a734dc..35a5f14 100644 (file)
@@ -294,6 +294,7 @@ libvlc_media_list_view_new( libvlc_media_list_t * p_mlist,
                             libvlc_media_list_view_count_func_t pf_count,
                             libvlc_media_list_view_item_at_index_func_t pf_item_at_index,
                             libvlc_media_list_view_children_at_index_func_t pf_children_at_index,
+                            libvlc_media_list_view_constructor_func_t pf_constructor,
                             libvlc_media_list_view_release_func_t pf_release,
                             void * this_view_data,
                             libvlc_exception_t * p_e )
@@ -322,6 +323,7 @@ libvlc_media_list_view_new( libvlc_media_list_t * p_mlist,
     p_mlv->pf_count             = pf_count;
     p_mlv->pf_item_at_index     = pf_item_at_index;
     p_mlv->pf_children_at_index = pf_children_at_index;
+    p_mlv->pf_constructor       = pf_constructor;
     p_mlv->pf_release           = pf_release;
 
     p_mlv->p_this_view_data = this_view_data;
@@ -424,6 +426,27 @@ libvlc_media_list_view_parent_media_list( libvlc_media_list_view_t * p_mlv,
     return p_mlist;
 }
 
+/**************************************************************************
+ *       libvlc_media_list_view_children_for_item (Public)
+ **************************************************************************/
+libvlc_media_list_view_t *
+libvlc_media_list_view_children_for_item( libvlc_media_list_view_t * p_mlv,
+                                          libvlc_media_descriptor_t * p_md,
+                                          libvlc_exception_t * p_e)
+{
+    (void)p_e;
+    libvlc_media_list_t * p_mlist;
+    libvlc_media_list_view_t * ret;
+
+    p_mlist = libvlc_media_descriptor_subitems(p_md, p_e);
+    if(!p_mlist) return NULL;
+
+    ret = p_mlv->pf_constructor( p_mlist, p_e );
+    libvlc_media_list_release( p_mlist );
+
+    return ret;
+}
+
 /* Limited to four args, because it should be enough */
 
 #define AN_SELECT( collapser, dec1, dec2, dec3, dec4, p, ...) p