diff --git a/girs/GstVulkan-1.0.gir b/girs/GstVulkan-1.0.gir
index fb287437cf..0dc871f87f 100644
--- a/girs/GstVulkan-1.0.gir
+++ b/girs/GstVulkan-1.0.gir
@@ -4150,6 +4150,23 @@ If a specific version is requested, the @patch level is ignored.
+
+
+
+ a new #GstVulkanDevice
+
+
+
+
+ a #GstVulkanInstance
+
+
+
+ the device index to create the new #GstVulkanDevice from
+
+
+
+
Disable an Vulkan extension by @name. Disabling an extension will only have
an effect before the call to gst_vulkan_instance_open().
@@ -4404,13 +4421,19 @@ version with this function.
-
+
Overrides the #GstVulkanDevice creation mechanism.
It can be called from any thread.
the newly created #GstVulkanDevice.
+
+
+ the index of the device
+
+
+
diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkinstance.c b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkinstance.c
index 0629f8e960..4845bdda63 100644
--- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkinstance.c
+++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkinstance.c
@@ -253,18 +253,20 @@ gst_vulkan_instance_class_init (GstVulkanInstanceClass * klass)
/**
* GstVulkanInstance::create-device:
- * @object: the #GstVulkanDisplay
+ * @device: the #GstVulkanDevice
+ * @device_index: the index of the device
*
* Overrides the #GstVulkanDevice creation mechanism.
* It can be called from any thread.
*
* Returns: (transfer full): the newly created #GstVulkanDevice.
*
- * Since: 1.18
+ * Since: 1.26
*/
gst_vulkan_instance_signals[SIGNAL_CREATE_DEVICE] =
g_signal_new ("create-device", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, GST_TYPE_VULKAN_DEVICE, 0);
+ G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, GST_TYPE_VULKAN_DEVICE, 1,
+ G_TYPE_UINT);
}
static void
@@ -1102,6 +1104,39 @@ gst_vulkan_instance_get_proc_address (GstVulkanInstance * instance,
return ret;
}
+/**
+ * gst_vulkan_instance_create_device_with_index:
+ * @instance: a #GstVulkanInstance
+ * @device_index: the device index to create the new #GstVulkanDevice from
+ * @error: (out) (optional): a #GError
+ *
+ * Returns: (transfer full): a new #GstVulkanDevice
+ *
+ * Since: 1.26
+ */
+GstVulkanDevice *
+gst_vulkan_instance_create_device_with_index (GstVulkanInstance * instance,
+ guint device_index, GError ** error)
+{
+ GstVulkanDevice *device;
+
+ g_return_val_if_fail (GST_IS_VULKAN_INSTANCE (instance), NULL);
+
+ g_signal_emit (instance, gst_vulkan_instance_signals[SIGNAL_CREATE_DEVICE], 0,
+ device_index, &device);
+
+ if (!device) {
+ device = gst_vulkan_device_new_with_index (instance, device_index);
+ }
+
+ if (!gst_vulkan_device_open (device, error)) {
+ gst_object_unref (device);
+ device = NULL;
+ }
+
+ return device;
+}
+
/**
* gst_vulkan_instance_create_device:
* @instance: a #GstVulkanInstance
@@ -1115,23 +1150,7 @@ GstVulkanDevice *
gst_vulkan_instance_create_device (GstVulkanInstance * instance,
GError ** error)
{
- GstVulkanDevice *device;
-
- g_return_val_if_fail (GST_IS_VULKAN_INSTANCE (instance), NULL);
-
- g_signal_emit (instance, gst_vulkan_instance_signals[SIGNAL_CREATE_DEVICE], 0,
- &device);
-
- if (!device) {
- device = gst_vulkan_device_new_with_index (instance, 0);
- }
-
- if (!gst_vulkan_device_open (device, error)) {
- gst_object_unref (device);
- device = NULL;
- }
-
- return device;
+ return gst_vulkan_instance_create_device_with_index (instance, 0, error);
}
/**
diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkinstance.h b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkinstance.h
index 4c3a8f3868..99cd8f2ef9 100644
--- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkinstance.h
+++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkinstance.h
@@ -94,6 +94,10 @@ gpointer gst_vulkan_instance_get_proc_address (GstVulkanInstan
GST_VULKAN_API
GstVulkanDevice * gst_vulkan_instance_create_device (GstVulkanInstance * instance,
GError ** error);
+GST_VULKAN_API
+GstVulkanDevice * gst_vulkan_instance_create_device_with_index(GstVulkanInstance * instance,
+ guint device_index,
+ GError ** error);
GST_VULKAN_API
void gst_context_set_vulkan_instance (GstContext * context,