diff --git a/src/httpd_dacp.c b/src/httpd_dacp.c index 67407395..ed9bdcbd 100644 --- a/src/httpd_dacp.c +++ b/src/httpd_dacp.c @@ -1344,7 +1344,7 @@ dacp_reply_setproperty(struct evhttp_request *req, struct evbuffer *evbuf, char } static void -speaker_enum_cb(uint64_t id, const char *name, int relvol, int selected, int has_password, void *arg) +speaker_enum_cb(uint64_t id, const char *name, int relvol, struct spk_flags flags, void *arg) { struct evbuffer *evbuf; int len; @@ -1352,15 +1352,15 @@ speaker_enum_cb(uint64_t id, const char *name, int relvol, int selected, int has evbuf = (struct evbuffer *)arg; len = 8 + strlen(name) + 28; - if (selected) + if (flags.selected) len += 9; - if (has_password) + if (flags.has_password) len += 9; dmap_add_container(evbuf, "mdcl", len); /* 8 + len */ - if (selected) + if (flags.selected) dmap_add_char(evbuf, "caia", 1); /* 9 */ - if (has_password) + if (flags.has_password) dmap_add_char(evbuf, "cahp", 1); /* 9 */ dmap_add_string(evbuf, "minm", name); /* 8 + len */ dmap_add_long(evbuf, "msma", id); /* 16 */ diff --git a/src/player.c b/src/player.c index 22cb97a4..4a3e7107 100644 --- a/src/player.c +++ b/src/player.c @@ -2385,6 +2385,7 @@ speaker_enumerate(struct player_command *cmd) { struct raop_device *rd; struct spk_enum *spk_enum; + struct spk_flags flags; char *laudio_name; spk_enum = cmd->arg.spk_enum; @@ -2395,7 +2396,10 @@ speaker_enumerate(struct player_command *cmd) if (!dev_list && !laudio_selected) speaker_select_laudio(); - spk_enum->cb(0, laudio_name, laudio_relvol, laudio_selected, 0, spk_enum->arg); + flags.selected = laudio_selected; + flags.has_password = 0; + + spk_enum->cb(0, laudio_name, laudio_relvol, flags, spk_enum->arg); #ifdef DEBUG_RELVOL DPRINTF(E_DBG, L_PLAYER, "*** master: %d\n", master_volume); @@ -2406,7 +2410,10 @@ speaker_enumerate(struct player_command *cmd) { if (rd->advertised || rd->selected) { - spk_enum->cb(rd->id, rd->name, rd->relvol, rd->selected, rd->has_password, spk_enum->arg); + flags.selected = rd->selected; + flags.has_password = rd->has_password; + + spk_enum->cb(rd->id, rd->name, rd->relvol, flags, spk_enum->arg); #ifdef DEBUG_RELVOL DPRINTF(E_DBG, L_PLAYER, "*** %s: abs %d rel %d\n", rd->name, rd->volume, rd->relvol); diff --git a/src/player.h b/src/player.h index f661422d..1ca327cf 100644 --- a/src/player.h +++ b/src/player.h @@ -32,6 +32,11 @@ enum repeat_mode { REPEAT_ALL = 2, }; +struct spk_flags { + unsigned selected:1; + unsigned has_password:1; +}; + struct player_status { enum play_status status; enum repeat_mode repeat; @@ -45,7 +50,7 @@ struct player_status { int pos_pl; }; -typedef void (*spk_enum_cb)(uint64_t id, const char *name, int relvol, int selected, int has_password, void *arg); +typedef void (*spk_enum_cb)(uint64_t id, const char *name, int relvol, struct spk_flags flags, void *arg); typedef void (*player_status_handler)(void); struct player_source;