[vlc-commits] input: register title change callbacks only once

Petri Hintukainen git at videolan.org
Thu Nov 12 12:54:57 CET 2015


vlc | branch: master | Petri Hintukainen <phintuka at gmail.com> | Tue Nov 10 13:43:01 2015 +0200| [e2115fed06ecb8b5458bc7dce4e8c38deccfa504] | committer: Jean-Baptiste Kempf

input: register title change callbacks only once

Fixes skipping multiple titles with single click.

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

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

 src/input/var.c |   22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/input/var.c b/src/input/var.c
index f5ce212..0ad530c 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -256,15 +256,19 @@ void input_ControlVarNavigation( input_thread_t *p_input )
     /* Create more command variables */
     if( p_input->p->i_title > 1 )
     {
-        var_Create( p_input, "next-title", VLC_VAR_VOID );
-        text.psz_string = _("Next title");
-        var_Change( p_input, "next-title", VLC_VAR_SETTEXT, &text, NULL );
-        var_AddCallback( p_input, "next-title", TitleCallback, NULL );
-
-        var_Create( p_input, "prev-title", VLC_VAR_VOID );
-        text.psz_string = _("Previous title");
-        var_Change( p_input, "prev-title", VLC_VAR_SETTEXT, &text, NULL );
-        var_AddCallback( p_input, "prev-title", TitleCallback, NULL );
+        if( var_Type( p_input, "next-title" ) == 0 ) {
+            var_Create( p_input, "next-title", VLC_VAR_VOID );
+            text.psz_string = _("Next title");
+            var_Change( p_input, "next-title", VLC_VAR_SETTEXT, &text, NULL );
+            var_AddCallback( p_input, "next-title", TitleCallback, NULL );
+        }
+
+        if( var_Type( p_input, "prev-title" ) == 0 ) {
+            var_Create( p_input, "prev-title", VLC_VAR_VOID );
+            text.psz_string = _("Previous title");
+            var_Change( p_input, "prev-title", VLC_VAR_SETTEXT, &text, NULL );
+            var_AddCallback( p_input, "prev-title", TitleCallback, NULL );
+        }
     }
 
     /* Create titles and chapters */



More information about the vlc-commits mailing list