internal: Add a element_end_compare

This commit is contained in:
Thibault Saunier 2013-03-23 01:33:39 -03:00
parent e72f5a6012
commit 7f1fbd2300
3 changed files with 37 additions and 9 deletions

View file

@ -519,6 +519,13 @@ _ges_container_sort_children (GESContainer * container)
(GCompareFunc) element_start_compare);
}
void
_ges_container_sort_children_by_end (GESContainer * container)
{
container->children = g_list_sort (container->children,
(GCompareFunc) element_end_compare);
}
void
_ges_container_set_ignore_notifies (GESContainer * container,
gboolean ignore_notifies)

View file

@ -224,13 +224,17 @@ G_GNUC_INTERNAL void _init_formatter_assets (void);
/* Utilities */
G_GNUC_INTERNAL gint element_start_compare (GESTimelineElement * a,
GESTimelineElement * b);
GESTimelineElement * b);
G_GNUC_INTERNAL gint element_end_compare (GESTimelineElement * a,
GESTimelineElement * b);
/****************************************************
* GESContainer *
****************************************************/
G_GNUC_INTERNAL void _ges_container_sort_children (GESContainer *container);
G_GNUC_INTERNAL void _ges_container_set_ignore_notifies (GESContainer *container,
gboolean ignore_notifies);
G_GNUC_INTERNAL void _ges_container_sort_children (GESContainer *container);
G_GNUC_INTERNAL void _ges_container_sort_children_by_end (GESContainer *container);
G_GNUC_INTERNAL void _ges_container_set_ignore_notifies (GESContainer *container,
gboolean ignore_notifies);
/****************************************************
* GESClip *

View file

@ -73,10 +73,27 @@ element_start_compare (GESTimelineElement * a, GESTimelineElement * b)
if (a->duration > b->duration)
return 1;
return 0;
}
if (a->start < b->start)
} else if (a->start < b->start)
return -1;
if (a->start > b->start)
return 1;
return 0;
return 1;
}
gint
element_end_compare (GESTimelineElement * a, GESTimelineElement * b)
{
if (GES_TIMELINE_ELEMENT_END (a) == GES_TIMELINE_ELEMENT_END (b)) {
if (a->priority < b->priority)
return -1;
if (a->priority > b->priority)
return 1;
if (a->duration < b->duration)
return -1;
if (a->duration > b->duration)
return 1;
return 0;
} else if (GES_TIMELINE_ELEMENT_END (a) < (GES_TIMELINE_ELEMENT_END (b)))
return -1;
return 1;
}