1
mirror of https://github.com/mpv-player/mpv synced 2024-10-30 04:46:41 +01:00
mpv/common
wm4 738dfbb2fe msg: add a mechanism to output messages to a ringbuffer
Until now, mp_msg output always went to the terminal. There was no way
to grab the stream of output messages. But this will be needed by
various future changes: Lua scripts, slave mode, client library...

This commit allows registering a ring buffer. A callback would be more
straight-forward, but since msg.c sits at the bottom of the lock
hierarchy (it's used by virtually everything), this would probably be a
nightmare. A ring buffer will be simpler and more predictable in the
long run.

We allocate new memory for each ringbuffer entry, which is probably a
bit expensive. We could try to be clever and somehow pack the data
directly into the buffer, but I felt like this wouldn't be worth the
complexity. You'd have to copy the data a bunch of times anyway. I'm
hoping that we can get away with using the ringbuffer mechanism for
low frequency important messages only (and not e.g. for high volume
debug messages), so the cost doesn't matter that much.

A ringbuffer has a simple, single log level. I considered allowing
--msglevel style per-prefix configuration for each ringbuffer, but
that would have been pretty complicated to implement, and wouldn't
have been that useful either.
2014-01-16 23:06:40 +01:00
..
asxparser.c asxparser: remove commented code 2013-12-22 23:43:09 +01:00
asxparser.h playlist_parser: mp_msg conversion 2013-12-21 21:43:16 +01:00
av_common.c Factor out setting AVCodecContext extradata 2014-01-11 01:25:49 +01:00
av_common.h Factor out setting AVCodecContext extradata 2014-01-11 01:25:49 +01:00
av_log.c msg: rename mp_msg_log -> mp_msg 2013-12-21 22:13:04 +01:00
av_log.h av_log: mp_msg conversion 2013-12-21 21:43:16 +01:00
av_opts.c Split mpvcore/ into common/, misc/, bstr/ 2013-12-17 02:39:45 +01:00
av_opts.h Split mpvcore/ into common/, misc/, bstr/ 2013-12-17 02:39:45 +01:00
codecs.c msg: rename mp_msg_log -> mp_msg 2013-12-21 22:13:04 +01:00
codecs.h codecs: mp_msg conversion 2013-12-21 20:50:12 +01:00
common.c common: drop mp_append_utf8_buffer() 2013-12-30 22:49:51 +01:00
common.h common: drop mp_append_utf8_buffer() 2013-12-30 22:49:51 +01:00
cpudetect.c cpudetect: remove mp_msg calls 2013-12-21 21:43:17 +01:00
cpudetect.h Split mpvcore/ into common/, misc/, bstr/ 2013-12-17 02:39:45 +01:00
encode_lavc.c msg: move special declarations to msg_control.h 2014-01-16 23:06:40 +01:00
encode_lavc.h encode_lavc: mp_msg conversions 2013-12-21 21:43:16 +01:00
encode.h encode_lavc: mp_msg conversions 2013-12-21 21:43:16 +01:00
global.h Split mpvcore/ into common/, misc/, bstr/ 2013-12-17 02:39:45 +01:00
msg_control.h msg: add a mechanism to output messages to a ringbuffer 2014-01-16 23:06:40 +01:00
msg.c msg: add a mechanism to output messages to a ringbuffer 2014-01-16 23:06:40 +01:00
msg.h msg: fix typo in comment 2014-01-16 23:06:40 +01:00
playlist_parser.c msg: rename mp_msg_log -> mp_msg 2013-12-21 22:13:04 +01:00
playlist_parser.h playlist_parser: mp_msg conversion 2013-12-21 21:43:16 +01:00
playlist.c Split mpvcore/ into common/, misc/, bstr/ 2013-12-17 02:39:45 +01:00
playlist.h Split mpvcore/ into common/, misc/, bstr/ 2013-12-17 02:39:45 +01:00
version.c Don't include version.h from make options.c 2013-12-22 14:35:45 +01:00