From 1123103926ad65689e0fae9bcd1d7b7c152fdec1 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 25 Mar 2003 19:39:18 +0000 Subject: [PATCH] - Added _LOCKED_STATE element flag Original commit message from CVS: - Added _LOCKED_STATE element flag - parent bin does not perform state changes on _LOCKED_STATE elements --- gst/gstbin.c | 15 +++++++++------ gst/gstelement.h | 15 ++++++++++----- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/gst/gstbin.c b/gst/gstbin.c index d269d8b446..e47196388a 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -431,6 +431,12 @@ gst_bin_add_func (GstBin *bin, GstElement *element) GstElementState state; GstScheduler *sched; + /* the element must not already have a parent */ + g_return_if_fail (GST_ELEMENT_PARENT (element) == NULL); + + /* must be not be in PLAYING state in order to modify bin */ + g_return_if_fail (GST_STATE (bin) != GST_STATE_PLAYING); + /* then check to see if the element's name is already taken in the bin */ if (gst_object_check_uniqueness (bin->children, GST_ELEMENT_NAME (element)) == FALSE) @@ -485,12 +491,6 @@ gst_bin_add (GstBin *bin, GstElement *element) GST_DEBUG (GST_CAT_PARENTAGE, "adding element \"%s\" to bin \"%s\"", GST_ELEMENT_NAME (element), GST_ELEMENT_NAME (bin)); - /* the element must not already have a parent */ - g_return_if_fail (GST_ELEMENT_PARENT (element) == NULL); - - /* must be not be in PLAYING state in order to modify bin */ - g_return_if_fail (GST_STATE (bin) != GST_STATE_PLAYING); - bclass = GST_BIN_GET_CLASS (bin); if (bclass->add_element) { @@ -694,6 +694,9 @@ gst_bin_change_state (GstElement * element) child = GST_ELEMENT (children->data); children = g_list_next (children); + if (GST_FLAG_IS_SET (child, GST_ELEMENT_LOCKED_STATE)) + continue; + old_child_state = GST_STATE (child); switch (gst_element_set_state (child, pending)) { diff --git a/gst/gstelement.h b/gst/gstelement.h index fe9a5448a7..26e0a1ec41 100644 --- a/gst/gstelement.h +++ b/gst/gstelement.h @@ -108,6 +108,9 @@ typedef enum { GST_ELEMENT_SCHEDULER_PRIVATE1, GST_ELEMENT_SCHEDULER_PRIVATE2, + /* ignore state changes from parent */ + GST_ELEMENT_LOCKED_STATE, + /* use some padding for future expansion */ GST_ELEMENT_FLAG_LAST = GST_OBJECT_FLAG_LAST + 16 } GstElementFlags; @@ -292,18 +295,20 @@ GList* gst_element_get_pad_template_list (GstElement *element); GstPadTemplate* gst_element_get_compatible_pad_template (GstElement *element, GstPadTemplate *compattempl); gboolean gst_element_link (GstElement *src, GstElement *dest); -gboolean gst_element_link_many (GstElement *element_1, GstElement *element_2, ...); +gboolean gst_element_link_many (GstElement *element_1, + GstElement *element_2, ...); gboolean gst_element_link_filtered (GstElement *src, GstElement *dest, GstCaps *filtercaps); void gst_element_unlink (GstElement *src, GstElement *dest); -void gst_element_unlink_many (GstElement *element_1, GstElement *element_2, ...); +void gst_element_unlink_many (GstElement *element_1, + GstElement *element_2, ...); -gboolean gst_element_link_pads (GstElement *src, const gchar *srcpadname, +gboolean gst_element_link_pads (GstElement *src, const gchar *srcpadname, GstElement *dest, const gchar *destpadname); -gboolean gst_element_link_pads_filtered (GstElement *src, const gchar *srcpadname, +gboolean gst_element_link_pads_filtered (GstElement *src, const gchar *srcpadname, GstElement *dest, const gchar *destpadname, GstCaps *filtercaps); -void gst_element_unlink_pads (GstElement *src, const gchar *srcpadname, +void gst_element_unlink_pads (GstElement *src, const gchar *srcpadname, GstElement *dest, const gchar *destpadname); const GstEventMask* gst_element_get_event_masks (GstElement *element);