vo_gpu_next: update overlays for blend subtitles on frame redraws

The commit subject sounds reasonable except that frame redraws get
spammed in certain cases (still image with subtitles) all the time
regardless if the subtitle actually has changed or not. So this is
stupid and wasteful, but you'll always see subtitles. vo_gpu currently
has this behavior as well, so we're just matching it but later mpv's
core should be fixed so this works reasonably. Fixes #11335.
This commit is contained in:
Dudemanguy 2023-11-09 22:47:32 -06:00
parent 2ba75a0ffc
commit ca6ae6fb5f
1 changed files with 5 additions and 8 deletions

View File

@ -124,7 +124,7 @@ struct priv {
bool is_interpolated;
bool want_reset;
bool frame_pending;
bool paused;
bool redraw;
pl_options pars;
struct m_config_cache *opts_cache;
@ -249,8 +249,6 @@ static void update_overlays(struct vo *vo, struct mp_osd_res res,
double pts = src ? src->pts : 0;
struct sub_bitmap_list *subs = osd_render(vo->osd, res, pts, flags, subfmt_all);
if (subs->num_items && p->paused)
p->osd_sync++;
frame->overlays = state->overlays;
frame->num_overlays = 0;
@ -999,7 +997,7 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
struct frame_priv *fp = mpi->priv;
apply_crop(image, p->src, vo->params->w, vo->params->h);
if (opts->blend_subs) {
if (p->paused || fp->osd_sync < p->osd_sync) {
if (frame->redraw || fp->osd_sync < p->osd_sync) {
float rx = pl_rect_w(p->dst) / pl_rect_w(image->crop);
float ry = pl_rect_h(p->dst) / pl_rect_h(image->crop);
struct mp_osd_res res = {
@ -1011,6 +1009,9 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
.mb = (image->crop.y1 - vo->params->h) * ry,
.display_par = 1.0,
};
// TODO: fix this doing pointless updates
if (frame->redraw)
p->osd_sync++;
update_overlays(vo, res, OSD_DRAW_SUB_ONLY,
PL_OVERLAY_COORDS_DST_CROP,
&fp->subs, image, mpi);
@ -1390,13 +1391,9 @@ static int control(struct vo *vo, uint32_t request, void *data)
return VO_TRUE;
case VOCTRL_SET_EQUALIZER:
case VOCTRL_PAUSE:
p->paused = true;
if (p->is_interpolated)
vo->want_redraw = true;
return VO_TRUE;
case VOCTRL_RESUME:
p->paused = false;
return VO_TRUE;
case VOCTRL_UPDATE_RENDER_OPTS: {
m_config_cache_update(p->opts_cache);