]> git.sesse.net Git - vlc/commitdiff
+ src/input/var.c: when starting a title, don't recreate next/prev-chapter
authorEric Petit <titer@videolan.org>
Mon, 6 Sep 2004 21:07:43 +0000 (21:07 +0000)
committerEric Petit <titer@videolan.org>
Mon, 6 Sep 2004 21:07:43 +0000 (21:07 +0000)
     and add callbacks if they already exist

src/input/var.c

index c75933b7c52d84689bde07aff6921558415bf1b5..cc5f5b928f63f0117c4715c7f8a7575bd74e8eb2 100644 (file)
@@ -333,7 +333,12 @@ void input_ControlVarTitle( input_thread_t *p_input, int i_title )
     int  i;
 
     /* Create/Destroy command variables */
-    if( t->i_seekpoint > 1 )
+    if( t->i_seekpoint <= 1 )
+    {
+        var_Destroy( p_input, "next-chapter" );
+        var_Destroy( p_input, "prev-chapter" );
+    }
+    else if( var_Get( p_input, "next-chapter", &val ) != VLC_SUCCESS )
     {
         vlc_value_t text;
 
@@ -347,11 +352,6 @@ void input_ControlVarTitle( input_thread_t *p_input, int i_title )
         var_Change( p_input, "prev-chapter", VLC_VAR_SETTEXT, &text, NULL );
         var_AddCallback( p_input, "prev-chapter", SeekpointCallback, NULL );
     }
-    else
-    {
-        var_Destroy( p_input, "next-chapter" );
-        var_Destroy( p_input, "prev-chapter" );
-    }
 
     /* Build chapter list */
     var_Change( p_input, "chapter", VLC_VAR_CLEARCHOICES, NULL, NULL );