Commit a53ff165 authored by Sam Hocevar's avatar Sam Hocevar

  * ./plugins/gtk/gtk.c: the log window is now black with colourful text.
  * ./plugins/gtk/gnome.c: ported the log window to the GNOME interface.
  * ./src/interface/intf_msg.c: messages are sent to the queue even if
    -vvvv* wasn't specified.
parent 9400b572
......@@ -2,7 +2,7 @@
* gnome.c : Gnome plugin for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: gnome.c,v 1.10 2002/02/19 00:50:19 sam Exp $
* $Id: gnome.c,v 1.11 2002/02/20 05:56:17 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -141,6 +141,8 @@ static int intf_Open( intf_thread_t *p_intf )
return( 1 );
}
p_intf->p_sys->p_sub = intf_MsgSub();
/* Initialize Gnome thread */
p_intf->p_sys->b_playing = 0;
p_intf->p_sys->b_popup_changed = 0;
......@@ -160,6 +162,8 @@ static int intf_Open( intf_thread_t *p_intf )
*****************************************************************************/
static void intf_Close( intf_thread_t *p_intf )
{
intf_MsgUnsub( p_intf->p_sys->p_sub );
/* Destroy structure */
free( p_intf->p_sys );
}
......@@ -195,6 +199,7 @@ static void intf_Run( intf_thread_t *p_intf )
p_intf->p_sys->p_window = create_intf_window( );
p_intf->p_sys->p_popup = create_intf_popup( );
p_intf->p_sys->p_playlist = create_intf_playlist();
p_intf->p_sys->p_messages = create_intf_messages();
/* Set the title of the main window */
gtk_window_set_title( GTK_WINDOW(p_intf->p_sys->p_window),
......@@ -210,9 +215,17 @@ static void intf_Run( intf_thread_t *p_intf )
GTK_DEST_DEFAULT_ALL, target_table,
1, GDK_ACTION_COPY );
/* Get the interface labels */
/* Get the slider object */
p_intf->p_sys->p_slider_frame = gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_window ), "slider_frame" );
/* Configure the log window */
p_intf->p_sys->p_messages_text = GTK_TEXT( gtk_object_get_data(
GTK_OBJECT(p_intf->p_sys->p_messages ), "messages_textbox" ) );
gtk_text_set_line_wrap( p_intf->p_sys->p_messages_text, TRUE);
gtk_text_set_word_wrap( p_intf->p_sys->p_messages_text, FALSE);
/* Get the interface labels */
#define P_LABEL( name ) GTK_LABEL( gtk_object_get_data( \
GTK_OBJECT( p_intf->p_sys->p_window ), name ) )
p_intf->p_sys->p_label_title = P_LABEL( "title_label" );
......@@ -248,6 +261,9 @@ static void intf_Run( intf_thread_t *p_intf )
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_playlist ),
"p_intf", p_intf );
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_messages ),
"p_intf", p_intf );
gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_adj),
"p_intf", p_intf );
......@@ -284,6 +300,12 @@ static void intf_Run( intf_thread_t *p_intf )
static gint GnomeManage( gpointer p_data )
{
#define p_intf ((intf_thread_t *)p_data)
static GdkColor white = { 0, 0xffff, 0xffff, 0xffff };
static GdkColor red = { 0, 0xffff, 0x6666, 0x6666 };
static GdkColor gray = { 0, 0xaaaa, 0xaaaa, 0xaaaa };
GdkColor *p_color;
int i_start, i_stop;
vlc_mutex_lock( &p_intf->change_lock );
......@@ -302,7 +324,46 @@ static gint GnomeManage( gpointer p_data )
p_intf->b_menu_change = 0;
}
/* update the playlist */
/* Update the log window */
vlc_mutex_lock( p_intf->p_sys->p_sub->p_lock );
i_stop = *p_intf->p_sys->p_sub->pi_stop;
vlc_mutex_unlock( p_intf->p_sys->p_sub->p_lock );
if( p_intf->p_sys->p_sub->i_start != i_stop )
{
for( i_start = p_intf->p_sys->p_sub->i_start;
i_start != i_stop;
i_start = (i_start+1) % INTF_MSG_QSIZE )
{
/* Append all messages to log window */
switch( p_intf->p_sys->p_sub->p_msg[i_start].i_type )
{
case INTF_MSG_ERR:
p_color = &red;
break;
case INTF_MSG_WARN:
p_color = &gray;
break;
default:
p_color = &white;
break;
}
gtk_text_insert( p_intf->p_sys->p_messages_text, NULL, p_color,
NULL, p_intf->p_sys->p_sub->p_msg[i_start].psz_msg, -1 );
gtk_text_insert( p_intf->p_sys->p_messages_text, NULL, p_color,
NULL, "\n", -1 );
}
vlc_mutex_lock( p_intf->p_sys->p_sub->p_lock );
p_intf->p_sys->p_sub->i_start = i_start;
vlc_mutex_unlock( p_intf->p_sys->p_sub->p_lock );
gtk_text_set_point( p_intf->p_sys->p_messages_text,
gtk_text_get_length( p_intf->p_sys->p_messages_text ) );
}
/* Update the playlist */
GtkPlayListManage( p_intf );
if( p_input_bank->pp_input[0] != NULL && !p_intf->b_die )
......
......@@ -267,6 +267,19 @@
<right_justify>False</right_justify>
<stock_icon>GNOME_STOCK_MENU_ATTACH</stock_icon>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>menubar_messages</name>
<tooltip>Open the messages window</tooltip>
<signal>
<name>activate</name>
<handler>GnomeMenubarMessagesActivate</handler>
<last_modification_time>Wed, 20 Feb 2002 05:43:55 GMT</last_modification_time>
</signal>
<label>Messages...</label>
<right_justify>False</right_justify>
</widget>
</widget>
</widget>
......@@ -5366,4 +5379,99 @@ Stereo
</widget>
</widget>
<widget>
<class>GnomeDialog</class>
<name>intf_messages</name>
<signal>
<name>destroy</name>
<handler>gtk_widget_hide</handler>
<data>&quot;intf_playlist&quot;</data>
<last_modification_time>Wed, 20 Feb 2002 05:11:27 GMT</last_modification_time>
</signal>
<signal>
<name>delete_event</name>
<handler>gtk_widget_hide</handler>
<data>&quot;intf_playlist&quot;</data>
<last_modification_time>Wed, 20 Feb 2002 05:11:27 GMT</last_modification_time>
</signal>
<title>Messages</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>True</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<auto_close>False</auto_close>
<hide_on_close>True</hide_on_close>
<widget>
<class>GtkVBox</class>
<child_name>GnomeDialog:vbox</child_name>
<name>dialog-vbox6</name>
<homogeneous>False</homogeneous>
<spacing>8</spacing>
<child>
<padding>4</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHButtonBox</class>
<child_name>GnomeDialog:action_area</child_name>
<name>dialog-action_area6</name>
<layout_style>GTK_BUTTONBOX_END</layout_style>
<spacing>8</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkButton</class>
<name>messages_ok</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>GtkMessagesOk</handler>
<data>&quot;intf_messages&quot;</data>
<last_modification_time>Wed, 20 Feb 2002 05:12:11 GMT</last_modification_time>
</signal>
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
</widget>
</widget>
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow1</name>
<hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkText</class>
<name>messages_textbox</name>
<width>600</width>
<height>400</height>
<can_focus>True</can_focus>
<editable>False</editable>
<text></text>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>
......@@ -265,3 +265,12 @@ GnomePopupJumpActivate (GtkMenuItem *menuitem,
{
GtkJumpShow( GTK_WIDGET( menuitem ), NULL, "intf_popup" );
}
void
GnomeMenubarMessagesActivate (GtkMenuItem *menuitem,
gpointer user_data)
{
GtkMessagesShow( GTK_WIDGET( menuitem ), NULL, "intf_window" );
}
......@@ -146,3 +146,7 @@ void
GtkNetworkOpenChannel (GtkToggleButton *togglebutton,
gpointer user_data);
void
GnomeMenubarMessagesActivate (GtkMenuItem *menuitem,
gpointer user_data);
......@@ -102,6 +102,13 @@ static GnomeUIInfo menubar_view_menu_uiinfo[] =
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ATTACH,
0, (GdkModifierType) 0, NULL
},
{
GNOME_APP_UI_ITEM, N_("Messages..."),
N_("Open the messages window"),
(gpointer) GnomeMenubarMessagesActivate, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL
},
GNOMEUIINFO_END
};
......@@ -297,6 +304,11 @@ create_intf_window (void)
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_set_sensitive (menubar_view_menu_uiinfo[8].widget, FALSE);
gtk_widget_ref (menubar_view_menu_uiinfo[9].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_messages",
menubar_view_menu_uiinfo[9].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (menubar_uiinfo[2].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_settings",
menubar_uiinfo[2].widget,
......@@ -3494,3 +3506,65 @@ create_intf_open (void)
return intf_open;
}
GtkWidget*
create_intf_messages (void)
{
GtkWidget *intf_messages;
GtkWidget *dialog_vbox6;
GtkWidget *scrolledwindow1;
GtkWidget *messages_textbox;
GtkWidget *dialog_action_area6;
GtkWidget *messages_ok;
intf_messages = gnome_dialog_new (_("Messages"), NULL);
gtk_object_set_data (GTK_OBJECT (intf_messages), "intf_messages", intf_messages);
gtk_window_set_policy (GTK_WINDOW (intf_messages), TRUE, TRUE, FALSE);
gnome_dialog_close_hides (GNOME_DIALOG (intf_messages), TRUE);
dialog_vbox6 = GNOME_DIALOG (intf_messages)->vbox;
gtk_object_set_data (GTK_OBJECT (intf_messages), "dialog_vbox6", dialog_vbox6);
gtk_widget_show (dialog_vbox6);
scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_ref (scrolledwindow1);
gtk_object_set_data_full (GTK_OBJECT (intf_messages), "scrolledwindow1", scrolledwindow1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (scrolledwindow1);
gtk_box_pack_start (GTK_BOX (dialog_vbox6), scrolledwindow1, TRUE, TRUE, 0);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
messages_textbox = gtk_text_new (NULL, NULL);
gtk_widget_ref (messages_textbox);
gtk_object_set_data_full (GTK_OBJECT (intf_messages), "messages_textbox", messages_textbox,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (messages_textbox);
gtk_container_add (GTK_CONTAINER (scrolledwindow1), messages_textbox);
gtk_widget_set_usize (messages_textbox, 600, 400);
dialog_action_area6 = GNOME_DIALOG (intf_messages)->action_area;
gtk_object_set_data (GTK_OBJECT (intf_messages), "dialog_action_area6", dialog_action_area6);
gtk_widget_show (dialog_action_area6);
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area6), GTK_BUTTONBOX_END);
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area6), 8);
gnome_dialog_append_button (GNOME_DIALOG (intf_messages), GNOME_STOCK_BUTTON_OK);
messages_ok = GTK_WIDGET (g_list_last (GNOME_DIALOG (intf_messages)->buttons)->data);
gtk_widget_ref (messages_ok);
gtk_object_set_data_full (GTK_OBJECT (intf_messages), "messages_ok", messages_ok,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (messages_ok);
GTK_WIDGET_SET_FLAGS (messages_ok, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (intf_messages), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_hide),
"intf_playlist");
gtk_signal_connect (GTK_OBJECT (intf_messages), "delete_event",
GTK_SIGNAL_FUNC (gtk_widget_hide),
"intf_playlist");
gtk_signal_connect (GTK_OBJECT (messages_ok), "clicked",
GTK_SIGNAL_FUNC (GtkMessagesOk),
"intf_messages");
return intf_messages;
}
......@@ -13,3 +13,4 @@ GtkWidget* create_intf_playlist (void);
GtkWidget* create_intf_jump (void);
GtkWidget* create_intf_preferences (void);
GtkWidget* create_intf_open (void);
GtkWidget* create_intf_messages (void);
......@@ -2,7 +2,7 @@
* gtk.c : Gtk+ plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: gtk.c,v 1.12 2002/02/19 03:54:55 sam Exp $
* $Id: gtk.c,v 1.13 2002/02/20 05:56:17 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -218,13 +218,15 @@ static void intf_Run( intf_thread_t *p_intf )
GTK_DEST_DEFAULT_ALL, target_table,
1, GDK_ACTION_COPY );
/* Get the slider object */
p_intf->p_sys->p_slider_frame = GTK_FRAME( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_window ), "slider_frame" ) );
/* Configure the log window */
p_intf->p_sys->p_messages_text = GTK_TEXT( gtk_object_get_data(
GTK_OBJECT(p_intf->p_sys->p_messages ), "messages_textbox" ) );
gtk_text_set_line_wrap( p_intf->p_sys->p_messages_text, TRUE);
gtk_text_set_word_wrap( p_intf->p_sys->p_messages_text, TRUE);
gtk_text_set_word_wrap( p_intf->p_sys->p_messages_text, FALSE);
/* Get the interface labels */
#define P_LABEL( name ) GTK_LABEL( gtk_object_get_data( \
......@@ -301,6 +303,11 @@ static void intf_Run( intf_thread_t *p_intf )
static gint GtkManage( gpointer p_data )
{
#define p_intf ((intf_thread_t *)p_data)
static GdkColor white = { 0, 0xffff, 0xffff, 0xffff };
static GdkColor red = { 0, 0xffff, 0x6666, 0x6666 };
static GdkColor gray = { 0, 0xaaaa, 0xaaaa, 0xaaaa };
GdkColor *p_color;
int i_start, i_stop;
vlc_mutex_lock( &p_intf->change_lock );
......@@ -324,23 +331,39 @@ static gint GtkManage( gpointer p_data )
i_stop = *p_intf->p_sys->p_sub->pi_stop;
vlc_mutex_unlock( p_intf->p_sys->p_sub->p_lock );
for( i_start = p_intf->p_sys->p_sub->i_start;
i_start != i_stop;
i_start = (i_start+1) % INTF_MSG_QSIZE )
if( p_intf->p_sys->p_sub->i_start != i_stop )
{
/* Append all messages to log window */
gtk_text_insert( p_intf->p_sys->p_messages_text, NULL, NULL, NULL,
p_intf->p_sys->p_sub->p_msg[i_start].psz_msg, -1 );
gtk_text_insert( p_intf->p_sys->p_messages_text, NULL, NULL, NULL,
"\n", -1 );
}
for( i_start = p_intf->p_sys->p_sub->i_start;
i_start != i_stop;
i_start = (i_start+1) % INTF_MSG_QSIZE )
{
/* Append all messages to log window */
switch( p_intf->p_sys->p_sub->p_msg[i_start].i_type )
{
case INTF_MSG_ERR:
p_color = &red;
break;
case INTF_MSG_WARN:
p_color = &gray;
break;
default:
p_color = &white;
break;
}
vlc_mutex_lock( p_intf->p_sys->p_sub->p_lock );
p_intf->p_sys->p_sub->i_start = i_start;
vlc_mutex_unlock( p_intf->p_sys->p_sub->p_lock );
gtk_text_insert( p_intf->p_sys->p_messages_text, NULL, p_color,
NULL, p_intf->p_sys->p_sub->p_msg[i_start].psz_msg, -1 );
gtk_text_insert( p_intf->p_sys->p_messages_text, NULL, p_color,
NULL, "\n", -1 );
}
gtk_text_set_point( p_intf->p_sys->p_messages_text,
gtk_text_get_length( p_intf->p_sys->p_messages_text ) );
vlc_mutex_lock( p_intf->p_sys->p_sub->p_lock );
p_intf->p_sys->p_sub->i_start = i_start;
vlc_mutex_unlock( p_intf->p_sys->p_sub->p_lock );
gtk_text_set_point( p_intf->p_sys->p_messages_text,
gtk_text_get_length( p_intf->p_sys->p_messages_text ) );
}
/* Update the playlist */
GtkPlayListManage( p_data );
......
......@@ -2,7 +2,7 @@
* gtk_callbacks.c : Callbacks for the Gtk+ plugin.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_callbacks.c,v 1.32 2002/02/19 03:54:55 sam Exp $
* $Id: gtk_callbacks.c,v 1.33 2002/02/20 05:56:17 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr>
......@@ -532,9 +532,21 @@ gboolean GtkMessagesShow( GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
static GdkColor black = { 0, 0x0000, 0x0000, 0x0000 };
static GdkColormap *colormap;
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
gtk_widget_show( p_intf->p_sys->p_messages );
colormap = gdk_colormap_get_system ();
gdk_color_alloc( colormap, &black );
gdk_window_set_background( p_intf->p_sys->p_messages_text->text_area,
&black );
gdk_window_raise( p_intf->p_sys->p_messages->window );
gtk_text_set_point( p_intf->p_sys->p_messages_text,
gtk_text_get_length( p_intf->p_sys->p_messages_text ) );
return TRUE;
}
......
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
/* This file was created automatically by glade and fixed by fixfiles.sh */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <videolan/vlc.h>
#include <sys/types.h>
#include <sys/stat.h>
......@@ -1585,7 +1581,7 @@ create_intf_disc (void)
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (disc_name);
gtk_box_pack_start (GTK_BOX (hbox2), disc_name, TRUE, TRUE, 0);
gtk_entry_set_text (GTK_ENTRY (disc_name), _("/dev/dvd"));
gtk_entry_set_text (GTK_ENTRY (disc_name), DVD_DEVICE);
dialog_action_area1 = GTK_DIALOG (intf_disc)->action_area;
gtk_object_set_data (GTK_OBJECT (intf_disc), "dialog_action_area1", dialog_action_area1);
......@@ -2531,7 +2527,7 @@ create_intf_preferences (void)
gtk_table_attach (GTK_TABLE (preferences_disc_table), preferences_disc_dvd_combo, 1, 2, 0, 1,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (GTK_EXPAND), 0, 0);
preferences_disc_dvd_combo_items = g_list_append (preferences_disc_dvd_combo_items, (gpointer) _("/dev/dvd"));
preferences_disc_dvd_combo_items = g_list_append (preferences_disc_dvd_combo_items, (gpointer) DVD_DEVICE);
gtk_combo_set_popdown_strings (GTK_COMBO (preferences_disc_dvd_combo), preferences_disc_dvd_combo_items);
g_list_free (preferences_disc_dvd_combo_items);
......@@ -2540,7 +2536,7 @@ create_intf_preferences (void)
gtk_object_set_data_full (GTK_OBJECT (intf_preferences), "preferences_disc_dvd_entry", preferences_disc_dvd_entry,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preferences_disc_dvd_entry);
gtk_entry_set_text (GTK_ENTRY (preferences_disc_dvd_entry), _("/dev/dvd"));
gtk_entry_set_text (GTK_ENTRY (preferences_disc_dvd_entry), DVD_DEVICE);
preferences_disc_vcd_combo = gtk_combo_new ();
gtk_widget_ref (preferences_disc_vcd_combo);
......
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
* This file was created automatically by glade and fixed by fixfiles.sh
*/
#ifdef HAVE_CONFIG_H
......@@ -11,7 +11,7 @@
/*
* Standard gettext macros.
*/
#ifdef ENABLE_NLS
#if defined( ENABLE_NLS ) && defined ( HAVE_GETTEXT )
# include <libintl.h>
# undef _
# define _(String) dgettext (PACKAGE, String)
......
......@@ -2,7 +2,7 @@
* lirc.c : lirc plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: lirc.c,v 1.5 2002/02/20 01:47:01 sam Exp $
* $Id: lirc.c,v 1.6 2002/02/20 05:56:18 sam Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
......@@ -145,7 +145,6 @@ static void intf_Run( intf_thread_t *p_intf )
while( !p_intf->b_die && lirc_nextcode(&code) == 0 )
{
printf("code\n");
if( code == NULL )
{
continue;
......@@ -270,6 +269,5 @@ printf("code\n");
/* Manage core vlc functions through the callback */
p_intf->pf_manage( p_intf );
}
printf("end of intf\n");
}
......@@ -2,7 +2,7 @@
* logger.c : file logging plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: logger.c,v 1.2 2002/02/19 03:54:56 sam Exp $
* $Id: logger.c,v 1.3 2002/02/20 05:56:18 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -187,18 +187,21 @@ static void FlushQueue( intf_subscription_t *p_sub, FILE *p_file )
i_stop = *p_sub->pi_stop;
vlc_mutex_unlock( p_sub->p_lock );
/* Append all messages to log file */
for( i_start = p_sub->i_start;
i_start != i_stop;
i_start = (i_start+1) % INTF_MSG_QSIZE )
if( p_sub->i_start != i_stop )
{
psz_msg = p_sub->p_msg[i_start].psz_msg;
LOG_STRING( psz_msg, p_file );
LOG_STRING( "\n", p_file );
/* Append all messages to log file */
for( i_start = p_sub->i_start;
i_start != i_stop;
i_start = (i_start+1) % INTF_MSG_QSIZE )
{
psz_msg = p_sub->p_msg[i_start].psz_msg;
LOG_STRING( psz_msg, p_file );
LOG_STRING( "\n", p_file );
}
vlc_mutex_lock( p_sub->p_lock );
p_sub->i_start = i_start;
vlc_mutex_unlock( p_sub->p_lock );
}
vlc_mutex_lock( p_sub->p_lock );
p_sub->i_start = i_start;
vlc_mutex_unlock( p_sub->p_lock );
}
......@@ -4,7 +4,7 @@
* interface, such as message output. See config.h for output configuration.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: intf_msg.c,v 1.44 2002/02/19 03:54:56 sam Exp $
* $Id: intf_msg.c,v 1.45 2002/02/20 05:56:18 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -69,8 +69,8 @@ msg_bank_t msg_bank;
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static void QueueMsg ( int, char *, va_list );
static void FlushLockedMsg ( void );
static void QueueMsg ( int, int, char *, va_list );
static void FlushMsg ( void );
#if defined( WIN32 )
static char *ConvertPrintfFormatString ( char *psz_format );
......@@ -111,7 +111,7 @@ void intf_MsgDestroy( void )
}
/* Free remaining messages */
FlushLockedMsg( );
FlushMsg( );
}
/*****************************************************************************
......@@ -190,7 +190,7 @@ void intf_Msg( char *psz_format, ... )
va_list ap;
va_start( ap, psz_format );
QueueMsg( INTF_MSG_STD, psz_format, ap );
QueueMsg( INTF_MSG_STD, 0, psz_format, ap );
va_end( ap );
}
......@@ -205,7 +205,7 @@ void intf_ErrMsg( char *psz_format, ... )
va_list ap;
va_start( ap, psz_format );
QueueMsg( INTF_MSG_ERR, psz_format, ap );
QueueMsg( INTF_MSG_ERR, 0, psz_format, ap );
va_end( ap );
}
......@@ -219,12 +219,9 @@ void intf_WarnMsg( int i_level, char *psz_format, ... )
{
va_list ap;
if( i_level <= p_main->i_warning_level )
{
va_start( ap, psz_format );
QueueMsg( INTF_MSG_WARN, psz_format, ap );
va_end( ap );
}
va_start( ap, psz_format );
QueueMsg( INTF_MSG_WARN, i_level, psz_format, ap );
va_end( ap );
}
/*****************************************************************************
......@@ -240,7 +237,7 @@ void intf_StatMsg( char *psz_format, ... )
if( p_main->b_stats )
{
va_start( ap, psz_format );
QueueMsg( INTF_MSG_STAT, psz_format, ap );
QueueMsg( INTF_MSG_STAT, 0, psz_format, ap );
va_end( ap );
}
}
......@@ -292,7 +289,7 @@ void intf_WarnHexDump( int i_level, void *p_data, int i_size )
* is full. If the message can't be converted to string in memory, it exit the
* program. If the queue is not used, it prints the message immediately.
*****************************************************************************/
static void QueueMsg( int i_type, char *psz_format, va_list ap )
static void QueueMsg( int i_type, int i_level, char *psz_format, va_list ap )
{
char * psz_str; /* formatted message string */
msg_item_t * p_item; /* pointer to message */
......@@ -332,11 +329,15 @@ static void QueueMsg( int i_type, char *psz_format, va_list ap )
vlc_mutex_lock( &msg_bank.lock );
/* Send the message to stderr */
fprintf( stderr, "%s\n", psz_str );
if( i_level <= p_main->i_warning_level )
{
fprintf( stderr, "%s\n", psz_str );
}
/* Put the message in the queue if there is room for it */
if( ((msg_bank.i_stop - msg_bank.i_start + 1) % INTF_MSG_QSIZE) == 0 )
{
FlushLockedMsg( );
FlushMsg( );
if( ((msg_bank.i_stop - msg_bank.i_start + 1) % INTF_MSG_QSIZE) == 0 )
{
......@@ -357,12 +358,12 @@ static void QueueMsg( int i_type, char *psz_format, va_list ap )
}
/*****************************************************************************
* FlushLockedMsg (ok ?)
* FlushMsg
*****************************************************************************
* Print all messages remaining in queue. MESSAGE QUEUE MUST BE LOCKED, since
* this function does not check the lock.
*****************************************************************************/
static void FlushLockedMsg ( void )
static void FlushMsg ( void )
{
int i_index, i_start, i_stop;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment