diff options
author | Lypheo <saifullah124@hotmail.de> | 2023-03-08 19:05:59 +0100 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-04-29 00:30:15 +0000 |
commit | e928bd5fdb4e2a7cac3e55c4a2056c0cb4a76d9c (patch) | |
tree | 48e4492a2bad9e13f558437273aaa9637ef8a232 /sub/sd_ass.c | |
parent | c5211dbf4ae38583b4a55ab63c5c07f8547f73b8 (diff) | |
download | mpv-e928bd5fdb4e2a7cac3e55c4a2056c0cb4a76d9c.tar.bz2 mpv-e928bd5fdb4e2a7cac3e55c4a2056c0cb4a76d9c.tar.xz |
sub: fix UPDATE_SUB_HARD for converted and external subtitles
Upon an option update with an UPDATE_SUB_HARD flag,
the ass_track that stores all the decoded
subtitle packets/events is destroyed and recreated, which means
the packets need to be read and decoded again to refill
the ass_track. This caused issues (no subs displayed) in 2 cases:
1. external sub files
Previously, external sub files were read and decoded only
once when loaded. Since this meant all decoded events were lost
forever when recreating the ass_track, we need to change this
and trigger a new preload during sub reinits.
2. converted subs (non-ASS text subs like srt)
For converted subs, we maintain a list of previously
seen packets to avoid decoding and adding duplicate events
to the ass_track. Previously this list wasn’t synchronized with
the corresponding ass_track, so the sub decoder would reject
any previously seen sub packets, usually meaning only subs sometime
after the current pts would be displayed after sub reinits.
Fix this by resetting the list upon ass_track recreation.
Diffstat (limited to 'sub/sd_ass.c')
-rw-r--r-- | sub/sd_ass.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sub/sd_ass.c b/sub/sd_ass.c index 34dc567e54..bec989fee7 100644 --- a/sub/sd_ass.c +++ b/sub/sd_ass.c @@ -824,6 +824,10 @@ static int control(struct sd *sd, enum sd_ctrl cmd, void *arg) ctx->clear_once = true; // allow reloading on seeks } if (flags & UPDATE_SUB_HARD) { + // ass_track will be recreated, so clear duplicate cache + ctx->clear_once = true; + reset(sd); + assobjects_destroy(sd); assobjects_init(sd); } |