From 11a242273b0b231aae59b8d34a37416238db2779 Mon Sep 17 00:00:00 2001 From: Antoine Cellerier Date: Tue, 29 Nov 2005 16:20:33 +0000 Subject: [PATCH] add aspect ratio, crop and deinterlace hotkeys. fixes #442 --- include/vlc_keys.h | 3 ++ modules/control/hotkeys.c | 78 +++++++++++++++++++++++++++++++++++++++ src/libvlc.h | 26 +++++++++++-- 3 files changed, 103 insertions(+), 4 deletions(-) diff --git a/include/vlc_keys.h b/include/vlc_keys.h index 98b93f7162..74871cbfb1 100644 --- a/include/vlc_keys.h +++ b/include/vlc_keys.h @@ -253,3 +253,6 @@ static inline int StringToKey( char *psz_key ) #define ACTIONID_SNAPSHOT 64 #define ACTIONID_RECORD 65 #define ACTIONID_DISC_MENU 66 +#define ACTIONID_ASPECT_RATIO 67 +#define ACTIONID_CROP 68 +#define ACTIONID_DEINTERLACE 69 diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c index aa5d1209a5..8bcd66c3a7 100644 --- a/modules/control/hotkeys.c +++ b/modules/control/hotkeys.c @@ -523,6 +523,84 @@ static void Run( intf_thread_t *p_intf ) _("Subtitle track: %s"), list2.p_list->p_values[i].psz_string ); } + else if( i_action == ACTIONID_ASPECT_RATIO ) + { + vlc_value_t val={0}, val_list, text_list; + var_Get( p_vout, "aspect-ratio", &val ); + if( var_Change( p_vout, "aspect-ratio", VLC_VAR_GETLIST, + &val_list, &text_list ) >= 0 ) + { + int i; + for( i = 0; i < val_list.p_list->i_count; i++ ) + { + if( !strcmp( val_list.p_list->p_values[i].psz_string, + val.psz_string ) ) + { + i++; + break; + } + } + if( i == val_list.p_list->i_count ) i = 0; + var_SetString( p_vout, "aspect-ratio", + val_list.p_list->p_values[i].psz_string ); + vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN, + _("Aspect ratio: %s"), + text_list.p_list->p_values[i].psz_string ); + } + free( val.psz_string ); + } + else if( i_action == ACTIONID_CROP ) + { + vlc_value_t val={0}, val_list, text_list; + var_Get( p_vout, "crop", &val ); + if( var_Change( p_vout, "crop", VLC_VAR_GETLIST, + &val_list, &text_list ) >= 0 ) + { + int i; + for( i = 0; i < val_list.p_list->i_count; i++ ) + { + if( !strcmp( val_list.p_list->p_values[i].psz_string, + val.psz_string ) ) + { + i++; + break; + } + } + if( i == val_list.p_list->i_count ) i = 0; + var_SetString( p_vout, "crop", + val_list.p_list->p_values[i].psz_string ); + vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN, + _("Crop: %s"), + text_list.p_list->p_values[i].psz_string ); + } + free( val.psz_string ); + } + else if( i_action == ACTIONID_DEINTERLACE ) + { + vlc_value_t val={0}, val_list, text_list; + var_Get( p_vout, "deinterlace", &val ); + if( var_Change( p_vout, "deinterlace", VLC_VAR_GETLIST, + &val_list, &text_list ) >= 0 ) + { + int i; + for( i = 0; i < val_list.p_list->i_count; i++ ) + { + if( !strcmp( val_list.p_list->p_values[i].psz_string, + val.psz_string ) ) + { + i++; + break; + } + } + if( i == val_list.p_list->i_count ) i = 0; + var_SetString( p_vout, "deinterlace", + val_list.p_list->p_values[i].psz_string ); + vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN, + _("Deinterlace mode: %s"), + text_list.p_list->p_values[i].psz_string ); + } + free( val.psz_string ); + } else if( i_action == ACTIONID_NEXT ) { p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, diff --git a/src/libvlc.h b/src/libvlc.h index 559d3cf19d..a6232b0389 100644 --- a/src/libvlc.h +++ b/src/libvlc.h @@ -845,9 +845,6 @@ static char *ppsz_clock_descriptions[] = #define JILONG_TEXT N_("Long jump size") #define JILONG_LONGTEXT N_("Long jump \"size\", in seconds") - - - #define QUIT_KEY_TEXT N_("Quit") #define QUIT_KEY_LONGTEXT N_("Select the hotkey to quit the application.") #define NAV_UP_KEY_TEXT N_("Navigate up") @@ -916,6 +913,12 @@ static char *ppsz_clock_descriptions[] = #define AUDIO_TRACK_KEY_LONGTEXT N_("Cycle through the available audio tracks(languages)") #define SUBTITLE_TRACK_KEY_TEXT N_("Cycle subtitle track") #define SUBTITLE_TRACK_KEY_LONGTEXT N_("Cycle through the available subtitle tracks") +#define ASPECT_RATIO_KEY_TEXT N_("Cycle source aspect ratio") +#define ASPECT_RATIO_KEY_LONGTEXT N_("Cycle through a predefined list of source aspect ratios") +#define CROP_KEY_TEXT N_("Cycle video crop") +#define CROP_KEY_LONGTEXT N_("Cycle through a predefined list of crop formats") +#define DEINTERLACE_KEY_TEXT N_("Cycle deinterlace modes") +#define DEINTERLACE_KEY_LONGTEXT N_("Cycle through all the deinterlace modes") #define INTF_SHOW_KEY_TEXT N_("Show interface") #define INTF_SHOW_KEY_LONGTEXT N_("Raise the interface above all other windows") #define INTF_HIDE_KEY_TEXT N_("Hide interface") @@ -1439,6 +1442,9 @@ vlc_module_begin(); # define KEY_AUDIODELAY_DOWN 'f' # define KEY_AUDIO_TRACK 'l' # define KEY_SUBTITLE_TRACK 's' +# define KEY_ASPECT_RATIO 'a' +# define KEY_CROP 'c' +# define KEY_DEINTERLACE 'd' # define KEY_INTF_SHOW 'i' # define KEY_INTF_HIDE 'I' # define KEY_DISC_MENU KEY_MODIFIER_CTRL|'m' @@ -1507,6 +1513,9 @@ vlc_module_begin(); # define KEY_AUDIO_TRACK 'l' # define KEY_SUBTITLE_TRACK 'k' +# define KEY_ASPECT_RATIO 'a' +# define KEY_CROP 'c' +# define KEY_DEINTERLACE 'd' # define KEY_INTF_SHOW 'i' # define KEY_INTF_HIDE 'I' # define KEY_DISC_MENU KEY_MODIFIER_CTRL|'m' @@ -1618,10 +1627,16 @@ vlc_module_begin(); AUDIO_TRACK_KEY_LONGTEXT, VLC_FALSE ); add_key( "key-subtitle-track", KEY_SUBTITLE_TRACK, NULL, SUBTITLE_TRACK_KEY_TEXT, SUBTITLE_TRACK_KEY_LONGTEXT, VLC_FALSE ); + add_key( "key-aspect-ratio", KEY_ASPECT_RATIO, NULL, + ASPECT_RATIO_KEY_TEXT, ASPECT_RATIO_KEY_LONGTEXT, VLC_FALSE ); + add_key( "key-crop", KEY_CROP, NULL, + CROP_KEY_TEXT, CROP_KEY_LONGTEXT, VLC_FALSE ); + add_key( "key-deinterlace", KEY_DEINTERLACE, NULL, + DEINTERLACE_KEY_TEXT, DEINTERLACE_KEY_LONGTEXT, VLC_FALSE ); add_key( "key-intf-show", KEY_INTF_SHOW, NULL, INTF_SHOW_KEY_TEXT, INTF_SHOW_KEY_LONGTEXT, VLC_TRUE ); add_key( "key-intf-hide", KEY_INTF_HIDE, NULL, - INTF_HIDE_KEY_TEXT, INTF_HIDE_KEY_LONGTEXT, VLC_TRUE ); + INTF_HIDE_KEY_TEXT, INTF_HIDE_KEY_LONGTEXT, VLC_TRUE ); add_key( "key-snapshot", KEY_SNAPSHOT, NULL, SNAP_KEY_TEXT, SNAP_KEY_LONGTEXT, VLC_TRUE ); add_key( "key-history-back", KEY_HISTORY_BACK, NULL, HISTORY_BACK_TEXT, @@ -1754,6 +1769,9 @@ static struct hotkey p_hotkeys[] = { "key-audiodelay-up", ACTIONID_AUDIODELAY_UP, 0, 0, 0, 0 }, { "key-audio-track", ACTIONID_AUDIO_TRACK, 0, 0, 0, 0 }, { "key-subtitle-track", ACTIONID_SUBTITLE_TRACK, 0, 0, 0, 0 }, + { "key-aspect-ratio", ACTIONID_ASPECT_RATIO, 0, 0, 0, 0 }, + { "key-crop", ACTIONID_CROP, 0, 0, 0, 0 }, + { "key-deinterlace", ACTIONID_DEINTERLACE, 0, 0, 0, 0 }, { "key-intf-show", ACTIONID_INTF_SHOW, 0, 0, 0, 0 }, { "key-intf-hide", ACTIONID_INTF_HIDE, 0, 0, 0, 0 }, { "key-snapshot", ACTIONID_SNAPSHOT, 0, 0, 0, 0 }, -- 2.39.2