aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-12 12:02:54 +0200
committerMax Kellermann <max@duempel.org>2008-10-12 12:02:54 +0200
commit9b0693d8ef564b16d1cff70588baf86a24d41d82 (patch)
treeb8c5c446e114c7bd7baa25355129b16c7e99578f
parentc0ecce54981a3c3b9cca29604b54620c63517129 (diff)
downloadmpd-9b0693d8ef564b16d1cff70588baf86a24d41d82.tar.gz
mpd-9b0693d8ef564b16d1cff70588baf86a24d41d82.tar.xz
mpd-9b0693d8ef564b16d1cff70588baf86a24d41d82.zip
pcm_utils: support any number of channels in pcm_sizeOfConvBuffer()
When calculating the conversion buffer size, don't hard-code the formulas for only mono<->stereo.
Diffstat (limited to '')
-rw-r--r--src/pcm_utils.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/pcm_utils.c b/src/pcm_utils.c
index cb6f93f63..200c657de 100644
--- a/src/pcm_utils.c
+++ b/src/pcm_utils.c
@@ -568,17 +568,8 @@ size_t pcm_sizeOfConvBuffer(const struct audio_format *inFormat, size_t inSize,
}
if (inFormat->channels != outFormat->channels) {
- switch (inFormat->channels) {
- case 1:
- outSize = (outSize >> 1) << 2;
- break;
- case 2:
- outSize >>= 1;
- break;
- default:
- FATAL("only 1 or 2 channels are supported "
- "for conversion!\n");
- }
+ outSize /= inFormat->channels;
+ outSize *= outFormat->channels;
}
outSize /= shift;