System time and CPU functions. More...
![]() |
Data Structures | |
struct | GF_SystemRTInfo |
run-time system info object More... | |
Defines | |
#define | GF_SHA1_DIGEST_SIZE 20 |
#define | GF_SHA1_DIGEST_SIZE_HEXA 41 |
Typedefs | |
typedef struct _GF_GlobalLock_opaque | GF_GlobalLock |
typedef struct __sha1_context | GF_SHA1Context |
Enumerations | |
enum | { GF_RTI_ALL_PROCESSES_TIMES = 1, GF_RTI_PROCESS_MEMORY = 1<<1, GF_RTI_SYSTEM_MEMORY_ONLY = 1<<2 } |
Functions | |
void | gf_sys_init (Bool enable_memory_tracker) |
System setup. | |
void | gf_sys_close () |
System closing. | |
void | gf_sys_set_args (s32 argc, const char **argv) |
System arguments. | |
u32 | gf_sys_get_argc () |
Get number of args. | |
const char * | gf_sys_get_arg (u32 arg) |
Get number of args. | |
u32 | gf_sys_clock () |
System clock query. | |
u64 | gf_sys_clock_high_res () |
High precision system clock query. | |
void | gf_sleep (u32 ms) |
Sleeps thread/process. | |
GF_Err | gf_rmdir (char *DirPathName) |
Delete Directory. | |
GF_Err | gf_mkdir (char *DirPathName) |
Create Directory. | |
GF_Err | gf_cleanup_dir (char *DirPathName) |
Create Directory. | |
u32 | gf_crc_32 (const char *data, u32 size) |
CRC32 compute. | |
u64 | gf_net_get_utc () |
gets UTC time in milliseconds | |
u64 | gf_net_parse_date (const char *date) |
parses date and returns UTC value for this date. Date format is an XSD dateTime format or any of the supported formats from HTTP 1.1: Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() formatgets UTC time in milliseconds | |
s32 | gf_net_get_timezone () |
gets timezone adjustment in seconds | |
GF_Err | gf_bin128_parse (char *string, bin128 value) |
parses 128 bit from string | |
Bool | gf_sys_get_rti (u32 refresh_time_ms, GF_SystemRTInfo *rti, u32 flags) |
Gets Run-Time info. | |
Bool | gf_sys_get_battery_state (Bool *onBattery, u32 *onCharge, u32 *level, u32 *batteryLifeTime, u32 *batteryFullLifeTime) |
GF_GlobalLock * | gf_global_resource_lock (const char *resourceName) |
GF_Err | gf_global_resource_unlock (GF_GlobalLock *lock) |
char * | gf_get_default_cache_directory () |
GF_Err | gf_gz_compress_payload (char **data, u32 data_len, u32 *out_size) |
GF_Err | gf_gz_decompress_payload (char *data, u32 data_len, char **uncompressed_data, u32 *out_size) |
GF_SHA1Context * | gf_sha1_starts () |
void | gf_sha1_update (GF_SHA1Context *ctx, u8 *input, u32 length) |
void | gf_sha1_finish (GF_SHA1Context *ctx, u8 digest[20]) |
int | gf_sha1_file (const char *filename, u8 digest[20]) |
void | gf_sha1_csum (u8 *buf, u32 buflen, u8 digest[20]) |
void | gf_sha1_csum_hexa (u8 *buf, u32 buflen, u8 digest[41]) |
This section documents time functionalities and CPU management in GPAC.
#define GF_SHA1_DIGEST_SIZE 20 |
#define GF_SHA1_DIGEST_SIZE_HEXA 41 |
typedef struct _GF_GlobalLock_opaque GF_GlobalLock |
typedef struct __sha1_context GF_SHA1Context |
anonymous enum |
Selection flags for run-time info retrieval
void gf_sys_init | ( | Bool | enable_memory_tracker | ) |
Inits the system high-resolution clock if any, and CPU usage manager. It is strongly recommended to call this function before calling any other GPAC functions, since on some systems (like winCE) it may result in a better memory usage estimation.
void gf_sys_close | ( | ) |
Closes the system high-resolution clock and any CPU associated ressources.
void gf_sys_set_args | ( | s32 | argc, | |
const char ** | argv | |||
) |
Sets the user app arguments (used by GUI mode)
argc | Number of arguments | |
argv | Array of arguments |
u32 gf_sys_get_argc | ( | ) |
Gets the number of argument of the user application if any
const char* gf_sys_get_arg | ( | u32 | arg | ) |
Gets the number of argument of the user application if any
arg | Index of argument to retrieve |
u32 gf_sys_clock | ( | ) |
Gets the system clock time.
u64 gf_sys_clock_high_res | ( | ) |
Gets the hight precision system clock time.
void gf_sleep | ( | u32 | ms | ) |
Locks calling thread/process execution for a given time.
ms | Amount of time to sleep in milliseconds. |
GF_Err gf_rmdir | ( | char * | DirPathName | ) |
Delete a dir within the full path.
DirPathName | the file path name. |
GF_Err gf_mkdir | ( | char * | DirPathName | ) |
Create a directory within the full path.
DirPathName | the dir path name. |
GF_Err gf_cleanup_dir | ( | char * | DirPathName | ) |
Cleanup a directory within the full path, removing all the files and the directories.
DirPathName | the dir path name. |
Computes the CRC32 value of a buffer.
data | buffer | |
size | buffer size |
u64 gf_net_get_utc | ( | ) |
Gets UTC clock in milliseconds
u64 gf_net_parse_date | ( | const char * | date | ) |
date | string containing the date to parse |
s32 gf_net_get_timezone | ( | ) |
Gets timezone adjustment in seconds, with localtime - timezone = UTC time
Parses 128 bit from string
string | the string containing the value in hexa. Non alphanum characters are skipped | |
value | the value parsed |
Bool gf_sys_get_rti | ( | u32 | refresh_time_ms, | |
GF_SystemRTInfo * | rti, | |||
u32 | flags | |||
) |
Gets CPU and memory usage info for the calling process and the system. Information gathering is controled through timeout values.
refresh_time_ms | refresh time period in milliseconds. If the last sampling was done less than this period ago, the run-time info is not refreshed. | |
rti | holder to the run-time info structure to update. | |
flags | specify which info is to be retrieved. |
Bool gf_sys_get_battery_state | ( | Bool * | onBattery, | |
u32 * | onCharge, | |||
u32 * | level, | |||
u32 * | batteryLifeTime, | |||
u32 * | batteryFullLifeTime | |||
) |
GF_GlobalLock* gf_global_resource_lock | ( | const char * | resourceName | ) |
This function allows the user to create a global lock for all GPAC instances. This allow to disable some features for other instances for instance.
resourceName | The name of the resource to lock |
GF_Err gf_global_resource_unlock | ( | GF_GlobalLock * | lock | ) |
Unlock a previouly locked resource
lock | The resource to unlock |
char* gf_get_default_cache_directory | ( | ) |
Gets a newly allocated string containing the default cache directory. It is the responsibility of the caller to free the string.
Compresses a data buffer in place using zlib. Buffer may be reallocated in the process.
data | pointer to the data buffer to be compressed | |
data_len | length of the data buffer to be compressed | |
out_size | pointer for output buffer size |
GF_Err gf_gz_decompress_payload | ( | char * | data, | |
u32 | data_len, | |||
char ** | uncompressed_data, | |||
u32 * | out_size | |||
) |
Decompresses a data buffer using zlib.
data | data buffer to be decompressed | |
data_len | length of the data buffer to be decompressed | |
uncompressed_data | pointer to the uncompressed data buffer. It is the responsibility of the caller to free this buffer. | |
out_size | size of the uncompressed buffer |
GF_SHA1Context* gf_sha1_starts | ( | ) |
void gf_sha1_update | ( | GF_SHA1Context * | ctx, | |
u8 * | input, | |||
u32 | length | |||
) |
void gf_sha1_finish | ( | GF_SHA1Context * | ctx, | |
u8 | digest[20] | |||
) |
int gf_sha1_file | ( | const char * | filename, | |
u8 | digest[20] | |||
) |