ges: Add a way to know whether a timeline is updating on each changes

+ Bind the new API in python

API: ges_timeline_is_updating
API: ges_track_is_updating
This commit is contained in:
Thibault Saunier 2012-01-22 22:50:24 -03:00
parent a762e72c13
commit d5b4fa215e
6 changed files with 63 additions and 6 deletions

View file

@ -881,6 +881,12 @@
)
)
(define-method is_updating
(of-object "GESTimeline")
(c-name "ges_timeline_is_updating")
(return-type "gboolean")
)
;; From ges-timeline-layer.h
@ -1752,6 +1758,12 @@
)
)
(define-method is_updating
(of-object "GESTrack")
(c-name "ges_track_is_updating")
(return-type "gboolean")
)
;; From ges-track-object.h

View 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

View file

@ -1202,6 +1202,29 @@ ges_timeline_get_layers (GESTimeline * timeline)
return res;
}
/**
* 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

View 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

View 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;
}

View 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);