diff --git a/core/mplayer.c b/core/mplayer.c index eb99b0d2d2..b564048560 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -1782,12 +1782,10 @@ static void update_subtitles(struct MPContext *mpctx, double refpts_tl) assert(track && sh_sub); struct dec_sub *dec_sub = sh_sub->dec_sub; - double video_offset = track->under_timeline ? mpctx->video_offset : 0; + mpctx->osd->video_offset = track->under_timeline ? mpctx->video_offset : 0; - mpctx->osd->sub_offset = video_offset - opts->sub_delay; - - double curpts_s = refpts_tl - mpctx->osd->sub_offset; - double refpts_s = refpts_tl - video_offset; + double refpts_s = refpts_tl - mpctx->osd->video_offset; + double curpts_s = refpts_s + opts->sub_delay; if (!track->preloaded) { struct demux_stream *d_sub = sh_sub->ds; @@ -2729,6 +2727,8 @@ static bool redraw_osd(struct MPContext *mpctx) if (vo_redraw_frame(vo) < 0) return false; + if (mpctx->sh_video) + update_subtitles(mpctx, mpctx->sh_video->pts); draw_osd(mpctx); vo_flip_page(vo, 0, -1); diff --git a/sub/sub.c b/sub/sub.c index 35d9f29326..90b6cfee00 100644 --- a/sub/sub.c +++ b/sub/sub.c @@ -160,7 +160,7 @@ static void render_object(struct osd_state *osd, struct osd_object *obj, if (osd->render_bitmap_subs && osd->dec_sub) { double sub_pts = video_pts; if (sub_pts != MP_NOPTS_VALUE) - sub_pts -= osd->sub_offset; + sub_pts -= osd->video_offset - opts->sub_delay; sub_get_bitmaps(osd->dec_sub, obj->vo_res, sub_pts, out_imgs); } } else { diff --git a/sub/sub.h b/sub/sub.h index a13d3ca6f8..4a636f0700 100644 --- a/sub/sub.h +++ b/sub/sub.h @@ -120,7 +120,7 @@ struct osd_state { struct ass_library *ass_library; struct ass_renderer *ass_renderer; - double sub_offset; + double video_offset; double vo_pts; bool render_subs_in_filter;