From fbe135fb60af69a548e4bacf3f81818b2ce8c0d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Via=C4=8Das=C5=82a=C5=AD?= Date: Sat, 21 Dec 2024 05:51:48 +0300 Subject: [PATCH] Fix displaying PipeWire help label, styling (#17274) Update README --- README.md | 1 + audio/drivers/pipewire.c | 23 ++++++++++------------- intl/msg_hash_lbl.h | 4 ++++ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 42bbe2e3e9..9a946727e6 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,7 @@ RetroArch needs at least one of these audio driver libraries: - JACK - SDL - PulseAudio + - PipeWire - XAudio2 (Win32, Xbox 360) - DirectSound (Win32, Xbox 1) - CoreAudio (OSX, iOS) diff --git a/audio/drivers/pipewire.c b/audio/drivers/pipewire.c index 635d4799ed..55efc791aa 100644 --- a/audio/drivers/pipewire.c +++ b/audio/drivers/pipewire.c @@ -33,6 +33,7 @@ #include "../audio_driver.h" #include "../../verbosity.h" + #define APPNAME "RetroArch" #define DEFAULT_CHANNELS 2 #define QUANTUM 1024 /* TODO: detect */ @@ -68,11 +69,8 @@ typedef struct void clear_buf(void *buf, int len) { - if (!len) - return; - - memset(buf, 0x00, len); - return; + if (len) + memset(buf, 0x00, len); } size_t calc_frame_size(enum spa_audio_format fmt, uint32_t nchannels) @@ -305,10 +303,10 @@ static void registry_event_global(void *data, uint32_t id, uint32_t permissions, const char *type, uint32_t version, const struct spa_dict *props) { - pw_t *pw = (pw_t*)data; union string_list_elem_attr attr; - const char* media = NULL; - const char* sink = NULL; + pw_t *pw = (pw_t*)data; + const char *media = NULL; + const char *sink = NULL; if (!pw) return; @@ -356,13 +354,13 @@ static void *pipewire_init(const char *device, unsigned rate, unsigned *new_rate) { int res; + uint64_t buf_samples; const struct spa_pod *params[1]; uint8_t buffer[1024]; struct pw_properties *props = NULL; const char *error = NULL; pw_t *pw = (pw_t*)calloc(1, sizeof(*pw)); struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer)); - uint64_t buf_samples; if (!pw) goto error; @@ -487,11 +485,11 @@ static bool pipewire_start(void *data, bool is_shutdown); static ssize_t pipewire_write(void *data, const void *buf_, size_t size) { - pw_t *pw = (pw_t*)data; - const char *error = NULL; - int32_t writable; + int32_t writable; int32_t avail; uint32_t index; + pw_t *pw = (pw_t*)data; + const char *error = NULL; /* Workaround buggy menu code. * If a write happens while we're paused, we might never progress. */ @@ -575,7 +573,6 @@ static bool pipewire_start(void *data, bool is_shutdown) static bool pipewire_alive(void *data) { pw_t *pw = (pw_t*)data; - if (!pw) return false; return !pw->is_paused; diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index e73ba3027b..7fa421a1ca 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -177,6 +177,10 @@ MSG_HASH( MENU_ENUM_LABEL_AUDIO_DRIVER_PULSE, "pulse" ) +MSG_HASH( + MENU_ENUM_LABEL_AUDIO_DRIVER_PIPEWIRE, + "pipewire" + ) MSG_HASH( MENU_ENUM_LABEL_AUDIO_DRIVER_EXT, "ext"