[MPlayer-dev-eng] [PATCH] audio channel remapping

Giacomo Comes comes at naic.edu
Sat Nov 17 14:18:27 CET 2007


On Fri, Nov 16, 2007 at 10:46:57PM -0800, Corey Hickey wrote:
> Corey Hickey wrote:
> > Hello,
> > 
> > This patch makes mplayer and mencoder auto-insert the channels filter
> > when necessary in order to maintain the proper order. Remapping is
> > necessary when reading from or writing to formats that have a different
> > native order from what mplayer and mencoder use internally.
> 
> Here's an updated version of this patch in case it is of use.
> 
> -Corey

[snip]

> --- libmpcodecs/ae_lavc.c	(revision 25055)
> +++ libmpcodecs/ae_lavc.c	(working copy)
> @@ -46,6 +46,22 @@
>  	mux_a->wf->nAvgBytesPerSec = (lavc_actx->bit_rate / 8);
>          mux_a->avg_rate= lavc_actx->bit_rate;
>  	mux_a->h.dwRate = mux_a->wf->nAvgBytesPerSec;
> +	/* remap channels */
> +	switch (lavc_actx->channels) {
> +		case 1: /* FC, no action needed */
> +		case 2: /* FL FR, no action needed */
> +		case 3: /* unknown */
> +		case 4: /* FL FR BL BR, no action needed */
> +			break;
> +		case 5: /* FL FC FR BL BR */
> +			encoder->output_chan_map = "00" "21" "32" "43" "14";
> +			break;
> +		case 6: /* FL FC FR BL BR LFE */
> +			encoder->output_chan_map = "00" "21" "32" "43" "14" "55";
> +			break;
> +		default:
> +			break;
> +	}
>  	if(lavc_actx->block_align)
>  		mux_a->h.dwSampleSize = mux_a->h.dwScale = lavc_actx->block_align;
>  	else 

This part needs an update. It is now possible to encode aac audio with 
libavcodec and the reorder is different depending if audio codec is ac3 or aac.

Ciao
Giacomo



More information about the MPlayer-dev-eng mailing list