![]() |
Miam-Player
0.8.0
A nice music player
|
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "attributes.h"
#include "macros.h"
#include "version.h"
#include "libavutil/avconfig.h"
#include "common.h"
#include "mem.h"
Go to the source code of this file.
Macros | |
#define | AV_NE(be, le) (le) |
#define | RSHIFT(a, b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) |
#define | ROUNDED_DIV(a, b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) |
#define | AV_CEIL_RSHIFT(a, b) |
#define | FF_CEIL_RSHIFT AV_CEIL_RSHIFT |
#define | FFUDIV(a, b) (((a)>0 ?(a):(a)-(b)+1) / (b)) |
#define | FFUMOD(a, b) ((a)-(b)*FFUDIV(a,b)) |
#define | FFABS(a) ((a) >= 0 ? (a) : (-(a))) |
#define | FFSIGN(a) ((a) > 0 ? 1 : -1) |
#define | FFNABS(a) ((a) <= 0 ? (a) : (-(a))) |
#define | FFDIFFSIGN(x, y) (((x)>(y)) - ((x)<(y))) |
#define | FFMAX(a, b) ((a) > (b) ? (a) : (b)) |
#define | FFMAX3(a, b, c) FFMAX(FFMAX(a,b),c) |
#define | FFMIN(a, b) ((a) > (b) ? (b) : (a)) |
#define | FFMIN3(a, b, c) FFMIN(FFMIN(a,b),c) |
#define | FFSWAP(type, a, b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) |
#define | FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) |
#define | MKTAG(a, b, c, d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) |
#define | MKBETAG(a, b, c, d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) |
#define | GET_UTF8(val, GET_BYTE, ERROR) |
#define | GET_UTF16(val, GET_16BIT, ERROR) |
#define | PUT_UTF8(val, tmp, PUT_BYTE) |
#define | PUT_UTF16(val, tmp, PUT_16BIT) |
Functions | |
av_const int | av_log2 (unsigned v) |
av_const int | av_log2_16bit (unsigned v) |
common internal and external API header
#define AV_CEIL_RSHIFT | ( | a, | |
b | |||
) |
#define AV_NE | ( | be, | |
le | |||
) | (le) |
#define FF_ARRAY_ELEMS | ( | a | ) | (sizeof(a) / sizeof((a)[0])) |
#define FF_CEIL_RSHIFT AV_CEIL_RSHIFT |
#define FFABS | ( | a | ) | ((a) >= 0 ? (a) : (-(a))) |
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable as absolute values of their type. This is the same as with *abs()
#define FFDIFFSIGN | ( | x, | |
y | |||
) | (((x)>(y)) - ((x)<(y))) |
Comparator. For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0 if x == y. This is useful for instance in a qsort comparator callback. Furthermore, compilers are able to optimize this to branchless code, and there is no risk of overflow with signed types. As with many macros, this evaluates its argument multiple times, it thus must not have a side-effect.
#define FFMAX | ( | a, | |
b | |||
) | ((a) > (b) ? (a) : (b)) |
#define FFMIN | ( | a, | |
b | |||
) | ((a) > (b) ? (b) : (a)) |
#define FFNABS | ( | a | ) | ((a) <= 0 ? (a) : (-(a))) |
Negative Absolute value. this works for all integers of all types. As with many macros, this evaluates its argument twice, it thus must not have a sideeffect, that is FFNABS(x++) has undefined behavior.
#define FFSIGN | ( | a | ) | ((a) > 0 ? 1 : -1) |
#define FFSWAP | ( | type, | |
a, | |||
b | |||
) | do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) |
#define FFUDIV | ( | a, | |
b | |||
) | (((a)>0 ?(a):(a)-(b)+1) / (b)) |
#define FFUMOD | ( | a, | |
b | |||
) | ((a)-(b)*FFUDIV(a,b)) |
#define GET_UTF16 | ( | val, | |
GET_16BIT, | |||
ERROR | |||
) |
Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form.
val | Output value, must be an lvalue of type uint32_t. |
GET_16BIT | Expression returning two bytes of UTF-16 data converted to native byte order. Evaluated one or two times. |
ERROR | Expression to be evaluated on invalid input, typically a goto statement. |
#define GET_UTF8 | ( | val, | |
GET_BYTE, | |||
ERROR | |||
) |
Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form.
val | Output value, must be an lvalue of type uint32_t. |
GET_BYTE | Expression reading one byte from the input. Evaluated up to 7 times (4 for the currently assigned Unicode range). With a memory buffer input, this could be *ptr++. |
ERROR | Expression to be evaluated on invalid input, typically a goto statement. |
#define MKBETAG | ( | a, | |
b, | |||
c, | |||
d | |||
) | ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) |
#define MKTAG | ( | a, | |
b, | |||
c, | |||
d | |||
) | ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) |
#define PUT_UTF16 | ( | val, | |
tmp, | |||
PUT_16BIT | |||
) |
Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes).
val | is an input-only argument and should be of type uint32_t. It holds a UCS-4 encoded Unicode character that is to be converted to UTF-16. If val is given as a function it is executed only once. |
tmp | is a temporary variable and should be of type uint16_t. It represents an intermediate value during conversion that is to be output by PUT_16BIT. |
PUT_16BIT | writes the converted UTF-16 data to any proper destination in desired endianness. It could be a function or a statement, and uses tmp as the input byte. For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be executed 1 or 2 times depending on input character. |
#define PUT_UTF8 | ( | val, | |
tmp, | |||
PUT_BYTE | |||
) |
Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long).
val | is an input-only argument and should be of type uint32_t. It holds a UCS-4 encoded Unicode character that is to be converted to UTF-8. If val is given as a function it is executed only once. |
tmp | is a temporary variable and should be of type uint8_t. It represents an intermediate value during conversion that is to be output by PUT_BYTE. |
PUT_BYTE | writes the converted UTF-8 bytes to any proper destination. It could be a function or a statement, and uses tmp as the input byte. For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be executed up to 4 times for values in the valid UTF-8 range and up to 7 times in the general case, depending on the length of the converted Unicode character. |
#define ROUNDED_DIV | ( | a, | |
b | |||
) | (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) |
#define RSHIFT | ( | a, | |
b | |||
) | ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) |
av_const int av_log2 | ( | unsigned | v | ) |
av_const int av_log2_16bit | ( | unsigned | v | ) |