mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
container: Properly implement ges_container_group
This commit is contained in:
parent
15c1481a56
commit
b5f2c819fc
3 changed files with 40 additions and 3 deletions
|
@ -473,6 +473,7 @@ ges_clip_class_init (GESClipClass * klass)
|
||||||
container_class->remove_child = _remove_child;
|
container_class->remove_child = _remove_child;
|
||||||
container_class->ungroup = _ungroup;
|
container_class->ungroup = _ungroup;
|
||||||
container_class->group = _group;
|
container_class->group = _group;
|
||||||
|
container_class->grouping_priority = G_MAXUINT;
|
||||||
|
|
||||||
klass->need_fill_track = TRUE;
|
klass->need_fill_track = TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,6 +139,25 @@ _free_mapping (ChildMapping * mapping)
|
||||||
g_slice_free (ChildMapping, mapping);
|
g_slice_free (ChildMapping, mapping);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gint
|
||||||
|
compare_grouping_prio (GType * a, GType * b)
|
||||||
|
{
|
||||||
|
gint ret = 0;
|
||||||
|
GObjectClass *aclass = g_type_class_ref (*a);
|
||||||
|
GObjectClass *bclass = g_type_class_ref (*b);
|
||||||
|
|
||||||
|
if (GES_CONTAINER_CLASS (aclass)->grouping_priority <
|
||||||
|
GES_CONTAINER_CLASS (bclass)->grouping_priority)
|
||||||
|
ret = -1;
|
||||||
|
else if (GES_CONTAINER_CLASS (aclass)->grouping_priority >
|
||||||
|
GES_CONTAINER_CLASS (bclass)->grouping_priority)
|
||||||
|
ret = 1;
|
||||||
|
|
||||||
|
g_type_class_unref (aclass);
|
||||||
|
g_type_class_unref (bclass);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************
|
/*****************************************************
|
||||||
* *
|
* *
|
||||||
* GESTimelineElement virtual methods implementation *
|
* GESTimelineElement virtual methods implementation *
|
||||||
|
@ -390,6 +409,7 @@ ges_container_class_init (GESContainerClass * klass)
|
||||||
klass->add_child = NULL;
|
klass->add_child = NULL;
|
||||||
klass->ungroup = NULL;
|
klass->ungroup = NULL;
|
||||||
klass->group = NULL;
|
klass->group = NULL;
|
||||||
|
klass->grouping_priority = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -734,11 +754,15 @@ GESContainer *
|
||||||
ges_container_group (GList * containers)
|
ges_container_group (GList * containers)
|
||||||
{
|
{
|
||||||
GList *tmp;
|
GList *tmp;
|
||||||
GESContainer *ret;
|
guint n_children;
|
||||||
GESTimeline *timeline;
|
GESTimeline *timeline;
|
||||||
|
GType *children_types;
|
||||||
GESTimelineElement *element;
|
GESTimelineElement *element;
|
||||||
GObjectClass *clip_class;
|
GObjectClass *clip_class;
|
||||||
|
|
||||||
|
guint i = 0;
|
||||||
|
GESContainer *ret = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (containers, NULL);
|
g_return_val_if_fail (containers, NULL);
|
||||||
element = GES_TIMELINE_ELEMENT (containers->data);
|
element = GES_TIMELINE_ELEMENT (containers->data);
|
||||||
timeline = ges_timeline_element_get_timeline (element);
|
timeline = ges_timeline_element_get_timeline (element);
|
||||||
|
@ -753,8 +777,18 @@ ges_container_group (GList * containers)
|
||||||
(GES_TIMELINE_ELEMENT (tmp->data)) == timeline, NULL);
|
(GES_TIMELINE_ELEMENT (tmp->data)) == timeline, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
clip_class = g_type_class_peek (GES_TYPE_CLIP);
|
children_types = g_type_children (GES_TYPE_CONTAINER, &n_children);
|
||||||
|
g_qsort_with_data (children_types, n_children, sizeof (GType),
|
||||||
|
(GCompareDataFunc) compare_grouping_prio, NULL);
|
||||||
|
|
||||||
|
for (i = 0; i < n_children; i++) {
|
||||||
|
clip_class = g_type_class_peek (children_types[i]);
|
||||||
ret = GES_CONTAINER_CLASS (clip_class)->group (containers);
|
ret = GES_CONTAINER_CLASS (clip_class)->group (containers);
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (children_types);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,6 +118,8 @@ struct _GESContainerClass
|
||||||
|
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
|
guint grouping_priority;
|
||||||
|
|
||||||
/* Padding for API extension */
|
/* Padding for API extension */
|
||||||
gpointer _ges_reserved[GES_PADDING_LARGE];
|
gpointer _ges_reserved[GES_PADDING_LARGE];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue