summaryrefslogtreecommitdiff
path: root/libavcodec/ac3dec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2009-04-17 08:43:04 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2009-04-17 08:43:04 +0000
commit95f3019a5193712a49cdcf9f2bc460e5c94fbc94 (patch)
tree6c5bd7196e45c7b90b62b9d9d1fbb468f46c1614 /libavcodec/ac3dec.c
parent8b5ec0875c8d00d62034ed1df7188b7c75baba3a (diff)
ac3dec: reorder output channels to SMPTE channel order
Originally committed as revision 18542 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ac3dec.c')
-rw-r--r--libavcodec/ac3dec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 854a38f32b..4a177aae69 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -1233,6 +1233,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
AC3DecodeContext *s = avctx->priv_data;
int16_t *out_samples = (int16_t *)data;
int blk, ch, err;
+ const uint8_t *channel_map;
/* initialize the GetBitContext with the start of valid AC-3 Frame */
if (s->input_buffer) {
@@ -1321,6 +1322,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
}
/* decode the audio blocks */
+ channel_map = ff_ac3_dec_channel_map[s->output_mode & ~AC3_OUTPUT_LFEON][s->lfe_on];
for (blk = 0; blk < s->num_blocks; blk++) {
const float *output[s->out_channels];
if (!err && decode_audio_block(s, blk)) {
@@ -1328,7 +1330,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
err = 1;
}
for (ch = 0; ch < s->out_channels; ch++)
- output[ch] = s->output[ch];
+ output[ch] = s->output[channel_map[ch]];
s->dsp.float_to_int16_interleave(out_samples, output, 256, s->out_channels);
out_samples += 256 * s->out_channels;
}