Mercurial > libavformat.hg
diff utils.c @ 354:6770ca07abe2 libavformat
store searched distance in index, so we dont waste time searching for keyframes where we already searched
asf seek fixes & use keyframe pos/timestamp cache
author | michael |
---|---|
date | Sat, 17 Jan 2004 18:06:52 +0000 |
parents | e154eb1b7149 |
children | 3fca8e9142a4 |
line wrap: on
line diff
--- a/utils.c Wed Jan 14 21:50:05 2004 +0000 +++ b/utils.c Sat Jan 17 18:06:52 2004 +0000 @@ -861,8 +861,8 @@ } /* add a index entry into a sorted list updateing if it is already there */ -void av_add_index_entry(AVStream *st, - int64_t pos, int64_t timestamp, int flags) +int av_add_index_entry(AVStream *st, + int64_t pos, int64_t timestamp, int distance, int flags) { AVIndexEntry *entries, *ie; int index; @@ -890,12 +890,17 @@ } st->nb_index_entries++; } - }else - ie= &entries[st->nb_index_entries++]; + }else{ + index= st->nb_index_entries++; + ie= &entries[index]; + } ie->pos = pos; ie->timestamp = timestamp; + ie->min_distance= distance; ie->flags = flags; + + return index; } /* build an index for raw streams using a parser */ @@ -916,7 +921,7 @@ if (pkt->stream_index == 0 && st->parser && (pkt->flags & PKT_FLAG_KEY)) { av_add_index_entry(st, st->parser->frame_offset, pkt->dts, - AVINDEX_KEYFRAME); + 0, AVINDEX_KEYFRAME); } av_free_packet(pkt); }