summaryrefslogtreecommitdiffstats
path: root/common/msg.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-18 19:04:30 +0100
committerwm4 <wm4@nowhere>2013-12-20 21:07:57 +0100
commit6a8fc3f5e38f93c36d18ad8407d4f3f345d893db (patch)
treead2567044e98efaad555366b2b5a2bf010e815ee /common/msg.h
parent5162c2709ee9bfce15750fa47744861c50351ae5 (diff)
downloadmpv-6a8fc3f5e38f93c36d18ad8407d4f3f345d893db.tar.bz2
mpv-6a8fc3f5e38f93c36d18ad8407d4f3f345d893db.tar.xz
msg: change --msglevel, reduce legacy glue
Basically, reimplement --msglevel. Instead of making the new msg code use the legacy code, make the legacy code use the reimplemented functionality. The handling of the deprecated --identify switch changes. It temporarily stops working; this will be fixed in later commits. The actual sub-options syntax (like --msglevel-vo=...) goes away, but I bet nobody knew about this or used this anyway.
Diffstat (limited to 'common/msg.h')
-rw-r--r--common/msg.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/common/msg.h b/common/msg.h
index 8533b19887..d970d71f60 100644
--- a/common/msg.h
+++ b/common/msg.h
@@ -31,6 +31,10 @@ struct mp_log;
extern int verbose;
extern bool mp_msg_mute;
extern bool mp_msg_stdout_in_use;
+extern int mp_smode; // slave mode compatibility glue
+
+// A mp_log instance that never outputs anything.
+extern struct mp_log *const mp_null_log;
// Verbosity levels.
#define MSGL_FATAL 0 // will exit/abort (note: msg.c doesn't exit or abort)
@@ -44,18 +48,19 @@ extern bool mp_msg_stdout_in_use;
#define MSGL_DBG3 8 // ...
#define MSGL_DBG4 9 // ....
#define MSGL_DBG5 10 // .....
+#define MSGL_SMODE 11 // old slave mode (-identify)
struct mp_log *mp_log_new(void *talloc_ctx, struct mp_log *parent,
const char *name);
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);
// 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_MSGT(obj, lev, ...) mp_msgt_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__)
@@ -64,6 +69,7 @@ void mp_msg_log(struct mp_log *log, int lev, const char *format, ...)
#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__)
+#define MP_SMODE(obj, ...) MP_MSG(obj, MSGL_SMODE, __VA_ARGS__)
#define mp_fatal(log, ...) mp_msg_log(log, MSGL_FATAL, __VA_ARGS__)
#define mp_err(log, ...) mp_msg_log(log, MSGL_ERR, __VA_ARGS__)
@@ -76,9 +82,13 @@ void mp_msg_log(struct mp_log *log, int lev, const char *format, ...)
struct mpv_global;
void mp_msg_init(struct mpv_global *global);
void mp_msg_uninit(struct mpv_global *global);
+void mp_msg_update_msglevels(struct mpv_global *global);
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.