From 93f6591c6f471c5b0c84abefeb2be2d8034c8855 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Sat, 14 Aug 2010 09:01:35 +0200 Subject: fixed bits per sample display in libsndfile plugin (wav files) --- plugins/sndfile/sndfile.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'plugins/sndfile') diff --git a/plugins/sndfile/sndfile.c b/plugins/sndfile/sndfile.c index 8535d1fd..0cb48675 100644 --- a/plugins/sndfile/sndfile.c +++ b/plugins/sndfile/sndfile.c @@ -110,7 +110,29 @@ sndfile_init (DB_fileinfo_t *_info, DB_playItem_t *it) { return -1; } _info->plugin = &plugin; - _info->bps = 16; + + switch (inf.format&0x000f) { + case SF_FORMAT_PCM_S8: + case SF_FORMAT_PCM_U8: + _info->bps = 8; + break; + case SF_FORMAT_PCM_16: + _info->bps = 16; + break; + case SF_FORMAT_PCM_24: + _info->bps = 24; + break; + case SF_FORMAT_PCM_32: + case SF_FORMAT_FLOAT: + _info->bps = 24; + break; + case SF_FORMAT_DOUBLE: + _info->bps = 64; + break; + default: + _info->bps = 16; + } + _info->channels = inf.channels; _info->samplerate = inf.samplerate; _info->readpos = 0; @@ -250,7 +272,7 @@ sndfile_insert (DB_playItem_t *after, const char *fname) { } static const char * exts[] = { "wav", "aif", "aiff", "snd", "au", "paf", "svx", "nist", "voc", "ircam", "w64", "mat4", "mat5", "pvf", "xi", "htk", "sds", "avr", "wavex", "sd2", "caf", "wve", NULL }; -static const char *filetypes[] = { "wav", NULL }; +static const char *filetypes[] = { "WAV", NULL }; // define plugin interface static DB_decoder_t plugin = { -- cgit v1.2.3