summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-12-22 00:00:18 +0100
committerwm4 <wm4@nowhere>2014-12-22 00:00:18 +0100
commitbdae2f8fa85e2428af37a719ecb6c7452d0ee911 (patch)
treebcfd6a9ba5e1c1f8b61a62371ab13e7779b81098 /sub
parent1e3400e353d7aea5243f074f45741eb1cee9b1ad (diff)
downloadmpv-bdae2f8fa85e2428af37a719ecb6c7452d0ee911.tar.bz2
mpv-bdae2f8fa85e2428af37a719ecb6c7452d0ee911.tar.xz
sd_lavc: ignore image subtitles with unknown duration after 1 minute
Most image subtitle formats implicitly terminate the current subtitle event with the next event (e.g. a new packet read from the demuxer will instruct the subtitle render to stop display). If the subtitle event is just trailing, it will be displayed forever. So there's no proper way of doing this and we just apply an heuristic to avoid annoyances.
Diffstat (limited to 'sub')
-rw-r--r--sub/sd_lavc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c
index 3628607eed..0a969efc41 100644
--- a/sub/sd_lavc.c
+++ b/sub/sd_lavc.c
@@ -277,6 +277,9 @@ static void get_bitmaps(struct sd *sd, struct mp_osd_res d, double pts,
((sub->pts == MP_NOPTS_VALUE || pts >= sub->pts) &&
(sub->endpts == MP_NOPTS_VALUE || pts < sub->endpts)))
{
+ // Ignore "trailing" subtitles with unknown length after 1 minute.
+ if (sub->endpts == MP_NOPTS_VALUE && pts >= sub->pts + 60)
+ break;
current = sub;
break;
}