[vlc-devel] [PATCH] hotkeys: Change subtitle position only if it exists and is enabled.
Zoran Turalija
zoran.turalija at gmail.com
Wed Apr 10 16:32:01 CEST 2013
In ACTIONID_SUBPOS_UP/DOWN, do not change subtitle position if there
is no subtitle, or if subtitle has been currently disabled.
---
modules/control/hotkeys.c | 38 +++++++++++++++++++++++++++++++-------
1 file changed, 31 insertions(+), 7 deletions(-)
diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 171c828..51262e5 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -906,14 +906,38 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
case ACTIONID_SUBPOS_DOWN:
case ACTIONID_SUBPOS_UP:
{
- int i_pos;
- if( i_action == ACTIONID_SUBPOS_DOWN )
- i_pos = var_DecInteger( p_vout, "sub-margin" );
- else
- i_pos = var_IncInteger( p_vout, "sub-margin" );
+ if( p_input )
+ {
+ vlc_value_t val, list, list2;
+ int i_count;
+ var_Get( p_input, "spu-es", &val );
- ClearChannels( p_intf, p_vout );
- DisplayMessage( p_vout, _( "Subtitle position %d px" ), i_pos );
+ var_Change( p_input, "spu-es", VLC_VAR_GETCHOICES,
+ &list, &list2 );
+ i_count = list.p_list->i_count;
+ if( i_count < 1 || val.i_int < 0 )
+ {
+ if( i_count == 0 )
+ DisplayMessage( p_vout,
+ _("Position not changed; subtitle track: %s"),
+ _("N/A") );
+ else
+ DisplayMessage( p_vout,
+ _("Position not changed; subtitle track: %s"),
+ _("Disabled") );
+ var_FreeList( &list, &list2 );
+ break;
+ }
+
+ int i_pos;
+ if( i_action == ACTIONID_SUBPOS_DOWN )
+ i_pos = var_DecInteger( p_vout, "sub-margin" );
+ else
+ i_pos = var_IncInteger( p_vout, "sub-margin" );
+
+ ClearChannels( p_intf, p_vout );
+ DisplayMessage( p_vout, _( "Subtitle position %d px" ), i_pos );
+ }
break;
}
--
1.7.10.4
--
Kind regards,
Zoran Turalija
More information about the vlc-devel
mailing list