+ /* Intra-slice refresh. Simulate a blank I picture. */
+ msg_Dbg( p_dec, "intra-slice refresh stream" );
+ decoder_SynchroNewPicture( p_sys->p_synchro,
+ I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate,
+ p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
+ decoder_SynchroDecode( p_sys->p_synchro );
+ decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
+ p_sys->b_slice_i = 1;
+ }
+ p_sys->b_after_sequence_header = 0;
+
+#ifdef PIC_FLAG_PTS
+ i_pts = p_sys->p_info->current_picture->flags & PIC_FLAG_PTS ?
+ ( ( p_sys->p_info->current_picture->pts ==
+ (uint32_t)p_sys->i_current_pts ) ?
+ p_sys->i_current_pts : p_sys->i_previous_pts ) : 0;
+ i_dts = 0;
+
+ /* Hack to handle demuxers which only have DTS timestamps */
+ if( !i_pts && !p_block->i_pts && p_block->i_dts > 0 )
+ {
+ if( p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ||
+ (p_sys->p_info->current_picture->flags &
+ PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_B )
+ {
+ i_pts = p_block->i_dts;
+ }
+ }
+ p_block->i_pts = p_block->i_dts = 0;
+ /* End hack */
+
+#else /* New interface */
+
+ i_pts = p_sys->p_info->current_picture->flags & PIC_FLAG_TAGS ?
+ ( ( p_sys->p_info->current_picture->tag ==
+ (uint32_t)p_sys->i_current_pts ) ?
+ p_sys->i_current_pts : p_sys->i_previous_pts ) : 0;
+ i_dts = p_sys->p_info->current_picture->flags & PIC_FLAG_TAGS ?
+ ( ( p_sys->p_info->current_picture->tag2 ==
+ (uint32_t)p_sys->i_current_dts ) ?
+ p_sys->i_current_dts : p_sys->i_previous_dts ) : 0;
+#endif
+
+ /* If nb_fields == 1, it is a field picture, and it will be
+ * followed by another field picture for which we won't call
+ * decoder_SynchroNewPicture() because this would have other
+ * problems, so we take it into account here.
+ * This kind of sucks, but I didn't think better. --Meuuh
+ */
+ decoder_SynchroNewPicture( p_sys->p_synchro,
+ p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE,
+ p_sys->p_info->current_picture->nb_fields == 1 ? 2 :
+ p_sys->p_info->current_picture->nb_fields, i_pts, i_dts,
+ p_sys->i_current_rate,
+ p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
+
+ if( !p_dec->b_pace_control && !p_sys->b_preroll &&
+ !(p_sys->b_slice_i
+ && ((p_sys->p_info->current_picture->flags
+ & PIC_MASK_CODING_TYPE) == P_CODING_TYPE))
+ && !decoder_SynchroChoose( p_sys->p_synchro,
+ p_sys->p_info->current_picture->flags
+ & PIC_MASK_CODING_TYPE,
+ /*p_sys->p_vout->render_time*/ 0 /*FIXME*/,
+ p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ) )
+ {
+ mpeg2_skip( p_sys->p_mpeg2dec, 1 );
+ p_sys->b_skip = 1;
+ decoder_SynchroTrash( p_sys->p_synchro );
+ mpeg2_set_buf( p_sys->p_mpeg2dec, buf, NULL );