]> git.sesse.net Git - vlc/blobdiff - src/control/media_list_path.h
libvlc: Allow event to be dispatched asynchronously.
[vlc] / src / control / media_list_path.h
index 209b1eb0cd50172dcd013daee16f2839ee2d90dd..a73dbe0beb0fac3fdfdcafaa2fa74bc3871dc737 100644 (file)
@@ -25,6 +25,8 @@
 #ifndef _LIBVLC_MEDIA_LIST_PATH_H
 #define _LIBVLC_MEDIA_LIST_PATH_H 1
 
+typedef int * libvlc_media_list_path_t; /* (Media List Player Internal) */
+
 /**************************************************************************
  *       path_empty (Media List Player Internal)
  **************************************************************************/
@@ -47,9 +49,9 @@ static inline libvlc_media_list_path_t libvlc_media_list_path_with_root_index( i
 }
 
 /**************************************************************************
- *       path_deepness (Media List Player Internal)
+ *       path_depth (Media List Player Internal)
  **************************************************************************/
-static inline int libvlc_media_list_path_deepness( libvlc_media_list_path_t path )
+static inline int libvlc_media_list_path_depth( libvlc_media_list_path_t path )
 {
     int i;
     for( i = 0; path[i] != -1; i++ );
@@ -61,10 +63,10 @@ static inline int libvlc_media_list_path_deepness( libvlc_media_list_path_t path
  **************************************************************************/
 static inline void libvlc_media_list_path_append( libvlc_media_list_path_t * p_path, int index )
 {
-    int old_deepness = libvlc_media_list_path_deepness( *p_path );
-    *p_path = realloc( *p_path, sizeof(int)*(old_deepness+2));
-    *p_path[old_deepness] = index;
-    *p_path[old_deepness+1] = -1;
+    int old_depth = libvlc_media_list_path_depth( *p_path );
+    *p_path = realloc( *p_path, sizeof(int)*(old_depth+2));
+    *p_path[old_depth] = index;
+    *p_path[old_depth+1] = -1;
 }
 
 /**************************************************************************
@@ -73,11 +75,11 @@ static inline void libvlc_media_list_path_append( libvlc_media_list_path_t * p_p
 static inline libvlc_media_list_path_t libvlc_media_list_path_copy_by_appending( libvlc_media_list_path_t path, int index )
 {
     libvlc_media_list_path_t ret;
-    int old_deepness = libvlc_media_list_path_deepness( path );
-    ret = malloc( sizeof(int)*(old_deepness+2) );
-    memcpy( ret, path, sizeof(int)*(old_deepness+2) );
-    ret[old_deepness] = index;
-    ret[old_deepness+1] = -1;
+    int old_depth = libvlc_media_list_path_depth( path );
+    ret = malloc( sizeof(int)*(old_depth+2) );
+    memcpy( ret, path, sizeof(int)*(old_depth+2) );
+    ret[old_depth] = index;
+    ret[old_depth+1] = -1;
     return ret;
 }
 
@@ -87,9 +89,9 @@ static inline libvlc_media_list_path_t libvlc_media_list_path_copy_by_appending(
 static inline libvlc_media_list_path_t libvlc_media_list_path_copy( libvlc_media_list_path_t path )
 {
     libvlc_media_list_path_t ret;
-    int deepness = libvlc_media_list_path_deepness( path );
-    ret = malloc( sizeof(int)*(deepness+1) );
-    memcpy( ret, path, sizeof(int)*(deepness+1) );
+    int depth = libvlc_media_list_path_depth( path );
+    ret = malloc( sizeof(int)*(depth+1) );
+    memcpy( ret, path, sizeof(int)*(depth+1) );
     return ret;
 }
 
@@ -97,19 +99,19 @@ static inline libvlc_media_list_path_t libvlc_media_list_path_copy( libvlc_media
  *       get_path_rec (Media List Player Internal)
  **************************************************************************/
 static libvlc_media_list_path_t
-get_path_rec( libvlc_media_list_path_t path, libvlc_media_list_t * p_current_mlist, libvlc_media_descriptor_t * p_searched_md )
+get_path_rec( libvlc_media_list_path_t path, libvlc_media_list_t * p_current_mlist, libvlc_media_t * p_searched_md )
 {
     int i, count;
     count = libvlc_media_list_count( p_current_mlist, NULL );
     for( i = 0; i < count; i++ )
     {
-        libvlc_media_descriptor_t * p_md = libvlc_media_list_item_at_index( p_current_mlist, i, NULL );
+        libvlc_media_t * p_md = libvlc_media_list_item_at_index( p_current_mlist, i, NULL );
 
         if( p_md == p_searched_md )
             return libvlc_media_list_path_copy_by_appending( path, i ); /* Found! */
 
-        libvlc_media_list_t * p_subitems = libvlc_media_descriptor_subitems( p_md, NULL );
-        libvlc_media_descriptor_release( p_md );
+        libvlc_media_list_t * p_subitems = libvlc_media_subitems( p_md, NULL );
+        libvlc_media_release( p_md );
         if( p_subitems )
         {
             libvlc_media_list_path_t new_path = libvlc_media_list_path_copy_by_appending( path, i );
@@ -128,7 +130,7 @@ get_path_rec( libvlc_media_list_path_t path, libvlc_media_list_t * p_current_mli
 /**************************************************************************
  *       path_of_item (Media List Player Internal)
  **************************************************************************/
-static inline libvlc_media_list_path_t libvlc_media_list_path_of_item( libvlc_media_list_t * p_mlist, libvlc_media_descriptor_t * p_md )
+static inline libvlc_media_list_path_t libvlc_media_list_path_of_item( libvlc_media_list_t * p_mlist, libvlc_media_t * p_md )
 {
     libvlc_media_list_path_t path = libvlc_media_list_path_empty();
     libvlc_media_list_path_t ret;
@@ -140,11 +142,11 @@ static inline libvlc_media_list_path_t libvlc_media_list_path_of_item( libvlc_me
 /**************************************************************************
  *       item_at_path (Media List Player Internal)
  **************************************************************************/
-static libvlc_media_descriptor_t *
+static libvlc_media_t *
 libvlc_media_list_item_at_path( libvlc_media_list_t * p_mlist, libvlc_media_list_path_t path )
 {
     libvlc_media_list_t * p_current_mlist = p_mlist;
-    libvlc_media_descriptor_t * p_md = NULL;
+    libvlc_media_t * p_md = NULL;
     int i;
     for( i = 0; path[i] != -1; i++ )
     {
@@ -156,9 +158,9 @@ libvlc_media_list_item_at_path( libvlc_media_list_t * p_mlist, libvlc_media_list
         if( path[i+1] == -1 )
             return p_md;
 
-        p_current_mlist = libvlc_media_descriptor_subitems( p_md, NULL );
-        libvlc_media_descriptor_release( p_md );
-    
+        p_current_mlist = libvlc_media_subitems( p_md, NULL );
+        libvlc_media_release( p_md );
         if( !p_current_mlist )
             return NULL;
 
@@ -167,7 +169,7 @@ libvlc_media_list_item_at_path( libvlc_media_list_t * p_mlist, libvlc_media_list
     /* Not found, shouldn't happen if the p_path is not empty */
     if( p_current_mlist != p_mlist )
         libvlc_media_list_release( p_current_mlist );
-    return NULL; 
+    return NULL;
 }
 
 /**************************************************************************
@@ -177,7 +179,7 @@ static libvlc_media_list_t *
 libvlc_media_list_parentlist_at_path( libvlc_media_list_t * p_mlist, libvlc_media_list_path_t path )
 {
     libvlc_media_list_t * p_current_mlist = p_mlist;
-    libvlc_media_descriptor_t * p_md = NULL;
+    libvlc_media_t * p_md = NULL;
     int i;
     for( i = 0; path[i] != -1; i++ )
     {
@@ -189,9 +191,9 @@ libvlc_media_list_parentlist_at_path( libvlc_media_list_t * p_mlist, libvlc_medi
 
         p_md = libvlc_media_list_item_at_index( p_current_mlist, path[i], NULL );
 
-        p_current_mlist = libvlc_media_descriptor_subitems( p_md, NULL );
-        libvlc_media_descriptor_release( p_md );
-    
+        p_current_mlist = libvlc_media_subitems( p_md, NULL );
+        libvlc_media_release( p_md );
         if( !p_current_mlist )
             return NULL;
 
@@ -200,7 +202,7 @@ libvlc_media_list_parentlist_at_path( libvlc_media_list_t * p_mlist, libvlc_medi
     /* Not found, shouldn't happen if the p_path is not empty */
     if( p_current_mlist != p_mlist )
         libvlc_media_list_release( p_current_mlist );
-    return NULL; 
+    return NULL;
 }
 
 /**************************************************************************
@@ -210,14 +212,14 @@ static libvlc_media_list_t *
 libvlc_media_list_sublist_at_path( libvlc_media_list_t * p_mlist, libvlc_media_list_path_t path )
 {
     libvlc_media_list_t * ret;
-    libvlc_media_descriptor_t * p_md = libvlc_media_list_item_at_path( p_mlist, path );
+    libvlc_media_t * p_md = libvlc_media_list_item_at_path( p_mlist, path );
     if( !p_md )
         return NULL;
-    
-    ret = libvlc_media_descriptor_subitems( p_md, NULL );
-    libvlc_media_descriptor_release( p_md );
-    
-    return ret; 
+    ret = libvlc_media_subitems( p_md, NULL );
+    libvlc_media_release( p_md );
+    return ret;
 }
 
 #endif