From b38e631ed211734f019e9844c00b1f72ddb20842 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 22 Jul 2013 02:14:15 +0200 Subject: vo_opengl: some option changes Doing "mpv --vo=opengl:lscale=help" now lists possible scalers and exits. The "backend" suboption behaves similar. Make the "stereo" suboption a choice, instead of using magic integer values. --- video/out/gl_common.c | 8 ++++++++ video/out/gl_video.c | 14 +++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'video/out') diff --git a/video/out/gl_common.c b/video/out/gl_common.c index 6ede196cb4..497387aa4f 100644 --- a/video/out/gl_common.c +++ b/video/out/gl_common.c @@ -43,6 +43,7 @@ #include "talloc.h" #include "gl_common.h" #include "core/options.h" +#include "core/m_option.h" #include "sub/sub.h" #include "bitmap_packer.h" @@ -879,6 +880,13 @@ int mpgl_find_backend(const char *name) int mpgl_validate_backend_opt(const struct m_option *opt, struct bstr name, struct bstr param) { + if (bstr_equals0(param, "help")) { + mp_msg(MSGT_VO, MSGL_INFO, "OpenGL windowing backends:\n"); + mp_msg(MSGT_VO, MSGL_INFO, " auto (autodetect)\n"); + for (const struct backend *entry = backends; entry->name; entry++) + mp_msg(MSGT_VO, MSGL_INFO, " %s\n", entry->name); + return M_OPT_EXIT - 1; + } char s[20]; snprintf(s, sizeof(s), "%.*s", BSTR_P(param)); return mpgl_find_backend(s) >= -1 ? 1 : M_OPT_INVALID; diff --git a/video/out/gl_video.c b/video/out/gl_video.c index dac2bb2451..98862b92e7 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -283,7 +283,11 @@ const struct m_sub_options gl_video_conf = { OPT_FLAG("srgb", srgb, 0), OPT_FLAG("npot", npot, 0), OPT_FLAG("pbo", pbo, 0), - OPT_INT("stereo", stereo_mode, 0), + OPT_CHOICE("stereo", stereo_mode, 0, + ({"no", 0}, + {"red-cyan", GL_3D_RED_CYAN}, + {"green-magenta", GL_3D_GREEN_MAGENTA}, + {"quadbuffer", GL_3D_QUADBUFFER})), OPT_STRING_VALIDATE("lscale", scalers[0], 0, validate_scaler_opt), OPT_STRING_VALIDATE("cscale", scalers[1], 0, validate_scaler_opt), OPT_FLOAT("lparam1", scaler_params[0], 0), @@ -2059,6 +2063,14 @@ bool gl_video_get_equalizer(struct gl_video *p, const char *name, int *val) static int validate_scaler_opt(const m_option_t *opt, struct bstr name, struct bstr param) { + if (bstr_equals0(param, "help")) { + mp_msg(MSGT_VO, MSGL_INFO, "Available scalers:\n"); + for (const char **filter = fixed_scale_filters; *filter; filter++) + mp_msg(MSGT_VO, MSGL_INFO, " %s\n", *filter); + for (int n = 0; mp_filter_kernels[n].name; n++) + mp_msg(MSGT_VO, MSGL_INFO, " %s\n", mp_filter_kernels[n].name); + return M_OPT_EXIT - 1; + } char s[20]; snprintf(s, sizeof(s), "%.*s", BSTR_P(param)); return handle_scaler_opt(s) ? 1 : M_OPT_INVALID; -- cgit v1.2.3