mirror of https://github.com/mpv-player/mpv
core: do not try to redraw OSD if VO doesn't support OSD
This fixes awkward framestepping when seeking with -vo null while paused (caused because seeking by default draws an OSD bar, and mplayer trying to redraw the OSD in that case; this logic is actually needed with vo_xv). It would have been simpler to just check vo->driver->draw_osd (and leave that callback to NULL for VOs which don't support OSD), but for now try to retain the capability to let VOs decide based on the image format whether to support OSD or not.
This commit is contained in:
parent
0c49ddc818
commit
f80a32a8eb
|
@ -37,7 +37,6 @@ struct vf_priv_s {
|
|||
};
|
||||
#define video_out (vf->priv->vo)
|
||||
|
||||
static int query_format(struct vf_instance *vf, unsigned int fmt);
|
||||
static void draw_slice(struct vf_instance *vf, unsigned char **src,
|
||||
int *stride, int w, int h, int x, int y);
|
||||
|
||||
|
@ -66,13 +65,13 @@ static int config(struct vf_instance *vf,
|
|||
if (info->comment && strlen(info->comment) > 0)
|
||||
mp_msg(MSGT_CPLAYER, MSGL_V, "VO: Comment: %s\n", info->comment);
|
||||
|
||||
// save vo's stride capability for the wanted colorspace:
|
||||
vf->default_caps = query_format(vf, outfmt);
|
||||
vf->draw_slice = (vf->default_caps & VOCAP_NOSLICES) ? NULL : draw_slice;
|
||||
|
||||
if (vo_config(video_out, width, height, d_width, d_height, flags, outfmt))
|
||||
return 0;
|
||||
|
||||
// save vo's stride capability for the wanted colorspace:
|
||||
vf->default_caps = video_out->default_caps;
|
||||
vf->draw_slice = (vf->default_caps & VOCAP_NOSLICES) ? NULL : draw_slice;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "mp_fifo.h"
|
||||
#include "m_config.h"
|
||||
#include "mp_msg.h"
|
||||
#include "libmpcodecs/vfcap.h"
|
||||
|
||||
#include "osdep/shmem.h"
|
||||
#ifdef CONFIG_X11
|
||||
|
@ -224,9 +225,8 @@ void vo_new_frame_imminent(struct vo *vo)
|
|||
|
||||
void vo_draw_osd(struct vo *vo, struct osd_state *osd)
|
||||
{
|
||||
if (!vo->config_ok)
|
||||
return;
|
||||
vo->driver->draw_osd(vo, osd);
|
||||
if (vo->config_ok && (vo->default_caps & VFCAP_OSD))
|
||||
vo->driver->draw_osd(vo, osd);
|
||||
}
|
||||
|
||||
void vo_flip_page(struct vo *vo, unsigned int pts_us, int duration)
|
||||
|
@ -385,10 +385,14 @@ int vo_config(struct vo *vo, uint32_t width, uint32_t height,
|
|||
vo->dheight = d_height;
|
||||
}
|
||||
|
||||
vo->default_caps = vo_control(vo, VOCTRL_QUERY_FORMAT, &format);
|
||||
|
||||
int ret = vo->driver->config(vo, width, height, d_width, d_height, flags,
|
||||
format);
|
||||
vo->config_ok = (ret == 0);
|
||||
vo->config_count += vo->config_ok;
|
||||
if (!vo->config_ok)
|
||||
vo->default_caps = 0;
|
||||
if (vo->registered_fd == -1 && vo->event_fd != -1 && vo->config_ok) {
|
||||
mp_input_add_key_fd(vo->input_ctx, vo->event_fd, 1, event_fd_callback,
|
||||
NULL, vo);
|
||||
|
|
|
@ -233,6 +233,7 @@ struct vo_driver {
|
|||
struct vo {
|
||||
int config_ok; // Last config call was successful?
|
||||
int config_count; // Total number of successful config calls
|
||||
int default_caps; // query_format() result for configured video format
|
||||
|
||||
bool frame_loaded; // Is there a next frame the VO could flip to?
|
||||
struct mp_image *waiting_mpi;
|
||||
|
|
33
mplayer.c
33
mplayer.c
|
@ -2553,16 +2553,16 @@ static void draw_osd(struct MPContext *mpctx)
|
|||
mpctx->osd->want_redraw = false;
|
||||
}
|
||||
|
||||
static int redraw_osd(struct MPContext *mpctx)
|
||||
static bool redraw_osd(struct MPContext *mpctx)
|
||||
{
|
||||
struct vo *vo = mpctx->video_out;
|
||||
if (vo_redraw_frame(vo) < 0)
|
||||
return -1;
|
||||
return false;
|
||||
|
||||
draw_osd(mpctx);
|
||||
|
||||
vo_flip_page(vo, 0, -1);
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
void add_step_frame(struct MPContext *mpctx)
|
||||
|
@ -3304,22 +3304,23 @@ static void run_playloop(struct MPContext *mpctx)
|
|||
audio_sleep = 0.020;
|
||||
}
|
||||
sleeptime = FFMIN(sleeptime, audio_sleep);
|
||||
if (sleeptime > 0) {
|
||||
if (!mpctx->sh_video)
|
||||
goto novideo;
|
||||
if (mpctx->osd->want_redraw || mpctx->video_out->want_redraw) {
|
||||
mpctx->osd->want_redraw = false;
|
||||
if (redraw_osd(mpctx) < 0) {
|
||||
if (mpctx->paused && video_left)
|
||||
add_step_frame(mpctx);
|
||||
else
|
||||
goto novideo;
|
||||
if (sleeptime > 0 && mpctx->sh_video) {
|
||||
bool want_redraw = mpctx->video_out->want_redraw;
|
||||
if (mpctx->video_out->default_caps & VFCAP_OSD)
|
||||
want_redraw |= mpctx->osd->want_redraw;
|
||||
mpctx->osd->want_redraw = false;
|
||||
if (want_redraw) {
|
||||
if (redraw_osd(mpctx)) {
|
||||
sleeptime = 0;
|
||||
} else if (mpctx->paused && video_left) {
|
||||
// force redrawing OSD by framestepping
|
||||
add_step_frame(mpctx);
|
||||
sleeptime = 0;
|
||||
}
|
||||
} else {
|
||||
novideo:
|
||||
mp_input_get_cmd(mpctx->input, sleeptime * 1000, true);
|
||||
}
|
||||
}
|
||||
if (sleeptime > 0)
|
||||
mp_input_get_cmd(mpctx->input, sleeptime * 1000, true);
|
||||
}
|
||||
|
||||
//================= Keyboard events, SEEKing ====================
|
||||
|
|
Loading…
Reference in New Issue