mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-21 13:36:39 +00:00
GESTimelineObject: Update TrackObject priorities handling
make use of the new TrackObject getters
This commit is contained in:
parent
bbf8aba733
commit
8717290bb0
1 changed files with 20 additions and 20 deletions
|
@ -383,9 +383,6 @@ ges_timeline_object_add_track_object (GESTimelineObject * object, GESTrackObject
|
||||||
GST_DEBUG ("Setting properties on newly created TrackObject");
|
GST_DEBUG ("Setting properties on newly created TrackObject");
|
||||||
|
|
||||||
mapping->priority_offset = priv->nb_effects;
|
mapping->priority_offset = priv->nb_effects;
|
||||||
ges_track_object_set_priority (trobj,
|
|
||||||
object->priority + mapping->priority_offset);
|
|
||||||
|
|
||||||
|
|
||||||
/* If the trackobject is an operation:
|
/* If the trackobject is an operation:
|
||||||
* - We add it on top of the list of TrackOperation
|
* - We add it on top of the list of TrackOperation
|
||||||
|
@ -404,11 +401,11 @@ ges_timeline_object_add_track_object (GESTimelineObject * object, GESTrackObject
|
||||||
|
|
||||||
/* We make sure not to move the entire #TimelineObject */
|
/* We make sure not to move the entire #TimelineObject */
|
||||||
ges_track_object_set_locked (tmpo, FALSE);
|
ges_track_object_set_locked (tmpo, FALSE);
|
||||||
ges_track_object_set_priority (tmpo, tmpo->priority + 1);
|
ges_track_object_set_priority (tmpo,
|
||||||
|
ges_track_object_get_priority (tmpo) + 1);
|
||||||
ges_track_object_set_locked (tmpo, TRUE);
|
ges_track_object_set_locked (tmpo, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
update_height (object);
|
|
||||||
priv->nb_effects++;
|
priv->nb_effects++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,6 +431,9 @@ ges_timeline_object_add_track_object (GESTimelineObject * object, GESTrackObject
|
||||||
g_signal_connect (G_OBJECT (trobj), "notify::priority",
|
g_signal_connect (G_OBJECT (trobj), "notify::priority",
|
||||||
G_CALLBACK (track_object_priority_changed_cb), object);
|
G_CALLBACK (track_object_priority_changed_cb), object);
|
||||||
|
|
||||||
|
ges_track_object_set_priority (trobj,
|
||||||
|
object->priority + mapping->priority_offset);
|
||||||
|
|
||||||
GST_DEBUG ("Returning trobj:%p", trobj);
|
GST_DEBUG ("Returning trobj:%p", trobj);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -854,12 +854,13 @@ update_height (GESTimelineObject * object)
|
||||||
|
|
||||||
/* Go over all childs and check if height has changed */
|
/* Go over all childs and check if height has changed */
|
||||||
for (tmp = object->priv->trackobjects; tmp; tmp = tmp->next) {
|
for (tmp = object->priv->trackobjects; tmp; tmp = tmp->next) {
|
||||||
GESTrackObject *tmpo = (GESTrackObject *) tmp->data;
|
guint tck_priority =
|
||||||
|
ges_track_object_get_priority (GES_TRACK_OBJECT (tmp->data));
|
||||||
|
|
||||||
if (tmpo->priority < min_prio)
|
if (tck_priority < min_prio)
|
||||||
min_prio = tmpo->priority;
|
min_prio = tck_priority;
|
||||||
if (tmpo->priority > max_prio)
|
if (tck_priority > max_prio)
|
||||||
max_prio = tmpo->priority;
|
max_prio = tck_priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME : We only grow the height */
|
/* FIXME : We only grow the height */
|
||||||
|
@ -924,27 +925,26 @@ track_object_priority_changed_cb (GESTrackObject * child,
|
||||||
GParamSpec * arg G_GNUC_UNUSED, GESTimelineObject * object)
|
GParamSpec * arg G_GNUC_UNUSED, GESTimelineObject * object)
|
||||||
{
|
{
|
||||||
ObjectMapping *map;
|
ObjectMapping *map;
|
||||||
|
guint tck_priority = ges_track_object_get_priority (child);
|
||||||
|
|
||||||
GST_DEBUG ("Priority changed");
|
GST_DEBUG ("Priority changed");
|
||||||
|
|
||||||
if (object->priv->ignore_notifies)
|
if (object->priv->ignore_notifies)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
update_height (object);
|
||||||
map = find_object_mapping (object, child);
|
map = find_object_mapping (object, child);
|
||||||
if (G_UNLIKELY (map == NULL))
|
if (G_UNLIKELY (map == NULL))
|
||||||
/* something massively screwed up if we get this */
|
/* something massively screwed up if we get this */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!ges_track_object_is_locked (child)) {
|
if (!ges_track_object_is_locked (child)) {
|
||||||
|
|
||||||
/* Update the internal priority_offset */
|
/* Update the internal priority_offset */
|
||||||
map->priority_offset = object->priority - child->priority;
|
map->priority_offset = object->priority - tck_priority;
|
||||||
update_height (object);
|
} else if (tck_priority < object->priority) {
|
||||||
|
/* Or update the parent priority, the object priority is always the
|
||||||
} else {
|
* highest priority (smaller number) */
|
||||||
/* Or update the parent priority */
|
|
||||||
ges_timeline_object_set_priority (object,
|
ges_timeline_object_set_priority (object,
|
||||||
child->priority + map->priority_offset);
|
tck_priority + map->priority_offset);
|
||||||
/* For the locked situation, we don't need to check the height,
|
|
||||||
* since all object priorities are moving together */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue