+ /* This isn't really valid for streams with B-frames */
+ p_block->i_length = I64C(1000000) *
+ p_enc->fmt_in.video.i_frame_rate_base /
+ p_enc->fmt_in.video.i_frame_rate;
+
+ p_block->i_dts = p_block->i_pts = pic.i_pts;
+
+ if( p_sys->param.i_bframe > 0 )
+ {
+ if( p_block->i_flags & BLOCK_FLAG_TYPE_B )
+ {
+ p_block->i_dts = p_block->i_pts;
+ }
+ else
+ {
+ if( p_sys->i_last_ref_pts )
+ {
+ p_block->i_dts = p_sys->i_last_ref_pts;
+ }
+ else
+ {
+ /* Let's put something sensible */
+ p_block->i_dts = p_block->i_pts;
+ }
+
+ p_sys->i_last_ref_pts = p_block->i_pts;
+ }
+ }
+