mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
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
|
|
@ -89,6 +89,15 @@ int main(int argc, char **argv)
|
|||
speex_bits_set_bit_buffer(&bits, indata, insize);
|
||||
while (speex_decode_int(st, &bits, out) == 0) {
|
||||
/* if no error, write decoded audio */
|
||||
#if defined(__BIG_ENDIAN__)
|
||||
/* byteswap samples from host (big) endianess to file (little) before
|
||||
* writing. */
|
||||
unsigned int a = frame_size - lookahead;
|
||||
while(a--) {
|
||||
out[lookahead + a] = ((unsigned short)out[lookahead+a]<<8)&0xff00
|
||||
| ((unsigned short)out[lookahead+a]>>8)&0x00ff;
|
||||
}
|
||||
#endif
|
||||
fwrite(out + lookahead, sizeof(short), frame_size - lookahead, fout);
|
||||
samples += frame_size - lookahead;
|
||||
lookahead = 0; /* only skip samples at the start */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue