diff options
author | Timo Rothenpieler <timo@rothenpieler.org> | 2020-03-20 16:00:16 +0100 |
---|---|---|
committer | Timo Rothenpieler <timo@rothenpieler.org> | 2020-03-28 17:59:32 +0100 |
commit | 77d5ea1c7cf85d16da330c60351fee3dce3c9e4c (patch) | |
tree | 0169f0d3c91c7262cc9c4892208e530726038bef /libavutil | |
parent | b06ae06e6a5da3a9c6cd48e6f71656b94ea0e2d5 (diff) | |
download | ffmpeg-77d5ea1c7cf85d16da330c60351fee3dce3c9e4c.tar.gz |
avutil/frame: make frame copy functions hwframe aware
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/frame.c | 10 | ||||
-rw-r--r-- | libavutil/version.h | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/libavutil/frame.c b/libavutil/frame.c index e4038096c2..769851ceac 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -25,6 +25,7 @@ #include "imgutils.h" #include "mem.h" #include "samplefmt.h" +#include "hwcontext.h" #if FF_API_FRAME_GET_SET MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp) @@ -626,7 +627,11 @@ int av_frame_make_writable(AVFrame *frame) tmp.channels = frame->channels; tmp.channel_layout = frame->channel_layout; tmp.nb_samples = frame->nb_samples; - ret = av_frame_get_buffer(&tmp, 32); + + if (frame->hw_frames_ctx) + ret = av_hwframe_get_buffer(frame->hw_frames_ctx, &tmp, 0); + else + ret = av_frame_get_buffer(&tmp, 32); if (ret < 0) return ret; @@ -752,6 +757,9 @@ static int frame_copy_video(AVFrame *dst, const AVFrame *src) dst->height < src->height) return AVERROR(EINVAL); + if (src->hw_frames_ctx || dst->hw_frames_ctx) + return av_hwframe_transfer_data(dst, src, 0); + planes = av_pix_fmt_count_planes(dst->format); for (i = 0; i < planes; i++) if (!dst->data[i] || !src->data[i]) diff --git a/libavutil/version.h b/libavutil/version.h index fb66893a65..70836a5d52 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -80,7 +80,7 @@ #define LIBAVUTIL_VERSION_MAJOR 56 #define LIBAVUTIL_VERSION_MINOR 42 -#define LIBAVUTIL_VERSION_MICRO 101 +#define LIBAVUTIL_VERSION_MICRO 102 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ |