summaryrefslogtreecommitdiffstats
path: root/libhb/encx264.c
diff options
context:
space:
mode:
authorTim Walker <[email protected]>2016-09-17 15:45:38 +0200
committerTim Walker <[email protected]>2016-09-17 15:45:38 +0200
commitbe6defbde7de260afc61d969c17a898a0fd28106 (patch)
tree720de878e154dcd7300318583323c49721a9511a /libhb/encx264.c
parent2df5fe643ebabf4e03456167475b6ca2bbe13c74 (diff)
libhb: use the new keyframe flag.
Diffstat (limited to 'libhb/encx264.c')
-rw-r--r--libhb/encx264.c49
1 files changed, 24 insertions, 25 deletions
diff --git a/libhb/encx264.c b/libhb/encx264.c
index e74e4a39d..d5adfdd10 100644
--- a/libhb/encx264.c
+++ b/libhb/encx264.c
@@ -652,15 +652,11 @@ static hb_buffer_t *nal_encode( hb_work_object_t *w, x264_picture_t *pic_out,
w->config->h264.init_delay = -pic_out->i_dts;
}
- /* Decide what type of frame we have. */
- switch( pic_out->i_type )
+ /* Determine what type of frame we have. */
+ switch (pic_out->i_type)
{
case X264_TYPE_IDR:
- // Handled in b_keyframe check below.
- break;
-
- case X264_TYPE_I:
- buf->s.frametype = HB_FRAME_I;
+ buf->s.frametype = HB_FRAME_IDR;
break;
case X264_TYPE_P:
@@ -671,24 +667,20 @@ static hb_buffer_t *nal_encode( hb_work_object_t *w, x264_picture_t *pic_out,
buf->s.frametype = HB_FRAME_B;
break;
- /* This is for b-pyramid, which has reference b-frames
- However, it doesn't seem to ever be used... */
case X264_TYPE_BREF:
buf->s.frametype = HB_FRAME_BREF;
break;
- // If it isn't the above, what type of frame is it??
+ case X264_TYPE_I:
default:
- buf->s.frametype = 0;
+ buf->s.frametype = HB_FRAME_I;
break;
}
+ buf->s.flags = 0;
- // PIR has no IDR frames, but x264 marks recovery points
- // as keyframes. So fake an IDR at these points. This flag
- // is also set for real IDR frames.
if (pic_out->b_keyframe)
{
- buf->s.frametype = HB_FRAME_IDR;
+ buf->s.flags |= HB_FLAG_FRAMETYPE_KEY;
/* if we have a chapter marker pending and this
frame's presentation time stamp is at or after
the marker's time stamp, use this as the
@@ -728,17 +720,24 @@ static hb_buffer_t *nal_encode( hb_work_object_t *w, x264_picture_t *pic_out,
break;
}
- /* Since libx264 doesn't tell us when b-frames are
- themselves reference frames, figure it out on our own. */
- if( (buf->s.frametype == HB_FRAME_B) &&
- (nal[i].i_ref_idc != NAL_PRIORITY_DISPOSABLE) )
- buf->s.frametype = HB_FRAME_BREF;
-
- /* Expose disposable bit to muxer. */
- if( nal[i].i_ref_idc == NAL_PRIORITY_DISPOSABLE )
- buf->s.flags &= ~HB_FRAME_REF;
+ /*
+ * Expose disposable bit to muxer.
+ *
+ * Also, since libx264 doesn't tell us when B-frames are
+ * themselves reference frames, figure it out on our own.
+ */
+ if (nal[i].i_ref_idc == NAL_PRIORITY_DISPOSABLE)
+ {
+ buf->s.flags &= ~HB_FLAG_FRAMETYPE_REF;
+ }
else
- buf->s.flags |= HB_FRAME_REF;
+ {
+ if (buf->s.frametype == HB_FRAME_B)
+ {
+ buf->s.frametype = HB_FRAME_BREF;
+ }
+ buf->s.flags |= HB_FLAG_FRAMETYPE_REF;
+ }
buf->size += size;
}