[vlc-devel] [PATCH 0/2] Libvlc formatted log callback
jeremy.vignelles at dev3i.fr
Fri May 17 10:04:59 CEST 2019
In libvlc, there is currently a `libvlc_log_set` function, that can register
log callback in a vprintf style, that is, with a `va_list` argument.
This is nice when you are trying to call from C, but when using other languages
like C# or Java, va_list is impossible to get right, and even if it did,
those languages do not provide ways to format that kind of stuff.
The best attempt so far seems to write an external native project to do that,
like this one : https://github.com/jeremyVignelles/libvlcLogInterop, but it has
a major drawback: it needs to be compiled for every host triplet that vlc supports,
which is a lot of work (if even possible), and requires the correct v*printf to be
available on the standard library.
I'm attempting here another approach : Modify libvlc v4 to include a preformatted
version of libvlc_log_set. The caller is now able to get log message as a single string,
and can filter by log level before formatting.
The new API requires a context to be created and destroyed, in order to keep compatibility with
I thought about modifying the libvlc_instance_t.log structure and put my context there,
but I was unsure about how that would interact with the existing things
Comments welcome :)
Jérémy VIGNELLES (2):
libvlc: added a formatted log callback
test: libvlc: Added a formatted log callback test
include/vlc/libvlc.h | 64 ++++++++++++++++++++++++++++++++++++++++++++
lib/libvlc.sym | 3 +++
lib/log.c | 55 +++++++++++++++++++++++++++++++++++++
test/libvlc/core.c | 27 +++++++++++++++++++
4 files changed, 149 insertions(+)
More information about the vlc-devel