mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
fix fallback if theres no index
fix index less seeking Originally committed as revision 6055 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
56c96a229b
commit
52e5461288
@ -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{
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user