aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
authorJurgen Kramer <gtmkramer@xs4all.nl>2013-11-09 17:02:49 +0100
committerMax Kellermann <max@duempel.org>2013-11-10 16:49:39 +0100
commit47d3758820fc26730545a5a442d608ebc0edbd8c (patch)
tree552219879375738ecad036d6aed6b7764ea39a1d /src/decoder
parent573ff3a24ff2d8fe0bcd13c255e8a8057cb6a8b9 (diff)
downloadmpd-47d3758820fc26730545a5a442d608ebc0edbd8c.tar.gz
mpd-47d3758820fc26730545a5a442d608ebc0edbd8c.tar.xz
mpd-47d3758820fc26730545a5a442d608ebc0edbd8c.zip
decoder/dsdiff: fix byte order bug
Diffstat (limited to 'src/decoder')
-rw-r--r--src/decoder/DsdLib.hxx11
-rw-r--r--src/decoder/DsdiffDecoderPlugin.cxx4
2 files changed, 13 insertions, 2 deletions
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