aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/oss.c
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/backends/oss.c')
-rw-r--r--Alc/backends/oss.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/Alc/backends/oss.c b/Alc/backends/oss.c
index 21c62d13..bd489e3e 100644
--- a/Alc/backends/oss.c
+++ b/Alc/backends/oss.c
@@ -49,6 +49,9 @@
static const ALCchar oss_device[] = "OSS Default";
+static const char *oss_driver = "/dev/dsp";
+static const char *oss_capture = "/dev/dsp";
+
typedef struct {
int fd;
volatile int killNow;
@@ -149,11 +152,8 @@ static ALuint OSSCaptureProc(ALvoid *ptr)
static ALCenum oss_open_playback(ALCdevice *device, const ALCchar *deviceName)
{
- char driver[64];
oss_data *data;
- strncpy(driver, GetConfigValue("oss", "device", "/dev/dsp"), sizeof(driver)-1);
- driver[sizeof(driver)-1] = 0;
if(!deviceName)
deviceName = oss_device;
else if(strcmp(deviceName, oss_device) != 0)
@@ -162,11 +162,11 @@ static ALCenum oss_open_playback(ALCdevice *device, const ALCchar *deviceName)
data = (oss_data*)calloc(1, sizeof(oss_data));
data->killNow = 0;
- data->fd = open(driver, O_WRONLY);
+ data->fd = open(oss_driver, O_WRONLY);
if(data->fd == -1)
{
free(data);
- ERR("Could not open %s: %s\n", driver, strerror(errno));
+ ERR("Could not open %s: %s\n", oss_driver, strerror(errno));
return ALC_INVALID_VALUE;
}
@@ -312,15 +312,11 @@ static ALCenum oss_open_capture(ALCdevice *device, const ALCchar *deviceName)
audio_buf_info info;
ALuint frameSize;
int numChannels;
- char driver[64];
oss_data *data;
int ossFormat;
int ossSpeed;
char *err;
- strncpy(driver, GetConfigValue("oss", "capture", "/dev/dsp"), sizeof(driver)-1);
- driver[sizeof(driver)-1] = 0;
-
if(!deviceName)
deviceName = oss_device;
else if(strcmp(deviceName, oss_device) != 0)
@@ -329,11 +325,11 @@ static ALCenum oss_open_capture(ALCdevice *device, const ALCchar *deviceName)
data = (oss_data*)calloc(1, sizeof(oss_data));
data->killNow = 0;
- data->fd = open(driver, O_RDONLY);
+ data->fd = open(oss_capture, O_RDONLY);
if(data->fd == -1)
{
free(data);
- ERR("Could not open %s: %s\n", driver, strerror(errno));
+ ERR("Could not open %s: %s\n", oss_capture, strerror(errno));
return ALC_INVALID_VALUE;
}
@@ -353,7 +349,7 @@ static ALCenum oss_open_capture(ALCdevice *device, const ALCchar *deviceName)
case DevFmtUInt:
case DevFmtFloat:
free(data);
- ERR("%s capture samples not supported on OSS\n", DevFmtTypeString(device->FmtType));
+ ERR("%s capture samples not supported\n", DevFmtTypeString(device->FmtType));
return ALC_INVALID_VALUE;
}
@@ -488,6 +484,9 @@ static const BackendFuncs oss_funcs = {
ALCboolean alc_oss_init(BackendFuncs *func_list)
{
+ ConfigValueStr("oss", "device", &oss_driver);
+ ConfigValueStr("oss", "capture", &oss_capture);
+
*func_list = oss_funcs;
return ALC_TRUE;
}
@@ -504,7 +503,7 @@ void alc_oss_probe(enum DevProbe type)
{
#ifdef HAVE_STAT
struct stat buf;
- if(stat(GetConfigValue("oss", "device", "/dev/dsp"), &buf) == 0)
+ if(stat(oss_device, &buf) == 0)
#endif
AppendAllDeviceList(oss_device);
}
@@ -514,7 +513,7 @@ void alc_oss_probe(enum DevProbe type)
{
#ifdef HAVE_STAT
struct stat buf;
- if(stat(GetConfigValue("oss", "capture", "/dev/dsp"), &buf) == 0)
+ if(stat(oss_capture, &buf) == 0)
#endif
AppendCaptureDeviceList(oss_device);
}