avcpp 3.1.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
Loading...
Searching...
No Matches
av::BufferRefView Class Reference

Non-owning view for the nested AVBufferRef.

#include <buffer.h>

Inheritance diagram for av::BufferRefView:

Classes

struct  iam_sure_what_i_do_tag
 Tag to confirm usage of the Low Level functionality. More...

Public Member Functions

 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.

Additional Inherited Members

Protected Attributes inherited from FFWrapperPtr< AVBufferRef >
AVBufferRef * m_raw
 The wrapped pointer; owned by the derived class, not by this template.

Constructor & Destructor Documentation

◆ BufferRefView() [1/2]

av::BufferRefView::BufferRefView ( BufferRef & ref)
explicit
Parameters
refthe buffer to view; the view borrows its pointer

◆ BufferRefView() [2/2]

av::BufferRefView::BufferRefView ( const BufferRef & ref)
explicit
Parameters
refthe buffer to view

Member Function Documentation

◆ clone()

BufferRef av::BufferRefView::clone ( int flags = 0) const
noexcept

Data will be copied into new buffer and owning taken.

Parameters
flagsAV_BUFFER_FLAG_*
Returns

◆ constData()

const uint8_t * av::BufferRefView::constData ( ) const
noexcept
Returns

◆ constSpan()

std::span< const uint8_t > av::BufferRefView::constSpan ( ) const
noexcept
Returns

◆ data() [1/2]

const uint8_t * av::BufferRefView::data ( ) const
noexcept
Returns

◆ data() [2/2]

uint8_t * av::BufferRefView::data ( OptionalErrorCode ec = throws())

Note, write access possible only to the buffer when isWritable()==true. If buffer can't be written error code will reported or exception reised.

Parameters
ec
Returns

◆ isWritable()

bool av::BufferRefView::isWritable ( ) const
noexcept

Always false if refCount() == 0 or > 1. Otherwise controls by the AV_BUFFER_FLAG_READONLY.

Returns

◆ makeRef()

AVBufferRef * av::BufferRefView::makeRef ( iam_sure_what_i_do_tag ) const
noexcept

Useful to pass to the low-level API.

Returns
new reference on success (data kept uncopied) or nullptr if control block allocation fails.

◆ ref()

BufferRef av::BufferRefView::ref ( )
Returns

◆ refCount()

int av::BufferRefView::refCount ( ) const
noexcept

For the refCount() > 1 isWritable() always return false.

Returns

◆ size()

std::size_t av::BufferRefView::size ( ) const
noexcept
Returns

◆ span() [1/2]

std::span< const uint8_t > av::BufferRefView::span ( ) const
noexcept
Returns

◆ span() [2/2]

std::span< uint8_t > av::BufferRefView::span ( OptionalErrorCode ec = throws())

Like data(ec) possible only for writable buffers.

Parameters
ec
Returns

The documentation for this class was generated from the following file: