summaryrefslogtreecommitdiff
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorJeff Downs <heydowns@borg.com>2007-10-04 06:50:44 +0000
committerAndreas Ă–man <andreas@lonelycoder.com>2007-10-04 06:50:44 +0000
commit3a22d7fa1f55b91f4d1a41d8b54423226ef43387 (patch)
treef787fd0d4dcaa1c4f55e04f622b38640f12e3b8c /libavcodec/h264.c
parentf57e2af68bb58d67c32612fb3e70a47b13d66695 (diff)
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 Originally committed as revision 10664 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index b1bb071244..8487c86af7 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -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)