Fix af_pan commandline mess and (hopefully) improve description.

It should now output the right number of channels and it doesn't silently
clamp values to the too restrictive [0, 1] range.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16494 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2005-09-15 11:41:23 +00:00
parent 3567bcac06
commit e3d0df70fe
2 changed files with 16 additions and 9 deletions

View File

@ -3986,18 +3986,22 @@ this filter can be found in the examples section near the end.
.PD 0
.RSs
.IPs <n>\ \
number of input channels (1\-6)
number of output channels (1\-6)
.IPs <lij>
How much of input channel j is mixed into output channel i (0\-1).
How much of input channel i is mixed into output channel j (0\-1).
So in principle you first have n numbers saying what to do with the
first input channel, then n numbers that act on the second input channel
etc.
If you don't specify any numbers for some input channels, 0 is assumed.
.RE
.sp 1
.RS
.I EXAMPLE:
.RE
.RSs
.IPs "mplayer \-af pan=1:0.5:0.5 \-channels 1 media.avi"
.IPs "mplayer \-af pan=1:0.5:0.5 media.avi"
Would down-mix from stereo to mono.
.IPs "mplayer \-af pan=3:1:0:1:0.5:0.5 \-channels 3 media.avi"
.IPs "mplayer \-af pan=3:1:0:0.5:0:1:0.5 media.avi"
Would give 3 channel output leaving channels 0 and 1 intact,
and mix channels 0 and 1 into output channel 2 (which could
be sent to a subwoofer for example).
@ -8963,7 +8967,7 @@ mplayer \-vo zr2 \-vf scale=352:288,zrmjpeg file.avi
.
.TP
.B Play a 6-channel AAC file with only two speakers:
mplayer \-rawaudio on:format=0xff \-af pan=6:.32:.39:.06:.17:-.17:.33:.32:.06:.39:-.17:.17:.33 adts_he-aac160_51.aac
mplayer \-rawaudio on:format=0xff \-af pan=2:.32:.32:.39:.06:.06:.39:.17:-.17:-.17:.17:.33:.33 adts_he-aac160_51.aac
.br
You might want to play a bit with the pan values (e.g multiply with a value) to
increase volume or avoid clipping.

View File

@ -64,10 +64,9 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
cp = &((char*)arg)[n];
j = 0; k = 0;
while((*cp == ':') && (k < AF_NCH)){
sscanf(cp, ":%f%n" , &s->level[k][j], &n);
s->level[k][j] = clamp(s->level[k][j],0.0,1.0);
sscanf(cp, ":%f%n" , &s->level[j][k], &n);
af_msg(AF_MSG_VERBOSE,"[pan] Pan level from channel %i to"
" channel %i = %f\n",j,k,s->level[k][j]);
" channel %i = %f\n",k,j,s->level[j][k]);
cp =&cp[n];
j++;
if(j>=nch){
@ -81,14 +80,18 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
int i;
int ch = ((af_control_ext_t*)arg)->ch;
float* level = ((af_control_ext_t*)arg)->arg;
if (ch >= AF_NCH)
return AF_FALSE;
for(i=0;i<AF_NCH;i++)
s->level[ch][i] = clamp(level[i],0.0,1.0);
s->level[ch][i] = level[i];
return AF_OK;
}
case AF_CONTROL_PAN_LEVEL | AF_CONTROL_GET:{
int i;
int ch = ((af_control_ext_t*)arg)->ch;
float* level = ((af_control_ext_t*)arg)->arg;
if (ch >= AF_NCH)
return AF_FALSE;
for(i=0;i<AF_NCH;i++)
level[i] = s->level[ch][i];
return AF_OK;