Mercurial > libavcodec.hg
comparison h264_parser.c @ 8998:9339bf262eb5 libavcodec
Set context variable key_frame in H264 parser.
Patch by Ivan Schreter, schreter gmx net
author | cehoyos |
---|---|
date | Sat, 21 Feb 2009 19:59:25 +0000 |
parents | 1c69c50d78f1 |
children | f701dab6a62d |
comparison
equal
deleted
inserted
replaced
8997:1c69c50d78f1 | 8998:9339bf262eb5 |
---|---|
116 int state; | 116 int state; |
117 const uint8_t *ptr; | 117 const uint8_t *ptr; |
118 | 118 |
119 /* set some sane default values */ | 119 /* set some sane default values */ |
120 s->pict_type = FF_I_TYPE; | 120 s->pict_type = FF_I_TYPE; |
121 s->key_frame = 0; | |
121 | 122 |
122 h->s.avctx= avctx; | 123 h->s.avctx= avctx; |
124 h->sei_recovery_frame_cnt = -1; | |
123 | 125 |
124 for(;;) { | 126 for(;;) { |
125 int src_length, dst_length, consumed; | 127 int src_length, dst_length, consumed; |
126 buf = ff_find_start_code(buf, buf_end, &state); | 128 buf = ff_find_start_code(buf, buf_end, &state); |
127 if(buf >= buf_end) | 129 if(buf >= buf_end) |
150 break; | 152 break; |
151 case NAL_SEI: | 153 case NAL_SEI: |
152 ff_h264_decode_sei(h); | 154 ff_h264_decode_sei(h); |
153 break; | 155 break; |
154 case NAL_IDR_SLICE: | 156 case NAL_IDR_SLICE: |
157 s->key_frame = 1; | |
158 /* fall through */ | |
155 case NAL_SLICE: | 159 case NAL_SLICE: |
156 get_ue_golomb(&h->s.gb); // skip first_mb_in_slice | 160 get_ue_golomb(&h->s.gb); // skip first_mb_in_slice |
157 slice_type = get_ue_golomb_31(&h->s.gb); | 161 slice_type = get_ue_golomb_31(&h->s.gb); |
158 s->pict_type = golomb_to_pict_type[slice_type % 5]; | 162 s->pict_type = golomb_to_pict_type[slice_type % 5]; |
163 if (h->sei_recovery_frame_cnt >= 0) { | |
164 /* key frame, since recovery_frame_cnt is set */ | |
165 s->key_frame = 1; | |
166 } | |
159 return 0; /* no need to evaluate the rest */ | 167 return 0; /* no need to evaluate the rest */ |
160 } | 168 } |
161 buf += consumed; | 169 buf += consumed; |
162 } | 170 } |
163 /* didn't find a picture! */ | 171 /* didn't find a picture! */ |