mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-20 18:42:41 -05:00
Byte-swap WAV data on big-endian targets
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6018 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
4d961f2128
commit
9828f08d9b
1 changed files with 10 additions and 0 deletions
|
|
@ -30,6 +30,7 @@ static struct plugin_api* rb;
|
||||||
|
|
||||||
/* Some standard functions and variables needed by Tremor */
|
/* Some standard functions and variables needed by Tremor */
|
||||||
|
|
||||||
|
|
||||||
int errno;
|
int errno;
|
||||||
|
|
||||||
size_t strlen(const char *s) {
|
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 current_section;
|
||||||
int eof;
|
int eof;
|
||||||
static char pcmbuf[4096];
|
static char pcmbuf[4096];
|
||||||
|
#if BYTE_ORDER == BIG_ENDIAN
|
||||||
|
int i;
|
||||||
|
char x;
|
||||||
|
#endif
|
||||||
|
|
||||||
file_info_struct file_info;
|
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");
|
dprintf("Error decoding frame\n");
|
||||||
} else {
|
} else {
|
||||||
file_info.frames_decoded++;
|
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);
|
rb->write(file_info.outfile,pcmbuf,n);
|
||||||
file_info.current_sample+=(n/4);
|
file_info.current_sample+=(n/4);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue