From 616f130d0513619710e0933647ceb2e1a5f82a13 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Wed, 27 Jan 2010 15:07:47 -0300 Subject: videorate: Improve upstream negotiation Put peer pad caps preferred framerates first, indicating they are videorate's first choices, removing an unnecessary conversion. Fixes #608025 --- gst/videorate/gstvideorate.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/gst/videorate/gstvideorate.c b/gst/videorate/gstvideorate.c index 24457f7c..b3481338 100644 --- a/gst/videorate/gstvideorate.c +++ b/gst/videorate/gstvideorate.c @@ -209,6 +209,8 @@ gst_video_rate_transformcaps (GstPad * in_pad, GstCaps * in_caps, GstCaps *intersect; const GstCaps *in_templ; gint i; + GSList *extra_structures = NULL; + GSList *iter; in_templ = gst_pad_get_pad_template_caps (in_pad); intersect = gst_caps_intersect (in_caps, in_templ); @@ -219,9 +221,22 @@ gst_video_rate_transformcaps (GstPad * in_pad, GstCaps * in_caps, structure = gst_caps_get_structure (intersect, i); - gst_structure_set (structure, - "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); + if (gst_structure_has_field (structure, "framerate")) { + GstStructure *copy_structure; + + copy_structure = gst_structure_copy (structure); + gst_structure_set (copy_structure, + "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); + extra_structures = g_slist_append (extra_structures, copy_structure); + } } + + /* append the extra structures */ + for (iter = extra_structures; iter != NULL; iter = g_slist_next (iter)) { + gst_caps_append_structure (intersect, (GstStructure *) iter->data); + } + g_slist_free (extra_structures); + *out_caps = intersect; return TRUE; -- cgit