From b465bcca0933f8c979ac9221b21f526ec2193ca4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Borel?= Date: Wed, 30 May 2001 23:02:04 +0000 Subject: [PATCH] -Updated the gtk/gnome interface to work in network mode, -Fixed some bugs in interface (language menus in ts, misnamed fields) -Play/Stop work in network mode to start/stop decoding of the stream I have a segfault in imdct_3dn(93). But I can't underdand assembly. --- include/main.h | 3 +- include/modules_export.h | 3 ++ plugins/gtk/gnome_callbacks.c | 1 + plugins/gtk/gnome_callbacks.h | 8 +++ plugins/gtk/gnome_interface.c | 87 ++++++++++++++++++++++++++----- plugins/gtk/gtk_callbacks.c | 28 +++++++++- plugins/gtk/gtk_callbacks.h | 4 +- plugins/gtk/gtk_display.c | 17 ++++-- plugins/gtk/gtk_interface.c | 94 +++++++++++++++++++++++++++------ plugins/gtk/gtk_menu.c | 6 ++- plugins/gtk/gtk_open.c | 53 ++++++++++++++++++- plugins/gtk/gtk_open.h | 3 +- plugins/gtk/gtk_playlist.c | 4 +- plugins/gtk/intf_gnome.c | 5 +- plugins/gtk/intf_gnome.glade | 117 ++++++++++++++++++++++++++++++++++++++--- plugins/gtk/intf_gtk.c | 6 ++- plugins/gtk/intf_gtk.glade | 118 +++++++++++++++++++++++++++++++++++++++--- plugins/imdct/ac3_imdct_3dn.c | 6 +-- src/audio_output/aout_spdif.c | 9 ++-- src/interface/main.c | 29 ++++++----- src/misc/netutils.c | 27 +++++++--- 21 files changed, 541 insertions(+), 87 deletions(-) diff --git a/include/main.h b/include/main.h index dfc352b7a8..d9bc4c7ca1 100644 --- a/include/main.h +++ b/include/main.h @@ -3,7 +3,7 @@ * Declaration and extern access to global program object. ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: main.h,v 1.19 2001/05/30 17:03:11 sam Exp $ + * $Id: main.h,v 1.20 2001/05/30 23:02:03 stef Exp $ * * Authors: Vincent Seguin * @@ -47,7 +47,6 @@ typedef struct main_s /* Generic settings */ boolean_t b_audio; /* is audio output allowed ? */ boolean_t b_video; /* is video output allowed ? */ - boolean_t b_channels; /* is channel changing supported ? */ /* Unique threads */ p_intf_thread_t p_intf; /* main interface thread */ diff --git a/include/modules_export.h b/include/modules_export.h index 45e216e957..379a2173c2 100644 --- a/include/modules_export.h +++ b/include/modules_export.h @@ -53,6 +53,7 @@ typedef struct module_symbols_s void ( * msleep ) ( mtime_t ); mtime_t ( * mdate ) ( void ); + int ( * network_ChannelCreate )( void ); int ( * network_ChannelJoin ) ( int ); void ( * input_SetStatus ) ( struct input_thread_s *, int ); @@ -94,6 +95,7 @@ typedef struct module_symbols_s (p_symbols)->intf_UrlDecode = intf_UrlDecode; \ (p_symbols)->msleep = msleep; \ (p_symbols)->mdate = mdate; \ + (p_symbols)->network_ChannelCreate = network_ChannelCreate; \ (p_symbols)->network_ChannelJoin = network_ChannelJoin; \ (p_symbols)->input_SetStatus = input_SetStatus; \ (p_symbols)->input_SetRate = input_SetRate; \ @@ -138,6 +140,7 @@ extern module_symbols_t* p_symbols; # define msleep(a) p_symbols->msleep(a) # define mdate() p_symbols->mdate() +# define network_ChannelCreate() p_symbols->network_ChannelCreate() # define network_ChannelJoin(a) p_symbols->network_ChannelJoin(a) # define input_SetStatus(a,b) p_symbols->input_SetStatus(a,b) diff --git a/plugins/gtk/gnome_callbacks.c b/plugins/gtk/gnome_callbacks.c index 15f3aa4d12..f326927872 100644 --- a/plugins/gtk/gnome_callbacks.c +++ b/plugins/gtk/gnome_callbacks.c @@ -261,3 +261,4 @@ GnomePopupJumpActivate (GtkMenuItem *menuitem, } + diff --git a/plugins/gtk/gnome_callbacks.h b/plugins/gtk/gnome_callbacks.h index 898304c274..c768fab7b7 100644 --- a/plugins/gtk/gnome_callbacks.h +++ b/plugins/gtk/gnome_callbacks.h @@ -133,3 +133,11 @@ GtkNetworkJoin (GtkEditable *editable, void GtkChannelGo (GtkButton *button, gpointer user_data); + +void +GtkNetworkOpenBroadcast (GtkToggleButton *togglebutton, + gpointer user_data); + +void +GtkNetworkOpenChannel (GtkToggleButton *togglebutton, + gpointer user_data); diff --git a/plugins/gtk/gnome_interface.c b/plugins/gtk/gnome_interface.c index cb7be299a6..89aab47585 100644 --- a/plugins/gtk/gnome_interface.c +++ b/plugins/gtk/gnome_interface.c @@ -393,7 +393,6 @@ create_intf_window (void) gtk_object_set_data_full (GTK_OBJECT (intf_window), "toolbar_stop", toolbar_stop, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (toolbar_stop); - gtk_widget_set_sensitive (toolbar_stop, FALSE); tmp_toolbar_icon = gnome_stock_pixmap_widget (intf_window, GNOME_STOCK_PIXMAP_FORWARD); toolbar_play = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar), @@ -1388,11 +1387,19 @@ create_intf_network (void) GtkWidget *label18; GtkObject *network_port_adj; GtkWidget *network_port; - GtkWidget *broadcast_check; + GtkWidget *network_broadcast_check; GtkWidget *network_broadcast_combo; GtkWidget *network_broadcast; GtkWidget *network_server_combo; GtkWidget *network_server; + GtkWidget *frame5; + GtkWidget *hbox4; + GtkWidget *network_channel_check; + GtkWidget *network_channel_combo; + GtkWidget *network_channel; + GtkWidget *channel_port; + GtkObject *network_channel_port_adj; + GtkWidget *network_channel_port; GtkWidget *hbuttonbox1; GtkWidget *network_ok; GtkWidget *network_cancel; @@ -1493,7 +1500,7 @@ create_intf_network (void) (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label18), 0, 0.5); - network_port_adj = gtk_adjustment_new (1234, 0, 65535, 1, 10, 10); + network_port_adj = gtk_adjustment_new (1234, 1024, 65535, 1, 10, 10); network_port = gtk_spin_button_new (GTK_ADJUSTMENT (network_port_adj), 1, 0); gtk_widget_ref (network_port); gtk_object_set_data_full (GTK_OBJECT (intf_network), "network_port", network_port, @@ -1504,15 +1511,14 @@ create_intf_network (void) (GtkAttachOptions) (0), 0, 0); gtk_tooltips_set_tip (tooltips, network_port, _("Port of the stream server"), NULL); - broadcast_check = gtk_check_button_new_with_label (_("Broadcast")); - gtk_widget_ref (broadcast_check); - gtk_object_set_data_full (GTK_OBJECT (intf_network), "broadcast_check", broadcast_check, + network_broadcast_check = gtk_check_button_new_with_label (_("Broadcast")); + gtk_widget_ref (network_broadcast_check); + gtk_object_set_data_full (GTK_OBJECT (intf_network), "network_broadcast_check", network_broadcast_check, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (broadcast_check); - gtk_table_attach (GTK_TABLE (table2), broadcast_check, 0, 1, 2, 3, + gtk_widget_show (network_broadcast_check); + gtk_table_attach (GTK_TABLE (table2), network_broadcast_check, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (broadcast_check), TRUE); network_broadcast_combo = gnome_entry_new (NULL); gtk_widget_ref (network_broadcast_combo); @@ -1547,6 +1553,60 @@ create_intf_network (void) gtk_widget_show (network_server); gtk_entry_set_text (GTK_ENTRY (network_server), _("vlsppc-02")); + frame5 = gtk_frame_new (_("Channels")); + gtk_widget_ref (frame5); + gtk_object_set_data_full (GTK_OBJECT (intf_network), "frame5", frame5, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (frame5); + gtk_box_pack_start (GTK_BOX (vbox5), frame5, TRUE, TRUE, 0); + gtk_frame_set_label_align (GTK_FRAME (frame5), 0.05, 0.5); + + hbox4 = gtk_hbox_new (FALSE, 0); + gtk_widget_ref (hbox4); + gtk_object_set_data_full (GTK_OBJECT (intf_network), "hbox4", hbox4, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (hbox4); + gtk_container_add (GTK_CONTAINER (frame5), hbox4); + + network_channel_check = gtk_check_button_new_with_label (_("Channel server:")); + gtk_widget_ref (network_channel_check); + gtk_object_set_data_full (GTK_OBJECT (intf_network), "network_channel_check", network_channel_check, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (network_channel_check); + gtk_box_pack_start (GTK_BOX (hbox4), network_channel_check, FALSE, FALSE, 0); + + network_channel_combo = gnome_entry_new (NULL); + gtk_widget_ref (network_channel_combo); + gtk_object_set_data_full (GTK_OBJECT (intf_network), "network_channel_combo", network_channel_combo, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (network_channel_combo); + gtk_box_pack_start (GTK_BOX (hbox4), network_channel_combo, FALSE, FALSE, 0); + gtk_widget_set_sensitive (network_channel_combo, FALSE); + + network_channel = gnome_entry_gtk_entry (GNOME_ENTRY (network_channel_combo)); + gtk_widget_ref (network_channel); + gtk_object_set_data_full (GTK_OBJECT (intf_network), "network_channel", network_channel, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (network_channel); + gtk_entry_set_text (GTK_ENTRY (network_channel), _("138.195.143.220")); + + channel_port = gtk_label_new (_("port:")); + gtk_widget_ref (channel_port); + gtk_object_set_data_full (GTK_OBJECT (intf_network), "channel_port", channel_port, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (channel_port); + gtk_box_pack_start (GTK_BOX (hbox4), channel_port, FALSE, FALSE, 5); + + network_channel_port_adj = gtk_adjustment_new (6010, 1024, 65535, 1, 10, 10); + network_channel_port = gtk_spin_button_new (GTK_ADJUSTMENT (network_channel_port_adj), 1, 0); + gtk_widget_ref (network_channel_port); + gtk_object_set_data_full (GTK_OBJECT (intf_network), "network_channel_port", network_channel_port, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (network_channel_port); + gtk_box_pack_start (GTK_BOX (hbox4), network_channel_port, FALSE, FALSE, 0); + gtk_widget_set_usize (network_channel_port, 60, -2); + gtk_widget_set_sensitive (network_channel_port, FALSE); + hbuttonbox1 = GNOME_DIALOG (intf_network)->action_area; gtk_object_set_data (GTK_OBJECT (intf_network), "hbuttonbox1", hbuttonbox1); gtk_widget_show (hbuttonbox1); @@ -1569,9 +1629,12 @@ create_intf_network (void) gtk_widget_show (network_cancel); GTK_WIDGET_SET_FLAGS (network_cancel, GTK_CAN_DEFAULT); - gtk_signal_connect (GTK_OBJECT (broadcast_check), "toggled", + gtk_signal_connect (GTK_OBJECT (network_broadcast_check), "toggled", GTK_SIGNAL_FUNC (GtkNetworkOpenBroadcast), - NULL); + "intf_network"); + gtk_signal_connect (GTK_OBJECT (network_channel_check), "toggled", + GTK_SIGNAL_FUNC (GtkNetworkOpenChannel), + "intf_network"); gtk_signal_connect (GTK_OBJECT (network_ok), "clicked", GTK_SIGNAL_FUNC (GtkNetworkOpenOk), "intf_network"); @@ -1806,7 +1869,7 @@ create_intf_playlist (void) (GtkDestroyNotify) gtk_widget_unref); gtk_widget_ref (playlist_delete_menu_uiinfo[1].widget); - gtk_object_set_data_full (GTK_OBJECT (intf_playlist), "playmist_delete_item", + gtk_object_set_data_full (GTK_OBJECT (intf_playlist), "playlist_delete_item", playlist_delete_menu_uiinfo[1].widget, (GtkDestroyNotify) gtk_widget_unref); diff --git a/plugins/gtk/gtk_callbacks.c b/plugins/gtk/gtk_callbacks.c index 021521ba53..d39fa611b6 100644 --- a/plugins/gtk/gtk_callbacks.c +++ b/plugins/gtk/gtk_callbacks.c @@ -2,7 +2,7 @@ * gtk_callbacks.c : Callbacks for the Gtk+ plugin. ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: gtk_callbacks.c,v 1.22 2001/05/30 17:03:12 sam Exp $ + * $Id: gtk_callbacks.c,v 1.23 2001/05/30 23:02:03 stef Exp $ * * Authors: Samuel Hocevar * Stéphane Borel @@ -282,7 +282,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 ); } @@ -293,6 +293,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" ) ); @@ -300,7 +302,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 ); } diff --git a/plugins/gtk/gtk_callbacks.h b/plugins/gtk/gtk_callbacks.h index a4270a7716..2d8b2da179 100644 --- a/plugins/gtk/gtk_callbacks.h +++ b/plugins/gtk/gtk_callbacks.h @@ -2,7 +2,7 @@ * gtk_callbacks.h : Callbacks for the gtk plugin. ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: gtk_callbacks.h,v 1.14 2001/05/30 05:19:03 stef Exp $ + * $Id: gtk_callbacks.h,v 1.15 2001/05/30 23:02:03 stef Exp $ * * Authors: Samuel Hocevar * Stéphane Borel @@ -68,3 +68,5 @@ void GtkJumpActivate ( GtkMenuItem *, gpointer ); void GtkNetworkJoin ( GtkEditable *, gpointer ); void GtkChannelGo ( GtkButton *, gpointer ); + +void GtkNetworkOpenChannel ( GtkToggleButton *, gpointer ); diff --git a/plugins/gtk/gtk_display.c b/plugins/gtk/gtk_display.c index 87610d668c..63d1b8c6c4 100644 --- a/plugins/gtk/gtk_display.c +++ b/plugins/gtk/gtk_display.c @@ -2,7 +2,7 @@ * gtk_display.c: Gtk+ tools for main interface ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: gtk_display.c,v 1.3 2001/05/30 17:03:12 sam Exp $ + * $Id: gtk_display.c,v 1.4 2001/05/30 23:02:03 stef Exp $ * * Authors: Samuel Hocevar * Stéphane Borel @@ -101,6 +101,7 @@ gint GtkModeManage( intf_thread_t * p_intf ) GtkWidget * p_network_box; GtkWidget * p_slider; GtkWidget * p_label; + GtkWidget * p_channel; boolean_t b_control; #define GETWIDGET( ptr, name ) GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( \ @@ -152,6 +153,18 @@ gint GtkModeManage( intf_thread_t * p_intf ) "network_address_label" ); gtk_label_set_text( GTK_LABEL( p_label ), p_intf->p_input->p_source ); + p_channel = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_intf->p_sys->p_window ), "network_channel_box" ) ); + if( main_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR, + INPUT_NETWORK_CHANNEL_DEFAULT ) ) + { + gtk_widget_show( GTK_WIDGET( p_channel ) ); + } + else + { + gtk_widget_hide( GTK_WIDGET( p_channel ) ); + } + break; default: intf_ErrMsg( "intf error: can't determine input method" ); @@ -206,12 +219,10 @@ gint GtkModeManage( intf_thread_t * p_intf ) /* set control items */ gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_back"), FALSE ); - gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_stop"), b_control ); gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_pause"), b_control ); gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_slow"), b_control ); gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_fast"), b_control ); gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_back"), FALSE ); - gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_stop"), b_control ); gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_pause"), b_control ); gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_slow"), b_control ); gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_fast"), b_control ); diff --git a/plugins/gtk/gtk_interface.c b/plugins/gtk/gtk_interface.c index 418f7b6768..33e4174150 100644 --- a/plugins/gtk/gtk_interface.c +++ b/plugins/gtk/gtk_interface.c @@ -89,7 +89,7 @@ create_intf_window (void) GtkWidget *chapter_prev_button; GtkWidget *chapter_next_button; GtkWidget *network_box; - GtkWidget *network_address; + GtkWidget *network_address_label; GtkWidget *network_channel_box; GtkWidget *channel_label; GtkObject *network_channel_spinbutton_adj; @@ -503,7 +503,6 @@ create_intf_window (void) gtk_object_set_data_full (GTK_OBJECT (intf_window), "toolbar_stop", toolbar_stop, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (toolbar_stop); - gtk_widget_set_sensitive (toolbar_stop, FALSE); toolbar_play = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_CHILD_BUTTON, @@ -721,12 +720,12 @@ create_intf_window (void) gtk_box_pack_start (GTK_BOX (window_vbox), network_box, TRUE, TRUE, 0); gtk_widget_set_usize (network_box, 500, 24); - network_address = gtk_label_new (_("No server !")); - gtk_widget_ref (network_address); - gtk_object_set_data_full (GTK_OBJECT (intf_window), "network_address", network_address, + network_address_label = gtk_label_new (_("No server !")); + gtk_widget_ref (network_address_label); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "network_address_label", network_address_label, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (network_address); - gtk_box_pack_start (GTK_BOX (network_box), network_address, TRUE, TRUE, 0); + gtk_widget_show (network_address_label); + gtk_box_pack_start (GTK_BOX (network_box), network_address_label, TRUE, TRUE, 0); network_channel_box = gtk_hbox_new (FALSE, 0); gtk_widget_ref (network_channel_box); @@ -938,7 +937,6 @@ create_intf_popup (void) (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (popup_stop); gtk_container_add (GTK_CONTAINER (intf_popup), popup_stop); - gtk_widget_set_sensitive (popup_stop, FALSE); popup_back = gtk_menu_item_new_with_label (_("Back")); gtk_widget_ref (popup_back); @@ -1599,12 +1597,20 @@ create_intf_network (void) GtkWidget *network_port; GtkWidget *label24; GtkWidget *label25; - GtkWidget *broadcast_check; + GtkWidget *network_broadcast_check; GtkWidget *network_broadcast_combo; GtkWidget *network_broadcast; GtkWidget *network_server_combo; GList *network_server_combo_items = NULL; GtkWidget *network_server; + GtkWidget *frame6; + GtkWidget *hbox14; + GtkWidget *network_channel_check; + GtkWidget *network_channel_combo; + GtkWidget *network_channel; + GtkWidget *channel_port; + GtkObject *network_channel_port_adj; + GtkWidget *network_channel_port; GtkWidget *hbox4; GtkWidget *hbox5; GtkWidget *network_ok; @@ -1723,12 +1729,12 @@ create_intf_network (void) (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label25), 0, 0.5); - broadcast_check = gtk_check_button_new_with_label (_("Broadcast")); - gtk_widget_ref (broadcast_check); - gtk_object_set_data_full (GTK_OBJECT (intf_network), "broadcast_check", broadcast_check, + network_broadcast_check = gtk_check_button_new_with_label (_("Broadcast")); + gtk_widget_ref (network_broadcast_check); + gtk_object_set_data_full (GTK_OBJECT (intf_network), "network_broadcast_check", network_broadcast_check, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (broadcast_check); - gtk_table_attach (GTK_TABLE (table2), broadcast_check, 0, 1, 2, 3, + gtk_widget_show (network_broadcast_check); + gtk_table_attach (GTK_TABLE (table2), network_broadcast_check, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); @@ -1748,6 +1754,7 @@ create_intf_network (void) (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (network_broadcast); gtk_widget_set_sensitive (network_broadcast, FALSE); + gtk_entry_set_text (GTK_ENTRY (network_broadcast), _("138.195.143.255")); network_server_combo = gtk_combo_new (); gtk_widget_ref (network_server_combo); @@ -1766,7 +1773,59 @@ create_intf_network (void) gtk_object_set_data_full (GTK_OBJECT (intf_network), "network_server", network_server, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (network_server); - gtk_entry_set_text (GTK_ENTRY (network_server), _("vls")); + gtk_entry_set_text (GTK_ENTRY (network_server), _("vlsppc-02")); + + frame6 = gtk_frame_new (_("Channels")); + gtk_widget_ref (frame6); + gtk_object_set_data_full (GTK_OBJECT (intf_network), "frame6", frame6, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (frame6); + gtk_box_pack_start (GTK_BOX (vbox8), frame6, TRUE, TRUE, 5); + gtk_frame_set_label_align (GTK_FRAME (frame6), 0.05, 0.5); + + hbox14 = gtk_hbox_new (FALSE, 0); + gtk_widget_ref (hbox14); + gtk_object_set_data_full (GTK_OBJECT (intf_network), "hbox14", hbox14, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (hbox14); + gtk_container_add (GTK_CONTAINER (frame6), hbox14); + + network_channel_check = gtk_check_button_new_with_label (_("Channel server:")); + gtk_widget_ref (network_channel_check); + gtk_object_set_data_full (GTK_OBJECT (intf_network), "network_channel_check", network_channel_check, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (network_channel_check); + gtk_box_pack_start (GTK_BOX (hbox14), network_channel_check, FALSE, FALSE, 0); + + network_channel_combo = gtk_combo_new (); + gtk_widget_ref (network_channel_combo); + gtk_object_set_data_full (GTK_OBJECT (intf_network), "network_channel_combo", network_channel_combo, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (network_channel_combo); + gtk_box_pack_start (GTK_BOX (hbox14), network_channel_combo, TRUE, TRUE, 0); + + network_channel = GTK_COMBO (network_channel_combo)->entry; + gtk_widget_ref (network_channel); + gtk_object_set_data_full (GTK_OBJECT (intf_network), "network_channel", network_channel, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (network_channel); + gtk_entry_set_text (GTK_ENTRY (network_channel), _("138.195.143.220")); + + channel_port = gtk_label_new (_("port:")); + gtk_widget_ref (channel_port); + gtk_object_set_data_full (GTK_OBJECT (intf_network), "channel_port", channel_port, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (channel_port); + gtk_box_pack_start (GTK_BOX (hbox14), channel_port, FALSE, FALSE, 5); + + network_channel_port_adj = gtk_adjustment_new (6010, 1024, 100, 1, 10, 10); + network_channel_port = gtk_spin_button_new (GTK_ADJUSTMENT (network_channel_port_adj), 1, 0); + gtk_widget_ref (network_channel_port); + gtk_object_set_data_full (GTK_OBJECT (intf_network), "network_channel_port", network_channel_port, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (network_channel_port); + gtk_box_pack_start (GTK_BOX (hbox14), network_channel_port, TRUE, TRUE, 0); + gtk_widget_set_usize (network_channel_port, 62, -2); hbox4 = GTK_DIALOG (intf_network)->action_area; gtk_object_set_data (GTK_OBJECT (intf_network), "hbox4", hbox4); @@ -1794,9 +1853,12 @@ create_intf_network (void) gtk_widget_show (network_cancel); gtk_box_pack_start (GTK_BOX (hbox5), network_cancel, FALSE, TRUE, 0); - gtk_signal_connect (GTK_OBJECT (broadcast_check), "toggled", + gtk_signal_connect (GTK_OBJECT (network_broadcast_check), "toggled", GTK_SIGNAL_FUNC (GtkNetworkOpenBroadcast), "intf_network"); + gtk_signal_connect (GTK_OBJECT (network_channel_check), "toggled", + GTK_SIGNAL_FUNC (GtkNetworkOpenChannel), + "intf_network"); gtk_signal_connect (GTK_OBJECT (network_ok), "clicked", GTK_SIGNAL_FUNC (GtkNetworkOpenOk), "intf_network"); diff --git a/plugins/gtk/gtk_menu.c b/plugins/gtk/gtk_menu.c index 406ba655ab..1ec4c17169 100644 --- a/plugins/gtk/gtk_menu.c +++ b/plugins/gtk/gtk_menu.c @@ -2,7 +2,7 @@ * gtk_menu.c : functions to handle menu items. ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: gtk_menu.c,v 1.6 2001/05/30 17:03:12 sam Exp $ + * $Id: gtk_menu.c,v 1.7 2001/05/30 23:02:04 stef Exp $ * * Authors: Samuel Hocevar * Stéphane Borel @@ -791,7 +791,7 @@ gint GtkSetupMenus( intf_thread_t * p_intf ) p_intf->p_sys->b_audio_update |= p_intf->p_sys->b_title_update; p_intf->p_sys->b_spu_update |= p_intf->p_sys->b_title_update; - vlc_mutex_lock( &p_intf->p_input->stream.stream_lock ); +// vlc_mutex_lock( &p_intf->p_input->stream.stream_lock ); if( p_intf->p_sys->b_title_update ) { @@ -923,6 +923,8 @@ gint GtkSetupMenus( intf_thread_t * p_intf ) p_intf->p_sys->b_spu_update = 0; } + vlc_mutex_lock( &p_intf->p_input->stream.stream_lock ); + return TRUE; } diff --git a/plugins/gtk/gtk_open.c b/plugins/gtk/gtk_open.c index b8ac154cc1..10a70b32ff 100644 --- a/plugins/gtk/gtk_open.c +++ b/plugins/gtk/gtk_open.c @@ -2,7 +2,7 @@ * gtk_open.c : functions to handle file/disc/network open widgets. ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: gtk_open.c,v 1.4 2001/05/30 17:03:12 sam Exp $ + * $Id: gtk_open.c,v 1.5 2001/05/30 23:02:04 stef Exp $ * * Authors: Samuel Hocevar * Stéphane Borel @@ -52,6 +52,7 @@ #include "intf_gtk.h" #include "main.h" +#include "netutils.h" #include "modules_export.h" @@ -275,6 +276,7 @@ void GtkNetworkOpenOk( GtkButton *button, gpointer user_data ) char * psz_source, *psz_server, *psz_protocol; unsigned int i_port; boolean_t b_broadcast; + boolean_t b_channel; int i_end = p_main->p_playlist->i_size; gtk_widget_hide( p_intf->p_sys->p_network ); @@ -308,7 +310,7 @@ void GtkNetworkOpenOk( GtkButton *button, gpointer user_data ) /* do we have a broadcast address */ b_broadcast = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( - lookup_widget( GTK_WIDGET(button), "broadcast_check" ) ) ); + lookup_widget( GTK_WIDGET(button), "network_broadcast_check" ) ) ); if( b_broadcast ) { char * psz_broadcast; @@ -346,6 +348,32 @@ void GtkNetworkOpenOk( GtkButton *button, gpointer user_data ) sprintf( psz_source, "%s://%s:%i", psz_protocol, psz_server, i_port ); } + /* Manage channel server */ + b_channel = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( + lookup_widget( GTK_WIDGET(button), "network_channel_check" ) ) ); + main_PutIntVariable( INPUT_NETWORK_CHANNEL_VAR, b_channel ); + if( b_channel ) + { + char * psz_channel; + unsigned int i_channel_port; + + if( p_main->p_channel == NULL ) + { + network_ChannelCreate(); + } + + psz_channel = gtk_entry_get_text( GTK_ENTRY( lookup_widget( + GTK_WIDGET(button), "network_channel" ) ) ); + i_channel_port = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( + lookup_widget( GTK_WIDGET(button), "network_channel_port" ) ) ); + + main_PutPszVariable( INPUT_CHANNEL_SERVER_VAR, psz_channel ); + if( i_channel_port < 65536 ) + { + main_PutIntVariable( INPUT_CHANNEL_PORT_VAR, i_channel_port ); + } + } + intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, psz_source ); free( psz_source ); @@ -387,6 +415,27 @@ void GtkNetworkOpenBroadcast( GtkToggleButton * togglebutton, } +void GtkNetworkOpenChannel( GtkToggleButton * togglebutton, + gpointer user_data ) +{ + GtkWidget * p_network; + + p_network = gtk_widget_get_toplevel( GTK_WIDGET (togglebutton) ); + + gtk_widget_set_sensitive( gtk_object_get_data( GTK_OBJECT( p_network ), + "network_channel_combo" ), + gtk_toggle_button_get_active( togglebutton ) ); + + gtk_widget_set_sensitive( gtk_object_get_data( GTK_OBJECT( p_network ), + "network_channel" ), + gtk_toggle_button_get_active( togglebutton ) ); + + gtk_widget_set_sensitive( gtk_object_get_data( GTK_OBJECT( p_network ), + "network_channel_port" ), + gtk_toggle_button_get_active( togglebutton ) ); + +} + /**************************************************************************** * Callbacks for menuitem diff --git a/plugins/gtk/gtk_open.h b/plugins/gtk/gtk_open.h index b46f63b54b..6ede5fbae8 100644 --- a/plugins/gtk/gtk_open.h +++ b/plugins/gtk/gtk_open.h @@ -2,7 +2,7 @@ * gtk_open.h: prototypes for open functions ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: gtk_open.h,v 1.2 2001/05/15 14:49:48 stef Exp $ + * $Id: gtk_open.h,v 1.3 2001/05/30 23:02:04 stef Exp $ * * Authors: Samuel Hocevar * Stéphane Borel @@ -36,6 +36,7 @@ gboolean GtkNetworkOpenShow ( GtkWidget *, GdkEventButton *, gpointer ); void GtkNetworkOpenOk ( GtkButton *, gpointer ); void GtkNetworkOpenCancel ( GtkButton *, gpointer ); void GtkNetworkOpenBroadcast( GtkToggleButton *, gpointer ); +void GtkNetworkOpenChannel ( GtkToggleButton *, gpointer ); void GtkFileOpenActivate ( GtkMenuItem *, gpointer ); void GtkDiscOpenActivate ( GtkMenuItem *, gpointer ); diff --git a/plugins/gtk/gtk_playlist.c b/plugins/gtk/gtk_playlist.c index d6201ddfa4..f36f286a31 100644 --- a/plugins/gtk/gtk_playlist.c +++ b/plugins/gtk/gtk_playlist.c @@ -2,7 +2,7 @@ * gtk_playlist.c : Interface for the playlist dialog ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: gtk_playlist.c,v 1.15 2001/05/30 17:03:12 sam Exp $ + * $Id: gtk_playlist.c,v 1.16 2001/05/30 23:02:04 stef Exp $ * * Authors: Pierre Baillet * Stéphane Borel @@ -198,7 +198,7 @@ void GtkPlaylistDeleteSelected( GtkMenuItem * menuitem, gpointer user_data ) playlist_t *p_playlist; /* catch the thread back */ - intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), (char*)user_data ); + intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), /*(char*)user_data*/"intf_playlist" ); p_playlist = p_main->p_playlist; diff --git a/plugins/gtk/intf_gnome.c b/plugins/gtk/intf_gnome.c index 1ddfcfb9be..38c1f609f4 100644 --- a/plugins/gtk/intf_gnome.c +++ b/plugins/gtk/intf_gnome.c @@ -2,7 +2,7 @@ * intf_gnome.c: Gnome interface ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: intf_gnome.c,v 1.2 2001/05/30 17:03:12 sam Exp $ + * $Id: intf_gnome.c,v 1.3 2001/05/30 23:02:04 stef Exp $ * * Authors: Samuel Hocevar * Stéphane Borel @@ -323,6 +323,7 @@ static gint GnomeManage( gpointer p_data ) if( p_intf->p_input->stream.b_changed ) { GtkModeManage( p_intf ); + GtkSetupMenus( p_intf ); } /* Manage the slider */ @@ -358,7 +359,6 @@ static gint GnomeManage( gpointer p_data ) } #undef p_area } - vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock ); if( p_intf->p_sys->i_part != p_intf->p_input->stream.p_selected_area->i_part ) @@ -367,6 +367,7 @@ static gint GnomeManage( gpointer p_data ) GtkSetupMenus( p_intf ); } + vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock ); } else if( !p_intf->b_die ) { diff --git a/plugins/gtk/intf_gnome.glade b/plugins/gtk/intf_gnome.glade index 2e6b3e0b40..a609460db9 100644 --- a/plugins/gtk/intf_gnome.glade +++ b/plugins/gtk/intf_gnome.glade @@ -423,7 +423,6 @@ GtkButton Toolbar:button toolbar_stop - False Stop Stream button_press_event @@ -2018,7 +2017,7 @@ Henri Fallon <henri@via.ecp.fr> False False 1234 - 0 + 1024 65535 1 10 @@ -2041,15 +2040,16 @@ Henri Fallon <henri@via.ecp.fr> GtkCheckButton - broadcast_check + network_broadcast_check True toggled GtkNetworkOpenBroadcast - Sat, 19 May 2001 02:57:46 GMT + "intf_network" + Wed, 30 May 2001 13:30:02 GMT - True + False True 0 @@ -2132,6 +2132,111 @@ Henri Fallon <henri@via.ecp.fr> + + + GtkFrame + frame5 + + 0.05 + GTK_SHADOW_ETCHED_IN + + 0 + True + True + + + + GtkHBox + hbox4 + False + 0 + + + GtkCheckButton + network_channel_check + True + + toggled + GtkNetworkOpenChannel + "intf_network" + Wed, 30 May 2001 13:30:25 GMT + + + False + True + + 0 + False + False + + + + + GnomeEntry + network_channel_combo + False + 10 + + 0 + False + False + + + + GtkEntry + GnomeEntry:entry + network_channel + True + True + True + 0 + 138.195.143.220 + + + + + GtkLabel + channel_port + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 5 + False + False + + + + + GtkSpinButton + network_channel_port + 60 + False + True + 1 + 0 + False + GTK_UPDATE_ALWAYS + False + False + 6010 + 1024 + 65535 + 1 + 10 + 10 + + 0 + False + False + + + + @@ -2403,7 +2508,7 @@ Henri Fallon <henri@via.ecp.fr> GtkMenuItem - playmist_delete_item + playlist_delete_item activate GtkPlaylistDeleteSelected diff --git a/plugins/gtk/intf_gtk.c b/plugins/gtk/intf_gtk.c index 3398b810df..89af71e117 100644 --- a/plugins/gtk/intf_gtk.c +++ b/plugins/gtk/intf_gtk.c @@ -2,7 +2,7 @@ * intf_gtk.c: Gtk+ interface ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: intf_gtk.c,v 1.22 2001/05/30 17:03:12 sam Exp $ + * $Id: intf_gtk.c,v 1.23 2001/05/30 23:02:04 stef Exp $ * * Authors: Samuel Hocevar * Stéphane Borel @@ -323,6 +323,7 @@ static gint GtkManage( gpointer p_data ) if( p_intf->p_input->stream.b_changed ) { GtkModeManage( p_intf ); + GtkSetupMenus( p_intf ); } /* Manage the slider */ @@ -358,7 +359,6 @@ static gint GtkManage( gpointer p_data ) } #undef p_area } - vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock ); if( p_intf->p_sys->i_part != p_intf->p_input->stream.p_selected_area->i_part ) @@ -367,6 +367,8 @@ static gint GtkManage( gpointer p_data ) GtkSetupMenus( p_intf ); } + vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock ); + } else if( !p_intf->b_die ) { diff --git a/plugins/gtk/intf_gtk.glade b/plugins/gtk/intf_gtk.glade index ff06d9dd2d..b1dbdc0573 100644 --- a/plugins/gtk/intf_gtk.glade +++ b/plugins/gtk/intf_gtk.glade @@ -431,7 +431,6 @@ GtkButton Toolbar:button toolbar_stop - False Stop Stream button_press_event @@ -849,7 +848,7 @@ GtkLabel - network_address + network_address_label GTK_JUSTIFY_CENTER False @@ -989,7 +988,6 @@ GtkMenuItem popup_stop - False activate GtKStopActivate @@ -2120,7 +2118,7 @@ Henri Fallon <henri@via.ecp.fr> GtkCheckButton - broadcast_check + network_broadcast_check True toggled @@ -2181,7 +2179,7 @@ Henri Fallon <henri@via.ecp.fr> True True 0 - + 138.195.143.255 @@ -2218,12 +2216,120 @@ Henri Fallon <henri@via.ecp.fr> True True 0 - vls + vlsppc-02 + + + GtkFrame + frame6 + + 0.05 + GTK_SHADOW_ETCHED_IN + + 5 + True + True + + + + GtkHBox + hbox14 + False + 0 + + + GtkCheckButton + network_channel_check + True + + toggled + GtkNetworkOpenChannel + "intf_network" + Wed, 30 May 2001 16:57:53 GMT + + + False + True + + 0 + False + False + + + + + GtkCombo + network_channel_combo + False + True + False + True + False + + + 0 + True + True + + + + GtkEntry + GtkCombo:entry + network_channel + True + True + True + 0 + 138.195.143.220 + + + + + GtkLabel + channel_port + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 5 + False + False + + + + + GtkSpinButton + network_channel_port + 62 + True + 1 + 0 + False + GTK_UPDATE_ALWAYS + False + False + 6010 + 1024 + 100 + 1 + 10 + 10 + + 0 + True + True + + + + diff --git a/plugins/imdct/ac3_imdct_3dn.c b/plugins/imdct/ac3_imdct_3dn.c index 2cde76ac47..e21aa96d6f 100644 --- a/plugins/imdct/ac3_imdct_3dn.c +++ b/plugins/imdct/ac3_imdct_3dn.c @@ -2,7 +2,7 @@ * ac3_imdct_3dn.c: accelerated 3D Now! ac3 DCT ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: ac3_imdct_3dn.c,v 1.2 2001/05/28 02:38:48 sam Exp $ + * $Id: ac3_imdct_3dn.c,v 1.3 2001/05/30 23:02:04 stef Exp $ * * Authors: Renaud Dartus * @@ -59,7 +59,7 @@ void _M( imdct_init ) (imdct_t * p_imdct) int i; float scale = 181.019; - fprintf(stderr,"imct_init\n"); + intf_WarnMsg( 6, "imct_init" ); for (i=0; i < 128; i++) { float xcos_i = cos(2.0f * M_PI * (8*i+1)/(8*N)) * scale; @@ -69,7 +69,7 @@ void _M( imdct_init ) (imdct_t * p_imdct) p_imdct->xcos_sin_sse[i * 4 + 2] = -xsin_i; p_imdct->xcos_sin_sse[i * 4 + 3] = -xcos_i; } - fprintf(stderr,"done imct_init\n"); + intf_WarnMsg( 6, "done imct_init" ); } void _M( imdct_do_512 ) (imdct_t * p_imdct, float data[], float delay[]) diff --git a/src/audio_output/aout_spdif.c b/src/audio_output/aout_spdif.c index aa902ccaab..cc2c6525aa 100644 --- a/src/audio_output/aout_spdif.c +++ b/src/audio_output/aout_spdif.c @@ -2,7 +2,7 @@ * aout_spdif: ac3 passthrough output ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: aout_spdif.c,v 1.7 2001/05/30 05:19:03 stef Exp $ + * $Id: aout_spdif.c,v 1.8 2001/05/30 23:02:04 stef Exp $ * * Authors: Michel Kaempf * Stéphane Borel @@ -42,6 +42,7 @@ #include "aout_common.h" #define BLANK_FRAME_MAX 100 +#define SLEEP_TIME 16000 /***************************************************************************** * aout_SpdifThread: audio output thread that sends raw spdif data @@ -63,7 +64,6 @@ void aout_SpdifThread( aout_thread_t * p_aout ) mtime_t mplay; mtime_t mdelta; mtime_t mlast = 0; - mtime_t m_frame_time; /* get a blank frame ready */ memset( pi_blank, 0, sizeof(pi_blank) ); @@ -76,7 +76,6 @@ void aout_SpdifThread( aout_thread_t * p_aout ) i_blank = 0; /* Compute the theorical duration of an ac3 frame */ - m_frame_time = 1000000 * AC3_FRAME_SIZE / p_aout->fifo[0].l_rate; while( !p_aout->b_die ) { @@ -105,7 +104,7 @@ void aout_SpdifThread( aout_thread_t * p_aout ) l_start_frame]; mdelta = mplay - mdate(); - if( mdelta < ( 2 * m_frame_time ) ) + if( mdelta < ( 2 * SLEEP_TIME ) ) { intf_WarnMsg( 12, "spdif out (%d):" "playing frame %lld (%lld)", @@ -140,7 +139,7 @@ void aout_SpdifThread( aout_thread_t * p_aout ) { /* we leave some time for aout fifo to fill and not to stress * the external decoder too much */ - msleep( m_frame_time / 2 ); + msleep( SLEEP_TIME ); } else { diff --git a/src/interface/main.c b/src/interface/main.c index 227e901365..dffeaa1ca3 100644 --- a/src/interface/main.c +++ b/src/interface/main.c @@ -4,7 +4,7 @@ * and spawn threads. ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: main.c,v 1.97 2001/05/30 05:19:03 stef Exp $ + * $Id: main.c,v 1.98 2001/05/30 23:02:04 stef Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -176,10 +176,10 @@ static const struct option longopts[] = /* Input options */ { "input", 1, 0, OPT_INPUT }, - { "channels", 0, 0, OPT_CHANNELS }, { "server", 1, 0, OPT_SERVER }, { "port", 1, 0, OPT_PORT }, { "broadcast", 1, 0, OPT_BROADCAST }, + { "channels", 0, 0, OPT_CHANNELS }, /* Synchro options */ { "synchro", 1, 0, OPT_SYNCHRO }, @@ -305,12 +305,14 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) /* * Initialize shared resources and libraries */ - if( p_main->b_channels && network_ChannelCreate() ) + if( main_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR, + INPUT_NETWORK_CHANNEL_DEFAULT ) && + network_ChannelCreate() ) { /* On error during Channels initialization, switch off channels */ intf_Msg( "Channels initialization failed : " "Channel management is deactivated" ); - p_main->b_channels = 0; + main_PutIntVariable( INPUT_NETWORK_CHANNEL_VAR, 0 ); } /* @@ -341,7 +343,8 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) /* * Go back into channel 0 which is the network */ - if( p_main->b_channels ) + if( main_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR, + INPUT_NETWORK_CHANNEL_DEFAULT ) ) { network_ChannelJoin( COMMON_CHANNEL ); } @@ -480,10 +483,11 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) p_main->b_audio = 1; p_main->b_video = 1; - p_main->b_channels = 0; p_main->i_warning_level = 0; + p_main->p_channel = NULL; + /* Get the executable name (similar to the basename command) */ p_main->psz_arg0 = p_tmp = ppsz_argv[ 0 ]; while( *p_tmp ) @@ -644,7 +648,6 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) main_PutPszVariable( INPUT_METHOD_VAR, optarg ); break; case OPT_CHANNELS: /* --channels */ - p_main->b_channels = 1; main_PutIntVariable( INPUT_NETWORK_CHANNEL_VAR, 1 ); break; case OPT_SERVER: /* --server */ @@ -807,12 +810,12 @@ static void Usage( int i_fashion ) /* Input parameters */ intf_MsgImm( "\nInput parameters:" - "\n " INPUT_SERVER_VAR "= \tvideo server" - "\n " INPUT_PORT_VAR "= \tvideo server port" - "\n " INPUT_IFACE_VAR "= \tnetwork interface" - "\n " INPUT_BROADCAST_VAR "= \tbroadcast mode" - "\n " INPUT_CHANNEL_SERVER_VAR "= \tchannel server" - "\n " INPUT_CHANNEL_PORT_VAR "= \tchannel server port" ); + "\n " INPUT_SERVER_VAR "= \tvideo server" + "\n " INPUT_PORT_VAR "= \tvideo server port" + "\n " INPUT_IFACE_VAR "= \tnetwork interface" + "\n " INPUT_BCAST_ADDR_VAR "= \tbroadcast mode" + "\n " INPUT_CHANNEL_SERVER_VAR "= \tchannel server" + "\n " INPUT_CHANNEL_PORT_VAR "= \tchannel server port" ); } diff --git a/src/misc/netutils.c b/src/misc/netutils.c index 67990c27a2..cfa3214c46 100644 --- a/src/misc/netutils.c +++ b/src/misc/netutils.c @@ -2,7 +2,7 @@ * netutils.c: various network functions ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: netutils.c,v 1.34 2001/05/30 17:03:12 sam Exp $ + * $Id: netutils.c,v 1.35 2001/05/30 23:02:04 stef Exp $ * * Authors: Vincent Seguin * Benoit Steiner @@ -256,8 +256,10 @@ int network_ChannelJoin( int i_channel ) char i_answer; fd_set fd; unsigned int i_rc; + char * psz_channel_server; - if( ! p_main->b_channels ) + if( !main_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR, + INPUT_NETWORK_CHANNEL_DEFAULT ) ) { intf_ErrMsg( "network: channels disabled, to enable them, use the" "--channels option" ); @@ -269,14 +271,14 @@ int network_ChannelJoin( int i_channel ) /* If last change is too recent, wait a while */ if( mdate() - p_main->p_channel->last_change < INPUT_CHANNEL_CHANGE_DELAY ) { - intf_Msg( "network: waiting before changing channel" ); + intf_WarnMsg( 2, "network: waiting before changing channel" ); mwait( p_main->p_channel->last_change + INPUT_CHANNEL_CHANGE_DELAY ); } p_main->p_channel->last_change = mdate(); p_main->p_channel->i_channel = i_channel; - intf_Msg( "network: joining channel %d", i_channel ); + intf_WarnMsg( 2, "network: joining channel %d", i_channel ); /* * Initializing the socket @@ -286,14 +288,25 @@ int network_ChannelJoin( int i_channel ) /* * Getting the server's information */ + intf_WarnMsg( 6, "Channel server: %s port: %d", + main_GetPszVariable( INPUT_CHANNEL_SERVER_VAR, + INPUT_CHANNEL_SERVER_DEFAULT ), + main_GetIntVariable( INPUT_CHANNEL_PORT_VAR, + INPUT_CHANNEL_PORT_DEFAULT ) ); + memset( &sa_server, 0x00, sizeof(struct sockaddr_in) ); sa_server.sin_family = AF_INET; - sa_server.sin_port = htons( INPUT_CHANNEL_PORT_DEFAULT ); + sa_server.sin_port = htons( main_GetIntVariable( INPUT_CHANNEL_PORT_VAR, + INPUT_CHANNEL_PORT_DEFAULT ) ); + + psz_channel_server = strdup( main_GetPszVariable( INPUT_CHANNEL_SERVER_VAR, + INPUT_CHANNEL_SERVER_DEFAULT ) ); #ifdef HAVE_ARPA_INET_H - inet_aton( INPUT_CHANNEL_SERVER_DEFAULT, &sa_server.sin_addr ); + inet_aton( psz_channel_server, &sa_server.sin_addr ); #else - sa_server.sin_addr.s_addr = inet_addr( INPUT_CHANNEL_SERVER_DEFAULT ); + sa_server.sin_addr.s_addr = inet_addr( psz_channel_server ); #endif + free( psz_channel_server ); /* * Looking for the interface MAC address -- 2.11.4.GIT