Sound (Linux): trim white spaces in device name

Fix #1005
This commit is contained in:
李通洲
2024-06-08 18:44:15 +08:00
parent f058d70d89
commit 06fa6033f0
+3
View File
@@ -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;