upipe/ubase.h header reference

Upipe common definitions More

Header inclusion  

Members  

Types  

Functions  

Macros  

Description  

Upipe common definitions

Members detail  

#define UBASE_ALLOC_RETURN(var)  

This macro is declared in upipe/ubase.h source file, line 316.

This macro returns #UBASE_ERR_ALLOC if the variable is NULL.

Parameter list:

  • var: variable to check

#define UBASE_ARRAY_SIZE(a)  

This macro is declared in upipe/ubase.h source file, line 88.

This macro is used to retrieve the number of items of an array.

#define UBASE_CASE_TO_STR(Value)  

This macro is declared in upipe/ubase.h source file, line 194.

#define UBASE_DEPRECATED  

This macro is declared in upipe/ubase.h source file, line 68.

This macro marks a function or variable as deprecated (forces compiler warnings).

#define UBASE_ERROR(upipe, command)  

This macro is declared in upipe/ubase.h source file, line 280.

This macro runs the given function and throws an error in case of failure.

Parameter list:

  • command: command whose return code is to be checked

#define UBASE_FATAL(upipe, command)  

This macro is declared in upipe/ubase.h source file, line 255.

This macro runs the given function and throws a fatal error in case of failure.

Parameter list:

  • command: command whose return code is to be checked

#define UBASE_FATAL_RETURN(upipe, command)  

This macro is declared in upipe/ubase.h source file, line 267.

This macro runs the given function, throws a fatal error and returns in case of failure.

Parameter list:

  • command: command whose return code is to be checked

#define UBASE_FMT_PRINTF(idx,first)  

This macro is declared in upipe/ubase.h source file, line 70.

This macro marks a function as taking printf style arguments

#define UBASE_FOURCC(a, b, c, d)  

This macro is declared in upipe/ubase.h source file, line 157.

This macro allows to define a 32-bit unsigned integer with 4 letters.

#define UBASE_FROM_TO(STRUCTURE, SUBSTRUCT, SUBNAME, SUB)  

This macro is declared in upipe/ubase.h source file, line 99.

This macro declares two functions dealing with substructures included into a larger structure.

Parameter list:

  • STRUCTURE: name of the larger structure
  • SUBSTRUCT: name of the smaller substructure
  • SUBNAME: name to use for the functions (STRUCTURE##_{to,from}_##SUBNAME)
  • SUB: name of the struct SUBSTRUCT field of struct STRUCTURE

#define UBASE_HANDLED_RETURN(command)  

This macro is declared in upipe/ubase.h source file, line 244.

This macro runs the given function and returns if the error code is not UBASE_ERR_UNHANDLER.

Parameter list:

  • command: command whose return code is to be checked

#define UBASE_RETURN(command)  

This macro is declared in upipe/ubase.h source file, line 232.

This macro runs the given function and returns an error in case of failure.

Parameter list:

  • command: command whose return code is to be checked

#define UBASE_SIGNATURE_CHECK(args, signature)  

This macro is declared in upipe/ubase.h source file, line 306.

This macro checks that the first argument is equal to the given signature.

Parameter list:

  • args: va_list of arguments
  • signature: unsigned int representing the signature of a module

#define UBASE_UNUSED  

This macro is declared in upipe/ubase.h source file, line 65.

This macro marks a function or variable as possibly unused (suppresses compiler warnings).

#define _UPIPE_UBASE_H_  

This macro is declared in upipe/ubase.h source file, line 31.

#define container_of(ptr, type, member)  

This macro is declared in upipe/ubase.h source file, line 82.

Preprocessor condition: not defined( container_of )

This macro is used to retrieve the private portion of a structure.

#define likely(x)  

This macro is declared in upipe/ubase.h source file, line 55.

Preprocessor condition: not defined( likely )

This macro should be used in a if conditional when it will be true most of the time.

#define ubase_assert(command)  

This macro is declared in upipe/ubase.h source file, line 291.

This macro asserts if the given command (returning an enum ubase_err) failed.

Parameter list:

  • command: command whose return code is to be checked

bool ubase_check(int err)  

This function is declared in upipe/ubase.h source file, line 225.

This function returns true if no error happened in an error code.

Parameter list:

  • err: error code

The return value is true if no error happened

void ubase_clean_data(uint8_t **data_p)  

This function is declared in upipe/ubase.h source file, line 481.

This function frees data pointer and sets it to NULL.

Parameter list:

  • ptr: a pointer to data pointer

void ubase_clean_fd(int *fd_p)  

This function is declared in upipe/ubase.h source file, line 490.

This function closes a fd and sets it to -1.

Parameter list:

  • fd_p: a pointer to a fd

void ubase_clean_ptr(void **ptr_p)  

This function is declared in upipe/ubase.h source file, line 460.

This function frees a pointer and sets it to NULL.

Parameter list:

  • ptr: a pointer to malloced data or NULL

void ubase_clean_str(char **str_p)  

This function is declared in upipe/ubase.h source file, line 472.

This function frees a string and sets it to NULL.

Parameter list:

  • ptr: a pointer to a string

int ubase_clip(int i, int min, int max)  

This function is declared in upipe/ubase.h source file, line 518.

This function clips an integer into the given range

Parameter list:

  • args: the va list to copy from

The return value is a signature

enum ubase_err  

This enum is declared in upipe/ubase.h source file, line 170.

This enum defines the standard error codes.

IdentifierValueDescription
UBASE_ERR_NONE0no error
UBASE_ERR_UNKNOWN1unknown error
UBASE_ERR_ALLOC2allocation error
UBASE_ERR_NOSPC3not enough space
UBASE_ERR_UPUMP4unable to allocate a upump
UBASE_ERR_UNHANDLED5unhandled command or event
UBASE_ERR_INVALID6invalid argument
UBASE_ERR_EXTERNAL7error in external library
UBASE_ERR_BUSY8failure to get an exclusive resource
UBASE_ERR_LOCAL0x8000non-standard error codes implemented by a module type can start from there

const char * ubase_err_str(int err)  

This function is declared in upipe/ubase.h source file, line 203.

This function return the corresponding error string.

Parameter list:

  • err: the error value

The return value is the error string

uint64_t ubase_gcd(uint64_t a, uint64_t b)  

This function is declared in upipe/ubase.h source file, line 338.

This function returns the greatest common denominator between two positive integers.

Parameter list:

  • a: first integer (not null)
  • b: second integer

The return value is GCD of the two integers

uint32_t ubase_get_signature(va_list args)  

This function is declared in upipe/ubase.h source file, line 504.

This function copies the signature from a va list.

Parameter list:

  • args: the va list to copy from

The return value is a signature

#define ubase_nassert(command)  

This macro is declared in upipe/ubase.h source file, line 298.

This macro asserts if the given command (returning an enum ubase_err) succeeded.

Parameter list:

  • command: command whose return code is to be checked

int ubase_ncmp(const char *string, const char *prefix)  

This function is declared in upipe/ubase.h source file, line 451.

This function checks if a prefix matches a string.

Parameter list:

  • string: large string
  • prefix: prefix to check

The return value is 0 if the prefix matches

int64_t ubase_sign(int64_t x)  

This function is declared in upipe/ubase.h source file, line 327.

This function returns the sign of an integer.

Parameter list:

  • x: integer

The return value is sign of the integer

struct uchain  

This struct is declared in upipe/ubase.h source file, line 140.

This struct is designed to chain uref and ubuf in a list.

FieldDescription
struct uchain * next;pointer to next element
struct uchain * prev;pointer to previous element

void uchain_init(struct uchain *uchain)  

This function is declared in upipe/ubase.h source file, line 152.

This function initializes a uchain.

Parameter list:

  • uchain: pointer to a uchain structure

#define unlikely(x)  

This macro is declared in upipe/ubase.h source file, line 60.

Preprocessor condition: not defined( unlikely )

This macro should be used in a if conditional when it will be false most of the time.

struct urational  

This struct is declared in upipe/ubase.h source file, line 348.

This struct defines the rational type.

FieldDescription
int64_t num;numerator
uint64_t den;denominator

struct urational urational_add(const struct urational *urational1, const struct urational *urational2)  

This function is declared in upipe/ubase.h source file, line 397.

This function adds two rationals.

Parameter list:

  • urational1: pointer to rational 1
  • urational2: pointer to rational 2

The return value is a rational

int64_t urational_cmp(const struct urational *urational1, const struct urational *urational2)  

This function is declared in upipe/ubase.h source file, line 380.

This function compares two rationals.

Parameter list:

  • urational1: pointer to rational 1
  • urational2: pointer to rational 2

The return value is 0 if both rationals are equal

struct urational urational_divide(const struct urational *dividend, const struct urational *diviser)  

This function is declared in upipe/ubase.h source file, line 430.

This function divides two rationals.

Parameter list:

  • urational1: pointer to rational 1
  • urational2: pointer to rational 2

The return value is a rational

struct urational urational_multiply(const struct urational *urational1, const struct urational *urational2)  

This function is declared in upipe/ubase.h source file, line 414.

This function multiplies two rationals.

Parameter list:

  • urational1: pointer to rational 1
  • urational2: pointer to rational 2

The return value is a rational

void urational_simplify(struct urational *urational)  

This function is declared in upipe/ubase.h source file, line 360.

This function simplifies a rational.

Parameter list:

  • urational: pointer to rational

#define UBASE_VARARG(command, ...)  

This macro is for internal use only.

This macro is declared in upipe/ubase.h source file, line 122.

This macro is a helper to simplify printf-style functions.

Valid XHTML 1.0 StrictGenerated by cmassiot on Fri Feb 2 23:57:19 2018 using MkDoc