diff options
author | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2012-01-05 11:00:39 +0100 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2012-01-05 11:04:29 +0100 |
commit | 872694fda58a725890fc8ff9f0a3f5bf9aabc88d (patch) | |
tree | 58e010b543d02525536bd89580cf1aa291566d09 | |
parent | 7f8eaa6cbfec856c2364835b9fa3c669aebd7a9d (diff) |
vaapipluingutils: add helper to append surface caps to YUV caps.
-rw-r--r-- | gst/vaapi/gstvaapipluginutil.c | 28 | ||||
-rw-r--r-- | gst/vaapi/gstvaapipluginutil.h | 3 |
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); |