History

avutil/frame: make frame copy functions hwframe aware

Timo Rothenpieler committed 6 years ago

Commit 77d5ea11 parent b06ae062 files · +10 −2Browse files

Unified · Split

2 files
  1. libavutil/frame.c +9 −1
  2. libavutil/version.h +1 −1
libavutil/frame.c+9−1
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 #include "imgutils.h"
2626 #include "mem.h"
2727 #include "samplefmt.h"
28+#include "hwcontext.h"
2829
2930 #if FF_API_FRAME_GET_SET
3031 MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp)
@@ -626,7 +627,11 @@ int av_frame_make_writable(AVFrame *frame) · 595 unmodified lines
626627 tmp.channels = frame->channels;
627628 tmp.channel_layout = frame->channel_layout;
628629 tmp.nb_samples = frame->nb_samples;
629− ret = av_frame_get_buffer(&tmp, 32);
630+
631+ if (frame->hw_frames_ctx)
632+ ret = av_hwframe_get_buffer(frame->hw_frames_ctx, &tmp, 0);
633+ else
634+ ret = av_frame_get_buffer(&tmp, 32);
630635 if (ret < 0)
631636 return ret;
632637
@@ -752,6 +757,9 @@ static int frame_copy_video(AVFrame *dst, const AVFrame *src) · 119 unmodified lines
752757 dst->height < src->height)
753758 return AVERROR(EINVAL);
754759
760+ if (src->hw_frames_ctx || dst->hw_frames_ctx)
761+ return av_hwframe_transfer_data(dst, src, 0);
762+
755763 planes = av_pix_fmt_count_planes(dst->format);
756764 for (i = 0; i < planes; i++)
757765 if (!dst->data[i] || !src->data[i])
libavutil/version.h+1−1
@@ -80,7 +80,7 @@ · 79 unmodified lines
8080
8181 #define LIBAVUTIL_VERSION_MAJOR 56
8282 #define LIBAVUTIL_VERSION_MINOR 42
83−#define LIBAVUTIL_VERSION_MICRO 101
83+#define LIBAVUTIL_VERSION_MICRO 102
8484
8585 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
8686 LIBAVUTIL_VERSION_MINOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t