d3d11: Add a helper method for GstContext creation

Add gst_d3d11_context_new() method for application to create
GstContext using GstD3D11Device.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2646>
This commit is contained in:
Seungha Yang 2022-06-24 22:17:28 +09:00 committed by GStreamer Marge Bot
parent 06b7b240af
commit eee0f97c18
2 changed files with 27 additions and 0 deletions

View file

@ -491,6 +491,30 @@ gst_d3d11_ensure_element_data_for_adapter_luid (GstElement * element,
return TRUE;
}
/**
* gst_d3d11_context_new:
* @device: (transfer none): a #GstD3D11Device
*
* Creates a new #GstContext object with @device
*
* Returns: a #GstContext object
*
* Since: 1.22
*/
GstContext *
gst_d3d11_context_new (GstD3D11Device * device)
{
GstContext *context;
g_return_val_if_fail (GST_IS_D3D11_DEVICE (device), nullptr);
context = gst_context_new (GST_D3D11_DEVICE_HANDLE_CONTEXT_TYPE, TRUE);
context_set_d3d11_device (context, device);
return context;
}
/**
* gst_d3d11_luid_to_int64:
* @luid: A pointer to LUID struct

View file

@ -51,6 +51,9 @@ gboolean gst_d3d11_ensure_element_data_for_adapter_luid (GstElement * ele
gint64 adapter_luid,
GstD3D11Device ** device);
GST_D3D11_API
GstContext * gst_d3d11_context_new (GstD3D11Device * device);
GST_D3D11_API
gint64 gst_d3d11_luid_to_int64 (const LUID * luid);