summaryrefslogtreecommitdiffstats
path: root/sub/dec_sub.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2024-01-23 10:10:35 -0600
committerDudemanguy <random342@airmail.cc>2024-02-15 16:43:11 +0000
commit4e5d996c3a3f74a7308aee53614c2b94c71daebc (patch)
treec0ace429c70f46a4e720495f9907e39d6a1bf238 /sub/dec_sub.c
parent25bba7c811fd203f4f9a8dfb1350e3bd79ed719e (diff)
downloadmpv-4e5d996c3a3f74a7308aee53614c2b94c71daebc.tar.bz2
mpv-4e5d996c3a3f74a7308aee53614c2b94c71daebc.tar.xz
player/sub: attempt to detect animated subtitles
The previous commits optimized sub redrawing on still images/terminal so mpv wouldn't redraw so much. There is a gap though. It only assumes static subtitles. Since ASS can be animated, those types of subtitles will always need redraws so we need to build in specific detection for this. We need to build a whitelist of events in ASS that are considered animations and then flag the packet. Additionally, there's a bunch of annoying bookkeeping that has to be done since packets can be dropped on seeks and so on.
Diffstat (limited to 'sub/dec_sub.c')
-rw-r--r--sub/dec_sub.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sub/dec_sub.c b/sub/dec_sub.c
index c224a25fd6..94ff3ba4dd 100644
--- a/sub/dec_sub.c
+++ b/sub/dec_sub.c
@@ -312,12 +312,16 @@ static bool update_pkt_cache(struct dec_sub *sub, double video_pts)
if (next_pts < pts || end_pts < pts) {
if (sub->cached_pkt_pos + 1 < sub->num_cached_pkts) {
TA_FREEP(&sub->cached_pkts[sub->cached_pkt_pos]);
+ pkt = NULL;
sub->cached_pkt_pos++;
}
if (next_pts < pts)
return true;
}
+ if (pkt && pkt->animated)
+ return true;
+
return false;
}