/* If the TrackElement is an effect:
* - We add it on top of the list of TrackEffect
- * - We put all TrackObject present in the TimelineObject
+ * - We put all TrackElements present in the Clip
* which are not BaseEffect on top of them
* FIXME: Let the full control over priorities to the user
*/
static gboolean
_remove_child (GESContainer * container, GESTimelineElement * element)
{
- if (GES_IS_BASE_EFFECT (element))
+ if (GES_IS_BASE_EFFECT (element)) {
+ GList *tmp;
+ GESChildrenControlMode mode = container->children_control_mode;
+
+ GST_DEBUG_OBJECT (container, "Resyncing effects priority.");
+
+ container->children_control_mode = GES_CHILDREN_UPDATE_OFFSETS;
+ tmp = g_list_find (GES_CONTAINER_CHILDREN (container), element);
+ for (tmp = tmp->next; tmp; tmp = tmp->next) {
+ ges_timeline_element_set_priority (GES_TIMELINE_ELEMENT (tmp->data),
+ GES_TIMELINE_ELEMENT_PRIORITY (tmp->data) - 1);
+ }
+ container->children_control_mode = mode;
GES_CLIP (container)->priv->nb_effects--;
+ }
GST_FIXME_OBJECT (container, "We should set other children prios");
{
GList *tmp;
GESContainer *self = GES_CONTAINER (object);
- GList *children = ges_container_get_children (self, FALSE);
+ GList *children;
- for (tmp = children; tmp; tmp = tmp->next)
+ _ges_container_sort_children (self);
+ children = ges_container_get_children (self, FALSE);
+
+ for (tmp = g_list_last (children); tmp; tmp = tmp->prev)
ges_container_remove (self, tmp->data);
g_list_free_full (children, gst_object_unref);
audio_source = test_clip.find_track_element(None, GES.AudioSource)
self.assertFalse(audio_source is None)
self.assertEqual(audio_source.get_child_property("volume")[1], 0.0)
+
+ def check_effects(self, clip, expected_effects, expected_indexes):
+ effects = clip.get_top_effects()
+ self.assertEqual(effects, expected_effects)
+ self.assertEqual([clip.get_top_effect_index(effect) for effect in effects], expected_indexes)
+
+ def test_effects_priority(self):
+ timeline = GES.Timeline.new_audio_video()
+ self.assertEqual(len(timeline.get_tracks()), 2)
+ layer = timeline.append_layer()
+
+ test_clip = GES.TestClip()
+ self.assertEqual(test_clip.get_children(True), [])
+ self.assertTrue(layer.add_clip(test_clip))
+
+ effect1 = GES.Effect.new("agingtv")
+ test_clip.add(effect1)
+ self.check_effects(test_clip, [effect1], [0])
+
+ test_clip.set_top_effect_index(effect1, 1)
+ self.check_effects(test_clip, [effect1], [0])
+ test_clip.set_top_effect_index(effect1, 10)
+ self.check_effects(test_clip, [effect1], [0])
+
+ effect2 = GES.Effect.new("dicetv")
+ test_clip.add(effect2)
+
+ test_clip.remove(effect1)
+ self.check_effects(test_clip, [effect2], [0])
\ No newline at end of file