diff options
author | wm4 <wm4@nowhere> | 2020-04-09 11:08:03 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-04-09 11:13:38 +0200 |
commit | 9d32d62b6154784a4e38dcb0ff50b8331e9169bf (patch) | |
tree | f2507d768e02fadc312e9ccc53765527b3d992c9 /options | |
parent | a67bda28409dd893617ef47f6e089fd753d7de78 (diff) | |
download | mpv-9d32d62b6154784a4e38dcb0ff50b8331e9169bf.tar.bz2 mpv-9d32d62b6154784a4e38dcb0ff50b8331e9169bf.tar.xz |
options: fix ab-loop-* properties
These used ".min = MP_NOPTS_VALUE" to indicate certain exceptions. This
broke with the recent change to how min/max are handled, which made
setting min or max mean that a value range is used, thus setting max=0.
Fix this by not using magic a value in .min; replace it with a proper
flag.
Fixes: #7596
Diffstat (limited to 'options')
-rw-r--r-- | options/m_option.c | 2 | ||||
-rw-r--r-- | options/m_option.h | 5 | ||||
-rw-r--r-- | options/options.c | 4 |
3 files changed, 7 insertions, 4 deletions
diff --git a/options/m_option.c b/options/m_option.c index a7b02b8819..fcc52406ff 100644 --- a/options/m_option.c +++ b/options/m_option.c @@ -2639,7 +2639,7 @@ static int parse_timestring(struct bstr str, double *time, char endchar) return len; } -#define HAS_NOPTS(opt) ((opt)->min == MP_NOPTS_VALUE) +#define HAS_NOPTS(opt) ((opt)->flags & M_OPT_ALLOW_NO) static int parse_time(struct mp_log *log, const m_option_t *opt, struct bstr name, struct bstr param, void *dst) diff --git a/options/m_option.h b/options/m_option.h index 84336ae3ce..8a8b54b510 100644 --- a/options/m_option.h +++ b/options/m_option.h @@ -427,7 +427,10 @@ char *format_file_size(int64_t size); (((UPDATE_OPT_LAST << 1) - 1) & ~(unsigned)(UPDATE_OPT_FIRST - 1)) // type_float/type_double: string "default" is parsed as NaN (and reverse) -#define M_OPT_DEFAULT_NAN (1 << 29) +#define M_OPT_DEFAULT_NAN (1 << 25) + +// type time: string "no" maps to MP_NOPTS_VALUE (if unset, NOPTS is rejected) +#define M_OPT_ALLOW_NO (1 << 26) // Like M_OPT_TYPE_OPTIONAL_PARAM. #define M_OPT_OPTIONAL_PARAM (1 << 30) diff --git a/options/options.c b/options/options.c index c7d75b0648..3536e439a0 100644 --- a/options/options.c +++ b/options/options.c @@ -447,8 +447,8 @@ static const m_option_t mp_opts[] = { {"rebase-start-time", OPT_FLAG(rebase_start_time)}, - {"ab-loop-a", OPT_TIME(ab_loop[0]), .min = MP_NOPTS_VALUE}, - {"ab-loop-b", OPT_TIME(ab_loop[1]), .min = MP_NOPTS_VALUE}, + {"ab-loop-a", OPT_TIME(ab_loop[0]), .flags = M_OPT_ALLOW_NO}, + {"ab-loop-b", OPT_TIME(ab_loop[1]), .flags = M_OPT_ALLOW_NO}, {"ab-loop-count", OPT_CHOICE(ab_loop_count, {"inf", -1}), M_RANGE(0, INT_MAX)}, |