mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
timeline: Keep transitions when moving the moving context between layers
Differential Revision: https://phabricator.freedesktop.org/D1225
This commit is contained in:
parent
f8f3444daf
commit
8162811bce
1 changed files with 69 additions and 47 deletions
|
@ -144,6 +144,9 @@ struct _MoveContext
|
||||||
GESTrackElement *last_snaped1;
|
GESTrackElement *last_snaped1;
|
||||||
GESTrackElement *last_snaped2;
|
GESTrackElement *last_snaped2;
|
||||||
GstClockTime *last_snap_ts;
|
GstClockTime *last_snap_ts;
|
||||||
|
|
||||||
|
/* Moving elements of the context between layers */
|
||||||
|
gboolean moving_to_layer;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GESTimelinePrivate
|
struct _GESTimelinePrivate
|
||||||
|
@ -830,6 +833,24 @@ _destroy_auto_transition_cb (GESAutoTransition * auto_transition,
|
||||||
GESClip *transition = auto_transition->transition_clip;
|
GESClip *transition = auto_transition->transition_clip;
|
||||||
GESLayer *layer = ges_clip_get_layer (transition);
|
GESLayer *layer = ges_clip_get_layer (transition);
|
||||||
|
|
||||||
|
if (timeline->priv->movecontext.moving_to_layer) {
|
||||||
|
GESLayer *nlayer, *transition_layer =
|
||||||
|
ges_clip_get_layer (auto_transition->transition_clip),
|
||||||
|
*prev_clip_layer =
|
||||||
|
ges_clip_get_layer (auto_transition->previous_clip), *next_clip_layer =
|
||||||
|
ges_clip_get_layer (auto_transition->next_clip);
|
||||||
|
|
||||||
|
nlayer =
|
||||||
|
next_clip_layer == transition_layer ? prev_clip_layer : next_clip_layer;
|
||||||
|
|
||||||
|
ges_clip_move_to_layer (auto_transition->transition_clip, nlayer);
|
||||||
|
|
||||||
|
g_object_unref (transition_layer);
|
||||||
|
g_object_unref (prev_clip_layer);
|
||||||
|
g_object_unref (next_clip_layer);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ges_layer_remove_clip (layer, transition);
|
ges_layer_remove_clip (layer, transition);
|
||||||
g_signal_handlers_disconnect_by_func (auto_transition,
|
g_signal_handlers_disconnect_by_func (auto_transition,
|
||||||
_destroy_auto_transition_cb, timeline);
|
_destroy_auto_transition_cb, timeline);
|
||||||
|
@ -2087,20 +2108,24 @@ gboolean
|
||||||
timeline_context_to_layer (GESTimeline * timeline, gint offset)
|
timeline_context_to_layer (GESTimeline * timeline, gint offset)
|
||||||
{
|
{
|
||||||
gboolean ret = TRUE;
|
gboolean ret = TRUE;
|
||||||
MoveContext *mv_ctx = &timeline->priv->movecontext;
|
|
||||||
|
|
||||||
/* Layer's priority is always positive */
|
|
||||||
if (offset != 0 && (offset > 0 || mv_ctx->min_move_layer >= -offset)) {
|
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
GESContainer *key, *value;
|
GESContainer *key, *value;
|
||||||
GESLayer *new_layer;
|
GESLayer *new_layer;
|
||||||
guint prio;
|
guint prio;
|
||||||
|
MoveContext *mv_ctx = &timeline->priv->movecontext;
|
||||||
|
|
||||||
mv_ctx->ignore_needs_ctx = TRUE;
|
/* Layer's priority is always positive */
|
||||||
|
if (offset == 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
if (offset < 0 && mv_ctx->min_move_layer < -offset)
|
||||||
|
return ret;
|
||||||
|
|
||||||
GST_DEBUG ("Moving %d object, offset %d",
|
GST_DEBUG ("Moving %d object, offset %d",
|
||||||
g_hash_table_size (mv_ctx->toplevel_containers), offset);
|
g_hash_table_size (mv_ctx->toplevel_containers), offset);
|
||||||
|
|
||||||
|
mv_ctx->ignore_needs_ctx = TRUE;
|
||||||
|
mv_ctx->moving_to_layer = TRUE;
|
||||||
timeline->priv->needs_rollback = FALSE;
|
timeline->priv->needs_rollback = FALSE;
|
||||||
g_hash_table_iter_init (&iter, mv_ctx->toplevel_containers);
|
g_hash_table_iter_init (&iter, mv_ctx->toplevel_containers);
|
||||||
while (g_hash_table_iter_next (&iter, (gpointer *) & key,
|
while (g_hash_table_iter_next (&iter, (gpointer *) & key,
|
||||||
|
@ -2110,8 +2135,7 @@ timeline_context_to_layer (GESTimeline * timeline, gint offset)
|
||||||
prio = ges_clip_get_layer_priority (GES_CLIP (value));
|
prio = ges_clip_get_layer_priority (GES_CLIP (value));
|
||||||
|
|
||||||
/* We know that the layer exists as we created it */
|
/* We know that the layer exists as we created it */
|
||||||
new_layer =
|
new_layer = GES_LAYER (g_list_nth_data (timeline->layers, prio + offset));
|
||||||
GES_LAYER (g_list_nth_data (timeline->layers, prio + offset));
|
|
||||||
|
|
||||||
if (new_layer == NULL) {
|
if (new_layer == NULL) {
|
||||||
do {
|
do {
|
||||||
|
@ -2132,14 +2156,12 @@ timeline_context_to_layer (GESTimeline * timeline, gint offset)
|
||||||
} while (ges_layer_get_priority (new_layer) < last_prio);
|
} while (ges_layer_get_priority (new_layer) < last_prio);
|
||||||
}
|
}
|
||||||
|
|
||||||
_set_priority0 (GES_TIMELINE_ELEMENT (value),
|
_set_priority0 (GES_TIMELINE_ELEMENT (value), _PRIORITY (value) + offset);
|
||||||
_PRIORITY (value) + offset);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Readjust min_move_layer */
|
/* Readjust min_move_layer */
|
||||||
mv_ctx->min_move_layer = mv_ctx->min_move_layer + offset;
|
mv_ctx->min_move_layer = mv_ctx->min_move_layer + offset;
|
||||||
|
|
||||||
mv_ctx->ignore_needs_ctx = FALSE;
|
mv_ctx->ignore_needs_ctx = FALSE;
|
||||||
|
|
||||||
if (timeline->priv->needs_rollback && !timeline->priv->rolling_back) {
|
if (timeline->priv->needs_rollback && !timeline->priv->rolling_back) {
|
||||||
|
@ -2148,7 +2170,7 @@ timeline_context_to_layer (GESTimeline * timeline, gint offset)
|
||||||
timeline_context_to_layer (timeline, -offset);
|
timeline_context_to_layer (timeline, -offset);
|
||||||
timeline->priv->rolling_back = FALSE;
|
timeline->priv->rolling_back = FALSE;
|
||||||
}
|
}
|
||||||
}
|
mv_ctx->moving_to_layer = FALSE;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue