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

Strongly typed enum-like wrapper over an FFmpeg pixel or sample format. More...

#include <ffmpeg.h>

Public Member Functions

constexpr PixSampleFmtWrapper ()=default
 Create a wrapper holding NoneValue.
constexpr PixSampleFmtWrapper (T fmt) noexcept
 Wrap a raw enum value.
 operator T () const noexcept
 Implicit conversion to the FFmpeg enum.
T get () const noexcept
 The stored enum value.
 operator T& () noexcept
 Mutable access to the stored value.
WrapperClass & operator= (T fmt) noexcept
 Assign a raw enum value.
void set (T fmt) noexcept
 Assign a raw enum value.

Protected Attributes

T m_fmt = NoneValue
 The stored enum value.

Friends

std::ostream & operator<< (std::ostream &ost, WrapperClass fmt)
 Print the format name.

Detailed Description

template<typename WrapperClass, typename T, T NoneValue = static_cast<T>(-1)>
struct PixSampleFmtWrapper< WrapperClass, T, NoneValue >

The concrete wrappers (PixelFormat, SampleFormat) add name lookup and comparison; this template supplies the storage and the conversions that let a wrapper be passed wherever FFmpeg expects the raw enum.

Template Parameters
WrapperClassthe derived type, for the assignment operator
Tthe FFmpeg enum type
NoneValuethe value meaning "unset", usually -1

Constructor & Destructor Documentation

◆ PixSampleFmtWrapper()

template<typename WrapperClass, typename T, T NoneValue = static_cast<T>(-1)>
PixSampleFmtWrapper< WrapperClass, T, NoneValue >::PixSampleFmtWrapper ( T fmt)
inlineconstexprnoexcept
Parameters
fmtthe value to store

Member Function Documentation

◆ get()

template<typename WrapperClass, typename T, T NoneValue = static_cast<T>(-1)>
T PixSampleFmtWrapper< WrapperClass, T, NoneValue >::get ( ) const
inlinenoexcept
Returns
the stored value

◆ operator T()

template<typename WrapperClass, typename T, T NoneValue = static_cast<T>(-1)>
PixSampleFmtWrapper< WrapperClass, T, NoneValue >::operator T ( ) const
inlinenoexcept
Returns
the stored value, so the wrapper can be passed to FFmpeg calls

◆ operator T&()

template<typename WrapperClass, typename T, T NoneValue = static_cast<T>(-1)>
PixSampleFmtWrapper< WrapperClass, T, NoneValue >::operator T& ( )
inlinenoexcept

Lets FFmpeg fill the value in place, for example through a pointer parameter.

Returns
a reference to the stored value

◆ operator=()

template<typename WrapperClass, typename T, T NoneValue = static_cast<T>(-1)>
WrapperClass & PixSampleFmtWrapper< WrapperClass, T, NoneValue >::operator= ( T fmt)
inlinenoexcept
Parameters
fmtthe value to store
Returns
this wrapper

◆ set()

template<typename WrapperClass, typename T, T NoneValue = static_cast<T>(-1)>
void PixSampleFmtWrapper< WrapperClass, T, NoneValue >::set ( T fmt)
inlinenoexcept
Parameters
fmtthe value to store

◆ operator<<

template<typename WrapperClass, typename T, T NoneValue = static_cast<T>(-1)>
std::ostream & operator<< ( std::ostream & ost,
WrapperClass fmt )
friend
Parameters
ostthe stream to write to
fmtthe wrapper to print
Returns
the stream, for chaining

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