diff options
author | Max Kellermann <max@duempel.org> | 2009-07-22 15:56:56 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-07-22 15:56:56 +0200 |
commit | c5a662f405a28caca2380d1b20fed050b1407ad5 (patch) | |
tree | 8d4e323e1f1196ac9c20e91903478b041551be00 /src/pcm_convert.c | |
parent | 92779504415e00c2ab5a15dd28ffaf3f067f2ead (diff) | |
download | mpd-c5a662f405a28caca2380d1b20fed050b1407ad5.tar.gz mpd-c5a662f405a28caca2380d1b20fed050b1407ad5.tar.xz mpd-c5a662f405a28caca2380d1b20fed050b1407ad5.zip |
pcm_convert: added pcm_convert_state.byteswap_buffer
Currently, byteswapping is performed on the format_buffer. This can
go wrong when this buffer is used twice during one run. Add a
separate buffer for swapping the byte order.
Diffstat (limited to 'src/pcm_convert.c')
-rw-r--r-- | src/pcm_convert.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/pcm_convert.c b/src/pcm_convert.c index 2d72628b2..94c72a941 100644 --- a/src/pcm_convert.c +++ b/src/pcm_convert.c @@ -40,6 +40,7 @@ void pcm_convert_init(struct pcm_convert_state *state) pcm_buffer_init(&state->format_buffer); pcm_buffer_init(&state->channels_buffer); + pcm_buffer_init(&state->byteswap_buffer); } void pcm_convert_deinit(struct pcm_convert_state *state) @@ -48,6 +49,7 @@ void pcm_convert_deinit(struct pcm_convert_state *state) pcm_buffer_deinit(&state->format_buffer); pcm_buffer_deinit(&state->channels_buffer); + pcm_buffer_deinit(&state->byteswap_buffer); } static const int16_t * @@ -85,7 +87,7 @@ pcm_convert_16(struct pcm_convert_state *state, &len); if (dest_format->reverse_endian) { - buf = pcm_byteswap_16(&state->format_buffer, buf, len); + buf = pcm_byteswap_16(&state->byteswap_buffer, buf, len); if (!buf) g_error("pcm_byteswap_16() failed"); } @@ -128,7 +130,7 @@ pcm_convert_24(struct pcm_convert_state *state, &len); if (dest_format->reverse_endian) { - buf = pcm_byteswap_32(&state->format_buffer, buf, len); + buf = pcm_byteswap_32(&state->byteswap_buffer, buf, len); if (!buf) g_error("pcm_byteswap_32() failed"); } @@ -171,7 +173,7 @@ pcm_convert_32(struct pcm_convert_state *state, &len); if (dest_format->reverse_endian) { - buf = pcm_byteswap_32(&state->format_buffer, buf, len); + buf = pcm_byteswap_32(&state->byteswap_buffer, buf, len); if (!buf) g_error("pcm_byteswap_32() failed"); } |