aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/flac_pcm.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-10 17:11:34 +0100
committerMax Kellermann <max@duempel.org>2009-12-02 22:29:50 +0100
commitc412d6251e9cd3abe735b7622af4003502e54f72 (patch)
tree7344c13f62e4cc788c830c05d21bb7b5b47f5866 /src/decoder/flac_pcm.c
parent68c2cfbb4067b2292e1ff1d4e7716ff370903f84 (diff)
downloadmpd-c412d6251e9cd3abe735b7622af4003502e54f72.tar.gz
mpd-c412d6251e9cd3abe735b7622af4003502e54f72.tar.xz
mpd-c412d6251e9cd3abe735b7622af4003502e54f72.zip
audio_format: changed "bits" to "enum sample_format"
This patch prepares support for floating point samples (and probably other formats). It changes the meaning of the "bits" attribute from a bit count to a symbolic value.
Diffstat (limited to 'src/decoder/flac_pcm.c')
-rw-r--r--src/decoder/flac_pcm.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/decoder/flac_pcm.c b/src/decoder/flac_pcm.c
index 737d5b043..a8bf6f293 100644
--- a/src/decoder/flac_pcm.c
+++ b/src/decoder/flac_pcm.c
@@ -20,6 +20,8 @@
#include "config.h"
#include "flac_pcm.h"
+#include <assert.h>
+
static void flac_convert_stereo16(int16_t *dest,
const FLAC__int32 * const buf[],
unsigned int position, unsigned int end)
@@ -74,12 +76,12 @@ flac_convert_8(int8_t *dest,
void
flac_convert(void *dest,
- unsigned int num_channels, unsigned sample_format,
+ unsigned int num_channels, enum sample_format sample_format,
const FLAC__int32 *const buf[],
unsigned int position, unsigned int end)
{
switch (sample_format) {
- case 16:
+ case SAMPLE_FORMAT_S16:
if (num_channels == 2)
flac_convert_stereo16((int16_t*)dest, buf,
position, end);
@@ -88,15 +90,19 @@ flac_convert(void *dest,
position, end);
break;
- case 24:
- case 32:
+ case SAMPLE_FORMAT_S24_P32:
+ case SAMPLE_FORMAT_S32:
flac_convert_32((int32_t*)dest, num_channels, buf,
position, end);
break;
- case 8:
+ case SAMPLE_FORMAT_S8:
flac_convert_8((int8_t*)dest, num_channels, buf,
position, end);
break;
+
+ case SAMPLE_FORMAT_UNDEFINED:
+ /* unreachable */
+ assert(false);
}
}