layer: Add an API to get the total duration of the layer

API:
    ges_layer_get_duration
This commit is contained in:
Thibault Saunier 2013-11-22 17:33:18 -03:00
parent 4b94efa246
commit 4c411761fd
3 changed files with 25 additions and 1 deletions

View file

@ -385,6 +385,7 @@ ges_layer_get_timeline
ges_layer_get_auto_transition
ges_layer_set_auto_transition
ges_layer_is_empty
ges_layer_get_duration
GES_TIMELINE_GET_LAYERS
GES_TIMELINE_GET_TRACKS

View file

@ -219,7 +219,7 @@ ges_layer_init (GESLayer * self)
* ges_layer_resync_priorities:
* @layer: a #GESLayer
*
* Resyncs the priorities of the objects controlled by @layer.
* Resyncs the priorities of the clips controlled by @layer.
* This method
*/
static gboolean
@ -285,6 +285,28 @@ new_asset_cb (GESAsset * source, GAsyncResult * res, NewAssetUData * udata)
g_slice_free (NewAssetUData, udata);
}
/**
* ges_layer_get_duration:
* @layer: The #GESLayer to get the duration from
*
* Lets you retrieve the duration of the layer, which means
* the end time of the last clip inside it
*
* Returns: The duration of a layer
*/
GstClockTime
ges_layer_get_duration (GESLayer * layer)
{
GList *tmp;
GstClockTime duration = 0;
for (tmp = layer->priv->clips_start; tmp; tmp = tmp->next) {
duration = MAX (duration, _END (tmp->data));
}
return duration;
}
/* Public methods */
/**
* ges_layer_remove_clip:

View file

@ -124,6 +124,7 @@ void ges_layer_set_auto_transition (GESLayer * layer,
gboolean auto_transition);
GList* ges_layer_get_clips (GESLayer * layer);
GstClockTime ges_layer_get_duration (GESLayer *layer);
G_END_DECLS