From e7b9b683613f64fa8a34f3a766ffb4b074fa7a78 Mon Sep 17 00:00:00 2001 From: Stefan Sauer Date: Fri, 30 Mar 2012 22:46:02 +0200 Subject: [PATCH] childproxy: include the child name in the signal --- gst/gstbin.c | 10 ++++++---- gst/gstchildproxy.c | 18 ++++++++++++------ gst/gstchildproxy.h | 6 ++++-- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/gst/gstbin.c b/gst/gstbin.c index 0ef7bd9..665259e 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -1160,10 +1160,11 @@ no_state_recalc: GST_CAT_DEBUG_OBJECT (GST_CAT_PARENTAGE, bin, "added element \"%s\"", elem_name); - g_free (elem_name); g_signal_emit (bin, gst_bin_signals[ELEMENT_ADDED], 0, element); - gst_child_proxy_child_added ((GObject *) bin, (GObject *) element); + gst_child_proxy_child_added ((GObject *) bin, (GObject *) element, elem_name); + + g_free (elem_name); return TRUE; @@ -1480,7 +1481,6 @@ no_state_recalc: GST_CAT_INFO_OBJECT (GST_CAT_PARENTAGE, bin, "removed child \"%s\"", elem_name); - g_free (elem_name); gst_element_set_bus (element, NULL); @@ -1497,8 +1497,10 @@ no_state_recalc: GST_OBJECT_UNLOCK (element); g_signal_emit (bin, gst_bin_signals[ELEMENT_REMOVED], 0, element); - gst_child_proxy_child_removed ((GObject *) bin, (GObject *) element); + gst_child_proxy_child_removed ((GObject *) bin, (GObject *) element, + elem_name); + g_free (elem_name); /* element is really out of our control now */ gst_object_unref (element); diff --git a/gst/gstchildproxy.c b/gst/gstchildproxy.c index 1f37554..2b3c480 100644 --- a/gst/gstchildproxy.c +++ b/gst/gstchildproxy.c @@ -452,26 +452,30 @@ gst_child_proxy_set (GObject * object, const gchar * first_property_name, ...) * gst_child_proxy_child_added: * @object: the parent object * @child: the newly added child + * @name: the name of the new child * * Emits the "child-added" signal. */ void -gst_child_proxy_child_added (GObject * object, GObject * child) +gst_child_proxy_child_added (GObject * object, GObject * child, + const gchar * name) { - g_signal_emit (G_OBJECT (object), signals[CHILD_ADDED], 0, child); + g_signal_emit (G_OBJECT (object), signals[CHILD_ADDED], 0, child, name); } /** * gst_child_proxy_child_removed: * @object: the parent object * @child: the removed child + * @name: the name of the old child * * Emits the "child-removed" signal. */ void -gst_child_proxy_child_removed (GObject * object, GObject * child) +gst_child_proxy_child_removed (GObject * object, GObject * child, + const gchar * name) { - g_signal_emit (G_OBJECT (object), signals[CHILD_REMOVED], 0, child); + g_signal_emit (G_OBJECT (object), signals[CHILD_REMOVED], 0, child, name); } /* gobject methods */ @@ -495,6 +499,7 @@ gst_child_proxy_base_init (gpointer g_class) * GstChildProxy::child-added: * @child_proxy: the #GstChildProxy * @object: the #GObject that was added + * @name: the name of the new child * * Will be emitted after the @object was added to the @child_proxy. */ @@ -502,12 +507,13 @@ gst_child_proxy_base_init (gpointer g_class) g_signal_new ("child-added", G_TYPE_FROM_CLASS (g_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GstChildProxyInterface, child_added), NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, - 1, G_TYPE_OBJECT); + 2, G_TYPE_OBJECT, G_TYPE_STRING); /** * GstChildProxy::child-removed: * @child_proxy: the #GstChildProxy * @object: the #GObject that was removed + * @name: the name of the old child * * Will be emitted after the @object was removed from the @child_proxy. */ @@ -515,7 +521,7 @@ gst_child_proxy_base_init (gpointer g_class) g_signal_new ("child-removed", G_TYPE_FROM_CLASS (g_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GstChildProxyInterface, child_removed), NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, - 1, G_TYPE_OBJECT); + 2, G_TYPE_OBJECT, G_TYPE_STRING); initialized = TRUE; } diff --git a/gst/gstchildproxy.h b/gst/gstchildproxy.h index d8b9429..94e2011 100644 --- a/gst/gstchildproxy.h +++ b/gst/gstchildproxy.h @@ -95,8 +95,10 @@ void gst_child_proxy_set (GObject * object, const gchar * first_property_name, ...) G_GNUC_NULL_TERMINATED; -void gst_child_proxy_child_added (GObject * object, GObject * child); -void gst_child_proxy_child_removed (GObject * object, GObject * child); +void gst_child_proxy_child_added (GObject * object, GObject * child, + const gchar *name); +void gst_child_proxy_child_removed (GObject * object, GObject * child, + const gchar *name); G_END_DECLS -- 2.7.4