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.
This commit is contained in:
wm4 2013-07-22 02:14:15 +02:00
parent 7bf1b9066c
commit b38e631ed2
3 changed files with 33 additions and 30 deletions

View File

@ -235,31 +235,6 @@ Available video output drivers are:
(or if the necessary extensions are available).
``lscale=<filter>``
Set the scaling filter. Possible choices:
bilinear
bicubic_fast
sharpen3
sharpen5
hanning
hamming
hermite
quadric
bicubic
kaiser
catmull_rom
mitchell
spline16
spline36
gaussian
sinc2
sinc3
sinc4
lanczos2
lanczos3
lanczos4
blackman2
blackman3
blackman4
``bilinear``
Bilinear hardware texture filtering (fastest, mid-quality).
@ -288,6 +263,10 @@ Available video output drivers are:
Mitchell-Netravali. The ``b`` and ``c`` parameters can be set with
``lparam1`` and ``lparam2``. Both are set to 1/3 by default.
There are some more filters. For a complete list, pass ``help`` as
value, e.g.: ``mpv --vo=opengl:lscale=help``
``lparam1=<value>``
Set filter parameters. Ignored if the filter is not tunable. These are
unset by default, and use the filter specific default if applicable.
@ -307,13 +286,13 @@ Available video output drivers are:
Select a method for stereo display. You may have to use ``--aspect`` to
fix the aspect value. Experimental, do not expect too much from it.
0
no
Normal 2D display
1
red-cyan
Convert side by side input to full-color red-cyan stereo.
2
green-magenta
Convert side by side input to full-color green-magenta stereo.
3
quadbuffer
Convert side by side input to quadbuffered stereo. Only supported
by very few OpenGL cards.
@ -406,6 +385,10 @@ Available video output drivers are:
Continue even if a software renderer is detected.
``backend=<sys>``
The value ``auto`` (the default) selects the windowing backend. You
can also pass ``help`` to get a complete list of compiled in backends
(sorted by autoprobe order).
auto
auto-select (default)
cocoa

View File

@ -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;

View File

@ -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;