From 6052a8876a9175c9cdf8cc850e721ae77f3757b3 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 26 Jan 2002 20:55:59 +0000 Subject: [PATCH] make add_ghost_pad return new pad instead of NULL Original commit message from CVS: make add_ghost_pad return new pad instead of NULL --- gst/gstelement.c | 16 ++++++++++------ gst/gstelement.h | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/gst/gstelement.c b/gst/gstelement.c index bb2414790b..effd6a8c90 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -350,19 +350,21 @@ gst_element_remove_pad (GstElement *element, GstPad *pad) * * Create a ghost pad from the given pad, and add it to the list of pads * for this element. + * + * Returns: the added ghost pad or NULL, if no ghost pad was created. */ -void +GstPad * gst_element_add_ghost_pad (GstElement *element, GstPad *pad, gchar *name) { GstPad *ghostpad; - g_return_if_fail (element != NULL); - g_return_if_fail (GST_IS_ELEMENT (element)); - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); + g_return_val_if_fail (element != NULL, NULL); + g_return_val_if_fail (GST_IS_ELEMENT (element), NULL); + g_return_val_if_fail (pad != NULL, NULL); + g_return_val_if_fail (GST_IS_PAD (pad), NULL); /* then check to see if there's already a pad by that name here */ - g_return_if_fail (gst_object_check_uniqueness (element->pads, name) == TRUE); + g_return_val_if_fail (gst_object_check_uniqueness (element->pads, name) == TRUE, NULL); GST_DEBUG(GST_CAT_ELEMENT_PADS,"creating new ghost pad called %s, from pad %s:%s\n", name,GST_DEBUG_PAD_NAME(pad)); @@ -380,6 +382,8 @@ gst_element_add_ghost_pad (GstElement *element, GstPad *pad, gchar *name) /* emit the NEW_GHOST_PAD signal */ g_signal_emit (G_OBJECT (element), gst_element_signals[NEW_PAD], 0, ghostpad); + + return ghostpad; } /** diff --git a/gst/gstelement.h b/gst/gstelement.h index 32eb78eea3..0c0c000f10 100644 --- a/gst/gstelement.h +++ b/gst/gstelement.h @@ -194,7 +194,7 @@ GstPad* gst_element_get_pad (GstElement *element, const gchar *name); GList* gst_element_get_pad_list (GstElement *element); GList* gst_element_get_padtemplate_list (GstElement *element); GstPadTemplate* gst_element_get_padtemplate_by_name (GstElement *element, const guchar *name); -void gst_element_add_ghost_pad (GstElement *element, GstPad *pad, gchar *name); +GstPad * gst_element_add_ghost_pad (GstElement *element, GstPad *pad, gchar *name); void gst_element_remove_ghost_pad (GstElement *element, GstPad *pad); GstPad* gst_element_request_compatible_pad (GstElement *element, GstPadTemplate *templ);