player: add --force-render option

mpv has an internal optimization on a couple of platforms where it will
not render any frames if the window is minimized or hidden. There's at
least once possible use case for wanting to force a render anyway
(screensharing with pipeware) so let's just add a simple switch for
this that always forces mpv to render. Closes #10846.
This commit is contained in:
Dudemanguy 2022-11-11 13:57:53 -06:00
parent 295ceab382
commit 38a626650a
6 changed files with 13 additions and 2 deletions

View File

@ -26,6 +26,8 @@ Interface changes
::
--- mpv 0.36.0 ---
- add `--force-render`
--- mpv 0.35.0 ---
- add the `--vo=gpu-next` video output driver, as well as the options
`--allow-delayed-peak-detect`, `--builtin-scalers`,

View File

@ -3243,6 +3243,12 @@ Window
depending on GPU drivers and hardware. For other VOs, this just makes
rendering slower.
``--force-render``
Forces mpv to always render frames regardless of the visibility of the
window. Currently only affects X11 and Wayland VOs since they are the
only ones that have this optimization (i.e. everything else always renders
regardless of visibility).
``--force-window-position``
Forcefully move mpv's video output window to default location whenever
there is a change in video parameters, video stream or file. This used to

View File

@ -126,6 +126,7 @@ static const m_option_t mp_vo_opt_list[] = {
{"window-minimized", OPT_FLAG(window_minimized)},
{"window-maximized", OPT_FLAG(window_maximized)},
{"focus-on-open", OPT_BOOL(focus_on_open)},
{"force-render", OPT_FLAG(force_render)},
{"force-window-position", OPT_FLAG(force_window_position)},
{"x11-name", OPT_STRING(winname)},
{"wayland-app-id", OPT_STRING(appid)},

View File

@ -56,6 +56,7 @@ typedef struct mp_vo_opts {
float force_monitor_aspect;
float monitor_pixel_aspect;
int force_render;
int force_window_position;
char *mmcss_profile;

View File

@ -1754,7 +1754,7 @@ int vo_wayland_allocate_memfd(struct vo *vo, size_t size)
bool vo_wayland_check_visible(struct vo *vo)
{
struct vo_wayland_state *wl = vo->wl;
bool render = !wl->hidden || wl->opts->disable_vsync;
bool render = !wl->hidden || wl->vo_opts->force_render;
wl->frame_wait = true;
return render;
}

View File

@ -1972,7 +1972,8 @@ bool vo_x11_check_visible(struct vo *vo) {
struct vo_x11_state *x11 = vo->x11;
struct mp_vo_opts *opts = x11->opts;
bool render = !x11->hidden || VS_IS_DISP(opts->video_sync);
bool render = !x11->hidden || opts->force_render ||
VS_IS_DISP(opts->video_sync);
return render;
}