vkformat: add gst_vulkan_format_to_video_format()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
This commit is contained in:
Víctor Manuel Jáquez Leal 2023-04-05 10:53:31 +02:00 committed by GStreamer Marge Bot
parent ce7256e0d3
commit d84926b60f
2 changed files with 26 additions and 0 deletions

View file

@ -656,3 +656,26 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
return FALSE;
}
/**
* gst_vulkan_format_to_video_format:
* @vk_format: the Vulkan format to convert
*
* Returns: the #GstVideoFormat that maps to @vk_format
*
* Since: 1.24
*/
GstVideoFormat
gst_vulkan_format_to_video_format (VkFormat vk_format)
{
int i;
for (i = 0; i < G_N_ELEMENTS (vk_formats_map); i++) {
if (vk_formats_map[i].vkfrmt != vk_format)
continue;
return vk_formats_map[i].format;
}
return GST_VIDEO_FORMAT_UNKNOWN;
}

View file

@ -149,6 +149,9 @@ gboolean gst_vulkan_format_from_video_info_2 (
int * n_imgs,
VkImageUsageFlags * usage);
GST_VULKAN_API
GstVideoFormat gst_vulkan_format_to_video_format (VkFormat vk_format);
G_END_DECLS
#endif /* __GST_VULKAN_FORMAT_H__ */