Revision 8a472821 libavformat/avidec.c
libavformat/avidec.c | ||
---|---|---|
89 | 89 |
} |
90 | 90 |
#endif |
91 | 91 |
|
92 |
static inline int get_duration(AVIStream *ast, int len){ |
|
93 |
if(ast->sample_size){ |
|
94 |
return len; |
|
95 |
}else |
|
96 |
return 1; |
|
97 |
} |
|
98 |
|
|
92 | 99 |
static int get_riff(AVFormatContext *s, ByteIOContext *pb) |
93 | 100 |
{ |
94 | 101 |
AVIContext *avi = s->priv_data; |
... | ... | |
175 | 182 |
if(last_pos != pos && (len || !ast->sample_size)) |
176 | 183 |
av_add_index_entry(st, pos, ast->cum_len, len, 0, key ? AVINDEX_KEYFRAME : 0); |
177 | 184 |
|
178 |
if(ast->sample_size) |
|
179 |
ast->cum_len += len; |
|
180 |
else |
|
181 |
ast->cum_len ++; |
|
185 |
ast->cum_len += get_duration(ast, len); |
|
182 | 186 |
last_pos= pos; |
183 | 187 |
}else{ |
184 | 188 |
int64_t offset, pos; |
... | ... | |
821 | 825 |
} else { |
822 | 826 |
pkt->flags |= AV_PKT_FLAG_KEY; |
823 | 827 |
} |
824 |
if(ast->sample_size) |
|
825 |
ast->frame_offset += pkt->size; |
|
826 |
else |
|
827 |
ast->frame_offset++; |
|
828 |
ast->frame_offset += get_duration(ast, pkt->size); |
|
828 | 829 |
} |
829 | 830 |
ast->remaining -= size; |
830 | 831 |
if(!ast->remaining){ |
... | ... | |
906 | 907 |
if( (st->discard >= AVDISCARD_DEFAULT && size==0) |
907 | 908 |
/*|| (st->discard >= AVDISCARD_NONKEY && !(pkt->flags & AV_PKT_FLAG_KEY))*/ //FIXME needs a little reordering |
908 | 909 |
|| st->discard >= AVDISCARD_ALL){ |
909 |
if(ast->sample_size) ast->frame_offset += size; |
|
910 |
else ast->frame_offset++; |
|
910 |
ast->frame_offset += get_duration(ast, size); |
|
911 | 911 |
url_fskip(pb, size); |
912 | 912 |
goto resync; |
913 | 913 |
} |
... | ... | |
1000 | 1000 |
avi->non_interleaved= 1; |
1001 | 1001 |
else if(len || !ast->sample_size) |
1002 | 1002 |
av_add_index_entry(st, pos, ast->cum_len, len, 0, (flags&AVIIF_INDEX) ? AVINDEX_KEYFRAME : 0); |
1003 |
if(ast->sample_size) |
|
1004 |
ast->cum_len += len; |
|
1005 |
else |
|
1006 |
ast->cum_len ++; |
|
1003 |
ast->cum_len += get_duration(ast, len); |
|
1007 | 1004 |
last_pos= pos; |
1008 | 1005 |
} |
1009 | 1006 |
return 0; |
Also available in: Unified diff