From b6995ca0113611613d311250eabfc354658d46a7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 3 Nov 2009 21:08:48 +0100 Subject: 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. --- src/dbUtils.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/dbUtils.c') 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 @@ -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; } -- cgit v1.2.3