[pulseaudio] allow specification of pulseaudio server

This commit is contained in:
Wolfgang Scherer 2017-11-05 05:59:56 +01:00
parent 04dc5956ed
commit 540d771648
3 changed files with 12 additions and 2 deletions

View File

@ -177,6 +177,12 @@ audio {
# Type of the output (alsa, pulseaudio, dummy or disabled)
# type = "alsa"
# For pulseaudio output, an optional server can be specified.
# See http://billauer.co.il/blog/2014/01/pa-multiple-users/
# for an example how to set up access to the daemon started
# by a logged-in user.
# server = "localhost"
# Audio PCM device name for local audio output - ALSA only
# card = "default"

View File

@ -104,6 +104,7 @@ static cfg_opt_t sec_audio[] =
{
CFG_STR("nickname", "Computer", CFGF_NONE),
CFG_STR("type", NULL, CFGF_NONE),
CFG_STR("server", NULL, CFGF_NONE),
CFG_STR("card", "default", CFGF_NONE),
CFG_STR("mixer", NULL, CFGF_NONE),
CFG_STR("mixer_device", NULL, CFGF_NONE),

View File

@ -891,6 +891,7 @@ static int
pulse_init(void)
{
char *type;
char *server;
int state;
int ret;
@ -898,6 +899,8 @@ pulse_init(void)
if (type && (strcasecmp(type, "pulseaudio") != 0))
return -1;
server = cfg_getstr(cfg_getsec(cfg, "audio"), "server");
ret = 0;
if (!(pulse.mainloop = pa_threaded_mainloop_new()))
@ -914,8 +917,8 @@ pulse_init(void)
goto fail;
pa_context_set_state_callback(pulse.context, context_state_cb, NULL);
if (pa_context_connect(pulse.context, NULL, 0, NULL) < 0)
if (pa_context_connect(pulse.context, server, 0, NULL) < 0)
{
ret = pa_context_errno(pulse.context);
goto fail;