[vlc-devel] [PATCH 0/2] Libvlc formatted log callback

Rémi Denis-Courmont remi at remlab.net
Thu May 23 16:53:03 CEST 2019

Le tiistaina 21. toukokuuta 2019, 23.34.31 EEST Jeremy Vignelles a écrit :
> After reading through the comments, I think it is a good idea to sum things
> up:
> == The issue ==
> `libvlc_log_set` is a good API that can register log callbacks.
> An application using libvlc is able to get log messages, format them, and
> either show them to the user, or write them to a file.
> This is great when the application is written in C, or uses an intermediate
> layer written in C.

The thing is, as others have already pointed, LibVLC *is* normally called with 
an intermediate layer in C (or C++, or Objective C, or any other C-
interoperable language).

We already tried to call LibVLC directly from CIL a decade ago. It did not 
work as LibVLC is not even close to portable enough. As already mentioned all 
the following things vary:
- run-time location (path) of LibVLC (if at all computable),
- name of LibVLC for the run-time linker,
- C types with variable signedness, size, or representation,
- platform-specific process and thread requirements of LibVLC (see libvlc_new 
- correct C run-time initialization,
- different windowing handle types.

Last but not least, on many platforms, you simply *cannot* use LibVLC through 
an existing VLC installation, e.g. Portable VLC on Windows, Ubuntu Snap, etc. 
You just have to ship LibVLC with your app - you cannot avoid shipping native 
code anyway.

> However, the current shape of the API makes it hard to call from languages
> calling libvlc through FFI, because of the va_list argument.

I think you're welcome to add va_list to FFI if that's your problem. But 
really, that is just one small problem among many problems that are just 
better handled with a native slim wrapper.

Rémi Denis-Courmont

More information about the vlc-devel mailing list