[vlc-devel] [PATCH 04/18] decoder: add a function to create a decoder module

Rémi Denis-Courmont remi at remlab.net
Tue Jul 18 06:28:07 CEST 2017


Le 17 juillet 2017 23:40:13 GMT+08:00, Steve Lhomme <robux4 at gmail.com> a écrit :
>On Mon, Jul 17, 2017 at 5:02 PM, Rémi Denis-Courmont <remi at remlab.net>
>wrote:
>> On lundi 17 juillet 2017 16:33:10 EEST Steve Lhomme wrote:
>>> And add a sanity check for the ES category.
>>
>> I don't think this grants a new function TBH. This is such a narrow
>wrapper.
>
>Yeah it's not big but apart from the core there are 3 modules that
>also load a decoder. And they could/should benefit from the extra
>safety on fmt_out when loading a module. Unfortunately there is
>nothing that would allow creating a decoder_t directly. There's
>input_DecoderCreate() but it depends on input_resource_t that they
>don't have.
>
>> We don't usually expose such functionality - instead combining object
>creation
>> and module loading.
>>
>>
>> --
>> Rémi Denis-Courmont
>> _______________________________________________
>> 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

I don't really buy it. The function semantics are very tightly coupled with the calling code, especially given the callback parameter.

If you want to rationalize this, the "modern" pattern defined by Laurent consists of providing an "owner" structure pointer for the callbacks and private data of the caller. This allows to keep object allocation, initialization and module probing in a single function.
-- 
Rémi Denis-Courmont
Typed on an inconvenient virtual keyboard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170718/c70ba0c5/attachment.html>


More information about the vlc-devel mailing list