msdkallocator_d3d: implement GetHDL callback function
authorTong Wu <tong1.wu@intel.com>
Fri, 26 Aug 2022 06:13:36 +0000 (14:13 +0800)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 11 Nov 2022 06:02:28 +0000 (06:02 +0000)
During encoding process, oneVPL runtime will call GetHDL callback function.
This patch implements this function for the use of msdk.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3231>

subprojects/gst-plugins-bad/sys/msdk/gstmsdkallocator_d3d.c

index 27e4572..791752e 100644 (file)
@@ -60,6 +60,17 @@ gst_msdk_frame_unlock (mfxHDL pthis, mfxMemId mid, mfxFrameData * ptr)
 mfxStatus
 gst_msdk_frame_get_hdl (mfxHDL pthis, mfxMemId mid, mfxHDL * hdl)
 {
+  GstMsdkMemoryID *mem_id;
+  mfxHDLPair *pair;
+
+  if (!hdl || !mid)
+    return MFX_ERR_INVALID_HANDLE;
+
+  mem_id = (GstMsdkMemoryID *) mid;
+  pair = (mfxHDLPair *) hdl;
+  pair->first = (mfxHDL) mem_id->texture;
+  pair->second = (mfxHDL) GUINT_TO_POINTER (mem_id->subresource_index);
+
   return MFX_ERR_NONE;
 }