mirror of https://github.com/mpv-player/mpv
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:
parent
b97f57bfd4
commit
ae5ac7e90a
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue