mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-12 11:26:39 +00:00
Added gst_element_remove_pad. more refcounting stuff (object unparent on destroy)
Original commit message from CVS: Added gst_element_remove_pad. more refcounting stuff (object unparent on destroy)
This commit is contained in:
parent
d5cb52427f
commit
b42e262efe
3 changed files with 52 additions and 5 deletions
|
@ -33,7 +33,9 @@
|
||||||
enum {
|
enum {
|
||||||
STATE_CHANGE,
|
STATE_CHANGE,
|
||||||
NEW_PAD,
|
NEW_PAD,
|
||||||
|
PAD_REMOVED,
|
||||||
NEW_GHOST_PAD,
|
NEW_GHOST_PAD,
|
||||||
|
GHOST_PAD_REMOVED,
|
||||||
ERROR,
|
ERROR,
|
||||||
EOS,
|
EOS,
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
|
@ -100,11 +102,21 @@ gst_element_class_init (GstElementClass *klass)
|
||||||
GTK_SIGNAL_OFFSET (GstElementClass, new_pad),
|
GTK_SIGNAL_OFFSET (GstElementClass, new_pad),
|
||||||
gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
|
gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
|
||||||
GST_TYPE_PAD);
|
GST_TYPE_PAD);
|
||||||
|
gst_element_signals[PAD_REMOVED] =
|
||||||
|
gtk_signal_new ("pad_removed", GTK_RUN_LAST, gtkobject_class->type,
|
||||||
|
GTK_SIGNAL_OFFSET (GstElementClass, pad_removed),
|
||||||
|
gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
|
||||||
|
GST_TYPE_PAD);
|
||||||
gst_element_signals[NEW_GHOST_PAD] =
|
gst_element_signals[NEW_GHOST_PAD] =
|
||||||
gtk_signal_new ("new_ghost_pad", GTK_RUN_LAST, gtkobject_class->type,
|
gtk_signal_new ("new_ghost_pad", GTK_RUN_LAST, gtkobject_class->type,
|
||||||
GTK_SIGNAL_OFFSET (GstElementClass, new_ghost_pad),
|
GTK_SIGNAL_OFFSET (GstElementClass, new_ghost_pad),
|
||||||
gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
|
gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
|
||||||
GST_TYPE_PAD);
|
GST_TYPE_PAD);
|
||||||
|
gst_element_signals[GHOST_PAD_REMOVED] =
|
||||||
|
gtk_signal_new ("ghost_pad_removed", GTK_RUN_LAST, gtkobject_class->type,
|
||||||
|
GTK_SIGNAL_OFFSET (GstElementClass, ghost_pad_removed),
|
||||||
|
gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
|
||||||
|
GST_TYPE_PAD);
|
||||||
gst_element_signals[ERROR] =
|
gst_element_signals[ERROR] =
|
||||||
gtk_signal_new ("error", GTK_RUN_LAST, gtkobject_class->type,
|
gtk_signal_new ("error", GTK_RUN_LAST, gtkobject_class->type,
|
||||||
GTK_SIGNAL_OFFSET (GstElementClass, error),
|
GTK_SIGNAL_OFFSET (GstElementClass, error),
|
||||||
|
@ -296,6 +308,36 @@ gst_element_add_pad (GstElement *element, GstPad *pad)
|
||||||
gtk_signal_emit (GTK_OBJECT (element), gst_element_signals[NEW_PAD], pad);
|
gtk_signal_emit (GTK_OBJECT (element), gst_element_signals[NEW_PAD], pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_element_remove_pad:
|
||||||
|
* @element: element to remove pad from
|
||||||
|
* @pad: pad to remove
|
||||||
|
*
|
||||||
|
* Remove a pad (connection point) from the element,
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gst_element_remove_pad (GstElement *element, GstPad *pad)
|
||||||
|
{
|
||||||
|
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_if_fail (GST_PAD_PARENT (pad) == element);
|
||||||
|
|
||||||
|
/* add it to the list */
|
||||||
|
element->pads = g_list_remove (element->pads, pad);
|
||||||
|
element->numpads--;
|
||||||
|
if (gst_pad_get_direction (pad) == GST_PAD_SRC)
|
||||||
|
element->numsrcpads--;
|
||||||
|
else
|
||||||
|
element->numsinkpads--;
|
||||||
|
|
||||||
|
gtk_signal_emit (GTK_OBJECT (element), gst_element_signals[NEW_PAD], pad);
|
||||||
|
|
||||||
|
gst_object_unparent (GST_OBJECT (pad));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_element_add_ghost_pad:
|
* gst_element_add_ghost_pad:
|
||||||
* @element: element to add ghost pad to
|
* @element: element to add ghost pad to
|
||||||
|
|
|
@ -166,11 +166,13 @@ struct _GstElementClass {
|
||||||
GstElementFactory *elementfactory;
|
GstElementFactory *elementfactory;
|
||||||
|
|
||||||
/* signal callbacks */
|
/* signal callbacks */
|
||||||
void (*state_change) (GstElement *element,GstElementState state);
|
void (*state_change) (GstElement *element,GstElementState state);
|
||||||
void (*new_pad) (GstElement *element,GstPad *pad);
|
void (*new_pad) (GstElement *element,GstPad *pad);
|
||||||
void (*new_ghost_pad) (GstElement *element,GstPad *pad);
|
void (*pad_removed) (GstElement *element,GstPad *pad);
|
||||||
void (*error) (GstElement *element,gchar *error);
|
void (*new_ghost_pad) (GstElement *element,GstPad *pad);
|
||||||
void (*eos) (GstElement *element);
|
void (*ghost_pad_removed) (GstElement *element,GstPad *pad);
|
||||||
|
void (*error) (GstElement *element,gchar *error);
|
||||||
|
void (*eos) (GstElement *element);
|
||||||
|
|
||||||
/* local pointers for get/set */
|
/* local pointers for get/set */
|
||||||
void (*set_arg) (GtkObject *object,
|
void (*set_arg) (GtkObject *object,
|
||||||
|
@ -222,6 +224,7 @@ void gst_element_set_sched (GstElement *element, GstSchedule *sched);
|
||||||
GstSchedule* gst_element_get_sched (GstElement *element);
|
GstSchedule* gst_element_get_sched (GstElement *element);
|
||||||
|
|
||||||
void gst_element_add_pad (GstElement *element, GstPad *pad);
|
void gst_element_add_pad (GstElement *element, GstPad *pad);
|
||||||
|
void gst_element_remove_pad (GstElement *element, GstPad *pad);
|
||||||
GstPad* gst_element_get_pad (GstElement *element, const gchar *name);
|
GstPad* gst_element_get_pad (GstElement *element, const gchar *name);
|
||||||
GList* gst_element_get_pad_list (GstElement *element);
|
GList* gst_element_get_pad_list (GstElement *element);
|
||||||
GList* gst_element_get_padtemplate_list (GstElement *element);
|
GList* gst_element_get_padtemplate_list (GstElement *element);
|
||||||
|
|
|
@ -238,6 +238,8 @@ gst_object_real_destroy (GtkObject *gtk_object)
|
||||||
{
|
{
|
||||||
GST_DEBUG (GST_CAT_REFCOUNTING, "destroy\n");
|
GST_DEBUG (GST_CAT_REFCOUNTING, "destroy\n");
|
||||||
|
|
||||||
|
GST_OBJECT_PARENT (gtk_object) = NULL;
|
||||||
|
|
||||||
parent_class->destroy (gtk_object);
|
parent_class->destroy (gtk_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue