aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/qsa.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-09-07 22:02:37 -0700
committerChris Robinson <[email protected]>2018-09-07 22:02:37 -0700
commit46cfedb1171ace7c21bd1d95c1c75a8274892d3d (patch)
treeee65f558b5436a6e4d9a5ae188b56238c5fc5453 /Alc/backends/qsa.c
parent212cb8e298ccfd42e8d44cc2a20108513507e29e (diff)
Pass the device name list to the backend probe method
Diffstat (limited to 'Alc/backends/qsa.c')
-rw-r--r--Alc/backends/qsa.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/Alc/backends/qsa.c b/Alc/backends/qsa.c
index 8f87779b..81645096 100644
--- a/Alc/backends/qsa.c
+++ b/Alc/backends/qsa.c
@@ -119,6 +119,9 @@ static void deviceList(int type, vector_DevMap *devmap)
if(max_cards < 0)
return;
+#define FREE_NAME(iter) free((iter)->name)
+ VECTOR_FOR_EACH(DevMap, *devmap, FREE_NAME);
+#undef FREE_NAME
VECTOR_RESIZE(*devmap, 0, max_cards+1);
entry.name = strdup(qsaDevice);
@@ -989,7 +992,7 @@ typedef struct ALCqsaBackendFactory {
static ALCboolean ALCqsaBackendFactory_init(ALCqsaBackendFactory* UNUSED(self));
static void ALCqsaBackendFactory_deinit(ALCqsaBackendFactory* UNUSED(self));
static ALCboolean ALCqsaBackendFactory_querySupport(ALCqsaBackendFactory* UNUSED(self), ALCbackend_Type type);
-static void ALCqsaBackendFactory_probe(ALCqsaBackendFactory* UNUSED(self), enum DevProbe type);
+static void ALCqsaBackendFactory_probe(ALCqsaBackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames);
static ALCbackend* ALCqsaBackendFactory_createBackend(ALCqsaBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type);
DEFINE_ALCBACKENDFACTORY_VTABLE(ALCqsaBackendFactory);
@@ -1016,33 +1019,25 @@ static ALCboolean ALCqsaBackendFactory_querySupport(ALCqsaBackendFactory* UNUSED
return ALC_FALSE;
}
-static void ALCqsaBackendFactory_probe(ALCqsaBackendFactory* UNUSED(self), enum DevProbe type)
+static void ALCqsaBackendFactory_probe(ALCqsaBackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames)
{
switch (type)
{
+#define APPEND_OUTNAME(e) do { \
+ const char *n_ = (e)->name; \
+ if(n_ && n_[0]) \
+ alstr_append_range(outnames, n_, n_+strlen(n_)+1); \
+} while(0)
case ALL_DEVICE_PROBE:
-#define FREE_NAME(iter) free((iter)->name)
- VECTOR_FOR_EACH(DevMap, DeviceNameMap, FREE_NAME);
- VECTOR_RESIZE(DeviceNameMap, 0, 0);
-#undef FREE_NAME
-
deviceList(SND_PCM_CHANNEL_PLAYBACK, &DeviceNameMap);
-#define APPEND_DEVICE(iter) AppendAllDevicesList((iter)->name)
- VECTOR_FOR_EACH(const DevMap, DeviceNameMap, APPEND_DEVICE);
-#undef APPEND_DEVICE
+ VECTOR_FOR_EACH(const DevMap, DeviceNameMap, APPEND_OUTNAME);
break;
case CAPTURE_DEVICE_PROBE:
-#define FREE_NAME(iter) free((iter)->name)
- VECTOR_FOR_EACH(DevMap, CaptureNameMap, FREE_NAME);
- VECTOR_RESIZE(CaptureNameMap, 0, 0);
-#undef FREE_NAME
-
deviceList(SND_PCM_CHANNEL_CAPTURE, &CaptureNameMap);
-#define APPEND_DEVICE(iter) AppendCaptureDeviceList((iter)->name)
- VECTOR_FOR_EACH(const DevMap, CaptureNameMap, APPEND_DEVICE);
-#undef APPEND_DEVICE
+ VECTOR_FOR_EACH(const DevMap, CaptureNameMap, APPEND_OUTNAME);
break;
+#undef APPEND_OUTNAME
}
}