mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 23:48:53 +00:00
container/group/clip: Allow creating an empty group.
This is a legitimate use case.
This commit is contained in:
parent
96204ac1d2
commit
2723ef561e
3 changed files with 21 additions and 8 deletions
|
@ -440,6 +440,9 @@ _group (GList * containers)
|
||||||
|
|
||||||
start = inpoint = duration = GST_CLOCK_TIME_NONE;
|
start = inpoint = duration = GST_CLOCK_TIME_NONE;
|
||||||
|
|
||||||
|
if (!containers)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
/* First check if all the containers are clips, if they
|
/* First check if all the containers are clips, if they
|
||||||
* all have the same start/inpoint/duration and are in the same
|
* all have the same start/inpoint/duration and are in the same
|
||||||
* layer.
|
* layer.
|
||||||
|
|
|
@ -643,7 +643,7 @@ ges_container_ungroup (GESContainer * container, gboolean recursive)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ges_container_group:
|
* ges_container_group:
|
||||||
* @containers: (transfer none)(element-type GESContainer): The
|
* @containers: (transfer none)(element-type GESContainer) (allow-none): The
|
||||||
* #GESContainer to group, they must all be in a same #GESTimeline
|
* #GESContainer to group, they must all be in a same #GESTimeline
|
||||||
*
|
*
|
||||||
* Groups the #GESContainer-s provided in @containers. It creates a subclass
|
* Groups the #GESContainer-s provided in @containers. It creates a subclass
|
||||||
|
@ -669,10 +669,11 @@ ges_container_group (GList * containers)
|
||||||
guint i = 0;
|
guint i = 0;
|
||||||
GESContainer *ret = NULL;
|
GESContainer *ret = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (containers, NULL);
|
if (containers) {
|
||||||
element = GES_TIMELINE_ELEMENT (containers->data);
|
element = GES_TIMELINE_ELEMENT (containers->data);
|
||||||
timeline = GES_TIMELINE_ELEMENT_TIMELINE (element);
|
timeline = GES_TIMELINE_ELEMENT_TIMELINE (element);
|
||||||
g_return_val_if_fail (timeline, NULL);
|
g_return_val_if_fail (timeline, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if (g_list_length (containers) == 1)
|
if (g_list_length (containers) == 1)
|
||||||
return containers->data;
|
return containers->data;
|
||||||
|
|
|
@ -380,6 +380,11 @@ _child_added (GESContainer * group, GESTimelineElement * child)
|
||||||
GESGroupPrivate *priv = GES_GROUP (group)->priv;
|
GESGroupPrivate *priv = GES_GROUP (group)->priv;
|
||||||
GstClockTime last_child_end = 0, first_child_start = G_MAXUINT64;
|
GstClockTime last_child_end = 0, first_child_start = G_MAXUINT64;
|
||||||
|
|
||||||
|
if (!GES_TIMELINE_ELEMENT_TIMELINE (group)) {
|
||||||
|
timeline_add_group (GES_TIMELINE_ELEMENT_TIMELINE (child),
|
||||||
|
GES_GROUP (group));
|
||||||
|
}
|
||||||
|
|
||||||
children = GES_CONTAINER_CHILDREN (group);
|
children = GES_CONTAINER_CHILDREN (group);
|
||||||
|
|
||||||
for (tmp = children; tmp; tmp = tmp->next) {
|
for (tmp = children; tmp; tmp = tmp->next) {
|
||||||
|
@ -432,6 +437,8 @@ _child_removed (GESContainer * group, GESTimelineElement * child)
|
||||||
|
|
||||||
if (children == NULL) {
|
if (children == NULL) {
|
||||||
GST_FIXME_OBJECT (group, "Auto destroy myself?");
|
GST_FIXME_OBJECT (group, "Auto destroy myself?");
|
||||||
|
timeline_remove_group (GES_TIMELINE_ELEMENT_TIMELINE (group),
|
||||||
|
GES_GROUP (group));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,8 +467,7 @@ _ungroup (GESContainer * group, gboolean recursive)
|
||||||
}
|
}
|
||||||
g_list_free_full (children, gst_object_unref);
|
g_list_free_full (children, gst_object_unref);
|
||||||
|
|
||||||
timeline_remove_group (GES_TIMELINE_ELEMENT_TIMELINE (group),
|
/* No need to remove from the timeline here, this will be done in _child_removed */
|
||||||
GES_GROUP (group));
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -473,6 +479,9 @@ _group (GList * containers)
|
||||||
GESTimeline *timeline = NULL;
|
GESTimeline *timeline = NULL;
|
||||||
GESContainer *ret = g_object_new (GES_TYPE_GROUP, NULL);
|
GESContainer *ret = g_object_new (GES_TYPE_GROUP, NULL);
|
||||||
|
|
||||||
|
if (!containers)
|
||||||
|
return ret;
|
||||||
|
|
||||||
for (tmp = containers; tmp; tmp = tmp->next) {
|
for (tmp = containers; tmp; tmp = tmp->next) {
|
||||||
if (!timeline) {
|
if (!timeline) {
|
||||||
timeline = GES_TIMELINE_ELEMENT_TIMELINE (tmp->data);
|
timeline = GES_TIMELINE_ELEMENT_TIMELINE (tmp->data);
|
||||||
|
@ -485,7 +494,7 @@ _group (GList * containers)
|
||||||
ges_container_add (ret, tmp->data);
|
ges_container_add (ret, tmp->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
timeline_add_group (timeline, GES_GROUP (ret));
|
/* No need to add to the timeline here, this will be done in _child_added */
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue