diff options
author | wm4 <wm4@nowhere> | 2013-12-15 18:04:13 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-12-15 18:06:21 +0100 |
commit | ff85afa537f48b20751c92a6453a579e2ff8a757 (patch) | |
tree | c96debc3e37efc7eb4be3937662d81d910df03d2 /mpvcore/player | |
parent | 6dcebd91301179f4e59ce6cdfa5ba720043e99bc (diff) | |
download | mpv-ff85afa537f48b20751c92a6453a579e2ff8a757.tar.bz2 mpv-ff85afa537f48b20751c92a6453a579e2ff8a757.tar.xz |
player: don't temporarily disable terminal handling when reloading files
There's no reason why we should do this. For some reason, the existing
code reset terminal handling to default after unloading a file, just to
initialize it again when loading a new file.
Might be related to github issue #412, although I don't think it helps,
since the default SIGTERM handler _should_ kill the mpv process.
(It's still a nice simplification, though.)
Diffstat (limited to 'mpvcore/player')
-rw-r--r-- | mpvcore/player/loadfile.c | 25 | ||||
-rw-r--r-- | mpvcore/player/main.c | 5 | ||||
-rw-r--r-- | mpvcore/player/mp_core.h | 1 |
3 files changed, 11 insertions, 20 deletions
diff --git a/mpvcore/player/loadfile.c b/mpvcore/player/loadfile.c index b4e8921089..08b245a0ff 100644 --- a/mpvcore/player/loadfile.c +++ b/mpvcore/player/loadfile.c @@ -154,14 +154,6 @@ void uninit_player(struct MPContext *mpctx, unsigned int mask) mpctx->video_out = NULL; } - // Must be after libvo uninit, as few vo drivers (svgalib) have tty code. - if (mask & INITIALIZED_GETCH2) { - mpctx->initialized_flags &= ~INITIALIZED_GETCH2; - MP_DBG(mpctx, "\n[[[uninit getch2]]]\n"); - // restore terminal: - getch2_disable(); - } - if (mask & INITIALIZED_AO) { struct ao *ao = mpctx->ao; mpctx->initialized_flags &= ~INITIALIZED_AO; @@ -1024,16 +1016,8 @@ static void play_current_file(struct MPContext *mpctx) load_per_file_options(mpctx->mconfig, mpctx->playlist->current->params, mpctx->playlist->current->num_params); - // We must enable getch2 here to be able to interrupt network connection - // or cache filling - if (opts->consolecontrols && !opts->slave_mode) { - if (mpctx->initialized_flags & INITIALIZED_GETCH2) - MP_WARN(mpctx, "WARNING: getch2_init called twice!\n"); - else - getch2_enable(); // prepare stdin for hotkeys... - mpctx->initialized_flags |= INITIALIZED_GETCH2; - MP_DBG(mpctx, "\n[[[init getch2]]]\n"); - } + if (!opts->consolecontrols) + getch2_disable(); #if HAVE_LIBASS if (opts->ass_style_override) @@ -1270,7 +1254,7 @@ goto_reopen_demuxer: ; if (mpctx->stop_play == PT_RELOAD_DEMUXER) { mpctx->stop_play = KEEP_PLAYING; uninit_player(mpctx, INITIALIZED_ALL - - (INITIALIZED_PLAYBACK | INITIALIZED_STREAM | INITIALIZED_GETCH2 | + (INITIALIZED_PLAYBACK | INITIALIZED_STREAM | (opts->fixed_vo ? INITIALIZED_VO : 0))); goto goto_reopen_demuxer; } @@ -1306,6 +1290,9 @@ terminate_playback: // don't jump here after ao/vo/getch initialization! if (mpctx->stop_play != PT_RESTART) m_config_restore_backups(mpctx->mconfig); + if (opts->consolecontrols) + getch2_enable(); + mpctx->filename = NULL; talloc_free(mpctx->resolve_result); mpctx->resolve_result = NULL; diff --git a/mpvcore/player/main.c b/mpvcore/player/main.c index d95546f923..1a3bd15fe1 100644 --- a/mpvcore/player/main.c +++ b/mpvcore/player/main.c @@ -140,6 +140,8 @@ static MP_NORETURN void exit_player(struct MPContext *mpctx, mpctx->ass_library = NULL; #endif + getch2_disable(); + if (how != EXIT_NONE) { const char *reason; switch (how) { @@ -390,6 +392,9 @@ static int mpv_main(int argc, char *argv[]) } #endif + if (opts->consolecontrols) + getch2_enable(); + #if HAVE_LIBASS mpctx->ass_library = mp_ass_init(opts); #else diff --git a/mpvcore/player/mp_core.h b/mpvcore/player/mp_core.h index 21ce0ba3cb..517ddbd37b 100644 --- a/mpvcore/player/mp_core.h +++ b/mpvcore/player/mp_core.h @@ -28,7 +28,6 @@ #define INITIALIZED_VO 1 #define INITIALIZED_AO 2 -#define INITIALIZED_GETCH2 8 #define INITIALIZED_PLAYBACK 16 #define INITIALIZED_LIBASS 32 #define INITIALIZED_STREAM 64 |