Skip to content

Commit

Permalink
vo_gpu_next: add --libplacebo-opts
Browse files Browse the repository at this point in the history
To help test not-yet-exposed options, and for debugging purposes.
  • Loading branch information
haasn committed Aug 19, 2023
1 parent 40b6afc commit a8192ed
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions DOCS/interface-changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Interface changes
You can disable this with `--no-term-remaining-playtime`.
- add `playlist-path` and `playlist/N/playlist-path` properties
- add `--x11-wid-title` option
- add `--libplacebo-opts` option
--- mpv 0.36.0 ---
- add `--target-contrast`
- Target luminance value is now also applied when ICC profile is used.
Expand Down
8 changes: 8 additions & 0 deletions DOCS/man/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6927,6 +6927,14 @@ them.
The directory where gpu shader cache is stored. Cache is stored in the system's
cache directory (usually ``~/.cache/mpv``) if this is unset.

``--libplacebo-opts=<key>=<value>[,<key>=<value>[,...]]``
Passes extra raw option to the libplacebo rendering backend (used by
``--vo=gpu-next``). May override the effects of any other options set using
the normal options system. Requires libplacebo v6.309 or higher. Included
for debugging purposes only. For more information, see:

https://code.videolan.org/videolan/libplacebo/-/blob/master/src/options.c#L877

Miscellaneous
-------------

Expand Down
7 changes: 7 additions & 0 deletions video/out/vo_gpu_next.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ struct priv {
const struct pl_hook **hooks; // storage for `params.hooks`
const struct pl_filter_config *frame_mixer;
enum mp_csp_levels output_levels;
char **raw_opts;

struct pl_icc_profile icc_profile;
char *icc_path;
Expand Down Expand Up @@ -794,6 +795,11 @@ static void update_options(struct vo *vo)
pars->color_adjustment.saturation = cparams.saturation;
pars->color_adjustment.gamma = cparams.gamma;
p->output_levels = cparams.levels_out;

#if PL_API_VER >= 309
for (char **kv = p->raw_opts; kv && kv[0]; kv += 2)
pl_options_set_str(pars, kv[0], kv[1]);
#endif
}

static void apply_target_contrast(struct priv *p, struct pl_color_space *color)
Expand Down Expand Up @@ -2085,6 +2091,7 @@ const struct vo_driver video_out_gpu_next = {
{"target-lut", OPT_STRING(target_lut.opt), .flags = M_OPT_FILE},
{"target-colorspace-hint", OPT_BOOL(target_hint)},
// No `target-lut-type` because we don't support non-RGB targets
{"libplacebo-opts", OPT_KEYVALUELIST(raw_opts)},
{0}
},
};

0 comments on commit a8192ed

Please sign in to comment.