aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm_byteswap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pcm_byteswap.c')
-rw-r--r--src/pcm_byteswap.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/pcm_byteswap.c b/src/pcm_byteswap.c
index 4e604c79a..63f116211 100644
--- a/src/pcm_byteswap.c
+++ b/src/pcm_byteswap.c
@@ -68,3 +68,29 @@ const int32_t *pcm_byteswap_32(struct pcm_buffer *buffer,
return buf;
}
+
+const void *
+pcm_byteswap(struct pcm_buffer *buffer, enum sample_format format,
+ const void *src, size_t size)
+{
+ switch (format) {
+ case SAMPLE_FORMAT_UNDEFINED:
+ case SAMPLE_FORMAT_S24:
+ /* not implemented */
+ return NULL;
+
+ case SAMPLE_FORMAT_S8:
+ return src;
+
+ case SAMPLE_FORMAT_S16:
+ return pcm_byteswap_16(buffer, src, size);
+
+ case SAMPLE_FORMAT_S24_P32:
+ case SAMPLE_FORMAT_S32:
+ return pcm_byteswap_32(buffer, src, size);
+ }
+
+ /* unreachable */
+ assert(false);
+ return NULL;
+}