summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-22 19:58:22 +0100
committerwm4 <wm4@nowhere>2015-01-22 19:58:22 +0100
commit93f1bf48d9b2c524ec27a7a5058fa09b63dcf374 (patch)
tree5672bbbf151427c149f361a20cefcfdf5cd43d8d
parent27261bea313117b8644d8abda2bc3f9410623154 (diff)
downloadmpv-93f1bf48d9b2c524ec27a7a5058fa09b63dcf374.tar.bz2
mpv-93f1bf48d9b2c524ec27a7a5058fa09b63dcf374.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.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c
index d64833744d..7a40338ac1 100644
--- a/video/out/gl_video.c
+++ b/video/out/gl_video.c
@@ -2610,7 +2610,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);
@@ -2668,17 +2668,25 @@ void gl_video_eq_update(struct gl_video *p)
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.