summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2020-06-18 02:00:51 +0200
committerNiklas Haas <git@haasn.xyz>2020-06-18 02:02:45 +0200
commitae5ac7e90a96c02f66b3eb5b63ed960bfffa3fdb (patch)
tree69c0e2b8798fbb456aabdc4b9532e7b7a3960674
parentb97f57bfd4fae279b3f2c50046c8881537986029 (diff)
downloadmpv-ae5ac7e90a96c02f66b3eb5b63ed960bfffa3fdb.tar.bz2
mpv-ae5ac7e90a96c02f66b3eb5b63ed960bfffa3fdb.tar.xz
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.
-rw-r--r--video/out/gpu/video.c4
1 files changed, 4 insertions, 0 deletions
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);