The DSD DSDIFF decoder needs FromBE32 to calculate chunk sizes instead
of FromLE32 as is the case with the DSD DSF decoder.

Patch attached, againt MPD 0.18.3.

Jurgen

>From 69e8160f9191708d2cd444219e7e207d21d2d25d Mon Sep 17 00:00:00 2001
From: Jurgen Kramer <gtmkra...@xs4all.nl>
Date: Sat, 9 Nov 2013 17:02:49 +0100
Subject: [PATCH] Fix DSD DSDIFF decoder

---
 src/decoder/DsdLib.hxx              | 12 ++++++++++++
 src/decoder/DsdiffDecoderPlugin.cxx |  4 ++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/decoder/DsdLib.hxx b/src/decoder/DsdLib.hxx
index 25329e6..ac89c38 100644
--- a/src/decoder/DsdLib.hxx
+++ b/src/decoder/DsdLib.hxx
@@ -47,6 +47,18 @@ 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 1dc7c7c..347f5b5 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
-- 
1.8.3.1

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to