mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-05 10:12:20 +00:00
container: Add a 'recursive' argument to the get_children method
API: - ges_container_get_children (GESContainer *container); + ges_container_get_children (GESContainer *container, gboolean recurse);
This commit is contained in:
parent
ff21ea7f92
commit
96204ac1d2
5 changed files with 32 additions and 8 deletions
|
@ -383,7 +383,7 @@ _ungroup (GESContainer * container, gboolean recursive)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We need a copy of the current list of tracks */
|
/* We need a copy of the current list of tracks */
|
||||||
children = ges_container_get_children (container);
|
children = ges_container_get_children (container, FALSE);
|
||||||
for (tmp = children; tmp; tmp = tmp->next) {
|
for (tmp = children; tmp; tmp = tmp->next) {
|
||||||
track_element = GES_TRACK_ELEMENT (tmp->data);
|
track_element = GES_TRACK_ELEMENT (tmp->data);
|
||||||
track_type = ges_track_element_get_track_type (track_element);
|
track_type = ges_track_element_get_track_type (track_element);
|
||||||
|
@ -546,7 +546,7 @@ _group (GList * containers)
|
||||||
supported_formats = GES_CLIP (ret)->priv->supportedformats;
|
supported_formats = GES_CLIP (ret)->priv->supportedformats;
|
||||||
for (tmpclip = containers->next; tmpclip; tmpclip = tmpclip->next) {
|
for (tmpclip = containers->next; tmpclip; tmpclip = tmpclip->next) {
|
||||||
GESClip *cclip = tmpclip->data;
|
GESClip *cclip = tmpclip->data;
|
||||||
GList *children = ges_container_get_children (GES_CONTAINER (cclip));
|
GList *children = ges_container_get_children (GES_CONTAINER (cclip), FALSE);
|
||||||
|
|
||||||
for (tmpelement = children; tmpelement; tmpelement = tmpelement->next) {
|
for (tmpelement = children; tmpelement; tmpelement = tmpelement->next) {
|
||||||
GESTimelineElement *celement = GES_TIMELINE_ELEMENT (tmpelement->data);
|
GESTimelineElement *celement = GES_TIMELINE_ELEMENT (tmpelement->data);
|
||||||
|
|
|
@ -564,9 +564,27 @@ ges_container_remove (GESContainer * container, GESTimelineElement * child)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_get_children_recursively (GESContainer * container, GList ** children)
|
||||||
|
{
|
||||||
|
GList *tmp;
|
||||||
|
|
||||||
|
*children =
|
||||||
|
g_list_concat (*children, g_list_copy_deep (container->children,
|
||||||
|
(GCopyFunc) gst_object_ref, NULL));
|
||||||
|
|
||||||
|
for (tmp = container->children; tmp; tmp = tmp->next) {
|
||||||
|
GESTimelineElement *element = tmp->data;
|
||||||
|
|
||||||
|
if (GES_IS_CONTAINER (element))
|
||||||
|
_get_children_recursively (tmp->data, children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ges_container_get_children:
|
* ges_container_get_children:
|
||||||
* @container: a #GESContainer
|
* @container: a #GESContainer
|
||||||
|
* @recursive: Whether to recursively get children in @container
|
||||||
*
|
*
|
||||||
* Get the list of #GESTimelineElement contained in @container
|
* Get the list of #GESTimelineElement contained in @container
|
||||||
* The user is responsible for unreffing the contained objects
|
* The user is responsible for unreffing the contained objects
|
||||||
|
@ -576,12 +594,18 @@ ges_container_remove (GESContainer * container, GESTimelineElement * child)
|
||||||
* timeline element contained in @container.
|
* timeline element contained in @container.
|
||||||
*/
|
*/
|
||||||
GList *
|
GList *
|
||||||
ges_container_get_children (GESContainer * container)
|
ges_container_get_children (GESContainer * container, gboolean recursive)
|
||||||
{
|
{
|
||||||
|
GList *children = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (GES_IS_CONTAINER (container), NULL);
|
g_return_val_if_fail (GES_IS_CONTAINER (container), NULL);
|
||||||
|
|
||||||
|
if (!recursive)
|
||||||
return g_list_copy_deep (container->children, (GCopyFunc) gst_object_ref,
|
return g_list_copy_deep (container->children, (GCopyFunc) gst_object_ref,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
_get_children_recursively (container, &children);
|
||||||
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -137,7 +137,7 @@ struct _GESContainerClass
|
||||||
GType ges_container_get_type (void);
|
GType ges_container_get_type (void);
|
||||||
|
|
||||||
/* Children handling */
|
/* Children handling */
|
||||||
GList* ges_container_get_children (GESContainer *container);
|
GList* ges_container_get_children (GESContainer *container, gboolean recursive);
|
||||||
gboolean ges_container_add (GESContainer *container, GESTimelineElement *child);
|
gboolean ges_container_add (GESContainer *container, GESTimelineElement *child);
|
||||||
gboolean ges_container_remove (GESContainer *container, GESTimelineElement *child);
|
gboolean ges_container_remove (GESContainer *container, GESTimelineElement *child);
|
||||||
GList * ges_container_ungroup (GESContainer * container, gboolean recursive);
|
GList * ges_container_ungroup (GESContainer * container, gboolean recursive);
|
||||||
|
|
|
@ -450,7 +450,7 @@ _ungroup (GESContainer * group, gboolean recursive)
|
||||||
{
|
{
|
||||||
GList *children, *tmp, *ret = NULL;
|
GList *children, *tmp, *ret = NULL;
|
||||||
|
|
||||||
children = ges_container_get_children (group);
|
children = ges_container_get_children (group, FALSE);
|
||||||
for (tmp = children; tmp; tmp = tmp->next) {
|
for (tmp = children; tmp; tmp = tmp->next) {
|
||||||
GESTimelineElement *child = tmp->data;
|
GESTimelineElement *child = tmp->data;
|
||||||
|
|
||||||
|
|
|
@ -2014,7 +2014,7 @@ layer_object_removed_cb (GESLayer * layer, GESClip * clip,
|
||||||
/* Go over the clip's track element and figure out which one belongs to
|
/* Go over the clip's track element and figure out which one belongs to
|
||||||
* the list of tracks we control */
|
* the list of tracks we control */
|
||||||
|
|
||||||
trackelements = ges_container_get_children (GES_CONTAINER (clip));
|
trackelements = ges_container_get_children (GES_CONTAINER (clip), FALSE);
|
||||||
for (tmp = trackelements; tmp; tmp = tmp->next) {
|
for (tmp = trackelements; tmp; tmp = tmp->next) {
|
||||||
GESTrackElement *track_element = (GESTrackElement *) tmp->data;
|
GESTrackElement *track_element = (GESTrackElement *) tmp->data;
|
||||||
GESTrack *track = ges_track_element_get_track (track_element);
|
GESTrack *track = ges_track_element_get_track (track_element);
|
||||||
|
|
Loading…
Reference in a new issue