![]() |
libgpac
Documentation of the core library of GPAC
|
Memory management. More...
Collaboration diagram for Memory Management:Data Structures | |
| struct | GF_TimeCode |
| timecode type More... | |
Macros | |
| #define | GF_SAFEALLOC(__ptr, __struct) |
| Memory allocation for a structure. | |
| #define | GF_SAFE_ALLOC_N(__ptr, __n, __struct) |
| Memory allocation for an array of n structs. | |
Functions | |
| void | gf_free (void *ptr) |
| void * | gf_malloc (size_t size) |
| void * | gf_calloc (size_t num, size_t size_of) |
| char * | gf_strdup (const char *str) |
| void * | gf_realloc (void *ptr, size_t size) |
| GF_Err | gf_dynstrcat (char **str, const char *to_append, const char *sep) |
| dynamic string concatenation | |
| Bool | gf_parse_lfrac (const char *str, GF_Fraction64 *frac) |
| fraction parsing | |
| Bool | gf_parse_frac (const char *str, GF_Fraction *frac) |
| fraction parsing | |
| Bool | gf_strnistr (const char *text, const char *subtext, u32 subtext_len) |
| search string without case | |
| const char * | gf_strmemstr (const char *data, u32 data_size, const char *pat) |
| search string in buffer | |
| u64 | gf_timestamp_rescale (u64 value, u64 timescale, u64 new_timescale) |
| safe timestamp rescale | |
| s64 | gf_timestamp_rescale_signed (s64 value, u64 timescale, u64 new_timescale) |
| safe signed timestamp rescale | |
| Bool | gf_timestamp_less (u64 value1, u64 timescale1, u64 value2, u64 timescale2) |
| compare timestamps | |
| Bool | gf_timestamp_less_or_equal (u64 value1, u64 timescale1, u64 value2, u64 timescale2) |
| compare timestamps | |
| Bool | gf_timestamp_greater (u64 value1, u64 timescale1, u64 value2, u64 timescale2) |
| compare timestamps | |
| Bool | gf_timestamp_greater_or_equal (u64 value1, u64 timescale1, u64 value2, u64 timescale2) |
| compare timestamps | |
| Bool | gf_timestamp_equal (u64 value1, u64 timescale1, u64 value2, u64 timescale2) |
| compare timestamps | |
| Bool | gf_strict_atoi (const char *str, s32 *ans) |
| strict convert str into integer | |
| Bool | gf_strict_atoui (const char *str, u32 *ans) |
| strict convert str into unsigned integer | |
| const char * | gf_format_duration (u64 dur, u32 timescale, char szDur[100]) |
| formats a duration | |
| const char * | gf_format_timecode (GF_TimeCode *tc, char szTimecode[100]) |
| formats a timecode | |
| u64 | gf_timecode_to_timestamp (GF_TimeCode *tc, u32 timescale) |
| converts a timecode to timestamp | |
| Bool | gf_timecode_less (GF_TimeCode *value1, GF_TimeCode *value2) |
| compare timecodes | |
| Bool | gf_timecode_less_or_equal (GF_TimeCode *value1, GF_TimeCode *value2) |
| compare timecodes | |
| Bool | gf_timecode_greater (GF_TimeCode *value1, GF_TimeCode *value2) |
| compare timecodes | |
| Bool | gf_timecode_greater_or_equal (GF_TimeCode *value1, GF_TimeCode *value2) |
| compare timecodes | |
| Bool | gf_timecode_equal (GF_TimeCode *value1, GF_TimeCode *value2) |
| compare timecodes | |
| u8 | gf_cenc_key_info_get_iv_size (const u8 *key_info, u32 key_info_size, u32 key_idx, u8 *const_iv_size, const u8 **const_iv) |
| Get CENC IV size. | |
| Bool | gf_cenc_validate_key_info (const u8 *key_info, u32 key_info_size) |
| validate a CENC key info chunk | |
Memory management.
GPAC can use its own memory tracker, depending on compilation option. It is recommended to use only the functions defined in this section to allocate and free memory whenever developing within the GPAC library.
| struct GF_TimeCode |
| #define GF_SAFEALLOC | ( | __ptr, | |
| __struct | |||
| ) |
Memory allocation for a structure.
Macro allocating memory and zero-ing it
| #define GF_SAFE_ALLOC_N | ( | __ptr, | |
| __n, | |||
| __struct | |||
| ) |
Memory allocation for an array of n structs.
Macro allocating memory for n structures and zero-ing it
| void gf_free | ( | void * | ptr | ) |
free memory allocated with gpac
| ptr | same as free() |
| void * gf_malloc | ( | size_t | size | ) |
| void * gf_calloc | ( | size_t | num, |
| size_t | size_of | ||
| ) |
allocates memory array, shall be freed using gf_free
| num | same as calloc() |
| size_of | same as calloc() |
Here is the caller graph for this function:| char * gf_strdup | ( | const char * | str | ) |
duplicates string, shall be freed using gf_free
| str | same as strdup() |
| void * gf_realloc | ( | void * | ptr, |
| size_t | size | ||
| ) |
| GF_Err gf_dynstrcat | ( | char ** | str, |
| const char * | to_append, | ||
| const char * | sep | ||
| ) |
dynamic string concatenation
Dynamic concatenation of string with optional separator
| str | pointer to destination string pointer |
| to_append | string to append |
| sep | optional separator string to insert before concatenation. If set and initial string is NULL, will not be appended |
Here is the call graph for this function:
Here is the caller graph for this function:| Bool gf_parse_lfrac | ( | const char * | str, |
| GF_Fraction64 * | frac | ||
| ) |
fraction parsing
Parse a 64 bit fraction from string
| str | string to parse |
| frac | fraction to fill |
Here is the caller graph for this function:| Bool gf_parse_frac | ( | const char * | str, |
| GF_Fraction * | frac | ||
| ) |
fraction parsing
Parse a 32 bit fraction from string
| str | string to parse |
| frac | fraction to fill |
Here is the call graph for this function:
Here is the caller graph for this function:search string without case
Search a substring in a string without checking for case
| text | text to search |
| subtext | string to find |
| subtext_len | length of string to find |
Here is the caller graph for this function:| const char * gf_strmemstr | ( | const char * | data, |
| u32 | data_size, | ||
| const char * | pat | ||
| ) |
search string in buffer
Search for a substring in a memory buffer of characters that may not be null-terminated
| data | buffer of chars in which to search |
| data_size | size of data buffer |
| pat | pattern to search for as a null-terminated string |
Here is the caller graph for this function:safe timestamp rescale
Rescale a 64 bit timestamp value to new timescale, i.e. performs value * new_timescale / timescale
| value | value to rescale. A value of -1 means no timestamp defined and is returned unmodified |
| timescale | timescale of value. Assumed to be less than 0xFFFFFFFF |
| new_timescale | new timescale? Assumed to be less than 0xFFFFFFFF |
Here is the caller graph for this function:safe signed timestamp rescale
Rescale a 64 bit timestamp value to new timescale, i.e. performs value * new_timescale / timescale
| value | value to rescale |
| timescale | timescale of value. Assumed to be less than 0xFFFFFFFF |
| new_timescale | new timescale. Assumed to be less than 0xFFFFFFFF |
Here is the caller graph for this function:compare timestamps
Compares two timestamps
| value1 | value to rescale |
| timescale1 | timescale of value. Assumed to be less than 0xFFFFFFFF |
| value2 | value to rescale |
| timescale2 | timescale of value. Assumed to be less than 0xFFFFFFFF |
Here is the caller graph for this function:compare timestamps
Compares two timestamps
| value1 | value to rescale |
| timescale1 | timescale of value. Assumed to be less than 0xFFFFFFFF |
| value2 | value to rescale |
| timescale2 | timescale of value. Assumed to be less than 0xFFFFFFFF |
Here is the caller graph for this function:compare timestamps
Compares two timestamps
| value1 | value to rescale |
| timescale1 | timescale of value. Assumed to be less than 0xFFFFFFFF |
| value2 | value to rescale |
| timescale2 | timescale of value. Assumed to be less than 0xFFFFFFFF |
Here is the caller graph for this function:compare timestamps
Compares two timestamps
| value1 | value to rescale |
| timescale1 | timescale of value. Assumed to be less than 0xFFFFFFFF |
| value2 | value to rescale |
| timescale2 | timescale of value. Assumed to be less than 0xFFFFFFFF |
Here is the caller graph for this function:compare timestamps
Compares two timestamps
| value1 | value to rescale |
| timescale1 | timescale of value. Assumed to be less than 0xFFFFFFFF |
| value2 | value to rescale |
| timescale2 | timescale of value. Assumed to be less than 0xFFFFFFFF |
Here is the caller graph for this function:strict convert str into integer
Validate and parse str into integer
| str | text to convert to integer |
| ans | integer to fill |
strict convert str into unsigned integer
Validate and parse str into integer
| str | text to convert to integer |
| ans | unsigned integer to fill |
Here is the caller graph for this function:formats a duration
Formats a duration into a string
| dur | duration expressed in timescale |
| timescale | number of ticks per second in duration |
| szDur | the buffer to format |
Here is the call graph for this function:
Here is the caller graph for this function:| const char * gf_format_timecode | ( | GF_TimeCode * | tc, |
| char | szTimecode[100] | ||
| ) |
formats a timecode
Formats a timecode into a string
| tc | timecode to format |
| szTimecode | the buffer to format |
Here is the caller graph for this function:| u64 gf_timecode_to_timestamp | ( | GF_TimeCode * | tc, |
| u32 | timescale | ||
| ) |
converts a timecode to timestamp
Converts a timecode to a timestamp in the given timescale
| tc | timecode to convert |
| timescale | timescale to convert to |
Here is the call graph for this function:
Here is the caller graph for this function:| Bool gf_timecode_less | ( | GF_TimeCode * | value1, |
| GF_TimeCode * | value2 | ||
| ) |
compare timecodes
Compares two timecodes
| value1 | value to compare |
| value2 | value to compare |
Here is the caller graph for this function:| Bool gf_timecode_less_or_equal | ( | GF_TimeCode * | value1, |
| GF_TimeCode * | value2 | ||
| ) |
compare timecodes
Compares two timecodes
| value1 | value to compare |
| value2 | value to compare |
Here is the caller graph for this function:| Bool gf_timecode_greater | ( | GF_TimeCode * | value1, |
| GF_TimeCode * | value2 | ||
| ) |
compare timecodes
Compares two timecodes
| value1 | value to compare |
| value2 | value to compare |
Here is the caller graph for this function:| Bool gf_timecode_greater_or_equal | ( | GF_TimeCode * | value1, |
| GF_TimeCode * | value2 | ||
| ) |
compare timecodes
Compares two timecodes
| value1 | value to compare |
| value2 | value to compare |
| Bool gf_timecode_equal | ( | GF_TimeCode * | value1, |
| GF_TimeCode * | value2 | ||
| ) |
compare timecodes
Compares two timecodes
| value1 | value to compare |
| value2 | value to compare |
| u8 gf_cenc_key_info_get_iv_size | ( | const u8 * | key_info, |
| u32 | key_info_size, | ||
| u32 | key_idx, | ||
| u8 * | const_iv_size, | ||
| const u8 ** | const_iv | ||
| ) |
Get CENC IV size.
Get CENC IV size from a key info chunk
| key_info | CENC key info buffer |
| key_info_size | CENC key info buffer size |
| key_idx | index of key for multi-key cases, 0 otherwise |
| const_iv_size | set to const IV size if const IV is used, otherwise set to 0 - can be NULL |
| const_iv | set to const IV start in key_info buffer when constant IV is used, otherwise set to NULL - can be NULL |
Here is the caller graph for this function:validate a CENC key info chunk
Checks whether a CENC key info chunk is valid or not
| key_info | CENC key info buffer |
| key_info_size | CENC key info buffer size |
Here is the caller graph for this function: