aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-02-04 18:56:41 +0100
committerMax Kellermann <max@duempel.org>2009-02-04 18:56:41 +0100
commit8d3205871cf398c4e187bb0d1ead28c46a25a8c1 (patch)
treed50a3219a796cff081316d9a31d6bb4f9edc2d2c /src/playlist.h
parent1720c7090dc3d590ffe1b5175e175143c09266f8 (diff)
downloadmpd-8d3205871cf398c4e187bb0d1ead28c46a25a8c1.tar.gz
mpd-8d3205871cf398c4e187bb0d1ead28c46a25a8c1.tar.xz
mpd-8d3205871cf398c4e187bb0d1ead28c46a25a8c1.zip
playlist: renamed global "playlist" variable to "g_playlist"
Export the "g_playlist" variable, and pass it to all playlist functions. This way, we can split playlist.c easier into separate parts. The code which initializes the singleton variable is moved to playlist_global.c.
Diffstat (limited to '')
-rw-r--r--src/playlist.h98
1 files changed, 66 insertions, 32 deletions
diff --git a/src/playlist.h b/src/playlist.h
index 632ddfc76..186ac7548 100644
--- a/src/playlist.h
+++ b/src/playlist.h
@@ -83,21 +83,36 @@ struct playlist {
int queued;
};
+/** the global playlist object */
+extern struct playlist g_playlist;
+
void initPlaylist(void);
void finishPlaylist(void);
+void
+playlist_init(struct playlist *playlist);
+
+void
+playlist_finish(struct playlist *playlist);
+
+void
+playlist_tag_changed(struct playlist *playlist);
+
/**
* Returns the "queue" object of the global playlist instance.
*/
-const struct queue *
-playlist_get_queue(void);
+static inline const struct queue *
+playlist_get_queue(const struct playlist *playlist)
+{
+ return &playlist->queue;
+}
void readPlaylistState(FILE *);
void savePlaylistState(FILE *);
-void clearPlaylist(void);
+void clearPlaylist(struct playlist *playlist);
#ifndef WIN32
/**
@@ -105,66 +120,85 @@ void clearPlaylist(void);
* but only if the file's owner is equal to the specified uid.
*/
enum playlist_result
-playlist_append_file(const char *path, int uid, unsigned *added_id);
+playlist_append_file(struct playlist *playlist, const char *path, int uid,
+ unsigned *added_id);
#endif
-enum playlist_result addToPlaylist(const char *file, unsigned *added_id);
+enum playlist_result
+addToPlaylist(struct playlist *playlist, const char *file, unsigned *added_id);
enum playlist_result
-addSongToPlaylist(struct song *song, unsigned *added_id);
+addSongToPlaylist(struct playlist *playlist,
+ struct song *song, unsigned *added_id);
-enum playlist_result deleteFromPlaylist(unsigned song);
+enum playlist_result
+deleteFromPlaylist(struct playlist *playlist, unsigned song);
-enum playlist_result deleteFromPlaylistById(unsigned song);
+enum playlist_result
+deleteFromPlaylistById(struct playlist *playlist, unsigned song);
-void stopPlaylist(void);
+void stopPlaylist(struct playlist *playlist);
-enum playlist_result playPlaylist(int song);
+enum playlist_result
+playPlaylist(struct playlist *playlist, int song);
-enum playlist_result playPlaylistById(int song);
+enum playlist_result
+playPlaylistById(struct playlist *playlist, int song);
-void nextSongInPlaylist(void);
+void nextSongInPlaylist(struct playlist *playlist);
-void syncPlayerAndPlaylist(void);
+void syncPlayerAndPlaylist(struct playlist *playlist);
-void previousSongInPlaylist(void);
+void previousSongInPlaylist(struct playlist *playlist);
-void shufflePlaylist(void);
+void shufflePlaylist(struct playlist *playlist);
-enum playlist_result savePlaylist(const char *utf8file);
+enum playlist_result
+savePlaylist(struct playlist *playlist, const char *utf8file);
void
-deleteASongFromPlaylist(const struct song *song);
+deleteASongFromPlaylist(struct playlist *playlist, const struct song *song);
-enum playlist_result moveSongInPlaylist(unsigned from, int to);
+enum playlist_result
+moveSongInPlaylist(struct playlist *playlist, unsigned from, int to);
-enum playlist_result moveSongInPlaylistById(unsigned id, int to);
+enum playlist_result
+moveSongInPlaylistById(struct playlist *playlist, unsigned id, int to);
-enum playlist_result swapSongsInPlaylist(unsigned song1, unsigned song2);
+enum playlist_result
+swapSongsInPlaylist(struct playlist *playlist, unsigned song1, unsigned song2);
-enum playlist_result swapSongsInPlaylistById(unsigned id1, unsigned id2);
+enum playlist_result
+swapSongsInPlaylistById(struct playlist *playlist, unsigned id1, unsigned id2);
-bool getPlaylistRepeatStatus(void);
+bool
+getPlaylistRepeatStatus(struct playlist *playlist);
-void setPlaylistRepeatStatus(bool status);
+void setPlaylistRepeatStatus(struct playlist *playlist, bool status);
-bool getPlaylistRandomStatus(void);
+bool
+getPlaylistRandomStatus(struct playlist *playlist);
-void setPlaylistRandomStatus(bool status);
+void setPlaylistRandomStatus(struct playlist *playlist, bool status);
-int getPlaylistCurrentSong(void);
+int getPlaylistCurrentSong(struct playlist *playlist);
-unsigned getPlaylistSongId(unsigned song);
+unsigned
+getPlaylistSongId(struct playlist *playlist, unsigned song);
-int getPlaylistLength(void);
+int getPlaylistLength(struct playlist *playlist);
-unsigned long getPlaylistVersion(void);
+unsigned long
+getPlaylistVersion(struct playlist *playlist);
-enum playlist_result seekSongInPlaylist(unsigned song, float seek_time);
+enum playlist_result
+seekSongInPlaylist(struct playlist *playlist, unsigned song, float seek_time);
-enum playlist_result seekSongInPlaylistById(unsigned id, float seek_time);
+enum playlist_result
+seekSongInPlaylistById(struct playlist *playlist,
+ unsigned id, float seek_time);
-void playlistVersionChange(void);
+void playlistVersionChange(struct playlist *playlist);
int is_valid_playlist_name(const char *utf8path);