mirror of
https://github.com/mpv-player/mpv
synced 2025-02-16 12:17:12 +00:00
sd_ass: improve handling of subtitles with unknown duration
Commit 740b701
introduced handling for subtitles with unknown duration,
but it came with a minor flaw where a track event that shares identical
start time with following track event will has its Duration value set
to 0, we don't want this to happen since it will prevent simultaneous
rendering of multiple track events.
This commit aims to address this issue.
This commit is contained in:
parent
b3d77397eb
commit
59fc8eecbc
10
sub/sd_ass.c
10
sub/sd_ass.c
@ -359,10 +359,14 @@ static void decode(struct sd *sd, struct demux_packet *packet)
|
||||
filter_and_add(sd, &pkt2);
|
||||
}
|
||||
if (ctx->duration_unknown) {
|
||||
for (int n = 0; n < track->n_events - 1; n++) {
|
||||
for (int n = track->n_events - 2; n >= 0; n--) {
|
||||
if (track->events[n].Duration == UNKNOWN_DURATION * 1000) {
|
||||
track->events[n].Duration = track->events[n + 1].Start -
|
||||
track->events[n].Start;
|
||||
if (track->events[n].Start != track->events[n + 1].Start) {
|
||||
track->events[n].Duration = track->events[n + 1].Start -
|
||||
track->events[n].Start;
|
||||
} else {
|
||||
track->events[n].Duration = track->events[n + 1].Duration;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user