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

Rémi Denis-Courmont remi at remlab.net
Mon May 20 14:37:42 CEST 2019


Hi,

You don't need to care about the order or content of the va_list. Just pass the format string and the va_list to the suitable formatted output function, e.g. vfprintf(), vsyslog(), etc.

Le 20 mai 2019 15:18:11 GMT+03:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
>On 2019-05-20 14:03, Rémi Denis-Courmont wrote:
>> I don't see how passing va_list to whatever is the appropriate 
>> formatting function for your logging system, is a PITA.
>
>The order or the elements in the va_list is completely arbitrary and 
>entirely depends on the format string it's tied to. There's no way the 
>libvlc host can actually make sense of which parameter does what and 
>reformat this.
>
>IMO we can just replace this by the formatted string and everyone will 
>be happy. Nothing will be lost.
>
>
>> Certainly, implementing printf() by hand is a PITA, but why the heck 
>> would you do that??
>> 
>> Le 20 mai 2019 10:41:07 GMT+03:00, Steve Lhomme <robux4 at ycbcr.xyz> a
>écrit :
>> 
>>     On 2019-05-19 8:32, Rémi Denis-Courmont wrote:
>> 
>>         Le lauantaina 18. toukokuuta 2019, 23.12.30 EEST Jeremy
>>         Vignelles a écrit :
>> 
>>             Hi Rémi,
>> 
>>             Thanks for your review.
>> 
>>                 Le 18 mai 2019 à 09:18, Rémi Denis-Courmont
>>                 <remi at remlab.net> a écrit :
>> 
>>                 Le perjantaina 17. toukokuuta 2019, 11.04.59 EEST
>Jérémy
>>                 VIGNELLES a écrit
>> 
>>         :
>> 
>>                     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.
>> 
>>                 We already tried to adapt to foreign function
>interfaces
>>                 and failed, and
>>                 realized that the FFI just could not handle it across
>>                 the broad set of
>>                 platforms that VLC supports.
>> 
>>                 Then we took the logical decision going forward: to
>>                 reject that sort of
>>                 patchsets.
>> 
>>             As of today, every libvlc API that made sense to expose
>are
>>             implemented in
>>             LibVLCSharp, with the only exception of that specific
>>             logging API. I don't
>>             know if there is something missing for other languages on
>>             specific APIs,
>>             but as far as .net is concerned, the other functions are
>>             correctly
>>             supported.
>> 
>>         And? The point is, we decided to *stop* vainly trying to
>support
>>         the DotNet
>>         DllImport natively, because we want char, bool, size_t,
>va_list,
>>         etc. and
>>         becausewe found out that it ws anyway not possible to import
>>         LibVLC without
>>         platform-specific code even if the type system were
>watered-down.
>> 
>> 
>>     I followed the conversation and still don't understand why it's
>wrong to
>>     replace a "format string + va_list" by a "formatted string" in
>the API.
>>     Even in C handling a va_list is a PITA. If you want to peek into
>it, you
>>     need to copy it. Let alone the typing of the variables in the
>va_list.
>>    
>------------------------------------------------------------------------
>>     vlc-devel mailing list
>>     To unsubscribe or modify your subscription options:
>>     https://mailman.videolan.org/listinfo/vlc-devel
>> 
>> 
>> -- 
>> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez
>excuser 
>> ma brièveté.
>> 
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
>> 
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190520/a2613f5c/attachment.html>


More information about the vlc-devel mailing list