]> git.sesse.net Git - vlc/blobdiff - modules/control/hotkeys.c
* : make jump hotkeys time interval user configurable
[vlc] / modules / control / hotkeys.c
index 08fd30b2d9eb1400e04f4bb7e8027c787c0b2f19..44204027eab57240d3343825e34a58cb1918d0f6 100644 (file)
@@ -94,8 +94,31 @@ static void ClearChannels  ( intf_thread_t *, vout_thread_t * );
 #define BOOKMARK_LONGTEXT N_( \
     "This option allows you to define playlist bookmarks.")
 
+#define JIEXTRASHORT_TEXT N_("Extra short jump key interval")
+#define JIEXTRASHORT_LONGTEXT N_("Extra short jump key interval in seconds")
+#define JISHORT_TEXT N_("Short jump key interval")
+#define JISHORT_LONGTEXT N_("Short jump key interval in seconds")
+#define JIMEDIUM_TEXT N_("Medium jump key interval")
+#define JIMEDIUM_LONGTEXT N_("Medium jump key interval in seconds")
+#define JILONG_TEXT N_("Long jump key interval")
+#define JILONG_LONGTEXT N_("Long jump key interval in seconds")
+
 vlc_module_begin();
+    set_shortname( _("Hotkeys") );
     set_description( _("Hotkeys management interface") );
+    set_category( CAT_INTERFACE );
+//    set_subcategory( SUBCAT_INTERFACE_GENERAL );
+
+    /* jump key user defined time intervals */
+    add_integer( "key-jump-extrashort-interval", 3, NULL, JIEXTRASHORT_TEXT,
+                JIEXTRASHORT_LONGTEXT, VLC_FALSE );
+    add_integer( "key-jump-short-interval", 10, NULL, JISHORT_TEXT,
+                JISHORT_LONGTEXT, VLC_FALSE );
+    add_integer( "key-jump-medium-interval", 60, NULL, JIMEDIUM_TEXT,
+                JIMEDIUM_LONGTEXT, VLC_FALSE );
+    add_integer( "key-jump-long-interval", 300, NULL, JILONG_TEXT,
+                JILONG_LONGTEXT, VLC_FALSE );
+
     add_string( "bookmark1", NULL, NULL,
                 BOOKMARK1_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
     add_string( "bookmark2", NULL, NULL,
@@ -382,6 +405,7 @@ static void Run( intf_thread_t *p_intf )
              * That's not that easy with some special stream
              */
             vlc_bool_t b_seekable = VLC_TRUE;
+            int i_interval =0;
 
             if( i_action == ACTIONID_PAUSE )
             {
@@ -391,53 +415,46 @@ static void Run( intf_thread_t *p_intf )
                 val.i_int = PAUSE_S;
                 var_Set( p_input, "state", val );
             }
-            else if( i_action == ACTIONID_JUMP_BACKWARD_3SEC && b_seekable )
+            else if( i_action == ACTIONID_JUMP_BACKWARD_EXTRASHORT && b_seekable )
             {
-                val.i_time = (-3000000L * ((mtime_t)(1 << i_times)));
-                var_Set( p_input, "time-offset", val );
-                DisplayPosition( p_intf, p_vout, p_input );
+#define SET_TIME( a, b ) \
+    i_interval = config_GetInt( p_input, "key-jump-" a "-interval" ); \
+    if( i_interval > 0 ) { \
+        val.i_time = ( (mtime_t)(i_interval * b) * 1000000L \
+                       * ((mtime_t)(1 << i_times))); \
+        var_Set( p_input, "time-offset", val ); \
+        DisplayPosition( p_intf, p_vout, p_input ); \
+    }
+                SET_TIME( "extrashort", -1 );
             }
-            else if( i_action == ACTIONID_JUMP_FORWARD_3SEC && b_seekable )
+            else if( i_action == ACTIONID_JUMP_FORWARD_EXTRASHORT && b_seekable )
             {
-                val.i_time = (3000000L * ((mtime_t)(1 << i_times)));
-                var_Set( p_input, "time-offset", val );
-                DisplayPosition( p_intf, p_vout, p_input );
+                SET_TIME( "extrashort", 1 );
             }
-            else if( i_action == ACTIONID_JUMP_BACKWARD_10SEC && b_seekable )
+            else if( i_action == ACTIONID_JUMP_BACKWARD_SHORT && b_seekable )
             {
-                val.i_time = (-10000000L * ((mtime_t)(1 << i_times)));
-                var_Set( p_input, "time-offset", val );
-                DisplayPosition( p_intf, p_vout, p_input );
+                SET_TIME( "short", -1 );
             }
-            else if( i_action == ACTIONID_JUMP_FORWARD_10SEC && b_seekable )
+            else if( i_action == ACTIONID_JUMP_FORWARD_SHORT && b_seekable )
             {
-                val.i_time = (10000000L * ((mtime_t)(1 << i_times)));
-                var_Set( p_input, "time-offset", val );
-                DisplayPosition( p_intf, p_vout, p_input );
+                SET_TIME( "short", 1 );
             }
-            else if( i_action == ACTIONID_JUMP_BACKWARD_1MIN && b_seekable )
+            else if( i_action == ACTIONID_JUMP_BACKWARD_MEDIUM && b_seekable )
             {
-                val.i_time = (-60000000L * ((mtime_t)(1 << i_times)));
-                var_Set( p_input, "time-offset", val );
-                DisplayPosition( p_intf, p_vout, p_input );
+                SET_TIME( "medium", -1 );
             }
-            else if( i_action == ACTIONID_JUMP_FORWARD_1MIN && b_seekable )
+            else if( i_action == ACTIONID_JUMP_FORWARD_MEDIUM && b_seekable )
             {
-                val.i_time = (60000000L * ((mtime_t)(1 << i_times)));
-                var_Set( p_input, "time-offset", val );
-                DisplayPosition( p_intf, p_vout, p_input );
+                SET_TIME( "medium", 1 );
             }
-            else if( i_action == ACTIONID_JUMP_BACKWARD_5MIN && b_seekable )
+            else if( i_action == ACTIONID_JUMP_BACKWARD_LONG && b_seekable )
             {
-                val.i_time = (-300000000L * ((mtime_t)(1 << i_times)));
-                var_Set( p_input, "time-offset", val );
-                DisplayPosition( p_intf, p_vout, p_input );
+                SET_TIME( "long", -1 );
             }
-            else if( i_action == ACTIONID_JUMP_FORWARD_5MIN && b_seekable )
+            else if( i_action == ACTIONID_JUMP_FORWARD_LONG && b_seekable )
             {
-                val.i_time = (300000000L * ((mtime_t)(1 << i_times)));
-                var_Set( p_input, "time-offset", val );
-                DisplayPosition( p_intf, p_vout, p_input );
+                SET_TIME( "long", 1 );
+#undef SET_TIME
             }
             else if( i_action == ACTIONID_AUDIO_TRACK )
             {