aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm_convert.c
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2009-07-19 16:42:19 +0100
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-07-19 17:15:21 +0100
commit05693e2d5d760e818fb7382f9bd528026f16aa51 (patch)
treea2f9cbcafda5f17f253367225e4a1bc37d4859dc /src/pcm_convert.c
parent37754559b8f934ce8d554e0d9f976d4f6eb376d9 (diff)
downloadmpd-05693e2d5d760e818fb7382f9bd528026f16aa51.tar.gz
mpd-05693e2d5d760e818fb7382f9bd528026f16aa51.tar.xz
mpd-05693e2d5d760e818fb7382f9bd528026f16aa51.zip
Add reverse_endian field to struct audio_format and handle conversion
Diffstat (limited to 'src/pcm_convert.c')
-rw-r--r--src/pcm_convert.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/pcm_convert.c b/src/pcm_convert.c
index ebb4adff5..2d72628b2 100644
--- a/src/pcm_convert.c
+++ b/src/pcm_convert.c
@@ -20,6 +20,7 @@
#include "pcm_convert.h"
#include "pcm_channels.h"
#include "pcm_format.h"
+#include "pcm_byteswap.h"
#include "audio_format.h"
#include <assert.h>
@@ -83,6 +84,12 @@ pcm_convert_16(struct pcm_convert_state *state,
dest_format->sample_rate,
&len);
+ if (dest_format->reverse_endian) {
+ buf = pcm_byteswap_16(&state->format_buffer, buf, len);
+ if (!buf)
+ g_error("pcm_byteswap_16() failed");
+ }
+
*dest_size_r = len;
return buf;
}
@@ -120,6 +127,12 @@ pcm_convert_24(struct pcm_convert_state *state,
dest_format->sample_rate,
&len);
+ if (dest_format->reverse_endian) {
+ buf = pcm_byteswap_32(&state->format_buffer, buf, len);
+ if (!buf)
+ g_error("pcm_byteswap_32() failed");
+ }
+
*dest_size_r = len;
return buf;
}
@@ -157,6 +170,12 @@ pcm_convert_32(struct pcm_convert_state *state,
dest_format->sample_rate,
&len);
+ if (dest_format->reverse_endian) {
+ buf = pcm_byteswap_32(&state->format_buffer, buf, len);
+ if (!buf)
+ g_error("pcm_byteswap_32() failed");
+ }
+
*dest_size_r = len;
return buf;
}