diff options
author | Max Kellermann <max@musicpd.org> | 2019-03-18 10:29:26 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2019-03-18 10:29:26 +0100 |
commit | 42a05bc9042c2a2179b7717b0a5605018fb35205 (patch) | |
tree | 497ea92363421f35115c1076f19680dd9b95b247 /src | |
parent | 4722175049f5b79dd925b02b0d48777ff02a48a6 (diff) |
lib/ffmpeg/Frame: add more wrapper methods
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/ffmpeg/Frame.hxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/lib/ffmpeg/Frame.hxx b/src/lib/ffmpeg/Frame.hxx index c5fb32f86..986886710 100644 --- a/src/lib/ffmpeg/Frame.hxx +++ b/src/lib/ffmpeg/Frame.hxx @@ -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 |