gst/elements/gstcapsfilter.c: Free existing caps if the capsfilter changes. Add a FIXME about setting those caps on t...

Original commit message from CVS:
* gst/elements/gstcapsfilter.c: (gst_capsfilter_set_property):
Free existing caps if the capsfilter changes. Add a FIXME about
setting those caps on the pads.

* gst/gstutils.c: (gst_element_get_compatible_pad), (ghost_up):
Before adding a ghost pad to a parent bin, check that there isn't
already one for the element on the bin. Prevents infinite recursion
when using decodebin in parse pipelines. Andy says he'll rewrite the
way this works anyway, so ignore the hack.
This commit is contained in:
Jan Schmidt 2005-06-02 15:45:16 +00:00
parent 26a1c2c663
commit c9f30f98b7
4 changed files with 47 additions and 7 deletions

View file

@ -1,3 +1,15 @@
2005-06-03 Jan Schmidt <thaytan@mad.scientist.com>
* gst/elements/gstcapsfilter.c: (gst_capsfilter_set_property):
Free existing caps if the capsfilter changes. Add a FIXME about
setting those caps on the pads.
* gst/gstutils.c: (gst_element_get_compatible_pad), (ghost_up):
Before adding a ghost pad to a parent bin, check that there isn't
already one for the element on the bin. Prevents infinite recursion
when using decodebin in parse pipelines. Andy says he'll rewrite the
way this works anyway, so ignore the hack.
2005-06-02 Andy Wingo <wingo@pobox.com>
* gst/elements/gsttypefindelement.c (do_pull_typefind): Query the

View file

@ -205,9 +205,17 @@ gst_capsfilter_set_property (GObject * object, guint prop_id,
capsfilter = GST_CAPSFILTER (object);
switch (prop_id) {
case PROP_FILTER_CAPS:
capsfilter->filter_caps = gst_caps_copy (gst_value_get_caps (value));
case PROP_FILTER_CAPS:{
GstCaps *new_caps = gst_caps_copy (gst_value_get_caps (value));
g_return_if_fail (new_caps != NULL);
gst_caps_unref (capsfilter->filter_caps);
capsfilter->filter_caps = new_caps;
/* FIXME: Need to activate these caps on the pads */
break;
}
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;

View file

@ -625,7 +625,7 @@ gst_element_get_compatible_pad (GstElement * element, GstPad * pad,
current = GST_PAD (padptr);
GST_CAT_LOG (GST_CAT_ELEMENT_PADS, "examing pad %s:%s",
GST_CAT_LOG (GST_CAT_ELEMENT_PADS, "examining pad %s:%s",
GST_DEBUG_PAD_NAME (current));
peer = gst_pad_get_peer (current);
@ -808,14 +808,26 @@ ghost_up (GstElement * e, GstPad * pad)
static gint ghost_pad_index = 0;
GstPad *gpad;
gchar *name;
GList *gpads;
GstObject *parent = GST_OBJECT_PARENT (e);
/* Check if the pad already has a ghost on the element */
for (gpads = g_list_first (GST_PAD_REALIZE (pad)->ghostpads); gpads != NULL;
gpads = g_list_next (gpads)) {
if (GST_OBJECT_PARENT (GST_PAD (gpads->data)) == parent) {
GST_DEBUG ("Found existing ghost pad of %s on element %s\n",
GST_OBJECT_NAME (pad), GST_OBJECT_NAME (parent));
return GST_PAD (gpads->data);
}
}
name = g_strdup_printf ("ghost%d", ghost_pad_index++);
gpad = gst_ghost_pad_new (name, pad);
g_free (name);
if (!gst_element_add_pad ((GstElement *) GST_OBJECT_PARENT (e), gpad)) {
if (!gst_element_add_pad ((GstElement *) parent, gpad)) {
g_warning ("Pad named %s already exists in element %s\n",
GST_OBJECT_NAME (gpad), GST_OBJECT_NAME (GST_OBJECT_PARENT (e)));
GST_OBJECT_NAME (gpad), GST_OBJECT_NAME (parent));
gst_object_unref ((GstObject *) gpad);
return NULL;
}

View file

@ -205,9 +205,17 @@ gst_capsfilter_set_property (GObject * object, guint prop_id,
capsfilter = GST_CAPSFILTER (object);
switch (prop_id) {
case PROP_FILTER_CAPS:
capsfilter->filter_caps = gst_caps_copy (gst_value_get_caps (value));
case PROP_FILTER_CAPS:{
GstCaps *new_caps = gst_caps_copy (gst_value_get_caps (value));
g_return_if_fail (new_caps != NULL);
gst_caps_unref (capsfilter->filter_caps);
capsfilter->filter_caps = new_caps;
/* FIXME: Need to activate these caps on the pads */
break;
}
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;