From ce8afba36700a6b0bac00c11ec6b8d5cf62a5930 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Thu, 17 May 2012 20:49:01 -0400 Subject: [PATCH] timeline: Add a method to get the timeline duration + Bind it in python API: ges_timeline_get_duration --- bindings/python/ges.defs | 6 ++++++ docs/libs/ges-sections.txt | 1 + ges/ges-timeline.c | 16 ++++++++++++++++ ges/ges-timeline.h | 2 ++ 4 files changed, 25 insertions(+) diff --git a/bindings/python/ges.defs b/bindings/python/ges.defs index 3805b3cacd..4052591a5b 100644 --- a/bindings/python/ges.defs +++ b/bindings/python/ges.defs @@ -911,6 +911,12 @@ (return-type "gboolean") ) +(define-method get_duration + (of-object "GESTimeline") + (c-name "ges_timeline_get_duration") + (return-type "guint64") +) + ;; From ges-timeline-layer.h diff --git a/docs/libs/ges-sections.txt b/docs/libs/ges-sections.txt index 66f79a1d56..3b94fc64b7 100644 --- a/docs/libs/ges-sections.txt +++ b/docs/libs/ges-sections.txt @@ -266,6 +266,7 @@ ges_timeline_is_updating ges_timeline_get_tracks ges_timeline_get_layers ges_timeline_get_track_for_pad +ges_timeline_get_duration GESTimelinePrivate GESTimelineClass diff --git a/ges/ges-timeline.c b/ges/ges-timeline.c index dcb09f283d..b096e93c3f 100644 --- a/ges/ges-timeline.c +++ b/ges/ges-timeline.c @@ -2397,3 +2397,19 @@ ges_timeline_enable_update (GESTimeline * timeline, gboolean enabled) return res; } + +/** + * ges_timeline_get_duration + * @timeline: a #GESTimeline + * + * Get the current duration of @timeline + * + * Returns: The current duration of @timeline + */ +GstClockTime +ges_timeline_get_duration (GESTimeline * timeline) +{ + g_return_val_if_fail (GES_IS_TIMELINE (timeline), GST_CLOCK_TIME_NONE); + + return timeline->priv->duration; +} diff --git a/ges/ges-timeline.h b/ges/ges-timeline.h index de51bcb1d0..ad1992ca6e 100644 --- a/ges/ges-timeline.h +++ b/ges/ges-timeline.h @@ -102,6 +102,8 @@ GList *ges_timeline_get_tracks (GESTimeline *timeline); gboolean ges_timeline_enable_update(GESTimeline * timeline, gboolean enabled); gboolean ges_timeline_is_updating (GESTimeline * timeline); +GstClockTime ges_timeline_get_duration (GESTimeline *timeline); + G_END_DECLS #endif /* _GES_TIMELINE */