diff options
author | wm4 <wm4@nowhere> | 2014-10-03 19:57:49 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-10-03 23:05:09 +0200 |
commit | 9d5d031b6d23402a465618892a40b7af6d4e3c28 (patch) | |
tree | 143f43c4b002ec74f7172038e58409723647d892 /player/playloop.c | |
parent | 9570976255083c1ec32add62613c52ad98fa28c8 (diff) | |
download | mpv-9d5d031b6d23402a465618892a40b7af6d4e3c28.tar.bz2 mpv-9d5d031b6d23402a465618892a40b7af6d4e3c28.tar.xz |
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().
Diffstat (limited to 'player/playloop.c')
-rw-r--r-- | player/playloop.c | 14 |
1 files changed, 6 insertions, 8 deletions
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; |