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:
1 parent
b3d77397eb
commit
59fc8eecbc
1 file changed
+7
-3
+7
-3
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user