mirror of https://github.com/mpv-player/mpv
msg: remove legacy stuff
This commit is contained in:
parent
893aaf8d12
commit
3fa584e280
86
common/msg.c
86
common/msg.c
|
@ -63,10 +63,6 @@ struct mp_log {
|
|||
// Protects some (not all) state in mp_log_root
|
||||
static pthread_mutex_t mp_msg_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
// should not exist
|
||||
static bool initialized;
|
||||
static struct mp_log *legacy_logs[MSGT_MAX];
|
||||
|
||||
bool mp_msg_stdout_in_use;
|
||||
int verbose;
|
||||
bool mp_msg_mute;
|
||||
|
@ -188,79 +184,6 @@ void mp_msg_log_va(struct mp_log *log, int lev, const char *format, va_list va)
|
|||
pthread_mutex_unlock(&mp_msg_lock);
|
||||
}
|
||||
|
||||
void mp_msg_va(int mod, int lev, const char *format, va_list va)
|
||||
{
|
||||
assert(initialized);
|
||||
assert(mod >= 0 && mod < MSGT_MAX);
|
||||
mp_msg_log_va(legacy_logs[mod], lev, format, va);
|
||||
}
|
||||
|
||||
void mp_msg(int mod, int lev, const char *format, ...)
|
||||
{
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
mp_msg_va(mod, lev, format, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
int mp_msg_test(int mod, int lev)
|
||||
{
|
||||
assert(initialized);
|
||||
assert(mod >= 0 && mod < MSGT_MAX);
|
||||
return mp_msg_test_log(legacy_logs[mod], lev);
|
||||
}
|
||||
|
||||
// legacy names
|
||||
static const char *module_text[MSGT_MAX] = {
|
||||
"global",
|
||||
"cplayer",
|
||||
"gplayer",
|
||||
"vo",
|
||||
"ao",
|
||||
"demuxer",
|
||||
"ds",
|
||||
"demux",
|
||||
"header",
|
||||
"avsync",
|
||||
"autoq",
|
||||
"cfgparser",
|
||||
"decaudio",
|
||||
"decvideo",
|
||||
"seek",
|
||||
"win32",
|
||||
"open",
|
||||
"dvd",
|
||||
"parsees",
|
||||
"lirc",
|
||||
"stream",
|
||||
"cache",
|
||||
"mencoder",
|
||||
"xacodec",
|
||||
"tv",
|
||||
"osdep",
|
||||
"spudec",
|
||||
"playtree",
|
||||
"input",
|
||||
"vf",
|
||||
"osd",
|
||||
"network",
|
||||
"cpudetect",
|
||||
"codeccfg",
|
||||
"sws",
|
||||
"vobsub",
|
||||
"subreader",
|
||||
"af",
|
||||
"netst",
|
||||
"muxer",
|
||||
"osdmenu",
|
||||
"identify",
|
||||
"radio",
|
||||
"ass",
|
||||
"loader",
|
||||
"statusline",
|
||||
"teletext",
|
||||
};
|
||||
|
||||
// Create a new log context, which uses talloc_ctx as talloc parent, and parent
|
||||
// as logical parent.
|
||||
// The name is the prefix put before the output. It's usually prefixed by the
|
||||
|
@ -298,7 +221,6 @@ struct mp_log *mp_log_new(void *talloc_ctx, struct mp_log *parent,
|
|||
|
||||
void mp_msg_init(struct mpv_global *global)
|
||||
{
|
||||
assert(!initialized);
|
||||
assert(!global->log);
|
||||
|
||||
struct mp_log_root *root = talloc_zero(NULL, struct mp_log_root);
|
||||
|
@ -307,15 +229,10 @@ void mp_msg_init(struct mpv_global *global)
|
|||
|
||||
struct mp_log dummy = { .root = root };
|
||||
struct mp_log *log = mp_log_new(root, &dummy, "");
|
||||
for (int n = 0; n < MSGT_MAX; n++) {
|
||||
char name[80];
|
||||
snprintf(name, sizeof(name), "!%s", module_text[n]);
|
||||
legacy_logs[n] = mp_log_new(root, log, name);
|
||||
}
|
||||
|
||||
mp_msg_do_init();
|
||||
|
||||
global->log = log;
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
struct mpv_global *mp_log_get_global(struct mp_log *log)
|
||||
|
@ -338,7 +255,6 @@ void mp_msg_uninit(struct mpv_global *global)
|
|||
{
|
||||
talloc_free(global->log->root);
|
||||
global->log = NULL;
|
||||
initialized = false;
|
||||
}
|
||||
|
||||
void mp_msg_log(struct mp_log *log, int lev, const char *format, ...)
|
||||
|
|
59
common/msg.h
59
common/msg.h
|
@ -57,6 +57,8 @@ void mp_msg_log(struct mp_log *log, int lev, const char *format, ...)
|
|||
PRINTF_ATTRIBUTE(3, 4);
|
||||
void mp_msg_log_va(struct mp_log *log, int lev, const char *format, va_list va);
|
||||
|
||||
bool mp_msg_test_log(struct mp_log *log, int lev);
|
||||
|
||||
// Convenience macros, typically called with a pointer to a context struct
|
||||
// as first argument, which has a "struct mp_log log;" member.
|
||||
|
||||
|
@ -89,61 +91,4 @@ struct mpv_global *mp_log_get_global(struct mp_log *log);
|
|||
struct bstr;
|
||||
int mp_msg_split_msglevel(struct bstr *s, struct bstr *out_mod, int *out_level);
|
||||
|
||||
// --- Legacy
|
||||
|
||||
// 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
|
||||
#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)
|
||||
#define MSGT_HEADER 8 // fileformat-specific header (*header.c)
|
||||
#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
|
||||
#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
|
||||
#define MSGT_STREAM 20 // stream.c
|
||||
#define MSGT_CACHE 21 // cache2.c
|
||||
#define MSGT_ENCODE 22 // now encode_lavc.c
|
||||
#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
|
||||
#define MSGT_PLAYTREE 27 // Playtree handeling (playtree.c, playtreeparser.c)
|
||||
#define MSGT_INPUT 28
|
||||
#define MSGT_VFILTER 29
|
||||
#define MSGT_OSD 30
|
||||
#define MSGT_NETWORK 31
|
||||
#define MSGT_CPUDETECT 32
|
||||
#define MSGT_CODECCFG 33
|
||||
#define MSGT_SWS 34
|
||||
#define MSGT_VOBSUB 35
|
||||
#define MSGT_SUBREADER 36
|
||||
#define MSGT_AFILTER 37 // Audio filter messages
|
||||
#define MSGT_NETST 38 // Netstream
|
||||
#define MSGT_MUXER 39 // muxer layer
|
||||
#define MSGT_IDENTIFY 41 // -identify output
|
||||
#define MSGT_RADIO 42
|
||||
#define MSGT_ASS 43 // libass messages
|
||||
#define MSGT_LOADER 44 // dll loader messages
|
||||
#define MSGT_STATUSLINE 45 // playback/encoding status line
|
||||
#define MSGT_TELETEXT 46 // Teletext decoder
|
||||
#define MSGT_MAX 47
|
||||
|
||||
#endif /* MPLAYER_MP_MSG_H */
|
||||
|
|
Loading…
Reference in New Issue