diff options
author | Vladimir Pantelic <vladoman@gmail.com> | 2011-05-12 10:25:54 +0200 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2011-05-17 21:48:16 +0200 |
commit | c7bd5edae4573d901583475608865c6f6ca64061 (patch) | |
tree | 54fc714f780f2fbf75dbb677a13a1ee5ca7c846a /libavformat/asfdec.c | |
parent | 4bac1bbc3bc6e102cd1e8bfd0a36db07d769dfea (diff) | |
download | ffmpeg-c7bd5edae4573d901583475608865c6f6ca64061.tar.gz |
asfdec: fallback to binary search internally
lavf will do that anyway in case seek by index fails
Diffstat (limited to 'libavformat/asfdec.c')
-rw-r--r-- | libavformat/asfdec.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 77c84490a0..e2161fda2a 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -1269,21 +1269,22 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int if (!asf->index_read) asf_build_simple_index(s, stream_index); - if(!(asf->index_read && st->index_entries)){ - if(av_seek_frame_binary(s, stream_index, pts, flags)<0) - return -1; - }else{ + if((asf->index_read && st->index_entries)){ index= av_index_search_timestamp(st, pts, flags); - if(index<0) - return -1; - + if(index >= 0) { /* find the position */ pos = st->index_entries[index].pos; /* do the seek */ av_log(s, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos); avio_seek(s->pb, pos, SEEK_SET); + asf_reset_header(s); + return 0; + } } + /* no index or seeking by index failed */ + if(av_seek_frame_binary(s, stream_index, pts, flags)<0) + return -1; asf_reset_header(s); return 0; } |