From: Jaroslav Kysela Date: Wed, 18 Dec 2002 12:04:59 +0000 (+0000) Subject: Fixed detection of 24-bit wav files X-Git-Tag: v1.0.3~95 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=f2aad9f2a6817e674e0ab316ac1b65949df599d2;p=alsa-utils.git Fixed detection of 24-bit wav files --- diff --git a/aplay/aplay.c b/aplay/aplay.c index be3d7e8..dd19dbe 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -654,7 +654,7 @@ static ssize_t test_wavefile(int fd, char *_buffer, size_t size) hwparams.format = SND_PCM_FORMAT_S16_LE; break; case 24: - switch (LE_SHORT(f->byte_p_spl)) { + switch (LE_SHORT(f->byte_p_spl) / hwparams.channels) { case 3: hwparams.format = SND_PCM_FORMAT_S24_3LE; break; @@ -662,9 +662,10 @@ static ssize_t test_wavefile(int fd, char *_buffer, size_t size) hwparams.format = SND_PCM_FORMAT_S24_LE; break; default: - error(" can't play WAVE-files with sample %d bits in %d bytes wide", LE_SHORT(f->bit_p_spl), LE_SHORT(f->byte_p_spl)); - break; + error(" can't play WAVE-files with sample %d bits in %d bytes wide (%d channels)", LE_SHORT(f->bit_p_spl), LE_SHORT(f->byte_p_spl), hwparams.channels); + exit(EXIT_FAILURE); } + break; case 32: hwparams.format = SND_PCM_FORMAT_S32_LE; break;