changeset 3915:7643d7c3fcf6 libavformat

matroskadec: ensure that overlapping subtitles are not added to the index
author aurel
date Tue, 09 Sep 2008 12:07:10 +0000
parents f7a20cf5438f
children 4a7174c2b34e
files matroskadec.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/matroskadec.c	Tue Sep 09 12:01:51 2008 +0000
+++ b/matroskadec.c	Tue Sep 09 12:07:10 2008 +0000
@@ -139,6 +139,7 @@
     EbmlList encodings;
 
     AVStream *stream;
+    int64_t end_timecode;
 } MatroskaTrack;
 
 typedef struct {
@@ -1462,8 +1463,12 @@
     if (cluster_time != (uint64_t)-1
         && (block_time >= 0 || cluster_time >= -block_time)) {
         timecode = cluster_time + block_time;
+        if (track->type == MATROSKA_TRACK_TYPE_SUBTITLE
+            && timecode < track->end_timecode)
+            is_keyframe = 0;  /* overlapping subtitles are not key frame */
         if (is_keyframe)
             av_add_index_entry(st, cluster_pos, timecode, 0,0,AVINDEX_KEYFRAME);
+        track->end_timecode = FFMAX(track->end_timecode, timecode+duration);
     }
 
     if (matroska->skip_to_keyframe) {