Add EngineDevice class

This commit is contained in:
Jonas Kvinge
2023-06-01 19:31:19 +02:00
parent a1dbbba1a1
commit 315073f9a7
20 changed files with 170 additions and 111 deletions

View File

@@ -30,8 +30,8 @@
#include <QString>
#include "core/logging.h"
#include "devicefinder.h"
#include "pulsedevicefinder.h"
#include "enginedevice.h"
PulseDeviceFinder::PulseDeviceFinder() : DeviceFinder("pulseaudio", { "pulseaudio", "pulse", "pulsesink" }), mainloop_(nullptr), context_(nullptr) {}
@@ -80,10 +80,10 @@ bool PulseDeviceFinder::Reconnect() {
}
}
DeviceFinder::DeviceList PulseDeviceFinder::ListDevices() {
EngineDeviceList PulseDeviceFinder::ListDevices() {
if (!context_ || pa_context_get_state(context_) != PA_CONTEXT_READY) {
return DeviceList();
return EngineDeviceList();
}
retry:
@@ -121,12 +121,12 @@ void PulseDeviceFinder::GetSinkInfoCallback(pa_context *c, const pa_sink_info *i
if (!state) return;
if (info) {
Device dev;
dev.description = QString::fromUtf8(info->description);
dev.value = QString::fromUtf8(info->name);
dev.iconname = GuessIconName(dev.description);
EngineDevice device;
device.description = QString::fromUtf8(info->description);
device.value = QString::fromUtf8(info->name);
device.iconname = device.GuessIconName();
state->devices.append(dev);
state->devices.append(device);
}
if (eol > 0) {