mirror of https://github.com/mpv-player/mpv
sub: update subtitle time offset even if paused
This was changed as part of commit b44202b
as an intended
simplification, but it's actually nicer to have the subtitles
update immediately even if paused.
This commit is contained in:
parent
302852c5e3
commit
f1fc60b32d
|
@ -1782,12 +1782,10 @@ static void update_subtitles(struct MPContext *mpctx, double refpts_tl)
|
||||||
assert(track && sh_sub);
|
assert(track && sh_sub);
|
||||||
struct dec_sub *dec_sub = sh_sub->dec_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 refpts_s = refpts_tl - mpctx->osd->video_offset;
|
||||||
|
double curpts_s = refpts_s + opts->sub_delay;
|
||||||
double curpts_s = refpts_tl - mpctx->osd->sub_offset;
|
|
||||||
double refpts_s = refpts_tl - video_offset;
|
|
||||||
|
|
||||||
if (!track->preloaded) {
|
if (!track->preloaded) {
|
||||||
struct demux_stream *d_sub = sh_sub->ds;
|
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)
|
if (vo_redraw_frame(vo) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (mpctx->sh_video)
|
||||||
|
update_subtitles(mpctx, mpctx->sh_video->pts);
|
||||||
draw_osd(mpctx);
|
draw_osd(mpctx);
|
||||||
|
|
||||||
vo_flip_page(vo, 0, -1);
|
vo_flip_page(vo, 0, -1);
|
||||||
|
|
|
@ -160,7 +160,7 @@ static void render_object(struct osd_state *osd, struct osd_object *obj,
|
||||||
if (osd->render_bitmap_subs && osd->dec_sub) {
|
if (osd->render_bitmap_subs && osd->dec_sub) {
|
||||||
double sub_pts = video_pts;
|
double sub_pts = video_pts;
|
||||||
if (sub_pts != MP_NOPTS_VALUE)
|
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);
|
sub_get_bitmaps(osd->dec_sub, obj->vo_res, sub_pts, out_imgs);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -120,7 +120,7 @@ struct osd_state {
|
||||||
|
|
||||||
struct ass_library *ass_library;
|
struct ass_library *ass_library;
|
||||||
struct ass_renderer *ass_renderer;
|
struct ass_renderer *ass_renderer;
|
||||||
double sub_offset;
|
double video_offset;
|
||||||
double vo_pts;
|
double vo_pts;
|
||||||
|
|
||||||
bool render_subs_in_filter;
|
bool render_subs_in_filter;
|
||||||
|
|
Loading…
Reference in New Issue