mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-04-22 00:00:49 +00:00
Cleanup Pulseaudio code to allow server select using audio argument
This commit is contained in:
@@ -35,19 +35,19 @@ static short pcmBuffer[FRAME_SIZE * MAX_CHANNEL_COUNT];
|
|||||||
static int channelCount;
|
static int channelCount;
|
||||||
|
|
||||||
bool audio_pulse_init() {
|
bool audio_pulse_init() {
|
||||||
pa_sample_spec spec = {
|
pa_sample_spec spec = {
|
||||||
.format = PA_SAMPLE_S16LE,
|
.format = PA_SAMPLE_S16LE,
|
||||||
.rate = 44000,
|
.rate = 44000,
|
||||||
.channels = 2
|
.channels = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
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) {
|
|
||||||
pa_simple_free(dev);
|
if (dev)
|
||||||
return true;
|
pa_simple_free(dev);
|
||||||
} else
|
|
||||||
return false;
|
return (bool) dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
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));
|
||||||
|
|||||||
Reference in New Issue
Block a user