mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
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.
This commit is contained in:
@@ -62,7 +62,7 @@ const struct m_sub_options stream_lavf_conf = {
|
||||
OPT_STRING("tls-ca-file", tls_ca_file, M_OPT_FILE),
|
||||
OPT_STRING("tls-cert-file", tls_cert_file, M_OPT_FILE),
|
||||
OPT_STRING("tls-key-file", tls_key_file, M_OPT_FILE),
|
||||
OPT_DOUBLE("network-timeout", timeout, M_OPT_MIN, .min = 0),
|
||||
OPT_DOUBLE("network-timeout", timeout, 0, .min = 0, .max = DBL_MAX),
|
||||
OPT_STRING("http-proxy", http_proxy, 0),
|
||||
{0}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user