gst/gstpad.c: Remove handling of filtered caps. Fix/merge functions that handle...
authorDavid Schleef <ds@schleef.org>
Sun, 24 Apr 2005 21:16:45 +0000 (21:16 +0000)
committerDavid Schleef <ds@schleef.org>
Sun, 24 Apr 2005 21:16:45 +0000 (21:16 +0000)
Original commit message from CVS:
* gst/gstpad.c: Remove handling of filtered caps.  Fix/merge
functions that handle filtered links.
* gst/gstpad.h: Remove 'appfilter' field and prototypes of
removed functions.
* gst/gstutils.c: Fix/remove utility functions that handle
filtered caps.
* gst/gstutils.h:
* gst/gstvalue.c: Add serialization/deserialization of caps
* gst/parse/grammar.y: Ignore filtered caps when linking.  This
requires fixing so that the filter caps notation creates
a capsfilter element and sets the filter_caps property.  I
think everyone probably wants to keep the shorthand notation.
* docs/gst/tmpl/gstelement.sgml: updates for API changes.
* docs/gst/tmpl/gstpad.sgml:
* gst/elements/gstelements.c: Register capsfilter element.
* gst/Makefile.am: fix spacing
* docs/random/ds/0.9-suggested-changes: random

13 files changed:
ChangeLog
docs/gst/tmpl/gstelement.sgml
docs/gst/tmpl/gstpad.sgml
docs/random/ds/0.9-suggested-changes
gst/Makefile.am
gst/elements/gstelements.c
gst/gstpad.c
gst/gstpad.h
gst/gstutils.c
gst/gstutils.h
gst/gstvalue.c
gst/parse/grammar.y
plugins/elements/gstelements.c

index 2f66eb1..40aea94 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2005-04-24  David Schleef  <ds@schleef.org>
+
+       * gst/gstpad.c: Remove handling of filtered caps.  Fix/merge
+       functions that handle filtered links.
+       * gst/gstpad.h: Remove 'appfilter' field and prototypes of
+       removed functions.
+       * gst/gstutils.c: Fix/remove utility functions that handle
+       filtered caps.
+       * gst/gstutils.h:
+       * gst/gstvalue.c: Add serialization/deserialization of caps
+       * gst/parse/grammar.y: Ignore filtered caps when linking.  This
+       requires fixing so that the filter caps notation creates
+       a capsfilter element and sets the filter_caps property.  I
+       think everyone probably wants to keep the shorthand notation.
+       * docs/gst/tmpl/gstelement.sgml: updates for API changes.
+       * docs/gst/tmpl/gstpad.sgml:
+
+       * gst/elements/gstelements.c: Register capsfilter element.
+       * gst/Makefile.am: fix spacing
+       * docs/random/ds/0.9-suggested-changes: random
+
 2005-04-23  David Schleef  <ds@schleef.org>
 
        * gst/elements/Makefile.am:
index 73ec96a..d461b1c 100644 (file)
@@ -502,17 +502,7 @@ Sets the parent of an element.
 
 @element: 
 @pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_element_get_compatible_pad_filtered ##### -->
-<para>
-
-</para>
-
-@element: 
-@pad: 
-@filtercaps: 
+@caps: 
 @Returns: 
 
 
@@ -566,17 +556,6 @@ Sets the parent of an element.
 @Returns: 
 
 
-<!-- ##### FUNCTION gst_element_link_filtered ##### -->
-<para>
-
-</para>
-
-@src: 
-@dest: 
-@filtercaps: 
-@Returns: 
-
-
 <!-- ##### FUNCTION gst_element_unlink ##### -->
 <para>
 
@@ -608,19 +587,6 @@ Sets the parent of an element.
 @Returns: 
 
 
-<!-- ##### FUNCTION gst_element_link_pads_filtered ##### -->
-<para>
-
-</para>
-
-@src: 
-@srcpadname: 
-@dest: 
-@destpadname: 
-@filtercaps: 
-@Returns: 
-
-
 <!-- ##### FUNCTION gst_element_unlink_pads ##### -->
 <para>
 
index 064a6f2..b51ce44 100644 (file)
@@ -662,17 +662,6 @@ Checks if the pad is a sink pad.
 @Returns: 
 
 
-<!-- ##### FUNCTION gst_pad_can_link_filtered ##### -->
-<para>
-
-</para>
-
-@srcpad: 
-@sinkpad: 
-@filtercaps: 
-@Returns: 
-
-
 <!-- ##### FUNCTION gst_pad_set_unlink_function ##### -->
 <para>
 
@@ -692,17 +681,6 @@ Checks if the pad is a sink pad.
 @Returns: 
 
 
-<!-- ##### FUNCTION gst_pad_link_filtered ##### -->
-<para>
-
-</para>
-
-@srcpad: 
-@sinkpad: 
-@filtercaps: 
-@Returns: 
-
-
 <!-- ##### FUNCTION gst_pad_unlink ##### -->
 <para>
 
@@ -776,17 +754,6 @@ Checks if the pad is a sink pad.
 @Returns: 
 
 
-<!-- ##### FUNCTION gst_pad_relink_filtered ##### -->
-<para>
-
-</para>
-
-@srcpad: 
-@sinkpad: 
-@filtercaps: 
-@Returns: 
-
-
 <!-- ##### FUNCTION gst_pad_get_allowed_caps ##### -->
 <para>
 
index 4c50d1e..e433e4c 100644 (file)
@@ -94,6 +94,8 @@ API:
  - remove GST_FORMATS_FUNCTION().  It doesn't work with non-c99 
    compilers.
 
+ - do an audit to remove GtkObject-isms from gtk-1.2
+
 caps:
 
   (Company:)
index 8f75fa2..e8b84d2 100644 (file)
@@ -183,7 +183,7 @@ gst_headers =                       \
        gstsystemclock.h        \
        gsttag.h                \
        gsttaginterface.h       \
-    gsttask.h                  \
+       gsttask.h               \
        gsttrace.h              \
        gsttrashstack.h         \
        gsttypefind.h           \
index 249a944..f093c38 100644 (file)
@@ -51,11 +51,13 @@ struct _elements_entry
 };
 
 
+extern GType gst_capsfilter_get_type (void);
 extern GType gst_filesrc_get_type (void);
 extern GstElementDetails gst_filesrc_details;
 
 static struct _elements_entry _elements[] = {
 //  {"aggregator", GST_RANK_NONE, gst_aggregator_get_type},
+  {"capsfilter", GST_RANK_NONE, gst_capsfilter_get_type},
   {"fakesrc", GST_RANK_NONE, gst_fakesrc_get_type},
   {"fakesink", GST_RANK_NONE, gst_fakesink_get_type},
   {"filesrc", GST_RANK_NONE, gst_filesrc_get_type},
index 8199b6c..96004bd 100644 (file)
@@ -1104,7 +1104,7 @@ gst_pad_set_formats_function (GstPad * pad, GstPadFormatsFunction formats)
  * 
  * Sets the given link function for the pad. It will be called when the pad is
  * linked or relinked with caps. The caps passed to the link function is
- * the filtered caps for the connnection. It can contain a non fixed caps.
+ * the caps for the connnection. It can contain a non fixed caps.
  * 
  * The return value GST_PAD_LINK_OK should be used when the connection can be
  * made.
@@ -1305,10 +1305,6 @@ gst_pad_unlink (GstPad * srcpad, GstPad * sinkpad)
   GST_RPAD_PEER (realsrc) = NULL;
   GST_RPAD_PEER (realsink) = NULL;
 
-  /* clear filter, note that we leave the pad caps as they are */
-  gst_caps_replace (&GST_RPAD_APPFILTER (realsrc), NULL);
-  gst_caps_replace (&GST_RPAD_APPFILTER (realsink), NULL);
-
   GST_UNLOCK (realsink);
   GST_UNLOCK (realsrc);
 
@@ -1385,11 +1381,45 @@ lost_ghostpad:
   }
 }
 
+static gboolean
+gst_pad_link_check_templates_compatible_unlocked (GstRealPad * src,
+    GstRealPad * sink)
+{
+  GstCaps *srccaps;
+  GstCaps *sinkcaps;
+  GstCaps *icaps;
+  gboolean ret;
+
+  if (!GST_PAD_PAD_TEMPLATE (src)) {
+    g_warning ("pad has no pad template");
+    return FALSE;
+  }
+  if (!GST_PAD_PAD_TEMPLATE (sink)) {
+    g_warning ("pad has no pad template");
+    return FALSE;
+  }
+
+  srccaps = GST_PAD_TEMPLATE_CAPS (GST_PAD_PAD_TEMPLATE (src));
+  sinkcaps = GST_PAD_TEMPLATE_CAPS (GST_PAD_PAD_TEMPLATE (sink));
+
+  icaps = gst_caps_intersect (srccaps, sinkcaps);
+
+  if (gst_caps_is_empty (icaps)) {
+    ret = FALSE;
+  } else {
+    ret = TRUE;
+  }
+
+  gst_caps_unref (icaps);
+
+  return ret;
+}
+
+
 /* FIXME leftover from an attempt at refactoring... */
 static GstPadLinkReturn
-gst_pad_link_prepare_filtered (GstPad * srcpad, GstPad * sinkpad,
-    GstRealPad ** outrealsrc, GstRealPad ** outrealsink,
-    const GstCaps * filtercaps)
+gst_pad_link_prepare (GstPad * srcpad, GstPad * sinkpad,
+    GstRealPad ** outrealsrc, GstRealPad ** outrealsink)
 {
   GstRealPad *realsrc, *realsink;
 
@@ -1425,48 +1455,12 @@ gst_pad_link_prepare_filtered (GstPad * srcpad, GstPad * sinkpad,
   *outrealsink = realsink;
 
   /* check pad caps for non-empty intersection */
-  {
-    GstCaps *srccaps;
-    GstCaps *sinkcaps;
-
-    srccaps = gst_real_pad_get_caps_unlocked (realsrc);
-    sinkcaps = gst_real_pad_get_caps_unlocked (realsink);
-    GST_CAT_DEBUG (GST_CAT_CAPS, "got caps %p and %p", srccaps, sinkcaps);
-
-    if (srccaps && sinkcaps) {
-      GstCaps *caps;
-
-      caps = gst_caps_intersect (srccaps, sinkcaps);
-      GST_CAT_DEBUG (GST_CAT_CAPS,
-          "intersection caps %p %" GST_PTR_FORMAT, caps, caps);
-
-      if (filtercaps) {
-        GstCaps *tmp;
-
-        tmp = gst_caps_intersect (caps, filtercaps);
-        gst_caps_unref (caps);
-        caps = tmp;
-      }
-      if (!caps || gst_caps_is_empty (caps))
-        goto no_format;
-    }
+  if (!gst_pad_link_check_templates_compatible_unlocked (realsrc, realsink)) {
+    goto no_format;
   }
 
   /* FIXME check pad scheduling for non-empty intersection */
 
-  /* update filter */
-  if (filtercaps) {
-    GstCaps *filtercopy;
-
-    filtercopy = gst_caps_copy (filtercaps);
-
-    gst_caps_replace (&GST_PAD_APPFILTER (realsrc), filtercopy);
-    gst_caps_replace (&GST_PAD_APPFILTER (realsink), filtercopy);
-    gst_caps_unref (filtercopy);
-  } else {
-    gst_caps_replace (&GST_PAD_APPFILTER (realsrc), NULL);
-    gst_caps_replace (&GST_PAD_APPFILTER (realsink), NULL);
-  }
   return GST_PAD_LINK_OK;
 
 lost_src_ghostpad:
@@ -1521,16 +1515,11 @@ no_format:
 }
 
 /**
- * gst_pad_link_filtered:
+ * gst_pad_link:
  * @srcpad: the source #GstPad to link.
  * @sinkpad: the sink #GstPad to link.
- * @filtercaps: the filter #GstCaps.
- *
- * Links the source pad and the sink pad, constrained
- * by the given filter caps.
  *
- * The filtercaps will be copied and refcounted, so you should unref
- * it yourself after using this function.
+ * Links the source pad and the sink pad.
  *
  * Returns: A result code indicating if the connection worked or
  *          what went wrong.
@@ -1538,14 +1527,12 @@ no_format:
  * MT Safe.
  */
 GstPadLinkReturn
-gst_pad_link_filtered (GstPad * srcpad, GstPad * sinkpad,
-    const GstCaps * filtercaps)
+gst_pad_link (GstPad * srcpad, GstPad * sinkpad)
 {
   GstRealPad *realsrc, *realsink;
   GstPadLinkReturn result;
 
-  result = gst_pad_link_prepare_filtered (srcpad, sinkpad, &realsrc, &realsink,
-      filtercaps);
+  result = gst_pad_link_prepare (srcpad, sinkpad, &realsrc, &realsink);
 
   if (result != GST_PAD_LINK_OK)
     goto prepare_failed;
@@ -1590,12 +1577,6 @@ gst_pad_link_filtered (GstPad * srcpad, GstPad * sinkpad,
     GST_CAT_INFO (GST_CAT_PADS, "link between %s:%s and %s:%s failed",
         GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink));
 
-    /* remove the filter again */
-    if (filtercaps) {
-      gst_caps_replace (&GST_RPAD_APPFILTER (realsrc), NULL);
-      gst_caps_replace (&GST_RPAD_APPFILTER (realsink), NULL);
-    }
-
     GST_UNLOCK (realsink);
     GST_UNLOCK (realsrc);
   }
@@ -1607,22 +1588,6 @@ prepare_failed:
   }
 }
 
-/**
- * gst_pad_link:
- * @srcpad: the source #GstPad to link.
- * @sinkpad: the sink #GstPad to link.
- *
- * Links the source pad to the sink pad.
- *
- * Returns: A result code indicating if the connection worked or
- *          what went wrong.
- */
-GstPadLinkReturn
-gst_pad_link (GstPad * srcpad, GstPad * sinkpad)
-{
-  return gst_pad_link_filtered (srcpad, sinkpad, NULL);
-}
-
 static void
 gst_pad_set_pad_template (GstPad * pad, GstPadTemplate * templ)
 {
@@ -1723,118 +1688,11 @@ gst_pad_remove_ghost_pad (GstPad * pad, GstPad * ghostpad)
   GST_GPAD_REALPAD (ghostpad) = NULL;
 }
 
-/**
- * gst_pad_relink_filtered:
- * @srcpad: the source #GstPad to relink.
- * @sinkpad: the sink #GstPad to relink.
- * @filtercaps: the #GstPad to use as a filter in the relink.
- *
- * Relinks the given source and sink pad, constrained by the given
- * capabilities.  If the relink fails, the pads are unlinked
- * and an error code is returned.
- *
- * Returns: The result code of the operation.
- *
- * MT safe
- */
-GstPadLinkReturn
-gst_pad_relink_filtered (GstPad * srcpad, GstPad * sinkpad,
-    const GstCaps * filtercaps)
-{
-  GstRealPad *realsrc, *realsink;
-
-  /* FIXME refactor and share code with link/unlink */
-
-  /* generic checks */
-  g_return_val_if_fail (GST_IS_PAD (srcpad), GST_PAD_LINK_REFUSED);
-  g_return_val_if_fail (GST_IS_PAD (sinkpad), GST_PAD_LINK_REFUSED);
-
-  GST_CAT_INFO (GST_CAT_PADS, "trying to relink %s:%s and %s:%s",
-      GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
-
-  /* now we need to deal with the real/ghost stuff */
-  GST_PAD_REALIZE_AND_LOCK (srcpad, realsrc, lost_src_ghostpad);
-
-  if (G_UNLIKELY (GST_RPAD_DIRECTION (realsrc) != GST_PAD_SRC))
-    goto not_srcpad;
-
-  GST_PAD_REALIZE_AND_LOCK (sinkpad, realsink, lost_sink_ghostpad);
-
-  if (G_UNLIKELY (GST_RPAD_DIRECTION (realsink) != GST_PAD_SINK))
-    goto not_sinkpad;
-
-  if (G_UNLIKELY (GST_RPAD_PEER (realsink) != realsrc))
-    goto not_linked_together;
-
-  if ((GST_PAD (realsrc) != srcpad) || (GST_PAD (realsink) != sinkpad)) {
-    GST_CAT_INFO (GST_CAT_PADS, "*actually* relinking %s:%s and %s:%s",
-        GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink));
-  }
-
-  /* update filter */
-  if (filtercaps) {
-    GstCaps *filtercopy;
-
-    filtercopy = gst_caps_copy (filtercaps);
-
-    gst_caps_replace (&GST_PAD_APPFILTER (realsrc), filtercopy);
-    gst_caps_replace (&GST_PAD_APPFILTER (realsink), filtercopy);
-    gst_caps_unref (filtercopy);
-  } else {
-    gst_caps_replace (&GST_PAD_APPFILTER (realsrc), NULL);
-    gst_caps_replace (&GST_PAD_APPFILTER (realsink), NULL);
-  }
-  /* clear caps to force renegotiation */
-  gst_caps_replace (&GST_PAD_CAPS (realsrc), NULL);
-  gst_caps_replace (&GST_PAD_CAPS (realsink), NULL);
-  GST_UNLOCK (realsink);
-  GST_UNLOCK (realsrc);
-
-  GST_CAT_INFO (GST_CAT_PADS, "relinked %s:%s and %s:%s, successful",
-      GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink));
-
-  return GST_PAD_LINK_OK;
-
-lost_src_ghostpad:
-  {
-    return GST_PAD_LINK_REFUSED;
-  }
-not_srcpad:
-  {
-    g_critical ("pad %s is not a source pad", GST_PAD_NAME (realsrc));
-    GST_UNLOCK (realsrc);
-    return GST_PAD_LINK_WRONG_DIRECTION;
-  }
-lost_sink_ghostpad:
-  {
-    GST_DEBUG ("lost sink ghostpad");
-    GST_UNLOCK (realsrc);
-    return GST_PAD_LINK_REFUSED;
-  }
-not_sinkpad:
-  {
-    g_critical ("pad %s is not a sink pad", GST_PAD_NAME (realsink));
-    GST_UNLOCK (realsink);
-    GST_UNLOCK (realsrc);
-    return GST_PAD_LINK_WRONG_DIRECTION;
-  }
-not_linked_together:
-  {
-    GST_CAT_INFO (GST_CAT_PADS, "src %s:%s was not linked with sink %s:%s",
-        GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink));
-    /* we do not emit a warning in this case because unlinking cannot
-     * be made MT safe.*/
-    GST_UNLOCK (realsink);
-    GST_UNLOCK (realsrc);
-    return GST_PAD_LINK_REFUSED;
-  }
-}
-
 /* should be called with the pad LOCK held */
 static GstCaps *
 gst_real_pad_get_caps_unlocked (GstRealPad * realpad)
 {
-  GstCaps *result = NULL, *filter;
+  GstCaps *result = NULL;
 
   GST_CAT_DEBUG (GST_CAT_CAPS, "get pad caps of %s:%s (%p)",
       GST_DEBUG_PAD_NAME (realpad), realpad);
@@ -1901,19 +1759,6 @@ gst_real_pad_get_caps_unlocked (GstRealPad * realpad)
   result = gst_caps_new_empty ();
 
 done:
-  filter = GST_RPAD_APPFILTER (realpad);
-
-  if (filter) {
-    GstCaps *temp = result;
-
-    GST_CAT_DEBUG (GST_CAT_CAPS,
-        "app filter %p %" GST_PTR_FORMAT, filter, filter);
-    result = gst_caps_intersect (temp, filter);
-    gst_caps_unref (temp);
-    GST_CAT_DEBUG (GST_CAT_CAPS,
-        "caps after intersection with app filter %p %" GST_PTR_FORMAT, result,
-        result);
-  }
   return result;
 }
 
@@ -2459,58 +2304,6 @@ no_peer:
 }
 
 /**
- * gst_pad_get_filter_caps:
- * @pad: a real #GstPad.
- *
- * Gets the capabilities of filter that currently configured on @pad 
- * and its peer.
- *
- * Returns: the filter #GstCaps of the pad link.  Free the caps when
- * you no longer need it. This function returns NULL when the @pad has no 
- * peer or there is no filter configured.
- *
- * MT safe.
- */
-GstCaps *
-gst_pad_get_filter_caps (GstPad * pad)
-{
-  GstCaps *caps;
-  GstRealPad *realpad, *peer;
-
-  g_return_val_if_fail (GST_IS_PAD (pad), NULL);
-
-  GST_PAD_REALIZE_AND_LOCK (pad, realpad, lost_ghostpad);
-
-  if (G_UNLIKELY ((peer = GST_RPAD_PEER (realpad)) == NULL))
-    goto no_peer;
-
-  GST_CAT_DEBUG (GST_CAT_PROPERTIES, "%s:%s: getting filter caps",
-      GST_DEBUG_PAD_NAME (realpad));
-
-  if ((caps = GST_RPAD_APPFILTER (realpad)) != NULL)
-    gst_caps_ref (caps);
-  GST_UNLOCK (pad);
-
-  GST_CAT_DEBUG (GST_CAT_CAPS, "filter caps %" GST_PTR_FORMAT, caps);
-
-  return caps;
-
-lost_ghostpad:
-  {
-    GST_UNLOCK (pad);
-    return NULL;
-  }
-no_peer:
-  {
-    GST_CAT_DEBUG (GST_CAT_PROPERTIES, "%s:%s: no peer",
-        GST_DEBUG_PAD_NAME (realpad));
-    GST_UNLOCK (realpad);
-
-    return NULL;
-  }
-}
-
-/**
  * gst_pad_alloc_buffer:
  * @pad: a source #GstPad
  * @offset: the offset of the new buffer in the stream
@@ -2651,7 +2444,6 @@ gst_real_pad_dispose (GObject * object)
 
   /* clear the caps */
   gst_caps_replace (&GST_RPAD_CAPS (pad), NULL);
-  gst_caps_replace (&GST_RPAD_APPFILTER (pad), NULL);
 
   if (GST_IS_ELEMENT (GST_OBJECT_PARENT (pad))) {
     GST_CAT_DEBUG (GST_CAT_REFCOUNTING, "removing pad from element '%s'",
index 95e7d0d..3b5cf2e 100644 (file)
@@ -222,7 +222,6 @@ struct _GstRealPad {
 
   /* the pad capabilities */
   GstCaps                      *caps;
-  GstCaps                      *appfilter;
   GstPadGetCapsFunction         getcapsfunc;
   GstPadSetCapsFunction         setcapsfunc;
   GstPadAcceptCapsFunction      acceptcapsfunc;
@@ -320,7 +319,6 @@ struct _GstGhostPadClass {
 #define GST_RPAD_UNLINKFUNC(pad)       (GST_REAL_PAD_CAST(pad)->unlinkfunc)
 
 #define GST_RPAD_CAPS(pad)             (GST_REAL_PAD_CAST(pad)->caps)
-#define GST_RPAD_APPFILTER(pad)                (GST_REAL_PAD_CAST(pad)->appfilter)
 #define GST_RPAD_GETCAPSFUNC(pad)      (GST_REAL_PAD_CAST(pad)->getcapsfunc)
 #define GST_RPAD_SETCAPSFUNC(pad)      (GST_REAL_PAD_CAST(pad)->setcapsfunc)
 #define GST_RPAD_ACCEPTCAPSFUNC(pad)   (GST_REAL_PAD_CAST(pad)->acceptcapsfunc)
@@ -366,7 +364,6 @@ struct _GstGhostPadClass {
 #define GST_PAD_REALIZE(pad)           (GST_IS_REAL_PAD(pad) ? ((GstRealPad *)(pad)) : GST_GPAD_REALPAD(pad))
 #define GST_PAD_DIRECTION(pad)         GST_RPAD_DIRECTION(GST_PAD_REALIZE(pad))
 #define GST_PAD_CAPS(pad)              GST_RPAD_CAPS(GST_PAD_REALIZE (pad))
-#define GST_PAD_APPFILTER(pad)         GST_RPAD_APPFILTER(GST_PAD_REALIZE (pad))
 #define GST_PAD_PEER(pad)              GST_PAD_CAST(GST_RPAD_PEER(GST_PAD_REALIZE(pad)))
 
 /* Some check functions (unused?) */
@@ -497,10 +494,6 @@ void                       gst_pad_set_link_function               (GstPad *pad, GstPadLinkFunction link);
 void                   gst_pad_set_unlink_function             (GstPad *pad, GstPadUnlinkFunction unlink);
 
 GstPadLinkReturn        gst_pad_link                           (GstPad *srcpad, GstPad *sinkpad);
-GstPadLinkReturn        gst_pad_link_filtered                  (GstPad *srcpad, GstPad *sinkpad, 
-                                                                const GstCaps *filtercaps);
-GstPadLinkReturn       gst_pad_relink_filtered                 (GstPad *srcpad, GstPad *sinkpad, 
-                                                                const GstCaps *filtercaps);
 gboolean               gst_pad_unlink                          (GstPad *srcpad, GstPad *sinkpad);
 gboolean               gst_pad_is_linked                       (GstPad *pad);
 
@@ -527,7 +520,6 @@ gboolean            gst_pad_peer_accept_caps                (GstPad * pad, GstCaps *caps);
 /* capsnego for connected pads */
 GstCaps *              gst_pad_get_allowed_caps                (GstPad * srcpad);
 GstCaps *              gst_pad_get_negotiated_caps             (GstPad * pad);
-GstCaps *              gst_pad_get_filter_caps                 (GstPad * pad);
 
 /* data passing functions */
 GstFlowReturn          gst_pad_push                            (GstPad *pad, GstBuffer *buffer);
index 244bc34..1a839ea 100644 (file)
@@ -399,6 +399,7 @@ gst_element_create_all_pads (GstElement * element)
 
       gst_element_add_pad (element, pad);
     }
+    padlist = padlist->next;
   }
 }
 
@@ -566,7 +567,7 @@ gst_element_request_compatible_pad (GstElement * element,
 }
 
 /**
- * gst_element_get_compatible_pad_filtered:
+ * gst_element_get_compatible_pad:
  * @element: a #GstElement in which the pad should be found.
  * @pad: the #GstPad to find a compatible one for.
  * @filtercaps: the #GstCaps to use as a filter.
@@ -579,8 +580,8 @@ gst_element_request_compatible_pad (GstElement * element,
  * found.
  */
 GstPad *
-gst_element_get_compatible_pad_filtered (GstElement * element, GstPad * pad,
-    const GstCaps * filtercaps)
+gst_element_get_compatible_pad (GstElement * element, GstPad * pad,
+    const GstCaps * caps)
 {
   GstIterator *pads;
   GstPadTemplate *templ;
@@ -588,12 +589,14 @@ gst_element_get_compatible_pad_filtered (GstElement * element, GstPad * pad,
   GstPad *foundpad = NULL;
   gboolean done;
 
+  /* FIXME check for caps compatibility */
+
   g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
   g_return_val_if_fail (GST_IS_PAD (pad), NULL);
 
   GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS,
-      "finding pad in %s compatible with %s:%s and filter %" GST_PTR_FORMAT,
-      GST_ELEMENT_NAME (element), GST_DEBUG_PAD_NAME (pad), filtercaps);
+      "finding pad in %s compatible with %s:%s",
+      GST_ELEMENT_NAME (element), GST_DEBUG_PAD_NAME (pad));
 
   /* let's use the real pad */
   pad = (GstPad *) GST_PAD_REALIZE (pad);
@@ -619,8 +622,7 @@ gst_element_get_compatible_pad_filtered (GstElement * element, GstPad * pad,
 
         peer = gst_pad_get_peer (current);
 
-        if (peer == NULL &&
-            gst_pad_can_link_filtered (pad, current, filtercaps)) {
+        if (peer == NULL && gst_pad_can_link (pad, current)) {
 
           GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS,
               "found existing unlinked pad %s:%s",
@@ -654,13 +656,6 @@ gst_element_get_compatible_pad_filtered (GstElement * element, GstPad * pad,
   /* try to create a new one */
   /* requesting is a little crazy, we need a template. Let's create one */
   templcaps = gst_pad_get_caps (pad);
-  if (filtercaps != NULL) {
-    GstCaps *temp;
-
-    temp = gst_caps_intersect (filtercaps, templcaps);
-    gst_caps_unref (templcaps);
-    templcaps = temp;
-  }
 
   templ = gst_pad_template_new ((gchar *) GST_PAD_NAME (pad),
       GST_PAD_DIRECTION (pad), GST_PAD_ALWAYS, templcaps);
@@ -679,26 +674,6 @@ gst_element_get_compatible_pad_filtered (GstElement * element, GstPad * pad,
   return NULL;
 }
 
-
-
-/**
- * gst_element_get_compatible_pad:
- * @element: a #GstElement in which the pad should be found.
- * @pad: the #GstPad to find a compatible one for.
- *
- * Looks for an unlinked pad to which the given pad can link to.
- * It is not guaranteed that linking the pads will work, though
- * it should work in most cases.
- *
- * Returns: the #GstPad to which a link can be made, or %NULL if one
- * could not be found.
- */
-GstPad *
-gst_element_get_compatible_pad (GstElement * element, GstPad * pad)
-{
-  return gst_element_get_compatible_pad_filtered (element, pad, NULL);
-}
-
 /**
  * gst_element_state_get_name:
  * @state: a #GstElementState to get the name of.
@@ -754,12 +729,11 @@ gst_element_state_get_name (GstElementState state)
 }
 
 /**
- * gst_element_link_pads_filtered:
+ * gst_element_link_pads:
  * @src: a #GstElement containing the source pad.
  * @srcpadname: the name of the #GstPad in source element or NULL for any pad.
  * @dest: the #GstElement containing the destination pad.
  * @destpadname: the name of the #GstPad in destination element or NULL for any pad.
- * @filtercaps: the #GstCaps to use as a filter.
  *
  * Links the two named pads of the source and destination elements.
  * Side effect is that if one of the pads has no parent, it becomes a
@@ -769,8 +743,8 @@ gst_element_state_get_name (GstElementState state)
  * Returns: TRUE if the pads could be linked, FALSE otherwise.
  */
 gboolean
-gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname,
-    GstElement * dest, const gchar * destpadname, const GstCaps * filtercaps)
+gst_element_link_pads (GstElement * src, const gchar * srcpadname,
+    GstElement * dest, const gchar * destpadname)
 {
   const GList *srcpads, *destpads, *srctempls, *desttempls, *l;
   GstPad *srcpad, *destpad;
@@ -853,7 +827,7 @@ gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname,
     gboolean result;
 
     /* two explicitly specified pads */
-    result = gst_pad_link_filtered (srcpad, destpad, filtercaps);
+    result = gst_pad_link (srcpad, destpad);
 
     gst_object_unref (GST_OBJECT (srcpad));
     gst_object_unref (GST_OBJECT (destpad));
@@ -871,12 +845,9 @@ gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname,
       if ((GST_PAD_DIRECTION (srcpad) == GST_PAD_SRC) &&
           (GST_PAD_PEER (srcpad) == NULL)) {
         GstPad *temp = destpadname ? destpad :
-            gst_element_get_compatible_pad_filtered (dest, srcpad,
-            filtercaps);
+            gst_element_get_compatible_pad (dest, srcpad, NULL);
 
-        if (temp
-            && gst_pad_link_filtered (srcpad, temp,
-                filtercaps) == GST_PAD_LINK_OK) {
+        if (temp && gst_pad_link (srcpad, temp) == GST_PAD_LINK_OK) {
           GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "linked pad %s:%s to pad %s:%s",
               GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (temp));
           if (destpad)
@@ -915,12 +886,9 @@ gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname,
           GST_DEBUG_PAD_NAME (destpad));
       if ((GST_PAD_DIRECTION (destpad) == GST_PAD_SINK) &&
           (GST_PAD_PEER (destpad) == NULL)) {
-        GstPad *temp = gst_element_get_compatible_pad_filtered (src, destpad,
-            filtercaps);
+        GstPad *temp = gst_element_get_compatible_pad (src, destpad, NULL);
 
-        if (temp
-            && gst_pad_link_filtered (temp, destpad,
-                filtercaps) == GST_PAD_LINK_OK) {
+        if (temp && gst_pad_link (temp, destpad) == GST_PAD_LINK_OK) {
           GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "linked pad %s:%s to pad %s:%s",
               GST_DEBUG_PAD_NAME (temp), GST_DEBUG_PAD_NAME (destpad));
           gst_object_unref (GST_OBJECT (temp));
@@ -974,8 +942,7 @@ gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname,
                   gst_element_get_request_pad (src, srctempl->name_template);
               destpad =
                   gst_element_get_request_pad (dest, desttempl->name_template);
-              if (gst_pad_link_filtered (srcpad, destpad,
-                      filtercaps) == GST_PAD_LINK_OK) {
+              if (gst_pad_link (srcpad, destpad) == GST_PAD_LINK_OK) {
                 GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS,
                     "linked pad %s:%s to pad %s:%s",
                     GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (destpad));
@@ -1000,12 +967,11 @@ gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname,
 }
 
 /**
- * gst_element_link_filtered:
+ * gst_element_link:
  * @src: a #GstElement containing the source pad.
  * @dest: the #GstElement containing the destination pad.
- * @filtercaps: the #GstCaps to use as a filter.
  *
- * Links @src to @dest, filtered by @filtercaps. The link must be from source to
+ * Links @src to @dest. The link must be from source to
  * destination; the other direction will not be tried. The function looks for
  * existing pads that aren't linked yet. It will request new pads if necessary.
  * If multiple links are possible, only one is established.
@@ -1013,10 +979,9 @@ gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname,
  * Returns: TRUE if the elements could be linked, FALSE otherwise.
  */
 gboolean
-gst_element_link_filtered (GstElement * src, GstElement * dest,
-    const GstCaps * filtercaps)
+gst_element_link (GstElement * src, GstElement * dest)
 {
-  return gst_element_link_pads_filtered (src, NULL, dest, NULL, filtercaps);
+  return gst_element_link_pads (src, NULL, dest, NULL);
 }
 
 /**
@@ -1053,44 +1018,6 @@ gst_element_link_many (GstElement * element_1, GstElement * element_2, ...)
 }
 
 /**
- * gst_element_link:
- * @src: a #GstElement containing the source pad.
- * @dest: the #GstElement containing the destination pad.
- *
- * Links @src to @dest with no filter caps. See gst_element_link_filtered() for
- * more information.
- *
- * Returns: TRUE if the elements could be linked, FALSE otherwise.
- */
-gboolean
-gst_element_link (GstElement * src, GstElement * dest)
-{
-  return gst_element_link_pads_filtered (src, NULL, dest, NULL, NULL);
-}
-
-/**
- * gst_element_link_pads:
- * @src: a #GstElement containing the source pad.
- * @srcpadname: the name of the #GstPad in the source element.
- * @dest: the #GstElement containing the destination pad.
- * @destpadname: the name of the #GstPad in destination element.
- *
- * Links the two named pads of the source and destination elements.
- * Side effect is that if one of the pads has no parent, it becomes a
- * child of the parent of the other element.  If they have different
- * parents, the link fails.
- *
- * Returns: TRUE if the pads could be linked, FALSE otherwise.
- */
-gboolean
-gst_element_link_pads (GstElement * src, const gchar * srcpadname,
-    GstElement * dest, const gchar * destpadname)
-{
-  return gst_element_link_pads_filtered (src, srcpadname, dest, destpadname,
-      NULL);
-}
-
-/**
  * gst_element_unlink_pads:
  * @src: a #GstElement containing the source pad.
  * @srcpadname: the name of the #GstPad in source element.
@@ -1221,19 +1148,17 @@ gst_element_unlink (GstElement * src, GstElement * dest)
 }
 
 /**
- * gst_pad_can_link_filtered:
+ * gst_pad_can_link:
  * @srcpad: the source #GstPad to link.
  * @sinkpad: the sink #GstPad to link.
- * @filtercaps: the filter #GstCaps.
  *
- * Checks if the source pad and the sink pad can be linked when constrained
- * by the given filter caps. Both @srcpad and @sinkpad must be unlinked.
+ * Checks if the source pad and the sink pad can be linked.
+ * Both @srcpad and @sinkpad must be unlinked.
  *
  * Returns: TRUE if the pads can be linked, FALSE otherwise.
  */
 gboolean
-gst_pad_can_link_filtered (GstPad * srcpad, GstPad * sinkpad,
-    const GstCaps * filtercaps)
+gst_pad_can_link (GstPad * srcpad, GstPad * sinkpad)
 {
   GstRealPad *realsrc, *realsink;
 
@@ -1298,21 +1223,6 @@ gst_pad_can_link_filtered (GstPad * srcpad, GstPad * sinkpad,
 }
 
 /**
- * gst_pad_can_link:
- * @srcpad: the source #GstPad to link.
- * @sinkpad: the sink #GstPad to link.
- *
- * Checks if the source pad and the sink pad can be linked.
- *
- * Returns: TRUE if the pads can be linked, FALSE otherwise.
- */
-gboolean
-gst_pad_can_link (GstPad * srcpad, GstPad * sinkpad)
-{
-  return gst_pad_can_link_filtered (srcpad, sinkpad, NULL);
-}
-
-/**
  * gst_pad_use_fixed_caps:
  * @pad: the pad to use
  *
index 2b00ed0..5487047 100644 (file)
@@ -233,9 +233,8 @@ GstFlowReturn               gst_element_abort_preroll       (GstElement *element);
 GstFlowReturn          gst_element_finish_preroll      (GstElement *element, GstPad *pad);
 
 void                    gst_element_create_all_pads     (GstElement *element);
-GstPad*                 gst_element_get_compatible_pad  (GstElement *element, GstPad *pad);
-GstPad*                 gst_element_get_compatible_pad_filtered (GstElement *element, GstPad *pad,
-                                                        const GstCaps *filtercaps);
+GstPad*                 gst_element_get_compatible_pad  (GstElement *element, GstPad *pad,
+                                                        const GstCaps *caps);
 
 GstPadTemplate*         gst_element_get_compatible_pad_template (GstElement *element, GstPadTemplate *compattempl);
 
@@ -244,17 +243,12 @@ G_CONST_RETURN gchar*   gst_element_state_get_name      (GstElementState state);
 gboolean               gst_element_link                (GstElement *src, GstElement *dest);
 gboolean               gst_element_link_many           (GstElement *element_1,
                                                         GstElement *element_2, ...);
-gboolean               gst_element_link_filtered       (GstElement *src, GstElement *dest,
-                                                        const GstCaps *filtercaps);
 void                    gst_element_unlink              (GstElement *src, GstElement *dest);
 void                    gst_element_unlink_many         (GstElement *element_1,
                                                         GstElement *element_2, ...);
 
 gboolean               gst_element_link_pads           (GstElement *src, const gchar *srcpadname,
                                                         GstElement *dest, const gchar *destpadname);
-gboolean               gst_element_link_pads_filtered  (GstElement *src, const gchar *srcpadname,
-                                                        GstElement *dest, const gchar *destpadname,
-                                                        const GstCaps *filtercaps);
 void                    gst_element_unlink_pads         (GstElement *src, const gchar *srcpadname,
                                                         GstElement *dest, const gchar *destpadname);
 
@@ -264,7 +258,6 @@ void gst_element_class_install_std_props (GstElementClass * klass,
 
 /* pad functions */
 gboolean                gst_pad_can_link                (GstPad *srcpad, GstPad *sinkpad);
-gboolean                gst_pad_can_link_filtered       (GstPad *srcpad, GstPad *sinkpad, const GstCaps *filtercaps);
 
 void                   gst_pad_use_fixed_caps          (GstPad *pad);
 GstCaps*               gst_pad_get_fixed_caps_func     (GstPad *pad);
index 2a24eb7..a992a30 100644 (file)
@@ -835,6 +835,29 @@ gst_value_get_caps (const GValue * value)
   return (GstCaps *) g_value_get_boxed (value);
 }
 
+static char *
+gst_value_serialize_caps (const GValue * value)
+{
+  GstCaps *caps = g_value_get_boxed (value);
+
+  return gst_caps_to_string (caps);
+}
+
+static gboolean
+gst_value_deserialize_caps (GValue * dest, const char *s)
+{
+  GstCaps *caps;
+
+  caps = gst_caps_from_string (s);
+
+  if (caps) {
+    g_value_set_boxed (dest, caps);
+    return TRUE;
+  }
+  return FALSE;
+}
+
+
 /*************
  * GstBuffer *
  *************/
@@ -3011,6 +3034,17 @@ _gst_value_initialize (void)
     gst_value.type = gst_type_fraction;
     gst_value_register (&gst_value);
   }
+  {
+    static GstValueTable gst_value = {
+      0,
+      NULL,
+      gst_value_serialize_caps,
+      gst_value_deserialize_caps,
+    };
+
+    gst_value.type = GST_TYPE_CAPS;
+    gst_value_register (&gst_value);
+  }
 
 
   REGISTER_SERIALIZATION (G_TYPE_DOUBLE, double);
index 792bf5b..a7f003f 100644 (file)
@@ -372,7 +372,7 @@ gst_parse_found_pad (GstElement *src, GstPad *pad, gpointer data)
                 GST_ELEMENT_NAME (src), link->src_pad,
                 GST_ELEMENT_NAME (link->sink), link->sink_pad);
 
-  if (gst_element_link_pads_filtered (src, link->src_pad, link->sink, link->sink_pad, link->caps)) {
+  if (gst_element_link_pads (src, link->src_pad, link->sink, link->sink_pad)) {
     /* do this here, we don't want to get any problems later on when unlocking states */
     GST_CAT_DEBUG (GST_CAT_PIPELINE, "delayed linking %s:%s to %s:%s worked", 
                           GST_ELEMENT_NAME (src), link->src_pad,
@@ -442,9 +442,8 @@ gst_parse_perform_link (link_t *link, graph_t *graph)
                link->caps);
 
   if (!srcs || !sinks) {
-    if (gst_element_link_pads_filtered (src, srcs ? (const gchar *) srcs->data : NULL,
-                                        sink, sinks ? (const gchar *) sinks->data : NULL,
-                                       link->caps)) {
+    if (gst_element_link_pads (src, srcs ? (const gchar *) srcs->data : NULL,
+                                        sink, sinks ? (const gchar *) sinks->data : NULL)) {
       gst_parse_element_lock (sink, gst_element_is_locked_state (src));
       goto success;
     } else {
@@ -466,7 +465,7 @@ gst_parse_perform_link (link_t *link, graph_t *graph)
     const gchar *sink_pad = (const gchar *) sinks->data;
     srcs = g_slist_next (srcs);
     sinks = g_slist_next (sinks);
-    if (gst_element_link_pads_filtered (src, src_pad, sink, sink_pad, link->caps)) {
+    if (gst_element_link_pads (src, src_pad, sink, sink_pad)) {
       gst_parse_element_lock (sink, gst_element_is_locked_state (src));
       continue;
     } else {
index 249a944..f093c38 100644 (file)
@@ -51,11 +51,13 @@ struct _elements_entry
 };
 
 
+extern GType gst_capsfilter_get_type (void);
 extern GType gst_filesrc_get_type (void);
 extern GstElementDetails gst_filesrc_details;
 
 static struct _elements_entry _elements[] = {
 //  {"aggregator", GST_RANK_NONE, gst_aggregator_get_type},
+  {"capsfilter", GST_RANK_NONE, gst_capsfilter_get_type},
   {"fakesrc", GST_RANK_NONE, gst_fakesrc_get_type},
   {"fakesink", GST_RANK_NONE, gst_fakesink_get_type},
   {"filesrc", GST_RANK_NONE, gst_filesrc_get_type},