summaryrefslogtreecommitdiff
path: root/playlist.h
diff options
context:
space:
mode:
Diffstat (limited to 'playlist.h')
-rw-r--r--playlist.h66
1 files changed, 43 insertions, 23 deletions
diff --git a/playlist.h b/playlist.h
index ac49fa63..c168c4aa 100644
--- a/playlist.h
+++ b/playlist.h
@@ -31,7 +31,8 @@ typedef struct metaInfo_s {
typedef struct playItem_s {
char *fname; // full pathname
- struct DB_decoder_s *decoder; // codec to use with this file
+// struct DB_decoder_s *decoder; // codec to use with this file
+ const char *decoder_id;
int tracknum; // used for stuff like sid, nsf, cue (will be ignored by most codecs)
int startsample;
int endsample;
@@ -45,6 +46,7 @@ typedef struct playItem_s {
float replaygain_track_peak;
// private area, must not be visible to plugins
float _duration; // in seconds
+ int _refc;
struct playItem_s *next[PL_MAX_ITERATORS]; // next item in linked list
struct playItem_s *prev[PL_MAX_ITERATORS]; // prev item in linked list
struct metaInfo_s *meta; // linked list storing metainfo
@@ -53,11 +55,37 @@ typedef struct playItem_s {
unsigned in_playlist : 1; // 1 if item is in playlist
} playItem_t;
-extern playItem_t *playlist_head[PL_MAX_ITERATORS]; // head of linked list
-extern playItem_t *playlist_tail[PL_MAX_ITERATORS]; // tail of linked list
-extern int playlist_current_row[PL_MAX_ITERATORS]; // current row (cursor)
-extern playItem_t *playlist_current_ptr; // pointer to a real current playlist item (or NULL)
+typedef struct playlist_s{
+ char *title;
+ playItem_t *head[PL_MAX_ITERATORS]; // head of linked list
+ playItem_t *tail[PL_MAX_ITERATORS]; // tail of linked list
+ int current_row[PL_MAX_ITERATORS]; // current row (cursor)
+ struct playlist_s *next;
+} playlist_t;
+// playlist management functions
+int
+plt_get_count (void);
+
+void
+plt_add (int before, const char *title);
+
+void
+plt_remove (int plt);
+
+void
+plt_free (void);
+
+void
+plt_set_curr (int plt);
+
+int
+plt_get_curr (void);
+
+playlist_t *
+plt_get_curr_ptr (void);
+
+// playlist access functions
int
pl_add_dir (const char *dirname, int (*cb)(playItem_t *it, void *data), void *user_data);
@@ -80,7 +108,13 @@ playItem_t *
pl_item_alloc (void);
void
-pl_item_free (playItem_t *it);
+pl_item_ref (playItem_t *it);
+
+void
+pl_item_unref (playItem_t *it);
+
+//void
+//pl_item_free (playItem_t *it);
void
pl_item_copy (playItem_t *out, playItem_t *it);
@@ -109,20 +143,6 @@ pl_insert_cue_from_buffer (playItem_t *after, playItem_t *origin, const uint8_t
playItem_t *
pl_insert_cue (playItem_t *after, playItem_t *origin, int numsamples, int samplerate);
-//int
-//pl_set_current (playItem_t *it);
-
-// returns -1 if theres no next song, or playlist finished
-// reason 0 means "song finished", 1 means "user clicked next"
-int
-pl_nextsong (int reason);
-
-int
-pl_prevsong (void);
-
-int
-pl_randomsong (void);
-
void
pl_add_meta (playItem_t *it, const char *key, const char *value);
@@ -175,9 +195,6 @@ pl_reset_cursor (void);
float
pl_get_totaltime (void);
-playItem_t *
-pl_getcurrent (void);
-
void
pl_set_selected (playItem_t *it, int sel);
@@ -233,4 +250,7 @@ pl_playqueue_test (playItem_t *it);
playItem_t *
pl_playqueue_getnext (void);
+int
+pl_playqueue_getcount (void);
+
#endif // __PLAYLIST_H