input: remove JUMP controls

The input_thread can now only seek with absolute values.
This commit is contained in:
Thomas Guillem 2023-02-17 11:23:10 +01:00 committed by Steve Lhomme
parent 05c9c72715
commit 396c81410c
5 changed files with 11 additions and 54 deletions

View File

@ -544,18 +544,8 @@ static inline bool demux_IsForced( demux_t *p_demux, const char *psz_name )
return true;
}
static inline int demux_SetPosition( demux_t *p_demux, double pos, bool precise,
bool absolute)
static inline int demux_SetPosition( demux_t *p_demux, double pos, bool precise )
{
if( !absolute )
{
double current_pos;
int ret = vlc_demux_GetPosition( p_demux, &current_pos );
if( ret != VLC_SUCCESS )
return ret;
pos += current_pos;
}
if( pos < 0.f )
pos = 0.f;
else if( pos > 1.f )
@ -563,18 +553,8 @@ static inline int demux_SetPosition( demux_t *p_demux, double pos, bool precise,
return demux_Control( p_demux, DEMUX_SET_POSITION, pos, precise );
}
static inline int demux_SetTime( demux_t *p_demux, vlc_tick_t time, bool precise,
bool absolute )
static inline int demux_SetTime( demux_t *p_demux, vlc_tick_t time, bool precise )
{
if( !absolute )
{
vlc_tick_t current_time;
int ret = vlc_demux_GetTime( p_demux, &current_time );
if( ret != VLC_SUCCESS )
return ret;
time += current_time;
}
if( time < 0 )
time = 0;
return demux_Control( p_demux, DEMUX_SET_TIME, time, precise );

View File

@ -804,7 +804,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
{
vlc_tick_t i_time = va_arg( args, vlc_tick_t );
i_time -= p_sys->tk[p_sys->i_time_track_index].i_first_pts;
return demux_SetPosition( p_demux, (double) i_time / p_sys->i_length, false, true );
return demux_SetPosition( p_demux, (double) i_time / p_sys->i_length, false );
}
break;
}

View File

@ -221,7 +221,7 @@ struct demux_cc
ret = demux_Control( p_demux->s, DEMUX_SET_TIME, time, false );
if( ret != VLC_SUCCESS && pos >= 0 )
demux_SetPosition( p_demux->s, pos, false, true );
demux_SetPosition( p_demux->s, pos, false );
}
}
@ -346,7 +346,7 @@ struct demux_cc
{
double pos = va_arg( args, double );
/* Force imprecise seek */
int ret = demux_SetPosition( p_demux->s, pos, false, true );
int ret = demux_SetPosition( p_demux->s, pos, false );
if( ret != VLC_SUCCESS )
return ret;

View File

@ -1493,16 +1493,6 @@ static size_t ControlGetReducedIndexLocked( input_thread_t *p_input,
{
return sys->i_control - 1;
}
else if ( i_ct == INPUT_CONTROL_JUMP_TIME )
{
c->param.time.i_val += prev_control->param.time.i_val;
return sys->i_control - 1;
}
else if ( i_ct == INPUT_CONTROL_JUMP_POSITION )
{
c->param.pos.f_val += prev_control->param.pos.f_val;
return sys->i_control - 1;
}
else if ( i_ct == INPUT_CONTROL_UPDATE_VIEWPOINT )
{
c->param.viewpoint.yaw += prev_control->param.viewpoint.yaw;
@ -1601,9 +1591,7 @@ static bool ControlIsSeekRequest( int i_type )
switch( i_type )
{
case INPUT_CONTROL_SET_POSITION:
case INPUT_CONTROL_JUMP_POSITION:
case INPUT_CONTROL_SET_TIME:
case INPUT_CONTROL_JUMP_TIME:
case INPUT_CONTROL_SET_TITLE:
case INPUT_CONTROL_SET_TITLE_NEXT:
case INPUT_CONTROL_SET_TITLE_PREV:
@ -1917,9 +1905,7 @@ static bool Control( input_thread_t *p_input,
switch( i_type )
{
case INPUT_CONTROL_SET_POSITION:
case INPUT_CONTROL_JUMP_POSITION:
{
const bool absolute = i_type == INPUT_CONTROL_SET_POSITION;
if( priv->b_recording )
{
msg_Err( p_input, "INPUT_CONTROL_SET_POSITION ignored while recording" );
@ -1929,12 +1915,10 @@ static bool Control( input_thread_t *p_input,
/* Reset the decoders states and clock sync (before calling the demuxer */
es_out_Control( priv->p_es_out, ES_OUT_RESET_PCR );
if( demux_SetPosition( priv->master->p_demux, param.pos.f_val,
!param.pos.b_fast_seek, absolute ) )
!param.pos.b_fast_seek ) )
{
msg_Err( p_input, "INPUT_CONTROL_SET_POSITION "
"%s%2.1f%% failed",
absolute ? "@" : param.pos.f_val >= 0 ? "+" : "",
param.pos.f_val * 100.f );
"%2.1f%% failed", param.pos.f_val * 100.f );
}
else
{
@ -1948,9 +1932,7 @@ static bool Control( input_thread_t *p_input,
}
case INPUT_CONTROL_SET_TIME:
case INPUT_CONTROL_JUMP_TIME:
{
const bool absolute = i_type == INPUT_CONTROL_SET_TIME;
int i_ret;
if( priv->b_recording )
@ -1963,7 +1945,7 @@ static bool Control( input_thread_t *p_input,
es_out_Control( priv->p_es_out, ES_OUT_RESET_PCR );
i_ret = demux_SetTime( priv->master->p_demux, param.time.i_val,
!param.time.b_fast_seek, absolute );
!param.time.b_fast_seek );
if( i_ret )
{
vlc_tick_t i_length = InputSourceGetLength( priv->master, priv->p_item );
@ -1972,16 +1954,13 @@ static bool Control( input_thread_t *p_input,
{
double f_pos = (double)param.time.i_val / (double)i_length;
i_ret = demux_SetPosition( priv->master->p_demux, f_pos,
!param.time.b_fast_seek,
absolute );
!param.time.b_fast_seek );
}
}
if( i_ret )
{
msg_Warn( p_input, "INPUT_CONTROL_SET_TIME %s%"PRId64
" failed or not possible",
absolute ? "@" : param.time.i_val >= 0 ? "+" : "",
param.time.i_val );
msg_Warn( p_input, "INPUT_CONTROL_SET_TIME @%"PRId64
" failed or not possible", param.time.i_val );
}
else
{

View File

@ -557,10 +557,8 @@ enum input_control_e
INPUT_CONTROL_SET_RATE,
INPUT_CONTROL_SET_POSITION,
INPUT_CONTROL_JUMP_POSITION,
INPUT_CONTROL_SET_TIME,
INPUT_CONTROL_JUMP_TIME,
INPUT_CONTROL_SET_PROGRAM,