From 9d5d031b6d23402a465618892a40b7af6d4e3c28 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 3 Oct 2014 19:57:49 +0200 Subject: player: remove central uninit_player() function and flags mess Each subsystem (or similar thing) had an INITIALIZED_ flag assigned. The main use of this was that you could pass a bitmask of these flags to uninit_player(). Except in some situations where you wanted to uninitialize nearly everything, this wasn't really useful. Moreover, it was quite annoying that subsystems had most of the code in a specific file, but the uninit code in loadfile.c (because that's where uninit_player() was implemented). Simplify all this. Remove the flags; e.g. instead of testing for the INITIALIZED_AO flag, test whether mpctx->ao is set. Move uninit code to separate functions, e.g. uninit_audio_out(). --- player/playloop.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'player/playloop.c') diff --git a/player/playloop.c b/player/playloop.c index de1165e963..5cefcb8ac5 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -789,17 +789,18 @@ 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 OSD interaction. So screw it, hard. +// It also closes the VO if force_window or video display is not active. void handle_force_window(struct MPContext *mpctx, bool reconfig) { // Don't interfere with real video playback if (mpctx->d_video) return; - struct vo *vo = mpctx->video_out; - if (!vo) - return; + if (!mpctx->opts->force_vo) + uninit_video_out(mpctx); - if (!vo->config_ok || reconfig) { + if (mpctx->video_out && (!mpctx->video_out->config_ok || reconfig)) { + struct vo *vo = mpctx->video_out; MP_INFO(mpctx, "Creating non-video VO window.\n"); // Pick whatever works int config_format = 0; @@ -974,10 +975,7 @@ void idle_loop(struct MPContext *mpctx) { if (need_reinit) { mp_notify(mpctx, MPV_EVENT_IDLE, NULL); - int uninit = INITIALIZED_AO; - if (!mpctx->opts->force_vo) - uninit |= INITIALIZED_VO; - uninit_player(mpctx, uninit); + uninit_audio_out(mpctx); handle_force_window(mpctx, true); mpctx->sleeptime = 0; need_reinit = false; -- cgit v1.2.3