mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
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:
parent
c46642523c
commit
de4b0ef7dd
3 changed files with 15 additions and 18 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue