]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gstreamer0-10.git/commitdiff
gst/gstpad.c: Revert last change making try_set_caps() work with non-fixed caps.
authorDavid Schleef <ds@schleef.org>
Mon, 26 Jan 2004 23:25:24 +0000 (23:25 +0000)
committerDavid Schleef <ds@schleef.org>
Mon, 26 Jan 2004 23:25:24 +0000 (23:25 +0000)
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.

ChangeLog
gst/gstpad.c

index e461920d3ec161de4fdb471d4fe76762a1289341..f69837fca22bb2623555d7ea801ec6a06c59baaf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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:
index 6d1a346964379f7c2dd93e5970e2319d5696e794..db6d0d7e47a7f945b28aabf13e3a15cfbe7e530f 100644 (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);