summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorAurelien Jacobs <aurel@gnuage.org>2008-09-09 12:07:10 +0000
committerAurelien Jacobs <aurel@gnuage.org>2008-09-09 12:07:10 +0000
commit82360e670d2d1e6092257272d569efcdcb94cb2c (patch)
tree08baab282af306eaa9f4281ce3cce7c51bfb4415 /libavformat
parent20f7466550ae57e718600abefd3168d229056e51 (diff)
matroskadec: ensure that overlapping subtitles are not added to the index
Originally committed as revision 15283 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/matroskadec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index a6a682fad2..948238c4b4 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -139,6 +139,7 @@ typedef struct {
EbmlList encodings;
AVStream *stream;
+ int64_t end_timecode;
} MatroskaTrack;
typedef struct {
@@ -1462,8 +1463,12 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
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) {