mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-13 12:51:16 +00:00
vkformat: add gst_vulkan_format_get_map function
This will be used later to compare the format selected by gst_vulkan_format_from_video_info_2(), to verify if it's multiple memory buffer or not. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6798>
This commit is contained in:
parent
17f3a22130
commit
0f8f2d0057
3 changed files with 71 additions and 5 deletions
|
@ -2531,6 +2531,23 @@ the error</doc>
|
|||
<type name="Vulkan.ImageAspectFlags" c:type="VkImageAspectFlags"/>
|
||||
</field>
|
||||
</record>
|
||||
<record name="VulkanFormatMap" c:type="GstVulkanFormatMap" version="1.26">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkformat.h"/>
|
||||
<field name="format" writable="1">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkformat.h">the GStreamer video format</doc>
|
||||
<type name="GstVideo.VideoFormat" c:type="GstVideoFormat"/>
|
||||
</field>
|
||||
<field name="vkfrmt" writable="1">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkformat.h">the Vulkan format with a single memory</doc>
|
||||
<type name="Vulkan.Format" c:type="VkFormat"/>
|
||||
</field>
|
||||
<field name="vkfrmts" writable="1">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkformat.h">Vulkan formats for multiple memories</doc>
|
||||
<array zero-terminated="0" fixed-size="4">
|
||||
<type name="Vulkan.Format" c:type="VkFormat"/>
|
||||
</array>
|
||||
</field>
|
||||
</record>
|
||||
<enumeration name="VulkanFormatScaling" version="1.18" glib:type-name="GstVulkanFormatScaling" glib:get-type="gst_vulkan_format_scaling_get_type" c:type="GstVulkanFormatScaling">
|
||||
<member name="unorm" value="1" c:identifier="GST_VULKAN_FORMAT_SCALING_UNORM" glib:nick="unorm">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkformat.h">[0, 2^n - 1] -> [0.0, 1.0]</doc>
|
||||
|
@ -7140,6 +7157,19 @@ properties.</doc>
|
|||
</parameter>
|
||||
</parameters>
|
||||
</function>
|
||||
<function name="vulkan_format_get_map" c:identifier="gst_vulkan_format_get_map" version="1.26" introspectable="0">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkformat.h"/>
|
||||
<return-value transfer-ownership="none" nullable="1">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkformat.c">the #GstVulkanFormatMap matching with @format</doc>
|
||||
<type name="VulkanFormatMap" c:type="const GstVulkanFormatMap*"/>
|
||||
</return-value>
|
||||
<parameters>
|
||||
<parameter name="format" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkformat.c">the #GstVideoFormat to get</doc>
|
||||
<type name="GstVideo.VideoFormat" c:type="GstVideoFormat"/>
|
||||
</parameter>
|
||||
</parameters>
|
||||
</function>
|
||||
<function name="vulkan_format_to_video_format" c:identifier="gst_vulkan_format_to_video_format" version="1.24">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkformat.h"/>
|
||||
<return-value transfer-ownership="none">
|
||||
|
|
|
@ -431,11 +431,7 @@ gst_vulkan_format_get_aspect (VkFormat format)
|
|||
}
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
const static struct {
|
||||
GstVideoFormat format;
|
||||
VkFormat vkfrmt;
|
||||
VkFormat vkfrmts[GST_VIDEO_MAX_PLANES];
|
||||
} vk_formats_map[] = {
|
||||
const static GstVulkanFormatMap vk_formats_map[] = {
|
||||
/* RGB unsigned normalized format sRGB nonlinear encoding */
|
||||
{ GST_VIDEO_FORMAT_RGBA, VK_FORMAT_R8G8B8A8_UNORM, { VK_FORMAT_R8G8B8A8_SRGB, } },
|
||||
{ GST_VIDEO_FORMAT_RGBx, VK_FORMAT_R8G8B8A8_UNORM, { VK_FORMAT_R8G8B8A8_SRGB, } },
|
||||
|
@ -467,6 +463,28 @@ const static struct {
|
|||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/**
|
||||
* gst_vulkan_format_get_map: (skip)
|
||||
* @format: the #GstVideoFormat to get
|
||||
*
|
||||
* Returns: (nullable): the #GstVulkanFormatMap matching with @format
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
const GstVulkanFormatMap *
|
||||
gst_vulkan_format_get_map (GstVideoFormat format)
|
||||
{
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (vk_formats_map); i++) {
|
||||
if (vk_formats_map[i].format != format)
|
||||
continue;
|
||||
return &vk_formats_map[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vulkan_format_from_video_info: (skip)
|
||||
* @v_info: the #GstVideoInfo
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GstVulkanFormatInfo GstVulkanFormatInfo;
|
||||
typedef struct _GstVulkanFormatMap GstVulkanFormatMap;
|
||||
|
||||
/**
|
||||
* GST_VULKAN_MAX_COMPONENTS:
|
||||
|
@ -130,9 +131,26 @@ struct _GstVulkanFormatInfo
|
|||
VkImageAspectFlags aspect;
|
||||
};
|
||||
|
||||
/**
|
||||
* GstVulkanFormatMap:
|
||||
* @format: the GStreamer video format
|
||||
* @vkfrmt: the Vulkan format with a single memory
|
||||
* @vkfrmts: Vulkan formats for multiple memories
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
struct _GstVulkanFormatMap {
|
||||
GstVideoFormat format;
|
||||
VkFormat vkfrmt;
|
||||
VkFormat vkfrmts[GST_VIDEO_MAX_PLANES];
|
||||
};
|
||||
|
||||
GST_VULKAN_API
|
||||
const GstVulkanFormatInfo * gst_vulkan_format_get_info (VkFormat format);
|
||||
|
||||
GST_VULKAN_API
|
||||
const GstVulkanFormatMap * gst_vulkan_format_get_map (GstVideoFormat format);
|
||||
|
||||
GST_VULKAN_API
|
||||
guint gst_vulkan_format_get_aspect (VkFormat format);
|
||||
|
||||
|
|
Loading…
Reference in a new issue