va: Add helper functions to convert GstVideoInfoDmaDrm into va video info

The VA has its internal video format mapping(because different drivers may
have different interpretation for the same format), so we should convert the
info in GstVideoInfoDmaDrm into the according video info based on that mapping.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4821>
This commit is contained in:
He Junyan 2023-02-22 19:00:45 +08:00 committed by GStreamer Marge Bot
parent c72960b427
commit b59b77a02f
2 changed files with 40 additions and 0 deletions

View file

@ -313,6 +313,41 @@ gst_va_create_raw_caps (GstVaDisplay * display, VAProfile profile,
return caps;
}
gboolean
gst_va_video_info_from_caps (GstVideoInfo * info, guint64 * modifier,
GstCaps * caps)
{
GstVideoInfoDmaDrm drm_info;
if (!gst_video_is_dma_drm_caps (caps))
return gst_video_info_from_caps (info, caps);
if (!gst_video_info_dma_drm_from_caps (&drm_info, caps))
return FALSE;
if (!gst_va_video_info_from_dma_info (info, &drm_info))
return FALSE;
if (modifier)
*modifier = drm_info.drm_modifier;
return TRUE;
}
GstCaps *
gst_va_video_info_to_dma_caps (GstVideoInfo * info, guint64 modifier)
{
GstVideoInfoDmaDrm drm_info;
gst_video_info_dma_drm_init (&drm_info);
drm_info.vinfo = *info;
drm_info.drm_fourcc =
gst_va_drm_fourcc_from_video_format (GST_VIDEO_INFO_FORMAT (info));
drm_info.drm_modifier = modifier;
return gst_video_info_dma_drm_to_caps (&drm_info);
}
/* the purpose of this function is to find broken configurations in
* JPEG decoders: if the driver doesn't expose a pixel format for a
* config with a specific sampling, that sampling is not valid */

View file

@ -41,6 +41,11 @@ GstCaps * gst_va_create_coded_caps (GstVaDisplay * displa
VAProfile profile,
VAEntrypoint entrypoint,
guint32 * rt_formats_ptr);
gboolean gst_va_video_info_from_caps (GstVideoInfo * info,
guint64 * modifier,
GstCaps * caps);
GstCaps * gst_va_video_info_to_dma_caps (GstVideoInfo * info,
guint64 modifier);
gboolean gst_caps_set_format_array (GstCaps * caps,
GArray * formats);