Commit 42a05bc9 authored by Max Kellermann's avatar Max Kellermann

lib/ffmpeg/Frame: add more wrapper methods

parent 47221750
......@@ -20,6 +20,8 @@
#ifndef MPD_FFMPEG_FRAME_HXX
#define MPD_FFMPEG_FRAME_HXX
#include "Error.hxx"
extern "C" {
#include <libavutil/frame.h>
}
......@@ -47,6 +49,30 @@ public:
AVFrame &operator*() noexcept {
return *frame;
}
AVFrame *operator->() noexcept {
return frame;
}
AVFrame *get() noexcept {
return frame;
}
void GetBuffer() {
int err = av_frame_get_buffer(frame, 0);
if (err < 0)
throw MakeFfmpegError(err, "av_frame_get_buffer() failed");
}
void MakeWritable() {
int err = av_frame_make_writable(frame);
if (err < 0)
throw MakeFfmpegError(err, "av_frame_make_writable() failed");
}
void *GetData(unsigned plane) noexcept {
return frame->data[plane];
}
};
} // namespace Ffmpeg
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment