gst-editing-services: ges: Fix TimelineObject movement that contains unlocked and relocked objects

Thibault Saunier tsaunier at kemper.freedesktop.org
Wed Jan 11 07:04:34 PST 2012


Module: gst-editing-services
Branch: master
Commit: 53c4eb35db7bf441009808cdabdb3658dc3781f3
URL:    http://cgit.freedesktop.org/gstreamer/gst-editing-services/commit/?id=53c4eb35db7bf441009808cdabdb3658dc3781f3

Author: Thibault Saunier <thibault.saunier at collabora.com>
Date:   Fri Dec 16 04:23:58 2011 -0300

ges: Fix TimelineObject movement that contains unlocked and relocked objects

Record the TrackObject that initiated a TimelineObject movement so we don't
get inifite loops.

Also fix the new TrackObject calculation:
    child.start = time - offset (not time + offset)

---

 ges/ges-timeline-object.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/ges/ges-timeline-object.c b/ges/ges-timeline-object.c
index d23451b..fbbaf05 100644
--- a/ges/ges-timeline-object.c
+++ b/ges/ges-timeline-object.c
@@ -134,6 +134,8 @@ struct _GESTimelineObjectPrivate
 
   guint nb_effects;
 
+  GESTrackObject *initiated_move;
+
   /* The formats supported by this TimelineObject */
   GESTrackType supportedformats;
 };
@@ -743,9 +745,17 @@ ges_timeline_object_set_start_internal (GESTimelineObject * object,
     tr = (GESTrackObject *) tmp->data;
     map = find_object_mapping (object, tr);
 
-    if (ges_track_object_is_locked (tr)) {
+    if (ges_track_object_is_locked (tr) && tr != object->priv->initiated_move) {
+      gint64 new_start = start - map->start_offset;
+
       /* Move the child... */
-      ges_track_object_set_start (tr, start + map->start_offset);
+      if (new_start < 0) {
+        GST_ERROR ("Trying to set start to a negative value %" GST_TIME_FORMAT,
+            GST_TIME_ARGS (-(start + map->start_offset)));
+        continue;
+      }
+
+      ges_track_object_set_start (tr, new_start);
     } else {
       /* ... or update the offset */
       map->start_offset = start - tr->start;
@@ -1492,7 +1502,9 @@ track_object_start_changed_cb (GESTrackObject * child,
     map->start_offset = object->start - child->start;
   } else {
     /* Or update the parent start */
+    object->priv->initiated_move = child;
     ges_timeline_object_set_start (object, child->start + map->start_offset);
+    object->priv->initiated_move = NULL;
   }
 }
 



More information about the gstreamer-commits mailing list