libs: context: add gst_vaapi_context_get_surface_attributes()

This function copies the surface attributes from the context's object
to the caller.
This commit is contained in:
Víctor Manuel Jáquez Leal 2019-08-02 16:56:17 +02:00
parent 738be524b1
commit b1e7f974b2
2 changed files with 38 additions and 0 deletions

View file

@ -639,3 +639,36 @@ gst_vaapi_context_get_surface_formats (GstVaapiContext * context)
return g_array_ref (context->attribs->formats);
return NULL;
}
/**
* gst_vaapi_context_get_surface_attributes:
* @context: a #GstVaapiContext
* @out_attribs: an allocated #GstVaapiConfigSurfaceAttributes
*
* Copy context's surface restrictions to @out_attribs, EXCEPT the
* color formats. Use gst_vaapi_context_get_surface_formats() to get
* them.
*
* Returns: %TRUE if the attributes were extracted and copied; %FALSE,
* otherwise
**/
gboolean
gst_vaapi_context_get_surface_attributes (GstVaapiContext * context,
GstVaapiConfigSurfaceAttributes * out_attribs)
{
g_return_val_if_fail (context, FALSE);
if (!ensure_attributes (context))
return FALSE;
if (out_attribs) {
out_attribs->min_width = context->attribs->min_width;
out_attribs->min_height = context->attribs->min_height;
out_attribs->max_width = context->attribs->max_width;
out_attribs->max_height = context->attribs->max_height;
out_attribs->mem_types = context->attribs->mem_types;
out_attribs->formats = NULL;
}
return TRUE;
}

View file

@ -161,6 +161,11 @@ G_GNUC_INTERNAL
GArray *
gst_vaapi_context_get_surface_formats (GstVaapiContext * context);
G_GNUC_INTERNAL
gboolean
gst_vaapi_context_get_surface_attributes (GstVaapiContext * context,
GstVaapiConfigSurfaceAttributes * out_attribs);
G_END_DECLS
#endif /* GST_VAAPI_CONTEXT_H */