diff options
author | Max Kellermann <max@duempel.org> | 2009-02-25 22:01:32 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-02-25 22:01:32 +0100 |
commit | a4cf7b7dfd303d8f36cef7ba0b5da7f7e4d0bba6 (patch) | |
tree | 5caf393642b39b3bb69985dd9a3ff8ea9da671a7 /src/output | |
parent | 4c1fb8278b11134dfed72ec2b045c33517ed94c9 (diff) | |
download | mpd-a4cf7b7dfd303d8f36cef7ba0b5da7f7e4d0bba6.tar.gz mpd-a4cf7b7dfd303d8f36cef7ba0b5da7f7e4d0bba6.tar.xz mpd-a4cf7b7dfd303d8f36cef7ba0b5da7f7e4d0bba6.zip |
alsa: fall back to 16 bit audio
When the sample format is unknown, fall back to 16 bit samples.
Diffstat (limited to '')
-rw-r--r-- | src/output/alsa_plugin.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/output/alsa_plugin.c b/src/output/alsa_plugin.c index 9b3b5599c..1623dcac8 100644 --- a/src/output/alsa_plugin.c +++ b/src/output/alsa_plugin.c @@ -364,9 +364,14 @@ alsa_open(void *data, struct audio_format *audio_format) mixer_open(ad->mixer); - if ((bitformat = get_bitformat(audio_format)) == SND_PCM_FORMAT_UNKNOWN) - g_warning("ALSA device \"%s\" doesn't support %u bit audio\n", - alsa_device(ad), audio_format->bits); + bitformat = get_bitformat(audio_format); + if (bitformat == SND_PCM_FORMAT_UNKNOWN) { + /* sample format is not supported by this plugin - + fall back to 16 bit samples */ + + audio_format->bits = 16; + bitformat = SND_PCM_FORMAT_S16; + } err = snd_pcm_open(&ad->pcm, alsa_device(ad), SND_PCM_STREAM_PLAYBACK, ad->mode); |