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

Zoran Turalija git at videolan.org
Mon Apr 15 11:30:05 CEST 2013


vlc | branch: master | Zoran Turalija <zoran.turalija at gmail.com> | Sun Apr 14 12:48:15 2013 +0200| [b430b4c24866f45d9989b8e64716078c1c44be61] | committer: Jean-Baptiste Kempf

hotkeys: Delay subtitle track only if it exists and is enabled.

In ACTIONID_SUBDELAY_UP/DOWN, do not delay subtitle if there is none,
or if subtitle has been currently disabled.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b430b4c24866f45d9989b8e64716078c1c44be61
---

 modules/control/hotkeys.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 7fcde53..01d6f6b 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -444,12 +444,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 )
+                {
+                    DisplayMessage( p_vout, _("Subtitle delay: No active subtitle") );
+                    var_FreeList( &list, &list2 );
+                    break;
+                }
                 int64_t i_delay = var_GetTime( p_input, "spu-delay" ) + diff;
 
                 var_SetTime( p_input, "spu-delay", i_delay );
                 ClearChannels( p_intf, p_vout );
                 DisplayMessage( p_vout, _( "Subtitle delay %i ms" ),
                                 (int)(i_delay/1000) );
+                var_FreeList( &list, &list2 );
             }
             break;
         }



More information about the vlc-commits mailing list