gst/gstpad.c: Revert last change making try_set_caps() work with non-fixed caps.

Original commit message from CVS:
* gst/gstpad.c: (gst_pad_try_set_caps): Revert last change
making try_set_caps() work with non-fixed caps.
This commit is contained in:
David Schleef 2004-01-26 23:25:24 +00:00
parent aeca198dda
commit e02c8aae61
2 changed files with 21 additions and 9 deletions

View file

@ -1,3 +1,8 @@
2004-01-26 David Schleef <ds@schleef.org>
* gst/gstpad.c: (gst_pad_try_set_caps): Revert last change
making try_set_caps() work with non-fixed caps.
2004-01-26 Ronald Bultje <rbultje@ronald.bitfreak.net>
* docs/pwg/advanced_types.xml:

View file

@ -1322,21 +1322,28 @@ gst_pad_try_set_caps (GstPad *pad, const GstCaps *caps)
g_return_val_if_fail (GST_IS_REAL_PAD (pad), GST_PAD_LINK_REFUSED);
g_return_val_if_fail (!GST_FLAG_IS_SET (pad, GST_PAD_NEGOTIATING),
GST_PAD_LINK_REFUSED);
/* setting non-fixed caps on a pad is not allowed */
if (!gst_caps_is_fixed (caps)) {
GST_CAT_INFO (GST_CAT_CAPS,
"trying to set unfixed caps on pad %s:%s, not allowed",
GST_DEBUG_PAD_NAME (pad));
g_warning ("trying to set non fixed caps on pad %s:%s, not allowed",
GST_DEBUG_PAD_NAME (pad));
gst_caps_debug (caps, "unfixed caps");
return GST_PAD_LINK_REFUSED;
}
/* we allow setting caps on non-linked pads. It's ignored */
if (!GST_PAD_PEER (pad)) {
return GST_PAD_LINK_OK;
}
/* if the desired caps are already there, it's trivially ok */
if (GST_PAD_CAPS (pad)) {
GstCaps *intersection;
intersection = gst_caps_intersect (caps, GST_PAD_CAPS (pad));
if (!gst_caps_is_empty (intersection)) {
gst_caps_free (intersection);
return GST_PAD_LINK_OK;
}
gst_caps_free (intersection);
if (GST_PAD_CAPS (pad) && gst_caps_is_equal_fixed (caps,
GST_PAD_CAPS (pad))) {
return GST_PAD_LINK_OK;
}
g_return_val_if_fail (GST_PAD_LINK_SRC (pad), GST_PAD_LINK_REFUSED);