[FFmpeg-cvslog] avformat/subtitles: treat negative duration like unknown duration

wm4 git at videolan.org
Wed Dec 23 15:30:51 CET 2015


ffmpeg | branch: master | wm4 <nfxjfg at googlemail.com> | Wed Dec 23 15:08:58 2015 +0100| [a0ec4aebabe1f816cc69e20309981907ba5d1395] | committer: wm4

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.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a0ec4aebabe1f816cc69e20309981907ba5d1395
---

 libavformat/subtitles.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c
index 7c6cd5f..108f909 100644
--- a/libavformat/subtitles.c
+++ b/libavformat/subtitles.c
@@ -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)



More information about the ffmpeg-cvslog mailing list