36#pragma GCC diagnostic push
37#pragma GCC diagnostic ignored "-Wconversion"
38#pragma GCC diagnostic ignored "-Wsign-conversion"
39#include <libavcodec/avcodec.h>
40#pragma GCC diagnostic pop
49 m_frame(av_frame_alloc()),
51 m_stream_idx(stream_index)
59 m_stream_idx(frame.m_stream_idx)
69 m_res = AVERROR(EINVAL);
80 m_frame = av_frame_clone(frame);
86 m_res = AVERROR(EINVAL);
127FFmpeg_Frame::operator AVFrame*()
132FFmpeg_Frame::operator
const AVFrame*()
const
145 if (
this != &frame && m_frame != frame.m_frame)
147 AVFrame *new_frame = av_frame_clone(frame.m_frame);
153 m_stream_idx = frame.m_stream_idx;
155 m_res = (m_frame !=
nullptr) ? 0 : AVERROR(ENOMEM);
163 if (m_frame != frame)
165 AVFrame *new_frame = av_frame_clone(frame);
173 m_res = (m_frame !=
nullptr) ? 0 : AVERROR(ENOMEM);
FFmpeg_Frame & operator=(const FFmpeg_Frame &frame) noexcept
Make copy from other FFmpeg_Frame object.
virtual ~FFmpeg_Frame()
Destruct FFmpeg_Frame object.
AVFrame * operator->()
operator ->: Do as if we were a pointer to AVFrame
void unref()
Unreference underlying frame.
AVFrame * m_frame
Pointer to underlying AVFrame struct.
AVFrame * clone()
Clone frame to a new AVFrame * struct. Needs to be freed by a av_frame_free() call.
AVFrame * get()
Access the underlying frame.
FFmpeg_Frame(int stream_index=INVALID_STREAM)
Construct FFmpeg_Frame object.
void free()
Free underlying frame.
int m_res
0 if last operation was successful, or negative AVERROR value
int res() const
Get result of last operation.
FFmpeg AVFrame extension.
Various FFmpegfs utility functions.
#define INVALID_STREAM
Denote an invalid stream.