diff options
author | Ivan Schreter <schreter@gmx.net> | 2009-02-21 19:59:25 +0000 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at> | 2009-02-21 19:59:25 +0000 |
commit | 0ed260c7a3e57f9407602d4c78e23f7b8b675690 (patch) | |
tree | 015717c47270b4687505591fba870efad6e08bbd | |
parent | ff6474dd1505411e6875f431379ac4dbb5e45d4a (diff) | |
download | ffmpeg-0ed260c7a3e57f9407602d4c78e23f7b8b675690.tar.gz |
Set context variable key_frame in H264 parser.
Patch by Ivan Schreter, schreter gmx net
Originally committed as revision 17489 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/h264_parser.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index e00c15bb60..09f764aeae 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -118,8 +118,10 @@ static inline int parse_nal_units(AVCodecParserContext *s, /* set some sane default values */ s->pict_type = FF_I_TYPE; + s->key_frame = 0; h->s.avctx= avctx; + h->sei_recovery_frame_cnt = -1; for(;;) { int src_length, dst_length, consumed; @@ -152,10 +154,16 @@ static inline int parse_nal_units(AVCodecParserContext *s, ff_h264_decode_sei(h); break; case NAL_IDR_SLICE: + s->key_frame = 1; + /* fall through */ case NAL_SLICE: get_ue_golomb(&h->s.gb); // skip first_mb_in_slice slice_type = get_ue_golomb_31(&h->s.gb); s->pict_type = golomb_to_pict_type[slice_type % 5]; + if (h->sei_recovery_frame_cnt >= 0) { + /* key frame, since recovery_frame_cnt is set */ + s->key_frame = 1; + } return 0; /* no need to evaluate the rest */ } buf += consumed; |