mirror of
https://github.com/mpv-player/mpv
synced 2024-10-30 04:46:41 +01:00
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).
This commit is contained in:
parent
7a19eb490e
commit
ab7ac46bcc
@ -488,7 +488,7 @@ void execute_queued_seek(struct MPContext *mpctx);
|
||||
void run_playloop(struct MPContext *mpctx);
|
||||
void mp_idle(struct MPContext *mpctx);
|
||||
void idle_loop(struct MPContext *mpctx);
|
||||
int handle_force_window(struct MPContext *mpctx, bool reconfig);
|
||||
int handle_force_window(struct MPContext *mpctx, bool force);
|
||||
void add_frame_pts(struct MPContext *mpctx, double pts);
|
||||
int get_past_frame_durations(struct MPContext *mpctx, double *fd, int num);
|
||||
void seek_to_last_frame(struct MPContext *mpctx);
|
||||
|
@ -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};
|
||||
|
Loading…
Reference in New Issue
Block a user