summaryrefslogtreecommitdiff
path: root/ext/vulkan/vkdisplay.c
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2015-12-07 17:33:43 +1100
committerMatthew Waters <matthew@centricular.com>2016-02-17 01:13:43 +1100
commit996200ffc0f89f586b5b25e9d0a609d735617298 (patch)
treeabf47cb4ad3097ae234ec6b53629137990292484 /ext/vulkan/vkdisplay.c
parent75aaf184bbc1ed0b431948e8ef2f0e3cbfa1ad84 (diff)
downloadgstreamer-plugins-bad-996200ffc0f89f586b5b25e9d0a609d735617298.tar.gz
vulkan: implement GstContext helpers
Based off libgstgl's implementation
Diffstat (limited to 'ext/vulkan/vkdisplay.c')
-rw-r--r--ext/vulkan/vkdisplay.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/ext/vulkan/vkdisplay.c b/ext/vulkan/vkdisplay.c
index ad9f1d036..dcf3b55a9 100644
--- a/ext/vulkan/vkdisplay.c
+++ b/ext/vulkan/vkdisplay.c
@@ -34,6 +34,7 @@
#include "xcb/vkdisplay_xcb.h"
#endif
+GST_DEBUG_CATEGORY_STATIC (GST_CAT_CONTEXT);
#define GST_CAT_DEFAULT gst_vulkan_display_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
@@ -45,6 +46,7 @@ _init_debug (void)
if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "vulkandisplay", 0,
"Vulkan display");
+ GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT");
g_once_init_leave (&_init, 1);
}
}
@@ -323,3 +325,60 @@ gst_vulkan_display_remove_window (GstVulkanDisplay * display,
return ret;
}
+
+/**
+ * gst_context_set_vulkan_display:
+ * @context: a #GstContext
+ * @display: a #GstVulkanDisplay
+ *
+ * Sets @display on @context
+ *
+ * Since: 1.10
+ */
+void
+gst_context_set_vulkan_display (GstContext * context,
+ GstVulkanDisplay * display)
+{
+ GstStructure *s;
+
+ g_return_if_fail (context != NULL);
+ g_return_if_fail (gst_context_is_writable (context));
+
+ if (display)
+ GST_CAT_LOG (GST_CAT_CONTEXT,
+ "setting GstVulkanDisplay(%" GST_PTR_FORMAT ") on context(%"
+ GST_PTR_FORMAT ")", display, context);
+
+ s = gst_context_writable_structure (context);
+ gst_structure_set (s, GST_VULKAN_DISPLAY_CONTEXT_TYPE_STR,
+ GST_TYPE_VULKAN_DISPLAY, display, NULL);
+}
+
+/**
+ * gst_context_get_vulkan_display:
+ * @context: a #GstContext
+ * @display: resulting #GstVulkanDisplay
+ *
+ * Returns: Whether @display was in @context
+ *
+ * Since: 1.10
+ */
+gboolean
+gst_context_get_vulkan_display (GstContext * context,
+ GstVulkanDisplay ** display)
+{
+ const GstStructure *s;
+ gboolean ret;
+
+ g_return_val_if_fail (display != NULL, FALSE);
+ g_return_val_if_fail (context != NULL, FALSE);
+
+ s = gst_context_get_structure (context);
+ ret = gst_structure_get (s, GST_VULKAN_DISPLAY_CONTEXT_TYPE_STR,
+ GST_TYPE_VULKAN_DISPLAY, display, NULL);
+
+ GST_CAT_LOG (GST_CAT_CONTEXT, "got GstVulkanDisplay(%" GST_PTR_FORMAT
+ ") from context(%" GST_PTR_FORMAT ")", *display, context);
+
+ return ret;
+}