Cleanup Pulseaudio code to allow server select using audio argument

This commit is contained in:
Iwan Timmer
2017-05-10 15:58:32 +02:00
parent 45f9b0554e
commit 4bf3137bfc
+7 -12
View File
@@ -42,12 +42,12 @@ bool audio_pulse_init() {
}; };
int error; int error;
dev = pa_simple_new(NULL, "Moonlight Embedded", PA_STREAM_PLAYBACK, NULL, "Streaming", &spec, NULL, NULL, &error); dev = pa_simple_new(audio_device, "Moonlight Embedded", PA_STREAM_PLAYBACK, NULL, "Streaming", &spec, NULL, NULL, &error);
if (dev) {
if (dev)
pa_simple_free(dev); pa_simple_free(dev);
return true;
} else return (bool) dev;
return false;
} }
static void pulse_renderer_init(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig) { static void pulse_renderer_init(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig) {
@@ -69,12 +69,7 @@ static void pulse_renderer_init(int audioConfiguration, POPUS_MULTISTREAM_CONFIG
alsaMapping[5] = opusConfig->mapping[3]; alsaMapping[5] = opusConfig->mapping[3];
} }
decoder = opus_multistream_decoder_create(opusConfig->sampleRate, decoder = opus_multistream_decoder_create(opusConfig->sampleRate, opusConfig->channelCount, opusConfig->streams, opusConfig->coupledStreams, alsaMapping, &rc);
opusConfig->channelCount,
opusConfig->streams,
opusConfig->coupledStreams,
alsaMapping,
&rc);
pa_sample_spec spec = { pa_sample_spec spec = {
.format = PA_SAMPLE_S16LE, .format = PA_SAMPLE_S16LE,
@@ -82,7 +77,7 @@ static void pulse_renderer_init(int audioConfiguration, POPUS_MULTISTREAM_CONFIG
.channels = opusConfig->channelCount .channels = opusConfig->channelCount
}; };
dev = pa_simple_new(NULL, "Moonlight Embedded", PA_STREAM_PLAYBACK, NULL, "Streaming", &spec, NULL, NULL, &error); dev = pa_simple_new(audio_device, "Moonlight Embedded", PA_STREAM_PLAYBACK, NULL, "Streaming", &spec, NULL, NULL, &error);
if (!dev) { if (!dev) {
printf("Pulseaudio error: %s\n", pa_strerror(error)); printf("Pulseaudio error: %s\n", pa_strerror(error));