vlc_bool_t b_after_sequence_header; /* is it the next frame after
* the sequence header ? */
vlc_bool_t b_slice_i; /* intra-slice refresh stream */
+ vlc_bool_t b_second_field;
- vlc_bool_t b_preroll;
+ vlc_bool_t b_preroll;
/*
* Output properties
p_sys->p_picture_to_destroy = NULL;
p_sys->b_garbage_pic = 0;
p_sys->b_slice_i = 0;
+ p_sys->b_second_field = 0;
p_sys->b_skip = 0;
p_sys->b_preroll = VLC_FALSE;
break;
case STATE_PICTURE_2ND:
- 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,
- 0, 0, p_sys->i_current_rate,
- p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
-
- if( p_sys->b_skip )
- {
- vout_SynchroTrash( p_sys->p_synchro );
- }
- else
- {
- vout_SynchroDecode( p_sys->p_synchro );
- }
+ p_sys->b_second_field = 1;
break;
case STATE_PICTURE:
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
+ * vout_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
+ */
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 == 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 );
mtime_t i_interpolated_dts;
mtime_t i_old_duration;
mtime_t i_last_ref_pts;
+ vlc_bool_t b_second_field;
/* Number of pictures since last sequence header */
int i_seq_old;
p_sys->i_interpolated_dts = 0;
p_sys->i_old_duration = 0;
p_sys->i_last_ref_pts = 0;
+ p_sys->b_second_field = 0;
p_sys->b_discontinuity = VLC_FALSE;
p_sys->b_sync_on_intra_frame = var_CreateGetBool( p_dec, "packetizer-mpegvideo-sync-iframe" );
else
{
/* Correct interpolated dts when we receive a new pts/dts */
- if( p_sys->i_last_ref_pts > 0 )
+ if( p_sys->i_last_ref_pts > 0 && !p_sys->b_second_field )
p_sys->i_interpolated_dts = p_sys->i_last_ref_pts;
if( p_sys->i_dts > 0 ) p_sys->i_interpolated_dts = p_sys->i_dts;
- p_sys->i_last_ref_pts = p_sys->i_pts;
+ if( !p_sys->b_second_field )
+ p_sys->i_last_ref_pts = p_sys->i_pts;
}
p_pic->i_dts = p_sys->i_interpolated_dts;
+ p_sys->i_interpolated_dts += i_duration;
/* Set PTS only if we have a B frame or if it comes from the stream */
if( p_sys->i_pts > 0 )
p_pic->i_pts = 0;
}
- if( p_sys->b_low_delay || p_sys->i_picture_type == 0x03 )
- {
- /* Trivial case (DTS == PTS) */
- p_sys->i_interpolated_dts += i_duration;
- }
- else
- {
- p_sys->i_interpolated_dts += p_sys->i_old_duration;
- p_sys->i_old_duration = i_duration;
- }
-
switch ( p_sys->i_picture_type )
{
case 0x01:
p_sys->p_frame = NULL;
p_sys->pp_last = &p_sys->p_frame;
p_sys->b_frame_slice = VLC_FALSE;
+
+ if( p_sys->i_picture_structure != 0x03 )
+ {
+ p_sys->b_second_field = !p_sys->b_second_field;
+ }
+ else
+ {
+ p_sys->b_second_field = 0;
+ }
}
/*