diff options
author | Max Kellermann <max@duempel.org> | 2012-03-22 00:29:56 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2012-03-22 00:29:56 +0100 |
commit | 51dce3d1616603b44e0da8a7374d0cbf3efb7a2f (patch) | |
tree | 8f9ad9d3576b382ff2ad46e73c8b2a8acd79f5c4 | |
parent | c10f013fc21205c5c6c06d753066963805de8555 (diff) | |
download | mpd-51dce3d1616603b44e0da8a7374d0cbf3efb7a2f.tar.gz mpd-51dce3d1616603b44e0da8a7374d0cbf3efb7a2f.tar.xz mpd-51dce3d1616603b44e0da8a7374d0cbf3efb7a2f.zip |
output/alsa: simplify setup_format()
Diffstat (limited to '')
-rw-r--r-- | src/output/alsa_output_plugin.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/output/alsa_output_plugin.c b/src/output/alsa_output_plugin.c index 202d09b5c..3788ba0f2 100644 --- a/src/output/alsa_output_plugin.c +++ b/src/output/alsa_output_plugin.c @@ -302,8 +302,6 @@ alsa_output_setup_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams, int err = alsa_output_try_format(pcm, hwparams, audio_format->format, reverse_endian_r); - if (err != -EINVAL) - return err; /* if unsupported by the hardware, try other formats */ @@ -316,7 +314,9 @@ alsa_output_setup_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams, SAMPLE_FORMAT_UNDEFINED, }; - for (unsigned i = 0; probe_formats[i] != SAMPLE_FORMAT_UNDEFINED; ++i) { + for (unsigned i = 0; + err == -EINVAL && probe_formats[i] != SAMPLE_FORMAT_UNDEFINED; + ++i) { const enum sample_format mpd_format = probe_formats[i]; if (mpd_format == audio_format->format) continue; @@ -325,12 +325,9 @@ alsa_output_setup_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams, reverse_endian_r); if (err == 0) audio_format->format = mpd_format; - - if (err != -EINVAL) - return err; } - return -EINVAL; + return err; } /** |