1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

avformat/subtitles: treat negative duration like unknown duration

Fixes a specific srt sample, which has an event with negative duration.
libavcodec will convert an event with negative duration to an ASS event
which will be displayed forever, which is not wanted here.

Treat negative duration always as unknown duration instead, and show it
until the next subtitle event.
This commit is contained in:
wm4 2015-12-23 15:08:58 +01:00
parent 57787f5ef8
commit a0ec4aebab

View File

@ -198,7 +198,7 @@ void ff_subtitles_queue_finalize(void *log_ctx, FFDemuxSubtitlesQueue *q)
q->sort == SUB_SORT_TS_POS ? cmp_pkt_sub_ts_pos q->sort == SUB_SORT_TS_POS ? cmp_pkt_sub_ts_pos
: cmp_pkt_sub_pos_ts); : cmp_pkt_sub_pos_ts);
for (i = 0; i < q->nb_subs; i++) for (i = 0; i < q->nb_subs; i++)
if (q->subs[i].duration == -1 && i < q->nb_subs - 1) if (q->subs[i].duration < 0 && i < q->nb_subs - 1)
q->subs[i].duration = q->subs[i + 1].pts - q->subs[i].pts; q->subs[i].duration = q->subs[i + 1].pts - q->subs[i].pts;
if (!q->keep_duplicates) if (!q->keep_duplicates)