mirror of
https://github.com/mpv-player/mpv
synced 2024-10-30 04:46:41 +01:00
738dfbb2fe
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. |
||
---|---|---|
.. | ||
asxparser.c | ||
asxparser.h | ||
av_common.c | ||
av_common.h | ||
av_log.c | ||
av_log.h | ||
av_opts.c | ||
av_opts.h | ||
codecs.c | ||
codecs.h | ||
common.c | ||
common.h | ||
cpudetect.c | ||
cpudetect.h | ||
encode_lavc.c | ||
encode_lavc.h | ||
encode.h | ||
global.h | ||
msg_control.h | ||
msg.c | ||
msg.h | ||
playlist_parser.c | ||
playlist_parser.h | ||
playlist.c | ||
playlist.h | ||
version.c |