summaryrefslogtreecommitdiffstats
path: root/player/playloop.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-09-21 21:22:20 +0200
committerwm4 <wm4@nowhere>2015-09-21 21:22:20 +0200
commitab7ac46bcc3bb68cfa3d4dfc920f8bd7143eebe0 (patch)
tree1d59f489c0d768ae549af4cc63fed0843c1e13b8 /player/playloop.c
parent7a19eb490e3e2b525acd54e774217c64f6df41d9 (diff)
downloadmpv-ab7ac46bcc3bb68cfa3d4dfc920f8bd7143eebe0.tar.bz2
mpv-ab7ac46bcc3bb68cfa3d4dfc920f8bd7143eebe0.tar.xz
player: some more --force-window fixes
Sigh... After the recent changes, another regression appeared. This time, the VO window wasn't cleared when changing from video to a non- video file (such as audio-only with no cover art). Fix this by properly taking the handle_force_window() bool parameter into account. Also, the info message could be printed twice, which is harmless but ugly. So just remove the message. Also, do some more minor cleanups (like fixing the comment, which was completely outdated).
Diffstat (limited to 'player/playloop.c')
-rw-r--r--player/playloop.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/player/playloop.c b/player/playloop.c
index 351787d957..1d382c69a1 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -861,22 +861,31 @@ static void handle_chapter_change(struct MPContext *mpctx)
}
}
-// Execute a forceful refresh of the VO window, if it hasn't had a valid frame
-// for a while. The problem is that a VO with no valid frame (vo->hasframe==0)
-// doesn't redraw video and doesn't do OSD interaction. So screw it, hard.
-// It also closes the VO if force_window or video display is not active.
-int handle_force_window(struct MPContext *mpctx, bool reconfig)
+// Execute a forceful refresh of the VO window. This clears the window from
+// the previous video. It also creates/destroys the VO on demand.
+// It tries to make the change only in situations where the window is
+// definitely needed or not needed, or if the force parameter is set (the
+// latter also decides whether to clear an existing window, because there's
+// no way to know if this has already been done or not).
+int handle_force_window(struct MPContext *mpctx, bool force)
{
// Don't interfere with real video playback
if (mpctx->d_video)
return 0;
+ // True if we're either in idle mode, or loading of the file has finished.
+ // It's also set via force in some stages during file loading.
+ bool act = !mpctx->playing || mpctx->playback_initialized || force;
+
if (!mpctx->opts->force_vo) {
- if (!mpctx->playing || mpctx->playback_initialized)
+ if (act)
uninit_video_out(mpctx);
return 0;
}
+ if (mpctx->opts->force_vo != 2 && !act)
+ return 0;
+
if (!mpctx->video_out) {
struct vo_extra ex = {
.input_ctx = mpctx->input,
@@ -889,12 +898,8 @@ int handle_force_window(struct MPContext *mpctx, bool reconfig)
mpctx->mouse_cursor_visible = true;
}
- if (mpctx->opts->force_vo != 2 && !mpctx->playback_initialized)
- return 0;
-
- if (!mpctx->video_out->config_ok || reconfig) {
+ if (!mpctx->video_out->config_ok || force) {
struct vo *vo = mpctx->video_out;
- MP_INFO(mpctx, "Creating non-video VO window.\n");
// Pick whatever works
int config_format = 0;
uint8_t fmts[IMGFMT_END - IMGFMT_START] = {0};