Debian Codegraph @

gst-libs/gst/vulkan/gstvkvideo-private.c

raw symbols SCIP
1 /*
2 * GStreamer
3 * Copyright (C) 2023 Igalia, S.L.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21 #ifdef HAVE_CONFIG_H
22 #include "config.h"
23 #endif
24
25 #include "gstvkvideo-private.h"
26 #include "gstvkphysicaldevice-private.h"
27 #include "gstvkinstance.h"
28
29 #include <vk_video/vulkan_video_codecs_common.h>
30
31 /* *INDENT-OFF* */
32 const VkExtensionProperties _vk_codec_extensions[] = {
33 [GST_VK_VIDEO_EXTENSION_DECODE_H264] = {
34 .extensionName = VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_EXTENSION_NAME,
35 .specVersion = VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_SPEC_VERSION,
36 },
37 [GST_VK_VIDEO_EXTENSION_DECODE_H265] = {
38 .extensionName = VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_EXTENSION_NAME,
39 .specVersion = VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_SPEC_VERSION,
40 },
41 [GST_VK_VIDEO_EXTENSION_DECODE_VP9] = {
42 .extensionName = VK_STD_VULKAN_VIDEO_CODEC_VP9_DECODE_EXTENSION_NAME,
43 .specVersion = VK_STD_VULKAN_VIDEO_CODEC_VP9_DECODE_SPEC_VERSION,
44 },
45 [GST_VK_VIDEO_EXTENSION_DECODE_AV1] = {
46 .extensionName = VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_EXTENSION_NAME,
47 .specVersion = VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_SPEC_VERSION,
48 },
49 [GST_VK_VIDEO_EXTENSION_ENCODE_H264] = {
50 .extensionName = VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_EXTENSION_NAME,
51 .specVersion = VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_SPEC_VERSION,
52 },
53 [GST_VK_VIDEO_EXTENSION_ENCODE_H265] = {
54 .extensionName = VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_EXTENSION_NAME,
55 .specVersion = VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_SPEC_VERSION,
56 },
57 [GST_VK_VIDEO_EXTENSION_ENCODE_AV1] = {
58 .extensionName = VK_STD_VULKAN_VIDEO_CODEC_AV1_ENCODE_EXTENSION_NAME,
59 .specVersion = VK_STD_VULKAN_VIDEO_CODEC_AV1_ENCODE_SPEC_VERSION,
60 },
61 };
62
63 const VkComponentMapping _vk_identity_component_map = {
64 .r = VK_COMPONENT_SWIZZLE_IDENTITY,
65 .g = VK_COMPONENT_SWIZZLE_IDENTITY,
66 .b = VK_COMPONENT_SWIZZLE_IDENTITY,
67 .a = VK_COMPONENT_SWIZZLE_IDENTITY,
68 };
69 /* *INDENT-ON* */
70
71 gboolean
72 gst_vulkan_video_get_vk_functions (GstVulkanDevice * device,
73 GstVulkanVideoFunctions * vk_funcs,
74 VkVideoCodecOperationFlagBitsKHR codec_op)
75 {
76 gboolean ret = FALSE;
77 GstVulkanInstance *instance;
78
79 g_return_val_if_fail (GST_IS_VULKAN_DEVICE (device), FALSE);
80 g_return_val_if_fail (vk_funcs, FALSE);
81
82 instance = gst_vulkan_device_get_instance (device);
83
84 #define GET_PROC_ADDRESS_REQUIRED(name, type) \
85 G_STMT_START { \
86 const char *fname = "vk" G_STRINGIFY (name) "KHR"; \
87 vk_funcs->G_PASTE (, name) = G_PASTE(G_PASTE(gst_vulkan_, type), _get_proc_address) (type, fname); \
88 if (!vk_funcs->G_PASTE(, name)) { \
89 GST_ERROR_OBJECT (device, "Failed to find required function %s", fname); \
90 goto bail; \
91 } \
92 } G_STMT_END;
93 #define GET_DEVICE_PROC_ADDRESS_REQUIRED(name) GET_PROC_ADDRESS_REQUIRED(name, device)
94 #define GET_INSTANCE_PROC_ADDRESS_REQUIRED(name) GET_PROC_ADDRESS_REQUIRED(name, instance)
95 GST_VULKAN_DEVICE_VIDEO_FN_LIST_COMMON (GET_DEVICE_PROC_ADDRESS_REQUIRED);
96
97 if (GST_VULKAN_VIDEO_CODEC_OPERATION_IS_DECODE (codec_op))
98 GST_VULKAN_DEVICE_VIDEO_FN_LIST_DECODE (GET_DEVICE_PROC_ADDRESS_REQUIRED);
99
100 if (GST_VULKAN_VIDEO_CODEC_OPERATION_IS_ENCODE (codec_op)) {
101 GST_VULKAN_DEVICE_VIDEO_FN_LIST_ENCODE (GET_DEVICE_PROC_ADDRESS_REQUIRED);
102 GST_VULKAN_INSTANCE_VIDEO_FN_LIST_ENCODE
103 (GET_INSTANCE_PROC_ADDRESS_REQUIRED);
104 }
105 #undef GET_DEVICE_PROC_ADDRESS_REQUIRED
106 #undef GET_INSTANCE_PROC_ADDRESS_REQUIRED
107 #undef GET_PROC_ADDRESS_REQUIRED
108 ret = TRUE;
109
110 bail:
111 gst_object_unref (instance);
112 return ret;
113 }
114
115 static void
116 gst_vulkan_handle_free_video_session (GstVulkanHandle * handle, gpointer data)
117 {
118 PFN_vkDestroyVideoSessionKHR vkDestroyVideoSession;
119
120 g_return_if_fail (handle != NULL);
121 g_return_if_fail (handle->handle != VK_NULL_HANDLE);
122 g_return_if_fail (handle->type == GST_VULKAN_HANDLE_TYPE_VIDEO_SESSION);
123 g_return_if_fail (handle->user_data);
124
125 vkDestroyVideoSession = handle->user_data;
126 vkDestroyVideoSession (handle->device->device,
127 (VkVideoSessionKHR) handle->handle, NULL);
128 }
129
130 gboolean
131 gst_vulkan_video_session_create (GstVulkanVideoSession * session,
132 GstVulkanDevice * device, GstVulkanVideoFunctions * vk,
133 VkVideoSessionCreateInfoKHR * session_create, GError ** error)
134 {
135 VkVideoSessionKHR vk_session;
136 VkMemoryRequirements2 *mem_req = NULL;
137 VkVideoSessionMemoryRequirementsKHR *mem = NULL;
138 VkBindVideoSessionMemoryInfoKHR *bind_mem = NULL;
139 VkResult res;
140 guint32 i, n_mems;
141 gboolean ret = FALSE;
142
143 g_return_val_if_fail (session && !session->session, FALSE);
144 g_return_val_if_fail (GST_IS_VULKAN_DEVICE (device), FALSE);
145 g_return_val_if_fail (vk, FALSE);
146 g_return_val_if_fail (session_create, FALSE);
147
148 if (gst_vulkan_physical_device_has_feature_video_maintenance1
149 (device->physical_device)) {
150 session_create->flags |= VK_VIDEO_SESSION_CREATE_INLINE_QUERIES_BIT_KHR;
151 }
152
153 res = vk->CreateVideoSession (device->device, session_create, NULL,
154 &vk_session);
155 if (gst_vulkan_error_to_g_error (res, error, "vkCreateVideoSessionKHR")
156 != VK_SUCCESS)
157 return FALSE;
158
159 session->session = gst_vulkan_handle_new_wrapped (device,
160 GST_VULKAN_HANDLE_TYPE_VIDEO_SESSION, (GstVulkanHandleTypedef) vk_session,
161 gst_vulkan_handle_free_video_session, vk->DestroyVideoSession);
162
163 res = vk->GetVideoSessionMemoryRequirements (device->device, vk_session,
164 &n_mems, NULL);
165 if (gst_vulkan_error_to_g_error (res, error,
166 "vkGetVideoSessionMemoryRequirementsKHR") != VK_SUCCESS)
167 goto beach;
168
169 session->video_mems = g_malloc0 (sizeof (GstMemory *) * n_mems);
170 session->n_mems = n_mems;
171 mem_req = g_new (VkMemoryRequirements2, n_mems);
172 mem = g_new (VkVideoSessionMemoryRequirementsKHR, n_mems);
173 bind_mem = g_new (VkBindVideoSessionMemoryInfoKHR, n_mems);
174
175 for (i = 0; i < n_mems; i++) {
176 /* *INDENT-OFF* */
177 mem_req[i] = (VkMemoryRequirements2) {
178 .sType = VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2,
179 };
180 mem[i] = (VkVideoSessionMemoryRequirementsKHR) {
181 .sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_MEMORY_REQUIREMENTS_KHR,
182 .memoryRequirements = mem_req[i].memoryRequirements,
183 };
184 /* *INDENT-ON* */
185 }
186 res = vk->GetVideoSessionMemoryRequirements (device->device, vk_session,
187 &n_mems, mem);
188 if (gst_vulkan_error_to_g_error (res, error,
189 "vkGetVideoSessionMemoryRequirementsKHR") != VK_SUCCESS)
190 goto beach;
191
192 for (i = 0; i < n_mems; i++) {
193 GstMemory *vk_mem;
194 VkPhysicalDeviceMemoryProperties *props;
195 VkMemoryPropertyFlags prop_flags;
196 guint index;
197
198 if (!gst_vulkan_memory_find_memory_type_index_with_requirements (device,
199 &mem[i].memoryRequirements, G_MAXUINT32, &index)) {
200 g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
201 "Cannot find memory type for video session");
202 goto beach;
203 }
204
205 props = &device->physical_device->memory_properties;
206 prop_flags = props->memoryTypes[index].propertyFlags;
207
208 vk_mem = gst_vulkan_memory_alloc (device, index, NULL,
209 mem[i].memoryRequirements.size, prop_flags);
210 if (!vk_mem) {
211 g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
212 "Cannot allocate memory for video session");
213 goto beach;
214 }
215 session->video_mems[i] = vk_mem;
216
217 /* *INDENT-OFF* */
218 bind_mem[i] = (VkBindVideoSessionMemoryInfoKHR) {
219 .sType = VK_STRUCTURE_TYPE_BIND_VIDEO_SESSION_MEMORY_INFO_KHR,
220 .memory = ((GstVulkanMemory *) vk_mem)->mem_ptr,
221 .memoryBindIndex = mem[i].memoryBindIndex,
222 .memorySize = vk_mem->size,
223 };
224 /* *INDENT-ON* */
225 }
226
227 res =
228 vk->BindVideoSessionMemory (device->device, vk_session, n_mems, bind_mem);
229 if (gst_vulkan_error_to_g_error (res, error, "vkBindVideoSessionMemoryKHR")
230 != VK_SUCCESS)
231 goto beach;
232
233 ret = TRUE;
234
235 beach:
236 g_free (mem_req);
237 g_free (mem);
238 g_free (bind_mem);
239
240 return ret;
241 }
242
243 void
244 gst_vulkan_video_session_destroy (GstVulkanVideoSession * session)
245 {
246 g_return_if_fail (session);
247
248 gst_clear_vulkan_handle (&session->session);
249
250 for (guint i = 0; i < session->n_mems; i++)
251 gst_memory_unref (session->video_mems[i]);
252
253 g_free (session->video_mems);
254 }
255
256 GstBuffer *
257 gst_vulkan_video_codec_buffer_new (GstVulkanDevice * device,
258 const GstVulkanVideoProfile * profile, VkBufferUsageFlags usage, gsize size)
259 {
260 GstMemory *mem;
261 GstBuffer *buf;
262 VkVideoProfileListInfoKHR profile_list = {
263 .sType = VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR,
264 .profileCount = 1,
265 .pProfiles = &profile->profile,
266 };
267 VkBufferCreateInfo buf_info = {
268 .sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
269 .pNext = &profile_list,
270 .usage = usage,
271 .sharingMode = VK_SHARING_MODE_EXCLUSIVE,
272 .size = size,
273 };
274
275 buf_info.size = MAX (buf_info.size, 1024 * 1024);
276
277 mem = gst_vulkan_buffer_memory_alloc_with_buffer_info (device, &buf_info,
278 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
279
280 if (!mem)
281 return NULL;
282
283 buf = gst_buffer_new ();
284 gst_buffer_append_memory (buf, mem);
285 return buf;
286 }
287
288 /**
289 * gst_vulkan_video_image_create_view:
290 * @buf: a #GstBuffer
291 * @layered_dpb: if DPB is layered
292 * @is_out: if @buf is for output or for DPB
293 * @sampler: (optional): sampler #GstVulkanHandle
294 *
295 * Creates a #GstVulkanImageView for @buf for decoding, with the internal Ycbcr
296 * sampler, if available.
297 *
298 * Returns: (transfer full) (nullable): the #GstVulkanImageView.
299 */
300 GstVulkanImageView *
301 gst_vulkan_video_image_create_view (GstBuffer * buf, gboolean layered_dpb,
302 gboolean is_out, GstVulkanHandle * sampler)
303 {
304 VkSamplerYcbcrConversionInfo yuv_sampler_info;
305 VkImageViewCreateInfo view_create_info;
306 GstVulkanImageMemory *vkmem;
307 GstMemory *mem;
308 gpointer pnext;
309 guint n_mems;
310
311 g_return_val_if_fail (GST_IS_BUFFER (buf), NULL);
312
313 n_mems = gst_buffer_n_memory (buf);
314 if (n_mems != 1)
315 return NULL;
316
317 mem = gst_buffer_peek_memory (buf, 0);
318 if (!gst_is_vulkan_image_memory (mem))
319 return NULL;
320
321 pnext = NULL;
322 if (sampler
323 && sampler->type == GST_VULKAN_HANDLE_TYPE_SAMPLER_YCBCR_CONVERSION) {
324 yuv_sampler_info = (VkSamplerYcbcrConversionInfo) {
325 /* *INDENT-OFF* */
326 .sType = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO,
327 .conversion = sampler->handle,
328 /* *INDENT-ON* */
329 };
330
331 pnext = &yuv_sampler_info;
332 }
333
334 vkmem = (GstVulkanImageMemory *) mem;
335
336 /* *INDENT-OFF* */
337 view_create_info = (VkImageViewCreateInfo) {
338 .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
339 .pNext = pnext,
340 .viewType = layered_dpb && !is_out ?
341 VK_IMAGE_VIEW_TYPE_2D_ARRAY: VK_IMAGE_VIEW_TYPE_2D,
342 .format = vkmem->create_info.format,
343 .image = vkmem->image,
344 .components = _vk_identity_component_map,
345 .subresourceRange = (VkImageSubresourceRange) {
346 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
347 .baseArrayLayer = 0,
348 .layerCount = layered_dpb && !is_out ?
349 VK_REMAINING_ARRAY_LAYERS : 1,
350 .levelCount = 1,
351 },
352 };
353 /* *INDENT-ON* */
354
355 return gst_vulkan_get_or_create_image_view_with_info (vkmem,
356 &view_create_info);
357 }
358
359 /**
360 * gst_vulkan_video_try_configuration:
361 * @device: a #GstVulkanPhysicalDevice
362 * @profile: the #GstVulkanVideoProfile to configure
363 * @out_vkcaps: (out caller-allocates): the capabilities given @profile
364 * @out_caps: (out) (optional) (transfer full): the codec #GstCaps given
365 * @profile
366 * @out_formats: (out) (optional) (transfer full): a #GArray with all possible
367 * raw video formats
368 * @error: (out) (optional) (transfer full): the resulting error
369 *
370 * This function will try @profile, as a configuration in @device, by getting
371 * its Vulkan capabilities and the output formats that @profile can produce by
372 * the driver.
373 *
374 * If the capabilities are fetched correctly, then @out_caps is generated. If
375 * the output formats are fetched correctly, then @out_formats is generated.
376 *
377 * Return: whether @profile configuration is possible in @device
378 */
379 gboolean
380 gst_vulkan_video_try_configuration (GstVulkanPhysicalDevice * device,
381 GstVulkanVideoProfile * profile, GstVulkanVideoCapabilities * out_vkcaps,
382 GstCaps ** out_caps, GArray ** out_formats, GError ** error)
383 {
384 VkVideoCodecOperationFlagBitsKHR codec_op;
385 VkImageUsageFlags image_usage;
386 GstVulkanVideoCapabilities vkcaps = {
387 .caps = {.sType = VK_STRUCTURE_TYPE_VIDEO_CAPABILITIES_KHR,},
388 };
389 GArray *fmts;
390 gboolean decode, encode;
391
392 g_return_val_if_fail (GST_IS_VULKAN_PHYSICAL_DEVICE (device), FALSE);
393 g_return_val_if_fail (profile && profile->profile.videoCodecOperation, FALSE);
394
395 codec_op = profile->profile.videoCodecOperation;
396
397 /* VkVideoCodecOperationFlagBitsKHR distinguish decoding and encoding
398 * operations by the bit position with the following masks */
399 decode = GST_VULKAN_VIDEO_CODEC_OPERATION_IS_DECODE (codec_op);
400 encode = GST_VULKAN_VIDEO_CODEC_OPERATION_IS_ENCODE (codec_op);
401 g_assert (decode ^ encode);
402
403 /* fill vkcaps & output format usage */
404 if (decode) {
405 gboolean dedicated_dpb;
406
407 vkcaps.caps.pNext = &vkcaps.decoder;
408 /* *INDENT-OFF* */
409 vkcaps.decoder.caps = (VkVideoDecodeCapabilitiesKHR) {
410 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_CAPABILITIES_KHR,
411 .pNext = &vkcaps.decoder.codec,
412 };
413 /* *INDENT-ON* */
414
415 dedicated_dpb = ((vkcaps.decoder.caps.flags &
416 VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR) == 0);
417
418 image_usage = VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR
419 | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT;
420 if (!dedicated_dpb)
421 image_usage |= VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR;
422 } else if (encode) {
423 vkcaps.caps.pNext = &vkcaps.encoder;
424 /* *INDENT-OFF* */
425 vkcaps.encoder.caps = (VkVideoEncodeCapabilitiesKHR) {
426 .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_CAPABILITIES_KHR,
427 .pNext = &vkcaps.encoder.codec,
428 };
429 /* *INDENT-ON* */
430
431 image_usage = VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR
432 | VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR;
433 } else {
434 g_assert_not_reached ();
435 }
436
437 switch (codec_op) {
438 case VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR:
439 /* *INDENT-OFF* */
440 vkcaps.decoder.codec.h264 = (VkVideoDecodeH264CapabilitiesKHR) {
441 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_CAPABILITIES_KHR,
442 };
443 /* *INDENT-ON* */
444 break;
445 case VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR:
446 /* *INDENT-OFF* */
447 vkcaps.decoder.codec.h265 = (VkVideoDecodeH265CapabilitiesKHR) {
448 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_CAPABILITIES_KHR,
449 };
450 /* *INDENT-ON* */
451 break;
452 case VK_VIDEO_CODEC_OPERATION_DECODE_VP9_BIT_KHR:
453 /* *INDENT-OFF* */
454 vkcaps.decoder.codec.vp9 = (VkVideoDecodeVP9CapabilitiesKHR) {
455 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_VP9_CAPABILITIES_KHR,
456 };
457 /* *INDENT-ON* */
458 break;
459 case VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR:
460 /* *INDENT-OFF* */
461 vkcaps.encoder.codec.h264 = (VkVideoEncodeH264CapabilitiesKHR) {
462 .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_CAPABILITIES_KHR,
463 };
464 /* *INDENT-ON* */
465 break;
466 case VK_VIDEO_CODEC_OPERATION_DECODE_AV1_BIT_KHR:
467 /* *INDENT-OFF* */
468 vkcaps.decoder.codec.av1 = (VkVideoDecodeAV1CapabilitiesKHR) {
469 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_CAPABILITIES_KHR,
470 };
471 /* *INDENT-ON* */
472 break;
473 case VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR:
474 /* *INDENT-OFF* */
475 vkcaps.encoder.codec.h265 = (VkVideoEncodeH265CapabilitiesKHR) {
476 .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_CAPABILITIES_KHR,
477 };
478 /* *INDENT-ON* */
479 break;
480 case VK_VIDEO_CODEC_OPERATION_ENCODE_AV1_BIT_KHR:
481 /* *INDENT-OFF* */
482 vkcaps.encoder.codec.av1 = (VkVideoEncodeAV1CapabilitiesKHR) {
483 .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_AV1_CAPABILITIES_KHR,
484 };
485 /* *INDENT-ON* */
486 break;
487 default:
488 g_assert_not_reached ();
489 }
490
491 if (!gst_vulkan_physical_device_get_video_capabilities (device,
492 &profile->profile, &vkcaps.caps, error))
493 return FALSE;
494
495 fmts =
496 gst_vulkan_physical_device_get_video_formats (device, image_usage,
497 &profile->profile, error);
498 if (!fmts || (error && *error)) {
499 g_clear_pointer (&fmts, g_array_unref);
500 return FALSE;
501 }
502
503 if (out_vkcaps) {
504 *out_vkcaps = vkcaps;
505 out_vkcaps->caps.pNext = NULL;
506 }
507
508 if (out_formats)
509 *out_formats = fmts;
510 else
511 g_array_unref (fmts);
512
513 if (out_caps)
514 *out_caps = gst_vulkan_video_profile_to_caps (profile);
515
516 return TRUE;
517 }