summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2011-11-16 17:49:46 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2011-11-16 17:49:46 +0100
commit361a7ae44d5088553caa806b9f468ee78779b9cc (patch)
treeffc33fada437e1827237eb59b7cfc947863d1de5
parent09a8294d3681f5ab57d7b8978d3c55bda078243f (diff)
add parent to internal links
-rw-r--r--gst/gstghostpad.c3
-rw-r--r--gst/gstghostpad.h2
-rw-r--r--gst/gstpad.c36
-rw-r--r--gst/gstpad.h7
-rw-r--r--plugins/elements/gstinputselector.c7
-rw-r--r--plugins/elements/gstmultiqueue.c4
6 files changed, 33 insertions, 26 deletions
diff --git a/gst/gstghostpad.c b/gst/gstghostpad.c
index 6b7fcf470..13a113ad2 100644
--- a/gst/gstghostpad.c
+++ b/gst/gstghostpad.c
@@ -234,6 +234,7 @@ gst_proxy_pad_query_default (GstPad * pad, GstObject * parent, GstQuery * query)
/**
* gst_proyx_pad_iterate_internal_links_default:
* @pad: the #GstPad to get the internal links of.
+ * @parent: the parent of @pad or NULL
*
* Invoke the default iterate internal links function of the proxy pad.
*
@@ -243,7 +244,7 @@ gst_proxy_pad_query_default (GstPad * pad, GstObject * parent, GstQuery * query)
* Since: 0.10.36
*/
GstIterator *
-gst_proxy_pad_iterate_internal_links_default (GstPad * pad)
+gst_proxy_pad_iterate_internal_links_default (GstPad * pad, GstObject * parent)
{
GstIterator *res = NULL;
GstPad *internal;
diff --git a/gst/gstghostpad.h b/gst/gstghostpad.h
index ab1c3a19c..fa8950c62 100644
--- a/gst/gstghostpad.h
+++ b/gst/gstghostpad.h
@@ -65,7 +65,7 @@ GstProxyPad* gst_proxy_pad_get_internal (GstProxyPad *pad);
gboolean gst_proxy_pad_event_default (GstPad *pad, GstEvent *event);
gboolean gst_proxy_pad_query_default (GstPad *pad, GstObject *parent,
GstQuery *query);
-GstIterator* gst_proxy_pad_iterate_internal_links_default (GstPad *pad);
+GstIterator* gst_proxy_pad_iterate_internal_links_default (GstPad *pad, GstObject *parent);
GstFlowReturn gst_proxy_pad_chain_default (GstPad *pad, GstBuffer *buffer);
GstFlowReturn gst_proxy_pad_chain_list_default (GstPad *pad, GstBufferList *list);
GstFlowReturn gst_proxy_pad_getrange_default (GstPad *pad, guint64 offset, guint size, GstBuffer **buffer);
diff --git a/gst/gstpad.c b/gst/gstpad.c
index a415288ea..fc2c5b692 100644
--- a/gst/gstpad.c
+++ b/gst/gstpad.c
@@ -2390,6 +2390,7 @@ no_peer:
/**
* gst_pad_iterate_internal_links_default:
* @pad: the #GstPad to get the internal links of.
+ * @parent: the parent of @pad or NULL
*
* Iterate the list of pads to which the given pad is linked to inside of
* the parent element.
@@ -2404,38 +2405,39 @@ no_peer:
* Since: 0.10.21
*/
GstIterator *
-gst_pad_iterate_internal_links_default (GstPad * pad)
+gst_pad_iterate_internal_links_default (GstPad * pad, GstObject * parent)
{
GstIterator *res;
GList **padlist;
guint32 *cookie;
GMutex *lock;
gpointer owner;
+ GstElement *eparent;
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
- {
- GstElement *parent;
-
+ if (parent != NULL && GST_IS_ELEMENT (parent)) {
+ eparent = GST_ELEMENT_CAST (gst_object_ref (parent));
+ } else {
GST_OBJECT_LOCK (pad);
- parent = GST_PAD_PARENT (pad);
- if (!parent || !GST_IS_ELEMENT (parent))
+ eparent = GST_PAD_PARENT (pad);
+ if (!eparent || !GST_IS_ELEMENT (eparent))
goto no_parent;
- gst_object_ref (parent);
+ gst_object_ref (eparent);
GST_OBJECT_UNLOCK (pad);
+ }
- if (pad->direction == GST_PAD_SRC)
- padlist = &parent->sinkpads;
- else
- padlist = &parent->srcpads;
+ if (pad->direction == GST_PAD_SRC)
+ padlist = &eparent->sinkpads;
+ else
+ padlist = &eparent->srcpads;
- GST_DEBUG_OBJECT (pad, "Making iterator");
+ GST_DEBUG_OBJECT (pad, "Making iterator");
- cookie = &parent->pads_cookie;
- owner = parent;
- lock = GST_OBJECT_GET_LOCK (parent);
- }
+ cookie = &eparent->pads_cookie;
+ owner = eparent;
+ lock = GST_OBJECT_GET_LOCK (eparent);
res = gst_iterator_new_list (GST_TYPE_PAD,
lock, cookie, padlist, (GObject *) owner, NULL);
@@ -2484,7 +2486,7 @@ gst_pad_iterate_internal_links (GstPad * pad)
GST_OBJECT_UNLOCK (pad);
if (GST_PAD_ITERINTLINKFUNC (pad))
- res = GST_PAD_ITERINTLINKFUNC (pad) (pad);
+ res = GST_PAD_ITERINTLINKFUNC (pad) (pad, parent);
RELEASE_PARENT (parent);
diff --git a/gst/gstpad.h b/gst/gstpad.h
index f377631f6..749b14dc2 100644
--- a/gst/gstpad.h
+++ b/gst/gstpad.h
@@ -353,6 +353,9 @@ typedef gboolean (*GstPadEventFunction) (GstPad *pad, GstEvent *event);
/**
* GstPadIterIntLinkFunction:
* @pad: The #GstPad to query.
+ * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
+ * @parent is guaranteed to be not-NULL and remain valid during the
+ * execution of this function.
*
* The signature of the internal pad link iterator function.
*
@@ -363,7 +366,7 @@ typedef gboolean (*GstPadEventFunction) (GstPad *pad, GstEvent *event);
*
* Since 0.10.21
*/
-typedef GstIterator* (*GstPadIterIntLinkFunction) (GstPad *pad);
+typedef GstIterator* (*GstPadIterIntLinkFunction) (GstPad *pad, GstObject *parent);
/* generic query function */
/**
@@ -876,7 +879,7 @@ gboolean gst_pad_stop_task (GstPad *pad);
void gst_pad_set_iterate_internal_links_function (GstPad * pad,
GstPadIterIntLinkFunction iterintlink);
GstIterator * gst_pad_iterate_internal_links (GstPad * pad);
-GstIterator * gst_pad_iterate_internal_links_default (GstPad * pad);
+GstIterator * gst_pad_iterate_internal_links_default (GstPad * pad, GstObject *parent);
/* generic query function */
diff --git a/plugins/elements/gstinputselector.c b/plugins/elements/gstinputselector.c
index 2bade08ce..1b9c43907 100644
--- a/plugins/elements/gstinputselector.c
+++ b/plugins/elements/gstinputselector.c
@@ -181,7 +181,8 @@ static void gst_selector_pad_reset (GstSelectorPad * pad);
static gboolean gst_selector_pad_event (GstPad * pad, GstEvent * event);
static gboolean gst_selector_pad_query (GstPad * pad, GstObject * parent,
GstQuery * query);
-static GstIterator *gst_selector_pad_iterate_linked_pads (GstPad * pad);
+static GstIterator *gst_selector_pad_iterate_linked_pads (GstPad * pad,
+ GstObject * parent);
static GstFlowReturn gst_selector_pad_chain (GstPad * pad, GstBuffer * buf);
G_DEFINE_TYPE (GstSelectorPad, gst_selector_pad, GST_TYPE_PAD);
@@ -330,14 +331,14 @@ gst_selector_pad_reset (GstSelectorPad * pad)
/* strictly get the linked pad from the sinkpad. If the pad is active we return
* the srcpad else we return NULL */
static GstIterator *
-gst_selector_pad_iterate_linked_pads (GstPad * pad)
+gst_selector_pad_iterate_linked_pads (GstPad * pad, GstObject * parent)
{
GstInputSelector *sel;
GstPad *otherpad;
GstIterator *it = NULL;
GValue val = { 0, };
- sel = GST_INPUT_SELECTOR (GST_PAD_PARENT (pad));
+ sel = GST_INPUT_SELECTOR (parent);
otherpad = gst_input_selector_get_linked_pad (sel, pad, TRUE);
if (otherpad) {
diff --git a/plugins/elements/gstmultiqueue.c b/plugins/elements/gstmultiqueue.c
index ca1c45bed..3a14394d2 100644
--- a/plugins/elements/gstmultiqueue.c
+++ b/plugins/elements/gstmultiqueue.c
@@ -575,12 +575,12 @@ gst_multi_queue_get_property (GObject * object, guint prop_id,
}
static GstIterator *
-gst_multi_queue_iterate_internal_links (GstPad * pad)
+gst_multi_queue_iterate_internal_links (GstPad * pad, GstObject * parent)
{
GstIterator *it = NULL;
GstPad *opad;
GstSingleQueue *squeue;
- GstMultiQueue *mq = GST_MULTI_QUEUE (GST_PAD_PARENT (pad));
+ GstMultiQueue *mq = GST_MULTI_QUEUE (parent);
GValue val = { 0, };
GST_MULTI_QUEUE_MUTEX_LOCK (mq);