|
avcpp
2.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
|
Light weight wrapper for the FFmpeg AVBufferRef functionality. More...
#include <buffer.h>


Public Member Functions | |
| BufferRef ()=default | |
| Construct null buffer. More... | |
| BufferRef (std::size_t size, bool keepUninit=true) noexcept | |
| Allocate referenced buffer with given size. More... | |
| 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. More... | |
| 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. More... | |
| BufferRef (const uint8_t *data, size_t size, int flags=0) noexcept | |
| Clone exsiting data buffer and wrap it. More... | |
| BufferRef (const BufferRef &other) noexcept | |
| Make a buffer reference. More... | |
| BufferRef (BufferRef &&other) noexcept | |
| Just move owning of the nested AVBufferRef pointer into new instance. More... | |
| ~BufferRef () noexcept | |
| Unref nested AVBufferRef. More... | |
| BufferRef & | operator= (const BufferRef &other) noexcept |
| Make a buffer reference. More... | |
| BufferRef & | operator= (BufferRef &&other) noexcept |
| Move owning of the nested AVBufferRef from other to the this instance. More... | |
| AVBufferRef * | release () noexcept |
| Release owning of the buffer and return existing raw AVBufferRef. More... | |
| void | reset () noexcept |
| Force to unref nested data. More... | |
| void | makeWritable (OptionalErrorCode ec=throws()) |
| Make buffer writable. More... | |
| void | resize (std::size_t size, OptionalErrorCode ec=throws()) |
| Resize given buffer. More... | |
| void | swap (BufferRef &other) noexcept |
| Swap nested data with other. More... | |
| BufferRef | ref () |
| Create reference to the view data, refCount() will be increased. More... | |
Public Member Functions inherited from av::BufferRefView | |
| BufferRefView ()=default | |
| Construct null buffer. More... | |
| BufferRefView (BufferRef &ref) | |
| BufferRefView (const BufferRef &ref) | |
| AVBufferRef * | makeRef (iam_sure_what_i_do_tag) const noexcept |
| Make an reference of the exsting buffer. More... | |
| BufferRef | ref () |
| Create reference to the view data, refCount() will be increased. More... | |
| BufferRef | clone (int flags=0) const noexcept |
| Make deep copy of the existing buffer. More... | |
| int | refCount () const noexcept |
| Report current reference counter of the buffer. More... | |
| bool | isWritable () const noexcept |
| Report writable flag. More... | |
| std::size_t | size () const noexcept |
| Nested buffer size. More... | |
| const uint8_t * | data () const noexcept |
| Pointer to the data block start. More... | |
| const uint8_t * | constData () const noexcept |
| Force request const data. More... | |
| uint8_t * | data (OptionalErrorCode ec=throws()) |
| Pointer to the data block start. More... | |
Public Member Functions inherited from FFWrapperPtr< AVBufferRef > | |
| FFWrapperPtr ()=default | |
| FFWrapperPtr (AVBufferRef *raw) | |
| const AVBufferRef * | raw () const |
| AVBufferRef * | raw () |
| void | reset (AVBufferRef *raw=nullptr) |
| bool | isNull () const |
| void | _log (int level, const char *fmt) const |
| void | _log (int level, const char *fmt, const Args &... args) const |
Static Public Member Functions | |
| static BufferRef | wrap (const AVBufferRef *buf, int flags=0) noexcept |
| Wrap constant raw buffer reference. More... | |
| static BufferRef | wrap (AVBufferRef *buf) noexcept |
| Wrap non-constant raw buffer reference. More... | |
| static BufferRef | ref (const AVBufferRef *buf) noexcept |
| Reference non-const buffer reference and wrap it. More... | |
Additional Inherited Members | |
Protected Attributes inherited from FFWrapperPtr< AVBufferRef > | |
| AVBufferRef * | m_raw |
Light weight wrapper for the FFmpeg AVBufferRef functionality.
|
default |
Construct null buffer.
|
noexcept |
Allocate referenced buffer with given size.
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 |
Wrap existing data buffer and take ownershipping.
Data kept uncopied.
If data allocated with custom allocators other then av_malloc/av_realloc/av::alloc/avmemdup 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/avmemdup function familiy. |
| opaque | optional argnument for the deleter, may be null |
| flags | AV_BUFFER_FLAG_* flags |
|
noexcept |
Same previous one, but forces AV_BUFFER_FLAG_READONLY.
Data still uncopied until makeWritable() call.
Can be used to wrap static constant data with av::buffer::null_deleter.
| data | |
| size | |
| opaque | |
| flags |
|
noexcept |
Clone exsiting data buffer and wrap it.
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 |
Make a buffer reference.
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 |
Just move owning of the nested AVBufferRef pointer into new instance.
refCount() kept untouched. other buffer does not controll nested AVBufferRef anymore;
| other |
|
noexcept |
Unref nested AVBufferRef.
If the refCount() == 1 data will be deleted too.
| void av::BufferRef::makeWritable | ( | OptionalErrorCode | ec = throws() | ) |
Make buffer writable.
Look into notice of the av_buffer_make_writable() for data coping details.
| ec |
Move owning of the nested AVBufferRef from other to the this instance.
Existing data will be unreferenced.
| other |
Make a buffer reference.
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 |
| BufferRef av::BufferRefView::ref |
Create reference to the view data, refCount() will be increased.
|
staticnoexcept |
Reference non-const buffer reference and wrap it.
Owning of the new ference will be taken. Data kept uncopying.
| buf | raw buffer to reference |
|
noexcept |
Release owning of the buffer and return existing raw AVBufferRef.
Useful to move owning without referencing into nested low-level code.
|
noexcept |
Force to unref nested data.
| void av::BufferRef::resize | ( | std::size_t | size, |
| OptionalErrorCode | ec = throws() |
||
| ) |
Resize given buffer.
Look into of the av_buffer_realloc() for allocation details.
| size | new buffer size |
| ec |
|
noexcept |
Swap nested data with other.
| other |
|
staticnoexcept |
Wrap non-constant raw buffer reference.
Owning taken, but original buffer will not be referenced.
Possible usage:
| buf | buffer to wrap |
|
staticnoexcept |
Wrap constant raw buffer reference.
Data will be cloned into new buffer.
| buf | buffer to wrap |
| flags | AV_BUFFER_FLAG_* |