diff options
author | wm4 <wm4@nowhere> | 2013-10-02 20:38:10 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-10-02 20:38:10 +0200 |
commit | d24bf6e3496c48ec42be0e54f8aacd5a5c43e093 (patch) | |
tree | 2e97815f1cc0f941c2d268e1d8f9888494a3dabb /mpvcore | |
parent | ca2b05c0fbc9a51472b1a5a94d016e977c6c87c3 (diff) | |
download | mpv-d24bf6e3496c48ec42be0e54f8aacd5a5c43e093.tar.bz2 mpv-d24bf6e3496c48ec42be0e54f8aacd5a5c43e093.tar.xz |
mplayer: make VO interaction work in --idle mode
Didn't handle VO events, didn't handle OSD message management.
There is probably still some strangeness left. --idle mode was never
made for direct interaction.
Diffstat (limited to 'mpvcore')
-rw-r--r-- | mpvcore/mplayer.c | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/mpvcore/mplayer.c b/mpvcore/mplayer.c index 5db3c5c833..ee6ac69426 100644 --- a/mpvcore/mplayer.c +++ b/mpvcore/mplayer.c @@ -2857,6 +2857,8 @@ static bool redraw_osd(struct MPContext *mpctx) void add_step_frame(struct MPContext *mpctx, int dir) { + if (!mpctx->sh_video) + return; if (dir > 0) { mpctx->step_frames += 1; unpause_player(mpctx); @@ -3365,6 +3367,26 @@ static void update_avsync(struct MPContext *mpctx) } } +static bool handle_osd_redraw(struct MPContext *mpctx) +{ + if (!mpctx->video_out || !mpctx->video_out->config_ok) + return false; + bool want_redraw = vo_get_want_redraw(mpctx->video_out); + if (mpctx->video_out->driver->draw_osd) + want_redraw |= mpctx->osd->want_redraw; + mpctx->osd->want_redraw = false; + if (want_redraw) { + if (redraw_osd(mpctx)) { + return true; + } else if (mpctx->paused) { + // force redrawing OSD by framestepping + add_step_frame(mpctx, 1); + return true; + } + } + return false; +} + static void handle_metadata_update(struct MPContext *mpctx) { if (mp_time_sec() > mpctx->last_metadata_update + 2) { @@ -3900,20 +3922,9 @@ static void run_playloop(struct MPContext *mpctx) audio_sleep = 0.020; } sleeptime = FFMIN(sleeptime, audio_sleep); - if (sleeptime > 0 && mpctx->video_out && mpctx->video_out->config_ok) { - bool want_redraw = vo_get_want_redraw(mpctx->video_out); - if (mpctx->video_out->driver->draw_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, 1); - sleeptime = 0; - } - } + if (sleeptime > 0) { + if (handle_osd_redraw(mpctx)) + sleeptime = 0; } if (sleeptime > 0) mp_input_get_cmd(mpctx->input, sleeptime * 1000, true); @@ -4277,11 +4288,15 @@ static void idle_loop(struct MPContext *mpctx) uninit |= INITIALIZED_VO; uninit_player(mpctx, uninit); handle_force_window(mpctx); - mp_cmd_t *cmd; - while (!(cmd = mp_input_get_cmd(mpctx->input, - get_wakeup_period(mpctx) * 1000, - false))); - run_command(mpctx, cmd); + if (mpctx->video_out) + vo_check_events(mpctx->video_out); + update_osd_msg(mpctx); + handle_osd_redraw(mpctx); + mp_cmd_t *cmd = mp_input_get_cmd(mpctx->input, + get_wakeup_period(mpctx) * 1000, + false); + if (cmd) + run_command(mpctx, cmd); mp_cmd_free(cmd); mp_flush_events(mpctx); } |