]> git.sesse.net Git - vlc/commitdiff
* modules/control/hotkeys.c : Display simultaneously time position and slider when...
authorYoann Peronneau <yoann@videolan.org>
Wed, 2 Jun 2004 23:19:54 +0000 (23:19 +0000)
committerYoann Peronneau <yoann@videolan.org>
Wed, 2 Jun 2004 23:19:54 +0000 (23:19 +0000)
modules/control/hotkeys.c

index a7bdc6c7a54289fcb0ea019caf4a5e61001228c5..5495515dafe4c292b523492f5be5056d4295fd25 100755 (executable)
@@ -66,6 +66,7 @@ static int  ActionKeyCB( vlc_object_t *, char const *,
 static void PlayBookmark( intf_thread_t *, int );
 static void SetBookmark ( intf_thread_t *, int );
 static int  GetPosition ( intf_thread_t * );
+static void DisplayPosition( input_thread_t * );
 
 /*****************************************************************************
  * Module descriptor
@@ -377,15 +378,19 @@ static void Run( intf_thread_t *p_intf )
             {
                 val.i_time = -10000000;
                 var_Set( p_input, "time-offset", val );
-                if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
-                {
-                    vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
-                                    GetPosition( p_intf ), OSD_HOR_SLIDER );
-                }
-                else
+                if( p_vout )
                 {
-                    vout_OSDMessage( p_intf, SOLO_CHAN,
-                                     _( "Jump -10 seconds" ) );
+                    if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
+                    {
+                        DisplayPosition( p_input );
+                        vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
+                                        GetPosition( p_intf ), OSD_HOR_SLIDER );
+                    }
+                    else
+                    {
+                        vout_OSDMessage( p_intf, SOLO_CHAN,
+                                         _( "Jump -10 seconds" ) );
+                    }
                 }
             }
             else if( i_action == ACTIONID_JUMP_FORWARD_10SEC && b_seekable )
@@ -396,6 +401,7 @@ static void Run( intf_thread_t *p_intf )
                 {
                     if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
                     {
+                        DisplayPosition( p_input );
                         vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
                                         GetPosition( p_intf ), OSD_HOR_SLIDER );
                     }
@@ -414,6 +420,7 @@ static void Run( intf_thread_t *p_intf )
                 {
                     if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
                     {
+                        DisplayPosition( p_input );
                         vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
                                         GetPosition( p_intf ), OSD_HOR_SLIDER );
                     }
@@ -432,6 +439,7 @@ static void Run( intf_thread_t *p_intf )
                 {
                     if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
                     {
+                        DisplayPosition( p_input );
                         vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
                                         GetPosition( p_intf ), OSD_HOR_SLIDER );
                     }
@@ -450,6 +458,7 @@ static void Run( intf_thread_t *p_intf )
                 {
                     if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
                     {
+                        DisplayPosition( p_input );
                         vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
                                         GetPosition( p_intf ), OSD_HOR_SLIDER );
                     }
@@ -468,6 +477,7 @@ static void Run( intf_thread_t *p_intf )
                 {
                     if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
                     {
+                        DisplayPosition( p_input );
                         vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
                                         GetPosition( p_intf ), OSD_HOR_SLIDER );
                     }
@@ -520,26 +530,7 @@ static void Run( intf_thread_t *p_intf )
             }
             else if( i_action == ACTIONID_POSITION )
             {
-                char psz_duration[MSTRTIME_MAX_SIZE];
-                char psz_time[MSTRTIME_MAX_SIZE];
-                vlc_value_t time;
-                mtime_t i_seconds;
-
-                var_Get( p_input, "time", &time );
-                i_seconds = time.i_time / 1000000;
-                secstotimestr ( psz_time, i_seconds );
-
-                var_Get( p_input, "length", &time );
-                if( time.i_time > 0 )
-                {
-                    secstotimestr( psz_duration, time.i_time / 1000000 );
-                    vout_OSDMessage( p_input, POSITION_CHAN, "%s / %s",
-                                     psz_time, psz_duration );
-                }
-                else if( i_seconds > 0 )
-                {
-                    vout_OSDMessage( p_input, POSITION_CHAN, psz_time );
-                }
+                DisplayPosition( p_input );
             }
             else if( i_action >= ACTIONID_PLAY_BOOKMARK1 &&
                      i_action <= ACTIONID_PLAY_BOOKMARK10 )
@@ -680,3 +671,27 @@ static int GetPosition( intf_thread_t *p_intf )
     }
     return -1;
 }
+
+static void DisplayPosition( input_thread_t *p_input )
+{
+    char psz_duration[MSTRTIME_MAX_SIZE];
+    char psz_time[MSTRTIME_MAX_SIZE];
+    vlc_value_t time;
+    mtime_t i_seconds;
+
+    var_Get( p_input, "time", &time );
+    i_seconds = time.i_time / 1000000;
+    secstotimestr ( psz_time, i_seconds );
+
+    var_Get( p_input, "length", &time );
+    if( time.i_time > 0 )
+    {
+        secstotimestr( psz_duration, time.i_time / 1000000 );
+        vout_OSDMessage( p_input, POSITION_CHAN, "%s / %s",
+                         psz_time, psz_duration );
+    }
+    else if( i_seconds > 0 )
+    {
+        vout_OSDMessage( p_input, POSITION_CHAN, psz_time );
+    }
+}