[FFmpeg-cvslog] avidec: detect mpeg4 keyframes in indexless avi
Michael Niedermayer
git at videolan.org
Fri May 6 02:20:50 CEST 2011
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu May 5 23:54:31 2011 +0200| [5e24098b84424b4cf449d809d1027c49fb06c375] | committer: Michael Niedermayer
avidec: detect mpeg4 keyframes in indexless avi
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5e24098b84424b4cf449d809d1027c49fb06c375
---
libavformat/avidec.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 27ae09a..98b3be6 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -1002,6 +1002,23 @@ resync:
e= &st->index_entries[index];
if(index >= 0 && e->timestamp == ast->frame_offset){
+ if (index == st->nb_index_entries-1){
+ int key=1;
+ int i;
+ uint32_t state=-1;
+ for(i=0; i<FFMIN(size,256); i++){
+ if(st->codec->codec_id == CODEC_ID_MPEG4){
+ if(state == 0x1B6){
+ key= !(pkt->data[i]&0xC0);
+ break;
+ }
+ }else
+ break;
+ state= (state<<8) + pkt->data[i];
+ }
+ if(!key)
+ e->flags &= ~AVINDEX_KEYFRAME;
+ }
if (e->flags & AVINDEX_KEYFRAME)
pkt->flags |= AV_PKT_FLAG_KEY;
}
More information about the ffmpeg-cvslog
mailing list