- vout_SynchroNewPicture( p_dec->p_synchro,
- p_dec->p_info->current_picture->flags & PIC_MASK_CODING_TYPE,
- p_dec->p_info->current_picture->nb_fields,
- (p_dec->p_info->current_picture->flags & PIC_FLAG_PTS) ?
- ( (p_dec->p_info->current_picture->pts ==
- (uint32_t)p_dec->i_current_pts) ?
- p_dec->i_current_pts : p_dec->i_previous_pts ) : 0,
- 0,
- p_dec->i_current_rate );
-
- if ( !vout_SynchroChoose( p_dec->p_synchro,
- p_dec->p_info->current_picture->flags & PIC_MASK_CODING_TYPE ) )
+ if ( p_sys->b_after_sequence_header &&
+ ((p_sys->p_info->current_picture->flags &
+ PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_P) )
+ {
+ /* Intra-slice refresh. Simulate a blank I picture. */
+ msg_Dbg( p_dec, "intra-slice refresh stream" );
+ vout_SynchroNewPicture( p_sys->p_synchro,
+ I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate );
+ vout_SynchroDecode( p_sys->p_synchro );
+ vout_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
+
+ vout_SynchroNewPicture( p_sys->p_synchro,
+ p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE,
+ p_sys->p_info->current_picture->nb_fields, i_pts, i_dts,
+ p_sys->i_current_rate );
+
+ 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))
+ && !vout_SynchroChoose( p_sys->p_synchro,
+ p_sys->p_info->current_picture->flags
+ & PIC_MASK_CODING_TYPE,
+ /*p_sys->p_vout->render_time*/ 0 /*FIXME*/ ) )