int i_last_input_rate;
/* internal caching delay from input */
int i_pts_delay;
- /* desynchronisation delay request by the user */
- int i_desync;
-
};
/** an output stream for the audio output */
aout_unlock_input_fifos( p_aout );
aout_unlock_mixer( p_aout );
- p_input->i_desync = var_CreateGetInteger( p_this, "audio-desync" ) * 1000;
p_input_thread = (input_thread_t *)vlc_object_find( p_this,
VLC_OBJECT_INPUT, FIND_PARENT );
if( p_input_thread )
{
p_input->i_pts_delay = p_input_thread->i_pts_delay;
- p_input->i_pts_delay += p_input->i_desync;
p_input->p_input_thread = p_input_thread;
vlc_object_release( p_input_thread );
}
else
{
p_input->i_pts_delay = DEFAULT_PTS_DELAY;
- p_input->i_pts_delay += p_input->i_desync;
p_input->p_input_thread = NULL;
}
return 0;
}
- /* Apply the desynchronisation requested by the user */
- p_buffer->start_date += p_input->i_desync;
- p_buffer->end_date += p_input->i_desync;
-
if ( p_buffer->start_date > mdate() + p_input->i_pts_delay +
AOUT_MAX_ADVANCE_TIME )
{
/* If the desynchronisation requested by the user is < 0, we need to
* cache more data. */
var_Get( p_input, "audio-desync", &val );
- if( val.i_int < 0 ) p_input->i_pts_delay -= (val.i_int * 1000);
+ if( val.i_int < 0 )
+ p_input->i_pts_delay -= (val.i_int * 1000);
/* Update cr_average depending on the caching */
p_input->p->input.i_cr_average *= (10 * p_input->i_pts_delay / 200000);
/* Delay */
var_Create( p_input, "audio-delay", VLC_VAR_TIME );
- val.i_time = 0;
+ val.i_time = INT64_C(1000) * var_GetInteger( p_input, "audio-desync" );
var_Change( p_input, "audio-delay", VLC_VAR_SETVALUE, &val, NULL );
var_Create( p_input, "spu-delay", VLC_VAR_TIME );
val.i_time = 0;
if( !strcmp( psz_cmd, "audio-delay" ) )
{
- /*Change i_pts_delay to make sure es are decoded in time*/
- if (newval.i_int < 0 || oldval.i_int < 0 )
+ /* Change i_pts_delay to make sure es are decoded in time */
+ if( newval.i_int < 0 || oldval.i_int < 0 )
{
p_input->i_pts_delay -= newval.i_int - oldval.i_int;
}
input_ControlPush( p_input, INPUT_CONTROL_SET_AUDIO_DELAY, &newval );
}
else if( !strcmp( psz_cmd, "spu-delay" ) )
+ {
input_ControlPush( p_input, INPUT_CONTROL_SET_SPU_DELAY, &newval );
+ }
return VLC_SUCCESS;
}