VLC  4.0.0-dev
Macros | Typedefs | Functions
vlc_modules.h File Reference

This file defines functions for modules in vlc. More...

Include dependency graph for vlc_modules.h:

Go to the source code of this file.

Macros

#define vlc_module_load(ctx, cap, name, strict, ...)
 
#define module_need(a, b, c, d)   module_need(VLC_OBJECT(a),b,c,d)
 
#define module_need_var(a, b, c)   module_need_var(VLC_OBJECT(a),b,c)
 
#define module_unneed(a, b)   module_unneed(VLC_OBJECT(a),b)
 
#define module_GetLongName(m)   module_get_name( m, true )
 
#define module_get_main(a)   module_get_main()
 

Typedefs

typedef int(* vlc_activate_t) (void *func, bool forced, va_list args)
 

Functions

module_tvlc_module_load (struct vlc_logger *log, const char *cap, const char *name, bool strict, vlc_activate_t probe,...)
 Finds and instantiates the best module of a certain type. More...
 
module_tmodule_need (vlc_object_t *, const char *, const char *, bool)
 
static module_tmodule_need_var (vlc_object_t *obj, const char *cap, const char *varname)
 
void module_unneed (vlc_object_t *, module_t *)
 
bool module_exists (const char *)
 Checks if a module exists. More...
 
module_tmodule_find (const char *name)
 Get a pointer to a module_t given it's name. More...
 
module_config_tmodule_config_get (const module_t *module, unsigned *restrict psize)
 Gets the table of module configuration items. More...
 
void module_config_free (module_config_t *tab)
 Releases the configuration items table. More...
 
void module_list_free (module_t **)
 Frees the flat list of VLC modules. More...
 
module_t ** module_list_get (size_t *n)
 Gets the flat list of VLC modules. More...
 
bool module_provides (const module_t *m, const char *cap)
 Checks whether a module implements a capability. More...
 
const char * module_get_object (const module_t *m)
 Gets the internal name of a module. More...
 
const char * module_get_name (const module_t *m, bool longname)
 Gets the human-friendly name of a module. More...
 
const char * module_get_help (const module_t *m)
 Gets the help text for a module. More...
 
const char * module_get_capability (const module_t *m)
 Gets the capability string of a module. More...
 
int module_get_score (const module_t *m)
 Gets the precedence of a module. More...
 
const char * module_gettext (const module_t *m, const char *s)
 Translates a string using the module's text domain. More...
 
static module_tmodule_get_main (void)
 
static bool module_is_main (const module_t *p_module)
 

Detailed Description

This file defines functions for modules in vlc.

Macro Definition Documentation

◆ module_get_main

#define module_get_main (   a)    module_get_main()

◆ module_GetLongName

#define module_GetLongName (   m)    module_get_name( m, true )

◆ module_need

#define module_need (   a,
  b,
  c,
 
)    module_need(VLC_OBJECT(a),b,c,d)

◆ module_need_var

#define module_need_var (   a,
  b,
 
)    module_need_var(VLC_OBJECT(a),b,c)

◆ module_unneed

#define module_unneed (   a,
 
)    module_unneed(VLC_OBJECT(a),b)

◆ vlc_module_load

#define vlc_module_load (   ctx,
  cap,
  name,
  strict,
  ... 
)
Value:
_Generic ((ctx), \
struct vlc_logger *: \
vlc_module_load((void *)(ctx), cap, name, strict, __VA_ARGS__), \
void *: \
vlc_module_load((void *)(ctx), cap, name, strict, __VA_ARGS__), \
default: \
name, strict, __VA_ARGS__))
#define vlc_object_logger(o)
Definition: vlc_objects.h:165
const char name[16]
Definition: httpd.c:1269
Definition: messages.c:54
#define vlc_module_load(ctx, cap, name, strict,...)
Definition: vlc_modules.h:63
VLC object common members.
Definition: vlc_objects.h:43

Referenced by demux_NewAdvanced(), vlc_decoder_device_Create(), vlc_gl_Create(), vlc_LogModuleCreate(), vlc_tls_ClientCreate(), vlc_tls_ServerCreate(), vout_display_New(), and vout_window_New().

Typedef Documentation

◆ vlc_activate_t

typedef int(* vlc_activate_t) (void *func, bool forced, va_list args)

Function Documentation

◆ module_config_free()

void module_config_free ( module_config_t tab)

Releases the configuration items table.

Parameters
tabbase address of a table returned by module_config_get()

◆ module_config_get()

module_config_t* module_config_get ( const module_t module,
unsigned *restrict  psize 
)

Gets the table of module configuration items.

Note
Use module_config_free() to release the allocated memory.
Parameters
modulethe module
psizethe size of the configuration returned
Returns
the configuration as an array

References module_config_t::b_internal, module_config_t::b_removed, vlc_plugin_t::conf, config, vlc_plugin_t::items, vlc_plugin_t::module, module_t::plugin, vlc_plugin_t::size, and vlc_alloc().

◆ module_exists()

bool module_exists ( const char *  )

Checks if a module exists.

Parameters
namename of the module
Return values
trueif the module exists
falseif the module does not exist (in the running installation)

References module_find().

Referenced by aout_New().

◆ module_find()

module_t* module_find ( const char *  name)

Get a pointer to a module_t given it's name.

Parameters
namethe name of the module
Returns
a pointer to the module or NULL in case of a failure

References count, module_t::i_shortcuts, list, module_list_free(), module_list_get(), module_t::pp_shortcuts, and unlikely.

Referenced by module_exists(), and module_get_main().

◆ module_get_capability()

const char* module_get_capability ( const module_t m)

Gets the capability string of a module.

Parameters
mthe module
Returns
the capability, or "none" if unspecified

References module_t::psz_capability.

Referenced by module_provides(), and vlc_module_store().

◆ module_get_help()

const char* module_get_help ( const module_t m)

Gets the help text for a module.

Parameters
mthe module
Returns
the help

References module_t::psz_help.

◆ module_get_main()

static module_t* module_get_main ( void  )
inlinestatic

References module_find().

◆ module_get_name()

const char* module_get_name ( const module_t m,
bool  longname 
)

Gets the human-friendly name of a module.

Parameters
mthe module
longnameTRUE to have the long name of the module
Returns
the short or long name of the module

References module_get_object(), module_t::psz_longname, and module_t::psz_shortname.

Referenced by config_ListModules(), demux_filter_enable_disable(), and filter_chain_AppendInner().

◆ module_get_object()

const char* module_get_object ( const module_t m)

Gets the internal name of a module.

Parameters
mthe module
Returns
the module name

References module_t::i_shortcuts, module_t::pp_shortcuts, and unlikely.

Referenced by config_ListModules(), config_SaveConfigFile(), ListModules(), module_get_name(), module_is_main(), module_match(), module_need(), module_unneed(), Usage(), and vlc_module_load().

◆ module_get_score()

int module_get_score ( const module_t m)

Gets the precedence of a module.

Parameters
mthe module return the score for the capability

References module_t::i_score.

Referenced by vlc_module_load().

◆ module_gettext()

const char* module_gettext ( const module_t m,
const char *  s 
)

Translates a string using the module's text domain.

Parameters
mthe module
sthe American English ASCII string to localize
Returns
the gettext-translated string

References module_t::plugin, vlc_plugin_t::textdomain, and unlikely.

Referenced by config_ListModules(), ListModules(), print_item(), print_section(), and Usage().

◆ module_is_main()

static bool module_is_main ( const module_t p_module)
inlinestatic

References module_get_object().

◆ module_list_free()

void module_list_free ( module_t **  list)

Frees the flat list of VLC modules.

Parameters
listlist obtained by module_list_get()
lengthnumber of items on the list
Returns
nothing.

Referenced by config_ListModules(), ListModules(), module_find(), module_LoadPlugins(), and vlc_module_load().

◆ module_list_get()

module_t** module_list_get ( size_t *  n)

Gets the flat list of VLC modules.

Parameters
n[OUT] pointer to the number of modules
Returns
table of module pointers (release with module_list_free()), or NULL in case of error (in that case, *n is zeroed).

References vlc_plugin_t::next, module_t::next, and unlikely.

Referenced by ListModules(), module_find(), and module_LoadPlugins().

◆ module_need()

module_t* module_need ( vlc_object_t ,
const char *  ,
const char *  ,
bool   
)

◆ module_need_var()

static module_t* module_need_var ( vlc_object_t obj,
const char *  cap,
const char *  varname 
)
inlinestatic

◆ module_provides()

bool module_provides ( const module_t m,
const char *  cap 
)

Checks whether a module implements a capability.

Parameters
mthe module
capthe capability to check
Return values
trueif the module has the capability
falseif the module has another capability

References module_get_capability().

◆ module_unneed()

void module_unneed ( vlc_object_t ,
module_t  
)

◆ vlc_module_load()

module_t* vlc_module_load ( struct vlc_logger log,
const char *  capability,
const char *  name,
bool  strict,
vlc_activate_t  probe,
  ... 
)

Finds and instantiates the best module of a certain type.

All candidates modules having the specified capability and name will be sorted in decreasing order of priority. Then the probe callback will be invoked for each module, until it succeeds (returns 0), or all candidate module failed to initialize.

The probe callback first parameter is the address of the module entry point. Further parameters are passed as an argument list; it corresponds to the variable arguments passed to this function. This scheme is meant to support arbitrary prototypes for the module entry point.

Parameters
loglogger for debugging (or NULL to ignore)
capabilitycapability, i.e. class of module
namename of the module asked, if any
strictif true, do not fallback to plugin with a different name but the same capability
probemodule probe callback
Returns
the module or NULL in case of a failure

All candidates modules having the specified capability and name will be sorted in decreasing order of priority. Then the probe callback will be invoked for each module, until it succeeds (returns 0), or all candidate module failed to initialize.

The probe callback first parameter is the address of the module entry point. Further parameters are passed as an argument list; it corresponds to the variable arguments passed to this function. This scheme is meant to support arbitrary prototypes for the module entry point.

Parameters
loglogger (or NULL to ignore)
capabilitycapability, i.e. class of module
namename of the module asked, if any
strictif true, do not fallback to plugin with a different name but the same capability
probemodule probe callback
Returns
the module or NULL in case of a failure

References module_get_object(), module_get_score(), module_list_cap(), module_list_free(), module_load(), module_match_name(), name, strcasecmp(), vlc_debug, VLC_ETIMEOUT, and VLC_SUCCESS.

Referenced by module_need().