libs: context: add gst_vaapi_context_get_surface_attributes()
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Fri, 2 Aug 2019 14:56:17 +0000 (16:56 +0200)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Mon, 19 Aug 2019 17:26:55 +0000 (17:26 +0000)
This function copies the surface attributes from the context's object
to the caller.

gst-libs/gst/vaapi/gstvaapicontext.c
gst-libs/gst/vaapi/gstvaapicontext.h

index 4fdbbbe..61573d2 100644 (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;
+}
index 002275a..2dcaaf4 100644 (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 */