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: 6bfd5dada59612929362cab58d6cc87e235d4d70 $
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 * ) LIBVLC_USED );
00116 VLC_EXPORT( void, msg_Unsubscribe, ( msg_subscription_t * ) );
00117 VLC_EXPORT( void, msg_SubscriptionSetVerbosity, ( msg_subscription_t *, const int) );
00118 
00119 /* Enable or disable a certain object debug messages */
00120 VLC_EXPORT( void, msg_EnableObjectPrinting, ( vlc_object_t *, const char * psz_object ) );
00121 #define msg_EnableObjectPrinting(a,b) msg_EnableObjectPrinting(VLC_OBJECT(a),b)
00122 VLC_EXPORT( void, msg_DisableObjectPrinting, ( vlc_object_t *, const char * psz_object ) );
00123 #define msg_DisableObjectPrinting(a,b) msg_DisableObjectPrinting(VLC_OBJECT(a),b)
00124 
00125 
00126 /**
00127  * @}
00128  */
00129 
00130 /**
00131  * \defgroup statistics Statistics
00132  *
00133  * @{
00134  */
00135 
00136 /****************************
00137  * Generic stats stuff
00138  ****************************/
00139 enum
00140 {
00141     STATS_LAST,
00142     STATS_COUNTER,
00143     STATS_MAX,
00144     STATS_MIN,
00145     STATS_DERIVATIVE,
00146     STATS_TIMER
00147 };
00148 
00149 struct counter_sample_t
00150 {
00151     vlc_value_t value;
00152     mtime_t     date;
00153 };
00154 
00155 struct counter_t
00156 {
00157     unsigned int        i_id;
00158     char              * psz_name;
00159     int                 i_type;
00160     void              * p_obj;
00161     int                 i_compute_type;
00162     int                 i_samples;
00163     counter_sample_t ** pp_samples;
00164 
00165     mtime_t             update_interval;
00166     mtime_t             last_update;
00167 };
00168 
00169 enum
00170 {
00171     STATS_INPUT_BITRATE,
00172     STATS_READ_BYTES,
00173     STATS_READ_PACKETS,
00174     STATS_DEMUX_READ,
00175     STATS_DEMUX_BITRATE,
00176     STATS_DEMUX_CORRUPTED,
00177     STATS_DEMUX_DISCONTINUITY,
00178     STATS_PLAYED_ABUFFERS,
00179     STATS_LOST_ABUFFERS,
00180     STATS_DECODED_AUDIO,
00181     STATS_DECODED_VIDEO,
00182     STATS_DECODED_SUB,
00183     STATS_CLIENT_CONNECTIONS,
00184     STATS_ACTIVE_CONNECTIONS,
00185     STATS_SOUT_SENT_PACKETS,
00186     STATS_SOUT_SENT_BYTES,
00187     STATS_SOUT_SEND_BITRATE,
00188     STATS_DISPLAYED_PICTURES,
00189     STATS_LOST_PICTURES,
00190 
00191     STATS_TIMER_PLAYLIST_BUILD,
00192     STATS_TIMER_ML_LOAD,
00193     STATS_TIMER_ML_DUMP,
00194     STATS_TIMER_INTERACTION,
00195     STATS_TIMER_PREPARSE,
00196     STATS_TIMER_INPUT_LAUNCHING,
00197     STATS_TIMER_MODULE_NEED,
00198     STATS_TIMER_VIDEO_FRAME_ENCODING,
00199     STATS_TIMER_AUDIO_FRAME_ENCODING,
00200 
00201     STATS_TIMER_SKINS_PLAYTREE_IMAGE,
00202 };
00203 
00204 /*********
00205  * Timing
00206  ********/
00207 VLC_EXPORT( void, stats_TimerStart, (vlc_object_t*, const char *, unsigned int ) );
00208 VLC_EXPORT( void, stats_TimerStop, (vlc_object_t*, unsigned int) );
00209 VLC_EXPORT( void, stats_TimerDump, (vlc_object_t*, unsigned int) );
00210 VLC_EXPORT( void, stats_TimersDumpAll, (vlc_object_t*) );
00211 #define stats_TimerStart(a,b,c) stats_TimerStart( VLC_OBJECT(a), b,c )
00212 #define stats_TimerStop(a,b) stats_TimerStop( VLC_OBJECT(a), b )
00213 #define stats_TimerDump(a,b) stats_TimerDump( VLC_OBJECT(a), b )
00214 #define stats_TimersDumpAll(a) stats_TimersDumpAll( VLC_OBJECT(a) )
00215 
00216 VLC_EXPORT( void, stats_TimersCleanAll, (vlc_object_t * ) );
00217 #define stats_TimersCleanAll(a) stats_TimersCleanAll( VLC_OBJECT(a) )
00218 
00219 VLC_EXPORT( void, stats_TimerClean, (vlc_object_t *, unsigned int ) );
00220 #define stats_TimerClean(a,b) stats_TimerClean( VLC_OBJECT(a), b )
00221 
00222 /**
00223  * @}
00224  */
00225 #endif

Generated on Mon Nov 22 07:55:20 2010 for VLC by  doxygen 1.5.6