*/
GHashTable *mappings;
guint nb_effects;
+
+ /* List of GESTimelineElement being in the "child-added" signal
+ * emission stage */
+ GList *adding_children;
};
enum
* @element: the #GESTimelineElement that was added.
*
* Will be emitted after a child was added to @container.
+ * Usually you should connect with #g_signal_connect_after
+ * as in the first emission stage, the signal emission might
+ * get stopped internally.
*/
ges_container_signals[CHILD_ADDED_SIGNAL] =
g_signal_new ("child-added", G_TYPE_FROM_CLASS (klass),
_ges_container_add_child_properties (container, child);
+ priv->adding_children = g_list_prepend (priv->adding_children, child);
g_signal_emit (container, ges_container_signals[CHILD_ADDED_SIGNAL], 0,
child);
+ priv->adding_children = g_list_remove (priv->adding_children, child);
return TRUE;
}
_ges_container_remove_child_properties (container, child);
- g_signal_emit (container, ges_container_signals[CHILD_REMOVED_SIGNAL], 0,
- child);
+ if (!g_list_find (container->priv->adding_children, child)) {
+ g_signal_emit (container, ges_container_signals[CHILD_REMOVED_SIGNAL], 0,
+ child);
+ } else {
+ GST_INFO_OBJECT (container, "Not emitting 'child-removed' signal as child"
+ " removal happend during 'child-added' signal emission");
+ }
gst_object_unref (child);
return TRUE;
if (!tracks || tracks->len == 0) {
GST_WARNING_OBJECT (timeline, "Got no Track to add %p (type %s), removing"
- " from clip",
+ " from clip (stopping 'child-added' signal emission).",
track_element, ges_track_type_name (ges_track_element_get_track_type
(track_element)));
if (tracks)
g_ptr_array_unref (tracks);
+ g_signal_stop_emission_by_name (clip, "child-added");
ges_container_remove (GES_CONTAINER (clip),
GES_TIMELINE_ELEMENT (track_element));
}
} else {
GST_INFO_OBJECT (clip, "Already had a Source Element in %" GST_PTR_FORMAT
- " of type %s, removing new one.", track,
- G_OBJECT_TYPE_NAME (track_element));
+ " of type %s, removing new one. (stopping 'child-added' emission)",
+ track, G_OBJECT_TYPE_NAME (track_element));
+ g_signal_stop_emission_by_name (clip, "child-added");
ges_container_remove (GES_CONTAINER (clip),
GES_TIMELINE_ELEMENT (track_element));
}
continue;
} else {
GST_INFO_OBJECT (clip, "Already had a Source Element in %" GST_PTR_FORMAT
- " of type %s, removing new one.", track,
- G_OBJECT_TYPE_NAME (track_element));
+ " of type %s, removing new one. (stopping 'child-added' emission)",
+ track, G_OBJECT_TYPE_NAME (track_element));
+ g_signal_stop_emission_by_name (clip, "child-added");
ges_container_remove (GES_CONTAINER (clip),
GES_TIMELINE_ELEMENT (track_element));
}