2010-01-30 23:24:23 +00:00
|
|
|
/*
|
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#ifndef MPLAYER_MP_MSG_H
|
|
|
|
#define MPLAYER_MP_MSG_H
|
2002-02-23 15:12:55 +00:00
|
|
|
|
2009-07-25 04:24:39 +00:00
|
|
|
#include <stdarg.h>
|
2013-07-31 19:40:30 +00:00
|
|
|
#include <stdbool.h>
|
2013-12-18 16:12:21 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "compat/compiler.h"
|
2013-07-31 19:40:30 +00:00
|
|
|
|
|
|
|
struct mp_log;
|
2009-07-25 04:24:39 +00:00
|
|
|
|
2004-11-25 22:24:00 +00:00
|
|
|
extern int verbose;
|
2013-12-18 14:43:31 +00:00
|
|
|
extern bool mp_msg_mute;
|
2013-12-18 15:55:10 +00:00
|
|
|
extern bool mp_msg_stdout_in_use;
|
2013-12-18 18:04:30 +00:00
|
|
|
extern int mp_smode; // slave mode compatibility glue
|
|
|
|
|
|
|
|
// A mp_log instance that never outputs anything.
|
|
|
|
extern struct mp_log *const mp_null_log;
|
2001-08-17 00:39:49 +00:00
|
|
|
|
2013-12-18 15:55:10 +00:00
|
|
|
// Verbosity levels.
|
|
|
|
#define MSGL_FATAL 0 // will exit/abort (note: msg.c doesn't exit or abort)
|
2001-08-16 22:39:46 +00:00
|
|
|
#define MSGL_ERR 1 // continues
|
2001-08-16 22:13:20 +00:00
|
|
|
#define MSGL_WARN 2 // only warning
|
2013-12-18 15:55:10 +00:00
|
|
|
#define MSGL_HINT 3 // (to be phased out)
|
2001-08-17 00:39:49 +00:00
|
|
|
#define MSGL_INFO 4 // -quiet
|
2013-12-18 15:55:10 +00:00
|
|
|
#define MSGL_STATUS 5 // exclusively for the playback status line
|
|
|
|
#define MSGL_V 6 // -v
|
|
|
|
#define MSGL_DBG2 7 // -v -v
|
|
|
|
#define MSGL_DBG3 8 // ...
|
|
|
|
#define MSGL_DBG4 9 // ....
|
|
|
|
#define MSGL_DBG5 10 // .....
|
2013-12-18 18:04:30 +00:00
|
|
|
#define MSGL_SMODE 11 // old slave mode (-identify)
|
2001-08-16 22:13:20 +00:00
|
|
|
|
2013-12-18 15:55:10 +00:00
|
|
|
struct mp_log *mp_log_new(void *talloc_ctx, struct mp_log *parent,
|
|
|
|
const char *name);
|
2004-08-24 19:36:17 +00:00
|
|
|
|
2013-12-18 15:55:10 +00:00
|
|
|
void mp_msg_log(struct mp_log *log, int lev, const char *format, ...)
|
|
|
|
PRINTF_ATTRIBUTE(3, 4);
|
2013-12-18 18:04:30 +00:00
|
|
|
void mp_msg_log_va(struct mp_log *log, int lev, const char *format, va_list va);
|
2001-08-16 22:13:20 +00:00
|
|
|
|
2013-12-18 15:55:10 +00:00
|
|
|
// Convenience macros, typically called with a pointer to a context struct
|
|
|
|
// as first argument, which has a "struct mp_log log;" member.
|
|
|
|
|
|
|
|
#define MP_MSG(obj, lev, ...) mp_msg_log((obj)->log, lev, __VA_ARGS__)
|
|
|
|
|
|
|
|
#define MP_FATAL(obj, ...) MP_MSG(obj, MSGL_FATAL, __VA_ARGS__)
|
|
|
|
#define MP_ERR(obj, ...) MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
|
|
|
|
#define MP_WARN(obj, ...) MP_MSG(obj, MSGL_WARN, __VA_ARGS__)
|
|
|
|
#define MP_INFO(obj, ...) MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
|
|
|
|
#define MP_VERBOSE(obj, ...) MP_MSG(obj, MSGL_V, __VA_ARGS__)
|
|
|
|
#define MP_DBG(obj, ...) MP_MSG(obj, MSGL_DBG2, __VA_ARGS__)
|
|
|
|
#define MP_TRACE(obj, ...) MP_MSG(obj, MSGL_DBG5, __VA_ARGS__)
|
2013-12-18 18:04:30 +00:00
|
|
|
#define MP_SMODE(obj, ...) MP_MSG(obj, MSGL_SMODE, __VA_ARGS__)
|
2013-12-18 15:55:10 +00:00
|
|
|
|
|
|
|
#define mp_fatal(log, ...) mp_msg_log(log, MSGL_FATAL, __VA_ARGS__)
|
|
|
|
#define mp_err(log, ...) mp_msg_log(log, MSGL_ERR, __VA_ARGS__)
|
|
|
|
#define mp_warn(log, ...) mp_msg_log(log, MSGL_WARN, __VA_ARGS__)
|
|
|
|
#define mp_info(log, ...) mp_msg_log(log, MSGL_INFO, __VA_ARGS__)
|
|
|
|
#define mp_verbose(log, ...) mp_msg_log(log, MSGL_V, __VA_ARGS__)
|
|
|
|
#define mp_dbg(log, ...) mp_msg_log(log, MSGL_DBG2, __VA_ARGS__)
|
|
|
|
#define mp_trace(log, ...) mp_msg_log(log, MSGL_DBG5, __VA_ARGS__)
|
|
|
|
|
|
|
|
struct mpv_global;
|
|
|
|
void mp_msg_init(struct mpv_global *global);
|
|
|
|
void mp_msg_uninit(struct mpv_global *global);
|
2013-12-18 18:04:30 +00:00
|
|
|
void mp_msg_update_msglevels(struct mpv_global *global);
|
2013-12-18 15:55:10 +00:00
|
|
|
|
|
|
|
struct mpv_global *mp_log_get_global(struct mp_log *log);
|
2001-08-16 22:13:20 +00:00
|
|
|
|
2013-12-18 18:04:30 +00:00
|
|
|
struct bstr;
|
|
|
|
int mp_msg_split_msglevel(struct bstr *s, struct bstr *out_mod, int *out_level);
|
|
|
|
|
2013-12-18 15:55:10 +00:00
|
|
|
// --- Legacy
|
2001-08-16 22:13:20 +00:00
|
|
|
|
2013-12-18 15:55:10 +00:00
|
|
|
// Note: using mp_msg_log or the MP_ERR/... macros is preferred.
|
|
|
|
int mp_msg_test(int mod, int lev);
|
|
|
|
bool mp_msg_test_log(struct mp_log *log, int lev);
|
|
|
|
void mp_msg_va(int mod, int lev, const char *format, va_list va);
|
|
|
|
void mp_msg(int mod, int lev, const char *format, ... ) PRINTF_ATTRIBUTE(3, 4);
|
|
|
|
|
|
|
|
#define MSGL_FIXME 1 // for conversions from printf where the appropriate MSGL is not known; set equal to ERR for obtrusiveness
|
|
|
|
#define MSGT_FIXME 0 // for conversions from printf where the appropriate MSGT is not known; set equal to GLOBAL for
|
|
|
|
#define MSGT_GLOBAL 0 // common player stuff errors
|
|
|
|
#define MSGT_CPLAYER 1 // console player (mplayer.c)
|
|
|
|
#define MSGT_VO 3 // libvo
|
|
|
|
#define MSGT_AO 4 // libao
|
2001-08-16 22:13:20 +00:00
|
|
|
#define MSGT_DEMUXER 5 // demuxer.c (general stuff)
|
|
|
|
#define MSGT_DS 6 // demux stream (add/read packet etc)
|
|
|
|
#define MSGT_DEMUX 7 // fileformat-specific stuff (demux_*.c)
|
2001-08-16 22:39:46 +00:00
|
|
|
#define MSGT_HEADER 8 // fileformat-specific header (*header.c)
|
2001-08-17 00:39:49 +00:00
|
|
|
#define MSGT_AVSYNC 9 // mplayer.c timer stuff
|
|
|
|
#define MSGT_AUTOQ 10 // mplayer.c auto-quality stuff
|
|
|
|
#define MSGT_CFGPARSER 11 // cfgparser.c
|
|
|
|
#define MSGT_DECAUDIO 12 // av decoder
|
|
|
|
#define MSGT_DECVIDEO 13
|
2013-12-18 15:55:10 +00:00
|
|
|
#define MSGT_SEEK 14 // seeking code
|
|
|
|
#define MSGT_WIN32 15 // win32 dll stuff
|
|
|
|
#define MSGT_OPEN 16 // open.c (stream opening)
|
|
|
|
#define MSGT_DVD 17 // open.c (DVD init/read/seek)
|
|
|
|
#define MSGT_PARSEES 18 // parse_es.c (mpeg stream parser)
|
|
|
|
#define MSGT_LIRC 19 // lirc_mp.c and input lirc driver
|
2001-09-26 21:35:14 +00:00
|
|
|
#define MSGT_STREAM 20 // stream.c
|
2013-12-18 15:55:10 +00:00
|
|
|
#define MSGT_CACHE 21 // cache2.c
|
2012-09-14 15:51:26 +00:00
|
|
|
#define MSGT_ENCODE 22 // now encode_lavc.c
|
2013-12-18 15:55:10 +00:00
|
|
|
#define MSGT_XACODEC 23 // XAnim codecs
|
|
|
|
#define MSGT_TV 24 // TV input subsystem
|
|
|
|
#define MSGT_OSDEP 25 // OS-dependent parts
|
|
|
|
#define MSGT_SPUDEC 26 // spudec.c
|
2002-01-08 01:52:11 +00:00
|
|
|
#define MSGT_PLAYTREE 27 // Playtree handeling (playtree.c, playtreeparser.c)
|
2002-03-19 13:30:16 +00:00
|
|
|
#define MSGT_INPUT 28
|
2002-04-06 22:00:27 +00:00
|
|
|
#define MSGT_VFILTER 29
|
2002-04-15 19:17:12 +00:00
|
|
|
#define MSGT_OSD 30
|
2002-04-30 16:58:54 +00:00
|
|
|
#define MSGT_NETWORK 31
|
2002-05-02 10:52:30 +00:00
|
|
|
#define MSGT_CPUDETECT 32
|
|
|
|
#define MSGT_CODECCFG 33
|
|
|
|
#define MSGT_SWS 34
|
2002-05-17 23:47:27 +00:00
|
|
|
#define MSGT_VOBSUB 35
|
2002-06-03 23:23:03 +00:00
|
|
|
#define MSGT_SUBREADER 36
|
2002-10-01 06:45:08 +00:00
|
|
|
#define MSGT_AFILTER 37 // Audio filter messages
|
2003-04-06 17:18:26 +00:00
|
|
|
#define MSGT_NETST 38 // Netstream
|
2003-10-22 17:04:39 +00:00
|
|
|
#define MSGT_MUXER 39 // muxer layer
|
2006-04-24 07:20:34 +00:00
|
|
|
#define MSGT_IDENTIFY 41 // -identify output
|
2006-08-28 17:05:18 +00:00
|
|
|
#define MSGT_RADIO 42
|
2006-11-03 18:15:33 +00:00
|
|
|
#define MSGT_ASS 43 // libass messages
|
2006-11-27 02:44:06 +00:00
|
|
|
#define MSGT_LOADER 44 // dll loader messages
|
2007-06-05 16:13:00 +00:00
|
|
|
#define MSGT_STATUSLINE 45 // playback/encoding status line
|
2009-10-29 22:39:00 +00:00
|
|
|
#define MSGT_TELETEXT 46 // Teletext decoder
|
2013-07-31 19:40:30 +00:00
|
|
|
#define MSGT_MAX 47
|
2001-08-16 22:13:20 +00:00
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#endif /* MPLAYER_MP_MSG_H */
|