Commit d2c70247 authored by Yoann Peronneau's avatar Yoann Peronneau

added a hotkey ('t') which displays the position in the media

parent 6d316cc7
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* hotkeys.h: keycode defines * hotkeys.h: keycode defines
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: vlc_keys.h,v 1.9 2003/11/16 22:10:16 sam Exp $ * $Id: vlc_keys.h,v 1.10 2003/12/10 17:19:05 yoann Exp $
* *
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
* *
...@@ -198,3 +198,4 @@ static inline int StringToKey( char *psz_key ) ...@@ -198,3 +198,4 @@ static inline int StringToKey( char *psz_key )
#define ACTIONID_JUMP_FORWARD_1MIN 21 #define ACTIONID_JUMP_FORWARD_1MIN 21
#define ACTIONID_JUMP_BACKWARD_5MIN 22 #define ACTIONID_JUMP_BACKWARD_5MIN 22
#define ACTIONID_JUMP_FORWARD_5MIN 23 #define ACTIONID_JUMP_FORWARD_5MIN 23
#define ACTIONID_POSITION 24
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* hotkeys.c: Hotkey handling for vlc * hotkeys.c: Hotkey handling for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: hotkeys.c,v 1.9 2003/12/08 13:04:58 gbazin Exp $ * $Id: hotkeys.c,v 1.10 2003/12/10 17:19:05 yoann Exp $
* *
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
* *
...@@ -351,6 +351,42 @@ static void Run( intf_thread_t *p_intf ) ...@@ -351,6 +351,42 @@ static void Run( intf_thread_t *p_intf )
vlc_value_t val; val.b_bool = VLC_TRUE; vlc_value_t val; val.b_bool = VLC_TRUE;
var_Set( p_input, "rate-slower", val ); var_Set( p_input, "rate-slower", val );
} }
else if( i_action == ACTIONID_POSITION )
{
p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
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 );
if( p_playlist )
{
mtime_t dur =
p_playlist->pp_items[p_playlist->i_index]->i_duration;
i_seconds = time.i_time / 1000000;
secstotimestr ( psz_time, i_seconds );
if( dur != -1 )
{
char psz_position[2*MSTRTIME_MAX_SIZE + 3];
secstotimestr( psz_duration, dur/1000000 );
strcpy( psz_position, psz_time );
strcat( psz_position, " / " );
strcat( psz_position, psz_duration );
vout_OSDMessage( VLC_OBJECT(p_playlist), psz_position );
}
else if( i_seconds > 0 )
{
vout_OSDMessage( VLC_OBJECT(p_playlist), psz_time );
}
}
vlc_object_release( p_playlist );
}
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libvlc.h: main libvlc header * libvlc.h: main libvlc header
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.h,v 1.115 2003/12/09 00:46:03 yoann Exp $ * $Id: libvlc.h,v 1.116 2003/12/10 17:19:05 yoann Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -545,6 +545,8 @@ static char *ppsz_language_text[] = ...@@ -545,6 +545,8 @@ static char *ppsz_language_text[] =
#define PREV_KEY_LONGTEXT N_("Select the hotkey to use to skip to the previous item in the playlist") #define PREV_KEY_LONGTEXT N_("Select the hotkey to use to skip to the previous item in the playlist")
#define STOP_KEY_TEXT N_("Stop") #define STOP_KEY_TEXT N_("Stop")
#define STOP_KEY_LONGTEXT N_("Select the hotkey to stop the playback") #define STOP_KEY_LONGTEXT N_("Select the hotkey to stop the playback")
#define POSITION_KEY_TEXT N_("Position")
#define POSITION_KEY_LONGTEXT N_("Select the hotkey to display the position")
#define JB10SEC_KEY_TEXT N_("Jump backward 10 seconds") #define JB10SEC_KEY_TEXT N_("Jump backward 10 seconds")
#define JB10SEC_KEY_LONGTEXT N_("Select the hotkey to jump backward by 10 seconds") #define JB10SEC_KEY_LONGTEXT N_("Select the hotkey to jump backward by 10 seconds")
...@@ -800,6 +802,7 @@ vlc_module_begin(); ...@@ -800,6 +802,7 @@ vlc_module_begin();
add_key( "key-next", KEY_MODIFIER_COMMAND|KEY_RIGHT, NULL, NEXT_KEY_TEXT, NEXT_KEY_LONGTEXT, VLC_FALSE ); add_key( "key-next", KEY_MODIFIER_COMMAND|KEY_RIGHT, NULL, NEXT_KEY_TEXT, NEXT_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-prev", KEY_MODIFIER_COMMAND|KEY_LEFT, NULL, PREV_KEY_TEXT, PREV_KEY_LONGTEXT, VLC_FALSE ); add_key( "key-prev", KEY_MODIFIER_COMMAND|KEY_LEFT, NULL, PREV_KEY_TEXT, PREV_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-stop", KEY_MODIFIER_COMMAND|'.', NULL, STOP_KEY_TEXT, STOP_KEY_LONGTEXT, VLC_FALSE ); add_key( "key-stop", KEY_MODIFIER_COMMAND|'.', NULL, STOP_KEY_TEXT, STOP_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-position", KEY_MODIFIER_COMMAND|'t', NULL, POSITION_KEY_TEXT, POSITION_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-jump-10sec", KEY_MODIFIER_COMMAND|KEY_MODIFIER_ALT|KEY_LEFT, NULL, JB10SEC_KEY_TEXT, JB10SEC_KEY_LONGTEXT, VLC_FALSE ); add_key( "key-jump-10sec", KEY_MODIFIER_COMMAND|KEY_MODIFIER_ALT|KEY_LEFT, NULL, JB10SEC_KEY_TEXT, JB10SEC_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-jump+10sec", KEY_MODIFIER_COMMAND|KEY_MODIFIER_ALT|KEY_RIGHT, NULL, JF10SEC_KEY_TEXT, JF10SEC_KEY_LONGTEXT, VLC_FALSE ); add_key( "key-jump+10sec", KEY_MODIFIER_COMMAND|KEY_MODIFIER_ALT|KEY_RIGHT, NULL, JF10SEC_KEY_TEXT, JF10SEC_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-jump-1min", KEY_MODIFIER_COMMAND|KEY_MODIFIER_SHIFT|KEY_LEFT, NULL, JB1MIN_KEY_TEXT, JB1MIN_KEY_LONGTEXT, VLC_FALSE ); add_key( "key-jump-1min", KEY_MODIFIER_COMMAND|KEY_MODIFIER_SHIFT|KEY_LEFT, NULL, JB1MIN_KEY_TEXT, JB1MIN_KEY_LONGTEXT, VLC_FALSE );
...@@ -824,6 +827,7 @@ vlc_module_begin(); ...@@ -824,6 +827,7 @@ vlc_module_begin();
add_key( "key-next", 'n', NULL, NEXT_KEY_TEXT, NEXT_KEY_LONGTEXT, VLC_FALSE ); add_key( "key-next", 'n', NULL, NEXT_KEY_TEXT, NEXT_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-prev", 'p', NULL, PREV_KEY_TEXT, PREV_KEY_LONGTEXT, VLC_FALSE ); add_key( "key-prev", 'p', NULL, PREV_KEY_TEXT, PREV_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-stop", 's', NULL, STOP_KEY_TEXT, STOP_KEY_LONGTEXT, VLC_FALSE ); add_key( "key-stop", 's', NULL, STOP_KEY_TEXT, STOP_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-position", 't', NULL, POSITION_KEY_TEXT, POSITION_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-jump-10sec", KEY_MODIFIER_ALT|KEY_LEFT, NULL, JB10SEC_KEY_TEXT, JB10SEC_KEY_LONGTEXT, VLC_FALSE ); add_key( "key-jump-10sec", KEY_MODIFIER_ALT|KEY_LEFT, NULL, JB10SEC_KEY_TEXT, JB10SEC_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-jump+10sec", KEY_MODIFIER_ALT|KEY_RIGHT, NULL, JF10SEC_KEY_TEXT, JF10SEC_KEY_LONGTEXT, VLC_FALSE ); add_key( "key-jump+10sec", KEY_MODIFIER_ALT|KEY_RIGHT, NULL, JF10SEC_KEY_TEXT, JF10SEC_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-jump-1min", KEY_MODIFIER_CTRL|KEY_LEFT, NULL, JB1MIN_KEY_TEXT, JB1MIN_KEY_LONGTEXT, VLC_FALSE ); add_key( "key-jump-1min", KEY_MODIFIER_CTRL|KEY_LEFT, NULL, JB1MIN_KEY_TEXT, JB1MIN_KEY_LONGTEXT, VLC_FALSE );
...@@ -882,6 +886,7 @@ static struct hotkey p_hotkeys[] = ...@@ -882,6 +886,7 @@ static struct hotkey p_hotkeys[] =
{ "key-play", ACTIONID_PLAY, 0 }, { "key-play", ACTIONID_PLAY, 0 },
{ "key-pause", ACTIONID_PAUSE, 0 }, { "key-pause", ACTIONID_PAUSE, 0 },
{ "key-stop", ACTIONID_STOP, 0 }, { "key-stop", ACTIONID_STOP, 0 },
{ "key-position", ACTIONID_POSITION, 0 },
{ "key-jump-10sec", ACTIONID_JUMP_BACKWARD_10SEC, 0 }, { "key-jump-10sec", ACTIONID_JUMP_BACKWARD_10SEC, 0 },
{ "key-jump+10sec", ACTIONID_JUMP_FORWARD_10SEC, 0 }, { "key-jump+10sec", ACTIONID_JUMP_FORWARD_10SEC, 0 },
{ "key-jump-1min", ACTIONID_JUMP_BACKWARD_1MIN, 0 }, { "key-jump-1min", ACTIONID_JUMP_BACKWARD_1MIN, 0 },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment