diff options
author | jstebbins <[email protected]> | 2011-09-19 15:39:48 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2011-09-19 15:39:48 +0000 |
commit | 574730f7b43a60478b22087947487d083b57be71 (patch) | |
tree | f0e0fd4fc8056480ec1e8c70cddce240c0750097 /libhb/encx264.c | |
parent | d36f10c33b9f9f85134f70fc785e2523177b2444 (diff) |
Add fake keyframes for PIR encoding
Periodic intra refresh has no IDR frames, but x264 signals a keyframe at
recovery points. Use this flag to fake keyframes in the container so
that seeking in these files works properly.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4232 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/encx264.c')
-rw-r--r-- | libhb/encx264.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/libhb/encx264.c b/libhb/encx264.c index e42a3be21..3d55c2ee3 100644 --- a/libhb/encx264.c +++ b/libhb/encx264.c @@ -422,16 +422,7 @@ static hb_buffer_t *nal_encode( hb_work_object_t *w, x264_picture_t *pic_out, switch( pic_out->i_type ) { case X264_TYPE_IDR: - buf->frametype = HB_FRAME_IDR; - /* 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 - chapter start. */ - if( pv->next_chap != 0 && pv->next_chap <= pic_out->i_pts ) - { - pv->next_chap = 0; - buf->new_chap = pv->chap_mark; - } + // Handled in b_keyframe check below. break; case X264_TYPE_I: @@ -470,6 +461,23 @@ static hb_buffer_t *nal_encode( hb_work_object_t *w, x264_picture_t *pic_out, else buf->flags |= HB_FRAME_REF; + // 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->frametype = HB_FRAME_IDR; + /* 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 + chapter start. */ + if( pv->next_chap != 0 && pv->next_chap <= pic_out->i_pts ) + { + pv->next_chap = 0; + buf->new_chap = pv->chap_mark; + } + } + buf->size += size; } // make sure we found at least one video frame |