upipe/ubase.h header reference
Upipe common definitions More
Members [link]
Types [link]
Functions [link]
- bool ubase_check(int err)
- void ubase_clean_data(uint8_t **data_p)
- void ubase_clean_fd(int *fd_p)
- void ubase_clean_ptr(void **ptr_p)
- void ubase_clean_str(char **str_p)
- int ubase_clip(int i, int min, int max)
- const char * ubase_err_str(int err)
- uint64_t ubase_gcd(uint64_t a, uint64_t b)
- uint32_t ubase_get_signature(va_list args)
- int ubase_ncmp(const char *string, const char *prefix)
- uint16_t ubase_read_u16(const uint8_t *p)
- uint32_t ubase_read_u32(const uint8_t *p)
- int64_t ubase_sign(int64_t x)
- void ubase_write_u16(uint8_t *p, uint16_t v)
- void ubase_write_u32(uint8_t *p, uint32_t v)
- void uchain_init(struct uchain *uchain)
- struct urational urational_add(const struct urational *v1, const struct urational *v2)
- int64_t urational_cmp(const struct urational *urational1, const struct urational *urational2)
- struct urational urational_divide(const struct urational *dividend, const struct urational *diviser)
- struct urational urational_multiply(const struct urational *urational1, const struct urational *urational2)
- void urational_simplify(struct urational *urational)
Macros [link]
Description [link]
Upipe common definitions
Members detail [link]
#define UBASE_ALLOC_RETURN(var) [link]
This macro is declared in upipe/ubase.h source file, line 347.
This macro returns #UBASE_ERR_ALLOC if the variable is NULL.
Parameter list:
- var: variable to check
#define UBASE_ARRAY_SIZE(a) [link]
This macro is declared in upipe/ubase.h source file, line 101.
This macro is used to retrieve the number of items of an array.
#define UBASE_BIGENDIAN [link]
This macro is declared in upipe/ubase.h source file, line 177.
#define UBASE_CASE_TO_STR(Value) [link]
This macro is declared in upipe/ubase.h source file, line 219.
#define UBASE_DEPRECATED [link]
This macro is declared in upipe/ubase.h source file, line 69.
This macro marks a function or variable as deprecated (forces compiler warnings).
#define UBASE_ERROR(upipe, command) [link]
This macro is declared in upipe/ubase.h source file, line 305.
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) [link]
This macro is declared in upipe/ubase.h source file, line 280.
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) [link]
This macro is declared in upipe/ubase.h source file, line 292.
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) [link]
This macro is declared in upipe/ubase.h source file, line 71.
This macro marks a function as taking printf style arguments
#define UBASE_FOURCC(a, b, c, d) [link]
This macro is declared in upipe/ubase.h source file, line 182.
This macro allows to define a 32-bit unsigned integer with 4 letters.
#define UBASE_FROM_TO(STRUCTURE, SUBSTRUCT, SUBNAME, SUB) [link]
This macro is declared in upipe/ubase.h source file, line 120.
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) [link]
This macro is declared in upipe/ubase.h source file, line 269.
This macro runs the given function and returns if the error code is not UBASE_ERR_UNHANDLED.
Parameter list:
- command: command whose return code is to be checked
#define UBASE_PRAGMA(x) [link]
This macro is declared in upipe/ubase.h source file, line 88.
#define UBASE_PRAGMA_CLANG(x) [link]
This macro is declared in upipe/ubase.h source file, line 90.
#define UBASE_PRAGMA_GCC(x) [link]
This macro is declared in upipe/ubase.h source file, line 95.
#define UBASE_RETURN(command) [link]
This macro is declared in upipe/ubase.h source file, line 257.
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) [link]
This macro is declared in upipe/ubase.h source file, line 337.
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 [link]
This macro is declared in upipe/ubase.h source file, line 66.
This macro marks a function or variable as possibly unused (suppresses compiler warnings).
#define _UPIPE_UBASE_H_ [link]
This macro is declared in upipe/ubase.h source file, line 32.
#define container_of(ptr, type, member) [link]
This macro is declared in upipe/ubase.h source file, line 83.
Preprocessor condition: not defined( container_of )
This macro is used to retrieve the private portion of a structure.
#define likely(x) [link]
This macro is declared in upipe/ubase.h source file, line 56.
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_array_foreach(a, item) [link]
This macro is declared in upipe/ubase.h source file, line 108.
This macro iterates the items of a fixed size array.
Parameter list:
- a: the array to iterate
- item: array iterator
#define ubase_assert(command) [link]
This macro is declared in upipe/ubase.h source file, line 317.
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) [link]
This function is declared in upipe/ubase.h source file, line 250.
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) [link]
This function is declared in upipe/ubase.h source file, line 515.
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) [link]
This function is declared in upipe/ubase.h source file, line 524.
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) [link]
This function is declared in upipe/ubase.h source file, line 494.
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) [link]
This function is declared in upipe/ubase.h source file, line 506.
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) [link]
This function is declared in upipe/ubase.h source file, line 554.
This function clips an integer into the given range
Parameter list:
- i: integer value
- min: minimum value
- max: maximum value
The return value is an integer
enum ubase_err [link]
This enum is declared in upipe/ubase.h source file, line 195.
This enum defines the standard error codes.
| Identifier | Value | Description |
|---|---|---|
| UBASE_ERR_NONE | 0 | no error |
| UBASE_ERR_UNKNOWN | 1 | unknown error |
| UBASE_ERR_ALLOC | 2 | allocation error |
| UBASE_ERR_NOSPC | 3 | not enough space |
| UBASE_ERR_UPUMP | 4 | unable to allocate a upump |
| UBASE_ERR_UNHANDLED | 5 | unhandled command or event |
| UBASE_ERR_INVALID | 6 | invalid argument |
| UBASE_ERR_EXTERNAL | 7 | error in external library |
| UBASE_ERR_BUSY | 8 | failure to get an exclusive resource |
| UBASE_ERR_LOCAL | 0x8000 | non-standard error codes implemented by a module type can start from there |
const char * ubase_err_str(int err) [link]
This function is declared in upipe/ubase.h source file, line 228.
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) [link]
This function is declared in upipe/ubase.h source file, line 369.
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) [link]
This function is declared in upipe/ubase.h source file, line 538.
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) [link]
This macro is declared in upipe/ubase.h source file, line 327.
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) [link]
This function is declared in upipe/ubase.h source file, line 485.
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
uint16_t ubase_read_u16(const uint8_t *p) [link]
This function is declared in upipe/ubase.h source file, line 588.
This function reads a big-endian unsigned 16-bit integer
Parameter list:
- p: source address
The return value is 16-bit value
uint32_t ubase_read_u32(const uint8_t *p) [link]
This function is declared in upipe/ubase.h source file, line 598.
This function reads a big-endian unsigned 32-bit integer
Parameter list:
- p: source address
The return value is 32-bit value
int64_t ubase_sign(int64_t x) [link]
This function is declared in upipe/ubase.h source file, line 358.
This function returns the sign of an integer.
Parameter list:
- x: integer
The return value is sign of the integer
void ubase_write_u16(uint8_t *p, uint16_t v) [link]
This function is declared in upipe/ubase.h source file, line 566.
This function writes a big-endian unsigned 16-bit integer
Parameter list:
- p: destination address
- v: 16-bit value
void ubase_write_u32(uint8_t *p, uint32_t v) [link]
This function is declared in upipe/ubase.h source file, line 577.
This function writes a big-endian unsigned 32-bit integer
Parameter list:
- p: destination address
- v: 32-bit value
struct uchain [link]
This struct is declared in upipe/ubase.h source file, line 161.
This struct is designed to chain uref and ubuf in a list.
This function is declared in upipe/ubase.h source file, line 173.
This function initializes a uchain.
Parameter list:
- uchain: pointer to a uchain structure
#define unlikely(x) [link]
This macro is declared in upipe/ubase.h source file, line 61.
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 [link]
This struct is declared in upipe/ubase.h source file, line 379.
This struct defines the rational type.
This function is declared in upipe/ubase.h source file, line 428.
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) [link]
This function is declared in upipe/ubase.h source file, line 411.
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) [link]
This function is declared in upipe/ubase.h source file, line 464.
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) [link]
This function is declared in upipe/ubase.h source file, line 448.
This function multiplies two rationals.
Parameter list:
- urational1: pointer to rational 1
- urational2: pointer to rational 2
The return value is a rational
This function is declared in upipe/ubase.h source file, line 391.
This function simplifies a rational.
Parameter list:
- urational: pointer to rational
#define UBASE_VARARG(command, ...) [link]
This macro is for internal use only.
This macro is declared in upipe/ubase.h source file, line 143.
This macro is a helper to simplify printf-style functions.