aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/oss.c64
1 files changed, 38 insertions, 26 deletions
diff --git a/Alc/backends/oss.c b/Alc/backends/oss.c
index 432c75f2..689a5c71 100644
--- a/Alc/backends/oss.c
+++ b/Alc/backends/oss.c
@@ -88,7 +88,7 @@ static struct oss_device oss_capture = {
#ifdef ALC_OSS_COMPAT
-static void ALCossListPopulate(struct oss_device *UNUSED(playback), struct oss_device *UNUSED(capture))
+static void ALCossListPopulate(struct oss_device *UNUSED(devlist), int UNUSED(type_flag))
{
}
@@ -153,7 +153,7 @@ static void ALCossListAppend(struct oss_device *list, const char *handle, size_t
TRACE("Got device \"%s\", \"%s\"\n", next->handle, next->path);
}
-static void ALCossListPopulate(struct oss_device *playback, struct oss_device *capture)
+static void ALCossListPopulate(struct oss_device *devlist, int type_flag)
{
struct oss_sysinfo si;
struct oss_audioinfo ai;
@@ -193,10 +193,9 @@ static void ALCossListPopulate(struct oss_device *playback, struct oss_device *c
len = strnlen(ai.name, sizeof(ai.name));
handle = ai.name;
}
- if((ai.caps&DSP_CAP_INPUT) && capture != NULL)
- ALCossListAppend(capture, handle, len, ai.devnode, strnlen(ai.devnode, sizeof(ai.devnode)));
- if((ai.caps&DSP_CAP_OUTPUT) && playback != NULL)
- ALCossListAppend(playback, handle, len, ai.devnode, strnlen(ai.devnode, sizeof(ai.devnode)));
+ if((ai.caps&type_flag))
+ ALCossListAppend(devlist, handle, len, ai.devnode,
+ strnlen(ai.devnode, sizeof(ai.devnode)));
}
done:
@@ -320,18 +319,26 @@ static ALCenum ALCplaybackOSS_open(ALCplaybackOSS *self, const ALCchar *name)
struct oss_device *dev = &oss_playback;
ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
- if(!name)
+ if(!name || strcmp(name, dev->handle) == 0)
name = dev->handle;
else
{
- while (dev != NULL)
+ if(!dev->next)
+ {
+ ALCossListPopulate(&oss_playback, DSP_CAP_OUTPUT);
+ dev = &oss_playback;
+ }
+ while(dev != NULL)
{
if (strcmp(dev->handle, name) == 0)
break;
dev = dev->next;
}
- if (dev == NULL)
+ if(dev == NULL)
+ {
+ WARN("Could not find \"%s\" in device list\n", name);
return ALC_INVALID_VALUE;
+ }
}
self->killNow = 0;
@@ -574,18 +581,26 @@ static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name)
int ossSpeed;
char *err;
- if(!name)
+ if(!name || strcmp(name, dev->handle) == 0)
name = dev->handle;
else
{
- while (dev != NULL)
+ if(!dev->next)
+ {
+ ALCossListPopulate(&oss_capture, DSP_CAP_INPUT);
+ dev = &oss_capture;
+ }
+ while(dev != NULL)
{
if (strcmp(dev->handle, name) == 0)
break;
dev = dev->next;
}
- if (dev == NULL)
+ if(dev == NULL)
+ {
+ WARN("Could not find \"%s\" in device list\n", name);
return ALC_INVALID_VALUE;
+ }
}
self->fd = open(dev->path, O_RDONLY);
@@ -770,33 +785,30 @@ ALCboolean ALCossBackendFactory_querySupport(ALCossBackendFactory* UNUSED(self),
void ALCossBackendFactory_probe(ALCossBackendFactory* UNUSED(self), enum DevProbe type)
{
+ struct oss_device *cur;
switch(type)
{
case ALL_DEVICE_PROBE:
- {
- struct oss_device *cur = &oss_playback;
- ALCossListFree(cur);
- ALCossListPopulate(cur, NULL);
- while (cur != NULL)
+ ALCossListFree(&oss_playback);
+ ALCossListPopulate(&oss_playback, DSP_CAP_OUTPUT);
+ cur = &oss_playback;
+ while(cur != NULL)
{
AppendAllDevicesList(cur->handle);
cur = cur->next;
}
- }
- break;
+ break;
case CAPTURE_DEVICE_PROBE:
- {
- struct oss_device *cur = &oss_capture;
- ALCossListFree(cur);
- ALCossListPopulate(NULL, cur);
- while (cur != NULL)
+ ALCossListFree(&oss_capture);
+ ALCossListPopulate(&oss_capture, DSP_CAP_INPUT);
+ cur = &oss_capture;
+ while(cur != NULL)
{
AppendCaptureDeviceList(cur->handle);
cur = cur->next;
}
- }
- break;
+ break;
}
}