]> git.sesse.net Git - vlc/blobdiff - include/vlc_playlist.h
Very beginning of the interaction framework (Refs:#27)
[vlc] / include / vlc_playlist.h
index 20ca0f4fc139cb01e815ae0b763feb2aeb954831..3bd4ebb304dd1f3648a9060f249be8b6c69a2c20 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * vlc_playlist.h : Playlist functions
  *****************************************************************************
- * Copyright (C) 1999-2004 VideoLAN
+ * Copyright (C) 1999-2004 the VideoLAN team
  * $Id$
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
@@ -84,6 +84,7 @@ struct playlist_item_t
 #define PLAYLIST_ENA_FLAG       0x04     /**< Is it enabled ? */
 #define PLAYLIST_DEL_FLAG       0x08     /**< Autodelete ? */
 #define PLAYLIST_RO_FLAG        0x10    /**< Write-enabled ? */
+#define PLAYLIST_REMOVE_FLAG    0x20    /**< Remove this item at the end */
 
 /**
  * playlist view
@@ -106,8 +107,10 @@ struct playlist_view_t
 #define VIEW_ALL      3
 #define VIEW_FIRST_SORTED  4
 #define VIEW_S_AUTHOR 4
+#define VIEW_S_GENRE 5
+#define VIEW_S_ALBUM  6
 
-#define VIEW_LAST_SORTED  4
+#define VIEW_LAST_SORTED  10
 
 #define VIEW_FIRST_CUSTOM 100
 
@@ -120,7 +123,7 @@ typedef enum { PLAYLIST_STOPPED,PLAYLIST_RUNNING,PLAYLIST_PAUSED } playlist_stat
 struct services_discovery_t
 {
     VLC_COMMON_MEMBERS
-    const char *psz_module;
+    char *psz_module;
 
     module_t *p_module;
 
@@ -154,6 +157,9 @@ struct playlist_t
     int                   i_size;   /**< total size of the list */
     playlist_item_t **    pp_items; /**< array of pointers to the
                                      * playlist items */
+    int                   i_all_size; /**< size of list of items and nodes */
+    playlist_item_t **    pp_all_items; /**< array of pointers to the
+                                         * playlist items and nodes */
 
     int                   i_views; /**< Number of views */
     playlist_view_t **    pp_views; /**< array of pointers to the
@@ -205,14 +211,22 @@ struct playlist_t
 
     playlist_preparse_t     *p_preparse;
 
+    vlc_mutex_t gc_lock;         /**< Lock to protect the garbage collection */
+
+    // The following members are about user interaction
+    // The playlist manages the user interaction to avoid creating another
+    // thread
+    vlc_bool_t b_manage_interaction;
+    interaction_t *p_interaction;
+
     /*@}*/
 };
 
 /* Helper to add an item */
 struct playlist_add_t
 {
-    playlist_item_t *p_node;
-    playlist_item_t *p_item;
+    int i_node;
+    int i_item;
     int i_view;
     int i_position;
 };
@@ -221,8 +235,11 @@ struct playlist_add_t
 #define SORT_TITLE 1
 #define SORT_TITLE_NODES_FIRST 2
 #define SORT_AUTHOR 3
-#define SORT_RANDOM 4
-#define SORT_DURATION 5
+#define SORT_GENRE 4
+#define SORT_RANDOM 5
+#define SORT_DURATION 6
+#define SORT_TITLE_NUMERIC 7
+#define SORT_ALBUM 8
 
 #define ORDER_NORMAL 0
 #define ORDER_REVERSE 1
@@ -237,20 +254,22 @@ playlist_t * __playlist_Create   ( vlc_object_t * );
 int            playlist_Destroy  ( playlist_t * );
 
 /* Playlist control */
-#define playlist_Play(p) playlist_Control(p,PLAYLIST_PLAY )
-#define playlist_Pause(p) playlist_Control(p,PLAYLIST_PAUSE )
-#define playlist_Stop(p) playlist_Control(p,PLAYLIST_STOP )
-#define playlist_Next(p) playlist_Control(p,PLAYLIST_SKIP , 1)
-#define playlist_Prev(p) playlist_Control(p,PLAYLIST_SKIP , -1)
-#define playlist_Skip(p,i) playlist_Control(p,PLAYLIST_SKIP,i)
-#define playlist_Goto(p,i) playlist_Control(p,PLAYLIST_GOTO,i)
+#define playlist_Play(p) playlist_LockControl(p,PLAYLIST_PLAY )
+#define playlist_Pause(p) playlist_LockControl(p,PLAYLIST_PAUSE )
+#define playlist_Stop(p) playlist_LockControl(p,PLAYLIST_STOP )
+#define playlist_Next(p) playlist_LockControl(p,PLAYLIST_SKIP, 1)
+#define playlist_Prev(p) playlist_LockControl(p,PLAYLIST_SKIP, -1)
+#define playlist_Skip(p,i) playlist_LockControl(p,PLAYLIST_SKIP, i)
+#define playlist_Goto(p,i) playlist_LockControl(p,PLAYLIST_GOTO, i)
 
 VLC_EXPORT( int, playlist_Control, ( playlist_t *, int, ...  ) );
+VLC_EXPORT( int, playlist_LockControl, ( playlist_t *, int, ...  ) );
 
 VLC_EXPORT( int,  playlist_Clear, ( playlist_t * ) );
 VLC_EXPORT( int,  playlist_LockClear, ( playlist_t * ) );
 
 VLC_EXPORT( int, playlist_PreparseEnqueue, (playlist_t *, input_item_t *) );
+VLC_EXPORT( int, playlist_PreparseEnqueueItem, (playlist_t *, playlist_item_t *) );
 
 /* Services discovery */
 
@@ -263,7 +282,10 @@ VLC_EXPORT( vlc_bool_t, playlist_IsServicesDiscoveryLoaded, ( playlist_t *,const
 /* Item management functions (act on items) */
 #define playlist_AddItem(p,pi,i1,i2) playlist_ItemAdd(p,pi,i1,i2)
 #define playlist_ItemNew( a , b, c ) __playlist_ItemNew(VLC_OBJECT(a) , b , c )
+#define playlist_ItemCopy( a, b ) __playlist_ItemCopy(VLC_OBJECT(a), b )
 VLC_EXPORT( playlist_item_t* , __playlist_ItemNew, ( vlc_object_t *,const char *,const char * ) );
+VLC_EXPORT( playlist_item_t* , __playlist_ItemCopy, ( vlc_object_t *,playlist_item_t* ) );
+VLC_EXPORT( playlist_item_t* , playlist_ItemNewWithType, ( vlc_object_t *,const char *,const char *, int ) );
 VLC_EXPORT( int, playlist_ItemDelete, ( playlist_item_t * ) );
 VLC_EXPORT( int, playlist_ItemAddParent, ( playlist_item_t *, int,playlist_item_t *) );
 VLC_EXPORT( int, playlist_CopyParents, ( playlist_item_t *,playlist_item_t *) );
@@ -285,9 +307,10 @@ VLC_EXPORT( playlist_item_t *, playlist_NodeCreate, ( playlist_t *,int,char *, p
 VLC_EXPORT( int, playlist_NodeAppend, (playlist_t *,int,playlist_item_t*,playlist_item_t *) );
 VLC_EXPORT( int, playlist_NodeInsert, (playlist_t *,int,playlist_item_t*,playlist_item_t *, int) );
 VLC_EXPORT( int, playlist_NodeRemoveItem, (playlist_t *,playlist_item_t*,playlist_item_t *) );
+VLC_EXPORT( int, playlist_NodeRemoveParent, (playlist_t *,playlist_item_t*,playlist_item_t *) );
 VLC_EXPORT( int, playlist_NodeChildrenCount, (playlist_t *,playlist_item_t* ) );
 VLC_EXPORT( playlist_item_t *, playlist_ChildSearchName, (playlist_item_t*, const char* ) );
-VLC_EXPORT( int, playlist_NodeDelete, ( playlist_t *, playlist_item_t *, vlc_bool_t ) );
+VLC_EXPORT( int, playlist_NodeDelete, ( playlist_t *, playlist_item_t *, vlc_bool_t , vlc_bool_t ) );
 VLC_EXPORT( int, playlist_NodeEmpty, ( playlist_t *, playlist_item_t *, vlc_bool_t ) );
 
 /* Tree walking */
@@ -330,22 +353,13 @@ VLC_EXPORT( playlist_item_t *, playlist_ItemGetByInput, (playlist_t *,input_item
 VLC_EXPORT( playlist_item_t *, playlist_LockItemGetByInput, (playlist_t *,input_item_t * ) );
 VLC_EXPORT( int, playlist_GetPositionById, (playlist_t *,int ) );
 
-/* Info functions */
-VLC_EXPORT( char * , playlist_GetInfo, ( playlist_t * , int, const char *, const char *) );
-VLC_EXPORT( char * , playlist_ItemGetInfo, ( playlist_item_t * , const char *, const char *) );
-
-VLC_EXPORT( info_category_t*, playlist_ItemGetCategory, ( playlist_item_t *, const char *) );
-
-VLC_EXPORT( info_category_t*, playlist_ItemCreateCategory, ( playlist_item_t *, const char *) );
-
-VLC_EXPORT( int, playlist_AddInfo, (playlist_t *, int, const char * , const char *, const char *, ...) );
-VLC_EXPORT( int, playlist_ItemAddInfo, (playlist_item_t *, const char * , const char *, const char *, ...) );
 VLC_EXPORT( int, playlist_ItemAddOption, (playlist_item_t *, const char *) );
 
 /* Playlist sorting */
 #define playlist_SortID(p, i) playlist_Sort( p, SORT_ID, i)
 #define playlist_SortTitle(p, i) playlist_Sort( p, SORT_TITLE, i)
 #define playlist_SortAuthor(p, i) playlist_Sort( p, SORT_AUTHOR, i)
+#define playlist_SortAlbum(p, i) playlist_Sort( p, SORT_ALBUM, i)
 #define playlist_SortGroup(p, i) playlist_Sort( p, SORT_GROUP, i)
 VLC_EXPORT( int,  playlist_Sort, ( playlist_t *, int, int) );
 VLC_EXPORT( int,  playlist_Move, ( playlist_t *, int, int ) );