[vlc-devel] [PATCH 0/2] Libvlc formatted log callback
Steve Lhomme
robux4 at ycbcr.xyz
Fri May 17 13:20:33 CEST 2019
On 2019-05-17 10:04, Jérémy VIGNELLES wrote:
> Hi,
>
> 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.
That sounds like a good idea.
We might also remove the old API (or mark it deprecated) because there's
not much sense in having both. And a va_list without parsing it to
create the string is pointless anyway.
> The new API requires a context to be created and destroyed, in order to keep compatibility with
> libvlc_log_set.
>
> 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(+)
>
> --
> 2.21.0.windows.1
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
>
More information about the vlc-devel
mailing list