From af66f666c65cfdca3cf717a923a0e440bb75afe2 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 1 Mar 2009 10:53:46 +0100 Subject: audiofile: added 24 bit support Don't hard code the "bits" parameter to 16. Try to use the input's sample format, if possible. --- src/decoder/audiofile_plugin.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/decoder/audiofile_plugin.c b/src/decoder/audiofile_plugin.c index bc517d49c..e1e848c05 100644 --- a/src/decoder/audiofile_plugin.c +++ b/src/decoder/audiofile_plugin.c @@ -127,8 +127,15 @@ audiofile_stream_decode(struct decoder *decoder, struct input_stream *is) return; } + afGetSampleFormat(af_fp, AF_DEFAULT_TRACK, &fs, &bits); + if (!audio_valid_sample_format(bits)) { + g_debug("input file has %d bit samples, converting to 16", + bits); + bits = 16; + } + afSetVirtualSampleFormat(af_fp, AF_DEFAULT_TRACK, - AF_SAMPFMT_TWOSCOMP, 16); + AF_SAMPFMT_TWOSCOMP, bits); afGetVirtualSampleFormat(af_fp, AF_DEFAULT_TRACK, &fs, &bits); audio_format.bits = (uint8_t)bits; audio_format.sample_rate = -- cgit v1.2.3