add parent to internal links

This commit is contained in:
Wim Taymans 2011-11-16 17:49:46 +01:00
parent 09a8294d36
commit 361a7ae44d
6 changed files with 35 additions and 28 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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,39 +2405,40 @@ 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;
GST_DEBUG_OBJECT (pad, "Making iterator");
cookie = &parent->pads_cookie;
owner = parent;
lock = GST_OBJECT_GET_LOCK (parent);
}
if (pad->direction == GST_PAD_SRC)
padlist = &eparent->sinkpads;
else
padlist = &eparent->srcpads;
GST_DEBUG_OBJECT (pad, "Making iterator");
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);

View file

@ -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 */

View file

@ -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) {

View file

@ -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);