--- /dev/null
+/*\r
+ * GPAC - Multimedia Framework C SDK\r
+ *\r
+ * Copyright (c) Jean Le Feuvre 2000-2005 \r
+ * All rights reserved\r
+ *\r
+ * This file is part of GPAC / common tools sub-project\r
+ *\r
+ * GPAC is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation; either version 2, or (at your option)\r
+ * any later version.\r
+ * \r
+ * GPAC is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; see the file COPYING. If not, write to\r
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
+ *\r
+ */\r
+\r
+#ifndef _GF_TOOLS_H_\r
+#define _GF_TOOLS_H_\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+#include <gpac/setup.h>\r
+\r
+\r
+/*! \file "gpac/tools.h"\r
+ * \brief Base definitions and functions of GPAC.\r
+ *\r
+ * This file contains basic functions and core definitions of the GPAC framework. This file is\r
+ * usually included by all GPAC header files since it contains the error definitions.\r
+*/\r
+\r
+/*! \defgroup utils_grp utils\r
+ * You will find in this module the documentation of all tools used in GPAC.\r
+*/\r
+\r
+/*! \addtogroup tools_grp base utils\r
+ * \ingroup utils_grp\r
+ * \brief Base definitions and functions of GPAC.\r
+ *\r
+ * This section documents some very basic functions and core definitions of the GPAC framework.\r
+ * @{\r
+ */\r
+\r
+/*!\r
+ * \brief GPAC Version\r
+ * \hideinitializer\r
+ *\r
+ * Macro giving GPAC version expressed as a printable string\r
+*/\r
+/*KEEP SPACE SEPARATORS FOR MAKE / GREP (SEE MAIN MAKEFILE)!!!, and NO SPACE in GPAC_VERSION for proper install*/\r
+#define GPAC_VERSION "0.4.6-DEV"\r
+\r
+#define GPAC_BUILD_NUMBER "1"\r
+#define GPAC_FULL_VERSION GPAC_VERSION" (build "GPAC_BUILD_NUMBER")"\r
+\r
+/*!\r
+ * \brief GPAC Version\r
+ * \hideinitializer\r
+ *\r
+ * Macro giving GPAC version expressed as an integer, where version X.Y.Z is coded as 0x00XXYYZZ\r
+*/\r
+#define GPAC_VERSION_INT 0x00000406\r
+\r
+/*!\r
+ * \brief Memory allocation\r
+ * \hideinitializer\r
+ *\r
+ * Macro allocating memory and zero-ing it\r
+*/\r
+#define GF_SAFEALLOC(__ptr, __struct) { __ptr = (__struct *) malloc(sizeof(__struct)); if (__ptr) memset((void *) __ptr, 0, sizeof(__struct)); }\r
+\r
+/*!\r
+ * \brief 4CC Formatting\r
+ * \hideinitializer\r
+ *\r
+ * Macro formating a 4-character code (or 4CC) "abcd" as 0xAABBCCDD\r
+*/\r
+#define GF_4CC(a,b,c,d) (((a)<<24)|((b)<<16)|((c)<<8)|(d))\r
+/*!\r
+ * \brief 4CC Printing\r
+ *\r
+ * returns a 4CC printable form\r
+*/\r
+const char *gf_4cc_to_str(u32 type);\r
+\r
+/*!\r
+ * \brief large file opening\r
+ *\r
+ * Opens a large file (>4GB)\r
+ * \param file_name Same semantics as fopen\r
+ * \param mode Same semantics as fopen\r
+ * \return stream handle of the file object\r
+ * \note You only need to call this function if you're suspecting the file to be a large one (usually only media files), otherwise use regular stdio.\r
+*/\r
+FILE *gf_f64_open(const char *file_name, const char *mode);\r
+/*!\r
+ * \brief large file position query\r
+ *\r
+ * Queries the current read/write position in a large file\r
+ * \param f Same semantics as ftell\r
+ * \return position in the file\r
+ * \note You only need to call this function if you're suspecting the file to be a large one (usually only media files), otherwise use regular stdio.\r
+*/\r
+u64 gf_f64_tell(FILE *f);\r
+/*!\r
+ * \brief large file seeking\r
+ *\r
+ * Seeks the current read/write position in a large file\r
+ * \param f Same semantics as fseek\r
+ * \param pos Same semantics as fseek\r
+ * \param whence Same semantics as fseek\r
+ * \return new position in the file\r
+ * \note You only need to call this function if you're suspecting the file to be a large one (usually only media files), otherwise use regular stdio.\r
+*/\r
+u64 gf_f64_seek(FILE *f, s64 pos, s32 whence);\r
+\r
+/*! @} */\r
+\r
+\r
+/*! \addtogroup errors_grp error codes\r
+ * \ingroup utils_grp\r
+ * \brief Errors used in GPAC.\r
+ *\r
+ * This section documents all error codes used in the GPAC framework. Most of the GPAC's functions will use these as \r
+ * return values, and some of these errors are also used for state communication with the different modules of the framework.\r
+ * @{\r
+ */\r
+\r
+/*!\r
+ * GPAC Error\r
+ * \hideinitializer\r
+ *\r
+ * positive values are warning and info, 0 means no error and negative values are errors\r
+ */\r
+typedef enum\r
+{\r
+ /*!Message from any scripting engine used in the presentation (ECMAScript, MPEG-J, ...) (Info).*/\r
+ GF_SCRIPT_INFO = 3,\r
+ /*!Indicates an data frame has several AU packed (not MPEG-4 compliant). This is used by decoders to force \r
+ multiple decoding of the same data frame (Info).*/\r
+ GF_PACKED_FRAMES = 2,\r
+ /*!Indicates the end of a stream or of a file (Info).*/\r
+ GF_EOS = 1,\r
+ /*!\r
+ \n\n\r
+ */\r
+ /*!Operation success (no error).*/\r
+ GF_OK = 0,\r
+ /*!\n*/\r
+ /*!One of the input parameter is not correct or cannot be used in the current operating mode of the framework.*/\r
+ GF_BAD_PARAM = -1,\r
+ /*! Memory allocation failure.*/\r
+ GF_OUT_OF_MEM = -2,\r
+ /*! Input/Output failure (disk access, system call failures)*/\r
+ GF_IO_ERR = -3,\r
+ /*! The desired feature or operation is not supported by the framework*/\r
+ GF_NOT_SUPPORTED = -4,\r
+ /*! Input data has been corrupted*/\r
+ GF_CORRUPTED_DATA = -5,\r
+ /*! A modification was attempted on a scene node which could not be found*/\r
+ GF_SG_UNKNOWN_NODE = -6,\r
+ /*! The PROTO node interface does not match the nodes using it*/\r
+ GF_SG_INVALID_PROTO = -7,\r
+ /*! An error occured in the scripting engine*/\r
+ GF_SCRIPT_ERROR = -8,\r
+ /*! Buffer is too small to contain decoded data. Decoders shall use this error whenever they need to resize their output memory buffers*/\r
+ GF_BUFFER_TOO_SMALL = -9,\r
+ /*! Bitstream is not compliant to the specfication it refers to*/\r
+ GF_NON_COMPLIANT_BITSTREAM = -10,\r
+ /*! No decoders could be found to handle the desired media type*/\r
+ GF_CODEC_NOT_FOUND = -11,\r
+ /*! The URL is not properly formatted or cannot be found*/\r
+ GF_URL_ERROR = -12,\r
+ /*! An service error has occured at the local side*/\r
+ GF_SERVICE_ERROR = -13,\r
+ /*! A service error has occured at the remote (server) side*/\r
+ GF_REMOTE_SERVICE_ERROR = -14,\r
+ /*! The desired stream could not be found in the service*/\r
+ GF_STREAM_NOT_FOUND = -15,\r
+ /*! The IsoMedia file is not a valid one*/\r
+ GF_ISOM_INVALID_FILE = -20,\r
+ /*! The IsoMedia file is not complete. Either the file is being downloaded, or it has been truncated*/\r
+ GF_ISOM_INCOMPLETE_FILE = -21,\r
+ /*! The media in this IsoMedia track is not valid (usually due to a broken stream description)*/\r
+ GF_ISOM_INVALID_MEDIA = -22,\r
+ /*! The requested operation cannot happen in the current opening mode of the IsoMedia file*/\r
+ GF_ISOM_INVALID_MODE = -23,\r
+ /*! This IsoMedia track refers to media outside the file in an unknown way*/\r
+ GF_ISOM_UNKNOWN_DATA_REF = -24,\r
+\r
+ /*! An invalid MPEG-4 Object Descriptor was found*/\r
+ GF_ODF_INVALID_DESCRIPTOR = -30,\r
+ /*! An MPEG-4 Object Descriptor was found or added to a forbidden descriptor*/\r
+ GF_ODF_FORBIDDEN_DESCRIPTOR = -31,\r
+ /*! An invalid MPEG-4 BIFS command was detected*/\r
+ GF_ODF_INVALID_COMMAND = -32,\r
+ /*! The scene has been encoded using an unknown BIFS version*/\r
+ GF_BIFS_UNKNOWN_VERSION = -33,\r
+\r
+ /*! The remote IP address could not be solved*/\r
+ GF_IP_ADDRESS_NOT_FOUND = -40,\r
+ /*! The connection to the remote peer has failed*/\r
+ GF_IP_CONNECTION_FAILURE = -41,\r
+ /*! The network operation has failed*/\r
+ GF_IP_NETWORK_FAILURE = -42,\r
+ /*! The network connection has been closed*/\r
+ GF_IP_CONNECTION_CLOSED = -43,\r
+ /*! The network operation has failed because no data is available*/\r
+ GF_IP_NETWORK_EMPTY = -44,\r
+ /*! The network operation has been discarded because it would be a blocking one*/\r
+ GF_IP_SOCK_WOULD_BLOCK = -45,\r
+ /*! UDP connection did not receive any data at all. Signaled by client services to reconfigure network if possible*/\r
+ GF_IP_UDP_TIMEOUT = -46,\r
+\r
+ /*! Authentication with the remote host has failed*/\r
+ GF_AUTHENTICATION_FAILURE = -50,\r
+ /*! Script not ready for playback */\r
+ GF_SCRIPT_NOT_READY = -51,\r
+} GF_Err;\r
+\r
+/*!\r
+ * \brief Error Printing\r
+ *\r
+ * Returns a printable version of a given error\r
+ * \param e Error code requested\r
+ * \return String representing the error\r
+*/\r
+const char *gf_error_to_string(GF_Err e);\r
+\r
+/*! @} */\r
+\r
+/*! \addtogroup log_grp logging tools\r
+ * \ingroup utils_grp\r
+ * @{\r
+ */\r
+\r
+/*!\r
+ * GPAC Log Levels\r
+ * \hideinitializer\r
+ * \r
+ * These levels describes messages priority used when filtering logs\r
+ */\r
+enum\r
+{\r
+ /*! Log message describes an error*/\r
+ GF_LOG_ERROR = 1,\r
+ /*! Log message describes a warning*/\r
+ GF_LOG_WARNING,\r
+ /*! Log message is informational (state, etc..)*/\r
+ GF_LOG_INFO,\r
+ /*! Log message is a debug info*/\r
+ GF_LOG_DEBUG,\r
+};\r
+\r
+/*!\r
+ * \brief Log level assignment\r
+ *\r
+ * Sets the level used for log filtering. By default no log is performed\r
+ * \param level log level used.\r
+ *\r
+ */\r
+void gf_log_set_level(u32 level);\r
+\r
+\r
+/*!\r
+ * GPAC Log tools\r
+ * \hideinitializer\r
+ *\r
+ * These flags describes which sub-part of GPAC generates the log and are used when filtering logs\r
+ */\r
+enum\r
+{\r
+ /*! Log message from the core library (init, threads, network calls, etc)*/\r
+ GF_LOG_CORE = 1,\r
+ /*! Log message from a raw media parser (BIFS, LASeR, A/V formats)*/\r
+ GF_LOG_CODING= 1<<1,\r
+ /*! Log message from a bitstream parser (IsoMedia, MPEG-2 TS, OGG, ...)*/\r
+ GF_LOG_CONTAINER = 1<<2,\r
+ /*! Log message from the network/service stack (messages & co)*/\r
+ GF_LOG_NETWORK = 1<<3,\r
+ /*! Log message from the RTP/RTCP stack (TS info) and packet structure & hinting (debug)*/\r
+ GF_LOG_RTP = 1<<4,\r
+ /*! Log message from authoring subsystem (file manip, import/export)*/\r
+ GF_LOG_AUTHOR = 1<<5,\r
+ /*! Log message from the sync layer of the terminal*/\r
+ GF_LOG_SYNC = 1<<6,\r
+ /*! Log message from a codec*/\r
+ GF_LOG_CODEC = 1<<7,\r
+ /*! Log message from any XML parser (context loading, etc)*/\r
+ GF_LOG_PARSER = 1<<8,\r
+ /*! Log message from the terminal/compositor, indicating media object state*/\r
+ GF_LOG_MEDIA = 1<<9,\r
+ /*! Log message from the scene graph/scene manager (handling of nodes and attribute modif, DOM core)*/\r
+ GF_LOG_SCENE = 1<<10,\r
+ /*! Log message from the scripting engine*/\r
+ GF_LOG_SCRIPT = 1<<11,\r
+ /*! Log message from event handling*/\r
+ GF_LOG_INTERACT = 1<<12,\r
+ /*! Log message from compositor*/\r
+ GF_LOG_COMPOSE = 1<<13,\r
+ /*! Log for video object cache */\r
+ GF_LOG_CACHE = 1<<14,\r
+ /*! Log message from multimedia I/O devices (audio/video input/output, ...)*/\r
+ GF_LOG_MMIO = 1<<15,\r
+ /*! Log for runtime info (times, memory, CPU usage)*/\r
+ GF_LOG_RTI = 1<<16,\r
+ /*! Log for SMIL timing and animation*/\r
+ GF_LOG_SMIL = 1<<17,\r
+\r
+};\r
+\r
+/*!\r
+ * \brief Log modules assignment\r
+ *\r
+ * Sets the modules to be checked for log filtering. By default no modules are logged.\r
+ * \param tools log tools filtered. This is an OR'ed combinaison of log module flags\r
+ *\r
+ */\r
+void gf_log_set_tools(u32 tools);\r
+\r
+/*!\r
+ * \brief Log Message Callback\r
+ *\r
+ * The gf_log_cbk type is the type for the callback of the \ref gf_log_set_callback function. By default all logs are redirected to stdout\r
+ * \param cbck Opaque user data.\r
+ * \param log_level level of the log. This value is not guaranteed in multi-threaded context.\r
+ * \param log_tool tool emitting the log. This value is not guaranteed in multi-threaded context.\r
+ * \param fmt message log format.\r
+ * \param vlist message log param.\r
+ *\r
+ */\r
+typedef void (*gf_log_cbk)(void *cbck, u32 log_level, u32 log_tool, const char* fmt, va_list vlist);\r
+\r
+/*!\r
+ * \brief Log overwrite\r
+ *\r
+ * Assigns a user-defined callback for printing log messages. By default all logs are redirected to stdout\r
+ * \param usr_cbk Opaque user data \r
+ * \param cbk callback log function\r
+ * \return previous callback function\r
+*/\r
+gf_log_cbk gf_log_set_callback(void *usr_cbk, gf_log_cbk cbk);\r
+\r
+/*!\r
+ \cond DUMMY_DOXY_SECTION\r
+*/\r
+\r
+#ifndef GPAC_DISABLE_LOG\r
+/*note: \r
+ to turn log on, change to GPAC_ENABLE_LOG\r
+ to turn log off, change to GPAC_DISABLE_LOG\r
+ this is needed by configure+sed to modify this file directly\r
+*/\r
+#define GPAC_ENABLE_LOG\r
+#endif\r
+\r
+/*!\r
+ \endcond\r
+*/\r
+\r
+\r
+/*this is all a bit ugly, but most compilers don't properly handle variadic macros...*/\r
+void gf_log(const char *fmt, ...);\r
+void gf_log_lt(u32 ll, u32 lt);\r
+\r
+u32 gf_log_get_level();\r
+u32 gf_log_get_tools();\r
+\r
+#ifdef GPAC_DISABLE_LOG\r
+#define GF_LOG(_ll, _lm, __args) \r
+#else\r
+/*!\r
+ * \brief Message logging\r
+ * \hideinitializer\r
+ *\r
+ * Macro for logging messages. Usage is GF_LOG(log_lev, log_module, (fmt, ...)). The log function is only called if log filtering allows it. This avoids fetching logged parameters when the tool is not being logged.\r
+*/\r
+#define GF_LOG(_log_level, _log_tools, __args) if ((gf_log_get_level() >= (_log_level)) && (gf_log_get_tools() & (_log_tools))) { gf_log_lt(_log_level, _log_tools); gf_log __args ;}\r
+#endif\r
+\r
+\r
+/*! @} */\r
+\r
+/*! \addtogroup tools_grp\r
+ * @{\r
+ */\r
+\r
+\r
+/*!\r
+ * \brief PseudoRandom Integer Generation Initialization\r
+ *\r
+ * Sets the starting point for generating a series of pseudorandom integers.\r
+ * \param Reset Re-initializes the random number generator\r
+*/\r
+void gf_rand_init(Bool Reset);\r
+/*!\r
+ * \brief PseudoRandom Integer Generation\r
+ *\r
+ * Returns a pseudorandom integer.\r
+*/\r
+u32 gf_rand();\r
+\r
+/*!\r
+ * \brief user name \r
+ *\r
+ * Gets current user (login) name.\r
+*/\r
+void gf_get_user_name(char *buf, u32 buf_size);\r
+\r
+/*!\r
+ * \brief Directory Enumeration Callback\r
+ *\r
+ * The gf_enum_dir_item type is the type for the callback of the \ref gf_enum_directory function\r
+ * \param cbck Opaque user data.\r
+ * \param item_name File or directory name.\r
+ * \param item_path File or directory full path and name from filesystem root.\r
+ * \return 1 to abort enumeration, 0 to continue enumeration.\r
+ *\r
+ */\r
+typedef Bool (*gf_enum_dir_item)(void *cbck, char *item_name, char *item_path);\r
+/*!\r
+ * \brief Directory enumeration\r
+ *\r
+ * Enumerates a directory content. Feedback is provided by the enum_dir_item function\r
+ * \param dir Directory to enumerate\r
+ * \param enum_directory If set, only directories will be enumerated, otherwise only files are.\r
+ * \param enum_dir \ref gf_enum_dir_item callback function for enumeration. \r
+ * \param cbck Opaque user data passed to callback function.\r
+ * \param filter optional filter for file extensions. If a file extension without the dot '.' character is not found in the\r
+ * filter the file will be skipped.\r
+*/\r
+GF_Err gf_enum_directory(const char *dir, Bool enum_directory, gf_enum_dir_item enum_dir, void *cbck, const char *filter);\r
+\r
+\r
+/*!\r
+ * \brief File Deletion\r
+ *\r
+ * Deletes a file from the disk.\r
+ * \param fileName absolute name of the file or name relative to the current working directory.\r
+*/\r
+void gf_delete_file(char *fileName);\r
+/*!\r
+ * \brief File Deletion\r
+ *\r
+ * Creates a new temporary file in binary mode\r
+ * \return stream handle to the new file ressoucre\r
+ */\r
+FILE *gf_temp_file_new();\r
+\r
+\r
+/*!\r
+ * \brief Progress formatting\r
+ *\r
+ * 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.\r
+ * \param title title string of the progress, or NULL for no progress\r
+ * \param done Current amount performed of the action.\r
+ * \param total Total amount of the action.\r
+ */\r
+void gf_set_progress(char *title, u32 done, u32 total);\r
+\r
+/*!\r
+ * \brief Progress Callback\r
+ *\r
+ * The gf_on_progress_cbk type is the type for the callback of the \ref gf_set_progress_callback function\r
+ * \param cbck Opaque user data.\r
+ * \param title preogress title.\r
+ * \param done Current amount performed of the action\r
+ * \param total Total amount of the action.\r
+ *\r
+ */\r
+typedef void (*gf_on_progress_cbk)(void *cbck, char *title, u32 done, u32 total);\r
+\r
+/*!\r
+ * \brief Progress overwriting\r
+ *\r
+ * Iverwrites the progress signaling function by a user-defined one.\r
+ * \param user_cbk Opaque user data\r
+ * \param prog_cbk new callback function to use. Passing NULL restore default GPAC stdout notification.\r
+ */\r
+void gf_set_progress_callback(void *user_cbk, gf_on_progress_cbk prog_cbk);\r
+\r
+\r
+/*!\r
+ * \brief Prompt checking \r
+ *\r
+ * Checks if a character is pending in the prompt buffer.\r
+ * \return 1 if a character is ready to be fetched, 0 otherwise.\r
+ * \note Function not available under WindowsCE nor SymbianOS\r
+*/\r
+Bool gf_prompt_has_input();\r
+\r
+/*!\r
+ * \brief Prompt character flush\r
+ *\r
+ * Returns the current character entered at prompt if any.\r
+ * \return value of the character.\r
+ * \note Function not available under WindowsCE nor SymbianOS\r
+*/\r
+char gf_prompt_get_char();\r
+\r
+\r
+/*!\r
+ * \brief turns prompt echo on/off\r
+ *\r
+ * Turns the prompt character echo on/off - this is usefull when entering passwords.\r
+ * \param echo_off indicates whether echo should be turned on or off.\r
+ * \note Function not available under WindowsCE nor SymbianOS\r
+*/\r
+void gf_prompt_set_echo_off(Bool echo_off);\r
+\r
+/*!\r
+ *\addtogroup cpu_grp Time tools\r
+ *\ingroup utils_grp\r
+ *\brief System time and CPU functions\r
+ *\r
+ *This section documents time functionalities and CPU management in GPAC.\r
+ * @{\r
+ */\r
+\r
+\r
+/*!\r
+ * \brief System setup\r
+ *\r
+ * Inits the system high-resolution clock if any, and CPU usage manager. It is strongly recommended to call this \r
+ * function before calling any other GPAC functions, since on some systems (like winCE) it may result in a better memory usage estimation.\r
+ * \note This can be called several times but only the first call will result in system setup. \r
+ */\r
+void gf_sys_init();\r
+/*!\r
+ * \brief System closing\r
+ *\r
+ * Closes the system high-resolution clock and any CPU associated ressources.\r
+ * \note This can be called several times but the system will be closed when no more users are counted.\r
+ */\r
+void gf_sys_close();\r
+/*!\r
+ * \brief System clock query\r
+ *\r
+ * Gets the system clock time.\r
+ * \return System clock value since initialization in milliseconds.\r
+ */\r
+u32 gf_sys_clock();\r
+\r
+/*!\r
+ * \brief Sleeps thread/process\r
+ *\r
+ * Locks calling thread/process execution for a given time.\r
+ * \param ms Amount of time to sleep in milliseconds.\r
+ */\r
+void gf_sleep(u32 ms);\r
+\r
+/*!\r
+ * \brief CRC32 compute\r
+ *\r
+ * Computes the CRC32 value of a buffer.\r
+ * \param data buffer\r
+ * \param size buffer size\r
+ * \return computed CRC32\r
+ */\r
+u32 gf_crc_32(char *data, u32 size);\r
+\r
+\r
+/*!\brief run-time system info object\r
+ *\r
+ *The Run-Time Info object is used to get CPU and memory occupation of the calling process. \r
+ *All time values are expressed in milliseconds (accuracy is not guaranteed).\r
+*/\r
+typedef struct\r
+{\r
+ /*!start of the sampling period*/\r
+ u32 sampling_instant;\r
+ /*!duration of the sampling period*/\r
+ u32 sampling_period_duration;\r
+ /*!total amount of time (User+kernel) spent in CPU for all processes as evaluated at the end of the sampling period*/\r
+ u32 total_cpu_time;\r
+ /*!total amount of time (User+kernel) spent in CPU for the calling process as evaluated at the end of the sampling period*/\r
+ u32 process_cpu_time;\r
+ /*!amount of time (User+kernel) spent in CPU for all processes during the sampling period*/\r
+ u32 total_cpu_time_diff;\r
+ /*!total amount of time (User+kernel) spent in CPU for the calling process during the sampling period*/\r
+ u32 process_cpu_time_diff;\r
+ /*!total amount of idle time during the sampling period.*/\r
+ u32 cpu_idle_time;\r
+ /*!percentage (from 0 to 100) of CPU usage during the sampling period.*/\r
+ u32 total_cpu_usage;\r
+ /*!percentage (from 0 to 100) of the CPU usage by the calling process during the sampling period.*/\r
+ u32 process_cpu_usage;\r
+ /*!calling process ID*/\r
+ u32 pid;\r
+ /*!calling process thread count if known*/\r
+ u32 thread_count;\r
+ /*!size of calling process allocated heaps*/\r
+ u64 process_memory;\r
+ /*!total physical memory in system*/\r
+ u64 physical_memory;\r
+ /*!available physical memory in system*/\r
+ u64 physical_memory_avail;\r
+ /*!total memory currently allocated by gpac*/\r
+ u64 gpac_memory;\r
+} GF_SystemRTInfo;\r
+\r
+/*!\r
+ * Selection flags for run-time info retrieval\r
+ * \hideinitializer\r
+ */\r
+enum\r
+{\r
+ /*!Indicates all processes' times must be fetched. If not set, only the current process times will be retrieved, and the\r
+ thread count and total times won't be available*/\r
+ GF_RTI_ALL_PROCESSES_TIMES = 1,\r
+ /*!Indicates the process allocated heap size must be fetch. If not set, only the system physical memory is fetched. \r
+ Fetching the entire ocess allocated memory can have a large impact on performances*/\r
+ GF_RTI_PROCESS_MEMORY = 1<<1,\r
+ /*!Indicates that only system memory should be fetched. When set, all refreshing info is ignored*/\r
+ GF_RTI_SYSTEM_MEMORY_ONLY = 1<<2,\r
+};\r
+\r
+/*!\r
+ * \brief Gets Run-Time info\r
+ *\r
+ * Gets CPU and memory usage info for the calling process and the system. Information gathering\r
+ * is controled through timeout values.\r
+ * \param 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.\r
+ * \param rti holder to the run-time info structure to update.\r
+ * \param flags specify which info is to be retrieved.\r
+ * \return 1 if info has been updated, 0 otherwise.\r
+ * \note You should not try to use a too small refresh time. Typical values are 500 ms or one second.\r
+ */\r
+Bool gf_sys_get_rti(u32 refresh_time_ms, GF_SystemRTInfo *rti, u32 flags);\r
+\r
+\r
+Bool gf_sys_get_battery_state(Bool *onBattery, u32 *onCharge, u32 *level);\r
+\r
+/*! @} */\r
+\r
+\r
+/*! @} */\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+\r
+#endif /*_GF_CORE_H_*/\r
+\r