[vlc-devel] [RFC] custom module capabilities

Lyndon Brown jnqnfe at gmail.com
Thu Sep 3 19:31:20 CEST 2020


On Thu, 2020-09-03 at 19:05 +0300, Rémi Denis-Courmont wrote:
> Le torstaina 3. syyskuuta 2020, 18.49.20 EEST Lyndon Brown a écrit :
> > One set of patches switches capabilities over to be enum based.
> > (For
> > which there are advantages such as efficiency and catching
> > mistakes).
> 
> If you're concerned with typos in the capability string, you can
> simply 
> replace the strings with macros:
> 
> #define VLC_CAPABILITY_DEMUX "demux"
> 
> and
> 
>     set_capability(VLC_CAPABILITY_DEMUX, xxx)
> 
> I don't really follow the efficiency argument. We already have a
> binary search 
> tree for indexing capabilities. An enumeration is likely to cause a
> lot of 
> compatibility problems as capabilities are added and removed.

 - replaces the string comparisons with more efficient integer
comparisons.
 - retrieving the module list for a given capability is as quick as
indexing into an array, avoiding the current binary search.
 - minor space saving in cache and speed up in reading the cache on
startup.
 - better type strictness in function params - better confidence that
the value we're working with is an actual capability, rather than just
a string pointer.

I don't understand the compatibility concern as being so supposedly
significant. Capabilities don't change much and when they do, you just
bump the plugin API number along with the adjusted enum (if not just
adding to the end)...



More information about the vlc-devel mailing list