]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Fix Picture.key_frame setting to be compatible with frame and field contexts. Part...
authorandoma <andoma@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 4 Oct 2007 06:50:44 +0000 (06:50 +0000)
committerandoma <andoma@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 4 Oct 2007 06:50:44 +0000 (06:50 +0000)
Contributed in part by Neil Brown.
patch by Jeff Downs, heydowns a borg d com
original thread:
Subject: [FFmpeg-devel] [PATCH] Implement PAFF in H.264
Date: 18/09/07 20:30

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@10664 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/h264.c

index b1bb071244105697ca21074c0b2128d1878d7952..8487c86af7f1a4e4aea0909dc11644489cc4df10 100644 (file)
@@ -2249,6 +2249,13 @@ static int frame_start(H264Context *h){
     if(MPV_frame_start(s, s->avctx) < 0)
         return -1;
     ff_er_frame_start(s);
+    /*
+     * MPV_frame_start uses pict_type to derive key_frame.
+     * This is incorrect for H.264; IDR markings must be used.
+     * Zero here; IDR markings per slice in frame or fields are OR'd in later.
+     * See decode_nal_units().
+     */
+    s->current_picture_ptr->key_frame= 0;
 
     assert(s->linesize && s->uvlinesize);
 
@@ -7189,7 +7196,7 @@ static int decode_nal_units(H264Context *h, uint8_t *buf, int buf_size){
             if((err = decode_slice_header(hx, h)))
                break;
 
-            s->current_picture_ptr->key_frame= (hx->nal_unit_type == NAL_IDR_SLICE);
+            s->current_picture_ptr->key_frame|= (hx->nal_unit_type == NAL_IDR_SLICE);
             if(hx->redundant_pic_count==0 && hx->s.hurry_up < 5
                && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
                && (avctx->skip_frame < AVDISCARD_BIDIR  || hx->slice_type!=B_TYPE)