From 1e37d35970398856e911487754056db9509f0c5a Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 31 Mar 2013 05:18:56 +0200 Subject: audio/filter: remove unused AF_CONTROLs Was unused, has never been used. --- audio/filter/af_channels.c | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'audio/filter/af_channels.c') diff --git a/audio/filter/af_channels.c b/audio/filter/af_channels.c index 8f676d8cfd..ac396a51cd 100644 --- a/audio/filter/af_channels.c +++ b/audio/filter/af_channels.c @@ -213,35 +213,6 @@ static int control(struct af_instance* af, int cmd, void* arg) mp_msg(MSGT_AFILTER, MSGL_V, "[channels] Changing number of channels" " to %i\n",af->data->nch); return AF_OK; - case AF_CONTROL_CHANNELS | AF_CONTROL_GET: - *(int*)arg = af->data->nch; - return AF_OK; - case AF_CONTROL_CHANNELS_ROUTING | AF_CONTROL_SET:{ - int ch = ((af_control_ext_t*)arg)->ch; - int* route = ((af_control_ext_t*)arg)->arg; - s->route[ch][FR] = route[FR]; - s->route[ch][TO] = route[TO]; - return AF_OK; - } - case AF_CONTROL_CHANNELS_ROUTING | AF_CONTROL_GET:{ - int ch = ((af_control_ext_t*)arg)->ch; - int* route = ((af_control_ext_t*)arg)->arg; - route[FR] = s->route[ch][FR]; - route[TO] = s->route[ch][TO]; - return AF_OK; - } - case AF_CONTROL_CHANNELS_NR | AF_CONTROL_SET: - s->nr = *(int*)arg; - return AF_OK; - case AF_CONTROL_CHANNELS_NR | AF_CONTROL_GET: - *(int*)arg = s->nr; - return AF_OK; - case AF_CONTROL_CHANNELS_ROUTER | AF_CONTROL_SET: - s->router = *(int*)arg; - return AF_OK; - case AF_CONTROL_CHANNELS_ROUTER | AF_CONTROL_GET: - *(int*)arg = s->router; - return AF_OK; } return AF_UNKNOWN; } -- cgit v1.2.3 From f7a427676c0fe3c12509e3d9a243301f93626b0a Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 5 Apr 2013 19:47:51 +0200 Subject: audio: add some setters for mp_audio, and require filters to use them mp_audio has some redundant fields. Setters like mp_audio_set_format() initialize these properly. Also move the mp_audio struct to a the file audio.c. We can remove a mysterious line of code from af.c: in.format |= af_bits2fmt(in.bps * 8); I'm not sure if this was ever actually needed, or if it was some kind of "make it work" quick-fix that works against the way things were supposed to work. All filters etc. now set the format correctly, so if there ever was a need for this code, it's definitely gone. --- audio/filter/af_channels.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'audio/filter/af_channels.c') diff --git a/audio/filter/af_channels.c b/audio/filter/af_channels.c index ac396a51cd..f6369936d6 100644 --- a/audio/filter/af_channels.c +++ b/audio/filter/af_channels.c @@ -164,8 +164,7 @@ static int control(struct af_instance* af, int cmd, void* arg) } af->data->rate = ((struct mp_audio*)arg)->rate; - af->data->format = ((struct mp_audio*)arg)->format; - af->data->bps = ((struct mp_audio*)arg)->bps; + mp_audio_set_format(af->data, ((struct mp_audio*)arg)->format); af->mul = (double)af->data->nch / ((struct mp_audio*)arg)->nch; return check_routes(s,((struct mp_audio*)arg)->nch,af->data->nch); case AF_CONTROL_COMMAND_LINE:{ @@ -208,7 +207,7 @@ static int control(struct af_instance* af, int cmd, void* arg) return AF_ERROR; } - af->data->nch=((int*)arg)[0]; + mp_audio_set_num_channels(af->data, ((int*)arg)[0]); if(!s->router) mp_msg(MSGT_AFILTER, MSGL_V, "[channels] Changing number of channels" " to %i\n",af->data->nch); @@ -248,7 +247,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; - c->nch = l->nch; + mp_audio_set_num_channels(c, l->nch); return c; } -- cgit v1.2.3 From 7971bb87cb46f90152913de6ac673ae3bd1637a3 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 5 Apr 2013 20:39:52 +0200 Subject: 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. --- audio/filter/af_channels.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'audio/filter/af_channels.c') 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; } -- cgit v1.2.3