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

Zoran Turalija git at videolan.org
Sun Apr 21 17:05:45 CEST 2013


vlc | branch: master | Zoran Turalija <zoran.turalija at gmail.com> | Tue Apr 16 13:16:35 2013 +0200| [e021989e800138c05c1e952a7e5b092d67dd14ed] | committer: Jean-Baptiste Kempf

hotkeys: Bookmark subtitle timestamp only if it exists and is enabled.

In ACTIONID_SUBSYNC_MARKSUB, do not bookmark subtitle timestamp if
there is no subtitle, 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=e021989e800138c05c1e952a7e5b092d67dd14ed
---

 modules/control/hotkeys.c |   24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 7069d3d..c15e309 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -389,11 +389,27 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
             break;
         }
         case ACTIONID_SUBSYNC_MARKSUB:
-        {
-            p_sys->subtitle_delaybookmarks.i_time_subtitle = mdate();
-            DisplayMessage( p_vout, _("Sub sync: bookmarked subtitle timestamp"));
+            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, _("Sub sync: No active subtitle") );
+                    var_FreeList( &list, &list2 );
+                    break;
+                }
+                p_sys->subtitle_delaybookmarks.i_time_subtitle = mdate();
+                DisplayMessage( p_vout,
+                                _("Sub sync: bookmarked subtitle timestamp"));
+                var_FreeList( &list, &list2 );
+            }
             break;
-        }
         case ACTIONID_SUBSYNC_APPLY:
         {
             /* Warning! Can yield a pause in the playback.



More information about the vlc-commits mailing list