diff options
author | Max Kellermann <max@duempel.org> | 2009-11-03 21:08:48 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-01-10 19:46:23 +0100 |
commit | b6995ca0113611613d311250eabfc354658d46a7 (patch) | |
tree | 713bff7fe8b8dcbd48b2ea67f95e3ec9e018104b /src/dbUtils.c | |
parent | 715844fd089d3baf17d7080b47434fca8fb60b1d (diff) | |
download | mpd-b6995ca0113611613d311250eabfc354658d46a7.tar.gz mpd-b6995ca0113611613d311250eabfc354658d46a7.tar.xz mpd-b6995ca0113611613d311250eabfc354658d46a7.zip |
player_control: removed the global variable "pc"
Allocate a player_control object where needed, and pass it around.
Each "client" object is associated with a "player_control" instance.
This prepares multi-player support.
Diffstat (limited to 'src/dbUtils.c')
-rw-r--r-- | src/dbUtils.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/dbUtils.c b/src/dbUtils.c index 888e757a5..e9405093f 100644 --- a/src/dbUtils.c +++ b/src/dbUtils.c @@ -29,6 +29,7 @@ #include "tag.h" #include "strset.h" #include "stored_playlist.h" +#include "client_internal.h" #include <glib.h> @@ -166,9 +167,11 @@ int printAllIn(struct client *client, const char *name) } static int -directoryAddSongToPlaylist(struct song *song, G_GNUC_UNUSED void *data) +directoryAddSongToPlaylist(struct song *song, void *data) { - return playlist_append_song(&g_playlist, song, NULL); + struct player_control *pc = data; + + return playlist_append_song(&g_playlist, pc, song, NULL); } struct add_data { @@ -185,9 +188,10 @@ directoryAddSongToStoredPlaylist(struct song *song, void *_data) return 0; } -int addAllIn(const char *name) +int +addAllIn(struct player_control *pc, const char *name) { - return db_walk(name, directoryAddSongToPlaylist, NULL, NULL); + return db_walk(name, directoryAddSongToPlaylist, NULL, pc); } int addAllInToStoredPlaylist(const char *name, const char *utf8file) @@ -205,7 +209,9 @@ findAddInDirectory(struct song *song, void *_data) struct search_data *data = _data; if (locate_song_match(song, data->criteria)) - return playlist_append_song(&g_playlist, song, NULL); + return playlist_append_song(&g_playlist, + data->client->player_control, + song, NULL); return 0; } |