forked from len0rd/rockbox
Fix rbspeex on big endian hosts.
Big endian hosts need to byteswap the wave data when reading or writing to disk. Should fix speex based voice- and talkfiles only containing garbage on PPC machines. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25177 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
3e9222de38
commit
b6ed0b606f
2 changed files with 19 additions and 1 deletions
|
|
@ -136,6 +136,7 @@ bool encode_file(FILE *fin, FILE *fout, float quality, int complexity,
|
|||
int i, tmp, target_sr, numchan, bps, sr, numsamples, frame_size, lookahead;
|
||||
int nbytes;
|
||||
bool ret = true;
|
||||
int a;
|
||||
|
||||
if (!get_wave_metadata(fin, &numchan, &bps, &sr, &numsamples)) {
|
||||
snprintf(errstr, errlen, "invalid WAV file");
|
||||
|
|
@ -179,7 +180,15 @@ bool encode_file(FILE *fin, FILE *fout, float quality, int complexity,
|
|||
snprintf(errstr, errlen, "could not read input file data");
|
||||
ret = false;
|
||||
goto finish;
|
||||
}
|
||||
}
|
||||
#if defined(__BIG_ENDIAN__)
|
||||
/* byteswap read bytes to host endianess. */
|
||||
a = numsamples;
|
||||
while(a--) {
|
||||
*(in + a) = ((unsigned short)(*(in + a)) >> 8) & 0x00ff
|
||||
| ((unsigned short)(*(in + a)) << 8) & 0xff00;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (volume != 1.0f) {
|
||||
for (i = 0; i < numsamples; ++i)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue