vaapipluingutils: add helper to append surface caps to YUV caps.

This commit is contained in:
Gwenole Beauchesne 2012-01-05 11:00:39 +01:00
parent 7f8eaa6cbf
commit 872694fda5
2 changed files with 31 additions and 0 deletions

View file

@ -160,3 +160,31 @@ gst_vaapi_reply_to_query (GstQuery *query, GstVaapiDisplay *display)
return res; 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;
}

View file

@ -28,3 +28,6 @@
gboolean gst_vaapi_ensure_display (gpointer element, GstVaapiDisplay **display); gboolean gst_vaapi_ensure_display (gpointer element, GstVaapiDisplay **display);
void gst_vaapi_set_display (const gchar *type, const GValue *value, 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_reply_to_query (GstQuery *query, GstVaapiDisplay *display);
gboolean
gst_vaapi_append_surface_caps (GstCaps *out_caps, GstCaps *in_caps);