]> git.sesse.net Git - vlc/blobdiff - plugins/gtk/gtk_callbacks.c
*fixed a double malloc/free bug in DVDRead
[vlc] / plugins / gtk / gtk_callbacks.c
index 96c9405ca56463290872ea4c8b26a629cc61eb0a..6f7e40d90da6f2f74a6d79381024c8df5ddd04e3 100644 (file)
@@ -2,7 +2,7 @@
  * gtk_callbacks.c : Callbacks for the Gtk+ plugin.
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: gtk_callbacks.c,v 1.21 2001/05/30 05:19:03 stef Exp $
+ * $Id: gtk_callbacks.c,v 1.24 2001/05/31 16:10:05 stef Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Stéphane Borel <stef@via.ecp.fr>
@@ -56,6 +56,8 @@
 #include "main.h"
 #include "netutils.h"
 
+#include "modules_export.h"
+
 /*****************************************************************************
  * Callbacks
  *****************************************************************************/
@@ -203,7 +205,9 @@ void GtkTitlePrev( GtkButton * button, gpointer user_data )
         input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
 
         p_intf->p_sys->b_title_update = 1;
+        vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
         GtkSetupMenus( p_intf );
+        vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
     }
 }
 
@@ -225,7 +229,9 @@ void GtkTitleNext( GtkButton * button, gpointer user_data )
         input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
 
         p_intf->p_sys->b_title_update = 1;
+        vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
         GtkSetupMenus( p_intf );
+        vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
     }
 
 }
@@ -247,7 +253,9 @@ void GtkChapterPrev( GtkButton * button, gpointer user_data )
         input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
 
         p_intf->p_sys->b_chapter_update = 1;
+        vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
         GtkSetupMenus( p_intf );
+        vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
     }
 }
 
@@ -268,7 +276,9 @@ void GtkChapterNext( GtkButton * button, gpointer user_data )
         input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
 
         p_intf->p_sys->b_chapter_update = 1;
+        vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
         GtkSetupMenus( p_intf );
+        vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
     }
 }
 
@@ -280,7 +290,7 @@ void GtkNetworkJoin( GtkEditable * editable, gpointer user_data )
     int     i_channel;
 
     i_channel = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( editable ) );
-    intf_WarnMsg( 3, "intf info: joining channel %d", i_channel );
+//    intf_WarnMsg( 3, "intf info: joining channel %d", i_channel );
 
 //    network_ChannelJoin( i_channel );
 }
@@ -291,6 +301,8 @@ void GtkChannelGo( GtkButton * button, gpointer user_data )
     GtkWidget *     spin;
     int             i_channel;
 
+    intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), (char*)user_data );
+
     window = gtk_widget_get_toplevel( GTK_WIDGET (button) );
     spin = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( window ),
                        "network_channel_spinbutton" ) );
@@ -298,7 +310,29 @@ void GtkChannelGo( GtkButton * button, gpointer user_data )
     i_channel = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( spin ) );
     intf_WarnMsg( 3, "intf info: joining channel %d", i_channel );
 
+    vlc_mutex_lock( &p_intf->change_lock );
+    if( p_intf->p_input != NULL )
+    {
+        /* end playing item */
+        p_intf->p_input->b_eof = 1;
+
+        /* update playlist */
+        vlc_mutex_lock( &p_main->p_playlist->change_lock );
+
+        p_main->p_playlist->i_index--;
+        p_main->p_playlist->b_stopped = 1;
+
+        vlc_mutex_unlock( &p_main->p_playlist->change_lock );
+
+        /* FIXME: ugly hack to close input and outputs */
+        p_intf->pf_manage( p_intf );
+        p_main->p_playlist->b_stopped = 0;
+        p_intf->pf_manage( p_intf );
+    }
+    vlc_mutex_unlock( &p_intf->change_lock );
+
     network_ChannelJoin( i_channel );
+    input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
 }