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

Base for wrappers that own a pointer to an FFmpeg object. More...

#include <ffmpeg.h>

Inheritance diagram for FFWrapperPtr< T >:

Public Member Functions

 FFWrapperPtr ()=default
 Create an empty wrapper; isNull() is true.
 FFWrapperPtr (T *raw)
 Wrap an existing object.
const T * raw () const
 Read access to the wrapped object.
T * raw ()
 Write access to the wrapped object.
void reset (T *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.
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 = nullptr
 The wrapped pointer; owned by the derived class, not by this template.

Detailed Description

template<typename T>
struct FFWrapperPtr< T >

The template stores the pointer, provides checked access to it and the logging helpers every wrapper exposes. It does not manage the lifetime of the pointed object: derived classes call av_*_free in their destructors.

Template Parameters
Tthe FFmpeg type being wrapped

Constructor & Destructor Documentation

◆ FFWrapperPtr()

template<typename T>
FFWrapperPtr< T >::FFWrapperPtr ( T * raw)
inlineexplicit
Parameters
rawpointer to take; the wrapper does not free it

Member Function Documentation

◆ _log() [1/2]

template<typename T>
void FFWrapperPtr< 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 FFWrapperPtr< 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 FFWrapperPtr< T >::isNull ( ) const
inline
Returns
true when no object is stored

◆ raw() [1/2]

template<typename T>
T * FFWrapperPtr< T >::raw ( )
inline
Returns
the stored pointer, or nullptr when the wrapper is empty

◆ raw() [2/2]

template<typename T>
const T * FFWrapperPtr< T >::raw ( ) const
inline
Returns
the stored pointer, or nullptr when the wrapper is empty

◆ reset()

template<typename T>
void FFWrapperPtr< T >::reset ( T * raw = nullptr)
inline
Parameters
rawthe new pointer; nullptr empties the wrapper
Note
The previous object is not freed: lifetime belongs to the derived class.

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