audiofile: added 24 bit support

Don't hard code the "bits" parameter to 16.  Try to use the input's
sample format, if possible.
This commit is contained in:
Max Kellermann 2009-03-01 10:53:46 +01:00
parent 614fe8b341
commit af66f666c6
2 changed files with 9 additions and 1 deletions

1
NEWS
View File

@ -9,6 +9,7 @@ ver 0.15 - (200?/??/??)
- parse RVA2 tags in mp3 files - parse RVA2 tags in mp3 files
* decoders: * decoders:
- audiofile: streaming support added - audiofile: streaming support added
- audiofile: added 24 bit support
- modplug: another MOD plugin, based on libmodplug - modplug: another MOD plugin, based on libmodplug
- mikmod disabled by default, due to severe security issues in libmikmod - mikmod disabled by default, due to severe security issues in libmikmod
- sidplay: new decoder plugin for C64 SID (using libsidplay2) - sidplay: new decoder plugin for C64 SID (using libsidplay2)

View File

@ -127,8 +127,15 @@ audiofile_stream_decode(struct decoder *decoder, struct input_stream *is)
return; 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, afSetVirtualSampleFormat(af_fp, AF_DEFAULT_TRACK,
AF_SAMPFMT_TWOSCOMP, 16); AF_SAMPFMT_TWOSCOMP, bits);
afGetVirtualSampleFormat(af_fp, AF_DEFAULT_TRACK, &fs, &bits); afGetVirtualSampleFormat(af_fp, AF_DEFAULT_TRACK, &fs, &bits);
audio_format.bits = (uint8_t)bits; audio_format.bits = (uint8_t)bits;
audio_format.sample_rate = audio_format.sample_rate =