mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
Finally move clip priority handling to GESLayer.
Fix all tests as we now have 1 priority inside the layer dedicated to transitions (basically no source clip will ever have a priority of 0 inside a layer). Differential Revision: https://phabricator.freedesktop.org/D1276
This commit is contained in:
parent
2854c91ebc
commit
3daf8bd788
12 changed files with 151 additions and 123 deletions
|
@ -85,19 +85,6 @@ neighbour_changed_cb (GESClip * clip, GParamSpec * arg G_GNUC_UNUSED,
|
|||
self->positioning = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_height_changed_cb (GESClip * clip, GParamSpec * arg G_GNUC_UNUSED,
|
||||
GESAutoTransition * self)
|
||||
{
|
||||
/* FIXME This is really not smart and we should properly implement clip
|
||||
* priority management at the Layer level */
|
||||
self->positioning = TRUE;
|
||||
_set_priority0 (GES_TIMELINE_ELEMENT (self->next_clip),
|
||||
_PRIORITY (self->previous_clip) +
|
||||
GES_CONTAINER_HEIGHT (self->previous_clip));
|
||||
self->positioning = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_track_changed_cb (GESTrackElement * track_element,
|
||||
GParamSpec * arg G_GNUC_UNUSED, GESAutoTransition * self)
|
||||
|
@ -125,8 +112,6 @@ ges_auto_transition_finalize (GObject * object)
|
|||
neighbour_changed_cb, self);
|
||||
g_signal_handlers_disconnect_by_func (self->next_source, neighbour_changed_cb,
|
||||
self);
|
||||
g_signal_handlers_disconnect_by_func (self->previous_clip,
|
||||
_height_changed_cb, self);
|
||||
g_signal_handlers_disconnect_by_func (self->next_source, _track_changed_cb,
|
||||
self);
|
||||
g_signal_handlers_disconnect_by_func (self->previous_source,
|
||||
|
@ -177,16 +162,12 @@ ges_auto_transition_new (GESTrackElement * transition,
|
|||
G_CALLBACK (neighbour_changed_cb), self);
|
||||
g_signal_connect (next_source, "notify::duration",
|
||||
G_CALLBACK (neighbour_changed_cb), self);
|
||||
g_signal_connect (self->previous_clip, "notify::height",
|
||||
G_CALLBACK (_height_changed_cb), self);
|
||||
|
||||
g_signal_connect (next_source, "notify::track",
|
||||
G_CALLBACK (_track_changed_cb), self);
|
||||
g_signal_connect (previous_source, "notify::track",
|
||||
G_CALLBACK (_track_changed_cb), self);
|
||||
|
||||
_height_changed_cb (self->previous_clip, NULL, self);
|
||||
|
||||
GST_DEBUG_OBJECT (self, "Created transition %" GST_PTR_FORMAT
|
||||
" between %" GST_PTR_FORMAT " and: %" GST_PTR_FORMAT
|
||||
" in layer nb %i, start: %" GST_TIME_FORMAT " duration: %"
|
||||
|
|
|
@ -228,18 +228,34 @@ ges_layer_init (GESLayer * self)
|
|||
static gboolean
|
||||
ges_layer_resync_priorities (GESLayer * layer)
|
||||
{
|
||||
GstClockTime next_reset = 0;
|
||||
gint priority = 1;
|
||||
GList *tmp;
|
||||
GESTimelineElement *element;
|
||||
|
||||
GST_DEBUG ("Resync priorities of %p", layer);
|
||||
|
||||
/* TODO : Inhibit composition updates while doing this.
|
||||
* Ideally we want to do it from an even higher level, but here will
|
||||
* do in the meantime. */
|
||||
GST_INFO_OBJECT (layer, "Resync priorities (prio: %d)",
|
||||
layer->priv->priority);
|
||||
|
||||
for (tmp = layer->priv->clips_start; tmp; tmp = tmp->next) {
|
||||
|
||||
element = GES_TIMELINE_ELEMENT (tmp->data);
|
||||
_set_priority0 (element, _PRIORITY (element));
|
||||
|
||||
if (GES_IS_TRANSITION_CLIP (element)) {
|
||||
_set_priority0 (element, 0);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (element->start > next_reset) {
|
||||
priority = 1;
|
||||
next_reset = 0;
|
||||
}
|
||||
|
||||
if (element->start + element->duration > next_reset)
|
||||
next_reset = element->start + element->duration;
|
||||
|
||||
_set_priority0 (element, priority);
|
||||
priority = priority + GES_CONTAINER_HEIGHT (element);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -515,7 +531,7 @@ ges_layer_add_clip (GESLayer * layer, GESClip * clip)
|
|||
g_return_val_if_fail (GES_IS_LAYER (layer), FALSE);
|
||||
g_return_val_if_fail (GES_IS_CLIP (clip), FALSE);
|
||||
|
||||
GST_DEBUG_OBJECT (layer, "adding clip:%p", clip);
|
||||
GST_DEBUG_OBJECT (layer, "adding clip: %s", GES_TIMELINE_ELEMENT_NAME (clip));
|
||||
|
||||
priv = layer->priv;
|
||||
current_layer = ges_clip_get_layer (clip);
|
||||
|
|
|
@ -85,7 +85,7 @@ GST_START_TEST (test_test_source_properties)
|
|||
fail_unless (ges_timeline_commit (timeline));
|
||||
/* And let's also check that it propagated correctly to GNonLin */
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 42, 51, 12,
|
||||
51, MIN_NLE_PRIO, TRUE);
|
||||
51, MIN_NLE_PRIO + TRANSITIONS_HEIGHT, TRUE);
|
||||
|
||||
/* Change more properties, see if they propagate */
|
||||
g_object_set (clip, "start", (guint64) 420, "duration", (guint64) 510,
|
||||
|
@ -100,17 +100,17 @@ GST_START_TEST (test_test_source_properties)
|
|||
fail_unless (ges_timeline_commit (timeline));
|
||||
/* And let's also check that it propagated correctly to GNonLin */
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 420, 510,
|
||||
120, 510, MIN_NLE_PRIO + 0, TRUE);
|
||||
120, 510, MIN_NLE_PRIO + TRANSITIONS_HEIGHT, TRUE);
|
||||
|
||||
/* Test mute support */
|
||||
g_object_set (clip, "mute", TRUE, NULL);
|
||||
fail_unless (ges_timeline_commit (timeline));
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 420, 510,
|
||||
120, 510, MIN_NLE_PRIO + 0, FALSE);
|
||||
120, 510, MIN_NLE_PRIO + TRANSITIONS_HEIGHT, FALSE);
|
||||
g_object_set (clip, "mute", FALSE, NULL);
|
||||
fail_unless (ges_timeline_commit (timeline));
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 420, 510,
|
||||
120, 510, MIN_NLE_PRIO + 0, TRUE);
|
||||
120, 510, MIN_NLE_PRIO + TRANSITIONS_HEIGHT, TRUE);
|
||||
|
||||
ges_container_remove (GES_CONTAINER (clip),
|
||||
GES_TIMELINE_ELEMENT (trackelement));
|
||||
|
|
|
@ -68,7 +68,7 @@ GST_START_TEST (test_object_properties)
|
|||
|
||||
/* And let's also check that it propagated correctly to GNonLin */
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 42, 51, 12,
|
||||
51, MIN_NLE_PRIO, TRUE);
|
||||
51, MIN_NLE_PRIO + TRANSITIONS_HEIGHT, TRUE);
|
||||
|
||||
/* Change more properties, see if they propagate */
|
||||
g_object_set (clip, "start", (guint64) 420, "duration", (guint64) 510,
|
||||
|
@ -83,7 +83,7 @@ GST_START_TEST (test_object_properties)
|
|||
/* And let's also check that it propagated correctly to GNonLin */
|
||||
ges_timeline_commit (timeline);
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 420, 510,
|
||||
120, 510, MIN_NLE_PRIO + 0, TRUE);
|
||||
120, 510, MIN_NLE_PRIO + TRANSITIONS_HEIGHT, TRUE);
|
||||
|
||||
|
||||
/* This time, we move the trackelement to see if the changes move
|
||||
|
@ -93,7 +93,7 @@ GST_START_TEST (test_object_properties)
|
|||
assert_equals_uint64 (_START (clip), 400);
|
||||
assert_equals_uint64 (_START (trackelement), 400);
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 400, 510,
|
||||
120, 510, MIN_NLE_PRIO + 0, TRUE);
|
||||
120, 510, MIN_NLE_PRIO + TRANSITIONS_HEIGHT, TRUE);
|
||||
|
||||
ges_container_remove (GES_CONTAINER (clip),
|
||||
GES_TIMELINE_ELEMENT (trackelement));
|
||||
|
@ -320,7 +320,7 @@ GST_START_TEST (test_split_object)
|
|||
|
||||
/* And let's also check that it propagated correctly to GNonLin */
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 42, 50, 12,
|
||||
50, MIN_NLE_PRIO, TRUE);
|
||||
50, MIN_NLE_PRIO + TRANSITIONS_HEIGHT, TRUE);
|
||||
|
||||
splitclip = ges_clip_split (clip, 67);
|
||||
fail_unless (GES_IS_CLIP (splitclip));
|
||||
|
@ -637,38 +637,56 @@ GST_START_TEST (test_effects_priorities)
|
|||
fail_unless (ges_container_add (GES_CONTAINER (clip),
|
||||
GES_TIMELINE_ELEMENT (effect2)));
|
||||
|
||||
fail_unless_equals_int (MIN_NLE_PRIO + 0, _PRIORITY (effect));
|
||||
fail_unless_equals_int (MIN_NLE_PRIO + 1, _PRIORITY (effect1));
|
||||
fail_unless_equals_int (MIN_NLE_PRIO + 2, _PRIORITY (effect2));
|
||||
fail_unless_equals_int (MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 0,
|
||||
_PRIORITY (effect));
|
||||
fail_unless_equals_int (MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 1,
|
||||
_PRIORITY (effect1));
|
||||
fail_unless_equals_int (MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 2,
|
||||
_PRIORITY (effect2));
|
||||
|
||||
fail_unless (ges_clip_set_top_effect_priority (clip, GES_BASE_EFFECT (effect),
|
||||
2));
|
||||
fail_unless_equals_int (MIN_NLE_PRIO + 0, _PRIORITY (effect1));
|
||||
fail_unless_equals_int (MIN_NLE_PRIO + 1, _PRIORITY (effect2));
|
||||
fail_unless_equals_int (MIN_NLE_PRIO + 2, _PRIORITY (effect));
|
||||
fail_unless_equals_int (MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 0,
|
||||
_PRIORITY (effect1));
|
||||
fail_unless_equals_int (MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 1,
|
||||
_PRIORITY (effect2));
|
||||
fail_unless_equals_int (MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 2,
|
||||
_PRIORITY (effect));
|
||||
|
||||
fail_unless (ges_clip_set_top_effect_priority (clip, GES_BASE_EFFECT (effect),
|
||||
0));
|
||||
fail_unless_equals_int (MIN_NLE_PRIO + 0, _PRIORITY (effect));
|
||||
fail_unless_equals_int (MIN_NLE_PRIO + 1, _PRIORITY (effect1));
|
||||
fail_unless_equals_int (MIN_NLE_PRIO + 2, _PRIORITY (effect2));
|
||||
fail_unless_equals_int (MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 0,
|
||||
_PRIORITY (effect));
|
||||
fail_unless_equals_int (MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 1,
|
||||
_PRIORITY (effect1));
|
||||
fail_unless_equals_int (MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 2,
|
||||
_PRIORITY (effect2));
|
||||
|
||||
fail_unless (ges_clip_move_to_layer (clip, layer1));
|
||||
fail_unless_equals_int (LAYER_HEIGHT + MIN_NLE_PRIO + 0, _PRIORITY (effect));
|
||||
fail_unless_equals_int (LAYER_HEIGHT + MIN_NLE_PRIO + 1, _PRIORITY (effect1));
|
||||
fail_unless_equals_int (LAYER_HEIGHT + MIN_NLE_PRIO + 2, _PRIORITY (effect2));
|
||||
fail_unless_equals_int (LAYER_HEIGHT + MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 0,
|
||||
_PRIORITY (effect));
|
||||
fail_unless_equals_int (LAYER_HEIGHT + MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 1,
|
||||
_PRIORITY (effect1));
|
||||
fail_unless_equals_int (LAYER_HEIGHT + MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 2,
|
||||
_PRIORITY (effect2));
|
||||
|
||||
fail_unless (ges_clip_set_top_effect_priority (clip, GES_BASE_EFFECT (effect),
|
||||
2));
|
||||
fail_unless_equals_int (LAYER_HEIGHT + MIN_NLE_PRIO + 0, _PRIORITY (effect1));
|
||||
fail_unless_equals_int (LAYER_HEIGHT + MIN_NLE_PRIO + 1, _PRIORITY (effect2));
|
||||
fail_unless_equals_int (LAYER_HEIGHT + MIN_NLE_PRIO + 2, _PRIORITY (effect));
|
||||
fail_unless_equals_int (LAYER_HEIGHT + MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 0,
|
||||
_PRIORITY (effect1));
|
||||
fail_unless_equals_int (LAYER_HEIGHT + MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 1,
|
||||
_PRIORITY (effect2));
|
||||
fail_unless_equals_int (LAYER_HEIGHT + MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 2,
|
||||
_PRIORITY (effect));
|
||||
|
||||
fail_unless (ges_clip_set_top_effect_priority (clip, GES_BASE_EFFECT (effect),
|
||||
0));
|
||||
fail_unless_equals_int (LAYER_HEIGHT + MIN_NLE_PRIO + 0, _PRIORITY (effect));
|
||||
fail_unless_equals_int (LAYER_HEIGHT + MIN_NLE_PRIO + 1, _PRIORITY (effect1));
|
||||
fail_unless_equals_int (LAYER_HEIGHT + MIN_NLE_PRIO + 2, _PRIORITY (effect2));
|
||||
fail_unless_equals_int (LAYER_HEIGHT + MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 0,
|
||||
_PRIORITY (effect));
|
||||
fail_unless_equals_int (LAYER_HEIGHT + MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 1,
|
||||
_PRIORITY (effect1));
|
||||
fail_unless_equals_int (LAYER_HEIGHT + MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 2,
|
||||
_PRIORITY (effect2));
|
||||
|
||||
gst_object_unref (timeline);
|
||||
}
|
||||
|
|
|
@ -111,7 +111,8 @@ GST_START_TEST (test_get_effects_from_tl)
|
|||
assert_equals_int (g_list_length (GES_CONTAINER_CHILDREN (source)), 1);
|
||||
video_source = GES_CONTAINER_CHILDREN (source)->data;
|
||||
fail_unless (GES_IS_VIDEO_TEST_SOURCE (video_source));
|
||||
assert_equals_int (_PRIORITY (video_source), MIN_NLE_PRIO);
|
||||
assert_equals_int (_PRIORITY (video_source),
|
||||
MIN_NLE_PRIO + TRANSITIONS_HEIGHT);
|
||||
|
||||
GST_DEBUG ("Create effect");
|
||||
effect = ges_effect_new ("agingtv");
|
||||
|
@ -127,17 +128,20 @@ GST_START_TEST (test_get_effects_from_tl)
|
|||
GES_TIMELINE_ELEMENT (effect)));
|
||||
fail_unless (ges_track_element_get_track (GES_TRACK_ELEMENT (effect)) ==
|
||||
track_video);
|
||||
assert_equals_int (_PRIORITY (effect), MIN_NLE_PRIO + 0);
|
||||
assert_equals_int (_PRIORITY (video_source), MIN_NLE_PRIO + 1);
|
||||
assert_equals_int (_PRIORITY (effect), MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 0);
|
||||
assert_equals_int (_PRIORITY (video_source),
|
||||
MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 1);
|
||||
|
||||
GST_DEBUG ("Adding effect 1");
|
||||
fail_unless (ges_container_add (GES_CONTAINER (source),
|
||||
GES_TIMELINE_ELEMENT (effect1)));
|
||||
fail_unless (ges_track_element_get_track (GES_TRACK_ELEMENT (effect1)) ==
|
||||
track_video);
|
||||
assert_equals_int (_PRIORITY (effect), MIN_NLE_PRIO);
|
||||
assert_equals_int (_PRIORITY (effect1), MIN_NLE_PRIO + 1);
|
||||
assert_equals_int (_PRIORITY (video_source), MIN_NLE_PRIO + 2);
|
||||
assert_equals_int (_PRIORITY (effect), MIN_NLE_PRIO + TRANSITIONS_HEIGHT);
|
||||
assert_equals_int (_PRIORITY (effect1),
|
||||
MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 1);
|
||||
assert_equals_int (_PRIORITY (video_source),
|
||||
MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 2);
|
||||
|
||||
GST_DEBUG ("Adding effect 2");
|
||||
fail_unless (ges_container_add (GES_CONTAINER (source),
|
||||
|
@ -280,9 +284,11 @@ GST_START_TEST (test_priorities_clip)
|
|||
fail_unless (GES_IS_EFFECT (audio_effect));
|
||||
fail_unless (GES_IS_EFFECT (video_effect));
|
||||
|
||||
/* FIXME This is ridiculus, both effects should have the same priority (0) */
|
||||
assert_equals_int (_PRIORITY (audio_effect), MIN_NLE_PRIO);
|
||||
assert_equals_int (_PRIORITY (video_effect), MIN_NLE_PRIO + 1);
|
||||
/* FIXME This is ridiculus, both effects should have the same priority */
|
||||
assert_equals_int (_PRIORITY (audio_effect),
|
||||
MIN_NLE_PRIO + TRANSITIONS_HEIGHT);
|
||||
assert_equals_int (_PRIORITY (video_effect),
|
||||
MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 1);
|
||||
assert_equals_int (GES_CONTAINER_HEIGHT (effect_clip), 2);
|
||||
|
||||
effect = ges_effect_new ("agingtv");
|
||||
|
@ -302,14 +308,19 @@ GST_START_TEST (test_priorities_clip)
|
|||
|
||||
fail_unless (ges_clip_set_top_effect_priority (GES_CLIP (effect_clip),
|
||||
GES_BASE_EFFECT (effect1), 0));
|
||||
assert_equals_int (_PRIORITY (effect), 3 + MIN_NLE_PRIO);
|
||||
assert_equals_int (_PRIORITY (effect1), 0 + MIN_NLE_PRIO);
|
||||
assert_equals_int (_PRIORITY (effect_clip), 1);
|
||||
|
||||
assert_equals_int (_PRIORITY (effect), 3 + MIN_NLE_PRIO + TRANSITIONS_HEIGHT);
|
||||
assert_equals_int (_PRIORITY (effect1),
|
||||
0 + MIN_NLE_PRIO + TRANSITIONS_HEIGHT);
|
||||
|
||||
assert_equals_int (GES_CONTAINER_HEIGHT (effect_clip), 4);
|
||||
|
||||
fail_unless (ges_clip_set_top_effect_priority (GES_CLIP (effect_clip),
|
||||
GES_BASE_EFFECT (effect1), 3));
|
||||
assert_equals_int (_PRIORITY (effect), 2 + MIN_NLE_PRIO);
|
||||
assert_equals_int (_PRIORITY (effect1), 3 + MIN_NLE_PRIO);
|
||||
assert_equals_int (_PRIORITY (effect), 2 + MIN_NLE_PRIO + TRANSITIONS_HEIGHT);
|
||||
assert_equals_int (_PRIORITY (effect1),
|
||||
3 + MIN_NLE_PRIO + TRANSITIONS_HEIGHT);
|
||||
assert_equals_int (GES_CONTAINER_HEIGHT (effect_clip), 4);
|
||||
|
||||
effects = ges_clip_get_top_effects (GES_CLIP (effect_clip));
|
||||
|
@ -520,25 +531,25 @@ GST_START_TEST (test_split_clip_effect_priorities)
|
|||
ges_layer_add_clip (layer, clip);
|
||||
|
||||
source = ges_clip_find_track_element (clip, NULL, GES_TYPE_VIDEO_SOURCE);
|
||||
assert_equals_uint64 (GES_TIMELINE_ELEMENT_PRIORITY (effect), 2);
|
||||
assert_equals_uint64 (GES_TIMELINE_ELEMENT_PRIORITY (source), 3);
|
||||
assert_equals_uint64 (GES_TIMELINE_ELEMENT_PRIORITY (effect), 3);
|
||||
assert_equals_uint64 (GES_TIMELINE_ELEMENT_PRIORITY (source), 4);
|
||||
|
||||
nclip = ges_clip_split (clip, GST_SECOND);
|
||||
neffect = ges_clip_find_track_element (nclip, NULL, GES_TYPE_EFFECT);
|
||||
nsource = ges_clip_find_track_element (nclip, NULL, GES_TYPE_VIDEO_SOURCE);
|
||||
|
||||
assert_equals_uint64 (GES_TIMELINE_ELEMENT_PRIORITY (effect), 2);
|
||||
assert_equals_uint64 (GES_TIMELINE_ELEMENT_PRIORITY (source), 3);
|
||||
assert_equals_uint64 (GES_TIMELINE_ELEMENT_PRIORITY (neffect), 2);
|
||||
assert_equals_uint64 (GES_TIMELINE_ELEMENT_PRIORITY (nsource), 3);
|
||||
assert_equals_uint64 (GES_TIMELINE_ELEMENT_PRIORITY (effect), 3);
|
||||
assert_equals_uint64 (GES_TIMELINE_ELEMENT_PRIORITY (source), 4);
|
||||
assert_equals_uint64 (GES_TIMELINE_ELEMENT_PRIORITY (neffect), 5);
|
||||
assert_equals_uint64 (GES_TIMELINE_ELEMENT_PRIORITY (nsource), 6);
|
||||
|
||||
/* Create a transition ... */
|
||||
ges_timeline_element_set_start (GES_TIMELINE_ELEMENT (clip), GST_SECOND / 2);
|
||||
|
||||
assert_equals_uint64 (GES_TIMELINE_ELEMENT_PRIORITY (effect), 2);
|
||||
assert_equals_uint64 (GES_TIMELINE_ELEMENT_PRIORITY (source), 3);
|
||||
assert_equals_uint64 (GES_TIMELINE_ELEMENT_PRIORITY (neffect), 4);
|
||||
assert_equals_uint64 (GES_TIMELINE_ELEMENT_PRIORITY (nsource), 5);
|
||||
assert_equals_uint64 (GES_TIMELINE_ELEMENT_PRIORITY (effect), 3);
|
||||
assert_equals_uint64 (GES_TIMELINE_ELEMENT_PRIORITY (source), 4);
|
||||
assert_equals_uint64 (GES_TIMELINE_ELEMENT_PRIORITY (neffect), 5);
|
||||
assert_equals_uint64 (GES_TIMELINE_ELEMENT_PRIORITY (nsource), 6);
|
||||
|
||||
gst_object_unref (timeline);
|
||||
}
|
||||
|
|
|
@ -72,34 +72,34 @@ GST_START_TEST (test_layer_properties)
|
|||
assert_equals_uint64 (_START (clip), 42);
|
||||
assert_equals_uint64 (_DURATION (clip), 51);
|
||||
assert_equals_uint64 (_INPOINT (clip), 12);
|
||||
assert_equals_uint64 (_PRIORITY (clip), 0);
|
||||
assert_equals_uint64 (_PRIORITY (clip), 1);
|
||||
ges_timeline_commit (timeline);
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 42, 51, 12,
|
||||
51, MIN_NLE_PRIO, TRUE);
|
||||
51, MIN_NLE_PRIO + TRANSITIONS_HEIGHT, TRUE);
|
||||
|
||||
/* Change the priority of the layer */
|
||||
g_object_set (layer, "priority", 1, NULL);
|
||||
assert_equals_int (ges_layer_get_priority (layer), 1);
|
||||
assert_equals_uint64 (_PRIORITY (clip), 0);
|
||||
assert_equals_uint64 (_PRIORITY (clip), 1);
|
||||
ges_timeline_commit (timeline);
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 42, 51, 12,
|
||||
51, LAYER_HEIGHT + MIN_NLE_PRIO, TRUE);
|
||||
51, LAYER_HEIGHT + MIN_NLE_PRIO + TRANSITIONS_HEIGHT, TRUE);
|
||||
|
||||
/* Change it to an insanely high value */
|
||||
g_object_set (layer, "priority", 31, NULL);
|
||||
assert_equals_int (ges_layer_get_priority (layer), 31);
|
||||
assert_equals_uint64 (_PRIORITY (clip), 0);
|
||||
assert_equals_uint64 (_PRIORITY (clip), 1);
|
||||
ges_timeline_commit (timeline);
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 42, 51, 12,
|
||||
51, MIN_NLE_PRIO + LAYER_HEIGHT * 31, TRUE);
|
||||
51, MIN_NLE_PRIO + TRANSITIONS_HEIGHT + LAYER_HEIGHT * 31, TRUE);
|
||||
|
||||
/* and back to 0 */
|
||||
g_object_set (layer, "priority", 0, NULL);
|
||||
assert_equals_int (ges_layer_get_priority (layer), 0);
|
||||
assert_equals_uint64 (_PRIORITY (clip), 0);
|
||||
assert_equals_uint64 (_PRIORITY (clip), 1);
|
||||
ges_timeline_commit (timeline);
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 42, 51, 12,
|
||||
51, MIN_NLE_PRIO + 0, TRUE);
|
||||
51, MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 0, TRUE);
|
||||
|
||||
gst_object_unref (trackelement);
|
||||
fail_unless (ges_layer_remove_clip (layer, clip));
|
||||
|
@ -119,7 +119,7 @@ GST_START_TEST (test_layer_priorities)
|
|||
GESClip *clip1, *clip2, *clip3;
|
||||
GstElement *nleobj1, *nleobj2, *nleobj3;
|
||||
guint prio1, prio2, prio3;
|
||||
GList *objs, *tmp;
|
||||
GList *objs;
|
||||
|
||||
ges_init ();
|
||||
|
||||
|
@ -144,24 +144,19 @@ GST_START_TEST (test_layer_priorities)
|
|||
fail_unless (ges_timeline_add_track (timeline, track));
|
||||
|
||||
clip1 = GES_CLIP (ges_test_clip_new ());
|
||||
ges_clip_set_supported_formats (clip1,
|
||||
GES_TRACK_TYPE_AUDIO | GES_TRACK_TYPE_VIDEO);
|
||||
clip2 = GES_CLIP (ges_test_clip_new ());
|
||||
ges_clip_set_supported_formats (clip2,
|
||||
GES_TRACK_TYPE_AUDIO | GES_TRACK_TYPE_VIDEO);
|
||||
clip3 = GES_CLIP (ges_test_clip_new ());
|
||||
ges_clip_set_supported_formats (clip3,
|
||||
GES_TRACK_TYPE_AUDIO | GES_TRACK_TYPE_VIDEO);
|
||||
fail_unless (clip1 != NULL);
|
||||
fail_unless (clip2 != NULL);
|
||||
fail_unless (clip3 != NULL);
|
||||
|
||||
/* Set priorities on the objects */
|
||||
g_object_set (clip1, "priority", 0, NULL);
|
||||
g_object_set (clip1, "priority", 0, "start", 0, "duration", 10, NULL);
|
||||
assert_equals_int (_PRIORITY (clip1), 0);
|
||||
g_object_set (clip2, "priority", 1, NULL);
|
||||
g_object_set (clip2, "priority", 1, "start", 10, "duration", 10, NULL);
|
||||
assert_equals_int (_PRIORITY (clip2), 1);
|
||||
g_object_set (clip3, "priority", LAYER_HEIGHT + 1, NULL);
|
||||
g_object_set (clip3, "priority", LAYER_HEIGHT + 1, "start", 20, "duration",
|
||||
10, NULL);
|
||||
assert_equals_int (_PRIORITY (clip3), LAYER_HEIGHT + 1);
|
||||
|
||||
/* Add objects to the timeline */
|
||||
|
@ -178,11 +173,11 @@ GST_START_TEST (test_layer_priorities)
|
|||
fail_unless (trackelement3 != NULL);
|
||||
|
||||
ges_timeline_commit (timeline);
|
||||
assert_equals_int (_PRIORITY (clip1), 0);
|
||||
assert_equals_int (_PRIORITY (clip1), 1);
|
||||
nleobj1 = ges_track_element_get_nleobject (trackelement1);
|
||||
fail_unless (nleobj1 != NULL);
|
||||
g_object_get (nleobj1, "priority", &prio1, NULL);
|
||||
assert_equals_int (prio1, MIN_NLE_PRIO);
|
||||
assert_equals_int (prio1, MIN_NLE_PRIO + TRANSITIONS_HEIGHT);
|
||||
|
||||
assert_equals_int (_PRIORITY (clip2), 1);
|
||||
nleobj2 = ges_track_element_get_nleobject (trackelement2);
|
||||
|
@ -191,13 +186,16 @@ GST_START_TEST (test_layer_priorities)
|
|||
/* clip2 is on the second layer and has a priority of 1 */
|
||||
assert_equals_int (prio2, MIN_NLE_PRIO + LAYER_HEIGHT + 1);
|
||||
|
||||
assert_equals_int (_PRIORITY (clip3), LAYER_HEIGHT - 1);
|
||||
/* We do not take into account users set priorities */
|
||||
assert_equals_int (_PRIORITY (clip3), 1);
|
||||
|
||||
nleobj3 = ges_track_element_get_nleobject (trackelement3);
|
||||
fail_unless (nleobj3 != NULL);
|
||||
|
||||
/* clip3 is on the third layer and has a priority of LAYER_HEIGHT + 1
|
||||
* it priority must have the maximum priority of this layer*/
|
||||
g_object_get (nleobj3, "priority", &prio3, NULL);
|
||||
assert_equals_int (prio3, MIN_NLE_PRIO + LAYER_HEIGHT * 3 - 1);
|
||||
assert_equals_int (prio3, 1 + MIN_NLE_PRIO + LAYER_HEIGHT * 2);
|
||||
|
||||
/* Move layers around */
|
||||
g_object_set (layer1, "priority", 2, NULL);
|
||||
|
@ -209,15 +207,16 @@ GST_START_TEST (test_layer_priorities)
|
|||
assert_equals_int (ges_layer_get_priority (layer1), 2);
|
||||
assert_equals_int (ges_layer_get_priority (layer2), 0);
|
||||
assert_equals_int (ges_layer_get_priority (layer3), 1);
|
||||
assert_equals_int (_PRIORITY (clip1), 0);
|
||||
assert_equals_int (_PRIORITY (clip1), 1);
|
||||
assert_equals_int (_PRIORITY (clip2), 1);
|
||||
assert_equals_int (_PRIORITY (clip3), LAYER_HEIGHT - 1);
|
||||
assert_equals_int (_PRIORITY (clip3), 1);
|
||||
g_object_get (nleobj1, "priority", &prio1, NULL);
|
||||
g_object_get (nleobj2, "priority", &prio2, NULL);
|
||||
g_object_get (nleobj3, "priority", &prio3, NULL);
|
||||
assert_equals_int (prio1, 2 * LAYER_HEIGHT + MIN_NLE_PRIO);
|
||||
assert_equals_int (prio1,
|
||||
2 * LAYER_HEIGHT + MIN_NLE_PRIO + TRANSITIONS_HEIGHT);
|
||||
assert_equals_int (prio2, MIN_NLE_PRIO + 1);
|
||||
assert_equals_int (prio3, LAYER_HEIGHT * 2 - 1 + MIN_NLE_PRIO);
|
||||
assert_equals_int (prio3, LAYER_HEIGHT + MIN_NLE_PRIO + TRANSITIONS_HEIGHT);
|
||||
|
||||
/* And move objects around */
|
||||
fail_unless (ges_clip_move_to_layer (clip2, layer1));
|
||||
|
@ -228,22 +227,21 @@ GST_START_TEST (test_layer_priorities)
|
|||
assert_equals_int (g_list_length (objs), 3);
|
||||
fail_unless (ges_layer_get_clips (layer2) == NULL);
|
||||
fail_unless (ges_layer_get_clips (layer3) == NULL);
|
||||
|
||||
for (tmp = objs; tmp; tmp = g_list_next (tmp)) {
|
||||
gst_object_unref (tmp->data);
|
||||
}
|
||||
g_list_free (objs);
|
||||
g_list_free_full (objs, gst_object_unref);
|
||||
|
||||
/* Check their priorities (layer1 priority is now 2) */
|
||||
assert_equals_int (_PRIORITY (clip1), 0);
|
||||
assert_equals_int (_PRIORITY (clip2), 1);
|
||||
assert_equals_int (_PRIORITY (clip3), LAYER_HEIGHT - 1);
|
||||
assert_equals_int (_PRIORITY (clip1), 1);
|
||||
assert_equals_int (_PRIORITY (clip2), 2);
|
||||
assert_equals_int (_PRIORITY (clip3), 3);
|
||||
g_object_get (nleobj1, "priority", &prio1, NULL);
|
||||
g_object_get (nleobj2, "priority", &prio2, NULL);
|
||||
g_object_get (nleobj3, "priority", &prio3, NULL);
|
||||
assert_equals_int (prio1, 2 * LAYER_HEIGHT + MIN_NLE_PRIO);
|
||||
assert_equals_int (prio2, 2 * LAYER_HEIGHT + 1 + MIN_NLE_PRIO);
|
||||
assert_equals_int (prio3, LAYER_HEIGHT * 3 - 1 + MIN_NLE_PRIO);
|
||||
assert_equals_int (prio1,
|
||||
2 * LAYER_HEIGHT + MIN_NLE_PRIO + TRANSITIONS_HEIGHT);
|
||||
assert_equals_int (prio2,
|
||||
2 * LAYER_HEIGHT + 1 + MIN_NLE_PRIO + TRANSITIONS_HEIGHT);
|
||||
assert_equals_int (prio3,
|
||||
2 * LAYER_HEIGHT + 2 + MIN_NLE_PRIO + TRANSITIONS_HEIGHT);
|
||||
|
||||
/* And change TrackElement-s priorities and check that changes are not
|
||||
* refected on it containing Clip
|
||||
|
|
|
@ -81,7 +81,7 @@ GST_START_TEST (test_overlay_properties)
|
|||
|
||||
/* And let's also check that it propagated correctly to GNonLin */
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 42, 51, 12,
|
||||
51, MIN_NLE_PRIO, TRUE);
|
||||
51, MIN_NLE_PRIO + TRANSITIONS_HEIGHT, TRUE);
|
||||
|
||||
/* Change more properties, see if they propagate */
|
||||
g_object_set (clip, "start", (guint64) 420, "duration", (guint64) 510,
|
||||
|
@ -96,7 +96,7 @@ GST_START_TEST (test_overlay_properties)
|
|||
|
||||
/* And let's also check that it propagated correctly to GNonLin */
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 420, 510,
|
||||
120, 510, MIN_NLE_PRIO + 0, TRUE);
|
||||
120, 510, MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 0, TRUE);
|
||||
|
||||
ges_container_remove (GES_CONTAINER (clip),
|
||||
GES_TIMELINE_ELEMENT (trackelement));
|
||||
|
|
|
@ -254,10 +254,12 @@ _test_project (GESProject * project, GESTimeline * timeline)
|
|||
assert_equals_int (nb_scratch_lines, 12);
|
||||
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement),
|
||||
0, 1000000000, 0, 1000000000, MIN_NLE_PRIO, TRUE);
|
||||
0, 1000000000, 0, 1000000000, MIN_NLE_PRIO + TRANSITIONS_HEIGHT,
|
||||
TRUE);
|
||||
} else {
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement),
|
||||
0, 1000000000, 0, 1000000000, MIN_NLE_PRIO + 1, TRUE);
|
||||
0, 1000000000, 0, 1000000000,
|
||||
MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 1, TRUE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -31,7 +31,7 @@ GESPipeline * ges_test_create_pipeline (GESTimeline *timeline);
|
|||
* 1- The Gaps
|
||||
*/
|
||||
#define MIN_NLE_PRIO 2
|
||||
|
||||
#define TRANSITIONS_HEIGHT 1
|
||||
#define LAYER_HEIGHT 1000
|
||||
|
||||
gchar * ges_test_get_tmp_uri (const gchar * filename);
|
||||
|
|
|
@ -81,7 +81,7 @@ GST_START_TEST (test_title_source_properties)
|
|||
|
||||
/* And let's also check that it propagated correctly to GNonLin */
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 42, 51, 0,
|
||||
51, MIN_NLE_PRIO, TRUE);
|
||||
51, MIN_NLE_PRIO + TRANSITIONS_HEIGHT, TRUE);
|
||||
|
||||
/* Change more properties, see if they propagate */
|
||||
g_object_set (clip, "start", (guint64) 420, "duration", (guint64) 510,
|
||||
|
@ -96,7 +96,7 @@ GST_START_TEST (test_title_source_properties)
|
|||
|
||||
/* And let's also check that it propagated correctly to GNonLin */
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 420, 510,
|
||||
0, 510, MIN_NLE_PRIO + 0, TRUE);
|
||||
0, 510, MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 0, TRUE);
|
||||
|
||||
ges_container_remove (GES_CONTAINER (clip),
|
||||
GES_TIMELINE_ELEMENT (trackelement));
|
||||
|
|
|
@ -168,7 +168,7 @@ GST_START_TEST (test_filesource_properties)
|
|||
|
||||
/* And let's also check that it propagated correctly to GNonLin */
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 42, 51, 12,
|
||||
51, MIN_NLE_PRIO, TRUE);
|
||||
51, MIN_NLE_PRIO + TRANSITIONS_HEIGHT, TRUE);
|
||||
|
||||
/* Change more properties, see if they propagate */
|
||||
g_object_set (clip, "start", (guint64) 420, "duration", (guint64) 510,
|
||||
|
@ -183,17 +183,17 @@ GST_START_TEST (test_filesource_properties)
|
|||
|
||||
/* And let's also check that it propagated correctly to GNonLin */
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 420, 510,
|
||||
120, 510, MIN_NLE_PRIO + 0, TRUE);
|
||||
120, 510, MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 0, TRUE);
|
||||
|
||||
/* Test mute support */
|
||||
g_object_set (clip, "mute", TRUE, NULL);
|
||||
ges_timeline_commit (timeline);
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 420, 510,
|
||||
120, 510, MIN_NLE_PRIO + 0, FALSE);
|
||||
120, 510, MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 0, FALSE);
|
||||
g_object_set (clip, "mute", FALSE, NULL);
|
||||
ges_timeline_commit (timeline);
|
||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 420, 510,
|
||||
120, 510, MIN_NLE_PRIO + 0, TRUE);
|
||||
120, 510, MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 0, TRUE);
|
||||
|
||||
ges_container_remove (GES_CONTAINER (clip),
|
||||
GES_TIMELINE_ELEMENT (trackelement));
|
||||
|
|
|
@ -98,6 +98,8 @@ class TestTitleClip(unittest.TestCase):
|
|||
children2 = clip2.get_children(True)
|
||||
self.assertNotEqual(children2[0].props.priority,
|
||||
children2[1].props.priority)
|
||||
|
||||
|
||||
class TestTrackElements(unittest.TestCase):
|
||||
def test_add_to_layer_with_effect_remove_add(self):
|
||||
timeline = GES.Timeline.new_audio_video()
|
||||
|
|
Loading…
Reference in a new issue