From ae5ac7e90a96c02f66b3eb5b63ed960bfffa3fdb Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Thu, 18 Jun 2020 02:00:51 +0200 Subject: vo_gpu: fix scaler/window validation to allow unsetting --dscale= and --*scale-window= (i.e. an empty string) are respectively valid settings for their options (and, in fact, the defaults). This fixes the bug that it was impossible to reset e.g. tscale-window back to the default "unset" setting after setting it once. Credit goes to @CounterPillow for locating the cause of this bug. --- video/out/gpu/video.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c index dedeed7001..f135d0ff94 100644 --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c @@ -4083,6 +4083,8 @@ static int validate_scaler_opt(struct mp_log *log, const m_option_t *opt, bool tscale = bstr_equals0(name, "tscale"); if (bstr_equals0(param, "help")) { r = M_OPT_EXIT; + } else if (bstr_equals0(name, "dscale") && !param.len) { + return r; // empty dscale means "use same as upscaler" } else { snprintf(s, sizeof(s), "%.*s", BSTR_P(param)); if (!handle_scaler_opt(s, tscale)) @@ -4112,6 +4114,8 @@ static int validate_window_opt(struct mp_log *log, const m_option_t *opt, int r = 1; if (bstr_equals0(param, "help")) { r = M_OPT_EXIT; + } else if (!param.len) { + return r; // empty string means "use preferred window" } else { snprintf(s, sizeof(s), "%.*s", BSTR_P(param)); const struct filter_window *window = mp_find_filter_window(s); -- cgit v1.2.3