Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavutil/hwcontext.c7
-rw-r--r--libavutil/hwcontext_internal.h5
2 files changed, 12 insertions, 0 deletions
diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index 745016ed7e..f1e404ab20 100644
--- a/libavutil/hwcontext.c
+++ b/libavutil/hwcontext.c
@@ -870,3 +870,10 @@ fail:
av_buffer_unref(&dst_ref);
return ret;
}
+
+int ff_hwframe_map_replace(AVFrame *dst, const AVFrame *src)
+{
+ HWMapDescriptor *hwmap = (HWMapDescriptor*)dst->buf[0]->data;
+ av_frame_unref(hwmap->source);
+ return av_frame_ref(hwmap->source, src);
+}
diff --git a/libavutil/hwcontext_internal.h b/libavutil/hwcontext_internal.h
index 332062ddaa..77dc47ddd6 100644
--- a/libavutil/hwcontext_internal.h
+++ b/libavutil/hwcontext_internal.h
@@ -156,6 +156,11 @@ int ff_hwframe_map_create(AVBufferRef *hwframe_ref,
HWMapDescriptor *hwmap),
void *priv);
+/**
+ * Replace the current hwmap of dst with the one from src, used for indirect
+ * mappings like VAAPI->(DRM)->OpenCL/Vulkan where a direct interop is missing
+ */
+int ff_hwframe_map_replace(AVFrame *dst, const AVFrame *src);
extern const HWContextType ff_hwcontext_type_cuda;
extern const HWContextType ff_hwcontext_type_d3d11va;