# HG changeset patch # User andoma # Date 1191480644 0 # Node ID e3d7a78e2df385f6fa9ea809ed096e993e915a8a # Parent 65b71bd21a4dd3c0cb535c3beb16d5a520447bfc Fix Picture.key_frame setting to be compatible with frame and field contexts. Part of PAFF implementation. 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 diff -r 65b71bd21a4d -r e3d7a78e2df3 h264.c --- a/h264.c Thu Oct 04 06:43:58 2007 +0000 +++ b/h264.c Thu Oct 04 06:50:44 2007 +0000 @@ -2249,6 +2249,13 @@ 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 @@ 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)