Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * This file is part of mpv. |
3 | | * |
4 | | * mpv is free software; you can redistribute it and/or |
5 | | * modify it under the terms of the GNU Lesser General Public |
6 | | * License as published by the Free Software Foundation; either |
7 | | * version 2.1 of the License, or (at your option) any later version. |
8 | | * |
9 | | * mpv is distributed in the hope that it will be useful, |
10 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | | * GNU Lesser General Public License for more details. |
13 | | * |
14 | | * You should have received a copy of the GNU Lesser General Public |
15 | | * License along with mpv. If not, see <http://www.gnu.org/licenses/>. |
16 | | */ |
17 | | |
18 | | #ifndef MPLAYER_MP_MSG_H |
19 | | #define MPLAYER_MP_MSG_H |
20 | | |
21 | | #include <stdarg.h> |
22 | | #include <stdbool.h> |
23 | | #include <stdlib.h> |
24 | | #include <stdint.h> |
25 | | |
26 | | #include "osdep/compiler.h" |
27 | | |
28 | | // Escape code for TERM_MSG codes. PU2 (U+0092) followed by 't'. |
29 | 135M | #define TERM_MSG_ESCAPE "\xC2\x92" "t" |
30 | 135M | #define TERM_MSG_0 TERM_MSG_ESCAPE "0" |
31 | | |
32 | | struct mp_log; |
33 | | |
34 | | // A mp_log instance that never outputs anything. |
35 | | extern struct mp_log *const mp_null_log; |
36 | | |
37 | | // Verbosity levels. |
38 | | enum { |
39 | | MSGL_FATAL, // only errors (difference to MSGL_ERR isn't too clear) |
40 | | MSGL_ERR, // only errors |
41 | | MSGL_WARN, // only warnings |
42 | | MSGL_INFO, // what you normally see on the terminal |
43 | | MSGL_STATUS, // exclusively for the playback status line (-quiet disables) |
44 | | MSGL_V, // -v | slightly more information than default |
45 | | MSGL_DEBUG, // -v -v | full debug information; this and numerically below |
46 | | // should not produce "per frame" output |
47 | | MSGL_TRACE, // -v -v -v | anything that might flood the terminal |
48 | | MSGL_STATS, // dumping fine grained stats (--dump-stats) |
49 | | |
50 | | MSGL_MAX = MSGL_STATS, |
51 | | }; |
52 | | |
53 | | struct mp_log *mp_log_new(void *talloc_ctx, struct mp_log *parent, |
54 | | const char *name); |
55 | | |
56 | | void mp_msg(struct mp_log *log, int lev, const char *format, ...) |
57 | | PRINTF_ATTRIBUTE(3, 4); |
58 | | void mp_msg_va(struct mp_log *log, int lev, const char *format, va_list va) |
59 | | PRINTF_ATTRIBUTE(3, 0); |
60 | | |
61 | | int mp_msg_level(struct mp_log *log); |
62 | | |
63 | | static inline bool mp_msg_test(struct mp_log *log, int lev) |
64 | 208M | { |
65 | 208M | return lev <= mp_msg_level(log); |
66 | 208M | } Unexecuted instantiation: client.c:mp_msg_test Line | Count | Source | 64 | 22.9k | { | 65 | 22.9k | return lev <= mp_msg_level(log); | 66 | 22.9k | } |
Unexecuted instantiation: configfiles.c:mp_msg_test Unexecuted instantiation: external_files.c:mp_msg_test Unexecuted instantiation: loadfile.c:mp_msg_test Unexecuted instantiation: main.c:mp_msg_test Unexecuted instantiation: misc.c:mp_msg_test Unexecuted instantiation: osd.c:mp_msg_test Unexecuted instantiation: playloop.c:mp_msg_test Unexecuted instantiation: screenshot.c:mp_msg_test Unexecuted instantiation: scripting.c:mp_msg_test Unexecuted instantiation: sub.c:mp_msg_test Unexecuted instantiation: video.c:mp_msg_test Unexecuted instantiation: clipboard.c:mp_msg_test Unexecuted instantiation: clipboard-vo.c:mp_msg_test Unexecuted instantiation: stream.c:mp_msg_test Unexecuted instantiation: stream_avdevice.c:mp_msg_test Unexecuted instantiation: stream_cb.c:mp_msg_test Unexecuted instantiation: stream_edl.c:mp_msg_test Unexecuted instantiation: stream_file.c:mp_msg_test Unexecuted instantiation: stream_lavf.c:mp_msg_test Unexecuted instantiation: stream_memory.c:mp_msg_test Unexecuted instantiation: stream_mf.c:mp_msg_test Unexecuted instantiation: stream_mpv.c:mp_msg_test Unexecuted instantiation: stream_null.c:mp_msg_test Unexecuted instantiation: stream_slice.c:mp_msg_test Unexecuted instantiation: dec_sub.c:mp_msg_test Unexecuted instantiation: osd_libass.c:mp_msg_test Unexecuted instantiation: sd_ass.c:mp_msg_test Unexecuted instantiation: sd_lavc.c:mp_msg_test Unexecuted instantiation: csputils.c:mp_msg_test Unexecuted instantiation: image_writer.c:mp_msg_test Unexecuted instantiation: img_format.c:mp_msg_test Unexecuted instantiation: mp_image.c:mp_msg_test Unexecuted instantiation: mp_image_pool.c:mp_msg_test Unexecuted instantiation: vo.c:mp_msg_test Unexecuted instantiation: vo_gpu.c:mp_msg_test Unexecuted instantiation: vo_image.c:mp_msg_test Unexecuted instantiation: vo_lavc.c:mp_msg_test Unexecuted instantiation: vo_libmpv.c:mp_msg_test Unexecuted instantiation: vo_null.c:mp_msg_test Unexecuted instantiation: vo_tct.c:mp_msg_test Unexecuted instantiation: vo_kitty.c:mp_msg_test Unexecuted instantiation: sws_utils.c:mp_msg_test Unexecuted instantiation: vo_gpu_next.c:mp_msg_test Unexecuted instantiation: context.c:mp_msg_test Unexecuted instantiation: subprocess.c:mp_msg_test Unexecuted instantiation: timer.c:mp_msg_test Unexecuted instantiation: ipc-unix.c:mp_msg_test Unexecuted instantiation: filter_regex.c:mp_msg_test Unexecuted instantiation: stream_dvb.c:mp_msg_test Unexecuted instantiation: ra_gl.c:mp_msg_test Unexecuted instantiation: utils.c:mp_msg_test Unexecuted instantiation: chmap.c:mp_msg_test Unexecuted instantiation: ao.c:mp_msg_test Unexecuted instantiation: ao_lavc.c:mp_msg_test Unexecuted instantiation: ao_null.c:mp_msg_test Unexecuted instantiation: ao_pcm.c:mp_msg_test Unexecuted instantiation: buffer.c:mp_msg_test Unexecuted instantiation: av_common.c:mp_msg_test Line | Count | Source | 64 | 28.4M | { | 65 | 28.4M | return lev <= mp_msg_level(log); | 66 | 28.4M | } |
Unexecuted instantiation: codecs.c:mp_msg_test Unexecuted instantiation: encode_lavc.c:mp_msg_test Line | Count | Source | 64 | 150M | { | 65 | 150M | return lev <= mp_msg_level(log); | 66 | 150M | } |
Unexecuted instantiation: playlist.c:mp_msg_test Unexecuted instantiation: recorder.c:mp_msg_test Unexecuted instantiation: stats.c:mp_msg_test Unexecuted instantiation: demux.c:mp_msg_test Unexecuted instantiation: demux_cue.c:mp_msg_test Unexecuted instantiation: demux_disc.c:mp_msg_test Unexecuted instantiation: demux_edl.c:mp_msg_test Unexecuted instantiation: demux_lavf.c:mp_msg_test Unexecuted instantiation: demux_mf.c:mp_msg_test Unexecuted instantiation: demux_mkv.c:mp_msg_test Unexecuted instantiation: demux_mkv_timeline.c:mp_msg_test Unexecuted instantiation: demux_mpv.c:mp_msg_test Unexecuted instantiation: demux_null.c:mp_msg_test Unexecuted instantiation: demux_playlist.c:mp_msg_test Unexecuted instantiation: demux_raw.c:mp_msg_test Unexecuted instantiation: demux_timeline.c:mp_msg_test Unexecuted instantiation: ebml.c:mp_msg_test Unexecuted instantiation: packet.c:mp_msg_test Unexecuted instantiation: timeline.c:mp_msg_test Unexecuted instantiation: f_async_queue.c:mp_msg_test Unexecuted instantiation: f_decoder_wrapper.c:mp_msg_test Unexecuted instantiation: f_demux_in.c:mp_msg_test Unexecuted instantiation: f_lavfi.c:mp_msg_test Unexecuted instantiation: f_output_chain.c:mp_msg_test Unexecuted instantiation: f_utils.c:mp_msg_test Unexecuted instantiation: filter.c:mp_msg_test Unexecuted instantiation: frame.c:mp_msg_test Unexecuted instantiation: user_filters.c:mp_msg_test Line | Count | Source | 64 | 282k | { | 65 | 282k | return lev <= mp_msg_level(log); | 66 | 282k | } |
Line | Count | Source | 64 | 28.8M | { | 65 | 28.8M | return lev <= mp_msg_level(log); | 66 | 28.8M | } |
Unexecuted instantiation: ipc.c:mp_msg_test Unexecuted instantiation: keycodes.c:mp_msg_test Unexecuted instantiation: charset_conv.c:mp_msg_test Unexecuted instantiation: m_config_core.c:mp_msg_test m_config_frontend.c:mp_msg_test Line | Count | Source | 64 | 1.07M | { | 65 | 1.07M | return lev <= mp_msg_level(log); | 66 | 1.07M | } |
Unexecuted instantiation: m_option.c:mp_msg_test Unexecuted instantiation: m_property.c:mp_msg_test Unexecuted instantiation: options.c:mp_msg_test Unexecuted instantiation: parse_commandline.c:mp_msg_test Unexecuted instantiation: parse_configfile.c:mp_msg_test Unexecuted instantiation: path.c:mp_msg_test Unexecuted instantiation: audio.c:mp_msg_test Unexecuted instantiation: cookies.c:mp_msg_test Unexecuted instantiation: stream_concat.c:mp_msg_test Unexecuted instantiation: ass_mp.c:mp_msg_test Unexecuted instantiation: draw_bmp.c:mp_msg_test Unexecuted instantiation: filter_sdh.c:mp_msg_test Unexecuted instantiation: img_convert.c:mp_msg_test Unexecuted instantiation: lavc_conv.c:mp_msg_test Unexecuted instantiation: vd_lavc.c:mp_msg_test Unexecuted instantiation: vf_format.c:mp_msg_test Unexecuted instantiation: vf_sub.c:mp_msg_test Unexecuted instantiation: aspect.c:mp_msg_test Unexecuted instantiation: dr_helper.c:mp_msg_test Unexecuted instantiation: hwdec.c:mp_msg_test Unexecuted instantiation: libmpv_gpu.c:mp_msg_test Unexecuted instantiation: ra.c:mp_msg_test Unexecuted instantiation: spirv.c:mp_msg_test Unexecuted instantiation: libmpv_sw.c:mp_msg_test Unexecuted instantiation: repack.c:mp_msg_test Unexecuted instantiation: ra_pl.c:mp_msg_test Unexecuted instantiation: dvb_tune.c:mp_msg_test Unexecuted instantiation: formats.c:mp_msg_test Unexecuted instantiation: libmpv_gl.c:mp_msg_test Line | Count | Source | 64 | 30.2k | { | 65 | 30.2k | return lev <= mp_msg_level(log); | 66 | 30.2k | } |
Unexecuted instantiation: ad_lavc.c:mp_msg_test Unexecuted instantiation: ad_spdif.c:mp_msg_test Unexecuted instantiation: af_drop.c:mp_msg_test Unexecuted instantiation: af_format.c:mp_msg_test Unexecuted instantiation: af_lavcac3enc.c:mp_msg_test Unexecuted instantiation: af_scaletempo.c:mp_msg_test Unexecuted instantiation: af_scaletempo2.c:mp_msg_test Unexecuted instantiation: codec_tags.c:mp_msg_test Unexecuted instantiation: cache.c:mp_msg_test Unexecuted instantiation: f_autoconvert.c:mp_msg_test Unexecuted instantiation: f_auto_filters.c:mp_msg_test Unexecuted instantiation: f_hwtransfer.c:mp_msg_test Unexecuted instantiation: f_swresample.c:mp_msg_test Unexecuted instantiation: f_swscale.c:mp_msg_test Unexecuted instantiation: lcms.c:mp_msg_test Unexecuted instantiation: shader_cache.c:mp_msg_test Unexecuted instantiation: user_shaders.c:mp_msg_test Unexecuted instantiation: common.c:mp_msg_test Unexecuted instantiation: event.c:mp_msg_test Unexecuted instantiation: refqueue.c:mp_msg_test Unexecuted instantiation: image_loader.c:mp_msg_test Unexecuted instantiation: win_state.c:mp_msg_test |
67 | | |
68 | | void mp_msg_set_max_level(struct mp_log *log, int lev); |
69 | | |
70 | | // Convenience macros. |
71 | 110k | #define mp_fatal(log, ...) mp_msg(log, MSGL_FATAL, __VA_ARGS__) |
72 | 291k | #define mp_err(log, ...) mp_msg(log, MSGL_ERR, __VA_ARGS__) |
73 | 125k | #define mp_warn(log, ...) mp_msg(log, MSGL_WARN, __VA_ARGS__) |
74 | 692k | #define mp_info(log, ...) mp_msg(log, MSGL_INFO, __VA_ARGS__) |
75 | 1.82M | #define mp_verbose(log, ...) mp_msg(log, MSGL_V, __VA_ARGS__) |
76 | 1.60M | #define mp_dbg(log, ...) mp_msg(log, MSGL_DEBUG, __VA_ARGS__) |
77 | 0 | #define mp_trace(log, ...) mp_msg(log, MSGL_TRACE, __VA_ARGS__) |
78 | | |
79 | | // Convenience macros, typically called with a pointer to a context struct |
80 | | // as first argument, which has a "struct mp_log *log;" member. |
81 | | |
82 | 140M | #define MP_MSG(obj, lev, ...) mp_msg((obj)->log, lev, __VA_ARGS__) |
83 | | |
84 | 35.1k | #define MP_FATAL(obj, ...) MP_MSG(obj, MSGL_FATAL, __VA_ARGS__) |
85 | 5.11M | #define MP_ERR(obj, ...) MP_MSG(obj, MSGL_ERR, __VA_ARGS__) |
86 | 533k | #define MP_WARN(obj, ...) MP_MSG(obj, MSGL_WARN, __VA_ARGS__) |
87 | 467k | #define MP_INFO(obj, ...) MP_MSG(obj, MSGL_INFO, __VA_ARGS__) |
88 | 7.87M | #define MP_VERBOSE(obj, ...) MP_MSG(obj, MSGL_V, __VA_ARGS__) |
89 | 3.16M | #define MP_DBG(obj, ...) MP_MSG(obj, MSGL_DEBUG, __VA_ARGS__) |
90 | 66.3M | #define MP_TRACE(obj, ...) MP_MSG(obj, MSGL_TRACE, __VA_ARGS__) |
91 | | |
92 | | // This is a bit special. See TOOLS/stats-conv.py what rules text passed |
93 | | // to these functions should follow. Also see --dump-stats. |
94 | | #define mp_stats(obj, ...) mp_msg(obj, MSGL_STATS, __VA_ARGS__) |
95 | 23.7M | #define MP_STATS(obj, ...) MP_MSG(obj, MSGL_STATS, __VA_ARGS__) |
96 | | |
97 | | #endif /* MPLAYER_MP_MSG_H */ |