![]() |
libgpac
Documentation of the core library of GPAC
|
Library configuration. More...
Enumerations | |
enum | GF_MemTrackerType { GF_MemTrackerNone = 0 , GF_MemTrackerSimple , GF_MemTrackerBackTrace } |
enum | GF_ConsoleCodes { GF_CONSOLE_RESET =0 , GF_CONSOLE_RED , GF_CONSOLE_GREEN , GF_CONSOLE_BLUE , GF_CONSOLE_YELLOW , GF_CONSOLE_CYAN , GF_CONSOLE_WHITE , GF_CONSOLE_MAGENTA , GF_CONSOLE_CLEAR , GF_CONSOLE_SAVE , GF_CONSOLE_RESTORE , GF_CONSOLE_BOLD = 1<<16 , GF_CONSOLE_ITALIC = 1<<17 , GF_CONSOLE_UNDERLINED = 1<<18 , GF_CONSOLE_STRIKE = 1<<19 } |
Functions | |
GF_Err | gf_sys_init (GF_MemTrackerType mem_tracker_type, const char *profile) |
System setup. More... | |
void | gf_sys_close () |
System closing. More... | |
GF_Err | gf_sys_set_args (s32 argc, const char **argv) |
System arguments. More... | |
u32 | gf_sys_get_argc () |
Get number of args. More... | |
const char ** | gf_sys_get_argv () |
Get program arguments. More... | |
const char * | gf_sys_get_arg (u32 arg) |
Get number of args. More... | |
const char * | gf_sys_find_global_arg (const char *arg) |
Locate a global filter arg. More... | |
void | gf_sys_mark_arg_used (s32 arg_idx, Bool used) |
Mark arg as used. More... | |
Bool | gf_sys_is_arg_used (s32 arg_idx) |
Check if arg is marked as used. More... | |
Bool | gf_sys_is_test_mode () |
checks if test mode is enabled More... | |
Bool | gf_sys_old_arch_compat () |
checks if compatibility with old arch is enabled More... | |
u32 | gf_sys_is_quiet () |
checks if running in quiet mode More... | |
const char * | gf_sys_features (Bool disabled) |
Bool | gf_sys_solve_path (const char *tpl_path, char szPath[GF_MAX_PATH]) |
GF_Err | gf_sys_enable_rmtws (Bool start) |
void | gf_sys_set_console_code (FILE *std, GF_ConsoleCodes code) |
const char * | gf_opts_get_key (const char *secName, const char *keyName) |
GF_Err | gf_opts_set_key (const char *secName, const char *keyName, const char *keyValue) |
void | gf_opts_del_section (const char *secName) |
u32 | gf_opts_get_section_count () |
const char * | gf_opts_get_section_name (u32 secIndex) |
u32 | gf_opts_get_key_count (const char *secName) |
const char * | gf_opts_get_key_name (const char *secName, u32 keyIndex) |
Bool | gf_opts_get_bool (const char *secName, const char *keyName) |
u32 | gf_opts_get_int (const char *secName, const char *keyName) |
const char * | gf_opts_get_key_restricted (const char *secName, const char *keyName) |
GF_Err | gf_opts_discard_changes () |
GF_Err | gf_opts_save () |
const char * | gf_opts_get_filename () |
Bool | gf_opts_default_shared_directory (char *path_buffer) |
GF_Err | gf_creds_check_password (const char *username, char *password) |
Bool | gf_creds_check_membership (const char *username, const char *users, const char *groups) |
Library configuration.
These functions are used to initialize, shutdown and configure libgpac.
The library shall be initialized using gf_sys_init and terminated using gf_sys_close
The library can usually be configured from command line if your program uses gf_sys_set_args.
The library can also be configured from your program using gf_opts_set_key and related functions right after initializing the library.
For more information on configuration options, see
and https://wiki.gpac.io/Filters/core_options
For more information on filters configuration options, see https://wiki.gpac.io/Filters/Filters
enum GF_MemTrackerType |
enum GF_ConsoleCodes |
GPAC Log tools
Describes the color code for console print
GF_Err gf_sys_init | ( | GF_MemTrackerType | mem_tracker_type, |
const char * | profile | ||
) |
System setup.
Inits system tools (GPAC global config, high-resolution clock if any, CPU usage manager, random number, ...).
You MUST call this function before calling any libgpac function, typically only once at startup.
The profile allows using a different global config file than the default, and may be a name (without / or \) or point to an existing config file.
mem_tracker_type | memory tracking mode |
profile | name of the profile to load, NULL for default. |
void gf_sys_close | ( | ) |
System closing.
Closes allocated system resources opened by gf_sys_init.
When JavaScript APIs are loaded, the JS runtime is destroyed in this function call. If your application needs to reload GPAC a second time after this, you MUST prevent JS runtime destruction otherwise the application will crash due to static JS class definitions refering to freed memory. To prevent destruction, make sure you have called
before calling gf_sys_close. For example:
System arguments.
Sets the user app arguments (used by GUI mode)
argc | Number of arguments |
argv | Array of arguments - the first string is ignored (considered to be the executable name) |
u32 gf_sys_get_argc | ( | ) |
Get number of args.
Gets the number of argument of the user application if any
const char** gf_sys_get_argv | ( | ) |
Get program arguments.
Gets the arguments of the user application if any
const char* gf_sys_get_arg | ( | u32 | arg | ) |
Get number of args.
Gets the number of argument of the user application if any
arg | Index of argument to retrieve |
const char* gf_sys_find_global_arg | ( | const char * | arg | ) |
Locate a global filter arg.
Looks for a filter option specified as global argument
arg | name of option to search, without "--" or "-+" specififers |
Mark arg as used.
Marks the argument at given index as used. By default all args are marked as not used when assigning args
arg_idx | Index of argument to mark |
used | flag to set |
Check if arg is marked as used.
Marks the argument at given index as used
arg_idx | Index of argument to mark |
Bool gf_sys_is_test_mode | ( | ) |
checks if test mode is enabled
Checks if test mode is enabled (no date nor GPAC version should be written).
Bool gf_sys_old_arch_compat | ( | ) |
checks if compatibility with old arch is enabled
Checks if compatibility with old arch is enabled - this function will be removed when master will be moved to filters branch
u32 gf_sys_is_quiet | ( | ) |
checks if running in quiet mode
Checks if quiet mode is enabled
const char* gf_sys_features | ( | Bool | disabled | ) |
gets GPAC feature list in this GPAC build
disabled | if GF_TRUE, gets disabled features, otherwise gets enabled features |
Bool gf_sys_solve_path | ( | const char * | tpl_path, |
char | szPath[GF_MAX_PATH] | ||
) |
solves path starting with replacement keywords:
tpl_path | url to translate, must start with $GDOCS or $GCFG |
szPath | path to store the result |
Enables or disables the rmt websocket monitoring server
start | If true starts the webserver, if false stops it |
void gf_sys_set_console_code | ( | FILE * | std, |
GF_ConsoleCodes | code | ||
) |
sets console code
std | the output stream (stderr or stdout) |
code | the console code to set |
const char* gf_opts_get_key | ( | const char * | secName, |
const char * | keyName | ||
) |
gets a global config key value from its section and name.
secName | the desired key parent section name |
keyName | the desired key name |
GF_Err gf_opts_set_key | ( | const char * | secName, |
const char * | keyName, | ||
const char * | keyValue | ||
) |
sets a global config key value from its section and name.
secName | the desired key parent section name |
keyName | the desired key name |
keyValue | the desired key value |
void gf_opts_del_section | ( | const char * | secName | ) |
removes all entries in the given section of the global config
secName | the target section |
u32 gf_opts_get_section_count | ( | ) |
gets the number of sections in the global config
const char* gf_opts_get_section_name | ( | u32 | secIndex | ) |
gets a section name based on its index in the global config
secIndex | 0-based index of the section to query |
u32 gf_opts_get_key_count | ( | const char * | secName | ) |
gets the number of keys in a section of the global config
secName | the target section |
const char* gf_opts_get_key_name | ( | const char * | secName, |
u32 | keyIndex | ||
) |
gets the number of keys in a section of the global config
secName | the target section |
keyIndex | 0-based index of the key in the section |
Bool gf_opts_get_bool | ( | const char * | secName, |
const char * | keyName | ||
) |
gets a global config boolean value from its section and name.
secName | the desired key parent section name |
keyName | the desired key name |
u32 gf_opts_get_int | ( | const char * | secName, |
const char * | keyName | ||
) |
gets a global config integer value from its section and name.
secName | the desired key parent section name |
keyName | the desired key name |
const char* gf_opts_get_key_restricted | ( | const char * | secName, |
const char * | keyName | ||
) |
gets a global config key value from its section and name.
secName | the desired key parent section name |
keyName | the desired key name |
GF_Err gf_opts_discard_changes | ( | ) |
Do not save modification to global options
GF_Err gf_opts_save | ( | ) |
Force immediate write of config
const char* gf_opts_get_filename | ( | ) |
Returns file name of global config
Bool gf_opts_default_shared_directory | ( | char * | path_buffer | ) |
Gets GPAC shared directory (gui, shaders, etc ..)
path_buffer | GF_MAX_PATH buffer to store output |
GF_Err gf_creds_check_password | ( | const char * | username, |
char * | password | ||
) |
Checks given user and password are valid
username | user name |
password | password |
Bool gf_creds_check_membership | ( | const char * | username, |
const char * | users, | ||
const char * | groups | ||
) |
Checks given user belongs to list of users or groups.
username | user name |
users | comma-seprated list of users to check, may be NULL |
groups | comma-seprated list of groups to check, may be NULL |