1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-01 20:00:37 +00:00

audio: fix balance control

Balance controls as used by mixer.c was broken, because af_pan.c stopped
accepting its arguments. We have to allow 0 channels explicitly. Also,
fix null pointer access if the matrix parameter is not used.

Regression from commit 82983970.
This commit is contained in:
wm4 2014-01-23 15:53:36 +01:00
parent 4a3975bf7e
commit f088abb2bf

View File

@ -153,13 +153,13 @@ static int af_open(struct af_instance* af){
int j,k;
int nch = s->nch;
if(AF_OK != control(af,AF_CONTROL_SET_PAN_NOUT, &nch))
if(nch && AF_OK != control(af,AF_CONTROL_SET_PAN_NOUT, &nch))
return AF_ERROR;
// Read pan values
char *cp = s->matrixstr;
j = 0; k = 0;
while(k < AF_NCH){
while(cp && k < AF_NCH){
sscanf(cp, "%f%n" , &s->level[j][k], &n);
MP_VERBOSE(af, "[pan] Pan level from channel %i to"
" channel %i = %f\n",k,j,s->level[j][k]);