aboutsummaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
Diffstat (limited to 'src/output')
-rw-r--r--src/output/alsa_output_plugin.c9
-rw-r--r--src/output/openal_output_plugin.c18
2 files changed, 15 insertions, 12 deletions
diff --git a/src/output/alsa_output_plugin.c b/src/output/alsa_output_plugin.c
index 41293272d..af6d1b184 100644
--- a/src/output/alsa_output_plugin.c
+++ b/src/output/alsa_output_plugin.c
@@ -193,6 +193,9 @@ static snd_pcm_format_t
get_bitformat(enum sample_format sample_format)
{
switch (sample_format) {
+ case SAMPLE_FORMAT_UNDEFINED:
+ return SND_PCM_FORMAT_UNKNOWN;
+
case SAMPLE_FORMAT_S8:
return SND_PCM_FORMAT_S8;
@@ -209,10 +212,10 @@ get_bitformat(enum sample_format sample_format)
case SAMPLE_FORMAT_S32:
return SND_PCM_FORMAT_S32;
-
- default:
- return SND_PCM_FORMAT_UNKNOWN;
}
+
+ assert(false);
+ return SND_PCM_FORMAT_UNKNOWN;
}
static snd_pcm_format_t
diff --git a/src/output/openal_output_plugin.c b/src/output/openal_output_plugin.c
index 1473659f0..622cf559e 100644
--- a/src/output/openal_output_plugin.c
+++ b/src/output/openal_output_plugin.c
@@ -67,26 +67,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