mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-03 15:06:34 +00:00
vulkan: add device to handle_context_query
This commit is contained in:
parent
bfab93dabe
commit
7871910bc6
3 changed files with 21 additions and 3 deletions
|
@ -208,7 +208,7 @@ gst_vulkan_sink_query (GstBaseSink * bsink, GstQuery * query)
|
|||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_CONTEXT:{
|
||||
res = gst_vulkan_handle_context_query (GST_ELEMENT (vk_sink), query,
|
||||
&vk_sink->display, &vk_sink->instance);
|
||||
&vk_sink->display, &vk_sink->instance, &vk_sink->device);
|
||||
|
||||
if (res)
|
||||
return res;
|
||||
|
|
|
@ -292,7 +292,8 @@ gst_vulkan_handle_set_context (GstElement * element, GstContext * context,
|
|||
|
||||
gboolean
|
||||
gst_vulkan_handle_context_query (GstElement * element, GstQuery * query,
|
||||
GstVulkanDisplay ** display, GstVulkanInstance ** instance)
|
||||
GstVulkanDisplay ** display, GstVulkanInstance ** instance,
|
||||
GstVulkanDevice ** device)
|
||||
{
|
||||
gboolean res = FALSE;
|
||||
const gchar *context_type;
|
||||
|
@ -303,6 +304,7 @@ gst_vulkan_handle_context_query (GstElement * element, GstQuery * query,
|
|||
g_return_val_if_fail (GST_QUERY_TYPE (query) != GST_QUERY_CONTEXT, FALSE);
|
||||
g_return_val_if_fail (display != NULL, FALSE);
|
||||
g_return_val_if_fail (instance != NULL, FALSE);
|
||||
g_return_val_if_fail (device != NULL, FALSE);
|
||||
|
||||
gst_query_parse_context_type (query, &context_type);
|
||||
|
||||
|
@ -332,6 +334,22 @@ gst_vulkan_handle_context_query (GstElement * element, GstQuery * query,
|
|||
gst_query_set_context (query, context);
|
||||
gst_context_unref (context);
|
||||
|
||||
res = *instance != NULL;
|
||||
} else if (g_strcmp0 (context_type, "gst.vulkan.device") == 0) {
|
||||
GstStructure *s;
|
||||
|
||||
gst_query_parse_context (query, &old_context);
|
||||
|
||||
if (old_context)
|
||||
context = gst_context_copy (old_context);
|
||||
else
|
||||
context = gst_context_new ("gst.vulkan.device", TRUE);
|
||||
|
||||
s = gst_context_writable_structure (context);
|
||||
gst_structure_set (s, "device", GST_TYPE_VULKAN_DEVICE, *device, NULL);
|
||||
gst_query_set_context (query, context);
|
||||
gst_context_unref (context);
|
||||
|
||||
res = *instance != NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ gboolean gst_vulkan_ensure_element_data (gpointer element,
|
|||
gboolean gst_vulkan_handle_set_context (GstElement * element, GstContext * context,
|
||||
GstVulkanDisplay ** display, GstVulkanInstance ** instance);
|
||||
gboolean gst_vulkan_handle_context_query (GstElement * element, GstQuery * query,
|
||||
GstVulkanDisplay ** display, GstVulkanInstance ** instance);
|
||||
GstVulkanDisplay ** display, GstVulkanInstance ** instance, GstVulkanDevice ** device);
|
||||
|
||||
gboolean gst_vulkan_run_query (GstElement * element,
|
||||
GstQuery * query, GstPadDirection direction);
|
||||
|
|
Loading…
Reference in a new issue