summaryrefslogtreecommitdiff
path: root/libavformat/asfdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2009-12-16 21:24:04 +0000
committerMichael Niedermayer <michaelni@gmx.at>2009-12-16 21:24:04 +0000
commit134271c232f6cb497fc66ae938008b11201be2ab (patch)
tree100845cc36801a296930fdbfa5d96a52c3142c1b /libavformat/asfdec.c
parentc3abb5514191a14d2eb44a172437a4bbff59edf4 (diff)
downloadffmpeg-134271c232f6cb497fc66ae938008b11201be2ab.tar.gz
Only add 1 index entry per keyframe.
Idea from a patch by samsung. Originally committed as revision 20888 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/asfdec.c')
-rw-r--r--libavformat/asfdec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 78c99f3aa3..ef7c2d309f 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -1065,7 +1065,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
url_fseek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);
get_guid(s->pb, &g);
if (!guidcmp(&g, &index_guid)) {
- int64_t itime;
+ int64_t itime, last_pos=-1;
int pct, ict;
int64_t av_unused gsize= get_le64(s->pb);
get_guid(s->pb, &g);
@@ -1080,8 +1080,11 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
int64_t pos = s->data_offset + s->packet_size*(int64_t)pktnum;
int64_t index_pts= av_rescale(itime, i, 10000);
+ if(pos != last_pos){
av_log(s, AV_LOG_DEBUG, "pktnum:%d, pktct:%d\n", pktnum, pktct);
av_add_index_entry(s->streams[stream_index], pos, index_pts, s->packet_size, 0, AVINDEX_KEYFRAME);
+ last_pos=pos;
+ }
}
asf->index_read= 1;
}