mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-14 08:15:02 -05:00
[player] Add commands to enable/disable output
This commit is contained in:
parent
93879c6f90
commit
decf9f1329
78
src/player.c
78
src/player.c
@ -2534,6 +2534,60 @@ speaker_set(void *arg, int *retval)
|
||||
return COMMAND_END;
|
||||
}
|
||||
|
||||
static enum command_state
|
||||
speaker_enable(void *arg, int *retval)
|
||||
{
|
||||
uint64_t *id = arg;
|
||||
struct output_device *device;
|
||||
|
||||
*retval = 0;
|
||||
|
||||
DPRINTF(E_DBG, L_PLAYER, "Speaker enable: %" PRIu64 "\n", *id);
|
||||
|
||||
*retval = 0;
|
||||
|
||||
for (device = dev_list; device; device = device->next)
|
||||
{
|
||||
if (*id == device->id)
|
||||
{
|
||||
*retval = speaker_activate(device);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (*retval > 0)
|
||||
return COMMAND_PENDING; // async
|
||||
|
||||
return COMMAND_END;
|
||||
}
|
||||
|
||||
static enum command_state
|
||||
speaker_disable(void *arg, int *retval)
|
||||
{
|
||||
uint64_t *id = arg;
|
||||
struct output_device *device;
|
||||
|
||||
*retval = 0;
|
||||
|
||||
DPRINTF(E_DBG, L_PLAYER, "Speaker disable: %" PRIu64 "\n", *id);
|
||||
|
||||
*retval = 0;
|
||||
|
||||
for (device = dev_list; device; device = device->next)
|
||||
{
|
||||
if (*id == device->id)
|
||||
{
|
||||
*retval = speaker_deactivate(device);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (*retval > 0)
|
||||
return COMMAND_PENDING; // async
|
||||
|
||||
return COMMAND_END;
|
||||
}
|
||||
|
||||
static enum command_state
|
||||
volume_set(void *arg, int *retval)
|
||||
{
|
||||
@ -2965,6 +3019,30 @@ player_speaker_set(uint64_t *ids)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
player_speaker_enable(uint64_t id)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = commands_exec_sync(cmdbase, speaker_enable, NULL, &id);
|
||||
|
||||
listener_notify(LISTENER_SPEAKER);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
player_speaker_disable(uint64_t id)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = commands_exec_sync(cmdbase, speaker_disable, NULL, &id);
|
||||
|
||||
listener_notify(LISTENER_SPEAKER);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
player_volume_set(int vol)
|
||||
{
|
||||
|
@ -95,6 +95,12 @@ player_speaker_enumerate(spk_enum_cb cb, void *arg);
|
||||
int
|
||||
player_speaker_set(uint64_t *ids);
|
||||
|
||||
int
|
||||
player_speaker_enable(uint64_t id);
|
||||
|
||||
int
|
||||
player_speaker_disable(uint64_t id);
|
||||
|
||||
void
|
||||
player_speaker_status_trigger(void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user