Commit 3c01122e authored by Christophe Massiot's avatar Christophe Massiot

* 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.
parent 8665fe8b
......@@ -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 */
......
......@@ -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 ) );
......@@ -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 );
}
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment