diff options
Diffstat (limited to 'tools/rbspeex/rbspeexdec.c')
-rw-r--r-- | tools/rbspeex/rbspeexdec.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/rbspeex/rbspeexdec.c b/tools/rbspeex/rbspeexdec.c index 7c5df3eb50..14ee971697 100644 --- a/tools/rbspeex/rbspeexdec.c +++ b/tools/rbspeex/rbspeexdec.c | |||
@@ -89,6 +89,15 @@ int main(int argc, char **argv) | |||
89 | speex_bits_set_bit_buffer(&bits, indata, insize); | 89 | speex_bits_set_bit_buffer(&bits, indata, insize); |
90 | while (speex_decode_int(st, &bits, out) == 0) { | 90 | while (speex_decode_int(st, &bits, out) == 0) { |
91 | /* if no error, write decoded audio */ | 91 | /* if no error, write decoded audio */ |
92 | #if defined(__BIG_ENDIAN__) | ||
93 | /* byteswap samples from host (big) endianess to file (little) before | ||
94 | * writing. */ | ||
95 | unsigned int a = frame_size - lookahead; | ||
96 | while(a--) { | ||
97 | out[lookahead + a] = ((unsigned short)out[lookahead+a]<<8)&0xff00 | ||
98 | | ((unsigned short)out[lookahead+a]>>8)&0x00ff; | ||
99 | } | ||
100 | #endif | ||
92 | fwrite(out + lookahead, sizeof(short), frame_size - lookahead, fout); | 101 | fwrite(out + lookahead, sizeof(short), frame_size - lookahead, fout); |
93 | samples += frame_size - lookahead; | 102 | samples += frame_size - lookahead; |
94 | lookahead = 0; /* only skip samples at the start */ | 103 | lookahead = 0; /* only skip samples at the start */ |