summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorJan Ekström <jeebjp@gmail.com>2019-09-18 21:29:25 +0300
committerJan Ekström <jeebjp@gmail.com>2019-09-19 00:02:03 +0300
commit2d74b2d832659efc81090a2c6bd9808ffeba3bc2 (patch)
treea7003256870c64a2bd2f6d06a7a707dc333fa100 /sub
parent1b9370ff92a7fdf347d087db7c29bf682abadb9e (diff)
downloadmpv-2d74b2d832659efc81090a2c6bd9808ffeba3bc2.tar.bz2
mpv-2d74b2d832659efc81090a2c6bd9808ffeba3bc2.tar.xz
sub/sd_ass: utilize UINT32_MAX subtitle duration for unknown
US closed captions, teletext and ARIB caption decoders utilize this value.
Diffstat (limited to 'sub')
-rw-r--r--sub/lavc_conv.c8
-rw-r--r--sub/sd_ass.c13
2 files changed, 12 insertions, 9 deletions
diff --git a/sub/lavc_conv.c b/sub/lavc_conv.c
index 7077116180..65ebc0d8c7 100644
--- a/sub/lavc_conv.c
+++ b/sub/lavc_conv.c
@@ -260,9 +260,11 @@ 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 -
- priv->cur.start_display_time,
- &avctx->time_base);
+ *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);
for (int i = 0; i < priv->cur.num_rects; i++) {
if (priv->cur.rects[i]->w > 0 && priv->cur.rects[i]->h > 0)
diff --git a/sub/sd_ass.c b/sub/sd_ass.c
index d3eee38a45..bf2a49eb9e 100644
--- a/sub/sd_ass.c
+++ b/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) {
+
+ 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;
}
- packet->duration = UNKNOWN_DURATION;
+ sub_duration = UNKNOWN_DURATION;
}
- double sub_pts = 0;
- double sub_duration = 0;
- char **r = lavc_conv_decode(ctx->converter, packet, &sub_pts,
- &sub_duration);
for (int n = 0; r && r[n]; n++) {
char *ass_line = r[n];