|
avcpp 3.1.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
|
Light weight wrapper for the FFmpeg AVBufferRef functionality.
#include <buffer.h>
Public Member Functions | |
| BufferRef ()=default | |
| Construct null buffer. | |
| BufferRef (std::size_t size, bool keepUninit=true) noexcept | |
| Allocate referenced buffer with given size. | |
| BufferRef (uint8_t *data, size_t size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags=0) noexcept | |
| Wrap existing data buffer and take ownershipping. | |
| BufferRef (const uint8_t *data, size_t size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags=0) noexcept | |
| Same previous one, but forces AV_BUFFER_FLAG_READONLY. | |
| BufferRef (const uint8_t *data, size_t size, int flags=0) noexcept | |
| Clone exsiting data buffer and wrap it. | |
| BufferRef (std::span< uint8_t > data, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags=0) noexcept | |
| Same to BufferRef(data, size, free, opaque, flags) but pass data via std::span() interface. | |
| BufferRef (std::span< const uint8_t > data, int flags=0) noexcept | |
| Same to BufferRef(data, size, flags) but pass data via std::span() interface. | |
| BufferRef (const BufferRef &other) noexcept | |
| Make a buffer reference. | |
| BufferRef (BufferRef &&other) noexcept | |
| Just move owning of the nested AVBufferRef pointer into new instance. | |
| ~BufferRef () noexcept | |
| Unref nested AVBufferRef. | |
| BufferRef & | operator= (const BufferRef &other) noexcept |
| Make a buffer reference. | |
| BufferRef & | operator= (BufferRef &&other) noexcept |
| Move owning of the nested AVBufferRef from other to the this instance. | |
| AVBufferRef * | release () noexcept |
| Release owning of the buffer and return existing raw AVBufferRef. | |
| void | reset () noexcept |
| Force to unref nested data. | |
| void | makeWritable (OptionalErrorCode ec=throws()) |
| Make buffer writable. | |
| void | resize (std::size_t size, OptionalErrorCode ec=throws()) |
| Resize given buffer. | |
| void | swap (BufferRef &other) noexcept |
| Swap nested data with other. | |
| BufferRef | ref () |
| Create reference to the view data, refCount() will be increased. | |
| Public Member Functions inherited from av::BufferRefView | |
| BufferRefView ()=default | |
| Construct null buffer. | |
| BufferRefView (BufferRef &ref) | |
| View an owning buffer. | |
| BufferRefView (const BufferRef &ref) | |
| View an owning buffer, read-only. | |
| AVBufferRef * | makeRef (iam_sure_what_i_do_tag) const noexcept |
| Make an reference of the exsting buffer. | |
| BufferRef | ref () |
| Create reference to the view data, refCount() will be increased. | |
| BufferRef | clone (int flags=0) const noexcept |
| Make deep copy of the existing buffer. | |
| int | refCount () const noexcept |
| Report current reference counter of the buffer. | |
| bool | isWritable () const noexcept |
| Report writable flag. | |
| std::size_t | size () const noexcept |
| Nested buffer size. | |
| const uint8_t * | data () const noexcept |
| Pointer to the data block start. | |
| const uint8_t * | constData () const noexcept |
| Force request const data. | |
| uint8_t * | data (OptionalErrorCode ec=throws()) |
| Pointer to the data block start. | |
| std::span< const uint8_t > | span () const noexcept |
| Span interface to obtain nested buffer data. | |
| std::span< const uint8_t > | constSpan () const noexcept |
| Force request const span. | |
| std::span< uint8_t > | span (OptionalErrorCode ec=throws()) |
| Span interface to obtain nested buffer data. | |
| Public Member Functions inherited from FFWrapperPtr< AVBufferRef > | |
| FFWrapperPtr ()=default | |
| Create an empty wrapper; isNull() is true. | |
| const AVBufferRef * | raw () const |
| Read access to the wrapped object. | |
| void | reset (AVBufferRef *raw=nullptr) |
| Replace the stored pointer. | |
| bool | isNull () const |
| Whether the wrapper is empty. | |
| void | _log (int level, const char *fmt) const |
| Log through the FFmpeg log system, using this wrapper as the context. | |
Static Public Member Functions | |
| static BufferRef | wrap (const AVBufferRef *buf, int flags=0) noexcept |
| Wrap constant raw buffer reference. | |
| static BufferRef | wrap (AVBufferRef *buf) noexcept |
| Wrap non-constant raw buffer reference. | |
| static BufferRef | ref (const AVBufferRef *buf) noexcept |
| Reference non-const buffer reference and wrap it. | |
Additional Inherited Members | |
| Protected Attributes inherited from FFWrapperPtr< AVBufferRef > | |
| AVBufferRef * | m_raw |
| The wrapped pointer; owned by the derived class, not by this template. | |
|
noexcept |
If keepUninit point into true data in the buffer kept uninitialized. otherwise it initializes with zeroes.
refCount() will return 1 after this function.
| size | requested size of the buffer |
| keepUninit | true to kept buffer with garbage and zeroing it otherwise. |
|
noexcept |
Data kept uncopied.
If data allocated with custom allocators other then av_malloc/av_realloc/av::alloc/av::memdup families, free function must be provided.
Also, it can be used to wrap static buffers with av::buffer::null_deleter()
refCount() will return 1 after this function.
| data | data buffer to wrap, owning taken. |
| size | size of the data buffer. |
| free | deleter for the data, maybe nullptr if data buffer was allocated with av_malloc/av_realloc/av::alloc/av::memdup function familiy. |
| opaque | optional argnument for the deleter, may be null |
| flags | AV_BUFFER_FLAG_* flags |
|
noexcept |
Data still uncopied until makeWritable() call.
Can be used to wrap static constant data with av::buffer::null_deleter.
| data | data buffer to wrap, not copied |
| size | size of the data buffer |
| free | deleter for the data; receives the opaque pointer and the data |
| opaque | optional argument for the deleter, may be null |
| flags | AV_BUFFER_FLAG_* flags |
|
noexcept |
Data copied into new storage and owning taken.
refCount() will return 1 after this function.
| data | data buffer with payload |
| size | data buffer size |
| flags | AV_BUFFER_FLAG_* |
|
noexcept |
Span must be pointed into start of the allocated block.
| data | data block reference with size |
| free | deleter, may be nullptr |
| opaque | extra data passed into deleter, maybe nullptr |
| flags | AV_BUFFER_FLAG_* |
|
explicitnoexcept |
Span may point to any location of the allocated memory block.
| data | data block reference with size |
| flags | AV_BUFFER_FLAG_* |
|
noexcept |
refCount() will return values increased by 1 for both new and old instances. Actual data will be kept uncopied. Newly created buffer may be invalid if the allocating for the reference block fails.
| other |
|
noexcept |
refCount() kept untouched. other buffer does not controll nested AVBufferRef anymore;
| other |
|
noexcept |
If the refCount() == 1 data will be deleted too.
| void av::BufferRef::makeWritable | ( | OptionalErrorCode | ec = throws() | ) |
Look into notice of the av_buffer_make_writable() for data coping details.
| ec |
Existing data will be unreferenced.
| other |
Existing data will be unreferenced. refCount() will return value increased by 1 for both this and other instances. Value must be same.
Buffer state may be invalid, if control block allocation will be fail durting copying.
| other |
|
staticnoexcept |
Owning of the new ference will be taken. Data kept uncopying.
| buf | raw buffer to reference |
|
noexcept |
Useful to move owning without referencing into nested low-level code.
| void av::BufferRef::resize | ( | std::size_t | size, |
| OptionalErrorCode | ec = throws() ) |
Look into of the av_buffer_realloc() for allocation details.
| size | new buffer size |
| ec |
|
noexcept |
| other |
|
staticnoexcept |
Owning taken, but original buffer will not be referenced.
Possible usage:
| buf | buffer to wrap |
|
staticnoexcept |
Data will be cloned into new buffer.
| buf | buffer to wrap |
| flags | AV_BUFFER_FLAG_* |