diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-01-17 18:06:52 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-01-17 18:06:52 +0000 |
commit | 3e9245a98e3e6e752d7b15109990c50b2ac73407 (patch) | |
tree | c5acf88c48ac7af48607519ae7f2e8daa9953b81 /libavformat/utils.c | |
parent | fb204d4bc1d05f1713534ab19cccfb993d738d7f (diff) | |
download | ffmpeg-3e9245a98e3e6e752d7b15109990c50b2ac73407.tar.gz |
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
Originally committed as revision 2709 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 18f031db46..2f60c77c74 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -861,8 +861,8 @@ static void av_read_frame_flush(AVFormatContext *s) } /* 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 @@ void av_add_index_entry(AVStream *st, } 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 @@ static void av_build_index_raw(AVFormatContext *s) 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); } |