summaryrefslogtreecommitdiff
path: root/libavcodec/qsvdec.c
diff options
context:
space:
mode:
authorHaihao Xiang <haihao.xiang@intel.com>2021-01-04 10:46:14 +0800
committerHaihao Xiang <haihao.xiang@intel.com>2022-08-12 10:43:39 +0800
commit6900feef0683a9fbad3f1106e0dbd5de243d71e0 (patch)
treee2d5125e502d661fb294b3906747a1a727fcebce /libavcodec/qsvdec.c
parent05bd88dca2d788b40023786ee48c30e0c43c99f2 (diff)
downloadffmpeg-6900feef0683a9fbad3f1106e0dbd5de243d71e0.tar.gz
lavc/qsv: create mfx session using oneVPL for decoding/encoding
If qsv hwdevice is available, use the mfxLoader handle in qsv hwdevice to create mfx session. Otherwise create mfx session with a new mfxLoader handle. This is in preparation for oneVPL support
Diffstat (limited to 'libavcodec/qsvdec.c')
-rw-r--r--libavcodec/qsvdec.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 8b718a08ff..89ec5dcee8 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -50,6 +50,12 @@
#include "qsv.h"
#include "qsv_internal.h"
+#if QSV_ONEVPL
+#include <mfxdispatcher.h>
+#else
+#define MFXUnload(a) do { } while(0)
+#endif
+
static const AVRational mfx_tb = { 1, 90000 };
#define PTS_TO_MFX_PTS(pts, pts_tb) ((pts) == AV_NOPTS_VALUE ? \
@@ -231,6 +237,11 @@ static int qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession ses
q->internal_qs.session = NULL;
}
+ if (q->internal_qs.loader) {
+ MFXUnload(q->internal_qs.loader);
+ q->internal_qs.loader = NULL;
+ }
+
return AVERROR_EXTERNAL;
}