World of Might and Magic
0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
|
Файлы | |
файл | buffer.h |
Классы | |
struct | AVBufferRef |
Определения типов | |
typedef struct AVBuffer | AVBuffer |
typedef struct AVBufferRef | AVBufferRef |
Функции | |
AVBufferRef * | av_buffer_alloc (int size) |
AVBufferRef * | av_buffer_allocz (int size) |
AVBufferRef * | av_buffer_create (uint8_t *data, int size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags) |
void | av_buffer_default_free (void *opaque, uint8_t *data) |
AVBufferRef * | av_buffer_ref (AVBufferRef *buf) |
void | av_buffer_unref (AVBufferRef **buf) |
int | av_buffer_is_writable (const AVBufferRef *buf) |
void * | av_buffer_get_opaque (const AVBufferRef *buf) |
int | av_buffer_get_ref_count (const AVBufferRef *buf) |
int | av_buffer_make_writable (AVBufferRef **buf) |
int | av_buffer_realloc (AVBufferRef **buf, int size) |
AVBuffer is an API for reference-counted data buffers.
There are two core objects in this API – AVBuffer and AVBufferRef. AVBuffer represents the data buffer itself; it is opaque and not meant to be accessed by the caller directly, but only through AVBufferRef. However, the caller may e.g. compare two AVBuffer pointers to check whether two different references are describing the same data buffer. AVBufferRef represents a single reference to an AVBuffer and it is the object that may be manipulated by the caller directly.
There are two functions provided for creating a new AVBuffer with a single reference – av_buffer_alloc() to just allocate a new buffer, and av_buffer_create() to wrap an existing array in an AVBuffer. From an existing reference, additional references may be created with av_buffer_ref(). Use av_buffer_unref() to free a reference (this will automatically free the data once all the references are freed).
The convention throughout this API and the rest of FFmpeg is such that the buffer is considered writable if there exists only one reference to it (and it has not been marked as read-only). The av_buffer_is_writable() function is provided to check whether this is true and av_buffer_make_writable() will automatically create a new writable buffer when necessary. Of course nothing prevents the calling code from violating this convention, however that is safe only when all the existing references are under its control.
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/buffer.h>
A reference counted buffer type. It is opaque and is meant to be used through references (AVBufferRef).
typedef struct AVBufferRef AVBufferRef |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/buffer.h>
A reference to a data buffer.
The size of this struct is not a part of the public ABI and it is not meant to be allocated directly.
AVBufferRef* av_buffer_alloc | ( | int | size | ) |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/buffer.h>
Allocate an AVBuffer of the given size using av_malloc().
AVBufferRef* av_buffer_allocz | ( | int | size | ) |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/buffer.h>
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
AVBufferRef* av_buffer_create | ( | uint8_t * | data, |
int | size, | ||
void(*)(void *opaque, uint8_t *data) | free, | ||
void * | opaque, | ||
int | flags | ||
) |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/buffer.h>
Create an AVBuffer from an existing array.
If this function is successful, data is owned by the AVBuffer. The caller may only access data through the returned AVBufferRef and references derived from it. If this function fails, data is left untouched.
data | data array |
size | size of data in bytes |
free | a callback for freeing this buffer's data |
opaque | parameter to be got for processing or passed to free |
flags | a combination of AV_BUFFER_FLAG_* |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/buffer.h>
Default free callback, which calls av_free() on the buffer data. This function is meant to be passed to av_buffer_create(), not called directly.
AVBufferRef* av_buffer_ref | ( | AVBufferRef * | buf | ) |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/buffer.h>
Create a new reference to an AVBuffer.
void av_buffer_unref | ( | AVBufferRef ** | buf | ) |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/buffer.h>
Free a given reference and automatically free the buffer if there are no more references to it.
buf | the reference to be freed. The pointer is set to NULL on return. |
int av_buffer_is_writable | ( | const AVBufferRef * | buf | ) |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/buffer.h>
void* av_buffer_get_opaque | ( | const AVBufferRef * | buf | ) |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/buffer.h>
int av_buffer_get_ref_count | ( | const AVBufferRef * | buf | ) |
int av_buffer_make_writable | ( | AVBufferRef ** | buf | ) |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/buffer.h>
Create a writable reference from a given buffer reference, avoiding data copy if possible.
buf | buffer reference to make writable. On success, buf is either left untouched, or it is unreferenced and a new writable AVBufferRef is written in its place. On failure, buf is left untouched. |
int av_buffer_realloc | ( | AVBufferRef ** | buf, |
int | size | ||
) |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/buffer.h>
Reallocate a given buffer.
buf | a buffer reference to reallocate. On success, buf will be unreferenced and a new reference with the required size will be written in its place. On failure buf will be left untouched. *buf may be NULL, then a new buffer is allocated. |
size | required new buffer size. |