mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 11:10:37 +00:00
msdk: Add a help func to fix the map
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5208>
This commit is contained in:
parent
8081a665f8
commit
5536f742e9
1 changed files with 34 additions and 0 deletions
|
@ -224,6 +224,38 @@ _get_media_type (guint codec)
|
|||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
/* For RGB cases, the byte orders are different between vaImageFormat (LSB) and
|
||||
* GStreamer video format (MSB). This function corrects the mapping between
|
||||
* different order manners.
|
||||
*/
|
||||
static void
|
||||
_fix_map (GstMsdkContext * context)
|
||||
{
|
||||
GstVaDisplay *display = NULL;
|
||||
VAImageFormat *va_formats;
|
||||
VADisplay dpy;
|
||||
VAStatus status;
|
||||
int max, num = 0;
|
||||
|
||||
display = (GstVaDisplay *) gst_msdk_context_get_va_display (context);
|
||||
dpy = gst_va_display_get_va_dpy (display);
|
||||
gst_object_unref (display);
|
||||
|
||||
max = vaMaxNumImageFormats (dpy);
|
||||
if (max == 0)
|
||||
return;
|
||||
|
||||
va_formats = g_new (VAImageFormat, max);
|
||||
status = vaQueryImageFormats (dpy, va_formats, &num);
|
||||
gst_va_video_format_fix_map (va_formats, num);
|
||||
|
||||
if (status != VA_STATUS_SUCCESS)
|
||||
GST_WARNING ("vaQueryImageFormats: %s", vaErrorStr (status));
|
||||
|
||||
g_free (va_formats);
|
||||
return;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_dma_fmt_to_dma_drm_fmts (GstMsdkContext * context,
|
||||
GstMsdkContextJobType job_type,
|
||||
|
@ -245,6 +277,8 @@ _dma_fmt_to_dma_drm_fmts (GstMsdkContext * context,
|
|||
|
||||
g_return_val_if_fail (fmt != GST_VIDEO_FORMAT_UNKNOWN, FALSE);
|
||||
|
||||
_fix_map (context);
|
||||
|
||||
drm_fourcc = gst_va_drm_fourcc_from_video_format (fmt);
|
||||
if (drm_fourcc == DRM_FORMAT_INVALID)
|
||||
return FALSE;
|
||||
|
|
Loading…
Reference in a new issue