[player/dacp/mpd] Pass absolute volume to speaker enumerate callback and

add absolute volume to mpd 'outputs' command
This commit is contained in:
chme 2016-10-23 09:42:20 +02:00
parent a549f81861
commit bdb2c74934
4 changed files with 14 additions and 11 deletions

View File

@ -2294,7 +2294,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, struct spk_flags flags, void *arg)
speaker_enum_cb(uint64_t id, const char *name, int relvol, int absvol, struct spk_flags flags, void *arg)
{
struct evbuffer *evbuf;
int len;

View File

@ -3218,7 +3218,7 @@ mpd_command_rescan(struct evbuffer *evbuf, int argc, char **argv, char **errmsg)
* Adds a new struct output to the given struct outputs in *arg for the given speaker (id, name, etc.).
*/
static void
outputs_enum_cb(uint64_t id, const char *name, int relvol, struct spk_flags flags, void *arg)
outputs_enum_cb(uint64_t id, const char *name, int relvol, int absvol, struct spk_flags flags, void *arg)
{
struct outputs *outputs;
struct output *output;
@ -3528,21 +3528,24 @@ mpd_command_toggleoutput(struct evbuffer *evbuf, int argc, char **argv, char **e
* outputid: 0
* outputname: Computer
* outputenabled: 1
* outputvolume: 50
*/
static void
speaker_enum_cb(uint64_t id, const char *name, int relvol, struct spk_flags flags, void *arg)
speaker_enum_cb(uint64_t id, const char *name, int relvol, int absvol, struct spk_flags flags, void *arg)
{
struct evbuffer *evbuf;
evbuf = (struct evbuffer *)arg;
evbuffer_add_printf(evbuf,
"outputid: %d\n"
"outputname: %s\n"
"outputenabled: %d\n",
(unsigned short) id,
name,
flags.selected);
"outputid: %d\n"
"outputname: %s\n"
"outputenabled: %d\n"
"outputvolume: %d\n",
(unsigned short) id,
name,
flags.selected,
absvol);
}
/*

View File

@ -2724,7 +2724,7 @@ speaker_enumerate(void *arg, int *retval)
flags.has_password = device->has_password;
flags.has_video = device->has_video;
spk_enum->cb(device->id, device->name, device->relvol, flags, spk_enum->arg);
spk_enum->cb(device->id, device->name, device->relvol, device->volume, flags, spk_enum->arg);
#ifdef DEBUG_RELVOL
DPRINTF(E_DBG, L_PLAYER, "*** %s: abs %d rel %d\n", device->name, device->volume, device->relvol);

View File

@ -69,7 +69,7 @@ struct player_status {
int next_pos_pl;
};
typedef void (*spk_enum_cb)(uint64_t id, const char *name, int relvol, struct spk_flags flags, void *arg);
typedef void (*spk_enum_cb)(uint64_t id, const char *name, int relvol, int absvol, struct spk_flags flags, void *arg);
struct player_history
{