aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/avidec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-01-30 23:52:45 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-07-19 18:44:46 +0200
commit83d6ad3616cac9ecfe23d83822b2e9d10a8c985d (patch)
tree21dd7c9563687f26fdce9efeeffd99ec10241305 /libavformat/avidec.c
parente03cd1049ed916ee3c01b2f545a1175d48ac9101 (diff)
downloadffmpeg-83d6ad3616cac9ecfe23d83822b2e9d10a8c985d.tar.gz
avidec: Mark first frame as keyframe in case there are no keyframes.
This fixes seeking in filecopy.avi of Ticket504 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/avidec.c')
-rw-r--r--libavformat/avidec.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 582ca3396f..99a95b2aea 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -1248,6 +1248,7 @@ static int avi_read_idx1(AVFormatContext *s, int size)
unsigned last_pos= -1;
unsigned last_idx= -1;
int64_t idx1_pos, first_packet_pos = 0, data_offset = 0;
+ int anykey = 0;
nb_index_entries = size / 16;
if (nb_index_entries <= 0)
@@ -1299,6 +1300,14 @@ static int avi_read_idx1(AVFormatContext *s, int size)
}
ast->cum_len += get_duration(ast, len);
last_pos= pos;
+ anykey |= flags&AVIIF_INDEX;
+ }
+ if (!anykey) {
+ for (index = 0; index < s->nb_streams; index++) {
+ st = s->streams[index];
+ if (st->nb_index_entries)
+ st->index_entries[0].flags |= AVINDEX_KEYFRAME;
+ }
}
return 0;
}