Use audio_output { name } for the stream name in PulseAudio
git-svn-id: https://svn.musicpd.org/mpd/trunk@4340 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
06a0085700
commit
e4b0fcf8e0
@ -23,7 +23,6 @@
|
|||||||
#ifdef HAVE_PULSE
|
#ifdef HAVE_PULSE
|
||||||
|
|
||||||
#define MPD_PULSE_NAME "mpd"
|
#define MPD_PULSE_NAME "mpd"
|
||||||
#define MPD_PULSE_STREAM_NAME "mpd"
|
|
||||||
|
|
||||||
#include "../conf.h"
|
#include "../conf.h"
|
||||||
#include "../log.h"
|
#include "../log.h"
|
||||||
@ -34,6 +33,7 @@
|
|||||||
typedef struct _PulseData {
|
typedef struct _PulseData {
|
||||||
char * server;
|
char * server;
|
||||||
char * sink;
|
char * sink;
|
||||||
|
char * name;
|
||||||
pa_simple * s;
|
pa_simple * s;
|
||||||
} PulseData;
|
} PulseData;
|
||||||
|
|
||||||
@ -44,6 +44,7 @@ static PulseData * newPulseData()
|
|||||||
ret = malloc(sizeof(PulseData));
|
ret = malloc(sizeof(PulseData));
|
||||||
ret->server = NULL;
|
ret->server = NULL;
|
||||||
ret->sink = NULL;
|
ret->sink = NULL;
|
||||||
|
ret->name = NULL;
|
||||||
ret->s = NULL;
|
ret->s = NULL;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -52,6 +53,7 @@ static void freePulseData(PulseData * ad)
|
|||||||
{
|
{
|
||||||
if (ad->server) free(ad->server);
|
if (ad->server) free(ad->server);
|
||||||
if (ad->sink) free(ad->sink);
|
if (ad->sink) free(ad->sink);
|
||||||
|
if (ad->name) free(ad->name);
|
||||||
free(ad);
|
free(ad);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,16 +61,19 @@ static int pulse_initDriver(AudioOutput * audioOutput, ConfigParam * param)
|
|||||||
{
|
{
|
||||||
BlockParam * server = NULL;
|
BlockParam * server = NULL;
|
||||||
BlockParam * sink = NULL;
|
BlockParam * sink = NULL;
|
||||||
|
BlockParam * name = NULL;
|
||||||
PulseData * ad;
|
PulseData * ad;
|
||||||
|
|
||||||
if (param) {
|
if (param) {
|
||||||
server = getBlockParam(param, "server");
|
server = getBlockParam(param, "server");
|
||||||
sink = getBlockParam(param, "sink");
|
sink = getBlockParam(param, "sink");
|
||||||
|
name = getBlockParam(param, "name");
|
||||||
}
|
}
|
||||||
|
|
||||||
ad = newPulseData();
|
ad = newPulseData();
|
||||||
ad->server = server ? strdup(server->value) : NULL;
|
ad->server = server ? strdup(server->value) : NULL;
|
||||||
ad->sink = sink ? strdup(sink->value) : NULL;
|
ad->sink = sink ? strdup(sink->value) : NULL;
|
||||||
|
ad->name = strdup(name->value);
|
||||||
audioOutput->data = ad;
|
audioOutput->data = ad;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -90,7 +95,7 @@ static int pulse_testDefault()
|
|||||||
ss.channels = 2;
|
ss.channels = 2;
|
||||||
|
|
||||||
s = pa_simple_new(NULL, MPD_PULSE_NAME, PA_STREAM_PLAYBACK, NULL,
|
s = pa_simple_new(NULL, MPD_PULSE_NAME, PA_STREAM_PLAYBACK, NULL,
|
||||||
MPD_PULSE_STREAM_NAME, &ss, NULL, NULL, &error);
|
MPD_PULSE_NAME, &ss, NULL, NULL, &error);
|
||||||
if (!s) {
|
if (!s) {
|
||||||
WARNING("Cannot connect to default PulseAudio server: %s\n",
|
WARNING("Cannot connect to default PulseAudio server: %s\n",
|
||||||
pa_strerror(error));
|
pa_strerror(error));
|
||||||
@ -123,8 +128,7 @@ static int pulse_openDevice(AudioOutput * audioOutput)
|
|||||||
ss.channels = audioFormat->channels;
|
ss.channels = audioFormat->channels;
|
||||||
|
|
||||||
ad->s = pa_simple_new(ad->server, MPD_PULSE_NAME, PA_STREAM_PLAYBACK,
|
ad->s = pa_simple_new(ad->server, MPD_PULSE_NAME, PA_STREAM_PLAYBACK,
|
||||||
ad->sink, MPD_PULSE_STREAM_NAME, &ss,
|
ad->sink, ad->name, &ss, NULL, NULL, &error);
|
||||||
NULL, NULL, &error);
|
|
||||||
if (!ad->s) {
|
if (!ad->s) {
|
||||||
ERROR("Cannot connect to server in PulseAudio output " \
|
ERROR("Cannot connect to server in PulseAudio output " \
|
||||||
"\"%s\": %s\n", audioOutput->name, pa_strerror(error));
|
"\"%s\": %s\n", audioOutput->name, pa_strerror(error));
|
||||||
|
Loading…
Reference in New Issue
Block a user