GPAC
Open Source Multimedia Framework. For more information, check out http://gpac.wp.mines-telecom.fr
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups
tools.h File Reference

Base definitions and functions of GPAC. More...

#include <gpac/setup.h>
#include <gpac/version.h>
+ Include dependency graph for tools.h:
+ This graph shows which files directly or indirectly include this file:

Data Structures

struct  GF_SystemRTInfo
 run-time system info object More...
 

Macros

#define gf_stringizer(x)
 Stringizer. More...
 
#define GF_SAFEALLOC(__ptr, __struct)
 Memory allocation for a structure. More...
 
#define GF_SAFE_ALLOC_N(__ptr, __n, __struct)
 Memory allocation for an array of n structs. More...
 
#define GF_4CC(a, b, c, d)   (((a)<<24)|((b)<<16)|((c)<<8)|(d))
 4CC Formatting More...
 
#define GF_LOG(_log_level, _log_tools, __args)
 Message logging. More...
 

Typedefs

typedef void(* gf_log_cbk )(void *cbck, u32 log_level, u32 log_tool, const char *fmt, va_list vlist)
 Log Message Callback. More...
 
typedef Bool(* gf_enum_dir_item )(void *cbck, char *item_name, char *item_path)
 Directory Enumeration Callback. More...
 
typedef void(* gf_on_progress_cbk )(const void *cbck, const char *title, u64 done, u64 total)
 Progress Callback. More...
 

Enumerations

enum  GF_Err {
  GF_SCRIPT_INFO = 3, GF_PACKED_FRAMES = 2, GF_EOS = 1, GF_OK = 0,
  GF_BAD_PARAM = -1, GF_OUT_OF_MEM = -2, GF_IO_ERR = -3, GF_NOT_SUPPORTED = -4,
  GF_CORRUPTED_DATA = -5, GF_SG_UNKNOWN_NODE = -6, GF_SG_INVALID_PROTO = -7, GF_SCRIPT_ERROR = -8,
  GF_BUFFER_TOO_SMALL = -9, GF_NON_COMPLIANT_BITSTREAM = -10, GF_CODEC_NOT_FOUND = -11, GF_URL_ERROR = -12,
  GF_SERVICE_ERROR = -13, GF_REMOTE_SERVICE_ERROR = -14, GF_STREAM_NOT_FOUND = -15, GF_ISOM_INVALID_FILE = -20,
  GF_ISOM_INCOMPLETE_FILE = -21, GF_ISOM_INVALID_MEDIA = -22, GF_ISOM_INVALID_MODE = -23, GF_ISOM_UNKNOWN_DATA_REF = -24,
  GF_ODF_INVALID_DESCRIPTOR = -30, GF_ODF_FORBIDDEN_DESCRIPTOR = -31, GF_ODF_INVALID_COMMAND = -32, GF_BIFS_UNKNOWN_VERSION = -33,
  GF_IP_ADDRESS_NOT_FOUND = -40, GF_IP_CONNECTION_FAILURE = -41, GF_IP_NETWORK_FAILURE = -42, GF_IP_CONNECTION_CLOSED = -43,
  GF_IP_NETWORK_EMPTY = -44, GF_IP_SOCK_WOULD_BLOCK = -45, GF_IP_UDP_TIMEOUT = -46, GF_AUTHENTICATION_FAILURE = -50,
  GF_SCRIPT_NOT_READY = -51, GF_INVALID_CONFIGURATION = -52, GF_NOT_FOUND = -53, GF_MISSING_REQUIREMENTS = -54,
  GF_WRONG_DATAFORMAT = -55
}
 
enum  {
  GF_LOG_QUIET = 0, GF_LOG_ERROR, GF_LOG_WARNING, GF_LOG_INFO,
  GF_LOG_DEBUG
}
 
enum  {
  GF_LOG_CORE = 0, GF_LOG_CODING, GF_LOG_CONTAINER, GF_LOG_NETWORK,
  GF_LOG_RTP, GF_LOG_AUTHOR, GF_LOG_SYNC, GF_LOG_CODEC,
  GF_LOG_PARSER, GF_LOG_MEDIA, GF_LOG_SCENE, GF_LOG_SCRIPT,
  GF_LOG_INTERACT, GF_LOG_COMPOSE, GF_LOG_CACHE, GF_LOG_MMIO,
  GF_LOG_RTI, GF_LOG_SMIL, GF_LOG_MEMORY, GF_LOG_AUDIO,
  GF_LOG_MODULE, GF_LOG_MUTEX, GF_LOG_CONDITION, GF_LOG_DASH,
  GF_LOG_CONSOLE, GF_LOG_APP, GF_LOG_SCHEDULER, GF_LOG_ALL,
  GF_LOG_TOOL_MAX = GF_LOG_ALL
}
 
enum  { GF_RTI_ALL_PROCESSES_TIMES = 1, GF_RTI_PROCESS_MEMORY = 1<<1, GF_RTI_SYSTEM_MEMORY_ONLY = 1<<2 }
 

Functions

const char * gpac_features ()
 GPAC feature list. More...
 
const char * gf_4cc_to_str (u32 type)
 4CC Printing More...
 
int gf_asprintf (char **buffer, const char *fmt,...)
 asprintf() portable implementation More...
 
size_t gf_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream)
 file writing helper More...
 
FILE * gf_f64_open (const char *file_name, const char *mode)
 large file opening More...
 
u64 gf_f64_tell (FILE *f)
 large file position query More...
 
u64 gf_f64_seek (FILE *f, s64 pos, s32 whence)
 large file seeking More...
 
const char * gf_error_to_string (GF_Err e)
 Error Printing. More...
 
void gf_log_set_strict_error (Bool strict)
 Log exits at first error assignment. More...
 
char * gf_log_get_tools_levels ()
 gets string-formated log tools More...
 
void gf_log_set_tool_level (u32 tool, u32 level)
 Log modules assignment. More...
 
gf_log_cbk gf_log_set_callback (void *usr_cbk, gf_log_cbk cbk)
 Log overwrite. More...
 
void gf_log (const char *fmt,...)
 
void gf_log_lt (u32 ll, u32 lt)
 
Bool gf_log_tool_level_on (u32 log_tool, u32 log_level)
 Log level checking. More...
 
GF_Err gf_log_set_tools_levels (const char *log_tools_levels)
 Set log tools and levels. More...
 
GF_Err gf_log_modify_tools_levels (const char *val)
 Modify log tools and levels. More...
 
void gf_rand_init (Bool Reset)
 PseudoRandom Integer Generation Initialization. More...
 
u32 gf_rand ()
 PseudoRandom Integer Generation. More...
 
void gf_get_user_name (char *buf, u32 buf_size)
 user name More...
 
GF_Err gf_enum_directory (const char *dir, Bool enum_directory, gf_enum_dir_item enum_dir, void *cbck, const char *filter)
 Directory enumeration. More...
 
GF_Err gf_delete_file (const char *fileName)
 File Deletion. More...
 
GF_Err gf_move_file (const char *fileName, const char *newFileName)
 File Move. More...
 
FILE * gf_temp_file_new ()
 Temporary File Creation. More...
 
u64 gf_file_modification_time (const char *filename)
 File Modification Time. More...
 
void gf_set_progress (const char *title, u64 done, u64 total)
 Progress formatting. More...
 
void gf_set_progress_callback (void *user_cbk, gf_on_progress_cbk prog_cbk)
 Progress overwriting. More...
 
Bool gf_prompt_has_input ()
 Prompt checking. More...
 
char gf_prompt_get_char ()
 Prompt character flush. More...
 
void gf_prompt_set_echo_off (Bool echo_off)
 turns prompt echo on/off More...
 
void gf_sys_init (Bool enable_memory_tracker)
 System setup. More...
 
void gf_sys_close ()
 System closing. More...
 
u32 gf_sys_clock ()
 System clock query. More...
 
void gf_sleep (u32 ms)
 Sleeps thread/process. More...
 
GF_Err gf_rmdir (char *DirPathName)
 Delete Directory. More...
 
GF_Err gf_mkdir (char *DirPathName)
 Create Directory. More...
 
GF_Err gf_cleanup_dir (char *DirPathName)
 Create Directory. More...
 
u32 gf_crc_32 (const char *data, u32 size)
 CRC32 compute. More...
 
u64 gf_net_get_utc ()
 gets UTC time in milliseconds More...
 
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 More...
 
s32 gf_net_get_timezone ()
 gets timezone adjustment in seconds More...
 
GF_Err gf_bin128_parse (char *string, bin128 value)
 parses 128 bit from string More...
 
Bool gf_sys_get_rti (u32 refresh_time_ms, GF_SystemRTInfo *rti, u32 flags)
 Gets Run-Time info. More...
 
Bool gf_sys_get_battery_state (Bool *onBattery, u32 *onCharge, u32 *level, u32 *batteryLifeTime, u32 *batteryFullLifeTime)
 
GF_GlobalLockgf_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])
 

Detailed Description

This file contains basic functions and core definitions of the GPAC framework. This file is usually included by all GPAC header files since it contains the error definitions.