mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
Add pad->unlinkfunc and gst_pad_set_unlink_function()
Original commit message from CVS: Add pad->unlinkfunc and gst_pad_set_unlink_function()
This commit is contained in:
parent
98670720c1
commit
4f207a7a8b
2 changed files with 31 additions and 0 deletions
27
gst/gstpad.c
27
gst/gstpad.c
|
@ -760,6 +760,26 @@ gst_pad_set_link_function (GstPad *pad,
|
|||
GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (link));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_pad_set_unlink_function:
|
||||
* @pad: a #GstPad to set the unlink function for.
|
||||
* @unlink: the #GstPadUnlinkFunction to set.
|
||||
*
|
||||
* Sets the given unlink function for the pad. It will be called
|
||||
* when the pad is unlinked.
|
||||
*/
|
||||
void
|
||||
gst_pad_set_unlink_function (GstPad *pad,
|
||||
GstPadUnlinkFunction unlink)
|
||||
{
|
||||
g_return_if_fail (pad != NULL);
|
||||
g_return_if_fail (GST_IS_REAL_PAD (pad));
|
||||
|
||||
GST_RPAD_UNLINKFUNC (pad) = unlink;
|
||||
GST_CAT_DEBUG (GST_CAT_PADS, "unlinkfunc for %s:%s set to %s",
|
||||
GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (unlink));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_pad_set_getcaps_function:
|
||||
* @pad: a #GstPad to set the getcaps function for.
|
||||
|
@ -841,6 +861,13 @@ gst_pad_unlink (GstPad *srcpad,
|
|||
g_return_if_fail ((GST_RPAD_DIRECTION (realsrc) == GST_PAD_SRC) &&
|
||||
(GST_RPAD_DIRECTION (realsink) == GST_PAD_SINK));
|
||||
|
||||
if (GST_RPAD_UNLINKFUNC (srcpad)) {
|
||||
GST_RPAD_UNLINKFUNC (srcpad) (srcpad);
|
||||
}
|
||||
if (GST_RPAD_UNLINKFUNC (sinkpad)) {
|
||||
GST_RPAD_UNLINKFUNC (sinkpad) (sinkpad);
|
||||
}
|
||||
|
||||
/* get the schedulers before we unlink */
|
||||
src_sched = gst_pad_get_scheduler (GST_PAD_CAST (realsrc));
|
||||
sink_sched = gst_pad_get_scheduler (GST_PAD_CAST (realsink));
|
||||
|
|
|
@ -147,6 +147,7 @@ typedef const GstEventMask* (*GstPadEventMaskFunction) (GstPad *pad);
|
|||
typedef const GstQueryType* (*GstPadQueryTypeFunction) (GstPad *pad);
|
||||
|
||||
typedef GstPadLinkReturn (*GstPadLinkFunction) (GstPad *pad, GstCaps *caps);
|
||||
typedef void (*GstPadUnlinkFunction) (GstPad *pad);
|
||||
typedef GstCaps* (*GstPadGetCapsFunction) (GstPad *pad, GstCaps *caps);
|
||||
typedef GstBufferPool* (*GstPadBufferPoolFunction) (GstPad *pad);
|
||||
|
||||
|
@ -189,6 +190,7 @@ struct _GstRealPad {
|
|||
GstPadDirection direction;
|
||||
|
||||
GstPadLinkFunction linkfunc;
|
||||
GstPadUnlinkFunction unlinkfunc;
|
||||
GstRealPad *peer;
|
||||
|
||||
gpointer sched_private;
|
||||
|
@ -264,6 +266,7 @@ struct _GstGhostPadClass {
|
|||
#define GST_RPAD_EVENTMASKFUNC(pad) (((GstRealPad *)(pad))->eventmaskfunc)
|
||||
|
||||
#define GST_RPAD_LINKFUNC(pad) (((GstRealPad *)(pad))->linkfunc)
|
||||
#define GST_RPAD_UNLINKFUNC(pad) (((GstRealPad *)(pad))->unlinkfunc)
|
||||
#define GST_RPAD_GETCAPSFUNC(pad) (((GstRealPad *)(pad))->getcapsfunc)
|
||||
#define GST_RPAD_BUFFERPOOLFUNC(pad) (((GstRealPad *)(pad))->bufferpoolfunc)
|
||||
|
||||
|
@ -426,6 +429,7 @@ const GstEventMask* gst_pad_get_event_masks_default (GstPad *pad);
|
|||
void gst_pad_set_link_function (GstPad *pad, GstPadLinkFunction link);
|
||||
gboolean gst_pad_can_link (GstPad *srcpad, GstPad *sinkpad);
|
||||
gboolean gst_pad_can_link_filtered (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps);
|
||||
void gst_pad_set_unlink_function (GstPad *pad, GstPadUnlinkFunction unlink);
|
||||
|
||||
gboolean gst_pad_link (GstPad *srcpad, GstPad *sinkpad);
|
||||
gboolean gst_pad_link_filtered (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps);
|
||||
|
|
Loading…
Reference in a new issue