mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
surface: try to determine the underlying VA surface format.
If a VA surface was allocated with the chroma-format interface, try to determine the underlying pixel format on gst_vaapi_surface_get_format(), or return GST_VIDEO_FORMAT_ENCODED if this is not a supported operation.
This commit is contained in:
parent
a1b27c920b
commit
8663ad9492
1 changed files with 11 additions and 1 deletions
|
@ -118,7 +118,7 @@ gst_vaapi_surface_create(GstVaapiSurface *surface,
|
||||||
if (!vaapi_check_status(status, "vaCreateSurfaces()"))
|
if (!vaapi_check_status(status, "vaCreateSurfaces()"))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
surface->format = GST_VIDEO_FORMAT_ENCODED;
|
surface->format = GST_VIDEO_FORMAT_UNKNOWN;
|
||||||
surface->chroma_type = chroma_type;
|
surface->chroma_type = chroma_type;
|
||||||
surface->width = width;
|
surface->width = width;
|
||||||
surface->height = height;
|
surface->height = height;
|
||||||
|
@ -318,6 +318,16 @@ gst_vaapi_surface_get_format(GstVaapiSurface *surface)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(surface != NULL, 0);
|
g_return_val_if_fail(surface != NULL, 0);
|
||||||
|
|
||||||
|
/* Try to determine the underlying VA surface format */
|
||||||
|
if (surface->format == GST_VIDEO_FORMAT_UNKNOWN) {
|
||||||
|
GstVaapiImage * const image = gst_vaapi_surface_derive_image(surface);
|
||||||
|
if (image) {
|
||||||
|
surface->format = gst_vaapi_image_get_format(image);
|
||||||
|
gst_vaapi_object_unref(image);
|
||||||
|
}
|
||||||
|
if (surface->format == GST_VIDEO_FORMAT_UNKNOWN)
|
||||||
|
surface->format = GST_VIDEO_FORMAT_ENCODED;
|
||||||
|
}
|
||||||
return GST_VAAPI_SURFACE_FORMAT(surface);
|
return GST_VAAPI_SURFACE_FORMAT(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue