summaryrefslogtreecommitdiff
path: root/libavutil/hwcontext_qsv.c
diff options
context:
space:
mode:
authornyanmisaka <nst799610810@gmail.com>2022-01-11 14:55:38 +0800
committerHaihao Xiang <haihao.xiang@intel.com>2022-01-29 12:02:52 +0800
commit4cc7239d8bf812387200dd54c0d1120ff68c2bce (patch)
tree3354d04c8c60632a787663ace64dd2dcf755c413 /libavutil/hwcontext_qsv.c
parenta5b1e632c96727e485419748b4bd2241b5b22fe3 (diff)
downloadffmpeg-4cc7239d8bf812387200dd54c0d1120ff68c2bce.tar.gz
libavutil/hwcontext_opencl: fix a bug for mapping qsv frame to opencl
mfxHDLPair was added to qsv, so modify qsv->opencl map function as well. Now the following commandline works: ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128 \ -init_hw_device qsv=qs@va -init_hw_device opencl=ocl@va -filter_hw_device ocl \ -hwaccel qsv -hwaccel_output_format qsv -hwaccel_device qs -c:v h264_qsv \ -i input.264 -vf "hwmap=derive_device=opencl,format=opencl,avgblur_opencl, \ hwmap=derive_device=qsv:reverse=1:extra_hw_frames=32,format=qsv" \ -c:v h264_qsv output.264 Signed-off-by: nyanmisaka <nst799610810@gmail.com> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Diffstat (limited to 'libavutil/hwcontext_qsv.c')
-rw-r--r--libavutil/hwcontext_qsv.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index 853fb7f60d..6d9b8324c2 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -112,6 +112,40 @@ static const struct {
#endif
};
+extern int ff_qsv_get_surface_base_handle(mfxFrameSurface1 *surf,
+ enum AVHWDeviceType base_dev_type,
+ void **base_handle);
+
+/**
+ * Caller needs to allocate enough space for base_handle pointer.
+ **/
+int ff_qsv_get_surface_base_handle(mfxFrameSurface1 *surf,
+ enum AVHWDeviceType base_dev_type,
+ void **base_handle)
+{
+ mfxHDLPair *handle_pair;
+ handle_pair = surf->Data.MemId;
+ switch (base_dev_type) {
+#if CONFIG_VAAPI
+ case AV_HWDEVICE_TYPE_VAAPI:
+ base_handle[0] = handle_pair->first;
+ return 0;
+#endif
+#if CONFIG_D3D11VA
+ case AV_HWDEVICE_TYPE_D3D11VA:
+ base_handle[0] = handle_pair->first;
+ base_handle[1] = handle_pair->secode;
+ return 0;
+#endif
+#if CONFIG_DXVA2
+ case AV_HWDEVICE_TYPE_DXVA2:
+ base_handle[0] = handle_pair->first;
+ return 0;
+#endif
+ }
+ return AVERROR(EINVAL);
+}
+
static uint32_t qsv_fourcc_from_pix_fmt(enum AVPixelFormat pix_fmt)
{
int i;