+ mtime_t i_pts, i_dts;
+
+ mtime_t i_time = block->GlobalTimecode();
+ if ( i_block_ref1 != 0 )
+ i_time += min( 0, i_block_ref1 );
+ if ( i_block_ref2 != 0 )
+ i_time += min( 0, i_block_ref2 );
+
+ i_pts = (p_sys->i_chapter_time + block->GlobalTimecode()) / (mtime_t) 1000;
+ i_dts = (p_sys->i_chapter_time + i_time) / (mtime_t) 1000;
+
+ if ( i_dts != i_pts && p_sys->i_last_dts >= i_dts )
+ p_sys->i_last_dts += 200;
+ else
+ p_sys->i_last_dts = i_dts;
+
+ p_sys->i_pts = i_pts;