diff options
author | Chris Robinson <[email protected]> | 2009-09-21 02:53:33 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-09-21 02:53:33 -0700 |
commit | e11b59a80f542e08bc877d1447f885fb0f5cc439 (patch) | |
tree | 9295577e517bf06d82eccf29700ac3b20bdfdb1c | |
parent | 0ae02e8ad4f77287e4641ab9491c94efac2d402b (diff) |
Return imediately if trying to set an unknown format
-rw-r--r-- | Alc/alsa.c | 10 | ||||
-rw-r--r-- | Alc/dsound.c | 5 | ||||
-rw-r--r-- | Alc/oss.c | 10 | ||||
-rw-r--r-- | Alc/portaudio.c | 6 | ||||
-rw-r--r-- | Alc/pulseaudio.c | 4 | ||||
-rw-r--r-- | Alc/solaris.c | 3 |
6 files changed, 25 insertions, 13 deletions
@@ -425,8 +425,8 @@ static ALCboolean alsa_reset_playback(ALCdevice *device) data->format = SND_PCM_FORMAT_FLOAT; break; default: - data->format = SND_PCM_FORMAT_UNKNOWN; - AL_PRINT("Unknown format?! %x\n", device->Format); + AL_PRINT("Unknown format: 0x%x\n", device->Format); + return ALC_FALSE; } allowmmap = GetConfigValueBool("alsa", "mmap", 1); @@ -624,8 +624,10 @@ open_alsa: data->format = SND_PCM_FORMAT_FLOAT; break; default: - data->format = SND_PCM_FORMAT_UNKNOWN; - AL_PRINT("Unknown format?! %x\n", pDevice->Format); + AL_PRINT("Unknown format: 0x%x\n", pDevice->Format); + psnd_pcm_close(data->pcmHandle); + free(data); + return ALC_FALSE; } err = NULL; diff --git a/Alc/dsound.c b/Alc/dsound.c index a704c454..6846886d 100644 --- a/Alc/dsound.c +++ b/Alc/dsound.c @@ -237,6 +237,11 @@ static ALCboolean DSoundResetPlayback(ALCdevice *device) speakers = DSSPEAKER_COMBINED(DSSPEAKER_5POINT1, 0); else if(device->Format == AL_FORMAT_71CHN8 || device->Format == AL_FORMAT_71CHN16) speakers = DSSPEAKER_COMBINED(DSSPEAKER_7POINT1, 0); + else + { + AL_PRINT("Unknown format: 0x%x\n", device->Format); + return ALC_FALSE; + } } if(SUCCEEDED(hr)) { @@ -217,8 +217,8 @@ static ALCboolean oss_reset_playback(ALCdevice *device) ossFormat = AFMT_S16_NE; break; default: - ossFormat = -1; - AL_PRINT("Unknown format?! %x\n", device->Format); + AL_PRINT("Unknown format: 0x%x\n", device->Format); + return ALC_FALSE; } periods = device->NumUpdates; @@ -337,8 +337,10 @@ static ALCboolean oss_open_capture(ALCdevice *device, const ALCchar *deviceName) ossFormat = AFMT_S16_NE; break; default: - ossFormat = -1; - AL_PRINT("Unknown format?! %x\n", device->Format); + AL_PRINT("Unknown format: 0x%x\n", device->Format); + close(data->fd); + free(data); + return ALC_FALSE; } periods = 4; diff --git a/Alc/portaudio.c b/Alc/portaudio.c index 5e0687b1..fb4b8ed5 100644 --- a/Alc/portaudio.c +++ b/Alc/portaudio.c @@ -105,8 +105,10 @@ static ALCboolean pa_open_playback(ALCdevice *device, const ALCchar *deviceName) outParams.sampleFormat = paFloat32; break; default: - outParams.sampleFormat = -1; - AL_PRINT("Unknown format?! %x\n", device->Format); + AL_PRINT("Unknown format: 0x%x\n", device->Format); + device->ExtraData = NULL; + free(data); + return ALC_FALSE; } outParams.channelCount = aluChannelsFromFormat(device->Format); diff --git a/Alc/pulseaudio.c b/Alc/pulseaudio.c index b5add4c8..8d7d5c0c 100644 --- a/Alc/pulseaudio.c +++ b/Alc/pulseaudio.c @@ -366,7 +366,7 @@ static ALCboolean pulse_reset_playback(ALCdevice *device) //{{{ data->spec.format = PA_SAMPLE_FLOAT32NE; break; default: - AL_PRINT("Unknown format: %x\n", device->Format); + AL_PRINT("Unknown format: 0x%x\n", device->Format); ppa_threaded_mainloop_unlock(data->loop); return ALC_FALSE; } @@ -495,7 +495,7 @@ static ALCboolean pulse_open_capture(ALCdevice *device, const ALCchar *device_na data->spec.format = PA_SAMPLE_FLOAT32NE; break; default: - AL_PRINT("Unknown format: %x\n", device->Format); + AL_PRINT("Unknown format: 0x%x\n", device->Format); ppa_threaded_mainloop_unlock(data->loop); pulse_close(device); free(device->szDeviceName); diff --git a/Alc/solaris.c b/Alc/solaris.c index 58d6e081..6f590e5e 100644 --- a/Alc/solaris.c +++ b/Alc/solaris.c @@ -159,7 +159,8 @@ static ALCboolean solaris_reset_playback(ALCdevice *device) info.play.encoding = AUDIO_ENCODING_LINEAR; break; default: - AL_PRINT("Unknown format?! %x\n", device->Format); + AL_PRINT("Unknown format: 0x%x\n", device->Format); + return ALC_FALSE; } numChannels = aluChannelsFromFormat(device->Format); |