diff options
author | wm4 <wm4@nowhere> | 2020-03-13 16:49:39 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-03-13 17:34:46 +0100 |
commit | 8d965a1bfb3782343a03cff44977f11bb920f0b1 (patch) | |
tree | 2d115c24510ab36cc9ac7af8dea2b710537561c9 /filters/f_decoder_wrapper.c | |
parent | 5d5a7e19537a036fe16ce04555e6ce9449c47494 (diff) | |
download | mpv-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 'filters/f_decoder_wrapper.c')
-rw-r--r-- | filters/f_decoder_wrapper.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/filters/f_decoder_wrapper.c b/filters/f_decoder_wrapper.c index 82cc0a15db..6b297b671f 100644 --- a/filters/f_decoder_wrapper.c +++ b/filters/f_decoder_wrapper.c @@ -15,6 +15,7 @@ * License along with mpv. If not, see <http://www.gnu.org/licenses/>. */ +#include <float.h> #include <stdio.h> #include <stdlib.h> #include <stdbool.h> @@ -63,9 +64,9 @@ struct dec_queue_opts { static const struct m_option dec_queue_opts_list[] = { OPT_FLAG("enable", use_queue, 0), - OPT_DOUBLE("max-secs", max_duration, M_OPT_MIN, .min = 0), + OPT_DOUBLE("max-secs", max_duration, 0, .min = 0, .max = DBL_MAX), OPT_BYTE_SIZE("max-bytes", max_bytes, 0, 0, (size_t)-1), - OPT_INT64("max-samples", max_samples, M_OPT_MIN, 0, 0), + OPT_INT64("max-samples", max_samples, 0, .min = 0, .max = DBL_MAX), {0} }; @@ -115,14 +116,14 @@ static int decoder_list_opt(struct mp_log *log, const m_option_t *opt, const struct m_sub_options dec_wrapper_conf = { .opts = (const struct m_option[]){ OPT_FLAG("correct-pts", correct_pts, 0), - OPT_DOUBLE("fps", force_fps, CONF_MIN, .min = 0), + OPT_DOUBLE("fps", force_fps, 0, .min = 0, .max = DBL_MAX), OPT_STRING_VALIDATE("ad", audio_decoders, 0, decoder_list_opt), OPT_STRING_VALIDATE("vd", video_decoders, 0, decoder_list_opt), OPT_STRING_VALIDATE("audio-spdif", audio_spdif, 0, decoder_list_opt), OPT_CHOICE_OR_INT("video-rotate", video_rotate, UPDATE_IMGPAR, 0, 359, ({"no", -1})), OPT_ASPECT("video-aspect-override", movie_aspect, - UPDATE_IMGPAR | M_OPT_RANGE, .min = -1, .max = 10), + UPDATE_IMGPAR, .min = -1, .max = 10), OPT_CHOICE("video-aspect-method", aspect_method, UPDATE_IMGPAR, ({"bitstream", 1}, {"container", 2})), OPT_SUBSTRUCT("vd-queue", vdec_queue_opts, vdec_queue_conf, 0), |