From 6a850b02647c062f3ae48aaa180bf7ea1fe30576 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 10 Sep 2013 16:50:19 +0200 Subject: quvi: restore playback position when switching formats This simply issues a seek after reloading. --- mpvcore/command.c | 7 +++++++ mpvcore/mplayer.c | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'mpvcore') diff --git a/mpvcore/command.c b/mpvcore/command.c index a99dd3dcab..f5421d48fe 100644 --- a/mpvcore/command.c +++ b/mpvcore/command.c @@ -534,6 +534,13 @@ static int mp_property_quvi_format(m_option_t *prop, int action, void *arg, return M_PROPERTY_OK; case M_PROPERTY_SET: { mpctx->stop_play = PT_RESTART; + // Make it restart at the same position. This will have disastrous + // consequences if the stream is not arbitrarily seekable, but whatever. + m_config_backup_opt(mpctx->mconfig, "start"); + opts->play_start = (struct m_rel_time) { + .type = REL_TIME_ABSOLUTE, + .pos = get_current_time(mpctx), + }; break; } case M_PROPERTY_SWITCH: { diff --git a/mpvcore/mplayer.c b/mpvcore/mplayer.c index b295cb5cec..3590168d22 100644 --- a/mpvcore/mplayer.c +++ b/mpvcore/mplayer.c @@ -4549,7 +4549,8 @@ terminate_playback: // don't jump here after ao/vo/getch initialization! uninit_player(mpctx, uninitialize_parts); // xxx handle this as INITIALIZED_CONFIG? - m_config_restore_backups(mpctx->mconfig); + if (mpctx->stop_play != PT_RESTART) + m_config_restore_backups(mpctx->mconfig); mpctx->filename = NULL; talloc_free(mpctx->resolve_result); -- cgit v1.2.3