diff ac3dec.c @ 9454:7db61b0d21f9 libavcodec

ac3dec: reorder output channels to SMPTE channel order
author jbr
date Fri, 17 Apr 2009 08:43:04 +0000
parents 54bc8a2727b0
children ba5d9a97ab2f
line wrap: on
line diff
--- a/ac3dec.c	Fri Apr 17 08:42:08 2009 +0000
+++ b/ac3dec.c	Fri Apr 17 08:43:04 2009 +0000
@@ -1233,6 +1233,7 @@
     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 @@
     }
 
     /* 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 @@
             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;
     }