changeset 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
files h264_parser.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/h264_parser.c	Sat Feb 21 19:56:50 2009 +0000
+++ b/h264_parser.c	Sat Feb 21 19:59:25 2009 +0000
@@ -118,8 +118,10 @@
 
     /* 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 @@
             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;