[vlc-devel] [PATCH] hotkeys: Delay subtitle track only if it exists and is enabled.

Zoran Turalija zoran.turalija at gmail.com
Wed Apr 10 15:36:19 CEST 2013


In ACTIONID_SUBDELAY_UP/DOWN, do not delay subtitle if there is none,
or if subtitle has been currently disabled.
---
 modules/control/hotkeys.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 95bc0d0..bec3554 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -374,6 +374,26 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
             int diff = (i_action == ACTIONID_SUBDELAY_UP) ? 50000 : -50000;
             if( p_input )
             {
+                vlc_value_t val, list, list2;
+                int i_count;
+                var_Get( p_input, "spu-es", &val );
+
+                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,
+                                        _("No delay set; subtitle track: %s"),
+                                        _("N/A") );
+                    else
+                        DisplayMessage( p_vout,
+                                        _("No delay set; subtitle track: %s"),
+                                        _("Disabled") );
+                    var_FreeList( &list, &list2 );
+                    break;
+                }
                 int64_t i_delay = var_GetTime( p_input, "spu-delay" ) + diff;
 
                 var_SetTime( p_input, "spu-delay", i_delay );
-- 
1.7.10.4


-- 
Kind regards,
Zoran Turalija



More information about the vlc-devel mailing list