From 06fa6033f04eee67b5abdbad23df911d48cb33b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sat, 8 Jun 2024 18:44:15 +0800 Subject: [PATCH] Sound (Linux): trim white spaces in device name Fix #1005 --- src/detection/sound/sound_linux.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/detection/sound/sound_linux.c b/src/detection/sound/sound_linux.c index f42ea3a79..906792cc7 100644 --- a/src/detection/sound/sound_linux.c +++ b/src/detection/sound/sound_linux.c @@ -13,7 +13,10 @@ static void paSinkInfoCallback(pa_context *c, const pa_sink_info *i, int eol, vo FFSoundDevice* device = ffListAdd(userdata); ffStrbufInitS(&device->identifier, i->name); + ffStrbufTrimRightSpace(&device->identifier); ffStrbufInitS(&device->name, i->description); + ffStrbufTrimRightSpace(&device->name); + ffStrbufTrimLeft(&device->name, ' '); device->volume = i->mute ? 0 : (uint8_t) (i->volume.values[0] * 100 / PA_VOLUME_NORM); device->active = i->active_port && i->active_port->available != PA_PORT_AVAILABLE_NO; device->main = false;