ges/ges-simple-timeline-layer.c: don't allow user to create timelines with
authorBrandon Lewis <brandon.lewis@collabora.co.uk>
Thu, 27 May 2010 21:37:11 +0000 (23:37 +0200)
committerEdward Hervey <edward.hervey@collabora.co.uk>
Wed, 9 Jun 2010 09:28:09 +0000 (11:28 +0200)
adjacent transitions

ges/ges-simple-timeline-layer.c

index 7b279311d1e47df09ce15264e2a74c52bc7b9843..c00fd8b56c5d919d523eda9120b97c1666705a98 100644 (file)
@@ -173,6 +173,23 @@ ges_simple_timeline_layer_add_object (GESSimpleTimelineLayer * layer,
 
   GST_DEBUG ("layer:%p, object:%p, position:%d", layer, object, position);
 
+  GList *nth = g_list_nth (layer->objects, position);
+
+  if (GES_IS_TIMELINE_TRANSITION (object)) {
+    GList *lprev = g_list_previous (nth);
+
+    GESTimelineObject *prev = GES_TIMELINE_OBJECT (lprev ? lprev->data : NULL);
+    GESTimelineObject *next = GES_TIMELINE_OBJECT (nth ? nth->data : NULL);
+
+    if ((prev && GES_IS_TIMELINE_TRANSITION (prev)) ||
+        (next && GES_IS_TIMELINE_TRANSITION (next))) {
+      GST_ERROR ("Not adding transition: Only insert transitions between two"
+          " sources, or at the begining or end the layer\n");
+      return FALSE;
+    }
+  }
+
+
   layer->adding_object = TRUE;
 
   res = ges_timeline_layer_add_object ((GESTimelineLayer *) layer, object);