goom,monoscope: truncate 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.
This commit is contained in:
Stefan Kost 2010-05-06 15:42:38 +03:00
parent c46642523c
commit de4b0ef7dd
3 changed files with 15 additions and 18 deletions

View file

@ -262,7 +262,7 @@ gst_goom_src_setcaps (GstPad * pad, GstCaps * caps)
static gboolean
gst_goom_src_negotiate (GstGoom * goom)
{
GstCaps *othercaps, *target, *intersect;
GstCaps *othercaps, *target;
GstStructure *structure;
const GstCaps *templ;
@ -273,14 +273,13 @@ gst_goom_src_negotiate (GstGoom * goom)
/* see what the peer can do */
othercaps = gst_pad_peer_get_caps (goom->srcpad);
if (othercaps) {
intersect = gst_caps_intersect (othercaps, templ);
target = gst_caps_intersect (othercaps, templ);
gst_caps_unref (othercaps);
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 {
target = gst_caps_ref ((GstCaps *) templ);
}
@ -297,7 +296,7 @@ gst_goom_src_negotiate (GstGoom * goom)
no_format:
{
gst_caps_unref (intersect);
gst_caps_unref (target);
return FALSE;
}
}

View file

@ -262,7 +262,7 @@ gst_goom_src_setcaps (GstPad * pad, GstCaps * caps)
static gboolean
gst_goom_src_negotiate (GstGoom * goom)
{
GstCaps *othercaps, *target, *intersect;
GstCaps *othercaps, *target;
GstStructure *structure;
const GstCaps *templ;
@ -273,14 +273,13 @@ gst_goom_src_negotiate (GstGoom * goom)
/* see what the peer can do */
othercaps = gst_pad_peer_get_caps (goom->srcpad);
if (othercaps) {
intersect = gst_caps_intersect (othercaps, templ);
target = gst_caps_intersect (othercaps, templ);
gst_caps_unref (othercaps);
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 {
target = gst_caps_ref ((GstCaps *) templ);
}
@ -297,7 +296,7 @@ gst_goom_src_negotiate (GstGoom * goom)
no_format:
{
gst_caps_unref (intersect);
gst_caps_unref (target);
return FALSE;
}
}

View file

@ -239,7 +239,7 @@ gst_monoscope_src_setcaps (GstPad * pad, GstCaps * caps)
static gboolean
gst_monoscope_src_negotiate (GstMonoscope * monoscope)
{
GstCaps *othercaps, *target, *intersect;
GstCaps *othercaps, *target;
GstStructure *structure;
const GstCaps *templ;
@ -250,14 +250,13 @@ gst_monoscope_src_negotiate (GstMonoscope * monoscope)
/* see what the peer can do */
othercaps = gst_pad_peer_get_caps (monoscope->srcpad);
if (othercaps) {
intersect = gst_caps_intersect (othercaps, templ);
target = gst_caps_intersect (othercaps, templ);
gst_caps_unref (othercaps);
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 {
target = gst_caps_ref ((GstCaps *) templ);
}
@ -274,7 +273,7 @@ gst_monoscope_src_negotiate (GstMonoscope * monoscope)
no_format:
{
gst_caps_unref (intersect);
gst_caps_unref (target);
return FALSE;
}
}