mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-12 23:42:32 -04:00
[mpd] add "plugin" to outputs response
The plugin key is used by some clients to determine whether local playback is possible via HTTP stream, so mimick it. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
This commit is contained in:
parent
b2a957cdec
commit
5e68381fe4
18
src/mpd.c
18
src/mpd.c
@ -25,6 +25,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -3734,22 +3735,39 @@ mpd_command_toggleoutput(struct evbuffer *evbuf, int argc, char **argv, char **e
|
|||||||
* Example output:
|
* Example output:
|
||||||
* outputid: 0
|
* outputid: 0
|
||||||
* outputname: Computer
|
* outputname: Computer
|
||||||
|
* plugin: alsa
|
||||||
* outputenabled: 1
|
* outputenabled: 1
|
||||||
* outputvolume: 50
|
* outputvolume: 50
|
||||||
|
* https://mpd.readthedocs.io/en/latest/protocol.html#audio-output-devices
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
speaker_enum_cb(struct player_speaker_info *spk, void *arg)
|
speaker_enum_cb(struct player_speaker_info *spk, void *arg)
|
||||||
{
|
{
|
||||||
struct output_outputs_param *param = arg;
|
struct output_outputs_param *param = arg;
|
||||||
struct evbuffer *evbuf = param->buf;
|
struct evbuffer *evbuf = param->buf;
|
||||||
|
char plugin[sizeof(spk->output_type)];
|
||||||
|
char *p;
|
||||||
|
char *q;
|
||||||
|
|
||||||
|
/* MPD outputs lowercase plugin (audio_output:type) so convert to
|
||||||
|
* lowercase, convert spaces to underscores to make it a single word */
|
||||||
|
for (p = spk->output_type, q = plugin; *p != '\0'; p++, q++)
|
||||||
|
{
|
||||||
|
*q = tolower(*p);
|
||||||
|
if (*q == ' ')
|
||||||
|
*q = '_';
|
||||||
|
}
|
||||||
|
*q = '\0';
|
||||||
|
|
||||||
evbuffer_add_printf(evbuf,
|
evbuffer_add_printf(evbuf,
|
||||||
"outputid: %u\n"
|
"outputid: %u\n"
|
||||||
"outputname: %s\n"
|
"outputname: %s\n"
|
||||||
|
"plugin: %s\n"
|
||||||
"outputenabled: %d\n"
|
"outputenabled: %d\n"
|
||||||
"outputvolume: %d\n",
|
"outputvolume: %d\n",
|
||||||
param->nextid,
|
param->nextid,
|
||||||
spk->name,
|
spk->name,
|
||||||
|
plugin,
|
||||||
spk->selected,
|
spk->selected,
|
||||||
spk->absvol);
|
spk->absvol);
|
||||||
param->nextid++;
|
param->nextid++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user