diff options
author | Max Kellermann <max@duempel.org> | 2008-10-10 14:42:30 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-10 14:42:30 +0200 |
commit | 8fc6b93afc27be3ba44cfc6f06dac43821e9c423 (patch) | |
tree | 95f11b8d59e03c219a89a12b248c5c75016bd42d | |
parent | 96155a3376ef40eac9ca7a7b882da6447ab53979 (diff) |
oss: added OssData.audio_format
This replaces the separate properties channels, sampleRate, bits.
-rw-r--r-- | src/audioOutputs/audioOutput_oss.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/audioOutputs/audioOutput_oss.c b/src/audioOutputs/audioOutput_oss.c index 8dddf3be7..ed7d31c30 100644 --- a/src/audioOutputs/audioOutput_oss.c +++ b/src/audioOutputs/audioOutput_oss.c @@ -45,10 +45,8 @@ typedef struct _OssData { int fd; const char *device; - int channels; - int sampleRate; + struct audio_format audio_format; int bitFormat; - int bits; int *supported[3]; int numSupported[3]; int *unsupported[3]; @@ -447,19 +445,24 @@ static int oss_open(OssData *od) goto fail; } - if (setParam(od, SNDCTL_DSP_CHANNELS, &od->channels)) { - ERROR("OSS device \"%s\" does not support %i channels: %s\n", - od->device, od->channels, strerror(errno)); + tmp = od->audio_format.channels; + if (setParam(od, SNDCTL_DSP_CHANNELS, &tmp)) { + ERROR("OSS device \"%s\" does not support %u channels: %s\n", + od->device, od->audio_format.channels, strerror(errno)); goto fail; } + od->audio_format.channels = tmp; - if (setParam(od, SNDCTL_DSP_SPEED, &od->sampleRate)) { - ERROR("OSS device \"%s\" does not support %i Hz audio: %s\n", - od->device, od->sampleRate, strerror(errno)); + tmp = od->audio_format.sample_rate; + if (setParam(od, SNDCTL_DSP_SPEED, &tmp)) { + ERROR("OSS device \"%s\" does not support %u Hz audio: %s\n", + od->device, od->audio_format.sample_rate, + strerror(errno)); goto fail; } + od->audio_format.sample_rate = tmp; - switch (od->bits) { + switch (od->audio_format.bits) { case 8: tmp = AFMT_S8; break; @@ -468,7 +471,7 @@ static int oss_open(OssData *od) } if (setParam(od, SNDCTL_DSP_SAMPLESIZE, &tmp)) { - ERROR("OSS device \"%s\" does not support %i bit audio: %s\n", + ERROR("OSS device \"%s\" does not support %u bit audio: %s\n", od->device, tmp, strerror(errno)); goto fail; } @@ -486,19 +489,17 @@ static int oss_openDevice(void *data, int ret; OssData *od = data; - od->channels = (int8_t)audioFormat->channels; - od->sampleRate = audioFormat->sample_rate; - od->bits = (int8_t)audioFormat->bits; + od->audio_format = *audioFormat; if ((ret = oss_open(od)) < 0) return ret; - audioFormat->channels = od->channels; - audioFormat->sample_rate = od->sampleRate; - audioFormat->bits = od->bits; + *audioFormat = od->audio_format; - DEBUG("oss device \"%s\" will be playing %i bit %i channel audio at " - "%i Hz\n", od->device, od->bits, od->channels, od->sampleRate); + DEBUG("oss device \"%s\" will be playing %u bit %u channel audio at " + "%u Hz\n", od->device, + od->audio_format.bits, od->audio_format.channels, + od->audio_format.sample_rate); return ret; } |