From e11b59a80f542e08bc877d1447f885fb0f5cc439 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 21 Sep 2009 02:53:33 -0700 Subject: Return imediately if trying to set an unknown format --- Alc/alsa.c | 10 ++++++---- Alc/dsound.c | 5 +++++ Alc/oss.c | 10 ++++++---- Alc/portaudio.c | 6 ++++-- Alc/pulseaudio.c | 4 ++-- Alc/solaris.c | 3 ++- 6 files changed, 25 insertions(+), 13 deletions(-) (limited to 'Alc') diff --git a/Alc/alsa.c b/Alc/alsa.c index 8a28ce0f..1fa90039 100644 --- a/Alc/alsa.c +++ b/Alc/alsa.c @@ -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)) { diff --git a/Alc/oss.c b/Alc/oss.c index 6cf4c495..62d3c1df 100644 --- a/Alc/oss.c +++ b/Alc/oss.c @@ -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); -- cgit v1.2.3