+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:
@element:
@pad:
-@Returns:
-
-
-<!-- ##### FUNCTION gst_element_get_compatible_pad_filtered ##### -->
-<para>
-
-</para>
-
-@element:
-@pad:
-@filtercaps:
+@caps:
@Returns:
@Returns:
-<!-- ##### FUNCTION gst_element_link_filtered ##### -->
-<para>
-
-</para>
-
-@src:
-@dest:
-@filtercaps:
-@Returns:
-
-
<!-- ##### FUNCTION gst_element_unlink ##### -->
<para>
@Returns:
-<!-- ##### FUNCTION gst_element_link_pads_filtered ##### -->
-<para>
-
-</para>
-
-@src:
-@srcpadname:
-@dest:
-@destpadname:
-@filtercaps:
-@Returns:
-
-
<!-- ##### FUNCTION gst_element_unlink_pads ##### -->
<para>
@Returns:
-<!-- ##### FUNCTION gst_pad_can_link_filtered ##### -->
-<para>
-
-</para>
-
-@srcpad:
-@sinkpad:
-@filtercaps:
-@Returns:
-
-
<!-- ##### FUNCTION gst_pad_set_unlink_function ##### -->
<para>
@Returns:
-<!-- ##### FUNCTION gst_pad_link_filtered ##### -->
-<para>
-
-</para>
-
-@srcpad:
-@sinkpad:
-@filtercaps:
-@Returns:
-
-
<!-- ##### FUNCTION gst_pad_unlink ##### -->
<para>
@Returns:
-<!-- ##### FUNCTION gst_pad_relink_filtered ##### -->
-<para>
-
-</para>
-
-@srcpad:
-@sinkpad:
-@filtercaps:
-@Returns:
-
-
<!-- ##### FUNCTION gst_pad_get_allowed_caps ##### -->
<para>
- 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:)
gstsystemclock.h \
gsttag.h \
gsttaginterface.h \
- gsttask.h \
+ gsttask.h \
gsttrace.h \
gsttrashstack.h \
gsttypefind.h \
};
+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},
*
* 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.
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);
}
}
+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;
*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:
}
/**
- * 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.
* 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;
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);
}
}
}
-/**
- * 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)
{
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);
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;
}
}
/**
- * 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
/* 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'",
/* the pad capabilities */
GstCaps *caps;
- GstCaps *appfilter;
GstPadGetCapsFunction getcapsfunc;
GstPadSetCapsFunction setcapsfunc;
GstPadAcceptCapsFunction acceptcapsfunc;
#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)
#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?) */
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);
/* 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);
gst_element_add_pad (element, pad);
}
+ padlist = padlist->next;
}
}
}
/**
- * 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.
* 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;
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);
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",
/* 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);
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.
}
/**
- * 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
* 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;
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));
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)
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));
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));
}
/**
- * 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.
* 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);
}
/**
}
/**
- * 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.
}
/**
- * 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;
}
/**
- * 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
*
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);
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);
/* 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);
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 *
*************/
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);
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,
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 {
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 {
};
+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},