00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00039 struct playlist_export_t
00040 {
00041 char *psz_filename;
00042 FILE *p_file;
00043 };
00044
00045 struct item_parent_t
00046 {
00047 int i_view;
00048 playlist_item_t *p_parent;
00049 };
00050
00055 struct playlist_item_t
00056 {
00057 input_item_t input;
00059
00060 int i_children;
00062 playlist_item_t **pp_children;
00063 int i_parents;
00064 struct item_parent_t **pp_parents;
00065 int i_serial;
00067 uint8_t i_flags;
00070 int i_nb_played;
00072
00073 vlc_bool_t b_autodeletion;
00077 vlc_bool_t b_enabled;
00079
00080 };
00081
00082 #define PLAYLIST_SAVE_FLAG 0x01
00083 #define PLAYLIST_SKIP_FLAG 0x02
00084 #define PLAYLIST_ENA_FLAG 0x04
00085 #define PLAYLIST_DEL_FLAG 0x08
00086 #define PLAYLIST_RO_FLAG 0x10
00087 #define PLAYLIST_REMOVE_FLAG 0x20
00093 struct playlist_view_t
00094 {
00095 char * psz_name;
00096 int i_id;
00097 playlist_item_t * p_root;
00098 };
00099
00100
00105 #define VIEW_CATEGORY 1
00106 #define VIEW_SIMPLE 2
00107 #define VIEW_ALL 3
00108 #define VIEW_FIRST_SORTED 4
00109 #define VIEW_S_AUTHOR 4
00110 #define VIEW_S_GENRE 5
00111 #define VIEW_S_ALBUM 6
00112
00113 #define VIEW_LAST_SORTED 10
00114
00115 #define VIEW_FIRST_CUSTOM 100
00116
00120 typedef enum { PLAYLIST_STOPPED,PLAYLIST_RUNNING,PLAYLIST_PAUSED } playlist_status_t;
00121
00122
00123 struct services_discovery_t
00124 {
00125 VLC_COMMON_MEMBERS
00126 char *psz_module;
00127
00128 module_t *p_module;
00129
00130 services_discovery_sys_t *p_sys;
00131 void (*pf_run) ( services_discovery_t *);
00132 };
00133
00134 struct playlist_preparse_t
00135 {
00136 VLC_COMMON_MEMBERS
00137 vlc_mutex_t lock;
00138 int i_waiting;
00139 input_item_t **pp_waiting;
00140 };
00141
00142
00146 struct playlist_t
00147 {
00148 VLC_COMMON_MEMBERS
00154 int i_index;
00155 int i_enabled;
00157 int i_size;
00158 playlist_item_t ** pp_items;
00160 int i_all_size;
00161 playlist_item_t ** pp_all_items;
00164 int i_views;
00165 playlist_view_t ** pp_views;
00168 input_thread_t * p_input;
00171 mtime_t request_date;
00173 int i_last_id;
00174 int i_sort;
00175 int i_order;
00177 playlist_item_t * p_general;
00180 services_discovery_t **pp_sds;
00181 int i_sds;
00182
00183 vlc_bool_t b_go_next;
00184
00185 struct {
00186
00187 playlist_status_t i_status;
00189
00190
00191 playlist_item_t * p_item;
00192 playlist_item_t * p_node;
00193 int i_view;
00194 } status;
00195
00196 struct {
00197
00198
00199 int i_view;
00200 playlist_item_t * p_node;
00201 playlist_item_t * p_item;
00203 int i_skip;
00204 int i_goto;
00206 vlc_bool_t b_request;
00209 vlc_mutex_t lock;
00210 } request;
00211
00212 playlist_preparse_t *p_preparse;
00213
00214 vlc_mutex_t gc_lock;
00217 };
00218
00219
00220 struct playlist_add_t
00221 {
00222 int i_node;
00223 int i_item;
00224 int i_view;
00225 int i_position;
00226 };
00227
00228 #define SORT_ID 0
00229 #define SORT_TITLE 1
00230 #define SORT_TITLE_NODES_FIRST 2
00231 #define SORT_AUTHOR 3
00232 #define SORT_GENRE 4
00233 #define SORT_RANDOM 5
00234 #define SORT_DURATION 6
00235 #define SORT_TITLE_NUMERIC 7
00236 #define SORT_ALBUM 8
00237
00238 #define ORDER_NORMAL 0
00239 #define ORDER_REVERSE 1
00240
00241
00242
00243
00244
00245
00246 #define playlist_Create(a) __playlist_Create(VLC_OBJECT(a))
00247 playlist_t * __playlist_Create ( vlc_object_t * );
00248 int playlist_Destroy ( playlist_t * );
00249
00250
00251 #define playlist_Play(p) playlist_LockControl(p,PLAYLIST_PLAY )
00252 #define playlist_Pause(p) playlist_LockControl(p,PLAYLIST_PAUSE )
00253 #define playlist_Stop(p) playlist_LockControl(p,PLAYLIST_STOP )
00254 #define playlist_Next(p) playlist_LockControl(p,PLAYLIST_SKIP, 1)
00255 #define playlist_Prev(p) playlist_LockControl(p,PLAYLIST_SKIP, -1)
00256 #define playlist_Skip(p,i) playlist_LockControl(p,PLAYLIST_SKIP, i)
00257 #define playlist_Goto(p,i) playlist_LockControl(p,PLAYLIST_GOTO, i)
00258
00259 VLC_EXPORT( int, playlist_Control, ( playlist_t *, int, ... ) );
00260 VLC_EXPORT( int, playlist_LockControl, ( playlist_t *, int, ... ) );
00261
00262 VLC_EXPORT( int, playlist_Clear, ( playlist_t * ) );
00263 VLC_EXPORT( int, playlist_LockClear, ( playlist_t * ) );
00264
00265 VLC_EXPORT( int, playlist_PreparseEnqueue, (playlist_t *, input_item_t *) );
00266 VLC_EXPORT( int, playlist_PreparseEnqueueItem, (playlist_t *, playlist_item_t *) );
00267
00268
00269
00270 VLC_EXPORT( int, playlist_ServicesDiscoveryAdd, (playlist_t *, const char *));
00271 VLC_EXPORT( int, playlist_ServicesDiscoveryRemove, (playlist_t *, const char *));
00272 VLC_EXPORT( int, playlist_AddSDModules, (playlist_t *, char *));
00273 VLC_EXPORT( vlc_bool_t, playlist_IsServicesDiscoveryLoaded, ( playlist_t *,const char *));
00274
00275
00276
00277 #define playlist_AddItem(p,pi,i1,i2) playlist_ItemAdd(p,pi,i1,i2)
00278 #define playlist_ItemNew( a , b, c ) __playlist_ItemNew(VLC_OBJECT(a) , b , c )
00279 #define playlist_ItemCopy( a, b ) __playlist_ItemCopy(VLC_OBJECT(a), b )
00280 VLC_EXPORT( playlist_item_t* , __playlist_ItemNew, ( vlc_object_t *,const char *,const char * ) );
00281 VLC_EXPORT( playlist_item_t* , __playlist_ItemCopy, ( vlc_object_t *,playlist_item_t* ) );
00282 VLC_EXPORT( playlist_item_t* , playlist_ItemNewWithType, ( vlc_object_t *,const char *,const char *, int ) );
00283 VLC_EXPORT( int, playlist_ItemDelete, ( playlist_item_t * ) );
00284 VLC_EXPORT( int, playlist_ItemAddParent, ( playlist_item_t *, int,playlist_item_t *) );
00285 VLC_EXPORT( int, playlist_CopyParents, ( playlist_item_t *,playlist_item_t *) );
00286
00287 VLC_EXPORT( int, playlist_ItemSetName, (playlist_item_t *, char * ) );
00288 VLC_EXPORT( int, playlist_ItemSetDuration, (playlist_item_t *, mtime_t ) );
00289
00290
00291
00292 VLC_EXPORT( int, playlist_ViewInsert, (playlist_t *, int, char * ) );
00293 VLC_EXPORT( int, playlist_ViewDelete, (playlist_t *,playlist_view_t* ) );
00294 VLC_EXPORT( playlist_view_t *, playlist_ViewFind, (playlist_t *, int ) );
00295 VLC_EXPORT( int, playlist_ViewUpdate, (playlist_t *, int ) );
00296 VLC_EXPORT( int, playlist_ViewDump, (playlist_t *, playlist_view_t * ) );
00297 VLC_EXPORT( int, playlist_ViewEmpty, (playlist_t *, int, vlc_bool_t ) );
00298
00299
00300 VLC_EXPORT( playlist_item_t *, playlist_NodeCreate, ( playlist_t *,int,char *, playlist_item_t * p_parent ) );
00301 VLC_EXPORT( int, playlist_NodeAppend, (playlist_t *,int,playlist_item_t*,playlist_item_t *) );
00302 VLC_EXPORT( int, playlist_NodeInsert, (playlist_t *,int,playlist_item_t*,playlist_item_t *, int) );
00303 VLC_EXPORT( int, playlist_NodeRemoveItem, (playlist_t *,playlist_item_t*,playlist_item_t *) );
00304 VLC_EXPORT( int, playlist_NodeRemoveParent, (playlist_t *,playlist_item_t*,playlist_item_t *) );
00305 VLC_EXPORT( int, playlist_NodeChildrenCount, (playlist_t *,playlist_item_t* ) );
00306 VLC_EXPORT( playlist_item_t *, playlist_ChildSearchName, (playlist_item_t*, const char* ) );
00307 VLC_EXPORT( int, playlist_NodeDelete, ( playlist_t *, playlist_item_t *, vlc_bool_t , vlc_bool_t ) );
00308 VLC_EXPORT( int, playlist_NodeEmpty, ( playlist_t *, playlist_item_t *, vlc_bool_t ) );
00309
00310
00311 playlist_item_t *playlist_FindNextFromParent( playlist_t *p_playlist,
00312 int i_view,
00313 playlist_item_t *p_root,
00314 playlist_item_t *p_node,
00315 playlist_item_t *p_item );
00316 playlist_item_t *playlist_FindPrevFromParent( playlist_t *p_playlist,
00317 int i_view,
00318 playlist_item_t *p_root,
00319 playlist_item_t *p_node,
00320 playlist_item_t *p_item );
00321
00322
00323
00324
00325 VLC_EXPORT( int, playlist_Add, ( playlist_t *, const char *, const char *, int, int ) );
00326 VLC_EXPORT( int, playlist_AddExt, ( playlist_t *, const char *, const char *, int, int, mtime_t, const char **,int ) );
00327 VLC_EXPORT( int, playlist_ItemAdd, ( playlist_t *, playlist_item_t *, int, int ) );
00328 VLC_EXPORT(int, playlist_NodeAddItem, ( playlist_t *, playlist_item_t *,int,playlist_item_t *,int , int ) );
00329
00330
00331 VLC_EXPORT( int, playlist_Delete, ( playlist_t *, int ) );
00332 VLC_EXPORT( int, playlist_LockDelete, ( playlist_t *, int ) );
00333 VLC_EXPORT( int, playlist_Disable, ( playlist_t *, playlist_item_t * ) );
00334 VLC_EXPORT( int, playlist_Enable, ( playlist_t *, playlist_item_t * ) );
00335 VLC_EXPORT( int, playlist_ItemToNode, (playlist_t *,playlist_item_t *) );
00336 VLC_EXPORT( int, playlist_LockItemToNode, (playlist_t *,playlist_item_t *) );
00337 VLC_EXPORT( int, playlist_Replace, (playlist_t *,playlist_item_t *, input_item_t*) );
00338 VLC_EXPORT( int, playlist_LockReplace, (playlist_t *,playlist_item_t *, input_item_t*) );
00339
00340
00341
00342 VLC_EXPORT( playlist_item_t *, playlist_ItemGetById, (playlist_t *, int) );
00343 VLC_EXPORT( playlist_item_t *, playlist_LockItemGetById, (playlist_t *, int) );
00344 VLC_EXPORT( playlist_item_t *, playlist_ItemGetByPos, (playlist_t *, int) );
00345 VLC_EXPORT( playlist_item_t *, playlist_LockItemGetByPos, (playlist_t *, int) );
00346 VLC_EXPORT( playlist_item_t *, playlist_ItemGetByInput, (playlist_t *,input_item_t * ) );
00347 VLC_EXPORT( playlist_item_t *, playlist_LockItemGetByInput, (playlist_t *,input_item_t * ) );
00348 VLC_EXPORT( int, playlist_GetPositionById, (playlist_t *,int ) );
00349
00350 VLC_EXPORT( int, playlist_ItemAddOption, (playlist_item_t *, const char *) );
00351
00352
00353 #define playlist_SortID(p, i) playlist_Sort( p, SORT_ID, i)
00354 #define playlist_SortTitle(p, i) playlist_Sort( p, SORT_TITLE, i)
00355 #define playlist_SortAuthor(p, i) playlist_Sort( p, SORT_AUTHOR, i)
00356 #define playlist_SortAlbum(p, i) playlist_Sort( p, SORT_ALBUM, i)
00357 #define playlist_SortGroup(p, i) playlist_Sort( p, SORT_GROUP, i)
00358 VLC_EXPORT( int, playlist_Sort, ( playlist_t *, int, int) );
00359 VLC_EXPORT( int, playlist_Move, ( playlist_t *, int, int ) );
00360 VLC_EXPORT( int, playlist_NodeGroup, ( playlist_t *, int,playlist_item_t *,playlist_item_t **,int, int, int ) );
00361 VLC_EXPORT( int, playlist_NodeSort, ( playlist_t *, playlist_item_t *,int, int ) );
00362 VLC_EXPORT( int, playlist_RecursiveNodeSort, ( playlist_t *, playlist_item_t *,int, int ) );
00363
00364
00365 VLC_EXPORT( int, playlist_Import, ( playlist_t *, const char * ) );
00366 VLC_EXPORT( int, playlist_Export, ( playlist_t *, const char *, const char * ) );
00367
00368
00369
00370
00371
00372
00378 static inline vlc_bool_t playlist_IsPlaying( playlist_t * p_playlist )
00379 {
00380 vlc_bool_t b_playing;
00381
00382 vlc_mutex_lock( &p_playlist->object_lock );
00383 b_playing = p_playlist->status.i_status == PLAYLIST_RUNNING;
00384 vlc_mutex_unlock( &p_playlist->object_lock );
00385
00386 return( b_playing );
00387 }
00388
00394 static inline vlc_bool_t playlist_IsEmpty( playlist_t * p_playlist )
00395 {
00396 vlc_bool_t b_empty;
00397
00398 vlc_mutex_lock( &p_playlist->object_lock );
00399 b_empty = p_playlist->i_size == 0;
00400 vlc_mutex_unlock( &p_playlist->object_lock );
00401
00402 return( b_empty );
00403 }
00404
00405
00406