aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-01 10:53:46 +0100
committerMax Kellermann <max@duempel.org>2009-03-01 10:53:46 +0100
commitaf66f666c65cfdca3cf717a923a0e440bb75afe2 (patch)
treeaff07318a65dff2296ffe3a0ded03863ec7972cd
parent614fe8b341a68aa06d1d5259475147a0afde163f (diff)
downloadmpd-af66f666c65cfdca3cf717a923a0e440bb75afe2.tar.gz
mpd-af66f666c65cfdca3cf717a923a0e440bb75afe2.tar.xz
mpd-af66f666c65cfdca3cf717a923a0e440bb75afe2.zip
audiofile: added 24 bit support
Don't hard code the "bits" parameter to 16. Try to use the input's sample format, if possible.
-rw-r--r--NEWS1
-rw-r--r--src/decoder/audiofile_plugin.c9
2 files changed, 9 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 153cbd837..aa74e95dc 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ ver 0.15 - (200?/??/??)
- parse RVA2 tags in mp3 files
* decoders:
- audiofile: streaming support added
+ - audiofile: added 24 bit support
- modplug: another MOD plugin, based on libmodplug
- mikmod disabled by default, due to severe security issues in libmikmod
- sidplay: new decoder plugin for C64 SID (using libsidplay2)
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 =