summaryrefslogtreecommitdiffstats
path: root/audio/filter/af_channels.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-04-05 20:39:52 +0200
committerwm4 <wm4@nowhere>2013-05-12 21:24:54 +0200
commit7971bb87cb46f90152913de6ac673ae3bd1637a3 (patch)
tree7929e829c5960425270f4f0c017d84c37872ac5b /audio/filter/af_channels.c
parentf7a427676c0fe3c12509e3d9a243301f93626b0a (diff)
downloadmpv-7971bb87cb46f90152913de6ac673ae3bd1637a3.tar.bz2
mpv-7971bb87cb46f90152913de6ac673ae3bd1637a3.tar.xz
af: use mp_chmap for mp_audio, include channel map in format negotiation
Now af_lavrresample pretends to reorder the channels, although it doesn't yet, and nothing sets non-standard layouts either.
Diffstat (limited to 'audio/filter/af_channels.c')
-rw-r--r--audio/filter/af_channels.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/audio/filter/af_channels.c b/audio/filter/af_channels.c
index f6369936d6..7955018ec0 100644
--- a/audio/filter/af_channels.c
+++ b/audio/filter/af_channels.c
@@ -193,21 +193,16 @@ static int control(struct af_instance* af, int cmd, void* arg)
}
}
- if(AF_OK != af->control(af,AF_CONTROL_CHANNELS | AF_CONTROL_SET ,&nch))
+ struct mp_chmap chmap;
+ mp_chmap_from_channels(&chmap, nch);
+ if (AF_OK != af->control(af, AF_CONTROL_CHANNELS | AF_CONTROL_SET, &chmap))
return AF_ERROR;
return AF_OK;
}
case AF_CONTROL_CHANNELS | AF_CONTROL_SET:
// Reinit must be called after this function has been called
- // Sanity check
- if(((int*)arg)[0] <= 0 || ((int*)arg)[0] > AF_NCH){
- mp_msg(MSGT_AFILTER, MSGL_ERR, "[channels] The number of output channels must be"
- " between 1 and %i. Current value is %i\n",AF_NCH,((int*)arg)[0]);
- return AF_ERROR;
- }
-
- mp_audio_set_num_channels(af->data, ((int*)arg)[0]);
+ mp_audio_set_channels(af->data, (struct mp_chmap *)arg);
if(!s->router)
mp_msg(MSGT_AFILTER, MSGL_V, "[channels] Changing number of channels"
" to %i\n",af->data->nch);
@@ -247,7 +242,7 @@ static struct mp_audio* play(struct af_instance* af, struct mp_audio* data)
// Set output data
c->audio = l->audio;
c->len = c->len / c->nch * l->nch;
- mp_audio_set_num_channels(c, l->nch);
+ mp_audio_set_channels(c, &l->channels);
return c;
}