avcpp 3.2.1
Wrapper for the FFmpeg that simplify usage from C++ projects.
Loading...
Searching...
No Matches
FFWrapperRef< T > Struct Template Reference

Base for wrappers that hold a small FFmpeg structure by value. More...

#include <ffmpeg.h>

Public Member Functions

 FFWrapperRef ()=default
 Create a value-initialised holder.
 FFWrapperRef (const T &raw)
 Copy a structure into the wrapper.
const T * raw () const
 Read access to the stored structure.
T * raw ()
 Write access to the stored structure.
void reset (const T &raw=T())
 Replace the stored value.
bool isNull () const
 Whether the stored value equals a default-constructed one.
void _log (int level, const char *fmt) const
 Log through the FFmpeg log system, using this wrapper as the context.
template<typename... Args>
void _log (int level, const char *fmt, const Args &... args) const
 Log through the FFmpeg log system with arguments.

Protected Attributes

T m_raw = T()
 The stored value.

Detailed Description

template<typename T>
struct FFWrapperRef< T >

Used for structures FFmpeg expects to be passed by pointer but that have no separate allocation, such as AVPacketSideData. Address stability is part of the contract: raw() returns a pointer into the wrapper, so the wrapper must outlive any FFmpeg call that uses it.

Template Parameters
Tthe FFmpeg type being held

Constructor & Destructor Documentation

◆ FFWrapperRef()

template<typename T>
FFWrapperRef< T >::FFWrapperRef ( const T & raw)
inlineexplicit
Parameters
rawthe value to store

Member Function Documentation

◆ _log() [1/2]

template<typename T>
void FFWrapperRef< T >::_log ( int level,
const char * fmt ) const
inline
Parameters
levelan AV_LOG_* level
fmtprintf-style format string without arguments

◆ _log() [2/2]

template<typename T>
template<typename... Args>
void FFWrapperRef< T >::_log ( int level,
const char * fmt,
const Args &... args ) const
inline
Parameters
levelan AV_LOG_* level
fmtprintf-style format string
argsarguments for the format string

◆ isNull()

template<typename T>
bool FFWrapperRef< T >::isNull ( ) const
inline
Returns
true when every byte matches T()

◆ raw() [1/2]

template<typename T>
T * FFWrapperRef< T >::raw ( )
inline
Returns
a pointer to the value inside the wrapper

◆ raw() [2/2]

template<typename T>
const T * FFWrapperRef< T >::raw ( ) const
inline
Returns
a pointer to the value inside the wrapper

◆ reset()

template<typename T>
void FFWrapperRef< T >::reset ( const T & raw = T())
inline
Parameters
rawthe new value; the default resets to a zero-filled structure

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