]> git.sesse.net Git - vlc/blobdiff - include/vlc_playlist.h
Start of meta engine stuff. src/input/input.c needs to be fixed a bit. I'll finish...
[vlc] / include / vlc_playlist.h
index f49fdeb56a669290c378b54e52f055d8b8c0c4f3..0c79e48853db66059853eb968c43dc071a02e88e 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef _VLC_PLAYLIST_H_
 #define _VLC_PLAYLIST_H_
 
+#include <assert.h>
+
 /**
  *  \file
  *  This file contain structures and function prototypes related
@@ -32,7 +34,6 @@
 
 /**
  * \defgroup vlc_playlist Playlist
- * Brief description. Longer description
  * @{
  */
 
@@ -71,7 +72,6 @@ struct playlist_item_t
 #define PLAYLIST_RO_FLAG        0x0008    /**< Write-enabled ? */
 #define PLAYLIST_REMOVE_FLAG    0x0010    /**< Remove this item at the end */
 #define PLAYLIST_EXPANDED_FLAG  0x0020    /**< Expanded node */
-#define PLAYLIST_PREFCAT_FLAG   0x0040    /**< Prefer category */
 
 /**
  * Playlist status
@@ -91,15 +91,6 @@ struct services_discovery_t
     void (*pf_run) ( services_discovery_t *);
 };
 
-struct playlist_preparse_t
-{
-    VLC_COMMON_MEMBERS
-    vlc_mutex_t     lock;
-    int             i_waiting;
-    input_item_t  **pp_waiting;
-};
-
-
 /** Structure containing information about the playlist */
 struct playlist_t
 {
@@ -121,6 +112,11 @@ struct playlist_t
     int                   i_input_items;
     input_item_t **       pp_input_items;
 
+    int                   i_random;     /**< Number of candidates for random */
+    playlist_item_t **    pp_random;    /**< Random candidate items */
+    int                   i_random_index; /**< Current random item */
+    vlc_bool_t            b_reset_random; /**< Recreate random array ?*/
+
     int                   i_last_playlist_id; /**< Last id to an item */
     int                   i_last_input_id ; /**< Last id on an input */
 
@@ -138,6 +134,9 @@ struct playlist_t
     vlc_bool_t            b_always_tree;/**< Always display as tree */
     vlc_bool_t            b_never_tree;/**< Never display as tree */
 
+    vlc_bool_t            b_doing_ml; /**< Doing media library stuff, */
+                                      /*get quicker */
+
     /* Runtime */
     input_thread_t *      p_input;  /**< the input thread associated
                                      * with the current item */
@@ -146,6 +145,7 @@ struct playlist_t
     mtime_t               i_vout_destroyed_date;
     mtime_t               i_sout_destroyed_date;
     playlist_preparse_t  *p_preparse; /**< Preparser object */
+    playlist_preparse_t  *p_secondary_preparse; /**< Preparser object */
 
     vlc_mutex_t gc_lock;         /**< Lock to protect the garbage collection */
 
@@ -204,25 +204,22 @@ struct playlist_add_t
 
 /* Global thread */
 #define playlist_ThreadCreate(a) __playlist_ThreadCreate(VLC_OBJECT(a))
-playlist_t *__playlist_ThreadCreate   ( vlc_object_t * );
+void        __playlist_ThreadCreate   ( vlc_object_t * );
 int           playlist_ThreadDestroy  ( playlist_t * );
 
 /* Helpers */
 #define PL_LOCK vlc_mutex_lock( &p_playlist->object_lock );
 #define PL_UNLOCK vlc_mutex_unlock( &p_playlist->object_lock );
 
-/* Creation/Deletion */
-playlist_t *playlist_Create   ( vlc_object_t * );
-void        playlist_Destroy  ( playlist_t * );
-
-/* Engine */
-void playlist_MainLoop( playlist_t * );
-void playlist_LastLoop( playlist_t * );
-void playlist_PreparseLoop( playlist_preparse_t * );
-
-/* Control */
-playlist_item_t * playlist_NextItem  ( playlist_t * );
-int playlist_PlayItem  ( playlist_t *, playlist_item_t * );
+#define pl_Get( a ) a->p_libvlc->p_playlist
+#define pl_Yield( a ) __pl_Yield( VLC_OBJECT(a) )
+static inline playlist_t *__pl_Yield( vlc_object_t *p_this )
+{
+    assert( p_this->p_libvlc->p_playlist );
+    vlc_object_yield( p_this->p_libvlc->p_playlist );
+    return p_this->p_libvlc->p_playlist;
+}
+#define pl_Release(a) vlc_object_release( a->p_libvlc->p_playlist );
 
 /* Playlist control */
 #define playlist_Play(p) playlist_LockControl(p,PLAYLIST_PLAY )
@@ -354,7 +351,7 @@ static inline int playlist_PlaylistAddInput( playlist_t* p_playlist,
     return playlist_AddInput( p_playlist, p_input, i_mode, i_pos, VLC_TRUE );
 }
 
-/** Add an input item to the media library 
+/** Add an input item to the media library
  * \see playlist_AddInput
  */
 static inline int playlist_MLAddInput( playlist_t* p_playlist,
@@ -363,8 +360,6 @@ static inline int playlist_MLAddInput( playlist_t* p_playlist,
     return playlist_AddInput( p_playlist, p_input, i_mode, i_pos, VLC_FALSE );
 }
 
-void playlist_SendAddNotify( playlist_t *p_playlist, int i_item_id, int i_node_id );
-
 /********************** Misc item operations **********************/
 VLC_EXPORT( playlist_item_t*, playlist_ItemToNode, (playlist_t *,playlist_item_t *) );
 VLC_EXPORT( playlist_item_t*, playlist_LockItemToNode, (playlist_t *,playlist_item_t *) );
@@ -412,22 +407,9 @@ VLC_EXPORT( int, playlist_NodeRemoveItem, (playlist_t *,playlist_item_t*,playlis
 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_bool_t ) );
 VLC_EXPORT( int, playlist_NodeEmpty, ( playlist_t *, playlist_item_t *, vlc_bool_t ) );
-VLC_EXPORT( void, playlist_NodesCreateForSD, (playlist_t *, char *, playlist_item_t **, playlist_item_t ** ) );
+VLC_EXPORT( void, playlist_NodesPairCreate, (playlist_t *, char *, playlist_item_t **, playlist_item_t **, vlc_bool_t ) );
 VLC_EXPORT( playlist_item_t *, playlist_GetPreferredNode, ( playlist_t *p_playlist, playlist_item_t *p_node ) );
 
-/* Tree walking - These functions are only for playlist, not plugins */
-playlist_item_t *playlist_GetNextLeaf( playlist_t *p_playlist,
-                                       playlist_item_t *p_root,
-                                       playlist_item_t *p_item );
-playlist_item_t *playlist_GetNextEnabledLeaf( playlist_t *p_playlist,
-                                              playlist_item_t *p_root,
-                                              playlist_item_t *p_item );
-playlist_item_t *playlist_GetPrevLeaf( playlist_t *p_playlist,
-                                       playlist_item_t *p_root,
-                                       playlist_item_t *p_item );
-playlist_item_t *playlist_GetLastLeaf( playlist_t *p_playlist,
-                                       playlist_item_t *p_root );
-
 /***********************************************************************
  * Inline functions
  ***********************************************************************/
@@ -456,12 +438,4 @@ static inline vlc_bool_t playlist_IsEmpty( playlist_t * p_playlist )
  * @}
  */
 
-#define PLAYLIST_DEBUG 1
-
-#ifdef PLAYLIST_DEBUG
-#define PL_DEBUG( msg, args... ) msg_Dbg( p_playlist, msg, ## args )
-#else
-#define PL_DEBUG( msg, args ... ) {}
-#endif
-
 #endif