[vlc-commits] dbus: Fix seek detection
Mirsal Ennaime
git at videolan.org
Sun Aug 26 19:06:40 CEST 2012
vlc/vlc-2.0 | branch: master | Mirsal Ennaime <mirsal at videolan.org> | Thu May 17 02:30:07 2012 +0200| [970c0c6562161609a8571e39cbe7d15e69f96455] | committer: Jean-Baptiste Kempf
dbus: Fix seek detection
Closes: #6802
(cherry picked from commit 1b2ae82caddba30d5ea32317997d4464957e582c)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=970c0c6562161609a8571e39cbe7d15e69f96455
---
modules/control/dbus/dbus.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/modules/control/dbus/dbus.c b/modules/control/dbus/dbus.c
index 4751c03..462567d 100644
--- a/modules/control/dbus/dbus.c
+++ b/modules/control/dbus/dbus.c
@@ -906,20 +906,32 @@ static int InputIntfEventCallback( intf_thread_t *p_intf,
case INPUT_EVENT_POSITION:
/* Detect seeks
* 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 ||
!( 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;
- i_pos = var_GetTime( p_input, "time" );
+ }
+
f_current_rate = var_GetFloat( p_input, "rate" );
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 = i_pos;
+
if( ABS( i_pos - i_projected_pos ) < SEEK_THRESHOLD )
break;
+
p_info->signal = SIGNAL_SEEK;
p_info->i_item = input_GetItem( p_input )->i_id;
break;
+
default:
return VLC_EGENERIC;
}
More information about the vlc-commits
mailing list