aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQball Cow <qball@qballcow.nl>2007-10-03 16:11:01 +0000
committerQball Cow <qball@qballcow.nl>2007-10-03 16:11:01 +0000
commitec49c1d3d9bbfe0fb746f7a1f03bda032412d2b8 (patch)
tree8299650df267538a8c03a0ec33ad622f76fe4186
parentcb9d1b3d275fac683a4128b93a76ab72c99a0209 (diff)
downloadmpd-ec49c1d3d9bbfe0fb746f7a1f03bda032412d2b8.tar.gz
mpd-ec49c1d3d9bbfe0fb746f7a1f03bda032412d2b8.tar.xz
mpd-ec49c1d3d9bbfe0fb746f7a1f03bda032412d2b8.zip
Fix wavpack endian issues, tested to work for 16bit. (after blowing my ears off with white noise)
git-svn-id: https://svn.musicpd.org/mpd/trunk@6952 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/inputPlugins/wavpack_plugin.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/inputPlugins/wavpack_plugin.c b/src/inputPlugins/wavpack_plugin.c
index 73795df94..ec1e6a348 100644
--- a/src/inputPlugins/wavpack_plugin.c
+++ b/src/inputPlugins/wavpack_plugin.c
@@ -79,24 +79,41 @@ static void format_samples_int(int Bps, void *buffer, uint32_t samcnt)
break;
case 2:
while (samcnt--) {
- *dst++ = (uchar)(temp = *src++);
+ temp = *src++;
+#ifdef WORDS_BIGENDIAN
+ *dst++ = (uchar)(temp >> 8);
+ *dst++ = (uchar)(temp);
+#else
+ *dst++ = (uchar)(temp);
*dst++ = (uchar)(temp >> 8);
+#endif
}
break;
case 3:
/* downscale to 16 bits */
while (samcnt--) {
temp = *src++;
+#ifdef WORDS_BIGENDIAN
+ *dst++ = (uchar)(temp >> 16);
+ *dst++ = (uchar)(temp >> 8);
+#else
*dst++ = (uchar)(temp >> 8);
*dst++ = (uchar)(temp >> 16);
+#endif
}
break;
case 4:
/* downscale to 16 bits */
while (samcnt--) {
temp = *src++;
+#ifdef WORDS_BIGENDIAN
+ *dst++ = (uchar)(temp >> 24);
+ *dst++ = (uchar)(temp >> 16);
+
+#else
*dst++ = (uchar)(temp >> 16);
*dst++ = (uchar)(temp >> 24);
+#endif
}
break;
}