diff libmpcodecs/ae_pcm.c @ 25315:dfa8a510c81c

Fix all current known multi-channel wrong order problems by adding common functions for channel reordering. This fixes these modules by adding channel reordering code for 5.0/5.1 audio: ao: pcm ad: dmo, faad, ffmpeg(ac3, dca, libfaad, liba52), pcm ae: faac, lavc(ac3, libfaac), pcm
author ulion
date Mon, 10 Dec 2007 16:53:30 +0000
parents ed8f90096c65
children 0f1b5b68af32
line wrap: on
line diff
--- a/libmpcodecs/ae_pcm.c	Mon Dec 10 14:43:09 2007 +0000
+++ b/libmpcodecs/ae_pcm.c	Mon Dec 10 16:53:30 2007 +0000
@@ -8,6 +8,7 @@
 #include "mp_msg.h"
 #include "libmpdemux/aviheader.h"
 #include "libaf/af_format.h"
+#include "libaf/reorder_ch.h"
 #include "libmpdemux/ms_hdr.h"
 #include "stream/stream.h"
 #include "libmpdemux/muxer.h"
@@ -38,6 +39,14 @@
 static int encode_pcm(audio_encoder_t *encoder, uint8_t *dest, void *src, int nsamples, int max_size)
 {
 	max_size = FFMIN(nsamples, max_size);
+	if (encoder->params.channels == 6 || encoder->params.channels == 5) {
+		max_size -= max_size % (encoder->params.channels * 2);
+		reorder_channel_copy_nch(src, AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT,
+		                         dest, AF_CHANNEL_LAYOUT_WAVEEX_DEFAULT,
+		                         encoder->params.channels,
+		                         max_size / 2, 2);
+	}
+	else
 	memcpy(dest, src, max_size);
 	return max_size;
 }