Browse Source

hwcontext_internal: add ff_hwframe_map_replace

Used to fix unmapping when no direct interop exists between APIs.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
tags/n4.1
Rostislav Pehlivanov 7 years ago
parent
commit
7062e4dbc8
2 changed files with 12 additions and 0 deletions
  1. +7
    -0
      libavutil/hwcontext.c
  2. +5
    -0
      libavutil/hwcontext_internal.h

+ 7
- 0
libavutil/hwcontext.c View File

@@ -870,3 +870,10 @@ fail:
av_buffer_unref(&dst_ref); av_buffer_unref(&dst_ref);
return ret; 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);
}

+ 5
- 0
libavutil/hwcontext_internal.h View File

@@ -156,6 +156,11 @@ int ff_hwframe_map_create(AVBufferRef *hwframe_ref,
HWMapDescriptor *hwmap), HWMapDescriptor *hwmap),
void *priv); 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_cuda;
extern const HWContextType ff_hwcontext_type_d3d11va; extern const HWContextType ff_hwcontext_type_d3d11va;


Loading…
Cancel
Save