mirror of
https://github.com/mpv-player/mpv.git
synced 2024-09-20 12:02:23 +02:00
video/out: fix redrawing with no video frame for some VOs
With the change to merge osd drawing into video frame drawing, some bogus logic got in: they skipped drawing the OSD if no video frame is available. This broke --no-video --force-window mode.
This commit is contained in:
parent
86e5f15592
commit
9accfe0426
@ -1532,7 +1532,7 @@ void gl_video_render_frame(struct gl_video *p)
|
||||
|
||||
if (!p->have_image) {
|
||||
gl->Clear(GL_COLOR_BUFFER_BIT);
|
||||
return;
|
||||
goto draw_osd;
|
||||
}
|
||||
|
||||
// Order of processing:
|
||||
@ -1594,6 +1594,7 @@ void gl_video_render_frame(struct gl_video *p)
|
||||
|
||||
debug_check_gl(p, "after video rendering");
|
||||
|
||||
draw_osd:
|
||||
assert(p->osd);
|
||||
|
||||
osd_draw(p->osd_state, p->osd_rect, p->osd_pts, 0, p->osd->formats,
|
||||
|
@ -846,7 +846,7 @@ static uint32_t d3d_draw_frame(d3d_priv *priv)
|
||||
IDirect3DDevice9_Clear(priv->d3d_device, 0, NULL, D3DCLEAR_TARGET, 0, 0, 0);
|
||||
|
||||
if (!priv->have_image)
|
||||
return VO_TRUE;
|
||||
goto render_osd;
|
||||
|
||||
if (priv->use_textures) {
|
||||
|
||||
@ -912,6 +912,8 @@ static uint32_t d3d_draw_frame(d3d_priv *priv)
|
||||
}
|
||||
}
|
||||
|
||||
render_osd:
|
||||
|
||||
draw_osd(priv->vo);
|
||||
|
||||
return VO_TRUE;
|
||||
|
@ -474,9 +474,6 @@ static struct buffer * buffer_pool_get_no(struct buffer_pool *pool, uint32_t no)
|
||||
|
||||
static bool redraw_frame(struct priv *p)
|
||||
{
|
||||
if (!p->original_image)
|
||||
return false;
|
||||
|
||||
draw_image(p->vo, p->original_image);
|
||||
return true;
|
||||
}
|
||||
@ -670,6 +667,12 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
|
||||
buffer_resize(&p->video_bufpool, buf, p->dst_w, p->dst_h);
|
||||
}
|
||||
|
||||
if (!mpi) {
|
||||
// TODO: clear screen
|
||||
draw_osd(vo);
|
||||
return;
|
||||
}
|
||||
|
||||
struct mp_image src = *mpi;
|
||||
struct mp_rect src_rc = p->src;
|
||||
src_rc.x0 = MP_ALIGN_DOWN(src_rc.x0, src.fmt.align_x);
|
||||
|
@ -460,7 +460,7 @@ static void flip_page(struct vo *vo)
|
||||
XSync(vo->x11->display, False);
|
||||
}
|
||||
|
||||
// Note: redraw_frame() can call this with NULL.
|
||||
// Note: REDRAW_FRAME can call this with NULL.
|
||||
static void draw_image(struct vo *vo, mp_image_t *mpi)
|
||||
{
|
||||
struct priv *p = vo->priv;
|
||||
@ -489,17 +489,6 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
|
||||
}
|
||||
}
|
||||
|
||||
static int redraw_frame(struct vo *vo)
|
||||
{
|
||||
struct priv *p = vo->priv;
|
||||
|
||||
if (!p->original_image)
|
||||
return false;
|
||||
|
||||
draw_image(vo, p->original_image);
|
||||
return true;
|
||||
}
|
||||
|
||||
static int query_format(struct vo *vo, uint32_t format)
|
||||
{
|
||||
struct priv *p = vo->priv;
|
||||
@ -631,7 +620,7 @@ static int control(struct vo *vo, uint32_t request, void *data)
|
||||
resize(vo);
|
||||
return VO_TRUE;
|
||||
case VOCTRL_REDRAW_FRAME:
|
||||
redraw_frame(vo);
|
||||
draw_image(vo, p->original_image);
|
||||
return true;
|
||||
case VOCTRL_WINDOW_TO_OSD_COORDS: {
|
||||
// OSD is rendered into the scaled image
|
||||
|
@ -655,7 +655,7 @@ static mp_image_t *get_screenshot(struct vo *vo)
|
||||
return mp_image_new_ref(ctx->original_image);
|
||||
}
|
||||
|
||||
// Note: redraw_frame() can call this with NULL.
|
||||
// Note: REDRAW_FRAME can call this with NULL.
|
||||
static void draw_image(struct vo *vo, mp_image_t *mpi)
|
||||
{
|
||||
struct xvctx *ctx = vo->priv;
|
||||
@ -678,17 +678,6 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
|
||||
}
|
||||
}
|
||||
|
||||
static int redraw_frame(struct vo *vo)
|
||||
{
|
||||
struct xvctx *ctx = vo->priv;
|
||||
|
||||
if (!ctx->original_image)
|
||||
return false;
|
||||
|
||||
draw_image(vo, ctx->original_image);
|
||||
return true;
|
||||
}
|
||||
|
||||
static int query_format(struct vo *vo, uint32_t format)
|
||||
{
|
||||
struct xvctx *ctx = vo->priv;
|
||||
@ -855,7 +844,7 @@ static int control(struct vo *vo, uint32_t request, void *data)
|
||||
return true;
|
||||
}
|
||||
case VOCTRL_REDRAW_FRAME:
|
||||
redraw_frame(vo);
|
||||
draw_image(vo, ctx->original_image);
|
||||
return true;
|
||||
case VOCTRL_SCREENSHOT: {
|
||||
struct voctrl_screenshot_args *args = data;
|
||||
|
Loading…
Reference in New Issue
Block a user