mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-25 00:28:21 +00:00
layer: Handle operation priorities
All operations should have higher priorites and sources should be on top of those. We now first set the operations priorities in a first pass and then stack sources on top of those. Differential Revision: https://phabricator.freedesktop.org/D1279
This commit is contained in:
parent
eb48faf342
commit
f79c73789f
1 changed files with 36 additions and 17 deletions
|
@ -218,36 +218,28 @@ ges_layer_init (GESLayer * self)
|
||||||
_register_metas (self);
|
_register_metas (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static gint
|
||||||
* ges_layer_resync_priorities:
|
ges_layer_resync_priorities_by_type (GESLayer * layer,
|
||||||
* @layer: a #GESLayer
|
gint starting_priority, GType type)
|
||||||
*
|
|
||||||
* Resyncs the priorities of the clips controlled by @layer.
|
|
||||||
* This method
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
ges_layer_resync_priorities (GESLayer * layer)
|
|
||||||
{
|
{
|
||||||
GstClockTime next_reset = 0;
|
GstClockTime next_reset = 0;
|
||||||
gint priority = 1;
|
gint priority = starting_priority, max_priority = priority;
|
||||||
GList *tmp;
|
GList *tmp;
|
||||||
GESTimelineElement *element;
|
GESTimelineElement *element;
|
||||||
|
|
||||||
GST_INFO_OBJECT (layer, "Resync priorities (prio: %d)",
|
|
||||||
layer->priv->priority);
|
|
||||||
|
|
||||||
for (tmp = layer->priv->clips_start; tmp; tmp = tmp->next) {
|
for (tmp = layer->priv->clips_start; tmp; tmp = tmp->next) {
|
||||||
|
|
||||||
element = GES_TIMELINE_ELEMENT (tmp->data);
|
element = GES_TIMELINE_ELEMENT (tmp->data);
|
||||||
|
|
||||||
if (GES_IS_TRANSITION_CLIP (element)) {
|
if (GES_IS_TRANSITION_CLIP (element)) {
|
||||||
|
/* Blindly set transitions priorities to 0 */
|
||||||
_set_priority0 (element, 0);
|
_set_priority0 (element, 0);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
} else if (!g_type_is_a (G_OBJECT_TYPE (element), type))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (element->start > next_reset) {
|
if (element->start > next_reset) {
|
||||||
priority = 1;
|
priority = starting_priority;
|
||||||
next_reset = 0;
|
next_reset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,8 +248,34 @@ ges_layer_resync_priorities (GESLayer * layer)
|
||||||
|
|
||||||
_set_priority0 (element, priority);
|
_set_priority0 (element, priority);
|
||||||
priority = priority + GES_CONTAINER_HEIGHT (element);
|
priority = priority + GES_CONTAINER_HEIGHT (element);
|
||||||
|
|
||||||
|
if (priority > max_priority)
|
||||||
|
max_priority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return max_priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ges_layer_resync_priorities:
|
||||||
|
* @layer: a #GESLayer
|
||||||
|
*
|
||||||
|
* Resyncs the priorities of the clips controlled by @layer.
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
ges_layer_resync_priorities (GESLayer * layer)
|
||||||
|
{
|
||||||
|
gint min_source_prios;
|
||||||
|
|
||||||
|
GST_INFO_OBJECT (layer, "Resync priorities (prio: %d)",
|
||||||
|
layer->priv->priority);
|
||||||
|
|
||||||
|
min_source_prios = ges_layer_resync_priorities_by_type (layer, 1,
|
||||||
|
GES_TYPE_OPERATION_CLIP);
|
||||||
|
|
||||||
|
ges_layer_resync_priorities_by_type (layer, min_source_prios,
|
||||||
|
GES_TYPE_SOURCE_CLIP);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,6 +416,7 @@ ges_layer_set_priority (GESLayer * layer, guint priority)
|
||||||
layer->priv->priority = priority;
|
layer->priv->priority = priority;
|
||||||
layer->min_nle_priority = (priority * LAYER_HEIGHT) + MIN_NLE_PRIO;
|
layer->min_nle_priority = (priority * LAYER_HEIGHT) + MIN_NLE_PRIO;
|
||||||
layer->max_nle_priority = ((priority + 1) * LAYER_HEIGHT) + MIN_NLE_PRIO;
|
layer->max_nle_priority = ((priority + 1) * LAYER_HEIGHT) + MIN_NLE_PRIO;
|
||||||
|
|
||||||
ges_layer_resync_priorities (layer);
|
ges_layer_resync_priorities (layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -530,7 +549,7 @@ ges_layer_add_clip (GESLayer * layer, GESClip * clip)
|
||||||
g_return_val_if_fail (GES_IS_LAYER (layer), FALSE);
|
g_return_val_if_fail (GES_IS_LAYER (layer), FALSE);
|
||||||
g_return_val_if_fail (GES_IS_CLIP (clip), FALSE);
|
g_return_val_if_fail (GES_IS_CLIP (clip), FALSE);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (layer, "adding clip: %s", GES_TIMELINE_ELEMENT_NAME (clip));
|
GST_DEBUG_OBJECT (layer, "adding clip:%p", clip);
|
||||||
|
|
||||||
priv = layer->priv;
|
priv = layer->priv;
|
||||||
current_layer = ges_clip_get_layer (clip);
|
current_layer = ges_clip_get_layer (clip);
|
||||||
|
|
Loading…
Reference in a new issue