vo_gpu, options: don't return NaN through API

Internally, vo_gpu uses NaN for some options to indicate a default value
that is different depending on the context (e.g. different scalers).
There are 2 problems with this:

1. you couldn't reset the options to their defaults
2. NaN is a damn mess and shouldn't be part of the API

The option parser already rejected NaN explicitly, which is why 1.
didn't work. Regarding 2., JSON might be a good example, and actually
caused a bug report.

Fix this by mapping NaN to the special value "default". I think I'd
prefer other mechanisms (maybe just having every scaler expose separate
options?), but for now this will do. See you in a future commit, which
painfully deprecates this and replaces it with something else.

I refrained from using "no" (my favorite magic value for "unset" etc.)
because then I'd have e.g. make --no-scale-param1 work, which in
addition to a lot of effort looks dumb and nobody will use it.

Here's also an apology for the shitty added test script.

Fixes: #6691
This commit is contained in:
wm4
2019-10-25 00:25:05 +02:00
committed by sfan5
parent 922be71101
commit 419c44ccf6
6 changed files with 91 additions and 19 deletions

View File

@@ -191,6 +191,9 @@ Interface changes
internal counter that remembered the current position.
- remove deprecated ao/vo auto profiles. Consider using scripts like
auto-profiles.lua instead.
- --[c]scale-[w]param[1|2] and --tone-mapping-param now accept "default",
and if set to that value, reading them as property will also return
"default", instead of float nan as in previous versions
--- mpv 0.28.0 ---
- rename --hwdec=mediacodec option to mediacodec-copy, to reflect
conventions followed by other hardware video decoding APIs

View File

@@ -4404,8 +4404,10 @@ The following video options are currently all specific to ``--vo=gpu`` and
smooth.
``--scale-param1=<value>``, ``--scale-param2=<value>``, ``--cscale-param1=<value>``, ``--cscale-param2=<value>``, ``--dscale-param1=<value>``, ``--dscale-param2=<value>``, ``--tscale-param1=<value>``, ``--tscale-param2=<value>``
Set filter parameters. Ignored if the filter is not tunable. Currently,
this affects the following filter parameters:
Set filter parameters. By default, these are set to the special string
``default``, which maps to a scaler-specific default value. Ignored if the
filter is not tunable. Currently, this affects the following filter
parameters:
bcspline
Spline parameters (``B`` and ``C``). Defaults to 0.5 for both.
@@ -4477,8 +4479,10 @@ The following video options are currently all specific to ``--vo=gpu`` and
``--scale-wparam=<window>``, ``--cscale-wparam=<window>``, ``--cscale-wparam=<window>``, ``--tscale-wparam=<window>``
(Advanced users only) Configure the parameter for the window function given
by ``--scale-window`` etc. Ignored if the window is not tunable. Currently,
this affects the following window parameters:
by ``--scale-window`` etc. By default, these are set to the special string
``default``, which maps to a window-specific default value. Ignored if the
window is not tunable. Currently, this affects the following window
parameters:
kaiser
Window parameter (alpha). Defaults to 6.33.
@@ -5524,8 +5528,10 @@ The following video options are currently all specific to ``--vo=gpu`` and
the display.
``--tone-mapping-param=<value>``
Set tone mapping parameters. Ignored if the tone mapping algorithm is not
tunable. This affects the following tone mapping algorithms:
Set tone mapping parameters. By default, this is set to the special string
``default``, which maps to an algorithm-specific default value. Ignored if
the tone mapping algorithm is not tunable. This affects the following tone
mapping algorithms:
clip
Specifies an extra linear coefficient to multiply into the signal