Commit 970c0c65 authored by Mirsal Ennaime's avatar Mirsal Ennaime Committed by Jean-Baptiste Kempf

dbus: Fix seek detection

Closes: #6802
(cherry picked from commit 1b2ae82c)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent a97f94fa
...@@ -906,20 +906,32 @@ static int InputIntfEventCallback( intf_thread_t *p_intf, ...@@ -906,20 +906,32 @@ static int InputIntfEventCallback( intf_thread_t *p_intf,
case INPUT_EVENT_POSITION: case INPUT_EVENT_POSITION:
/* Detect seeks /* Detect seeks
* XXX: This is way more convoluted than it should be... */ * XXX: This is way more convoluted than it should be... */
i_pos = var_GetTime( p_input, "time" );
if( !p_intf->p_sys->i_last_input_pos_event || if( !p_intf->p_sys->i_last_input_pos_event ||
!( var_GetInteger( p_input, "state" ) == PLAYING_S ) ) !( var_GetInteger( p_input, "state" ) == PLAYING_S ) )
{
p_intf->p_sys->i_last_input_pos_event = i_now;
p_intf->p_sys->i_last_input_pos = i_pos;
break; break;
i_pos = var_GetTime( p_input, "time" ); }
f_current_rate = var_GetFloat( p_input, "rate" ); f_current_rate = var_GetFloat( p_input, "rate" );
i_interval = ( i_now - p_intf->p_sys->i_last_input_pos_event ); i_interval = ( i_now - p_intf->p_sys->i_last_input_pos_event );
i_projected_pos = p_intf->p_sys->i_last_input_pos + ( i_interval * f_current_rate );
i_projected_pos = p_intf->p_sys->i_last_input_pos +
( i_interval * f_current_rate );
p_intf->p_sys->i_last_input_pos_event = i_now; p_intf->p_sys->i_last_input_pos_event = i_now;
p_intf->p_sys->i_last_input_pos = i_pos; p_intf->p_sys->i_last_input_pos = i_pos;
if( ABS( i_pos - i_projected_pos ) < SEEK_THRESHOLD ) if( ABS( i_pos - i_projected_pos ) < SEEK_THRESHOLD )
break; break;
p_info->signal = SIGNAL_SEEK; p_info->signal = SIGNAL_SEEK;
p_info->i_item = input_GetItem( p_input )->i_id; p_info->i_item = input_GetItem( p_input )->i_id;
break; break;
default: default:
return VLC_EGENERIC; return VLC_EGENERIC;
} }
......
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