diff options
author | wm4 <wm4@nowhere> | 2016-03-25 17:40:18 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-03-25 17:40:44 +0100 |
commit | 5fe2812494f7743f4d662b1f7983d4afa898243f (patch) | |
tree | d6be49bb68a3b188b320b189703bc9128d6911dd | |
parent | dafafc90dea5caebebb169a7a7cddac8377651f5 (diff) | |
download | mpv-5fe2812494f7743f4d662b1f7983d4afa898243f.tar.bz2 mpv-5fe2812494f7743f4d662b1f7983d4afa898243f.tar.xz |
sub: force segment switch if video is already ahead
In particular, this prevents subtitle packets from building up in the
subtitle queue if e.g. --vo=null is used. In this situation,
sub_get_bitmaps() is never called, and thus the segment never switched.
This also seems to help with flickering at segment switch boundaries (if
subs are supposed to be visible at the transition points).
In theory, this could trigger a switch too early, but the way VO and
subtitle renderer interact wrt. timing is a bit iffy anyway.
-rw-r--r-- | sub/dec_sub.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sub/dec_sub.c b/sub/dec_sub.c index b6672348a5..3b1e957038 100644 --- a/sub/dec_sub.c +++ b/sub/dec_sub.c @@ -150,6 +150,9 @@ static void update_segment(struct dec_sub *sub) if (sub->new_segment && sub->last_vo_pts != MP_NOPTS_VALUE && sub->last_vo_pts >= sub->new_segment->start) { + MP_VERBOSE(sub, "Switch segment: %f at %f\n", sub->new_segment->start, + sub->last_vo_pts); + sub->codec = sub->new_segment->codec; sub->start = sub->new_segment->start; sub->end = sub->new_segment->end; @@ -210,6 +213,11 @@ bool sub_read_packets(struct dec_sub *sub, double video_pts) if (!read_more) break; + if (sub->new_segment && sub->new_segment->start < video_pts) { + sub->last_vo_pts = video_pts; + update_segment(sub); + } + if (sub->new_segment) break; |