From 3409719de5233f5df55793cd9123f60653b6078a Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Thu, 11 Aug 2016 10:54:08 -0400 Subject: [PATCH] ges: Deprecate GESTimelineElement::priority writability GESLayer is now responsible for setting clips priorites. Also GESClip top effects priorities are now set by the ges_clip_set_top_effect_index method, the user should never call ges_timeline_element_set_priority as it will anyway be overriden by GES itself. Differential Revision: https://phabricator.freedesktop.org/D1280 --- ges/ges-timeline-element.c | 7 +++++++ ges/ges-timeline-element.h | 2 +- tests/check/ges/clip.c | 8 ++++---- tests/check/ges/effects.c | 2 -- tests/check/ges/layer.c | 22 +++------------------- 5 files changed, 15 insertions(+), 26 deletions(-) diff --git a/ges/ges-timeline-element.c b/ges/ges-timeline-element.c index aca4290..9512cb6 100644 --- a/ges/ges-timeline-element.c +++ b/ges/ges-timeline-element.c @@ -366,6 +366,9 @@ ges_timeline_element_class_init (GESTimelineElementClass * klass) * GESTimelineElement:priority: * * The priority of the object. + * + * Setting GESTimelineElement priorities is deprecated + * as all priority management is done by GES itself now. */ properties[PROP_PRIORITY] = g_param_spec_uint ("priority", "Priority", "The priority of the object", 0, G_MAXUINT, 0, G_PARAM_READWRITE); @@ -881,6 +884,10 @@ ges_timeline_element_get_priority (GESTimelineElement * self) * @priority: the priority * * Sets the priority of the object within the containing layer + * + * Deprecated: All priority management is done by GES itself now. + * To set #GESEffect priorities #ges_clip_set_top_effect_index should + * be used. */ void ges_timeline_element_set_priority (GESTimelineElement * self, guint32 priority) diff --git a/ges/ges-timeline-element.h b/ges/ges-timeline-element.h index 82984a2..7888b8f 100644 --- a/ges/ges-timeline-element.h +++ b/ges/ges-timeline-element.h @@ -178,7 +178,7 @@ struct _GESTimelineElementClass gboolean (*set_inpoint) (GESTimelineElement * self, GstClockTime inpoint); gboolean (*set_duration) (GESTimelineElement * self, GstClockTime duration); gboolean (*set_max_duration) (GESTimelineElement * self, GstClockTime maxduration); - gboolean (*set_priority) (GESTimelineElement * self, guint32 priority); + gboolean (*set_priority) (GESTimelineElement * self, guint32 priority); /* set_priority is now protected */ gboolean (*ripple) (GESTimelineElement *self, guint64 start); gboolean (*ripple_end) (GESTimelineElement *self, guint64 end); diff --git a/tests/check/ges/clip.c b/tests/check/ges/clip.c index 41a2975..0be8832 100644 --- a/tests/check/ges/clip.c +++ b/tests/check/ges/clip.c @@ -644,7 +644,7 @@ GST_START_TEST (test_effects_priorities) 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), + fail_unless (ges_clip_set_top_effect_index (clip, GES_BASE_EFFECT (effect), 2)); fail_unless_equals_int (MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 0, _PRIORITY (effect1)); @@ -653,7 +653,7 @@ GST_START_TEST (test_effects_priorities) 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), + fail_unless (ges_clip_set_top_effect_index (clip, GES_BASE_EFFECT (effect), 0)); fail_unless_equals_int (MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 0, _PRIORITY (effect)); @@ -670,7 +670,7 @@ GST_START_TEST (test_effects_priorities) 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), + fail_unless (ges_clip_set_top_effect_index (clip, GES_BASE_EFFECT (effect), 2)); fail_unless_equals_int (LAYER_HEIGHT + MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 0, _PRIORITY (effect1)); @@ -679,7 +679,7 @@ GST_START_TEST (test_effects_priorities) 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), + fail_unless (ges_clip_set_top_effect_index (clip, GES_BASE_EFFECT (effect), 0)); fail_unless_equals_int (LAYER_HEIGHT + MIN_NLE_PRIO + TRANSITIONS_HEIGHT + 0, _PRIORITY (effect)); diff --git a/tests/check/ges/effects.c b/tests/check/ges/effects.c index 82ef486..0a40f55 100644 --- a/tests/check/ges/effects.c +++ b/tests/check/ges/effects.c @@ -335,8 +335,6 @@ GST_START_TEST (test_priorities_clip) } g_list_free (effects); - ges_timeline_element_set_priority (GES_TIMELINE_ELEMENT (effect_clip), 2); - assert_equals_int (_PRIORITY (effect_clip), 2); assert_equals_int (GES_CONTAINER_HEIGHT (effect_clip), 4); effects = ges_clip_get_top_effects (GES_CLIP (effect_clip)); effect_prio = 0; diff --git a/tests/check/ges/layer.c b/tests/check/ges/layer.c index 91c738a..3b8f19e 100644 --- a/tests/check/ges/layer.c +++ b/tests/check/ges/layer.c @@ -150,14 +150,9 @@ GST_START_TEST (test_layer_priorities) fail_unless (clip2 != NULL); fail_unless (clip3 != NULL); - /* Set priorities on the objects */ - g_object_set (clip1, "priority", 0, "start", 0, "duration", 10, NULL); - assert_equals_int (_PRIORITY (clip1), 0); - 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, "start", 20, "duration", - 10, NULL); - assert_equals_int (_PRIORITY (clip3), LAYER_HEIGHT + 1); + g_object_set (clip1, "start", 0, "duration", 10, NULL); + g_object_set (clip2, "start", 10, "duration", 10, NULL); + g_object_set (clip3, "start", 20, "duration", 10, NULL); /* Add objects to the timeline */ fail_unless (ges_layer_add_clip (layer1, clip1)); @@ -243,17 +238,6 @@ GST_START_TEST (test_layer_priorities) 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 - * FIXME : We should rework the way we handle the case were a trackobject - * prio is set outside the layer it is in. - * ges_timeline_element_set_priority (GES_TIMELINE_ELEMENT (trackelement3), - * ges_timeline_commit (timeline); - * LAYER_HEIGHT * 2); - * g_object_get (nleobj3, "priority", &prio3, NULL); - * assert_equals_int (prio3, 2 * LAYER_HEIGHT); - * assert_equals_int (_PRIORITY (clip3), LAYER_HEIGHT - 1); */ - gst_object_unref (trackelement1); gst_object_unref (trackelement2); gst_object_unref (trackelement3); -- 2.7.4