1 /*****************************************************************************
2 * messages.h: messages interface
3 * This library provides basic functions for threads to interact with user
4 * interface, such as message output.
5 *****************************************************************************
6 * Copyright (C) 1999, 2000, 2001, 2002 the VideoLAN team
9 * Authors: Vincent Seguin <seguin@via.ecp.fr>
10 * Samuel Hocevar <sam@zoy.org>
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25 *****************************************************************************/
27 #ifndef VLC_MESSAGES_H_
28 #define VLC_MESSAGES_H_
32 * This file defines structures and functions to handle messages and statistics gathering
38 * \defgroup messages Messages
39 * This library provides basic functions for threads to interact with user
40 * interface, such as message output.
48 VLC_MSG_INFO=0, /**< Important information */
49 VLC_MSG_ERR, /**< Error */
50 VLC_MSG_WARN, /**< Warning */
51 VLC_MSG_DBG, /**< Debug */
59 unsigned i_type; /**< Message type, see @ref msg_item_type */
60 uintptr_t i_object_id; /**< Emitter (temporaly) unique object ID or 0 */
61 const char *psz_object_type; /**< Emitter object type name */
62 const char *psz_module; /**< Emitter module (source code) */
63 const char *psz_header; /**< Additional header (used by VLM media) */
64 char *psz_msg; /**< Message text */
68 static inline msg_item_t *msg_Copy (const msg_item_t *msg)
70 msg_item_t *copy = (msg_item_t *)xmalloc (sizeof (*copy));
71 copy->i_type = msg->i_type;
72 copy->i_object_id = msg->i_object_id;
73 copy->psz_object_type = msg->psz_object_type;
74 copy->psz_module = strdup (msg->psz_module);
75 copy->psz_msg = strdup (msg->psz_msg);
76 copy->psz_header = msg->psz_header ? strdup (msg->psz_header) : NULL;
80 static inline void msg_Free (msg_item_t *msg)
82 free ((char *)msg->psz_module);
83 free ((char *)msg->psz_header);
89 * Used by interface plugins which subscribe to the message bank.
91 typedef struct msg_subscription_t msg_subscription_t;
93 /*****************************************************************************
95 *****************************************************************************/
96 VLC_API void vlc_Log(vlc_object_t *, int,
97 const char *, const char *, ...) VLC_FORMAT( 4, 5 );
98 VLC_API void vlc_vaLog(vlc_object_t *, int,
99 const char *, const char *, va_list);
100 #define msg_GenericVa(a, b, c, d, e) vlc_vaLog(VLC_OBJECT(a), b, c, d, e)
102 #define msg_Info( p_this, ... ) \
103 vlc_Log( VLC_OBJECT(p_this), VLC_MSG_INFO, MODULE_STRING, __VA_ARGS__ )
104 #define msg_Err( p_this, ... ) \
105 vlc_Log( VLC_OBJECT(p_this), VLC_MSG_ERR, MODULE_STRING, __VA_ARGS__ )
106 #define msg_Warn( p_this, ... ) \
107 vlc_Log( VLC_OBJECT(p_this), VLC_MSG_WARN, MODULE_STRING, __VA_ARGS__ )
108 #define msg_Dbg( p_this, ... ) \
109 vlc_Log( VLC_OBJECT(p_this), VLC_MSG_DBG, MODULE_STRING, __VA_ARGS__ )
112 * Message logging callback signature.
113 * Accepts one private data pointer, the message, and an overrun counter.
115 typedef void (*msg_callback_t) (void *, const msg_item_t *);
117 VLC_API msg_subscription_t *vlc_Subscribe(msg_callback_t, void *) VLC_USED;
118 VLC_API void vlc_Unsubscribe(msg_subscription_t *);
125 * \defgroup statistics Statistics
130 /****************************
131 * Generic stats stuff
132 ****************************/
143 struct counter_sample_t
157 counter_sample_t ** pp_samples;
159 mtime_t update_interval;
170 STATS_DEMUX_CORRUPTED,
171 STATS_DEMUX_DISCONTINUITY,
172 STATS_PLAYED_ABUFFERS,
177 STATS_CLIENT_CONNECTIONS,
178 STATS_ACTIVE_CONNECTIONS,
179 STATS_SOUT_SENT_PACKETS,
180 STATS_SOUT_SENT_BYTES,
181 STATS_SOUT_SEND_BITRATE,
182 STATS_DISPLAYED_PICTURES,
185 STATS_TIMER_PLAYLIST_BUILD,
188 STATS_TIMER_INTERACTION,
189 STATS_TIMER_PREPARSE,
190 STATS_TIMER_INPUT_LAUNCHING,
191 STATS_TIMER_MODULE_NEED,
192 STATS_TIMER_VIDEO_FRAME_ENCODING,
193 STATS_TIMER_AUDIO_FRAME_ENCODING,
195 STATS_TIMER_SKINS_PLAYTREE_IMAGE,
201 VLC_API void stats_TimerStart(vlc_object_t*, const char *, unsigned int );
202 VLC_API void stats_TimerStop(vlc_object_t*, unsigned int);
203 VLC_API void stats_TimerDump(vlc_object_t*, unsigned int);
204 VLC_API void stats_TimersDumpAll(vlc_object_t*);
205 #define stats_TimerStart(a,b,c) stats_TimerStart( VLC_OBJECT(a), b,c )
206 #define stats_TimerStop(a,b) stats_TimerStop( VLC_OBJECT(a), b )
207 #define stats_TimerDump(a,b) stats_TimerDump( VLC_OBJECT(a), b )
208 #define stats_TimersDumpAll(a) stats_TimersDumpAll( VLC_OBJECT(a) )
210 VLC_API void stats_TimersCleanAll(vlc_object_t * );
211 #define stats_TimersCleanAll(a) stats_TimersCleanAll( VLC_OBJECT(a) )
213 VLC_API void stats_TimerClean(vlc_object_t *, unsigned int );
214 #define stats_TimerClean(a,b) stats_TimerClean( VLC_OBJECT(a), b )