From 0129d1e158c4de289adfbb26ae7ea54b26e049ad Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 10 Oct 2011 09:29:02 +0200 Subject: pcm_convert: support reverse endian input --- src/pcm_convert.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/pcm_convert.c b/src/pcm_convert.c index b507999fa..4dbeee41f 100644 --- a/src/pcm_convert.c +++ b/src/pcm_convert.c @@ -269,6 +269,20 @@ pcm_convert(struct pcm_convert_state *state, size_t *dest_size_r, GError **error_r) { + if (src_format->reverse_endian) { + /* convert to host byte order, because all of our + conversion libraries assume host byte order */ + + src = pcm_byteswap(&state->byteswap_buffer, src_format->format, + src, src_size); + if (src == NULL) { + g_set_error(error_r, pcm_convert_quark(), 0, + "PCM byte order change of format '%s' is not implemented", + sample_format_to_string(src_format->format)); + return NULL; + } + } + switch (dest_format->format) { case SAMPLE_FORMAT_S16: return pcm_convert_16(state, -- cgit v1.2.3