mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
pad: Add parent parameter to the link and unlink functions
Fixes part of bug #683995.
This commit is contained in:
parent
c2175db889
commit
de635d089f
3 changed files with 37 additions and 10 deletions
29
gst/gstpad.c
29
gst/gstpad.c
|
@ -1836,11 +1836,23 @@ gst_pad_unlink (GstPad * srcpad, GstPad * sinkpad)
|
||||||
goto not_linked_together;
|
goto not_linked_together;
|
||||||
|
|
||||||
if (GST_PAD_UNLINKFUNC (srcpad)) {
|
if (GST_PAD_UNLINKFUNC (srcpad)) {
|
||||||
GST_PAD_UNLINKFUNC (srcpad) (srcpad);
|
GstObject *tmpparent;
|
||||||
|
|
||||||
|
ACQUIRE_PARENT (srcpad, tmpparent, no_src_parent);
|
||||||
|
|
||||||
|
GST_PAD_UNLINKFUNC (srcpad) (srcpad, tmpparent);
|
||||||
|
RELEASE_PARENT (parent);
|
||||||
}
|
}
|
||||||
|
no_src_parent:
|
||||||
if (GST_PAD_UNLINKFUNC (sinkpad)) {
|
if (GST_PAD_UNLINKFUNC (sinkpad)) {
|
||||||
GST_PAD_UNLINKFUNC (sinkpad) (sinkpad);
|
GstObject *tmpparent;
|
||||||
|
|
||||||
|
ACQUIRE_PARENT (sinkpad, tmpparent, no_sink_parent);
|
||||||
|
|
||||||
|
GST_PAD_UNLINKFUNC (sinkpad) (sinkpad, tmpparent);
|
||||||
|
RELEASE_PARENT (parent);
|
||||||
}
|
}
|
||||||
|
no_sink_parent:
|
||||||
|
|
||||||
/* first clear peers */
|
/* first clear peers */
|
||||||
GST_PAD_PEER (srcpad) = NULL;
|
GST_PAD_PEER (srcpad) = NULL;
|
||||||
|
@ -2210,13 +2222,22 @@ gst_pad_link_full (GstPad * srcpad, GstPad * sinkpad, GstPadLinkCheck flags)
|
||||||
GST_OBJECT_UNLOCK (srcpad);
|
GST_OBJECT_UNLOCK (srcpad);
|
||||||
|
|
||||||
if (srcfunc) {
|
if (srcfunc) {
|
||||||
|
GstObject *tmpparent;
|
||||||
|
|
||||||
|
ACQUIRE_PARENT (srcpad, tmpparent, no_parent);
|
||||||
/* this one will call the peer link function */
|
/* this one will call the peer link function */
|
||||||
result = srcfunc (srcpad, sinkpad);
|
result = srcfunc (srcpad, tmpparent, sinkpad);
|
||||||
|
RELEASE_PARENT (tmpparent);
|
||||||
} else if (sinkfunc) {
|
} else if (sinkfunc) {
|
||||||
|
GstObject *tmpparent;
|
||||||
|
|
||||||
|
ACQUIRE_PARENT (sinkpad, tmpparent, no_parent);
|
||||||
/* if no source link function, we need to call the sink link
|
/* if no source link function, we need to call the sink link
|
||||||
* function ourselves. */
|
* function ourselves. */
|
||||||
result = sinkfunc (sinkpad, srcpad);
|
result = sinkfunc (sinkpad, tmpparent, srcpad);
|
||||||
|
RELEASE_PARENT (tmpparent);
|
||||||
}
|
}
|
||||||
|
no_parent:
|
||||||
|
|
||||||
GST_OBJECT_LOCK (srcpad);
|
GST_OBJECT_LOCK (srcpad);
|
||||||
GST_OBJECT_LOCK (sinkpad);
|
GST_OBJECT_LOCK (sinkpad);
|
||||||
|
|
10
gst/gstpad.h
10
gst/gstpad.h
|
@ -396,20 +396,26 @@ typedef gboolean (*GstPadQueryFunction) (GstPad *pad, GstObject *parent,
|
||||||
/**
|
/**
|
||||||
* GstPadLinkFunction:
|
* GstPadLinkFunction:
|
||||||
* @pad: the #GstPad that is linked.
|
* @pad: the #GstPad that is linked.
|
||||||
|
* @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.
|
||||||
* @peer: the peer #GstPad of the link
|
* @peer: the peer #GstPad of the link
|
||||||
*
|
*
|
||||||
* Function signature to handle a new link on the pad.
|
* Function signature to handle a new link on the pad.
|
||||||
*
|
*
|
||||||
* Returns: the result of the link with the specified peer.
|
* Returns: the result of the link with the specified peer.
|
||||||
*/
|
*/
|
||||||
typedef GstPadLinkReturn (*GstPadLinkFunction) (GstPad *pad, GstPad *peer);
|
typedef GstPadLinkReturn (*GstPadLinkFunction) (GstPad *pad, GstObject *parent, GstPad *peer);
|
||||||
/**
|
/**
|
||||||
* GstPadUnlinkFunction:
|
* GstPadUnlinkFunction:
|
||||||
* @pad: the #GstPad that is linked.
|
* @pad: the #GstPad that is linked.
|
||||||
|
* @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.
|
||||||
*
|
*
|
||||||
* Function signature to handle a unlinking the pad prom its peer.
|
* Function signature to handle a unlinking the pad prom its peer.
|
||||||
*/
|
*/
|
||||||
typedef void (*GstPadUnlinkFunction) (GstPad *pad);
|
typedef void (*GstPadUnlinkFunction) (GstPad *pad, GstObject *parent);
|
||||||
|
|
||||||
|
|
||||||
/* misc */
|
/* misc */
|
||||||
|
|
|
@ -802,7 +802,7 @@ static gint linked_count2;
|
||||||
static gint unlinked_count2;
|
static gint unlinked_count2;
|
||||||
|
|
||||||
static GstPadLinkReturn
|
static GstPadLinkReturn
|
||||||
pad_linked1 (GstPad * pad, GstPad * peer)
|
pad_linked1 (GstPad * pad, GstObject * parent, GstPad * peer)
|
||||||
{
|
{
|
||||||
linked_count1++;
|
linked_count1++;
|
||||||
|
|
||||||
|
@ -810,13 +810,13 @@ pad_linked1 (GstPad * pad, GstPad * peer)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pad_unlinked1 (GstPad * pad)
|
pad_unlinked1 (GstPad * pad, GstObject * parent)
|
||||||
{
|
{
|
||||||
unlinked_count1++;
|
unlinked_count1++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstPadLinkReturn
|
static GstPadLinkReturn
|
||||||
pad_linked2 (GstPad * pad, GstPad * peer)
|
pad_linked2 (GstPad * pad, GstObject * parent, GstPad * peer)
|
||||||
{
|
{
|
||||||
linked_count2++;
|
linked_count2++;
|
||||||
|
|
||||||
|
@ -824,7 +824,7 @@ pad_linked2 (GstPad * pad, GstPad * peer)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pad_unlinked2 (GstPad * pad)
|
pad_unlinked2 (GstPad * pad, GstObject * parent)
|
||||||
{
|
{
|
||||||
unlinked_count2++;
|
unlinked_count2++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue