summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gst/vaapi/gstvaapipluginutil.c28
-rw-r--r--gst/vaapi/gstvaapipluginutil.h3
2 files changed, 31 insertions, 0 deletions
diff --git a/gst/vaapi/gstvaapipluginutil.c b/gst/vaapi/gstvaapipluginutil.c
index a95fb8c6..84e89d59 100644
--- a/gst/vaapi/gstvaapipluginutil.c
+++ b/gst/vaapi/gstvaapipluginutil.c
@@ -160,3 +160,31 @@ gst_vaapi_reply_to_query (GstQuery *query, GstVaapiDisplay *display)
return res;
}
+
+gboolean
+gst_vaapi_append_surface_caps (GstCaps *out_caps, GstCaps *in_caps)
+{
+ GstStructure *structure;
+ const GValue *v_width, *v_height, *v_framerate, *v_par;
+ guint i, n_structures;
+
+ structure = gst_caps_get_structure (in_caps, 0);
+ v_width = gst_structure_get_value (structure, "width");
+ v_height = gst_structure_get_value (structure, "height");
+ v_framerate = gst_structure_get_value (structure, "framerate");
+ v_par = gst_structure_get_value (structure, "pixel-aspect-ratio");
+ if (!v_width || !v_height)
+ return FALSE;
+
+ n_structures = gst_caps_get_size (out_caps);
+ for (i = 0; i < n_structures; i++) {
+ structure = gst_caps_get_structure (out_caps, i);
+ gst_structure_set_value (structure, "width", v_width);
+ gst_structure_set_value (structure, "height", v_height);
+ if (v_framerate)
+ gst_structure_set_value (structure, "framerate", v_framerate);
+ if (v_par)
+ gst_structure_set_value (structure, "pixel-aspect-ratio", v_par);
+ }
+ return TRUE;
+}
diff --git a/gst/vaapi/gstvaapipluginutil.h b/gst/vaapi/gstvaapipluginutil.h
index 3d31938a..704ed370 100644
--- a/gst/vaapi/gstvaapipluginutil.h
+++ b/gst/vaapi/gstvaapipluginutil.h
@@ -28,3 +28,6 @@
gboolean gst_vaapi_ensure_display (gpointer element, GstVaapiDisplay **display);
void gst_vaapi_set_display (const gchar *type, const GValue *value, GstVaapiDisplay **display);
gboolean gst_vaapi_reply_to_query (GstQuery *query, GstVaapiDisplay *display);
+
+gboolean
+gst_vaapi_append_surface_caps (GstCaps *out_caps, GstCaps *in_caps);