diff options
author | wm4 <wm4@nowhere> | 2012-10-21 15:54:22 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-10-24 21:56:34 +0200 |
commit | f80a32a8ebd1573f1578d707416b07880c1a08c1 (patch) | |
tree | 908845c81c04e393ce28beef519f6f6cfedc47ea /mplayer.c | |
parent | 0c49ddc818fee8059d764f7fbd25820584f335a3 (diff) |
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.
Diffstat (limited to 'mplayer.c')
-rw-r--r-- | mplayer.c | 33 |
1 files changed, 17 insertions, 16 deletions
@@ -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 ==================== |