aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/openal_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-10-08 14:39:40 +0200
committerMax Kellermann <max@duempel.org>2011-10-08 14:41:22 +0200
commit5ed0eb51d16507dcca9764771af8f05f08a078f9 (patch)
tree1e1644f728dd485f5132eae0e3b91511b9963fb8 /src/output/openal_plugin.c
parent72a1ca3b99302e229d4a7f699c45b9fa7288c1a8 (diff)
downloadmpd-5ed0eb51d16507dcca9764771af8f05f08a078f9.tar.gz
mpd-5ed0eb51d16507dcca9764771af8f05f08a078f9.tar.xz
mpd-5ed0eb51d16507dcca9764771af8f05f08a078f9.zip
output/openal: auto-fallback to mono if channel count is unsupported
.. instead of failing playback completely.
Diffstat (limited to 'src/output/openal_plugin.c')
-rw-r--r--src/output/openal_plugin.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/output/openal_plugin.c b/src/output/openal_plugin.c
index 767b3eb17..0a8f253b2 100644
--- a/src/output/openal_plugin.c
+++ b/src/output/openal_plugin.c
@@ -64,26 +64,26 @@ openal_audio_format(struct audio_format *audio_format)
return AL_FORMAT_STEREO16;
if (audio_format->channels == 1)
return AL_FORMAT_MONO16;
- break;
+
+ /* fall back to mono */
+ audio_format->channels = 1;
+ return openal_audio_format(audio_format);
case SAMPLE_FORMAT_S8:
if (audio_format->channels == 2)
return AL_FORMAT_STEREO8;
if (audio_format->channels == 1)
return AL_FORMAT_MONO8;
- break;
+
+ /* fall back to mono */
+ audio_format->channels = 1;
+ return openal_audio_format(audio_format);
default:
/* fall back to 16 bit */
audio_format->format = SAMPLE_FORMAT_S16;
- if (audio_format->channels == 2)
- return AL_FORMAT_STEREO16;
- if (audio_format->channels == 1)
- return AL_FORMAT_MONO16;
- break;
+ return openal_audio_format(audio_format);
}
-
- return 0;
}
static bool