libgpac
Documentation of the core library of GPAC
Loading...
Searching...
No Matches
module.c File Reference
#include "module_wrap.h"
#include <gpac/config_file.h>
#include <gpac/tools.h>
#include <gpac/network.h>
#include <gpac/modules/video_out.h>
#include <gpac/modules/audio_out.h>
#include <gpac/modules/font.h>

Macros

#define LOAD_PLUGIN(__name)
 

Functions

static void load_all_modules (GF_ModuleManager *mgr)
 
GF_EXPORT GF_Err gf_module_load_static (GF_InterfaceRegister *(*register_module)())
 load a static module given its interface function
 
u32 gf_modules_refresh (GF_ModuleManager *pm)
 
static void gf_modules_check_load ()
 
void gf_modules_refresh_module_directories ()
 
void gf_modules_new (GF_Config *config)
 module manager construtcor
 
void gf_module_reload_dirs ()
 
void gf_modules_del ()
 module manager destructor
 
Bool gf_module_is_loaded (GF_ModuleManager *pm, char *filename)
 
GF_EXPORT u32 gf_modules_count ()
 get module count
 
GF_EXPORT GF_BaseInterfacegf_modules_load (u32 whichplug, u32 InterfaceFamily)
 loads an interface
 
void * gf_modules_load_filter (u32 whichplug, void *fsess)
 filter module load
 
GF_EXPORT GF_BaseInterfacegf_modules_load_by_name (const char *plug_name, u32 InterfaceFamily, Bool rebrowse_all)
 loads an interface by module name
 
GF_EXPORT GF_Err gf_modules_close_interface (GF_BaseInterface *ifce)
 interface shutdown
 
GF_EXPORT const char * gf_modules_get_file_name (u32 i)
 get module file name
 
GF_EXPORT const char * gf_module_get_file_name (GF_BaseInterface *ifce)
 get module file name
 
static Bool module_check_ifce (GF_BaseInterface *ifce, u32 ifce_type)
 
GF_BaseInterfacegf_module_load (u32 ifce_type, const char *name)
 module load
 
GF_EXPORT const char * gf_module_get_key (GF_BaseInterface *dr, char *key_name)
 query module option
 
GF_EXPORT Bool gf_module_get_bool (GF_BaseInterface *dr, char *key_name)
 query module option as boolean
 
GF_EXPORT Bool gf_module_get_int (GF_BaseInterface *dr, char *key_name)
 query module option as int
 

Variables

GF_ModuleManager * gpac_modules_static = NULL
 

Macro Definition Documentation

◆ LOAD_PLUGIN

#define LOAD_PLUGIN (   __name)
Value:
{ \
GF_InterfaceRegister *gf_register_module_##__name(); \
pr = gf_register_module_##__name();\
if (!pr) {\
GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("Failed to statically load module ##__name\n"));\
} else {\
gf_list_add(mgr->plugin_registry, pr); \
} \
}
@ GF_LOG_CORE
Definition tools.h:759
@ GF_LOG_ERROR
Definition tools.h:724
Interface Registry.
Definition module.h:139

Function Documentation

◆ load_all_modules()

static void load_all_modules ( GF_ModuleManager *  mgr)
static

◆ gf_module_load_static()

GF_EXPORT GF_Err gf_module_load_static ( GF_InterfaceRegister *(*)()  register_module)

load a static module given its interface function

Parameters
register_modulethe register interface function
Returns
error if any

◆ gf_modules_refresh()

u32 gf_modules_refresh ( GF_ModuleManager *  pm)

◆ gf_modules_check_load()

static void gf_modules_check_load ( )
static

◆ gf_modules_refresh_module_directories()

void gf_modules_refresh_module_directories ( )

◆ gf_modules_new()

void gf_modules_new ( GF_Config *  config)

module manager construtcor

Constructs a module manager object.

Parameters
configGPAC configuration file handle. If this is NULL, the modules won't be able to share the configuration file with the rest of the GPAC framework.

◆ gf_module_reload_dirs()

void gf_module_reload_dirs ( )

◆ gf_modules_del()

void gf_modules_del ( )

module manager destructor

Destroys the module manager

◆ gf_module_is_loaded()

Bool gf_module_is_loaded ( GF_ModuleManager *  pm,
char *  filename 
)

◆ gf_modules_count()

GF_EXPORT u32 gf_modules_count ( )

get module count

Gets the number of modules found in the manager directory

Returns
the number of loaded modules

◆ gf_modules_load()

GF_EXPORT GF_BaseInterface * gf_modules_load ( u32  index,
u32  InterfaceFamily 
)

loads an interface

Loads an interface in the desired module.

Parameters
indexthe 0-based index of the module to load the interface from
InterfaceFamilytype of the interface to load
Returns
the interface object if found and loaded, NULL otherwise.

◆ gf_modules_load_filter()

void * gf_modules_load_filter ( u32  index,
void *  fsess 
)

filter module load

Loads a filter module (not using GF_BaseInterface) from its index. Returns NULL if no such filter.

Parameters
indexindex of the filter module to load
fsessopaque handle passed to the filter loader
Returns
the loaded filter register, or NULL if not found

◆ gf_modules_load_by_name()

GF_EXPORT GF_BaseInterface * gf_modules_load_by_name ( const char *  mod_name,
u32  InterfaceFamily,
Bool  rebrowse_all 
)

loads an interface by module name

Loads an interface in the desired module

Parameters
mod_namethe name of the module (shared library file) or of the interface as declared when registered.
InterfaceFamilytype of the interface to load
rebrowse_allif GF_TRUE, locate an interface for this type if not found by name
Returns
the interface object if found and loaded, NULL otherwise.

◆ gf_modules_close_interface()

GF_EXPORT GF_Err gf_modules_close_interface ( GF_BaseInterface interface_obj)

interface shutdown

Closes an interface

Parameters
interface_objthe interface to close
Returns
error if any

◆ gf_modules_get_file_name()

GF_EXPORT const char * gf_modules_get_file_name ( u32  index)

get module file name

Gets a module shared library file name based on its index

Parameters
indexthe 0-based index of the module to query
Returns
the name of the shared library module

◆ gf_module_get_file_name()

GF_EXPORT const char * gf_module_get_file_name ( GF_BaseInterface ifce)

get module file name

Gets a module shared library file name based on its index

Parameters
ifcethe module instance to query
Returns
the name of the shared library module

◆ module_check_ifce()

static Bool module_check_ifce ( GF_BaseInterface ifce,
u32  ifce_type 
)
static

◆ gf_module_load()

GF_BaseInterface * gf_module_load ( u32  ifce_type,
const char *  name 
)

module load

Loads a module based on a preferred name. If not found, check for predefined names for the given interface type in fthe global config and loads by predefined name. If still not found, enumerate modules.

Parameters
ifce_typetype of module interface to load
namename of preferred module
Returns
the loaded module, or NULL if not found

◆ gf_module_get_key()

GF_EXPORT const char * gf_module_get_key ( GF_BaseInterface ifce,
char *  key 
)

query module option

Loads a key from config in the module options.

Parameters
ifcethe module instance to query
keythe key to query
Returns
the key value or null

◆ gf_module_get_bool()

GF_EXPORT Bool gf_module_get_bool ( GF_BaseInterface ifce,
char *  key_name 
)

query module option as boolean

Loads a boolean key from config in the module options.

Parameters
ifcethe module instance to query
key_namethe key to query
Returns
GF_TRUE if key is found and equals yes, true or 1, GF_FALSE otherwise

◆ gf_module_get_int()

GF_EXPORT Bool gf_module_get_int ( GF_BaseInterface ifce,
char *  key_name 
)

query module option as int

Loads an integer key from config in the module options.

Parameters
ifcethe module instance to query
key_namethe key to query
Returns
integer value of key, 0 if not found

Variable Documentation

◆ gpac_modules_static

GF_ModuleManager* gpac_modules_static = NULL