summaryrefslogtreecommitdiff
path: root/apps/plugins/vorbis2wav.c
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2005-02-19 12:31:11 +0000
committerDave Chapman <dave@dchapman.com>2005-02-19 12:31:11 +0000
commit9828f08d9b01af15a2d4d9e73e82e04fd0d1225b (patch)
treeea776fe7cfd43b333acfdedd21bc62439d83e97f /apps/plugins/vorbis2wav.c
parent4d961f21285de89360173ccc76ee82eb504d726e (diff)
Byte-swap WAV data on big-endian targets
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6018 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/vorbis2wav.c')
-rw-r--r--apps/plugins/vorbis2wav.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/plugins/vorbis2wav.c b/apps/plugins/vorbis2wav.c
index 3b5de72c74..93c1be6a98 100644
--- a/apps/plugins/vorbis2wav.c
+++ b/apps/plugins/vorbis2wav.c
@@ -30,6 +30,7 @@ static struct plugin_api* rb;
/* Some standard functions and variables needed by Tremor */
+
int errno;
size_t strlen(const char *s) {
@@ -92,6 +93,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
int current_section;
int eof;
static char pcmbuf[4096];
+#if BYTE_ORDER == BIG_ENDIAN
+ int i;
+ char x;
+#endif
file_info_struct file_info;
@@ -139,6 +144,11 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
dprintf("Error decoding frame\n");
} else {
file_info.frames_decoded++;
+#if BYTE_ORDER == BIG_ENDIAN
+ for (i=0;i<n;i+=2) {
+ x=pcmbuf[i]; pcmbuf[i]=pcmbuf[i+1]; pcmbuf[i+1]=x;
+ }
+#endif
rb->write(file_info.outfile,pcmbuf,n);
file_info.current_sample+=(n/4);
}