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:
wm4 2013-06-29 01:31:19 +02:00
parent 302852c5e3
commit f1fc60b32d
3 changed files with 7 additions and 7 deletions

View File

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

View File

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

View File

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