{
gint inc;
GList *tmp;
- guint current_prio;
+ guint current_prio, min_prio, max_prio;
GESTrackElement *track_element;
g_return_val_if_fail (GES_IS_CLIP (clip), FALSE);
track_element = GES_TRACK_ELEMENT (effect);
current_prio = _PRIORITY (track_element);
- /* FIXME, do we actually want to change what the user is telling us to do? */
- newindex = newindex + MIN_GNL_PRIO;
+ _get_priority_range (GES_CONTAINER (clip), &min_prio, &max_prio);
+
+ newindex = newindex + min_prio;
/* We don't change the priority */
if (current_prio == newindex ||
(G_UNLIKELY (GES_CLIP (GES_TIMELINE_ELEMENT_PARENT (track_element)) !=
clip)))
return FALSE;
- if (newindex > (clip->priv->nb_effects - 1 + MIN_GNL_PRIO)) {
+ if (newindex > (clip->priv->nb_effects - 1 + min_prio)) {
GST_DEBUG ("You are trying to make %p not a top effect", effect);
return FALSE;
}
- if (current_prio > clip->priv->nb_effects + MIN_GNL_PRIO) {
- GST_DEBUG ("%p is not a top effect", effect);
+ if (current_prio > clip->priv->nb_effects + min_prio) {
+ GST_ERROR ("%p is not a top effect", effect);
return FALSE;
}
GESClip *clip;
GESTimeline *timeline;
GESTrack *audio_track, *video_track;
+ GESLayer *layer, *layer1;
GESTrackElement *effect, *effect1, *effect2;
fail_unless (ges_timeline_add_track (timeline, audio_track));
fail_unless (ges_timeline_add_track (timeline, video_track));
- effect = GES_TRACK_ELEMENT (ges_effect_new ("identity"));
- fail_unless (ges_track_add_element (video_track, effect));
+ layer = ges_timeline_append_layer (timeline);
+ layer1 = ges_timeline_append_layer (timeline);
+
+ ges_layer_add_clip (layer, clip);
+
+ effect = GES_TRACK_ELEMENT (ges_effect_new ("agingtv"));
fail_unless (ges_container_add (GES_CONTAINER (clip),
GES_TIMELINE_ELEMENT (effect)));
- effect1 = GES_TRACK_ELEMENT (ges_effect_new ("identity"));
- fail_unless (ges_track_add_element (video_track, effect1));
+ effect1 = GES_TRACK_ELEMENT (ges_effect_new ("agingtv"));
fail_unless (ges_container_add (GES_CONTAINER (clip),
GES_TIMELINE_ELEMENT (effect1)));
- effect2 = GES_TRACK_ELEMENT (ges_effect_new ("identity"));
- fail_unless (ges_track_add_element (video_track, effect2));
+ effect2 = GES_TRACK_ELEMENT (ges_effect_new ("agingtv"));
fail_unless (ges_container_add (GES_CONTAINER (clip),
GES_TIMELINE_ELEMENT (effect2)));
fail_unless_equals_int (MIN_GNL_PRIO + 1, _PRIORITY (effect1));
fail_unless_equals_int (MIN_GNL_PRIO + 2, _PRIORITY (effect2));
+ fail_unless (ges_clip_move_to_layer (clip, layer1));
+ fail_unless_equals_int (LAYER_HEIGHT + MIN_GNL_PRIO + 0, _PRIORITY (effect));
+ fail_unless_equals_int (LAYER_HEIGHT + MIN_GNL_PRIO + 1, _PRIORITY (effect1));
+ fail_unless_equals_int (LAYER_HEIGHT + MIN_GNL_PRIO + 2, _PRIORITY (effect2));
+
+ fail_unless (ges_clip_set_top_effect_priority (clip, GES_BASE_EFFECT (effect),
+ 2));
+ fail_unless_equals_int (LAYER_HEIGHT + MIN_GNL_PRIO + 0, _PRIORITY (effect1));
+ fail_unless_equals_int (LAYER_HEIGHT + MIN_GNL_PRIO + 1, _PRIORITY (effect2));
+ fail_unless_equals_int (LAYER_HEIGHT + MIN_GNL_PRIO + 2, _PRIORITY (effect));
+
+ fail_unless (ges_clip_set_top_effect_priority (clip, GES_BASE_EFFECT (effect),
+ 0));
+ fail_unless_equals_int (LAYER_HEIGHT + MIN_GNL_PRIO + 0, _PRIORITY (effect));
+ fail_unless_equals_int (LAYER_HEIGHT + MIN_GNL_PRIO + 1, _PRIORITY (effect1));
+ fail_unless_equals_int (LAYER_HEIGHT + MIN_GNL_PRIO + 2, _PRIORITY (effect2));
+
gst_object_unref (timeline);
}