vlc_messages.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * messages.h: messages interface
00003  * This library provides basic functions for threads to interact with user
00004  * interface, such as message output.
00005  *****************************************************************************
00006  * Copyright (C) 1999, 2000, 2001, 2002 the VideoLAN team
00007  * $Id: b03ff3ecfbdc5e8de33d2e7bc4299848b92b7c65 $
00008  *
00009  * Authors: Vincent Seguin <seguin@via.ecp.fr>
00010  *          Samuel Hocevar <sam@zoy.org>
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00025  *****************************************************************************/
00026 
00027 #ifndef VLC_MESSAGES_H_
00028 #define VLC_MESSAGES_H_
00029 
00030 /**
00031  * \file
00032  * This file defines structures and functions to handle messages and statistics gathering
00033  */
00034 
00035 #include <stdarg.h>
00036 
00037 /**
00038  * \defgroup messages Messages
00039  * This library provides basic functions for threads to interact with user
00040  * interface, such as message output.
00041  *
00042  * @{
00043  */
00044 
00045 /**
00046  * Store a single message sent to user.
00047  */
00048 typedef struct
00049 {
00050     int     i_type;                             /**< message type, see below */
00051     uintptr_t   i_object_id;
00052     const char *psz_object_type;
00053     char *  psz_module;
00054     char *  psz_msg;                            /**< the message itself */
00055     char *  psz_header;                         /**< Additional header */
00056 
00057     mtime_t date;                               /**< Message date */
00058     gc_object_t vlc_gc_data;
00059 } msg_item_t;
00060 
00061 /* Message types */
00062 /** standard messages */
00063 #define VLC_MSG_INFO  0
00064 /** error messages */
00065 #define VLC_MSG_ERR   1
00066 /** warning messages */
00067 #define VLC_MSG_WARN  2
00068 /** debug messages */
00069 #define VLC_MSG_DBG   3
00070 
00071 static inline msg_item_t *msg_Hold (msg_item_t *msg)
00072 {
00073     vlc_hold (&msg->vlc_gc_data);
00074     return msg;
00075 }
00076 
00077 static inline void msg_Release (msg_item_t *msg)
00078 {
00079     vlc_release (&msg->vlc_gc_data);
00080 }
00081 
00082 /**
00083  * Used by interface plugins which subscribe to the message bank.
00084  */
00085 typedef struct msg_subscription_t msg_subscription_t;
00086 
00087 /*****************************************************************************
00088  * Prototypes
00089  *****************************************************************************/
00090 VLC_EXPORT( void, __msg_Generic, ( vlc_object_t *, int, const char *, const char *, ... ) LIBVLC_FORMAT( 4, 5 ) );
00091 VLC_EXPORT( void, __msg_GenericVa, ( vlc_object_t *, int, const char *, const char *, va_list args ) );
00092 #define msg_GenericVa(a, b, c, d, e) __msg_GenericVa(VLC_OBJECT(a), b, c, d, e)
00093 
00094 #define msg_Info( p_this, ... ) \
00095       __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_INFO, \
00096                      MODULE_STRING, __VA_ARGS__ )
00097 #define msg_Err( p_this, ... ) \
00098       __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_ERR, \
00099                      MODULE_STRING, __VA_ARGS__ )
00100 #define msg_Warn( p_this, ... ) \
00101       __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_WARN, \
00102                      MODULE_STRING, __VA_ARGS__ )
00103 #define msg_Dbg( p_this, ... ) \
00104       __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_DBG, \
00105                      MODULE_STRING, __VA_ARGS__ )
00106 
00107 typedef struct msg_cb_data_t msg_cb_data_t;
00108 
00109 /**
00110  * Message logging callback signature.
00111  * Accepts one private data pointer, the message, and an overrun counter.
00112  */
00113 typedef void (*msg_callback_t) (msg_cb_data_t *, msg_item_t *, unsigned);
00114 
00115 VLC_EXPORT( msg_subscription_t*, msg_Subscribe, ( libvlc_int_t *, msg_callback_t, msg_cb_data_t * ) );
00116 VLC_EXPORT( void, msg_Unsubscribe, ( msg_subscription_t * ) );
00117 
00118 /* Enable or disable a certain object debug messages */
00119 #define msg_EnableObjectPrinting(a,b) __msg_EnableObjectPrinting(VLC_OBJECT(a),b)
00120 #define msg_DisableObjectPrinting(a,b) __msg_DisableObjectPrinting(VLC_OBJECT(a),b)
00121 VLC_EXPORT( void, __msg_EnableObjectPrinting, ( vlc_object_t *, char * psz_object ) );
00122 VLC_EXPORT( void, __msg_DisableObjectPrinting, ( vlc_object_t *, char * psz_object ) );
00123 
00124 /**
00125  * @}
00126  */
00127 
00128 /**
00129  * \defgroup statistics Statistics
00130  *
00131  * @{
00132  */
00133 
00134 /****************************
00135  * Generic stats stuff
00136  ****************************/
00137 enum
00138 {
00139     STATS_LAST,
00140     STATS_COUNTER,
00141     STATS_MAX,
00142     STATS_MIN,
00143     STATS_DERIVATIVE,
00144     STATS_TIMER
00145 };
00146 
00147 struct counter_sample_t
00148 {
00149     vlc_value_t value;
00150     mtime_t     date;
00151 };
00152 
00153 struct counter_t
00154 {
00155     unsigned int        i_id;
00156     char              * psz_name;
00157     int                 i_type;
00158     void              * p_obj;
00159     int                 i_compute_type;
00160     int                 i_samples;
00161     counter_sample_t ** pp_samples;
00162 
00163     mtime_t             update_interval;
00164     mtime_t             last_update;
00165 };
00166 
00167 enum
00168 {
00169     STATS_INPUT_BITRATE,
00170     STATS_READ_BYTES,
00171     STATS_READ_PACKETS,
00172     STATS_DEMUX_READ,
00173     STATS_DEMUX_BITRATE,
00174     STATS_DEMUX_CORRUPTED,
00175     STATS_DEMUX_DISCONTINUITY,
00176     STATS_PLAYED_ABUFFERS,
00177     STATS_LOST_ABUFFERS,
00178     STATS_DECODED_AUDIO,
00179     STATS_DECODED_VIDEO,
00180     STATS_DECODED_SUB,
00181     STATS_CLIENT_CONNECTIONS,
00182     STATS_ACTIVE_CONNECTIONS,
00183     STATS_SOUT_SENT_PACKETS,
00184     STATS_SOUT_SENT_BYTES,
00185     STATS_SOUT_SEND_BITRATE,
00186     STATS_DISPLAYED_PICTURES,
00187     STATS_LOST_PICTURES,
00188 
00189     STATS_TIMER_PLAYLIST_BUILD,
00190     STATS_TIMER_ML_LOAD,
00191     STATS_TIMER_ML_DUMP,
00192     STATS_TIMER_INTERACTION,
00193     STATS_TIMER_PREPARSE,
00194     STATS_TIMER_INPUT_LAUNCHING,
00195     STATS_TIMER_MODULE_NEED,
00196     STATS_TIMER_VIDEO_FRAME_ENCODING,
00197     STATS_TIMER_AUDIO_FRAME_ENCODING,
00198 
00199     STATS_TIMER_SKINS_PLAYTREE_IMAGE,
00200 };
00201 
00202 /*********
00203  * Timing
00204  ********/
00205 #define stats_TimerStart(a,b,c) __stats_TimerStart( VLC_OBJECT(a), b,c )
00206 #define stats_TimerStop(a,b) __stats_TimerStop( VLC_OBJECT(a), b )
00207 #define stats_TimerDump(a,b) __stats_TimerDump( VLC_OBJECT(a), b )
00208 #define stats_TimersDumpAll(a) __stats_TimersDumpAll( VLC_OBJECT(a) )
00209 VLC_EXPORT( void,__stats_TimerStart, (vlc_object_t*, const char *, unsigned int ) );
00210 VLC_EXPORT( void,__stats_TimerStop, (vlc_object_t*, unsigned int) );
00211 VLC_EXPORT( void,__stats_TimerDump, (vlc_object_t*, unsigned int) );
00212 VLC_EXPORT( void,__stats_TimersDumpAll, (vlc_object_t*) );
00213 #define stats_TimersCleanAll(a) __stats_TimersCleanAll( VLC_OBJECT(a) )
00214 VLC_EXPORT( void, __stats_TimersCleanAll, (vlc_object_t * ) );
00215 
00216 #define stats_TimerClean(a,b) __stats_TimerClean( VLC_OBJECT(a), b )
00217 VLC_EXPORT( void, __stats_TimerClean, (vlc_object_t *, unsigned int ) );
00218 
00219 /**
00220  * @}
00221  */
00222 #endif

Generated on Fri Nov 20 08:04:56 2009 for VLC by  doxygen 1.5.6