[vlc-commits] dbus: Fix seek detection

Mirsal Ennaime git at videolan.org
Thu May 17 02:50:19 CEST 2012


vlc | branch: master | Mirsal Ennaime <mirsal at videolan.org> | Thu May 17 02:30:07 2012 +0200| [1b2ae82caddba30d5ea32317997d4464957e582c] | committer: Mirsal Ennaime

dbus: Fix seek detection

Closes: #6802

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1b2ae82caddba30d5ea32317997d4464957e582c
---

 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 b3035c3..8841f78 100644
--- a/modules/control/dbus/dbus.c
+++ b/modules/control/dbus/dbus.c
@@ -912,20 +912,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