[vlc-commits] Deinterlace: Add hotkey to cycle through deinterlace modes.
Zoran Turalija
git at videolan.org
Sun Aug 26 18:38:50 CEST 2012
vlc | branch: master | Zoran Turalija <zoran.turalija at gmail.com> | Thu Aug 23 15:03:36 2012 +0200| [61e310a3237ac9bf852613ce0c615c4f610659f6] | committer: Jean-Baptiste Kempf
Deinterlace: Add hotkey to cycle through deinterlace modes.
Allow easier cycling through available deinterlace modes
instead of painfully going through menus.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=61e310a3237ac9bf852613ce0c615c4f610659f6
---
include/vlc_keys.h | 1 +
modules/control/hotkeys.c | 36 ++++++++++++++++++++++++++++++++++++
src/config/keys.c | 1 +
src/libvlc-module.c | 6 ++++++
4 files changed, 44 insertions(+)
diff --git a/include/vlc_keys.h b/include/vlc_keys.h
index a04847c..5451793 100644
--- a/include/vlc_keys.h
+++ b/include/vlc_keys.h
@@ -164,6 +164,7 @@ typedef enum vlc_action {
ACTIONID_ASPECT_RATIO,
ACTIONID_CROP,
ACTIONID_DEINTERLACE,
+ ACTIONID_DEINTERLACE_MODE,
ACTIONID_ZOOM,
ACTIONID_UNZOOM,
ACTIONID_CROP_TOP,
diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 25af282..9d39a8a 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -670,6 +670,42 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
free( psz_mode );
}
}
+ else if( i_action == ACTIONID_DEINTERLACE_MODE && p_vout )
+ {
+ char *psz_mode = var_GetString( p_vout, "deinterlace-mode" );
+ vlc_value_t vlist, tlist;
+ if( psz_mode && !var_Change( p_vout, "deinterlace-mode", VLC_VAR_GETCHOICES, &vlist, &tlist ) >= 0 )
+ {
+ const char *psz_text = NULL;
+ int i;
+ for( i = 0; i < vlist.p_list->i_count; i++ )
+ {
+ if( !strcmp( vlist.p_list->p_values[i].psz_string, psz_mode ) )
+ {
+ i++;
+ break;
+ }
+ }
+ if( i == vlist.p_list->i_count ) i = 0;
+ psz_text = tlist.p_list->p_values[i].psz_string;
+ var_SetString( p_vout, "deinterlace-mode", vlist.p_list->p_values[i].psz_string );
+
+ int i_deinterlace = var_GetInteger( p_vout, "deinterlace" );
+ if( i_deinterlace != 0 )
+ {
+ DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+ "%s (%s)", _("Deinterlace on"), psz_text ? psz_text : psz_mode );
+ }
+ else
+ {
+ DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+ "%s (%s)", _("Deinterlace off"), psz_text ? psz_text : psz_mode );
+ }
+
+ var_FreeList( &vlist, &tlist );
+ }
+ free( psz_mode );
+ }
else if( ( i_action == ACTIONID_ZOOM ||
i_action == ACTIONID_UNZOOM ) && p_vout )
{
diff --git a/src/config/keys.c b/src/config/keys.c
index 2588295..453ee4a 100644
--- a/src/config/keys.c
+++ b/src/config/keys.c
@@ -263,6 +263,7 @@ static const struct action actions[] =
{ "crop-top", ACTIONID_CROP_TOP, },
{ "decr-scalefactor", ACTIONID_SCALE_DOWN, },
{ "deinterlace", ACTIONID_DEINTERLACE, },
+ { "deinterlace-mode", ACTIONID_DEINTERLACE_MODE, },
{ "disc-menu", ACTIONID_DISC_MENU, },
{ "faster", ACTIONID_FASTER, },
{ "frame-next", ACTIONID_FRAME_NEXT, },
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 3746274..2d86f1a 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -1379,6 +1379,8 @@ static const char *const ppsz_albumart_descriptions[] =
#define SCALE_DOWN_KEY_LONGTEXT N_("Decrease scale factor.")
#define DEINTERLACE_KEY_TEXT N_("Toggle deinterlacing")
#define DEINTERLACE_KEY_LONGTEXT N_("Activate or deactivate deinterlacing.")
+#define DEINTERLACE_MODE_KEY_TEXT N_("Cycle deinterlace modes")
+#define DEINTERLACE_MODE_KEY_LONGTEXT N_("Cycle through available deinterlace modes.")
#define INTF_TOGGLE_FSC_KEY_TEXT N_("Show controller in fullscreen")
#define INTF_SHOW_KEY_TEXT N_("Show interface")
#define INTF_SHOW_KEY_LONGTEXT N_("Raise the interface above all other windows.")
@@ -2211,6 +2213,7 @@ vlc_module_begin ()
# define KEY_SCALE_UP "Alt+o"
# define KEY_SCALE_DOWN "Shift+Alt+o"
# define KEY_DEINTERLACE "d"
+# define KEY_DEINTERLACE_MODE "Shift+d"
# define KEY_INTF_TOGGLE_FSC "i"
# define KEY_INTF_BOSS NULL
# define KEY_DISC_MENU "Ctrl+m"
@@ -2329,6 +2332,7 @@ vlc_module_begin ()
# define KEY_SCALE_UP "Alt+o"
# define KEY_SCALE_DOWN "Alt+Shift+o"
# define KEY_DEINTERLACE "d"
+# define KEY_DEINTERLACE_MODE "Shift+d"
# define KEY_INTF_TOGGLE_FSC "i"
# define KEY_INTF_BOSS NULL
# define KEY_DISC_MENU "Shift+m"
@@ -2501,6 +2505,8 @@ vlc_module_begin ()
SCALE_DOWN_KEY_TEXT, SCALE_DOWN_KEY_LONGTEXT, false )
add_key( "key-deinterlace", KEY_DEINTERLACE,
DEINTERLACE_KEY_TEXT, DEINTERLACE_KEY_LONGTEXT, false )
+ add_key( "key-deinterlace-mode", KEY_DEINTERLACE_MODE,
+ DEINTERLACE_MODE_KEY_TEXT, DEINTERLACE_MODE_KEY_LONGTEXT, false )
add_key( "key-intf-show", KEY_INTF_TOGGLE_FSC,
INTF_TOGGLE_FSC_KEY_TEXT, INTF_TOGGLE_FSC_KEY_TEXT, false )
add_obsolete_inner( "key-intf-hide", CONFIG_ITEM_KEY )
More information about the vlc-commits
mailing list