summaryrefslogtreecommitdiffstats
path: root/audio/filter
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-03-13 16:49:39 +0100
committerwm4 <wm4@nowhere>2020-03-13 17:34:46 +0100
commit8d965a1bfb3782343a03cff44977f11bb920f0b1 (patch)
tree2d115c24510ab36cc9ac7af8dea2b710537561c9 /audio/filter
parent5d5a7e19537a036fe16ce04555e6ce9449c47494 (diff)
downloadmpv-8d965a1bfb3782343a03cff44977f11bb920f0b1.tar.bz2
mpv-8d965a1bfb3782343a03cff44977f11bb920f0b1.tar.xz
options: change how option range min/max is handled
Before this commit, option declarations used M_OPT_MIN/M_OPT_MAX (and some other identifiers based on these) to signal whether an option had min/max values. Remove these flags, and make it use a range implicitly on the condition if min<max is true. This requires care in all cases when only M_OPT_MIN or M_OPT_MAX were set (instead of both). Generally, the commit replaces all these instances with using DBL_MAX/DBL_MIN for the "unset" part of the range. This also happens to fix some cases where you could pass over-large values to integer options, which were silently truncated, but now cause an error. This commit has some higher potential for regressions.
Diffstat (limited to 'audio/filter')
-rw-r--r--audio/filter/af_rubberband.c2
-rw-r--r--audio/filter/af_scaletempo.c9
2 files changed, 6 insertions, 5 deletions
diff --git a/audio/filter/af_rubberband.c b/audio/filter/af_rubberband.c
index c7b6317c13..4c2b69049d 100644
--- a/audio/filter/af_rubberband.c
+++ b/audio/filter/af_rubberband.c
@@ -361,7 +361,7 @@ const struct mp_user_filter_entry af_rubberband = {
OPT_CHOICE("channels", channels, 0,
({"apart", RubberBandOptionChannelsApart},
{"together", RubberBandOptionChannelsTogether})),
- OPT_DOUBLE("pitch-scale", scale, M_OPT_RANGE, .min = 0.01, .max = 100),
+ OPT_DOUBLE("pitch-scale", scale, 0, .min = 0.01, .max = 100),
{0}
},
},
diff --git a/audio/filter/af_scaletempo.c b/audio/filter/af_scaletempo.c
index ed1df5725e..b76abc8e78 100644
--- a/audio/filter/af_scaletempo.c
+++ b/audio/filter/af_scaletempo.c
@@ -30,6 +30,7 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <float.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
@@ -608,10 +609,10 @@ const struct mp_user_filter_entry af_scaletempo = {
.scale_nominal = 1.0,
},
.options = (const struct m_option[]) {
- OPT_FLOAT("scale", scale_nominal, M_OPT_MIN, .min = 0.01),
- OPT_FLOAT("stride", ms_stride, M_OPT_MIN, .min = 0.01),
- OPT_FLOAT("overlap", percent_overlap, M_OPT_RANGE, .min = 0, .max = 1),
- OPT_FLOAT("search", ms_search, M_OPT_MIN, .min = 0),
+ OPT_FLOAT("scale", scale_nominal, 0, .min = 0.01, .max = DBL_MAX),
+ OPT_FLOAT("stride", ms_stride, 0, .min = 0.01, .max = DBL_MAX),
+ OPT_FLOAT("overlap", percent_overlap, 0, .min = 0, .max = 1),
+ OPT_FLOAT("search", ms_search, 0, .min = 0, .max = DBL_MAX),
OPT_CHOICE("speed", speed_opt, 0,
({"pitch", SCALE_PITCH},
{"tempo", SCALE_TEMPO},