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.
This commit is contained in:
Niklas Haas 2020-06-18 02:00:51 +02:00
parent b97f57bfd4
commit ae5ac7e90a
1 changed files with 4 additions and 0 deletions

View File

@ -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);