[MPlayer-dev-eng] [PATCH] af_pan.c: Avoid zero output channels when reinit af pan

Reimar Doeffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Wed Jun 13 09:57:21 CEST 2007


Hello,
On Wed, Jun 13, 2007 at 09:53:47AM +0800, Zuxy Meng wrote:
> Index: libaf/af_pan.c
> ===================================================================
> --- libaf/af_pan.c	?????? 23545??
> +++ libaf/af_pan.c	????????????
> @@ -22,6 +22,7 @@
>  // Data for specific instances of this filter
>  typedef struct af_pan_s
>  {
> +  int nch; // Number of output channels; zero means same as input
>    float level[AF_NCH][AF_NCH];	// Gain level for each channel
>  }af_pan_t;
>  
> @@ -38,6 +39,7 @@
>      af->data->rate   = ((af_data_t*)arg)->rate;
>      af->data->format = AF_FORMAT_FLOAT_NE;
>      af->data->bps    = 4;
> +    af->data->nch    = s->nch ? s->nch: ((af_data_t*)arg)->nch;
>      af->mul.n        = af->data->nch;
>      af->mul.d	     = ((af_data_t*)arg)->nch;
>      af_frac_cancel(&af->mul);
> @@ -48,7 +50,7 @@
>        ((af_data_t*)arg)->bps = af->data->bps;
>        return AF_FALSE;
>      }
> -    return control(af,AF_CONTROL_PAN_NOUT | AF_CONTROL_SET, &af->data->nch);
> +    return AF_OK;
>    case AF_CONTROL_COMMAND_LINE:{
>      int   nch = 0;
>      int   n = 0;
> @@ -104,7 +106,7 @@
>  	     " between 1 and %i. Current value is %i\n",AF_NCH,((int*)arg)[0]);
>        return AF_ERROR;
>      }
> -    af->data->nch=((int*)arg)[0];
> +    s->nch=af->data->nch=((int*)arg)[0];

Hmm.. why is it necessary to set af->data->nch here?

> Index: libaf/af_pan.c
> ===================================================================
> --- libaf/af_pan.c	?????? 23545??
> +++ libaf/af_pan.c	????????????
> @@ -183,6 +185,6 @@
>      "pan",
>      "Anders",
>      "",
> -    AF_FLAGS_NOT_REENTRANT,
> +    AF_FLAGS_REENTRANT,

Seems ok to me, I'd say go ahead.

Greetings,
Reimar Doeffinger



More information about the MPlayer-dev-eng mailing list