summaryrefslogtreecommitdiff
path: root/src/audio_dec/xine_lpcm_decoder.c
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2008-04-09 18:28:49 +0100
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2008-04-09 18:28:49 +0100
commit39939c95eff90545285a9a8f761d9fa6e9349358 (patch)
treeb8ea1fa3f2ddf1627eeecbd889f47226b01a45d8 /src/audio_dec/xine_lpcm_decoder.c
parent19357940a57c565ebe319729bd08d6e4800aff5d (diff)
parent628c4cbd9d023e74a7c6805d7ec0f163f2c172d1 (diff)
downloadxine-lib-39939c95eff90545285a9a8f761d9fa6e9349358.tar.gz
xine-lib-39939c95eff90545285a9a8f761d9fa6e9349358.tar.bz2
Merge from 1.2 main.
Diffstat (limited to 'src/audio_dec/xine_lpcm_decoder.c')
-rw-r--r--src/audio_dec/xine_lpcm_decoder.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/audio_dec/xine_lpcm_decoder.c b/src/audio_dec/xine_lpcm_decoder.c
index e84b112f4..83043cec9 100644
--- a/src/audio_dec/xine_lpcm_decoder.c
+++ b/src/audio_dec/xine_lpcm_decoder.c
@@ -192,18 +192,34 @@ static void lpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
uint8_t *d = (uint8_t *)audio_buffer->mem;
int n = buf->size;
- while (n >= 0) {
+ while (n >= 3) {
if ( stream_be ) {
- *d++ = s[0];
- *d++ = s[1];
+ if ( stream_be == this->cpu_be ) {
+ *d++ = s[0];
+ *d++ = s[1];
+ } else {
+ *d++ = s[1];
+ *d++ = s[0];
+ }
} else {
- *d++ = s[1];
- *d++ = s[2];
+ if ( stream_be == this->cpu_be ) {
+ *d++ = s[1];
+ *d++ = s[2];
+ }
+ else
+ {
+ *d++ = s[2];
+ *d++ = s[1];
+ }
}
s += 3;
n -= 3;
}
+
+ if ( (d - (uint8_t*)audio_buffer->mem)/2*3 < buf->size )
+ xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "lpcm_decoder: lost %i bytes\n", (int)(buf->size - (d - (uint8_t*)audio_buffer->mem))/2*3);
+
} else {
memcpy (audio_buffer->mem, sample_buffer, buf->size);
}