]> git.sesse.net Git - ffmpeg/commitdiff
avformat/subtitles: treat negative duration like unknown duration
authorwm4 <nfxjfg@googlemail.com>
Wed, 23 Dec 2015 14:08:58 +0000 (15:08 +0100)
committerwm4 <nfxjfg@googlemail.com>
Wed, 23 Dec 2015 14:08:58 +0000 (15:08 +0100)
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.

libavformat/subtitles.c

index 7c6cd5f3539535f60076d318244830565509fe94..108f909c84872d5b90a3d22024a6300bd8ae932a 100644 (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
                                      : cmp_pkt_sub_pos_ts);
     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;
 
     if (!q->keep_duplicates)