Commit 0ed260c7 authored by Ivan Schreter's avatar Ivan Schreter Committed by Carl Eugen Hoyos

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
parent ff6474dd
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment