From e81fbd612f6fa964abdcc8689573f18c6a22658f Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 15 Jan 2004 03:03:15 +0000 Subject: [PATCH] gst/gstpad.*: implement gst_pad_is_linked Original commit message from CVS: 2004-01-15 Benjamin Otte * gst/gstpad.c: (gst_pad_is_linked): * gst/gstpad.h: implement gst_pad_is_linked * gst/gstelement.h: reserve space for initiate_state_change --- ChangeLog | 8 ++++++++ gst/gstelement.h | 3 ++- gst/gstpad.c | 16 ++++++++++++++++ gst/gstpad.h | 1 + 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6d47cb11dd..809a2da00a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-01-15 Benjamin Otte + + * gst/gstpad.c: (gst_pad_is_linked): + * gst/gstpad.h: + implement gst_pad_is_linked + * gst/gstelement.h: + reserve space for initiate_state_change + 2004-01-15 Benjamin Otte * gst/autoplug/gstspideridentity.c: diff --git a/gst/gstelement.h b/gst/gstelement.h index e8403249e9..6b07468966 100644 --- a/gst/gstelement.h +++ b/gst/gstelement.h @@ -218,6 +218,7 @@ struct _GstElementClass { GstFormat *format, gint64 *value); /* change the element state */ + GstElementStateReturn (*initiate_state_change)(GstElement *element, GstElementState state); GstElementStateReturn (*change_state) (GstElement *element); /* request/release pads */ @@ -232,7 +233,7 @@ struct _GstElementClass { GstIndex* (*get_index) (GstElement *element); void (*set_index) (GstElement *element, GstIndex *index); - gpointer _gst_reserved[GST_PADDING]; + gpointer _gst_reserved[GST_PADDING - 1]; }; void gst_element_class_add_pad_template (GstElementClass *klass, GstPadTemplate *templ); diff --git a/gst/gstpad.c b/gst/gstpad.c index 877d1ba332..58b1883af0 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -953,6 +953,22 @@ gst_pad_unlink (GstPad *srcpad, gst_object_unref (GST_OBJECT (realsink)); } +/** + * gst_pad_is_linked: + * @pad: pad to check + * + * Checks if a given pad is linked to another pad or not. + * + * Returns: TRUE if the pad is linked. + */ +gboolean +gst_pad_is_linked (GstPad *pad) +{ + g_return_val_if_fail (GST_IS_PAD (pad), FALSE); + + return GST_PAD_PEER (pad) != NULL; +} + struct _GstPadLink { GType type; diff --git a/gst/gstpad.h b/gst/gstpad.h index c0efb0f83f..2b96c3bbc1 100644 --- a/gst/gstpad.h +++ b/gst/gstpad.h @@ -400,6 +400,7 @@ 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, const GstCaps *filtercaps); void gst_pad_unlink (GstPad *srcpad, GstPad *sinkpad); +gboolean gst_pad_is_linked (GstPad *pad); GstPad* gst_pad_get_peer (GstPad *pad);