diff options
author | wm4 <wm4@nowhere> | 2013-11-18 14:16:08 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-11-18 14:21:01 +0100 |
commit | 5594718b6bda3a230e2e2c3cb06d2837c5a02688 (patch) | |
tree | dca02cab9bde6d50d148a62b20ec99aa8601b847 /audio/filter/af_delay.c | |
parent | 93852b08f37f630b994d126751b4b9740a13219f (diff) | |
download | mpv-5594718b6bda3a230e2e2c3cb06d2837c5a02688.tar.bz2 mpv-5594718b6bda3a230e2e2c3cb06d2837c5a02688.tar.xz |
audio/filter: remove unneeded AF_CONTROLs, convert to enum
The AF control commands used an elaborate and unnecessary organization
for the command constants. Get rid of all that and convert the
definitions to a simple enum. Also remove the control commands that
were not really needed, because they were not used outside of the
filters that implemented them.
Diffstat (limited to 'audio/filter/af_delay.c')
-rw-r--r-- | audio/filter/af_delay.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/audio/filter/af_delay.c b/audio/filter/af_delay.c index e2ef57221d..e605ca71f4 100644 --- a/audio/filter/af_delay.c +++ b/audio/filter/af_delay.c @@ -65,7 +65,16 @@ static int control(struct af_instance* af, int cmd, void* arg) mp_msg(MSGT_AFILTER, MSGL_FATAL, "[delay] Out of memory\n"); } - return control(af,AF_CONTROL_DELAY_LEN | AF_CONTROL_SET,s->d); + if(AF_OK != af_from_ms(AF_NCH, s->d, s->wi, af->data->rate, 0.0, 1000.0)) + return AF_ERROR; + s->ri = 0; + for(i=0;i<AF_NCH;i++){ + mp_msg(MSGT_AFILTER, MSGL_DBG2, "[delay] Channel %i delayed by %0.3fms\n", + i,MPCLAMP(s->d[i],0.0,1000.0)); + mp_msg(MSGT_AFILTER, MSGL_DBG3, "[delay] Channel %i delayed by %i samples\n", + i,s->wi[i]); + } + return AF_OK; } case AF_CONTROL_COMMAND_LINE:{ int n = 1; @@ -80,29 +89,6 @@ static int control(struct af_instance* af, int cmd, void* arg) } return AF_OK; } - case AF_CONTROL_DELAY_LEN | AF_CONTROL_SET:{ - int i; - if(AF_OK != af_from_ms(AF_NCH, arg, s->wi, af->data->rate, 0.0, 1000.0)) - return AF_ERROR; - s->ri = 0; - for(i=0;i<AF_NCH;i++){ - mp_msg(MSGT_AFILTER, MSGL_DBG2, "[delay] Channel %i delayed by %0.3fms\n", - i,MPCLAMP(s->d[i],0.0,1000.0)); - mp_msg(MSGT_AFILTER, MSGL_DBG3, "[delay] Channel %i delayed by %i samples\n", - i,s->wi[i]); - } - return AF_OK; - } - case AF_CONTROL_DELAY_LEN | AF_CONTROL_GET:{ - int i; - for(i=0;i<AF_NCH;i++){ - if(s->ri > s->wi[i]) - s->wi[i] = L - (s->ri - s->wi[i]); - else - s->wi[i] = s->wi[i] - s->ri; - } - return af_to_ms(AF_NCH, s->wi, arg, af->data->rate); - } } return AF_UNKNOWN; } |