diff options
author | wm4 <wm4@nowhere> | 2015-01-22 19:58:22 +0100 |
---|---|---|
committer | Diogo Franco (Kovensky) <diogomfranco@gmail.com> | 2015-01-25 17:00:21 +0900 |
commit | c774f2c3bb97e30e229550238708d9c43852d463 (patch) | |
tree | a1b38e1124bf92077423ccfa37ece574104702b8 | |
parent | 9e6091a5b11e7218a84d23bfa9847ccbb265d53d (diff) | |
download | mpv-c774f2c3bb97e30e229550238708d9c43852d463.tar.bz2 mpv-c774f2c3bb97e30e229550238708d9c43852d463.tar.xz |
vo_opengl: improve terminal messages with lscale suboption errors
Make it more apparent what the hell the user did wrong.
-rw-r--r-- | video/out/gl_video.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c index 002f11124c..5e88bad398 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -2453,7 +2453,7 @@ static bool can_use_filter_kernel(const struct filter_kernel *kernel) } // Get static string for scaler shader. -static const char* handle_scaler_opt(const char *name) +static const char *handle_scaler_opt(const char *name) { if (name) { const struct filter_kernel *kernel = mp_find_filter_kernel(name); @@ -2513,17 +2513,25 @@ bool gl_video_get_equalizer(struct gl_video *p, const char *name, int *val) static int validate_scaler_opt(struct mp_log *log, const m_option_t *opt, struct bstr name, struct bstr param) { + char s[20] = {0}; + int r = 1; if (bstr_equals0(param, "help")) { + r = M_OPT_EXIT - 1; + } else { + snprintf(s, sizeof(s), "%.*s", BSTR_P(param)); + if (!handle_scaler_opt(s)) + r = M_OPT_INVALID; + } + if (r < 1) { mp_info(log, "Available scalers:\n"); for (const char *const *filter = fixed_scale_filters; *filter; filter++) mp_info(log, " %s\n", *filter); for (int n = 0; mp_filter_kernels[n].name; n++) mp_info(log, " %s\n", mp_filter_kernels[n].name); - return M_OPT_EXIT - 1; + if (s[0]) + mp_fatal(log, "No scaler named '%s' found!\n", s); } - char s[20]; - snprintf(s, sizeof(s), "%.*s", BSTR_P(param)); - return handle_scaler_opt(s) ? 1 : M_OPT_INVALID; + return r; } // Resize and redraw the contents of the window without further configuration. |