ges: Add a way to know whether a timeline is updating on each changes
authorThibault Saunier <thibault.saunier@collabora.com>
Mon, 23 Jan 2012 01:50:24 +0000 (22:50 -0300)
committerThibault Saunier <thibault.saunier@collabora.com>
Wed, 28 Mar 2012 02:33:57 +0000 (22:33 -0400)
   + Bind the new API in python

API: ges_timeline_is_updating
API: ges_track_is_updating

bindings/python/ges.defs
docs/libs/ges-sections.txt
ges/ges-timeline.c
ges/ges-timeline.h
ges/ges-track.c
ges/ges-track.h

index cfc7037..9828e93 100644 (file)
   )
 )
 
+(define-method is_updating
+  (of-object "GESTimeline")
+  (c-name "ges_timeline_is_updating")
+  (return-type "gboolean")
+)
+
 
 
 ;; From ges-timeline-layer.h
   )
 )
 
+(define-method is_updating
+  (of-object "GESTrack")
+  (c-name "ges_track_is_updating")
+  (return-type "gboolean")
+)
+
 
 
 ;; From ges-track-object.h
index f64216c..647c99f 100644 (file)
@@ -58,6 +58,7 @@ ges_track_set_caps
 ges_track_get_caps
 ges_track_enable_update
 ges_track_get_objects
+ges_track_is_updating
 <SUBSECTION Standard>
 GESTrackClass
 GESTrackPrivate
@@ -250,6 +251,7 @@ ges_timeline_remove_track
 ges_timeline_load_from_uri
 ges_timeline_save_to_uri
 ges_timeline_enable_update
+ges_timeline_is_updating
 <SUBSECTION usage>
 ges_timeline_get_tracks
 ges_timeline_get_layers
index 65bf307..fb16b9d 100644 (file)
@@ -1203,6 +1203,29 @@ ges_timeline_get_layers (GESTimeline * timeline)
 }
 
 /**
+ * ges_timeline_is_updating:
+ * @timeline: a #GESTimeline
+ *
+ * Get whether the timeline is updated for every change happening within or not.
+ *
+ * Returns: %TRUE if @timeline is updating on every changes, else %FALSE.
+ */
+gboolean
+ges_timeline_is_updating (GESTimeline * timeline)
+{
+  GList *tmp;
+
+  g_return_val_if_fail (GES_IS_TIMELINE (timeline), FALSE);
+
+  for (tmp = timeline->priv->tracks; tmp; tmp = tmp->next) {
+    if (!ges_track_is_updating (((TrackPrivate *) tmp->data)->track))
+      return FALSE;
+  }
+
+  return TRUE;
+}
+
+/**
  * ges_timeline_enable_update:
  * @timeline: a #GESTimeline
  * @enabled: Whether the timeline should update on every change or not.
index 07d1e03..1c170b9 100644 (file)
@@ -100,6 +100,7 @@ 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);
+gboolean ges_timeline_is_updating (GESTimeline * timeline);
 
 G_END_DECLS
 
index 5701755..bff638a 100644 (file)
@@ -48,6 +48,8 @@ struct _GESTrackPrivate
   GstElement *composition;      /* The composition associated with this track */
   GstElement *background;       /* The backgrond, handle the gaps in the track */
   GstPad *srcpad;               /* The source GhostPad */
+
+  gboolean updating;
 };
 
 enum
@@ -284,6 +286,7 @@ ges_track_init (GESTrack * self)
       GES_TYPE_TRACK, GESTrackPrivate);
 
   self->priv->composition = gst_element_factory_make ("gnlcomposition", NULL);
+  self->priv->updating = TRUE;
 
   g_signal_connect (G_OBJECT (self->priv->composition), "notify::duration",
       G_CALLBACK (composition_duration_cb), self);
@@ -711,13 +714,28 @@ ges_track_enable_update (GESTrack * track, gboolean enabled)
 {
   gboolean update;
 
-  g_object_set (track->priv->composition, "update", enabled, NULL);
+  g_return_val_if_fail (GES_IS_TRACK (track), FALSE);
 
+  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;
-  }
+  track->priv->updating = update;
+
+  return update == enabled;
+}
+
+/**
+ * ges_track_is_updating:
+ * @track: a #GESTrack
+ *
+ * Get whether the track is updated for every change happening within or not.
+ *
+ * Returns: %TRUE if @track is updating on every changes, else %FALSE.
+ */
+gboolean
+ges_track_is_updating (GESTrack * track)
+{
+  g_return_val_if_fail (GES_IS_TRACK (track), FALSE);
+
+  return track->priv->updating;
 }
index 6a3d519..b5bad82 100644 (file)
@@ -103,6 +103,7 @@ GESTrack *ges_track_video_raw_new         (void);
 GESTrack *ges_track_audio_raw_new         (void);
 
 gboolean ges_track_enable_update          (GESTrack * track, gboolean enabled);
+gboolean ges_track_is_updating            (GESTrack * track);
 
 GList* ges_track_get_objects              (GESTrack *track);