mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-08 04:41:31 +00:00
container: Replace ignore_notify by a GESChildrenControlMode flag
This commit is contained in:
parent
c6078abc97
commit
229ec5f435
4 changed files with 34 additions and 23 deletions
|
@ -144,11 +144,12 @@ _add_child (GESContainer * container, GESTimelineElement * element)
|
|||
|
||||
/* We set the timing value of the child to ours, we avoid infinite loop
|
||||
* making sure the container ignore notifies from the child */
|
||||
_ges_container_set_ignore_notifies (container, TRUE);
|
||||
_ges_container_set_children_control_mode (container,
|
||||
GES_CHILDREN_IGNORE_NOTIFIES);
|
||||
_set_start0 (element, GES_TIMELINE_ELEMENT_START (container));
|
||||
_set_inpoint0 (element, GES_TIMELINE_ELEMENT_INPOINT (container));
|
||||
_set_duration0 (element, GES_TIMELINE_ELEMENT_DURATION (container));
|
||||
_ges_container_set_ignore_notifies (container, FALSE);
|
||||
_ges_container_set_children_control_mode (container, GES_CHILDREN_UPDATE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ struct _GESContainerPrivate
|
|||
/* Set to TRUE when the container is doing updates of track object
|
||||
* properties so we don't end up in infinite property update loops
|
||||
*/
|
||||
gboolean ignore_notifies;
|
||||
GESChildrenControlMode children_control_mode;
|
||||
GHashTable *mappings;
|
||||
guint nb_effects;
|
||||
GESTimelineElement *initiated_move;
|
||||
|
@ -157,7 +157,7 @@ _set_start (GESTimelineElement * element, GstClockTime start)
|
|||
GST_DEBUG_OBJECT (element, "Setting children start, (initiated_move: %"
|
||||
GST_PTR_FORMAT ")", container->priv->initiated_move);
|
||||
|
||||
container->priv->ignore_notifies = TRUE;
|
||||
container->priv->children_control_mode = GES_CHILDREN_IGNORE_NOTIFIES;
|
||||
for (tmp = container->children; tmp; tmp = g_list_next (tmp)) {
|
||||
GESTimelineElement *child = (GESTimelineElement *) tmp->data;
|
||||
|
||||
|
@ -183,7 +183,7 @@ _set_start (GESTimelineElement * element, GstClockTime start)
|
|||
map->start_offset = start - _START (child);
|
||||
}
|
||||
}
|
||||
container->priv->ignore_notifies = FALSE;
|
||||
priv->children_control_mode = GES_CHILDREN_UPDATE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ _set_inpoint (GESTimelineElement * element, GstClockTime inpoint)
|
|||
GList *tmp;
|
||||
GESContainer *container = GES_CONTAINER (element);
|
||||
|
||||
container->priv->ignore_notifies = TRUE;
|
||||
container->priv->children_control_mode = GES_CHILDREN_IGNORE_NOTIFIES;
|
||||
for (tmp = container->children; tmp; tmp = g_list_next (tmp)) {
|
||||
GESTimelineElement *child = (GESTimelineElement *) tmp->data;
|
||||
ChildMapping *map = g_hash_table_lookup (container->priv->mappings, child);
|
||||
|
@ -206,7 +206,7 @@ _set_inpoint (GESTimelineElement * element, GstClockTime inpoint)
|
|||
|
||||
_set_inpoint0 (child, inpoint);
|
||||
}
|
||||
container->priv->ignore_notifies = FALSE;
|
||||
container->priv->children_control_mode = GES_CHILDREN_UPDATE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ _set_duration (GESTimelineElement * element, GstClockTime duration)
|
|||
GESContainer *container = GES_CONTAINER (element);
|
||||
GESContainerPrivate *priv = container->priv;
|
||||
|
||||
priv->ignore_notifies = TRUE;
|
||||
priv->children_control_mode = GES_CHILDREN_IGNORE_NOTIFIES;
|
||||
for (tmp = container->children; tmp; tmp = g_list_next (tmp)) {
|
||||
GESTimelineElement *child = (GESTimelineElement *) tmp->data;
|
||||
ChildMapping *map = g_hash_table_lookup (priv->mappings, child);
|
||||
|
@ -236,7 +236,7 @@ _set_duration (GESTimelineElement * element, GstClockTime duration)
|
|||
NULL, GES_EDGE_END, _START (child) + duration, TRUE) == FALSE)
|
||||
_set_duration0 (GES_TIMELINE_ELEMENT (child), duration);
|
||||
}
|
||||
priv->ignore_notifies = FALSE;
|
||||
priv->children_control_mode = GES_CHILDREN_UPDATE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ _set_priority (GESTimelineElement * element, guint32 priority)
|
|||
GES_CONTAINER_GET_CLASS (element)->get_priorty_range (container, &min_prio,
|
||||
&max_prio);
|
||||
|
||||
priv->ignore_notifies = TRUE; /* */
|
||||
priv->children_control_mode = GES_CHILDREN_IGNORE_NOTIFIES;
|
||||
for (tmp = container->children; tmp; tmp = g_list_next (tmp)) {
|
||||
GESTimelineElement *child = (GESTimelineElement *) tmp->data;
|
||||
ChildMapping *map = g_hash_table_lookup (priv->mappings, child);
|
||||
|
@ -282,7 +282,7 @@ _set_priority (GESTimelineElement * element, guint32 priority)
|
|||
}
|
||||
_set_priority0 (child, real_tck_prio);
|
||||
}
|
||||
priv->ignore_notifies = FALSE;
|
||||
priv->children_control_mode = GES_CHILDREN_UPDATE;
|
||||
|
||||
update_height (container);
|
||||
|
||||
|
@ -423,7 +423,7 @@ _child_start_changed_cb (GESTimelineElement * child,
|
|||
GESContainerPrivate *priv = container->priv;
|
||||
GESTimelineElement *element = GES_TIMELINE_ELEMENT (container);
|
||||
|
||||
if (priv->ignore_notifies)
|
||||
if (priv->children_control_mode == GES_CHILDREN_IGNORE_NOTIFIES)
|
||||
return;
|
||||
|
||||
map = g_hash_table_lookup (priv->mappings, child);
|
||||
|
@ -447,7 +447,7 @@ _child_inpoint_changed_cb (GESTimelineElement * child,
|
|||
GESContainerPrivate *priv = container->priv;
|
||||
GESTimelineElement *element = GES_TIMELINE_ELEMENT (container);
|
||||
|
||||
if (priv->ignore_notifies)
|
||||
if (priv->children_control_mode == GES_CHILDREN_IGNORE_NOTIFIES)
|
||||
return;
|
||||
|
||||
map = g_hash_table_lookup (priv->mappings, child);
|
||||
|
@ -468,7 +468,7 @@ _child_duration_changed_cb (GESTimelineElement * child,
|
|||
GESContainerPrivate *priv = container->priv;
|
||||
GESTimelineElement *element = GES_TIMELINE_ELEMENT (container);
|
||||
|
||||
if (priv->ignore_notifies)
|
||||
if (priv->children_control_mode == GES_CHILDREN_IGNORE_NOTIFIES)
|
||||
return;
|
||||
|
||||
map = g_hash_table_lookup (priv->mappings, child);
|
||||
|
@ -491,7 +491,7 @@ _child_priority_changed_cb (GESTimelineElement * child,
|
|||
GST_DEBUG_OBJECT (container, "TimelineElement %p priority changed to %i",
|
||||
child, _PRIORITY (child));
|
||||
|
||||
if (priv->ignore_notifies)
|
||||
if (priv->children_control_mode == GES_CHILDREN_IGNORE_NOTIFIES)
|
||||
return;
|
||||
|
||||
update_height (container);
|
||||
|
@ -527,10 +527,10 @@ _ges_container_sort_children_by_end (GESContainer * container)
|
|||
}
|
||||
|
||||
void
|
||||
_ges_container_set_ignore_notifies (GESContainer * container,
|
||||
gboolean ignore_notifies)
|
||||
_ges_container_set_children_control_mode (GESContainer * container,
|
||||
GESChildrenControlMode children_control_mode)
|
||||
{
|
||||
container->priv->ignore_notifies = ignore_notifies;
|
||||
container->priv->children_control_mode = children_control_mode;
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
|
@ -565,15 +565,15 @@ ges_container_add (GESContainer * container, GESTimelineElement * child)
|
|||
GST_DEBUG_OBJECT (container, "adding timeline element %" GST_PTR_FORMAT,
|
||||
child);
|
||||
|
||||
priv->ignore_notifies = TRUE;
|
||||
priv->children_control_mode = GES_CHILDREN_IGNORE_NOTIFIES;
|
||||
if (class->add_child) {
|
||||
if (class->add_child (container, child) == FALSE) {
|
||||
priv->ignore_notifies = FALSE;
|
||||
priv->children_control_mode = GES_CHILDREN_UPDATE;
|
||||
GST_WARNING_OBJECT (container, "Erreur adding child %p", child);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
priv->ignore_notifies = FALSE;
|
||||
priv->children_control_mode = GES_CHILDREN_UPDATE;
|
||||
|
||||
mapping = g_slice_new0 (ChildMapping);
|
||||
mapping->child = gst_object_ref (child);
|
||||
|
|
|
@ -38,6 +38,14 @@ G_BEGIN_DECLS
|
|||
|
||||
typedef struct _GESContainerPrivate GESContainerPrivate;
|
||||
|
||||
/* To be used by sublcasses only */
|
||||
typedef enum
|
||||
{
|
||||
GES_CHILDREN_UPDATE,
|
||||
GES_CHILDREN_IGNORE_NOTIFIES,
|
||||
GES_CHILDREN_UPDATE_OFFSETS,
|
||||
} GESChildrenControlMode;
|
||||
|
||||
/**
|
||||
* GES_CONTAINER_HEIGHT:
|
||||
* @obj: a #GESContainer
|
||||
|
@ -123,5 +131,9 @@ gboolean ges_container_remove (GESContainer *container, GESTimelineElement *
|
|||
GList * ges_container_ungroup (GESContainer * container, gboolean recursive);
|
||||
GESContainer *ges_container_group (GList *containers);
|
||||
|
||||
/* To be used by subclasses only */
|
||||
void _ges_container_set_children_control_mode (GESContainer * container,
|
||||
GESChildrenControlMode children_control_mode);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* _GES_CONTAINER */
|
||||
|
|
|
@ -233,8 +233,6 @@ G_GNUC_INTERNAL gint element_end_compare (GESTimelineElement *
|
|||
****************************************************/
|
||||
G_GNUC_INTERNAL void _ges_container_sort_children (GESContainer *container);
|
||||
G_GNUC_INTERNAL void _ges_container_sort_children_by_end (GESContainer *container);
|
||||
G_GNUC_INTERNAL void _ges_container_set_ignore_notifies (GESContainer *container,
|
||||
gboolean ignore_notifies);
|
||||
|
||||
/****************************************************
|
||||
* GESClip *
|
||||
|
|
Loading…
Reference in a new issue