libgpac
Documentation of the core library of GPAC
Base data types

Base data types of GPAC. More...

+ Collaboration diagram for Base data types:

Data Structures

struct  GF_Fraction
 
struct  GF_Fraction64
 

Macros

#define _FILE_OFFSET_BITS   64
 
#define _LARGEFILE_SOURCE
 
#define _LARGEFILE64_SOURCE
 
#define GPAC_HAS_FD
 
#define GFINLINE   inline
 
#define stricmp   strcasecmp
 
#define strnicmp   strncasecmp
 
#define strupr   my_str_upr
 
#define strlwr   my_str_lwr
 
#define GF_PATH_SEPARATOR   '/'
 
#define GF_MAX_PATH   1023
 
#define GF_MAX_DOUBLE   DBL_MAX
 
#define GF_MIN_DOUBLE   -GF_MAX_DOUBLE
 
#define GF_MAX_FLOAT   FLT_MAX
 
#define GF_MIN_FLOAT   -GF_MAX_FLOAT
 
#define GF_EPSILON_FLOAT   FLT_EPSILON
 
#define GF_SHORT_MAX   SHRT_MAX
 
#define GF_SHORT_MIN   SHRT_MIN
 
#define GF_UINT_MAX   UINT_MAX
 
#define GF_INT_MAX   INT_MAX
 
#define GF_INT_MIN   INT_MIN
 
#define GF_UINT64_MAX   ULLONG_MAX
 
#define GF_INT64_MAX   LLONG_MAX
 
#define GF_INT64_MIN   LLONG_MIN
 
#define MIN(X, Y)   ((X)<(Y)?(X):(Y))
 
#define MAX(X, Y)   ((X)>(Y)?(X):(Y))
 
#define ABSDIFF(a, b)   ( ( (a) > (b) ) ? ((a) - (b)) : ((b) - (a)) )
 
#define ABS(a)   ( ( (a) > 0 ) ? (a) : - (a) )
 
#define LLD_SUF   "lld"
 
#define LLU_SUF   "llu"
 
#define LLX_SUF   "llx"
 
#define PTR_TO_U_CAST   (u32)
 
#define LLD   "%" LLD_SUF
 
#define LLU   "%" LLU_SUF
 
#define LLX   "%" LLX_SUF
 
#define GF_EXPORT
 
#define gf_stringizer(x)
 Stringizer. More...
 
#define GF_4CC(a, b, c, d)   ((((u32)a)<<24)|(((u32)b)<<16)|(((u32)c)<<8)|((u32)d))
 4CC Formatting More...
 
#define GF_4CC_MSIZE   10
 

Typedefs

typedef uint64_t u64
 
typedef int64_t s64
 
typedef uint32_t u32
 
typedef int32_t s32
 
typedef uint16_t u16
 
typedef int16_t s16
 
typedef uint8_t u8
 
typedef int8_t s8
 
typedef double Double
 
typedef float Float
 
typedef u8 bin128[16]
 

Enumerations

enum  Bool { GF_FALSE = 0 , GF_TRUE }
 

Functions

char * my_str_upr (char *str)
 
char * my_str_lwr (char *str)
 
const char * gf_4cc_to_str (u32 type)
 
const char * gf_4cc_to_str_safe (u32 type, char szType[GF_4CC_MSIZE])
 
u32 gf_4cc_parse (const char *val)
 

Detailed Description

This section documents the base data types of GPAC, as well as some macros wrapping platform-specific functionalities. For better portability, only use the base data types defined here.


Data Structure Documentation

◆ GF_Fraction

struct GF_Fraction

32 bit fraction

Data Fields
s32 num
u32 den

◆ GF_Fraction64

struct GF_Fraction64

64 bit fraction

Data Fields
s64 num
u64 den

Macro Definition Documentation

◆ _FILE_OFFSET_BITS

#define _FILE_OFFSET_BITS   64

max file offset bits

◆ _LARGEFILE_SOURCE

#define _LARGEFILE_SOURCE

largefile

◆ _LARGEFILE64_SOURCE

#define _LARGEFILE64_SOURCE

largefile64

◆ GPAC_HAS_FD

#define GPAC_HAS_FD

file descriptor support

◆ GFINLINE

#define GFINLINE   inline

macro for cross-platform inlining of functions

◆ stricmp

#define stricmp   strcasecmp

use stricmp

◆ strnicmp

#define strnicmp   strncasecmp

use strnicmp

◆ strupr

#define strupr   my_str_upr

use strupr

◆ strlwr

#define strlwr   my_str_lwr

use strulwr

◆ GF_PATH_SEPARATOR

#define GF_PATH_SEPARATOR   '/'

default path separator of the current platform

◆ GF_MAX_PATH

#define GF_MAX_PATH   1023

default max filesystem path size of the current platform

◆ GF_MAX_DOUBLE

#define GF_MAX_DOUBLE   DBL_MAX

max positive possible value for Double

◆ GF_MIN_DOUBLE

#define GF_MIN_DOUBLE   -GF_MAX_DOUBLE

max negative possible value for Double

◆ GF_MAX_FLOAT

#define GF_MAX_FLOAT   FLT_MAX

max positive possible value for Float

◆ GF_MIN_FLOAT

#define GF_MIN_FLOAT   -GF_MAX_FLOAT

max negative possible value for Float

◆ GF_EPSILON_FLOAT

#define GF_EPSILON_FLOAT   FLT_EPSILON

smallest possible value for float

◆ GF_SHORT_MAX

#define GF_SHORT_MAX   SHRT_MAX

max possible value for s16

◆ GF_SHORT_MIN

#define GF_SHORT_MIN   SHRT_MIN

min possible value for s16

◆ GF_UINT_MAX

#define GF_UINT_MAX   UINT_MAX

max possible value for u32

◆ GF_INT_MAX

#define GF_INT_MAX   INT_MAX

max possible value for s32

◆ GF_INT_MIN

#define GF_INT_MIN   INT_MIN

min possible value for s32

◆ GF_UINT64_MAX

#define GF_UINT64_MAX   ULLONG_MAX

max possible value for u64

◆ GF_INT64_MAX

#define GF_INT64_MAX   LLONG_MAX

max possible value for s64

◆ GF_INT64_MIN

#define GF_INT64_MIN   LLONG_MIN

min possible value for s64

◆ MIN

#define MIN (   X,
 
)    ((X)<(Y)?(X):(Y))

get the smallest of two numbers

◆ MAX

#define MAX (   X,
 
)    ((X)>(Y)?(X):(Y))

get the biggest of two numbers

◆ ABSDIFF

#define ABSDIFF (   a,
 
)    ( ( (a) > (b) ) ? ((a) - (b)) : ((b) - (a)) )

get the absolute difference betwee two numbers

◆ ABS

#define ABS (   a)    ( ( (a) > 0 ) ? (a) : - (a) )

get the absolute value of a number

◆ LLD_SUF

#define LLD_SUF   "lld"

macro for cross-platform suffix used for formatting s64 integers in logs and printf routines

◆ LLU_SUF

#define LLU_SUF   "llu"

macro for cross-platform suffix used for formatting u64 integers in logs and printf routines

◆ LLX_SUF

#define LLX_SUF   "llx"

macro for cross-platform suffix used for formatting u64 integers as hex in logs and printf routines

◆ PTR_TO_U_CAST

#define PTR_TO_U_CAST   (u32)

macro for cross-platform casting a pointer to an integer

◆ LLD

#define LLD   "%" LLD_SUF

macro for cross-platform formatting of s64 integers in logs and printf routines

◆ LLU

#define LLU   "%" LLU_SUF

macro for cross-platform formatting of u64 integers in logs and printf routines

◆ LLX

#define LLX   "%" LLX_SUF

macro for cross-platform formatting of u64 integers as hexadecimal in logs and printf routines

◆ GF_EXPORT

#define GF_EXPORT

macro for cross-platform signaling of exported function of libgpac

◆ gf_stringizer

#define gf_stringizer (   x)

Macro transforming its input name into a string

◆ GF_4CC

#define GF_4CC (   a,
  b,
  c,
 
)    ((((u32)a)<<24)|(((u32)b)<<16)|(((u32)c)<<8)|((u32)d))

Macro formatting a 4-character code (or 4CC) "abcd" as 0xAABBCCDD

◆ GF_4CC_MSIZE

#define GF_4CC_MSIZE   10

minimum buffer size to hold any 4CC in string format

Typedef Documentation

◆ u64

typedef uint64_t u64

64 bit unsigned integer

◆ s64

typedef int64_t s64

64 bit signed integer

◆ u32

typedef uint32_t u32

32 bit unsigned integer

◆ s32

typedef int32_t s32

32 bit signed integer

◆ u16

typedef uint16_t u16

16 bit unsigned integer

◆ s16

typedef int16_t s16

16 bit signed integer

◆ u8

typedef uint8_t u8

8 bit unsigned integer

◆ s8

typedef int8_t s8

8 bit signed integer

◆ Double

typedef double Double

Double-precision floating point number

◆ Float

typedef float Float

Single-precision floating point number

◆ bin128

typedef u8 bin128[16]

128 bit IDs

Enumeration Type Documentation

◆ Bool

enum Bool

boolean value

Function Documentation

◆ my_str_upr()

char* my_str_upr ( char *  str)

gets upper case

Parameters
strinput string
Returns
uper case to free

◆ my_str_lwr()

char* my_str_lwr ( char *  str)

gets lower case

Parameters
strinput string
Returns
lower case to free

◆ gf_4cc_to_str()

const char* gf_4cc_to_str ( u32  type)

converts four character code to string

Parameters
typea four character code
Returns
a printable form of the code

◆ gf_4cc_to_str_safe()

const char* gf_4cc_to_str_safe ( u32  type,
char  szType[GF_4CC_MSIZE] 
)

converts four character code to string in the provided buffer - thread-safe version of gf_4cc_to_str

Parameters
typea four character code
szTypebuffer to write the code to
Returns
the onput buffer

◆ gf_4cc_parse()

u32 gf_4cc_parse ( const char *  val)

converts a 4CC string to its 32 bits value

Parameters
valfour character string
Returns
code value or 0 if error