mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 23:06:49 +00:00
vkvideoutils: add gst_vulkan_video_profile_is_valid()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
This commit is contained in:
parent
f896e2a347
commit
13d78652b7
2 changed files with 47 additions and 1 deletions
|
@ -323,3 +323,45 @@ gst_vulkan_video_profile_from_caps (GstVulkanVideoProfile * profile,
|
|||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vulkan_video_profile_is_valid: (skip)
|
||||
* @profile: the output profile
|
||||
* @codec: VkVideoCodecOperationFlagBitsKHR described by @profile
|
||||
*
|
||||
* Returns: %TRUE if @profile is correct and matches with @codec
|
||||
*
|
||||
* Since: 1.24
|
||||
*/
|
||||
gboolean
|
||||
gst_vulkan_video_profile_is_valid (GstVulkanVideoProfile * profile, guint codec)
|
||||
{
|
||||
#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS
|
||||
int i;
|
||||
VkVideoCodecOperationFlagBitsKHR op = codec;
|
||||
VkStructureType stype = VK_STRUCTURE_TYPE_MAX_ENUM;
|
||||
|
||||
if (op == VK_VIDEO_CODEC_OPERATION_NONE_KHR)
|
||||
return FALSE;
|
||||
|
||||
if (profile->profile.videoCodecOperation != op)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (video_codecs_map); i++) {
|
||||
if (op == video_codecs_map[i].codec) {
|
||||
stype = video_codecs_map[i].stype;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (stype == VK_STRUCTURE_TYPE_MAX_ENUM)
|
||||
return FALSE;
|
||||
|
||||
if (profile->codec.base.sType != stype)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/vulkan/vulkan.h>
|
||||
#include <gst/vulkan/gstvkapi.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
@ -39,6 +39,7 @@ struct _GstVulkanVideoProfile
|
|||
VkVideoProfileInfoKHR profile;
|
||||
VkVideoDecodeUsageInfoKHR usage;
|
||||
union {
|
||||
VkBaseInStructure base;
|
||||
VkVideoDecodeH264ProfileInfoKHR h264;
|
||||
VkVideoDecodeH265ProfileInfoKHR h265;
|
||||
} codec;
|
||||
|
@ -51,5 +52,8 @@ GstCaps * gst_vulkan_video_profile_to_caps (const GstVulkan
|
|||
GST_VULKAN_API
|
||||
gboolean gst_vulkan_video_profile_from_caps (GstVulkanVideoProfile * profile,
|
||||
GstCaps * caps);
|
||||
GST_VULKAN_API
|
||||
gboolean gst_vulkan_video_profile_is_valid (GstVulkanVideoProfile * profile,
|
||||
guint codec);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
Loading…
Reference in a new issue