mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 15:18:21 +00:00
ges: add a function to move TimelineObject from a layer to another
API: ges_timeline_object_move_to_layer API: ges_timeline_object_is_moving_from_layer API: ges_timeline_object_set_moving_from_layer
This commit is contained in:
parent
2bbcbab174
commit
6e1a482a80
4 changed files with 103 additions and 0 deletions
|
@ -298,6 +298,7 @@ ges_timeline_object_find_track_object
|
|||
ges_timeline_object_add_track_object
|
||||
ges_timeline_object_get_top_effects
|
||||
ges_timeline_object_get_top_effect_position
|
||||
ges_timeline_object_move_to_layer
|
||||
ges_timeline_object_set_top_effect_priority
|
||||
<SUBSECTION Standard>
|
||||
GES_TIMELINE_OBJECT_DURATION
|
||||
|
@ -308,9 +309,11 @@ GES_TIMELINE_OBJECT_HEIGHT
|
|||
ges_timeline_object_create_track_objects
|
||||
ges_timeline_object_create_track_object
|
||||
ges_timeline_object_fill_track_object
|
||||
ges_timeline_object_is_moving_from_layer
|
||||
ges_timeline_object_release_track_object
|
||||
ges_timeline_object_get_track_objects
|
||||
ges_timeline_object_set_layer
|
||||
ges_timeline_object_set_moving_from_layer
|
||||
ges_timeline_object_set_priority
|
||||
GESTimelineObjectPrivate
|
||||
GES_IS_TIMELINE_OBJECT
|
||||
|
|
|
@ -119,6 +119,7 @@ struct _GESTimelineObjectPrivate
|
|||
* properties so we don't end up in infinite property update loops
|
||||
*/
|
||||
gboolean ignore_notifies;
|
||||
gboolean is_moving;
|
||||
|
||||
GList *mappings;
|
||||
|
||||
|
@ -319,6 +320,7 @@ ges_timeline_object_init (GESTimelineObject * self)
|
|||
self->priv->trackobjects = NULL;
|
||||
self->priv->layer = NULL;
|
||||
self->priv->nb_effects = 0;
|
||||
self->priv->is_moving = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -822,6 +824,81 @@ ges_timeline_object_set_priority_internal (GESTimelineObject * object,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* ges_timeline_object_set_moving_from_layer:
|
||||
* @object: a #GESTimelineObject
|
||||
* @is_moving: %TRUE if you want to start moving @object to another layer
|
||||
* %FALSE when you finished moving it.
|
||||
*
|
||||
* Sets the object in a moving to layer state. You might rather use the
|
||||
* ges_timeline_object_move_to_layer function to move #GESTimelineObject-s
|
||||
* from a layer to another.
|
||||
**/
|
||||
void
|
||||
ges_timeline_object_set_moving_from_layer (GESTimelineObject * object,
|
||||
gboolean is_moving)
|
||||
{
|
||||
object->priv->is_moving = is_moving;
|
||||
}
|
||||
|
||||
/**
|
||||
* ges_timeline_object_is_moving_from_layer:
|
||||
* @object: a #GESTimelineObject
|
||||
*
|
||||
* Tells you if the object is currently moving from a layer to another.
|
||||
* You might rather use the ges_timeline_object_move_to_layer function to
|
||||
* move #GESTimelineObject-s from a layer to another.
|
||||
*
|
||||
*
|
||||
* Returns: %TRUE if @object is currently moving from its current layer
|
||||
* %FALSE otherwize
|
||||
**/
|
||||
gboolean
|
||||
ges_timeline_object_is_moving_from_layer (GESTimelineObject * object)
|
||||
{
|
||||
return object->priv->is_moving;
|
||||
}
|
||||
|
||||
/**
|
||||
* ges_timeline_object_move_to_layer:
|
||||
* @object: a #GESTimelineObject
|
||||
* @layer: the new #GESTimelineLayer
|
||||
*
|
||||
* Moves @object to @layer. If @object is not in any layer, it adds it to
|
||||
* @layer, else, it removes it from its current layer, and adds it to @layer.
|
||||
*
|
||||
* Returns: %TRUE if @object could be moved %FALSE otherwize
|
||||
*/
|
||||
gboolean
|
||||
ges_timeline_object_move_to_layer (GESTimelineObject * object, GESTimelineLayer
|
||||
* layer)
|
||||
{
|
||||
gboolean ret;
|
||||
GESTimelineLayer *current_layer = object->priv->layer;
|
||||
|
||||
if (current_layer == NULL) {
|
||||
GST_DEBUG ("Not moving %p, only adding it to %p", object, layer);
|
||||
|
||||
return ges_timeline_layer_add_object (layer, object);
|
||||
}
|
||||
|
||||
object->priv->is_moving = TRUE;
|
||||
g_object_ref (object);
|
||||
ret = ges_timeline_layer_remove_object (current_layer, object);
|
||||
|
||||
if (!ret) {
|
||||
g_object_unref (object);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ret = ges_timeline_layer_add_object (layer, object);
|
||||
object->priv->is_moving = FALSE;
|
||||
|
||||
g_object_unref (object);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* ges_timeline_object_set_priority:
|
||||
* @object: a #GESTimelineObject
|
||||
|
|
|
@ -258,6 +258,17 @@ ges_timeline_object_add_track_object (GESTimelineObject *object,
|
|||
GESTimelineLayer *
|
||||
ges_timeline_object_get_layer (GESTimelineObject *object);
|
||||
|
||||
gboolean
|
||||
ges_timeline_object_move_to_layer (GESTimelineObject *object,
|
||||
GESTimelineLayer *layer);
|
||||
|
||||
gboolean
|
||||
ges_timeline_object_is_moving_from_layer (GESTimelineObject *object);
|
||||
|
||||
void
|
||||
ges_timeline_object_set_moving_from_layer (GESTimelineObject * object,
|
||||
gboolean is_moving);
|
||||
|
||||
/* Effects */
|
||||
GList *
|
||||
ges_timeline_object_get_top_effects (GESTimelineObject *object);
|
||||
|
|
|
@ -599,6 +599,12 @@ static void
|
|||
layer_object_added_cb (GESTimelineLayer * layer, GESTimelineObject * object,
|
||||
GESTimeline * timeline)
|
||||
{
|
||||
if (ges_timeline_object_is_moving_from_layer (object)) {
|
||||
GST_DEBUG ("TimelineObject %p is moving from a layer to another, not doing"
|
||||
" anything on it", object);
|
||||
return;
|
||||
}
|
||||
|
||||
GST_DEBUG ("New TimelineObject %p added to layer %p", object, layer);
|
||||
|
||||
if (GES_IS_TIMELINE_FILE_SOURCE (object)) {
|
||||
|
@ -647,6 +653,12 @@ layer_object_removed_cb (GESTimelineLayer * layer, GESTimelineObject * object,
|
|||
{
|
||||
GList *tmp, *trackobjects;
|
||||
|
||||
if (ges_timeline_object_is_moving_from_layer (object)) {
|
||||
GST_DEBUG ("TimelineObject %p is moving from a layer to another, not doing"
|
||||
" anything on it", object);
|
||||
return;
|
||||
}
|
||||
|
||||
GST_DEBUG ("TimelineObject %p removed from layer %p", object, layer);
|
||||
|
||||
/* Go over the object's track objects and figure out which one belongs to
|
||||
|
|
Loading…
Reference in a new issue