summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiago.sousa.santos@collabora.co.uk>2010-01-27 15:07:47 -0300
committerThiago Santos <thiago.sousa.santos@collabora.co.uk>2010-02-22 17:03:07 -0300
commit616f130d0513619710e0933647ceb2e1a5f82a13 (patch)
tree90183fdaef696b61bbb7c7bfc34cc95a4d29d401
parentff21fe1d25fea5e94d08e2ff5489e67a7356d3f5 (diff)
videorate: Improve upstream negotiation
Put peer pad caps preferred framerates first, indicating they are videorate's first choices, removing an unnecessary conversion. Fixes #608025
-rw-r--r--gst/videorate/gstvideorate.c19
1 files 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;