9 #include <libavutil/avutil.h>
10 #include <libavutil/parseutils.h>
11 #include <libavutil/mathematics.h>
12 #include <libavutil/opt.h>
13 #include <libavutil/pixdesc.h>
14 #include <libavutil/bswap.h>
15 #include <libswscale/swscale.h>
16 #include <libswresample/swresample.h>
32 void _log(
int level,
const char *fmt)
const
34 av_log(
m_raw, level, fmt);
37 template<
typename... Args>
38 void _log(
int level,
const char* fmt,
const Args&... args)
const
40 av_log(
m_raw, level, fmt, args...);
47 #define RAW_GET(field, def) (m_raw ? m_raw->field : (def))
48 #define RAW_SET(field, val) if(m_raw) m_raw->field = (val)
50 #define RAW_GET2(cond, field, def) (m_raw && (cond) ? m_raw->field : def)
51 #define RAW_SET2(cond, field, val) if(m_raw && (cond)) m_raw->field = (val)
53 #define IF_GET(ptr, field, def) ((ptr) ? ptr->field : def)
54 #define IF_SET(ptr, field, val) (if(ptr) ptr->field = (val))
56 #define IF_GET2(cond, ptr, field, def) (ptr && (cond) ? ptr->field : def)
57 #define IF_SET2(cond, ptr, field, val) (if(ptr && (cond)) ptr->field = (val))
59 #if !DEPRECATED_INIT_PACKET
71 static const T empty = T();
72 auto res = memcmp(&
m_raw, &empty,
sizeof(empty));
76 void _log(
int level,
const char *fmt)
const
78 av_log(&
m_raw, level, fmt);
81 template<
typename... Args>
82 void _log(
int level,
const char* fmt,
const Args&... args)
const
84 av_log(&
m_raw, level, fmt, args...);
92 template<typename WrapperClass, typename T, T NoneValue = static_cast<T>(-1)>
99 operator T() const noexcept
109 operator T&() noexcept
126 friend std::ostream&
operator<<(std::ostream& ost, WrapperClass fmt)
void reset(T *raw=nullptr)
Definition: ffmpeg.h:29
void _log(int level, const char *fmt, const Args &... args) const
Definition: ffmpeg.h:38
void _log(int level, const char *fmt) const
Definition: ffmpeg.h:32
T * m_raw
Definition: ffmpeg.h:44
T * raw()
Definition: ffmpeg.h:28
const T * raw() const
Definition: ffmpeg.h:27
bool isNull() const
Definition: ffmpeg.h:30
FFWrapperPtr(T *raw)
Definition: ffmpeg.h:24
bool isNull() const
Definition: ffmpeg.h:70
void _log(int level, const char *fmt, const Args &... args) const
Definition: ffmpeg.h:82
T m_raw
Definition: ffmpeg.h:88
void reset(const T &raw=T())
Definition: ffmpeg.h:69
T * raw()
Definition: ffmpeg.h:68
const T * raw() const
Definition: ffmpeg.h:67
void _log(int level, const char *fmt) const
Definition: ffmpeg.h:76
FFWrapperRef(const T &raw)
Definition: ffmpeg.h:64
T m_fmt
Definition: ffmpeg.h:133
T get() const noexcept
Definition: ffmpeg.h:104
friend std::ostream & operator<<(std::ostream &ost, WrapperClass fmt)
Definition: ffmpeg.h:126
WrapperClass & operator=(T fmt) noexcept
Definition: ffmpeg.h:114
constexpr PixSampleFmtWrapper()=default
constexpr PixSampleFmtWrapper(T fmt) noexcept
Definition: ffmpeg.h:96
void set(T fmt) noexcept
Definition: ffmpeg.h:120