![]() |
libgpac
Documentation of the core library of GPAC. For more information, check out http://gpac.wp.mines-telecom.fr
|
Base definitions and functions of GPAC. More...
Modules | |
Time tools | |
System time and CPU functions. | |
Data Structures | |
struct | GF_FileEnumInfo |
FileEnum 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... | |
Typedefs | |
typedef Bool(* | gf_enum_dir_item) (void *cbck, char *item_name, char *item_path, GF_FileEnumInfo *file_info) |
Directory Enumeration Callback. More... | |
typedef void(* | gf_on_progress_cbk) (const void *cbck, const char *title, u64 done, u64 total) |
Progress Callback. More... | |
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_fopen (const char *file_name, const char *mode) |
large file opening More... | |
s32 | gf_fclose (FILE *file) |
file closing More... | |
u64 | gf_ftell (FILE *f) |
large file position query More... | |
u64 | gf_fseek (FILE *f, s64 pos, s32 whence) |
large file seeking 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 (char **const fileName) |
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... | |
This section documents some very basic functions and core definitions of the GPAC framework.
struct GF_FileEnumInfo |
The FileEnumInfo object is used to get file attributes upon enumeration of a directory.
Data Fields | ||
---|---|---|
Bool | hidden |
File is marked as hidden |
Bool | directory |
File is a directory |
Bool | drive |
File is a drive mountpoint |
Bool | system |
File is a system file |
u64 | size |
File size in bytes |
u64 | last_modified |
File last modif time in UTC seconds |
#define gf_stringizer | ( | x | ) |
Macro transforming its input name into a string
#define GF_SAFEALLOC | ( | __ptr, | |
__struct | |||
) |
Macro allocating memory and zero-ing it
#define GF_SAFE_ALLOC_N | ( | __ptr, | |
__n, | |||
__struct | |||
) |
Macro allocating memory for n structures and zero-ing it
#define GF_4CC | ( | a, | |
b, | |||
c, | |||
d | |||
) | (((a)<<24)|((b)<<16)|((c)<<8)|(d)) |
Macro formating a 4-character code (or 4CC) "abcd" as 0xAABBCCDD
typedef Bool(* gf_enum_dir_item) (void *cbck, char *item_name, char *item_path, GF_FileEnumInfo *file_info) |
The gf_enum_dir_item type is the type for the callback of the gf_enum_directory function
cbck | Opaque user data. |
item_name | File or directory name. |
item_path | File or directory full path and name from filesystem root. |
file_info | information for the file or directory. |
The gf_on_progress_cbk type is the type for the callback of the gf_set_progress_callback function
cbck | Opaque user data. |
title | preogress title. |
done | Current amount performed of the action |
total | Total amount of the action. |
const char* gpac_features | ( | ) |
returns the list of features enabled/disabled in this GPAC build.
const char* gf_4cc_to_str | ( | u32 | type | ) |
returns a 4CC printable form
int gf_asprintf | ( | char ** | buffer, |
const char * | fmt, | ||
... | |||
) |
similar to sprintf, except it allows the string on the
size_t gf_fwrite | ( | const void * | ptr, |
size_t | size, | ||
size_t | nmemb, | ||
FILE * | stream | ||
) |
Wrapper to properly handle calls to fwrite() Ensures proper error handling is invoked when it fails.
FILE* gf_fopen | ( | const char * | file_name, |
const char * | mode | ||
) |
Opens a large file (>4GB)
file_name | Same semantics as fopen |
mode | Same semantics as fopen |
s32 gf_fclose | ( | FILE * | file | ) |
Closes a file
file | file to close |
u64 gf_ftell | ( | FILE * | f | ) |
Queries the current read/write position in a large file
f | Same semantics as ftell |
Seeks the current read/write position in a large file
f | Same semantics as fseek |
pos | Same semantics as fseek |
whence | Same semantics as fseek |
void gf_rand_init | ( | Bool | Reset | ) |
Sets the starting point for generating a series of pseudorandom integers.
Reset | Re-initializes the random number generator |
u32 gf_rand | ( | ) |
Returns a pseudorandom integer.
void gf_get_user_name | ( | char * | buf, |
u32 | buf_size | ||
) |
Gets current user (login) name.
GF_Err gf_enum_directory | ( | const char * | dir, |
Bool | enum_directory, | ||
gf_enum_dir_item | enum_dir, | ||
void * | cbck, | ||
const char * | filter | ||
) |
Enumerates a directory content. Feedback is provided by the enum_dir_item function
dir | Directory to enumerate |
enum_directory | If set, only directories will be enumerated, otherwise only files are. |
enum_dir | gf_enum_dir_item callback function for enumeration. |
cbck | Opaque user data passed to callback function. |
filter | optional filter for file extensions. If a file extension without the dot '.' character is not found in the filter the file will be skipped. |
GF_Err gf_delete_file | ( | const char * | fileName | ) |
Deletes a file from the disk.
fileName | absolute name of the file or name relative to the current working directory. |
GF_Err gf_move_file | ( | const char * | fileName, |
const char * | newFileName | ||
) |
Moves or renames a file or directory.
fileName | absolute path of the file / directory to move or rename |
newFileName | absolute new path/name of the file / directory |
FILE* gf_temp_file_new | ( | char **const | fileName | ) |
Creates a new temporary file in binary mode
fileName | if not NULL, strdup() of the temporary filename when created by GPAC (NULL otherwise as the system automatically removes its own tmp files) |
u64 gf_file_modification_time | ( | const char * | filename | ) |
Returns the modification time of the given file. The exact meaning of this value is system dependent
filename | file to check |
Signals progress in GPAC's operations. Note that progress signaling with this function is not thread-safe, the main purpose is to use it for authoring tools only.
title | title string of the progress, or NULL for no progress |
done | Current amount performed of the action. |
total | Total amount of the action. |
void gf_set_progress_callback | ( | void * | user_cbk, |
gf_on_progress_cbk | prog_cbk | ||
) |
Iverwrites the progress signaling function by a user-defined one.
user_cbk | Opaque user data |
prog_cbk | new callback function to use. Passing NULL restore default GPAC stderr notification. |
Bool gf_prompt_has_input | ( | ) |
Checks if a character is pending in the prompt buffer.
char gf_prompt_get_char | ( | ) |
Returns the current character entered at prompt if any.
void gf_prompt_set_echo_off | ( | Bool | echo_off | ) |
Turns the prompt character echo on/off - this is usefull when entering passwords.
echo_off | indicates whether echo should be turned on or off. |