diff options
author | Dave Chapman <dave@dchapman.com> | 2005-02-19 12:31:11 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2005-02-19 12:31:11 +0000 |
commit | 9828f08d9b01af15a2d4d9e73e82e04fd0d1225b (patch) | |
tree | ea776fe7cfd43b333acfdedd21bc62439d83e97f /apps/plugins | |
parent | 4d961f21285de89360173ccc76ee82eb504d726e (diff) | |
download | rockbox-9828f08d9b01af15a2d4d9e73e82e04fd0d1225b.tar.gz rockbox-9828f08d9b01af15a2d4d9e73e82e04fd0d1225b.zip |
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')
-rw-r--r-- | apps/plugins/vorbis2wav.c | 10 |
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; | |||
30 | 30 | ||
31 | /* Some standard functions and variables needed by Tremor */ | 31 | /* Some standard functions and variables needed by Tremor */ |
32 | 32 | ||
33 | |||
33 | int errno; | 34 | int errno; |
34 | 35 | ||
35 | size_t strlen(const char *s) { | 36 | size_t strlen(const char *s) { |
@@ -92,6 +93,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file) | |||
92 | int current_section; | 93 | int current_section; |
93 | int eof; | 94 | int eof; |
94 | static char pcmbuf[4096]; | 95 | static char pcmbuf[4096]; |
96 | #if BYTE_ORDER == BIG_ENDIAN | ||
97 | int i; | ||
98 | char x; | ||
99 | #endif | ||
95 | 100 | ||
96 | file_info_struct file_info; | 101 | file_info_struct file_info; |
97 | 102 | ||
@@ -139,6 +144,11 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file) | |||
139 | dprintf("Error decoding frame\n"); | 144 | dprintf("Error decoding frame\n"); |
140 | } else { | 145 | } else { |
141 | file_info.frames_decoded++; | 146 | file_info.frames_decoded++; |
147 | #if BYTE_ORDER == BIG_ENDIAN | ||
148 | for (i=0;i<n;i+=2) { | ||
149 | x=pcmbuf[i]; pcmbuf[i]=pcmbuf[i+1]; pcmbuf[i+1]=x; | ||
150 | } | ||
151 | #endif | ||
142 | rb->write(file_info.outfile,pcmbuf,n); | 152 | rb->write(file_info.outfile,pcmbuf,n); |
143 | file_info.current_sample+=(n/4); | 153 | file_info.current_sample+=(n/4); |
144 | } | 154 | } |