From d8e5f6ff3aae31fc03c43b98bbf0e272c741eb1d Mon Sep 17 00:00:00 2001 From: Guido Cella Date: Fri, 13 Aug 2021 01:51:13 +0200 Subject: sub: show subs without duration on vid change When changing video track with subtitles with unknown duration, they aren't shown until you seek, cycle sub back and forth, or apply a video filter. This is caused by reinit_video_chain_src() calling reset_subtitle_state() -> sub/sd_ass.c:reset() -> ass_flush_events() when ctx->duration_unknown is true. The ass_flush_events() call was added in a714f8e so subs with unknown duration wouldn't multiply on seek, i.e. when reset_subtitle_state() is called from reset_playback_state(). So keep calling it from there, and in reinit_video_chain_src() use just term_osd_set_subs(mpctx, NULL) instead to clear any subtitles printed to the terminal. The reset_subtitle_state() call was added in c1ac97b to "reset the state correctly when switching between video/no-video", but with it removed I no longer notice any issue doing that. --- player/video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'player') diff --git a/player/video.c b/player/video.c index c13bdb4074..734835d850 100644 --- a/player/video.c +++ b/player/video.c @@ -288,7 +288,7 @@ void reinit_video_chain_src(struct MPContext *mpctx, struct track *track) } reset_video_state(mpctx); - reset_subtitle_state(mpctx); + term_osd_set_subs(mpctx, NULL); return; -- cgit v1.2.3