diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | docs/design/part-gstghostpad.txt | 2 | ||||
-rw-r--r-- | gst/gstghostpad.c | 30 | ||||
-rw-r--r-- | gst/gstpad.c | 11 |
4 files changed, 46 insertions, 9 deletions
@@ -1,5 +1,17 @@ 2007-02-20 Wim Taymans <wim@fluendo.com> + * docs/design/part-gstghostpad.txt: + * gst/gstghostpad.c: (gst_ghost_pad_dispose), + (gst_ghost_pad_new_full): + Make the ghostpad a parent of the internal pad again for better backward + compatibility. Don't write code that relies on this however. + + * gst/gstpad.c: (gst_pad_activate_pull), (gst_pad_activate_push), + (gst_pad_link_check_hierarchy): + Require that parents should be GstElements in the hierarchy check. + +2007-02-20 Wim Taymans <wim@fluendo.com> + * gst/gstbin.c: (bin_replace_message), (gst_bin_add_func), (gst_bin_change_state_func), (bin_query_min_max_init), (bin_query_latency_fold), (bin_query_latency_done), diff --git a/docs/design/part-gstghostpad.txt b/docs/design/part-gstghostpad.txt index ef54975c9..d5c987c65 100644 --- a/docs/design/part-gstghostpad.txt +++ b/docs/design/part-gstghostpad.txt @@ -66,6 +66,8 @@ Ghostpads | target *----->// (------------) + The GstGhostPad (X) is also set as the parent of the GstProxyPad (Y). + The target is a pointer to the internal pads peer. It is an optimisation to quickly get to the peer of a ghostpad without having to dereference the internal->peer. diff --git a/gst/gstghostpad.c b/gst/gstghostpad.c index 8324948fe..0a178ca89 100644 --- a/gst/gstghostpad.c +++ b/gst/gstghostpad.c @@ -707,9 +707,8 @@ gst_ghost_pad_dispose (GObject * object) GST_PROXY_PAD_INTERNAL (internal) = NULL; /* disposes of the internal pad, since the ghostpad is the only possible object - * that has a refcount on the internal pad. - */ - gst_object_unref (internal); + * that has a refcount on the internal pad. */ + gst_object_unparent (GST_OBJECT_CAST (internal)); GST_PROXY_UNLOCK (pad); @@ -782,17 +781,17 @@ gst_ghost_pad_new_full (const gchar * name, GstPadDirection dir, GST_PROXY_LOCK (ret); - /* don't set parent, we can't link the internal pads if parents/grandparents - * are different, just take ownership. */ - gst_object_ref (internal); - gst_object_sink (internal); + /* now make the ghostpad a parent of the internal pad */ + if (!gst_object_set_parent (GST_OBJECT_CAST (internal), + GST_OBJECT_CAST (ret))) + goto parent_failed; - /* The ghostpad is the owner of the internal pad and is the only object that + /* The ghostpad is the parent of the internal pad and is the only object that * can have a refcount on the internal pad. * At this point, the GstGhostPad has a refcount of 1, and the internal pad has * a refcount of 1. * When the refcount of the GstGhostPad drops to 0, the ghostpad will dispose - * it's refcount on the internal pad in the dispose method by un-reffing it. + * it's refcount on the internal pad in the dispose method by un-parenting it. * This is why we don't take extra refcounts in the assignments below */ GST_PROXY_PAD_INTERNAL (ret) = internal; @@ -816,6 +815,19 @@ gst_ghost_pad_new_full (const gchar * name, GstPadDirection dir, GST_PROXY_UNLOCK (ret); return ret; + + /* ERRORS */ +parent_failed: + { + GST_WARNING_OBJECT (ret, "Could not set internal pad %s:%s", + GST_DEBUG_PAD_NAME (internal)); + g_critical ("Could not set internal pad %s:%s", + GST_DEBUG_PAD_NAME (internal)); + GST_PROXY_UNLOCK (ret); + gst_object_unref (ret); + gst_object_unref (internal); + return NULL; + } } /** diff --git a/gst/gstpad.c b/gst/gstpad.c index 9f5044116..1e36c61df 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -1697,6 +1697,10 @@ gst_pad_link_check_hierarchy (GstPad * src, GstPad * sink) if (G_UNLIKELY (psrc == NULL || psink == NULL)) goto no_parent; + /* only care about parents that are elements */ + if (G_UNLIKELY (!GST_IS_ELEMENT (psrc) || !GST_IS_ELEMENT (psink))) + goto no_element_parent; + /* if the parents are the same, we have a loop */ if (G_UNLIKELY (psrc == psink)) goto same_parents; @@ -1721,6 +1725,13 @@ no_parent: GST_PTR_FORMAT, psrc, psink); return TRUE; } +no_element_parent: + { + GST_CAT_DEBUG (GST_CAT_CAPS, + "one of the pads has no element parent %" GST_PTR_FORMAT " and %" + GST_PTR_FORMAT, psrc, psink); + return TRUE; + } same_parents: { GST_CAT_DEBUG (GST_CAT_CAPS, "pads have same parent %" GST_PTR_FORMAT, |