summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-04-22 09:50:39 +0200
committerMax Kellermann <max@musicpd.org>2017-04-24 11:32:52 +0200
commit803b73a34ba6c247b8f5f34ab6c8ba2be4c8013c (patch)
tree561100337c042ff3feae92d5af1e67c71fb3183b /src
parentb1512201ab59aca4a1197c793b643f363fceb5ad (diff)
pcm/PcmPack: add pcm_unpack_24be()
Diffstat (limited to 'src')
-rw-r--r--src/pcm/PcmPack.cxx9
-rw-r--r--src/pcm/PcmPack.hxx7
2 files changed, 16 insertions, 0 deletions
diff --git a/src/pcm/PcmPack.cxx b/src/pcm/PcmPack.cxx
index f368d3059..72c18287e 100644
--- a/src/pcm/PcmPack.cxx
+++ b/src/pcm/PcmPack.cxx
@@ -94,3 +94,12 @@ pcm_unpack_24(int32_t *dest, const uint8_t *src, const uint8_t *src_end)
src += 3;
}
}
+
+void
+pcm_unpack_24be(int32_t *dest, const uint8_t *src, const uint8_t *src_end)
+{
+ while (src < src_end) {
+ *dest++ = ReadS24BE(src);
+ src += 3;
+ }
+}
diff --git a/src/pcm/PcmPack.hxx b/src/pcm/PcmPack.hxx
index 813363715..9b4d58c08 100644
--- a/src/pcm/PcmPack.hxx
+++ b/src/pcm/PcmPack.hxx
@@ -49,4 +49,11 @@ pcm_pack_24(uint8_t *dest, const int32_t *src, const int32_t *src_end);
void
pcm_unpack_24(int32_t *dest, const uint8_t *src, const uint8_t *src_end);
+/**
+ * Like pcm_unpack_24(), but assume the source byte order is
+ * big-endian. The destination byte order ia always native.
+ */
+void
+pcm_unpack_24be(int32_t *dest, const uint8_t *src, const uint8_t *src_end);
+
#endif