diff -Nraub mplayer.ori/libmpcodecs/ae_faac.c mplayer/libmpcodecs/ae_faac.c --- mplayer.ori/libmpcodecs/ae_faac.c 2006-10-08 15:57:44.000000000 -0400 +++ mplayer/libmpcodecs/ae_faac.c 2006-10-12 23:43:25.000000000 -0400 @@ -97,6 +97,25 @@ static int encode_faac(audio_encoder_t *encoder, uint8_t *dest, void *src, int len, int max_size) { + if (encoder->params.channels == 6 || encoder->params.channels == 5) { + //Codec wants: C L R SL SR LFE + //We have: L R SL SR C LFE + int i; + uint16_t tmp16; + uint32_t tmp32; + for (i = 0; i < len; i += encoder->params.channels*divisor) { + if (divisor == 4) + tmp32 = ((uint32_t*)(src+i))[4]; + else + tmp16 = ((uint16_t*)(src+i))[4]; + memmove(src+i+divisor, src+i, 4*divisor); + if (divisor == 4) + ((uint32_t*)(src+i))[0] = tmp32; + else + ((uint16_t*)(src+i))[0] = tmp16; + } + } + // len is divided by the number of bytes per sample enc_frame_size = faacEncEncode(faac, (int32_t*) src, len / divisor, dest, max_size);