aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJurgen Kramer <gtmkramer@xs4all.nl>2014-07-04 14:15:09 +0200
committerMax Kellermann <max@duempel.org>2014-08-16 18:40:53 +0200
commit9b9d189a333705818783e51da10d21511379124f (patch)
treebecd8f1e7d541e93d504f1779a0dd221064cdec4 /src
parent7c3af4f56f7171aacbe9bd26f2b30bb4f94e88f2 (diff)
downloadmpd-9b9d189a333705818783e51da10d21511379124f.tar.gz
mpd-9b9d189a333705818783e51da10d21511379124f.tar.xz
mpd-9b9d189a333705818783e51da10d21511379124f.zip
decoder/dsf: Allow up to DSD512. Enable DSD rates based on Fs=48kHz
Diffstat (limited to '')
-rw-r--r--src/decoder/plugins/DsdLib.cxx19
-rw-r--r--src/decoder/plugins/DsdLib.hxx7
-rw-r--r--src/decoder/plugins/DsfDecoderPlugin.cxx2
3 files changed, 27 insertions, 1 deletions
diff --git a/src/decoder/plugins/DsdLib.cxx b/src/decoder/plugins/DsdLib.cxx
index 0f10b20e9..086f9d4d6 100644
--- a/src/decoder/plugins/DsdLib.cxx
+++ b/src/decoder/plugins/DsdLib.cxx
@@ -82,6 +82,25 @@ dsdlib_skip(Decoder *decoder, InputStream &is,
return decoder_skip(decoder, is, delta);
}
+bool
+dsdlib_valid_freq(uint32_t samplefreq)
+{
+ switch (samplefreq) {
+ case 2822400: /* DSD64, 64xFs, Fs = 44.100kHz */
+ case 3072000: /* DSD64 with Fs = 48.000 kHz */
+ case 5644800:
+ case 6144000:
+ case 11289600:
+ case 12288000:
+ case 22579200:/* DSD512 */
+ case 24576000:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
#ifdef HAVE_ID3TAG
void
dsdlib_tag_id3(InputStream &is,
diff --git a/src/decoder/plugins/DsdLib.hxx b/src/decoder/plugins/DsdLib.hxx
index 5250922ac..4d5830702 100644
--- a/src/decoder/plugins/DsdLib.hxx
+++ b/src/decoder/plugins/DsdLib.hxx
@@ -67,6 +67,13 @@ dsdlib_skip(Decoder *decoder, InputStream &is,
uint64_t delta);
/**
+ * Check if the sample frequency is a valid DSD frequency.
+ **/
+gcc_const
+bool
+dsdlib_valid_freq(uint32_t samplefreq);
+
+/**
* Add tags from ID3 tag. All tags commonly found in the ID3 tags of
* DSF and DSDIFF files are imported
*/
diff --git a/src/decoder/plugins/DsfDecoderPlugin.cxx b/src/decoder/plugins/DsfDecoderPlugin.cxx
index dc94d149c..94c25247d 100644
--- a/src/decoder/plugins/DsfDecoderPlugin.cxx
+++ b/src/decoder/plugins/DsfDecoderPlugin.cxx
@@ -131,7 +131,7 @@ dsf_read_metadata(Decoder *decoder, InputStream &is,
if (dsf_fmt_chunk.version != 1 || dsf_fmt_chunk.formatid != 0
|| dsf_fmt_chunk.channeltype != 2
|| dsf_fmt_chunk.channelnum != 2
- || (samplefreq != 2822400 && samplefreq != 5644800))
+ || (!dsdlib_valid_freq(samplefreq)))
return false;
uint32_t chblksize = FromLE32(dsf_fmt_chunk.block_size);