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.
This commit is contained in:
Guido Cella 2021-08-13 01:51:13 +02:00 committed by Dudemanguy
parent 312e29cf7f
commit d8e5f6ff3a
1 changed files with 1 additions and 1 deletions

View File

@ -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;