mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
validate: scenario: call _element_added_cb() on existing children
Summary: We want to have a chance to set property on all the elements of the pipelines, including the existing children when the element is added. Reviewers: thiblahute Differential Revision: http://phabricator.freedesktop.org/D138
This commit is contained in:
parent
db366e0a37
commit
d0a02df6e5
1 changed files with 42 additions and 0 deletions
|
@ -2310,6 +2310,45 @@ gst_validate_scenario_finalize (GObject * object)
|
|||
G_OBJECT_CLASS (gst_validate_scenario_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void _element_added_cb (GstBin * bin, GstElement * element,
|
||||
GstValidateScenario * scenario);
|
||||
|
||||
static void
|
||||
iterate_children (GstValidateScenario * scenario, GstBin * bin)
|
||||
{
|
||||
GstIterator *it;
|
||||
GValue v = G_VALUE_INIT;
|
||||
gboolean done = FALSE;
|
||||
GHashTable *called; /* set of GstElement on which we already called _element_added_cb() */
|
||||
|
||||
called = g_hash_table_new (NULL, NULL);
|
||||
it = gst_bin_iterate_elements (bin);
|
||||
|
||||
while (!done) {
|
||||
switch (gst_iterator_next (it, &v)) {
|
||||
case GST_ITERATOR_OK:{
|
||||
GstElement *child = g_value_get_object (&v);
|
||||
|
||||
if (g_hash_table_lookup (called, child) == NULL) {
|
||||
_element_added_cb (bin, child, scenario);
|
||||
g_hash_table_add (called, child);
|
||||
}
|
||||
g_value_reset (&v);
|
||||
}
|
||||
break;
|
||||
case GST_ITERATOR_RESYNC:
|
||||
gst_iterator_resync (it);
|
||||
break;
|
||||
case GST_ITERATOR_ERROR:
|
||||
case GST_ITERATOR_DONE:
|
||||
done = TRUE;
|
||||
}
|
||||
}
|
||||
g_value_reset (&v);
|
||||
gst_iterator_free (it);
|
||||
g_hash_table_unref (called);
|
||||
}
|
||||
|
||||
static void
|
||||
_element_added_cb (GstBin * bin, GstElement * element,
|
||||
GstValidateScenario * scenario)
|
||||
|
@ -2356,6 +2395,7 @@ _element_added_cb (GstBin * bin, GstElement * element,
|
|||
if (GST_IS_BIN (element)) {
|
||||
g_signal_connect (element, "element-added", (GCallback) _element_added_cb,
|
||||
scenario);
|
||||
iterate_children (scenario, GST_BIN (element));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2391,6 +2431,8 @@ gst_validate_scenario_factory_create (GstValidateRunner *
|
|||
g_signal_connect (pipeline, "element-added", (GCallback) _element_added_cb,
|
||||
scenario);
|
||||
|
||||
iterate_children (scenario, GST_BIN (pipeline));
|
||||
|
||||
scenario->priv->bus = gst_element_get_bus (pipeline);
|
||||
gst_bus_add_signal_watch (scenario->priv->bus);
|
||||
g_signal_connect (scenario->priv->bus, "message", (GCallback) message_cb,
|
||||
|
|
Loading…
Reference in a new issue