]> git.sesse.net Git - vlc/blobdiff - modules/control/hotkeys.c
* change hotkeys OSD message from 0-100% to 0-400%
[vlc] / modules / control / hotkeys.c
old mode 100755 (executable)
new mode 100644 (file)
index 6145792..21d7b4f
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * hotkeys.c: Hotkey handling for vlc
  *****************************************************************************
- * Copyright (C) 2004 VideoLAN
+ * Copyright (C) 2005 the VideoLAN team
  * $Id$
  *
  * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
@@ -236,7 +236,7 @@ static void Run( intf_thread_t *p_intf )
         /* Find action triggered by hotkey */
         i_action = 0;
         i_key = GetKey( p_intf );
-        for( i = 0; p_hotkeys[i].psz_action != NULL; i++ )
+        for( i = 0; i_key != -1 && p_hotkeys[i].psz_action != NULL; i++ )
         {
             if( p_hotkeys[i].i_key == i_key )
             {
@@ -253,6 +253,14 @@ static void Run( intf_thread_t *p_intf )
 
         if( i_action == ACTIONID_QUIT )
         {
+            p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                                    FIND_ANYWHERE );
+            if( p_playlist )
+            {
+                playlist_Stop( p_playlist );
+                vlc_object_release( p_playlist );
+            }
+            /* Playlist is stopped now kill vlc. */
             p_intf->p_vlc->b_die = VLC_TRUE;
             ClearChannels( p_intf, p_vout );
             vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Quit" ) );
@@ -288,12 +296,26 @@ static void Run( intf_thread_t *p_intf )
                 }
             }
         }
-
+        else if( i_action == ACTIONID_INTF_SHOW )
+        {
+            val.b_bool = VLC_TRUE;
+            p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                                          FIND_ANYWHERE );
+            if( p_playlist )
+            {
+                var_Set( p_playlist, "intf-show", val );
+                vlc_object_release( p_playlist );
+            }
+        }
+        else if( i_action == ACTIONID_SNAPSHOT )
+        {
+            if( p_vout ) vout_Control( p_vout, VOUT_SNAPSHOT );
+        }
         else if( i_action == ACTIONID_SUBDELAY_DOWN )
         {
             int64_t i_delay = var_GetTime( p_input, "spu-delay" );
 
-            i_delay -= 10000;    /* 10 ms */
+            i_delay -= 50000;    /* 50 ms */
 
             var_SetTime( p_input, "spu-delay", i_delay );
             ClearChannels( p_intf, p_vout );
@@ -304,17 +326,53 @@ static void Run( intf_thread_t *p_intf )
         {
             int64_t i_delay = var_GetTime( p_input, "spu-delay" );
 
-            i_delay += 10000;    /* 10 ms */
+            i_delay += 50000;    /* 50 ms */
 
             var_SetTime( p_input, "spu-delay", i_delay );
             ClearChannels( p_intf, p_vout );
             vout_OSDMessage( p_intf, DEFAULT_CHAN, "Subtitle delay %i ms",
                                  (int)(i_delay/1000) );
         }
-        else if( i_action == ACTIONID_FULLSCREEN && p_vout )
+        else if( i_action == ACTIONID_AUDIODELAY_DOWN )
         {
-            var_Get( p_vout, "fullscreen", &val );
-            var_Set( p_vout, "fullscreen", (vlc_value_t)!val.b_bool );
+            int64_t i_delay = var_GetTime( p_input, "audio-delay" );
+
+            i_delay -= 50000;    /* 50 ms */
+
+            var_SetTime( p_input, "audio-delay", i_delay );
+            ClearChannels( p_intf, p_vout );
+            vout_OSDMessage( p_intf, DEFAULT_CHAN, "Audio delay %i ms",
+                                 (int)(i_delay/1000) );
+        }
+        else if( i_action == ACTIONID_AUDIODELAY_UP )
+        {
+            int64_t i_delay = var_GetTime( p_input, "audio-delay" );
+
+            i_delay += 50000;    /* 50 ms */
+
+            var_SetTime( p_input, "audio-delay", i_delay );
+            ClearChannels( p_intf, p_vout );
+            vout_OSDMessage( p_intf, DEFAULT_CHAN, "Audio delay %i ms",
+                                 (int)(i_delay/1000) );
+        }
+        else if( i_action == ACTIONID_FULLSCREEN )
+        {
+            if( p_vout )
+            {
+                var_Get( p_vout, "fullscreen", &val ); val.b_bool = !val.b_bool;
+                var_Set( p_vout, "fullscreen", val );
+            }
+            else
+            {
+                p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                                          FIND_ANYWHERE );
+                if( p_playlist )
+                {
+                    var_Get( p_playlist, "fullscreen", &val ); val.b_bool = !val.b_bool;
+                    var_Set( p_playlist, "fullscreen", val );
+                    vlc_object_release( p_playlist );
+                }
+            }
         }
         else if( i_action == ACTIONID_PLAY )
         {
@@ -652,7 +710,6 @@ static void PlayBookmark( intf_thread_t *p_intf, int i_num )
 
 static void SetBookmark( intf_thread_t *p_intf, int i_num )
 {
-    vlc_value_t val;
     playlist_t *p_playlist =
         vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
     if( p_playlist )
@@ -661,10 +718,14 @@ static void SetBookmark( intf_thread_t *p_intf, int i_num )
         sprintf( psz_bookmark_name, "bookmark%i", i_num );
         var_Create( p_intf, psz_bookmark_name,
                     VLC_VAR_STRING|VLC_VAR_DOINHERIT );
-        val.psz_string = strdup( p_playlist->pp_items[p_playlist->i_index]->input.psz_uri );
-        var_Set( p_intf, psz_bookmark_name, val );
-        msg_Info( p_intf, "setting playlist bookmark %i to %s", i_num,
-                  val.psz_string );
+        if( p_playlist->status.p_item )
+        {
+            config_PutPsz( p_intf, psz_bookmark_name, 
+                           p_playlist->status.p_item->input.psz_uri);
+            msg_Info( p_intf, "setting playlist bookmark %i to %s", i_num,
+                           p_playlist->status.p_item->input.psz_uri);
+            config_SaveConfigFile( p_intf, "hotkeys" );
+        }
         vlc_object_release( p_playlist );
     }
 }
@@ -723,8 +784,8 @@ static void DisplayVolume( intf_thread_t *p_intf, vout_thread_t *p_vout,
     }
     else
     {
-        vout_OSDMessage( p_vout, VOLUME_TEXT_CHAN, "Vol %d%%",
-                         2*i_vol*100/AOUT_VOLUME_MAX );
+        vout_OSDMessage( p_vout, VOLUME_TEXT_CHAN, "Volume %d%%",
+                         i_vol*400/AOUT_VOLUME_MAX );
     }
 }