From 2c4d614cb1643e04dfa991d10ae18c4dbeec4c46 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Wed, 3 Aug 2011 02:33:10 +0200 Subject: [PATCH] ges: adds an enable_update function to the GESTimeline Binds it in python API: ges_timeline_enable_update --- bindings/python/ges.defs | 18 ++++++++++++++++++ ges/ges-timeline.c | 28 ++++++++++++++++++++++++++++ ges/ges-timeline.h | 2 ++ ges/ges-track.c | 25 +++++++++++++++++++++++++ ges/ges-track.h | 2 ++ 5 files changed, 75 insertions(+) diff --git a/bindings/python/ges.defs b/bindings/python/ges.defs index 574efe7..a646522 100644 --- a/bindings/python/ges.defs +++ b/bindings/python/ges.defs @@ -853,6 +853,15 @@ (return-type "GList*") ) +(define-method enable_update + (of-object "GESTimeline") + (c-name "ges_timeline_enable_update") + (return-type "gboolean") + (parameters + '("gboolean" "enabled") + ) +) + ;; From ges-timeline-layer.h @@ -1636,6 +1645,15 @@ (return-type "GESTrack*") ) +(define-method enable_update + (of-object "GESTrack") + (c-name "ges_track_enable_update") + (return-type "gboolean") + (parameters + '("gboolean" "enabled") + ) +) + ;; From ges-track-image-source.h diff --git a/ges/ges-timeline.c b/ges/ges-timeline.c index d882108..f1ed51d 100644 --- a/ges/ges-timeline.c +++ b/ges/ges-timeline.c @@ -1104,3 +1104,31 @@ ges_timeline_get_layers (GESTimeline * timeline) return res; } + +/** + * ges_timeline_enable_update: + * @timeline : a #GESTimeline + * @enabled : TRUE if the timeline must be updated, FALSE otherwise. + * + * Calls the enable_update function of the tracks contained by the timeline. + * + * Returns : True if success, FALSE otherwise. + */ +gboolean +ges_timeline_enable_update (GESTimeline * timeline, gboolean enabled) +{ + GList *tmp, *tracks; + gboolean res = TRUE; + + tracks = ges_timeline_get_tracks (timeline); + + for (tmp = tracks; tmp; tmp = tmp->next) { + if (!ges_track_enable_update (tmp->data, enabled)) { + res = FALSE; + } + } + + g_list_free (tracks); + + return res; +} diff --git a/ges/ges-timeline.h b/ges/ges-timeline.h index 101addd..07d1e03 100644 --- a/ges/ges-timeline.h +++ b/ges/ges-timeline.h @@ -99,6 +99,8 @@ gboolean ges_timeline_remove_track (GESTimeline *timeline, GESTrack *track); GESTrack * ges_timeline_get_track_for_pad (GESTimeline *timeline, GstPad *pad); GList *ges_timeline_get_tracks (GESTimeline *timeline); +gboolean ges_timeline_enable_update(GESTimeline * timeline, gboolean enabled); + G_END_DECLS #endif /* _GES_TIMELINE */ diff --git a/ges/ges-track.c b/ges/ges-track.c index b0951bf..786f028 100644 --- a/ges/ges-track.c +++ b/ges/ges-track.c @@ -601,3 +601,28 @@ ges_track_get_timeline (GESTrack * track) return track->priv->timeline; } + +/** + * ges_track_enable_update: + * @track : a #GESTrack + * @enabled : TRUE if the composition must be updated, FALSE otherwise. + * + * Sets the @track 's composition update property to @enabled . + * + * Returns : True if success, FALSE otherwise. + */ +gboolean +ges_track_enable_update (GESTrack * track, gboolean enabled) +{ + gboolean update; + + g_object_set (track->priv->composition, "update", enabled, NULL); + + g_object_get (track->priv->composition, "update", &update, NULL); + + if (update == enabled) { + return TRUE; + } else { + return FALSE; + } +} diff --git a/ges/ges-track.h b/ges/ges-track.h index fa44ced..289935d 100644 --- a/ges/ges-track.h +++ b/ges/ges-track.h @@ -98,6 +98,8 @@ gboolean ges_track_remove_object (GESTrack * track, GESTrack *ges_track_video_raw_new (void); GESTrack *ges_track_audio_raw_new (void); +gboolean ges_track_enable_update(GESTrack * track, gboolean enabled); + GList* ges_track_get_objects (GESTrack *track); G_END_DECLS -- 2.7.4