FFmpeg
2.8.1
|
Macros | |
#define | DECLARE_ALIGNED(n, t, v) t __attribute__ ((aligned (n))) v |
#define | DECLARE_ASM_CONST(n, t, v) static const t av_used __attribute__ ((aligned (n))) v |
#define | av_malloc_attrib __attribute__((__malloc__)) |
#define | av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__))) |
Functions | |
void * | av_malloc (size_t size) av_malloc_attrib 1(1) |
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if available on the CPU). More... | |
static void * | av_malloc_array (size_t nmemb, size_t size) |
void * | av_realloc (void *ptr, size_t size) 1(2) |
Allocate or reallocate a block of memory. More... | |
void * | av_realloc_f (void *ptr, size_t nelem, size_t elsize) |
Allocate or reallocate a block of memory. More... | |
int | av_reallocp (void *ptr, size_t size) |
Allocate or reallocate a block of memory. More... | |
void * | av_realloc_array (void *ptr, size_t nmemb, size_t size) |
int | av_reallocp_array (void *ptr, size_t nmemb, size_t size) |
void | av_free (void *ptr) |
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). More... | |
void * | av_mallocz (size_t size) av_malloc_attrib 1(1) |
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if available on the CPU) and zero all the bytes of the block. More... | |
void * | av_calloc (size_t nmemb, size_t size) av_malloc_attrib |
Allocate a block of nmemb * size bytes with alignment suitable for all memory accesses (including vectors if available on the CPU) and zero all the bytes of the block. More... | |
static void * | av_mallocz_array (size_t nmemb, size_t size) |
char * | av_strdup (const char *s) av_malloc_attrib |
Duplicate the string s. More... | |
char * | av_strndup (const char *s, size_t len) av_malloc_attrib |
Duplicate a substring of the string s. More... | |
void * | av_memdup (const void *p, size_t size) |
Duplicate the buffer p. More... | |
void | av_freep (void *ptr) |
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer pointing to it to NULL. More... | |
void | av_dynarray_add (void *tab_ptr, int *nb_ptr, void *elem) |
Add an element to a dynamic array. More... | |
int | av_dynarray_add_nofree (void *tab_ptr, int *nb_ptr, void *elem) |
Add an element to a dynamic array. More... | |
void * | av_dynarray2_add (void **tab_ptr, int *nb_ptr, size_t elem_size, const uint8_t *elem_data) |
Add an element of size elem_size to a dynamic array. More... | |
static int | av_size_mult (size_t a, size_t b, size_t *r) |
Multiply two size_t values checking for overflow. More... | |
void | av_max_alloc (size_t max) |
Set the maximum size that may me allocated in one block. More... | |
void | av_memcpy_backptr (uint8_t *dst, int back, int cnt) |
deliberately overlapping memcpy implementation More... | |
void * | av_fast_realloc (void *ptr, unsigned int *size, size_t min_size) |
Reallocate the given block if it is not large enough, otherwise do nothing. More... | |
void | av_fast_malloc (void *ptr, unsigned int *size, size_t min_size) |
Allocate a buffer, reusing the given one if large enough. More... | |
#define DECLARE_ALIGNED | ( | n, | |
t, | |||
v | |||
) | t __attribute__ ((aligned (n))) v |
#define DECLARE_ASM_CONST | ( | n, | |
t, | |||
v | |||
) | static const t av_used __attribute__ ((aligned (n))) v |
#define av_alloc_size | ( | ... | ) | __attribute__((alloc_size(__VA_ARGS__))) |
void* av_malloc | ( | size_t | size | ) |
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if available on the CPU).
size | Size in bytes for the memory block to be allocated. |
Referenced by audio_encode_example(), av_malloc_array(), and main().
|
inlinestatic |
void* av_realloc | ( | void * | ptr, |
size_t | size | ||
) |
Allocate or reallocate a block of memory.
If ptr is NULL and size > 0, allocate a new block. If size is zero, free the memory block pointed to by ptr.
ptr | Pointer to a memory block already allocated with av_realloc() or NULL. |
size | Size in bytes of the memory block to be allocated or reallocated. |
void* av_realloc_f | ( | void * | ptr, |
size_t | nelem, | ||
size_t | elsize | ||
) |
Allocate or reallocate a block of memory.
This function does the same thing as av_realloc, except:
int av_reallocp | ( | void * | ptr, |
size_t | size | ||
) |
Allocate or reallocate a block of memory.
If *ptr is NULL and size > 0, allocate a new block. If size is zero, free the memory block pointed to by ptr.
ptr | Pointer to a pointer to a memory block already allocated with av_realloc(), or pointer to a pointer to NULL. The pointer is updated on success, or freed on failure. |
size | Size in bytes for the memory block to be allocated or reallocated |
void* av_realloc_array | ( | void * | ptr, |
size_t | nmemb, | ||
size_t | size | ||
) |
int av_reallocp_array | ( | void * | ptr, |
size_t | nmemb, | ||
size_t | size | ||
) |
void av_free | ( | void * | ptr | ) |
Free a memory block which has been allocated with av_malloc(z)() or av_realloc().
ptr | Pointer to the memory block which should be freed. |
Referenced by audio_decode_example(), audio_encode_example(), main(), video_decode_example(), and video_encode_example().
void* av_mallocz | ( | size_t | size | ) |
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if available on the CPU) and zero all the bytes of the block.
size | Size in bytes for the memory block to be allocated. |
Referenced by av_mallocz_array().
void* av_calloc | ( | size_t | nmemb, |
size_t | size | ||
) |
Allocate a block of nmemb * size bytes with alignment suitable for all memory accesses (including vectors if available on the CPU) and zero all the bytes of the block.
The allocation will fail if nmemb * size is greater than or equal to INT_MAX.
nmemb | |
size |
|
inlinestatic |
char* av_strdup | ( | const char * | s | ) |
Duplicate the string s.
s | string to be duplicated |
Referenced by init_filter(), and init_filters().
char* av_strndup | ( | const char * | s, |
size_t | len | ||
) |
Duplicate a substring of the string s.
s | string to be duplicated |
len | the maximum length of the resulting string (not counting the terminating byte). |
void* av_memdup | ( | const void * | p, |
size_t | size | ||
) |
Duplicate the buffer p.
p | buffer to be duplicated |
void av_freep | ( | void * | ptr | ) |
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer pointing to it to NULL.
ptr | Pointer to the pointer to the memory block which should be freed. |
Referenced by audio_encode_example(), init_converted_samples(), main(), read_decode_convert_and_store(), and video_encode_example().
void av_dynarray_add | ( | void * | tab_ptr, |
int * | nb_ptr, | ||
void * | elem | ||
) |
Add an element to a dynamic array.
The array to grow is supposed to be an array of pointers to structures, and the element to add must be a pointer to an already allocated structure.
The array is reallocated when its size reaches powers of 2. Therefore, the amortized cost of adding an element is constant.
In case of success, the pointer to the array is updated in order to point to the new grown array, and the number pointed to by nb_ptr is incremented. In case of failure, the array is freed, *tab_ptr is set to NULL and *nb_ptr is set to 0.
tab_ptr | pointer to the array to grow |
nb_ptr | pointer to the number of elements in the array |
elem | element to add |
int av_dynarray_add_nofree | ( | void * | tab_ptr, |
int * | nb_ptr, | ||
void * | elem | ||
) |
Add an element to a dynamic array.
Function has the same functionality as av_dynarray_add(), but it doesn't free memory on fails. It returns error code instead and leave current buffer untouched.
tab_ptr | pointer to the array to grow |
nb_ptr | pointer to the number of elements in the array |
elem | element to add |
void* av_dynarray2_add | ( | void ** | tab_ptr, |
int * | nb_ptr, | ||
size_t | elem_size, | ||
const uint8_t * | elem_data | ||
) |
Add an element of size elem_size to a dynamic array.
The array is reallocated when its number of elements reaches powers of 2. Therefore, the amortized cost of adding an element is constant.
In case of success, the pointer to the array is updated in order to point to the new grown array, and the number pointed to by nb_ptr is incremented. In case of failure, the array is freed, *tab_ptr is set to NULL and *nb_ptr is set to 0.
tab_ptr | pointer to the array to grow |
nb_ptr | pointer to the number of elements in the array |
elem_size | size in bytes of the elements in the array |
elem_data | pointer to the data of the element to add. If NULL, the space of the new added element is not filled. |
|
inlinestatic |
Multiply two size_t values checking for overflow.
void av_max_alloc | ( | size_t | max | ) |
Set the maximum size that may me allocated in one block.
void av_memcpy_backptr | ( | uint8_t * | dst, |
int | back, | ||
int | cnt | ||
) |
deliberately overlapping memcpy implementation
dst | destination buffer |
back | how many bytes back we start (the initial size of the overlapping window), must be > 0 |
cnt | number of bytes to copy, must be >= 0 |
cnt > back is valid, this will copy the bytes we just copied, thus creating a repeating pattern with a period length of back.
void* av_fast_realloc | ( | void * | ptr, |
unsigned int * | size, | ||
size_t | min_size | ||
) |
Reallocate the given block if it is not large enough, otherwise do nothing.
void av_fast_malloc | ( | void * | ptr, |
unsigned int * | size, | ||
size_t | min_size | ||
) |
Allocate a buffer, reusing the given one if large enough.
Contrary to av_fast_realloc the current buffer contents might not be preserved and on error the old buffer is freed, thus no special handling to avoid memleaks is necessary.
ptr | pointer to pointer to already allocated buffer, overwritten with pointer to new buffer |
size | size of the buffer *ptr points to |
min_size | minimum size of *ptr buffer after returning, *ptr will be NULL and *size 0 if an error occurred. |