timeline: Add API to find a layer with a specific priority in a timeline

Summary:
API:
  * ges_timeline_get_layer

Test Plan: Nan

Reviewers: mathieu.duponchelle
This commit is contained in:
Thibault Saunier 2015-02-20 12:24:49 +01:00
parent f470222f3d
commit 3e49850e6d
3 changed files with 33 additions and 0 deletions

View file

@ -366,6 +366,7 @@ ges_timeline_enable_update
ges_timeline_is_updating
<SUBSECTION usage>
ges_timeline_get_tracks
ges_timeline_get_layer
ges_timeline_get_layers
ges_timeline_get_track_for_pad
ges_timeline_get_pad_for_track

View file

@ -3214,3 +3214,34 @@ ges_timeline_is_empty (GESTimeline * timeline)
return TRUE;
}
/**
* ges_timeline_get_layer:
* @timeline: The #GESTimeline to retrive a layer from
* @priority: The priority of the layer to find
*
* Retrieve the layer with @priority as a priority
*
* Returns: A #GESLayer or %NULL if no layer with @priority was found
*
* Since 1.6
*/
GESLayer *
ges_timeline_get_layer (GESTimeline * timeline, guint priority)
{
GList *tmp;
GESLayer *layer = NULL;
for (tmp = timeline->layers; tmp; tmp = tmp->next) {
GESLayer *tmp_layer = GES_LAYER (tmp->data);
guint tmp_priority;
g_object_get (tmp_layer, "priority", &tmp_priority, NULL);
if (tmp_priority == priority) {
layer = gst_object_ref (tmp_layer);
break;
}
}
return layer;
}

View file

@ -109,6 +109,7 @@ gboolean ges_timeline_add_layer (GESTimeline *timeline, GESLayer *layer);
GESLayer * ges_timeline_append_layer (GESTimeline * timeline);
gboolean ges_timeline_remove_layer (GESTimeline *timeline, GESLayer *layer);
GList* ges_timeline_get_layers (GESTimeline *timeline);
GESLayer* ges_timeline_get_layer (GESTimeline *timeline, guint priority);
gboolean ges_timeline_add_track (GESTimeline *timeline, GESTrack *track);
gboolean ges_timeline_remove_track (GESTimeline *timeline, GESTrack *track);