mirror of
https://github.com/mpv-player/mpv
synced 2025-02-03 05:31:34 +00:00
sub/sd_ass: utilize UINT32_MAX subtitle duration for unknown
US closed captions, teletext and ARIB caption decoders utilize this value.
This commit is contained in:
parent
1b9370ff92
commit
2d74b2d832
@ -260,7 +260,9 @@ char **lavc_conv_decode(struct lavc_conv *priv, struct demux_packet *packet,
|
||||
} else if (got_sub) {
|
||||
*sub_pts = packet->pts + mp_pts_from_av(priv->cur.start_display_time,
|
||||
&avctx->time_base);
|
||||
*sub_duration = mp_pts_from_av(priv->cur.end_display_time -
|
||||
*sub_duration = priv->cur.end_display_time == UINT32_MAX ?
|
||||
UINT32_MAX :
|
||||
mp_pts_from_av(priv->cur.end_display_time -
|
||||
priv->cur.start_display_time,
|
||||
&avctx->time_base);
|
||||
|
||||
|
15
sub/sd_ass.c
15
sub/sd_ass.c
@ -234,17 +234,18 @@ static void decode(struct sd *sd, struct demux_packet *packet)
|
||||
if (!sd->opts->sub_clear_on_seek && packet->pos >= 0 &&
|
||||
check_packet_seen(sd, packet->pos))
|
||||
return;
|
||||
if (packet->duration < 0) {
|
||||
if (!ctx->duration_unknown) {
|
||||
MP_WARN(sd, "Subtitle with unknown duration.\n");
|
||||
ctx->duration_unknown = true;
|
||||
}
|
||||
packet->duration = UNKNOWN_DURATION;
|
||||
}
|
||||
|
||||
double sub_pts = 0;
|
||||
double sub_duration = 0;
|
||||
char **r = lavc_conv_decode(ctx->converter, packet, &sub_pts,
|
||||
&sub_duration);
|
||||
if (packet->duration < 0 || sub_duration == UINT32_MAX) {
|
||||
if (!ctx->duration_unknown) {
|
||||
MP_WARN(sd, "Subtitle with unknown duration.\n");
|
||||
ctx->duration_unknown = true;
|
||||
}
|
||||
sub_duration = UNKNOWN_DURATION;
|
||||
}
|
||||
|
||||
for (int n = 0; r && r[n]; n++) {
|
||||
char *ass_line = r[n];
|
||||
|
Loading…
Reference in New Issue
Block a user