From 17352ad3155a64683613c8086f558599445aa3c7 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 21 Jul 2012 06:39:01 +0200 Subject: [PATCH] alacdec: fix packed sample output with 5.1 Signed-off-by: Michael Niedermayer --- libavcodec/alac.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libavcodec/alac.c b/libavcodec/alac.c index f146238327..4fa328539c 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -440,23 +440,29 @@ static int decode_element(AVCodecContext *avctx, void *data, int ch_index, switch(alac->sample_size) { case 16: { int16_t *outbuffer = ((int16_t *)alac->frame.extended_data[0]) + ch_index; - for (i = 0; i < alac->nb_samples; i++) + for (i = 0; i < alac->nb_samples; i++) { for (ch = 0; ch < channels; ch++) *outbuffer++ = alac->output_samples_buffer[ch][i]; + outbuffer += alac->channels - channels; + } } break; case 24: { int32_t *outbuffer = ((int32_t *)alac->frame.extended_data[0]) + ch_index; - for (i = 0; i < alac->nb_samples; i++) + for (i = 0; i < alac->nb_samples; i++) { for (ch = 0; ch < channels; ch++) *outbuffer++ = alac->output_samples_buffer[ch][i] << 8; + outbuffer += alac->channels - channels; + } } break; case 32: { int32_t *outbuffer = ((int32_t *)alac->frame.extended_data[0]) + ch_index; - for (i = 0; i < alac->nb_samples; i++) + for (i = 0; i < alac->nb_samples; i++) { for (ch = 0; ch < channels; ch++) *outbuffer++ = alac->output_samples_buffer[ch][i]; + outbuffer += alac->channels - channels; + } } break; }