mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-12 03:16:33 +00:00
More housekeeping updates. _destroying an element or a pad properly removes if from the parent.
Original commit message from CVS: More housekeeping updates. _destroying an element or a pad properly removes if from the parent.
This commit is contained in:
parent
6f9ac3667b
commit
3e44dbdb6e
3 changed files with 43 additions and 9 deletions
|
@ -333,14 +333,15 @@ gst_bin_remove (GstBin *bin,
|
||||||
gst_bin_unset_element_sched (element);
|
gst_bin_unset_element_sched (element);
|
||||||
|
|
||||||
// now remove the element from the list of elements
|
// now remove the element from the list of elements
|
||||||
gst_object_unparent (GST_OBJECT (element));
|
|
||||||
bin->children = g_list_remove (bin->children, element);
|
bin->children = g_list_remove (bin->children, element);
|
||||||
bin->numchildren--;
|
bin->numchildren--;
|
||||||
|
|
||||||
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, bin, "removed child %s", GST_ELEMENT_NAME (element));
|
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, bin, "removed child %s", GST_ELEMENT_NAME (element));
|
||||||
|
|
||||||
|
gst_object_unparent (GST_OBJECT (element));
|
||||||
|
|
||||||
/* if we're down to zero children, force state to NULL */
|
/* if we're down to zero children, force state to NULL */
|
||||||
if (bin->numchildren == 0)
|
if (bin->numchildren == 0 && GST_ELEMENT_SCHED (bin) != NULL)
|
||||||
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL);
|
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -505,7 +506,8 @@ gst_bin_real_destroy (GtkObject *object)
|
||||||
children = bin->children;
|
children = bin->children;
|
||||||
while (children) {
|
while (children) {
|
||||||
child = GST_ELEMENT (children->data);
|
child = GST_ELEMENT (children->data);
|
||||||
gst_object_unref (GST_OBJECT (child));
|
//gst_object_unref (GST_OBJECT (child));
|
||||||
|
gst_object_unparent (GST_OBJECT (child));
|
||||||
children = g_list_next (children);
|
children = g_list_next (children);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ static void gst_element_init (GstElement *element);
|
||||||
static void gst_element_set_arg (GtkObject *object, GtkArg *arg, guint id);
|
static void gst_element_set_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||||
static void gst_element_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
static void gst_element_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||||
|
|
||||||
|
static void gst_element_shutdown (GtkObject *object);
|
||||||
static void gst_element_real_destroy (GtkObject *object);
|
static void gst_element_real_destroy (GtkObject *object);
|
||||||
|
|
||||||
static GstElementStateReturn gst_element_change_state (GstElement *element);
|
static GstElementStateReturn gst_element_change_state (GstElement *element);
|
||||||
|
@ -132,6 +133,7 @@ gst_element_class_init (GstElementClass *klass)
|
||||||
|
|
||||||
gtkobject_class->set_arg = GST_DEBUG_FUNCPTR(gst_element_set_arg);
|
gtkobject_class->set_arg = GST_DEBUG_FUNCPTR(gst_element_set_arg);
|
||||||
gtkobject_class->get_arg = GST_DEBUG_FUNCPTR(gst_element_get_arg);
|
gtkobject_class->get_arg = GST_DEBUG_FUNCPTR(gst_element_get_arg);
|
||||||
|
gtkobject_class->shutdown = GST_DEBUG_FUNCPTR(gst_element_shutdown);
|
||||||
gtkobject_class->destroy = GST_DEBUG_FUNCPTR(gst_element_real_destroy);
|
gtkobject_class->destroy = GST_DEBUG_FUNCPTR(gst_element_real_destroy);
|
||||||
|
|
||||||
gstobject_class->save_thyself = GST_DEBUG_FUNCPTR(gst_element_save_thyself);
|
gstobject_class->save_thyself = GST_DEBUG_FUNCPTR(gst_element_save_thyself);
|
||||||
|
@ -333,7 +335,7 @@ gst_element_remove_pad (GstElement *element, GstPad *pad)
|
||||||
else
|
else
|
||||||
element->numsinkpads--;
|
element->numsinkpads--;
|
||||||
|
|
||||||
gtk_signal_emit (GTK_OBJECT (element), gst_element_signals[NEW_PAD], pad);
|
gtk_signal_emit (GTK_OBJECT (element), gst_element_signals[PAD_REMOVED], pad);
|
||||||
|
|
||||||
gst_object_unparent (GST_OBJECT (pad));
|
gst_object_unparent (GST_OBJECT (pad));
|
||||||
}
|
}
|
||||||
|
@ -877,6 +879,20 @@ GST_ELEMENT_NAME(element),GST_ELEMENT_NAME(GST_ELEMENT_PARENT(element)),GST_ELEM
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_element_shutdown (GtkObject *object)
|
||||||
|
{
|
||||||
|
GstElement *element = GST_ELEMENT (object);
|
||||||
|
|
||||||
|
GST_DEBUG_ELEMENT (GST_CAT_REFCOUNTING, element, "shutdown\n");
|
||||||
|
|
||||||
|
if (GST_IS_BIN (GST_OBJECT_PARENT (element)))
|
||||||
|
gst_bin_remove (GST_BIN (GST_OBJECT_PARENT (element)), element);
|
||||||
|
|
||||||
|
if (GTK_OBJECT_CLASS (parent_class)->shutdown)
|
||||||
|
GTK_OBJECT_CLASS (parent_class)->shutdown (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_element_real_destroy (GtkObject *object)
|
gst_element_real_destroy (GtkObject *object)
|
||||||
{
|
{
|
||||||
|
@ -884,12 +900,12 @@ gst_element_real_destroy (GtkObject *object)
|
||||||
GList *pads;
|
GList *pads;
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
|
|
||||||
GST_DEBUG (GST_CAT_REFCOUNTING, "destroy\n");
|
GST_DEBUG_ELEMENT (GST_CAT_REFCOUNTING, element, "destroy\n");
|
||||||
|
|
||||||
pads = element->pads;
|
pads = element->pads;
|
||||||
while (pads) {
|
while (pads) {
|
||||||
pad = GST_PAD (pads->data);
|
pad = GST_PAD (pads->data);
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unparent (GST_OBJECT (pad));
|
||||||
pads = g_list_next (pads);
|
pads = g_list_next (pads);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
22
gst/gstpad.c
22
gst/gstpad.c
|
@ -97,6 +97,7 @@ static void gst_real_pad_init (GstRealPad *pad);
|
||||||
static void gst_real_pad_set_arg (GtkObject *object,GtkArg *arg,guint id);
|
static void gst_real_pad_set_arg (GtkObject *object,GtkArg *arg,guint id);
|
||||||
static void gst_real_pad_get_arg (GtkObject *object,GtkArg *arg,guint id);
|
static void gst_real_pad_get_arg (GtkObject *object,GtkArg *arg,guint id);
|
||||||
|
|
||||||
|
static void gst_real_pad_shutdown (GtkObject *object);
|
||||||
static void gst_real_pad_destroy (GtkObject *object);
|
static void gst_real_pad_destroy (GtkObject *object);
|
||||||
|
|
||||||
static void gst_pad_push_func (GstPad *pad, GstBuffer *buf);
|
static void gst_pad_push_func (GstPad *pad, GstBuffer *buf);
|
||||||
|
@ -161,9 +162,10 @@ gst_real_pad_class_init (GstRealPadClass *klass)
|
||||||
gtk_object_add_arg_type ("GstRealPad::active", GTK_TYPE_BOOL,
|
gtk_object_add_arg_type ("GstRealPad::active", GTK_TYPE_BOOL,
|
||||||
GTK_ARG_READWRITE, REAL_ARG_ACTIVE);
|
GTK_ARG_READWRITE, REAL_ARG_ACTIVE);
|
||||||
|
|
||||||
gtkobject_class->destroy = GST_DEBUG_FUNCPTR(gst_real_pad_destroy);
|
gtkobject_class->shutdown = GST_DEBUG_FUNCPTR(gst_real_pad_shutdown);
|
||||||
gtkobject_class->set_arg = GST_DEBUG_FUNCPTR(gst_real_pad_set_arg);
|
gtkobject_class->destroy = GST_DEBUG_FUNCPTR(gst_real_pad_destroy);
|
||||||
gtkobject_class->get_arg = GST_DEBUG_FUNCPTR(gst_real_pad_get_arg);
|
gtkobject_class->set_arg = GST_DEBUG_FUNCPTR(gst_real_pad_set_arg);
|
||||||
|
gtkobject_class->get_arg = GST_DEBUG_FUNCPTR(gst_real_pad_get_arg);
|
||||||
|
|
||||||
gstobject_class->save_thyself = GST_DEBUG_FUNCPTR(gst_pad_save_thyself);
|
gstobject_class->save_thyself = GST_DEBUG_FUNCPTR(gst_pad_save_thyself);
|
||||||
gstobject_class->path_string_separator = ".";
|
gstobject_class->path_string_separator = ".";
|
||||||
|
@ -1009,6 +1011,20 @@ gst_pad_get_bufferpool (GstPad *pad)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_real_pad_shutdown (GtkObject *object)
|
||||||
|
{
|
||||||
|
GstPad *pad = GST_PAD (object);
|
||||||
|
|
||||||
|
GST_DEBUG (GST_CAT_REFCOUNTING, "shutdown\n");
|
||||||
|
|
||||||
|
if (GST_IS_ELEMENT (GST_OBJECT_PARENT (pad)))
|
||||||
|
gst_element_remove_pad (GST_ELEMENT (GST_OBJECT_PARENT (pad)), pad);
|
||||||
|
|
||||||
|
if (GTK_OBJECT_CLASS (real_pad_parent_class)->shutdown)
|
||||||
|
GTK_OBJECT_CLASS (real_pad_parent_class)->shutdown (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_real_pad_destroy (GtkObject *object)
|
gst_real_pad_destroy (GtkObject *object)
|
||||||
|
|
Loading…
Reference in a new issue