From: Christophe Massiot Date: Fri, 20 May 2005 18:00:02 +0000 (+0000) Subject: * src/video_output/vout_synchro.c: Fixed synchro for low delay streams. X-Git-Tag: 0.8.2~158 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=3c01122ead0439d87bcaae4a3b5a32f28a50e940;p=vlc * src/video_output/vout_synchro.c: Fixed synchro for low delay streams. * include/vlc_block.h: Removed BLOCK_FLAG_END_OF_GOP which I don't use any longer. --- diff --git a/include/vlc_block.h b/include/vlc_block.h index bb42d3e85c..d673ce25f5 100644 --- a/include/vlc_block.h +++ b/include/vlc_block.h @@ -62,8 +62,6 @@ typedef struct block_sys_t block_sys_t; #define BLOCK_FLAG_END_OF_FRAME 0x0040 /** This is not a key frame for bitrate shaping */ #define BLOCK_FLAG_NO_KEYFRAME 0x0080 -/** This is the last block of the GOP */ -#define BLOCK_FLAG_END_OF_GOP 0x0100 /** This block contains a clock reference */ #define BLOCK_FLAG_CLOCK 0x0200 /** This block is scrambled */ diff --git a/include/vout_synchro.h b/include/vout_synchro.h index b4b6d470e3..eb2a10e10b 100644 --- a/include/vout_synchro.h +++ b/include/vout_synchro.h @@ -88,10 +88,10 @@ struct vout_synchro_t VLC_EXPORT( vout_synchro_t *, __vout_SynchroInit, ( vlc_object_t *, int ) ); VLC_EXPORT( void, vout_SynchroRelease, ( vout_synchro_t * ) ); VLC_EXPORT( void, vout_SynchroReset, ( vout_synchro_t * ) ); -VLC_EXPORT( vlc_bool_t, vout_SynchroChoose, ( vout_synchro_t *, int, int ) ); +VLC_EXPORT( vlc_bool_t, vout_SynchroChoose, ( vout_synchro_t *, int, int, vlc_bool_t ) ); VLC_EXPORT( void, vout_SynchroTrash, ( vout_synchro_t * ) ); VLC_EXPORT( void, vout_SynchroDecode, ( vout_synchro_t * ) ); VLC_EXPORT( void, vout_SynchroEnd, ( vout_synchro_t *, int, vlc_bool_t ) ); VLC_EXPORT( mtime_t, vout_SynchroDate, ( vout_synchro_t * ) ); -VLC_EXPORT( void, vout_SynchroNewPicture, ( vout_synchro_t *, int, int, mtime_t, mtime_t, int ) ); +VLC_EXPORT( void, vout_SynchroNewPicture, ( vout_synchro_t *, int, int, mtime_t, mtime_t, int, vlc_bool_t ) ); diff --git a/modules/codec/libmpeg2.c b/modules/codec/libmpeg2.c index bde31deb76..0675d18542 100644 --- a/modules/codec/libmpeg2.c +++ b/modules/codec/libmpeg2.c @@ -216,7 +216,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) return NULL; } - if( (p_block->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED)) && + if( (p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY + | BLOCK_FLAG_CORRUPTED)) && p_sys->p_synchro && p_sys->p_info->sequence && p_sys->p_info->sequence->width != (unsigned)-1 ) @@ -241,7 +242,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) if ( p_sys->b_slice_i ) { vout_SynchroNewPicture( p_sys->p_synchro, - I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate ); + I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate, + p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ); vout_SynchroDecode( p_sys->p_synchro ); vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 ); } @@ -377,7 +379,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) 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 ); + 0, 0, p_sys->i_current_rate, + p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ); if( p_sys->b_skip ) { @@ -402,7 +405,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) /* 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 ); + I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate, + p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ); vout_SynchroDecode( p_sys->p_synchro ); vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 ); p_sys->b_slice_i = 1; @@ -444,7 +448,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) 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 ); + 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 @@ -453,7 +458,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) && !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*/ ) ) + /*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; @@ -570,7 +576,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) if( p_sys->b_slice_i ) { vout_SynchroNewPicture( p_sys->p_synchro, - I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate ); + I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate, + p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ); vout_SynchroDecode( p_sys->p_synchro ); vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 ); } diff --git a/src/video_output/vout_synchro.c b/src/video_output/vout_synchro.c index 6293b5e5d4..5f4497a4c3 100644 --- a/src/video_output/vout_synchro.c +++ b/src/video_output/vout_synchro.c @@ -172,7 +172,7 @@ void vout_SynchroReset( vout_synchro_t * p_synchro ) * vout_SynchroChoose : Decide whether we will decode a picture or not *****************************************************************************/ vlc_bool_t vout_SynchroChoose( vout_synchro_t * p_synchro, int i_coding_type, - int i_render_time ) + int i_render_time, vlc_bool_t b_low_delay ) { #define TAU_PRIME( coding_type ) (p_synchro->p_tau[(coding_type)] \ + (p_synchro->p_tau[(coding_type)] >> 1) \ @@ -194,7 +194,11 @@ vlc_bool_t vout_SynchroChoose( vout_synchro_t * p_synchro, int i_coding_type, switch( i_coding_type ) { case I_CODING_TYPE: - if( S.backward_pts ) + if( b_low_delay ) + { + pts = S.current_pts; + } + else if( S.backward_pts ) { pts = S.backward_pts; } @@ -225,7 +229,11 @@ vlc_bool_t vout_SynchroChoose( vout_synchro_t * p_synchro, int i_coding_type, break; case P_CODING_TYPE: - if( S.backward_pts ) + if( b_low_delay ) + { + pts = S.current_pts; + } + else if( S.backward_pts ) { pts = S.backward_pts; } @@ -352,7 +360,8 @@ mtime_t vout_SynchroDate( vout_synchro_t * p_synchro ) *****************************************************************************/ void vout_SynchroNewPicture( vout_synchro_t * p_synchro, int i_coding_type, int i_repeat_field, mtime_t next_pts, - mtime_t next_dts, int i_current_rate ) + mtime_t next_dts, int i_current_rate, + vlc_bool_t b_low_delay ) { mtime_t period = 1000000 * 1001 / p_synchro->i_frame_rate * i_current_rate / INPUT_RATE_DEFAULT; @@ -441,7 +450,7 @@ void vout_SynchroNewPicture( vout_synchro_t * p_synchro, int i_coding_type, * (period >> 1); #define PTS_THRESHOLD (period >> 2) - if( i_coding_type == B_CODING_TYPE ) + if( i_coding_type == B_CODING_TYPE || b_low_delay ) { /* A video frame can be displayed 1, 2 or 3 times, according to * repeat_first_field, top_field_first, progressive_sequence and