diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2006-08-23 20:24:58 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2006-08-23 20:24:58 +0000 |
commit | 52e5461288ba54d2bbeb76bba863ae6d970ce90d (patch) | |
tree | d673a216999ac7720094a18b6f4afebb4561b720 | |
parent | 56c96a229b383827808a993b90661130e4a2b537 (diff) | |
download | ffmpeg-52e5461288ba54d2bbeb76bba863ae6d970ce90d.tar.gz |
fix fallback if theres no index
fix index less seeking
Originally committed as revision 6055 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/asf.c | 7 | ||||
-rw-r--r-- | libavformat/asf.h | 1 |
2 files changed, 5 insertions, 3 deletions
diff --git a/libavformat/asf.c b/libavformat/asf.c index 587c139410..000308576c 100644 --- a/libavformat/asf.c +++ b/libavformat/asf.c @@ -823,7 +823,7 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos, assert((asf_st->packet_pos - s->data_offset) % asf->packet_size == 0); pos= asf_st->packet_pos; - av_add_index_entry(s->streams[i], pos, pkt->size, pts, pos - start_pos[i] + 1, AVINDEX_KEYFRAME); + av_add_index_entry(s->streams[i], pos, pts, pkt->size, pos - start_pos[i] + 1, AVINDEX_KEYFRAME); start_pos[i]= asf_st->packet_pos + 1; if(pkt->stream_index == stream_index) @@ -868,6 +868,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index) av_add_index_entry(s->streams[stream_index], pos, index_pts, asf->packet_size, 0, AVINDEX_KEYFRAME); } + asf->index_read= 1; } url_fseek(&s->pb, current_pos, SEEK_SET); } @@ -882,10 +883,10 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int if (asf->packet_size <= 0) return -1; - if (!st->index_entries) + if (!asf->index_read) asf_build_simple_index(s, stream_index); - if(!st->index_entries){ + if(!(asf->index_read && st->index_entries)){ if(av_seek_frame_binary(s, stream_index, pts, flags)<0) return -1; }else{ diff --git a/libavformat/asf.h b/libavformat/asf.h index 476a089d56..5f0bf9adfc 100644 --- a/libavformat/asf.h +++ b/libavformat/asf.h @@ -100,6 +100,7 @@ typedef struct { uint64_t data_offset; /* begining of the first data packet */ uint64_t data_object_offset; /* data object offset (excl. GUID & size)*/ uint64_t data_object_size; /* size of the data object */ + int index_read; ASFMainHeader hdr; |