From 2e3cfe4546e2e84d99cd02b44c3c30310c75d759 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Thu, 6 May 2010 09:11:17 +0300 Subject: [PATCH] libvisual: trucate own caps, instead of copying and using the first only We got the caps from an intersect, it is our own, hence we can truncate it. --- ext/libvisual/visual.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ext/libvisual/visual.c b/ext/libvisual/visual.c index ff0f9bc..85f7c76 100644 --- a/ext/libvisual/visual.c +++ b/ext/libvisual/visual.c @@ -379,7 +379,7 @@ gst_visual_sink_setcaps (GstPad * pad, GstCaps * caps) static gboolean gst_vis_src_negotiate (GstVisual * visual) { - GstCaps *othercaps, *target, *intersect; + GstCaps *othercaps, *target; GstStructure *structure; GstCaps *caps; @@ -388,15 +388,14 @@ gst_vis_src_negotiate (GstVisual * visual) /* see what the peer can do */ othercaps = gst_pad_peer_get_caps (visual->srcpad); if (othercaps) { - intersect = gst_caps_intersect (othercaps, caps); + target = gst_caps_intersect (othercaps, caps); gst_caps_unref (othercaps); gst_caps_unref (caps); - if (gst_caps_is_empty (intersect)) + if (gst_caps_is_empty (target)) goto no_format; - target = gst_caps_copy_nth (intersect, 0); - gst_caps_unref (intersect); + gst_caps_truncate (target); } else { /* need a copy, we'll be modifying it when fixating */ target = gst_caps_copy (caps); @@ -421,7 +420,7 @@ no_format: { GST_ELEMENT_ERROR (visual, STREAM, FORMAT, (NULL), ("could not negotiate output format")); - gst_caps_unref (intersect); + gst_caps_unref (target); return FALSE; } } -- 2.7.4