1 #ifndef MP_MSG_CONTROL_H
2 #define MP_MSG_CONTROL_H
3 
4 #include <stdbool.h>
5 
6 struct mpv_global;
7 struct MPOpts;
8 void mp_msg_init(struct mpv_global *global);
9 void mp_msg_uninit(struct mpv_global *global);
10 void mp_msg_update_msglevels(struct mpv_global *global, struct MPOpts *opts);
11 void mp_msg_force_stderr(struct mpv_global *global, bool force_stderr);
12 bool mp_msg_has_status_line(struct mpv_global *global);
13 bool mp_msg_has_log_file(struct mpv_global *global);
14 void mp_msg_set_early_logging(struct mpv_global *global, bool enable);
15 
16 void mp_msg_flush_status_line(struct mp_log *log);
17 void mp_msg_set_term_title(struct mp_log *log, const char *title);
18 
19 struct mp_log_buffer_entry {
20     char *prefix;
21     int level;
22     char *text;
23 };
24 
25 // Use --msg-level option for log level of this log buffer
26 #define MP_LOG_BUFFER_MSGL_TERM (MSGL_MAX + 1)
27 // For --log-file; --msg-level, but at least MSGL_DEBUG
28 #define MP_LOG_BUFFER_MSGL_LOGFILE (MSGL_MAX + 2)
29 
30 struct mp_log_buffer;
31 struct mp_log_buffer *mp_msg_log_buffer_new(struct mpv_global *global,
32                                             int size, int level,
33                                             void (*wakeup_cb)(void *ctx),
34                                             void *wakeup_cb_ctx);
35 void mp_msg_log_buffer_destroy(struct mp_log_buffer *buffer);
36 struct mp_log_buffer_entry *mp_msg_log_buffer_read(struct mp_log_buffer *buffer);
37 void mp_msg_log_buffer_set_silent(struct mp_log_buffer *buffer, bool silent);
38 
39 int mp_msg_find_level(const char *s);
40 
41 extern const char *const mp_log_levels[MSGL_MAX + 1];
42 extern const int mp_mpv_log_levels[MSGL_MAX + 1];
43 
44 #endif
45