From 47d3758820fc26730545a5a442d608ebc0edbd8c Mon Sep 17 00:00:00 2001 From: Jurgen Kramer Date: Sat, 9 Nov 2013 17:02:49 +0100 Subject: [PATCH] decoder/dsdiff: fix byte order bug --- NEWS | 2 ++ src/decoder/DsdLib.hxx | 11 +++++++++++ src/decoder/DsdiffDecoderPlugin.cxx | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 82a96db94..47fda34cc 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.18.4 (not yet released) +* decoder + - dsdiff: fix byte order bug ver 0.18.3 (2013/11/08) * fix stuck MPD after song change (0.18.2 regression) diff --git a/src/decoder/DsdLib.hxx b/src/decoder/DsdLib.hxx index 25329e650..53160cf1e 100644 --- a/src/decoder/DsdLib.hxx +++ b/src/decoder/DsdLib.hxx @@ -47,6 +47,17 @@ public: } }; +class DffDsdUint64 { + uint32_t hi; + uint32_t lo; + +public: + constexpr uint64_t Read() const { + return (uint64_t(FromBE32(hi)) << 32) | + uint64_t(FromBE32(lo)); + } +}; + bool dsdlib_read(Decoder *decoder, InputStream &is, void *data, size_t length); diff --git a/src/decoder/DsdiffDecoderPlugin.cxx b/src/decoder/DsdiffDecoderPlugin.cxx index 1dc7c7c6a..347f5b586 100644 --- a/src/decoder/DsdiffDecoderPlugin.cxx +++ b/src/decoder/DsdiffDecoderPlugin.cxx @@ -43,13 +43,13 @@ struct DsdiffHeader { DsdId id; - DsdUint64 size; + DffDsdUint64 size; DsdId format; }; struct DsdiffChunkHeader { DsdId id; - DsdUint64 size; + DffDsdUint64 size; /** * Read the "size" attribute from the specified header, converting it