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. @param nmemb @param size @return Pointer to the allocated block, NULL if it cannot be allocated.
Add an element of size elem_size to a dynamic array.
Add an element to a dynamic array.
Add an element to a dynamic array.
Allocate a buffer, reusing the given one if large enough.
Allocate a buffer, reusing the given one if large enough.
Reallocate the given block if it is not large enough, otherwise do nothing.
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). @param ptr Pointer to the memory block which should be freed. @note ptr = NULL is explicitly allowed. @note It is recommended that you use av_freep() instead. @see av_freep()
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer pointing to it to NULL. @param ptr Pointer to the pointer to the memory block which should be freed. @note passing a pointer to a NULL pointer is safe and leads to no action. @see av_free()
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if available on the CPU). @param size Size in bytes for the memory block to be allocated. @return Pointer to the allocated block, NULL if the block cannot be allocated. @see av_mallocz()
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. @param size Size in bytes for the memory block to be allocated. @return Pointer to the allocated block, NULL if it cannot be allocated. @see av_malloc()
Set the maximum size that may me allocated in one block.
deliberately overlapping memcpy implementation @param dst destination buffer @param back how many bytes back we start (the initial size of the overlapping window), must be > 0 @param cnt number of bytes to copy, must be >= 0
Duplicate the buffer p. @param p buffer to be duplicated @return Pointer to a newly allocated buffer containing a copy of p or NULL if the buffer cannot be allocated.
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. @param ptr Pointer to a memory block already allocated with av_malloc(z)() or av_realloc() or NULL. @param size Size in bytes for the memory block to be allocated or reallocated. @return Pointer to a newly reallocated block or NULL if the block cannot be reallocated or the function is used to free the memory block. @see av_fast_realloc()
Allocate or reallocate an array. If ptr is NULL and nmemb > 0, allocate a new block. If nmemb is zero, free the memory block pointed to by ptr. @param ptr Pointer to a memory block already allocated with av_realloc() or NULL. @param nmemb Number of elements @param size Size of the single element @return Pointer to a newly-reallocated block or NULL if the block cannot be reallocated or the function is used to free the memory block. @warning Pointers originating from the av_malloc() family of functions must not be passed to av_realloc(). The former can be implemented using memalign() (or other functions), and there is no guarantee that pointers from such functions can be passed to realloc() at all. The situation is undefined according to POSIX and may crash with some libc implementations.
Allocate or reallocate a block of memory. This function does the same thing as av_realloc, except: - It takes two arguments and checks the result of the multiplication for integer overflow. - It frees the input block in case of failure, thus avoiding the memory leak with the classic "buf = realloc(buf); if (!buf) return -1;".
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. @param 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. @param size Size in bytes for the memory block to be allocated or reallocated @return Zero on success, an AVERROR error code on failure. @warning Pointers originating from the av_malloc() family of functions must not be passed to av_reallocp(). The former can be implemented using memalign() (or other functions), and there is no guarantee that pointers from such functions can be passed to realloc() at all. The situation is undefined according to POSIX and may crash with some libc implementations.
Allocate or reallocate an array through a pointer to a pointer. If *ptr is NULL and nmemb > 0, allocate a new block. If nmemb is zero, free the memory block pointed to by ptr. @param 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. @param nmemb Number of elements @param size Size of the single element @return Zero on success, an AVERROR error code on failure. @warning Pointers originating from the av_malloc() family of functions must not be passed to av_realloc(). The former can be implemented using memalign() (or other functions), and there is no guarantee that pointers from such functions can be passed to realloc() at all. The situation is undefined according to POSIX and may crash with some libc implementations.
Duplicate the string s. @param s string to be duplicated @return Pointer to a newly allocated string containing a copy of s or NULL if the string cannot be allocated.
Duplicate a substring of the string s. @param s string to be duplicated @param len the maximum length of the resulting string (not counting the terminating byte). @return Pointer to a newly-allocated string containing a copy of s or NULL if the string cannot be allocated.
Helper function to allocate a block of size * nmemb bytes with using av_malloc() @param nmemb Number of elements @param size Size of the single element @return Pointer to the allocated block, NULL if the block cannot be allocated. @see av_malloc()
Allocate a block of size * nmemb bytes with av_mallocz(). @param nmemb Number of elements @param size Size of the single element @return Pointer to the allocated block, NULL if the block cannot be allocated. @see av_mallocz() @see av_malloc_array()
Multiply two size_t values checking for overflow. @return 0 if success, AVERROR(EINVAL) if overflow.