1 /* GStreamer Editing Services
2 * Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
3 * 2009 Nokia Corporation
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
22 * SECTION:ges-timeline-layer
23 * @short_description: Non-overlaping sequence of #GESTimelineObject
25 * Responsible for the ordering of the various contained TimelineObject(s). A
26 * timeline layer has a "priority" property, which is used to manage the
27 * priorities of individual TimelineObjects. Two layers should not have the
28 * same priority within a given timeline.
31 #include "ges-internal.h"
32 #include "gesmarshal.h"
33 #include "ges-timeline-layer.h"
35 #include "ges-timeline-source.h"
37 #define LAYER_HEIGHT 10
39 static void track_object_added_cb (GESTimelineObject * object,
40 GESTrackObject * track_object, GESTimelineLayer * layer);
41 static void track_object_changed_cb (GESTrackObject * track_object,
42 GParamSpec * arg G_GNUC_UNUSED, GESTimelineLayer * layer);
43 static void calculate_transitions (GESTrackObject * track_object,
44 GESTimelineLayer * layer);
45 static void calculate_next_transition (GESTrackObject * track_object,
46 GESTimelineLayer * layer);
49 timeline_object_height_changed_cb (GESTimelineObject * obj,
50 GESTrackEffect * tr_eff, GESTimelineObject * second_obj);
52 G_DEFINE_TYPE (GESTimelineLayer, ges_timeline_layer, G_TYPE_INITIALLY_UNOWNED);
54 struct _GESTimelineLayerPrivate
57 GList *objects_start; /* The TimelineObjects sorted by start and
60 guint32 priority; /* The priority of the layer within the
61 * containing timeline */
63 gboolean auto_transition;
81 static guint ges_timeline_layer_signals[LAST_SIGNAL] = { 0 };
83 static gboolean ges_timeline_layer_resync_priorities (GESTimelineLayer * layer);
85 static GList *track_get_by_layer (GESTimelineLayer * layer, GESTrack * track);
87 static void compare (GList * compared, GESTrackObject * track_object,
91 ges_timeline_layer_get_property (GObject * object, guint property_id,
92 GValue * value, GParamSpec * pspec)
94 GESTimelineLayer *layer = GES_TIMELINE_LAYER (object);
96 switch (property_id) {
98 g_value_set_uint (value, layer->priv->priority);
100 case PROP_AUTO_TRANSITION:
101 g_value_set_boolean (value, layer->priv->auto_transition);
104 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
109 ges_timeline_layer_set_property (GObject * object, guint property_id,
110 const GValue * value, GParamSpec * pspec)
112 GESTimelineLayer *layer = GES_TIMELINE_LAYER (object);
114 switch (property_id) {
116 ges_timeline_layer_set_priority (layer, g_value_get_uint (value));
118 case PROP_AUTO_TRANSITION:
119 ges_timeline_layer_set_auto_transition (layer,
120 g_value_get_boolean (value));
123 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
128 ges_timeline_layer_dispose (GObject * object)
130 GESTimelineLayer *layer = GES_TIMELINE_LAYER (object);
131 GESTimelineLayerPrivate *priv = layer->priv;
133 GST_DEBUG ("Disposing layer");
135 while (priv->objects_start)
136 ges_timeline_layer_remove_object (layer,
137 (GESTimelineObject *) priv->objects_start->data);
139 G_OBJECT_CLASS (ges_timeline_layer_parent_class)->dispose (object);
143 ges_timeline_layer_class_init (GESTimelineLayerClass * klass)
145 GObjectClass *object_class = G_OBJECT_CLASS (klass);
147 g_type_class_add_private (klass, sizeof (GESTimelineLayerPrivate));
149 object_class->get_property = ges_timeline_layer_get_property;
150 object_class->set_property = ges_timeline_layer_set_property;
151 object_class->dispose = ges_timeline_layer_dispose;
154 * GESTimelineLayer:priority
156 * The priority of the layer in the #GESTimeline. 0 is the highest
157 * priority. Conceptually, a #GESTimeline is a stack of GESTimelineLayers,
158 * and the priority of the layer represents its position in the stack. Two
159 * layers should not have the same priority within a given GESTimeline.
161 g_object_class_install_property (object_class, PROP_PRIORITY,
162 g_param_spec_uint ("priority", "Priority",
163 "The priority of the layer", 0, G_MAXUINT, 0, G_PARAM_READWRITE));
166 * GESTimelineLayer:auto_transitioning
168 * Sets whether transitions are added automatically when timeline objects overlap
170 g_object_class_install_property (object_class, PROP_AUTO_TRANSITION,
171 g_param_spec_boolean ("auto-transition", "Auto-Transition",
172 "whether the transitions are added", FALSE, G_PARAM_READWRITE));
175 * GESTimelineLayer::object-added
176 * @layer: the #GESTimelineLayer
177 * @object: the #GESTimelineObject that was added.
179 * Will be emitted after the object was added to the layer.
181 ges_timeline_layer_signals[OBJECT_ADDED] =
182 g_signal_new ("object-added", G_TYPE_FROM_CLASS (klass),
183 G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GESTimelineLayerClass, object_added),
184 NULL, NULL, ges_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
185 GES_TYPE_TIMELINE_OBJECT);
188 * GESTimelineLayer::object-removed
189 * @layer: the #GESTimelineLayer
190 * @object: the #GESTimelineObject that was removed
192 * Will be emitted after the object was removed from the layer.
194 ges_timeline_layer_signals[OBJECT_REMOVED] =
195 g_signal_new ("object-removed", G_TYPE_FROM_CLASS (klass),
196 G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GESTimelineLayerClass,
197 object_removed), NULL, NULL, ges_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
198 GES_TYPE_TIMELINE_OBJECT);
202 ges_timeline_layer_init (GESTimelineLayer * self)
204 self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
205 GES_TYPE_TIMELINE_LAYER, GESTimelineLayerPrivate);
207 self->priv->priority = 0;
208 self->priv->auto_transition = FALSE;
209 self->min_gnl_priority = 0;
210 self->max_gnl_priority = LAYER_HEIGHT;
214 * ges_timeline_layer_new:
216 * Creates a new #GESTimelineLayer.
218 * Returns: A new #GESTimelineLayer
221 ges_timeline_layer_new (void)
223 return g_object_new (GES_TYPE_TIMELINE_LAYER, NULL);
227 ges_timeline_layer_set_timeline (GESTimelineLayer * layer,
228 GESTimeline * timeline)
230 GST_DEBUG ("layer:%p, timeline:%p", layer, timeline);
232 layer->timeline = timeline;
236 objects_start_compare (GESTimelineObject * a, GESTimelineObject * b)
238 if (a->start == b->start) {
239 if (a->priority < b->priority)
241 if (a->priority > b->priority)
245 if (a->start < b->start)
247 if (a->start > b->start)
253 track_get_by_layer (GESTimelineLayer * layer, GESTrack * track)
255 GList *tck_objects_list = NULL, *tmp = NULL, *return_list = NULL;
256 GESTimelineObject *tl_obj;
258 tck_objects_list = ges_track_get_objects (track);
259 for (tmp = tck_objects_list; tmp; tmp = tmp->next) {
260 tl_obj = ges_track_object_get_timeline_object (tmp->data);
262 if (ges_timeline_object_get_layer (tl_obj) == layer) {
264 /* We still the reference from tck_objects_list */
265 return_list = g_list_append (return_list, tmp->data);
268 g_object_unref (tmp->data);
275 * ges_timeline_layer_add_object:
276 * @layer: a #GESTimelineLayer
277 * @object: (transfer full): the #GESTimelineObject to add.
279 * Adds the given object to the layer. Sets the object's parent, and thus
280 * takes ownership of the object.
282 * An object can only be added to one layer.
284 * Returns: TRUE if the object was properly added to the layer, or FALSE
285 * if the @layer refuses to add the object.
288 ges_timeline_layer_add_object (GESTimelineLayer * layer,
289 GESTimelineObject * object)
291 GESTimelineLayer *tl_obj_layer;
292 guint32 maxprio, minprio, prio;
294 GST_DEBUG ("layer:%p, object:%p", layer, object);
296 tl_obj_layer = ges_timeline_object_get_layer (object);
298 if (G_UNLIKELY (tl_obj_layer)) {
299 GST_WARNING ("TimelineObject %p already belongs to another layer", object);
300 g_object_unref (tl_obj_layer);
304 g_object_ref_sink (object);
306 /* Take a reference to the object and store it stored by start/priority */
307 layer->priv->objects_start =
308 g_list_insert_sorted (layer->priv->objects_start, object,
309 (GCompareFunc) objects_start_compare);
311 if (layer->priv->auto_transition) {
312 if (GES_IS_TIMELINE_SOURCE (object)) {
313 g_signal_connect (G_OBJECT (object), "track-object-added",
314 G_CALLBACK (track_object_added_cb), layer);
318 /* Inform the object it's now in this layer */
319 ges_timeline_object_set_layer (object, layer);
321 GST_DEBUG ("current object priority : %d, layer min/max : %d/%d",
322 GES_TIMELINE_OBJECT_PRIORITY (object),
323 layer->min_gnl_priority, layer->max_gnl_priority);
325 /* Set the priority. */
326 maxprio = layer->max_gnl_priority;
327 minprio = layer->min_gnl_priority;
328 prio = GES_TIMELINE_OBJECT_PRIORITY (object);
329 if (minprio + prio > (maxprio)) {
330 GST_WARNING ("%p is out of the layer %p space, setting its priority to "
331 "setting its priority %d to failthe maximum priority of the layer %d",
332 object, layer, prio, maxprio - minprio);
333 ges_timeline_object_set_priority (object, LAYER_HEIGHT - 1);
335 /* If the object has an acceptable priority, we just let it with its current
338 ges_timeline_layer_resync_priorities (layer);
340 /* emit 'object-added' */
341 g_signal_emit (layer, ges_timeline_layer_signals[OBJECT_ADDED], 0, object);
347 track_object_duration_cb (GESTrackObject * track_object,
348 GParamSpec * arg G_GNUC_UNUSED, GESTimelineLayer * layer)
350 if (G_LIKELY (GES_IS_TRACK_SOURCE (track_object)))
351 GST_DEBUG ("Here we should recalculate");
352 calculate_next_transition (track_object, layer);
356 track_object_added_cb (GESTimelineObject * object,
357 GESTrackObject * track_object, GESTimelineLayer * layer)
359 if (GES_IS_TRACK_SOURCE (track_object)) {
360 g_signal_connect (G_OBJECT (track_object), "notify::start",
361 G_CALLBACK (track_object_changed_cb), layer);
362 g_signal_connect (G_OBJECT (track_object), "notify::duration",
363 G_CALLBACK (track_object_duration_cb), layer);
364 calculate_transitions (track_object, layer);
367 g_object_unref (layer);
372 track_object_removed_cb (GESTimelineObject * object,
373 GESTrackObject * track_object, GESTimelineLayer * layer)
375 if (GES_IS_TRACK_SOURCE (track_object)) {
376 g_signal_handlers_disconnect_by_func (track_object, track_object_changed_cb,
378 calculate_transitions (track_object, layer);
381 g_object_unref (layer);
386 timeline_object_height_changed_cb (GESTimelineObject * obj,
387 GESTrackEffect * tr_eff, GESTimelineObject * second_obj)
389 gint priority, height;
390 g_object_get (obj, "height", &height, "priority", &priority, NULL);
391 g_object_set (second_obj, "priority", priority + height, NULL);
395 track_object_changed_cb (GESTrackObject * track_object,
396 GParamSpec * arg G_GNUC_UNUSED, GESTimelineLayer * layer)
398 if (G_LIKELY (GES_IS_TRACK_SOURCE (track_object)))
399 calculate_transitions (track_object, layer);
403 calculate_next_transition_with_list (GESTrackObject * track_object,
404 GList * tckobjs_in_layer, GESTimelineLayer * layer)
408 if (!(compared = g_list_find (tckobjs_in_layer, track_object)))
411 if (compared == NULL)
412 /* This is the last TrackObject of the Track */
416 compared = compared->next;
417 if (compared == NULL)
419 } while (!GES_IS_TRACK_SOURCE (compared->data));
421 compare (compared, track_object, FALSE);
426 calculate_next_transition (GESTrackObject * track_object,
427 GESTimelineLayer * layer)
429 GESTrack *track = ges_track_object_get_track (track_object);
430 GList *tckobjs_in_layer = track_get_by_layer (layer, track);
432 if (ges_track_object_get_track (track_object)) {
433 calculate_next_transition_with_list (track_object, tckobjs_in_layer, layer);
436 g_list_free_full (tckobjs_in_layer, g_object_unref);
440 calculate_transitions (GESTrackObject * track_object, GESTimelineLayer * layer)
442 GList *tckobjs_in_layer, *compared;
443 GESTrack *track = ges_track_object_get_track (track_object);
445 tckobjs_in_layer = track_get_by_layer (layer, track);
446 if (!(compared = g_list_find (tckobjs_in_layer, track_object)))
450 compared = compared->prev;
452 if (compared == NULL) {
453 /* Nothing before, let's check after */
454 calculate_next_transition_with_list (track_object, tckobjs_in_layer,
459 } while (!GES_IS_TRACK_SOURCE (compared->data));
461 compare (compared, track_object, TRUE);
463 calculate_next_transition_with_list (track_object, tckobjs_in_layer, layer);
466 g_list_free_full (tckobjs_in_layer, g_object_unref);
471 * @compared: The #GList of #GESTrackObjects that we compare with @track_object
472 * @track_object: The #GESTrackObject that serves as a reference
473 * @ahead: %TRUE if we are comparing frontward %FALSE if we are comparing
476 compare (GList * compared, GESTrackObject * track_object, gboolean ahead)
479 gint64 start, duration, compared_start, compared_duration, end, compared_end,
480 tr_start, tr_duration;
481 GESTimelineStandardTransition *trans = NULL;
483 GESTimelineLayer *layer;
484 GESTimelineObject *object, *compared_object, *first_object, *second_object;
487 g_return_if_fail (compared);
489 GST_DEBUG ("Recalculating transitions");
491 object = ges_track_object_get_timeline_object (track_object);
494 GST_WARNING ("Trackobject not in a timeline object: "
495 "Can not calulate transitions");
500 compared_object = ges_track_object_get_timeline_object (compared->data);
501 layer = ges_timeline_object_get_layer (object);
503 start = ges_track_object_get_start (track_object);
504 duration = ges_track_object_get_duration (track_object);
505 compared_start = ges_track_object_get_start (compared->data);
506 compared_duration = ges_track_object_get_duration (compared->data);
507 end = start + duration;
508 compared_end = compared_start + compared_duration;
511 /* Make sure we remove the last transition we created it is not needed
512 * FIXME make it a smarter way */
513 if (compared->prev && GES_IS_TRACK_TRANSITION (compared->prev->data)) {
514 trans = GES_TIMELINE_STANDARD_TRANSITION
515 (ges_track_object_get_timeline_object (compared->prev->data));
516 g_object_get (compared->prev->data, "start", &tr_start, "duration",
518 if (tr_start >= compared_start && tr_start + tr_duration <= compared_end)
519 ges_timeline_layer_remove_object (layer, GES_TIMELINE_OBJECT (trans));
523 for (tmp = compared->next; tmp; tmp = tmp->next) {
524 /* If we have a transitionm we recaluculate its values */
525 if (GES_IS_TRACK_TRANSITION (tmp->data)) {
526 g_object_get (tmp->data, "start", &tr_start, "duration", &tr_duration,
529 if (tr_start + tr_duration == compared_start + compared_duration) {
530 GESTimelineObject *tlobj;
531 tlobj = ges_track_object_get_timeline_object (tmp->data);
533 trans = GES_TIMELINE_STANDARD_TRANSITION (tlobj);
539 if (compared_end <= start) {
541 ges_timeline_layer_remove_object (layer, GES_TIMELINE_OBJECT (trans));
542 g_object_get (compared_object, "priority", &priority, NULL);
543 g_object_set (object, "priority", priority, NULL);
547 } else if (start > compared_start && end < compared_end) {
549 /* Transition not needed anymore */
550 ges_timeline_layer_remove_object (layer, GES_TIMELINE_OBJECT (trans));
553 } else if (start <= compared_start) {
555 ges_timeline_layer_remove_object (layer, GES_TIMELINE_OBJECT (trans));
562 if (compared->next && GES_IS_TRACK_TRANSITION (compared->next->data)) {
563 trans = GES_TIMELINE_STANDARD_TRANSITION
564 (ges_track_object_get_timeline_object (compared->next->data));
565 g_object_get (compared->prev->data, "start", &tr_start, "duration",
567 if (tr_start >= compared_start && tr_start + tr_duration <= compared_end)
568 ges_timeline_layer_remove_object (layer, GES_TIMELINE_OBJECT (trans));
571 for (tmp = compared->prev; tmp; tmp = tmp->prev) {
572 if GES_IS_TRACK_TRANSITION
574 g_object_get (tmp->data, "start", &tr_start, "duration", &tr_duration,
576 if (tr_start == compared_start) {
577 trans = GES_TIMELINE_STANDARD_TRANSITION
578 (ges_track_object_get_timeline_object (tmp->data));
584 if (start + duration <= compared_start) {
586 ges_timeline_layer_remove_object (layer, GES_TIMELINE_OBJECT (trans));
587 g_object_get (object, "priority", &priority, NULL);
588 g_object_set (compared_object, "priority", priority, NULL);
592 } else if (start > compared_start) {
594 ges_timeline_layer_remove_object (layer, GES_TIMELINE_OBJECT (trans));
597 } else if (start < compared_start && end > compared_end) {
599 ges_timeline_layer_remove_object (layer, GES_TIMELINE_OBJECT (trans));
610 ges_timeline_standard_transition_new_for_nick ((gchar *) "crossfade");
611 track = ges_track_object_get_track (track_object);
613 ges_timeline_object_set_supported_formats (GES_TIMELINE_OBJECT (trans),
616 ges_timeline_layer_add_object (layer, GES_TIMELINE_OBJECT (trans));
619 first_object = ges_track_object_get_timeline_object (compared->data);
620 second_object = object;
622 second_object = ges_track_object_get_timeline_object (compared->data);
623 first_object = object;
626 g_object_get (first_object, "priority", &priority, "height", &height, NULL);
627 g_object_set (second_object, "priority", priority + height, NULL);
628 g_signal_connect (first_object, "notify::height",
629 (GCallback) timeline_object_height_changed_cb, second_object);
633 g_object_set (trans, "start", start, "duration",
634 compared_duration + compared_start - start, NULL);
636 g_object_set (trans, "start", compared_start, "duration",
637 start + duration - compared_start, NULL);
641 g_object_unref (layer);
646 * ges_timeline_layer_remove_object:
647 * @layer: a #GESTimelineLayer
648 * @object: the #GESTimelineObject to remove
650 * Removes the given @object from the @layer and unparents it.
651 * Unparenting it means the reference owned by @layer on the @object will be
652 * removed. If you wish to use the @object after this function, make sure you
653 * call g_object_ref() before removing it from the @layer.
655 * Returns: TRUE if the object could be removed, FALSE if the layer does
656 * not want to remove the object.
659 ges_timeline_layer_remove_object (GESTimelineLayer * layer,
660 GESTimelineObject * object)
662 GESTimelineLayer *tl_obj_layer;
664 g_return_val_if_fail (GES_IS_TIMELINE_LAYER (layer), FALSE);
665 g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE);
667 GST_DEBUG ("layer:%p, object:%p", layer, object);
669 tl_obj_layer = ges_timeline_object_get_layer (object);
670 if (G_UNLIKELY (tl_obj_layer != layer)) {
671 GST_WARNING ("TimelineObject doesn't belong to this layer");
672 if (tl_obj_layer != NULL)
673 g_object_unref (tl_obj_layer);
676 g_object_unref (tl_obj_layer);
678 /* emit 'object-removed' */
679 g_signal_emit (layer, ges_timeline_layer_signals[OBJECT_REMOVED], 0, object);
681 /* inform the object it's no longer in a layer */
682 ges_timeline_object_set_layer (object, NULL);
684 /* Remove it from our list of controlled objects */
685 layer->priv->objects_start =
686 g_list_remove (layer->priv->objects_start, object);
688 /* Remove our reference to the object */
689 g_object_unref (object);
695 * ges_timeline_layer_resync_priorities:
696 * @layer: a #GESTimelineLayer
698 * Resyncs the priorities of the objects controlled by @layer.
702 ges_timeline_layer_resync_priorities (GESTimelineLayer * layer)
705 GESTimelineObject *obj;
707 GST_DEBUG ("Resync priorities of %p", layer);
709 /* TODO : Inhibit composition updates while doing this.
710 * Ideally we want to do it from an even higher level, but here will
711 * do in the meantime. */
713 for (tmp = layer->priv->objects_start; tmp; tmp = tmp->next) {
714 obj = GES_TIMELINE_OBJECT (tmp->data);
715 ges_timeline_object_set_priority (obj, GES_TIMELINE_OBJECT_PRIORITY (obj));
722 * ges_timeline_layer_set_priority:
723 * @layer: a #GESTimelineLayer
724 * @priority: the priority to set
726 * Sets the layer to the given @priority. See the documentation of the
727 * priority property for more information.
730 ges_timeline_layer_set_priority (GESTimelineLayer * layer, guint priority)
732 g_return_if_fail (GES_IS_TIMELINE_LAYER (layer));
734 GST_DEBUG ("layer:%p, priority:%d", layer, priority);
736 if (priority != layer->priv->priority) {
737 layer->priv->priority = priority;
738 layer->min_gnl_priority = (priority * LAYER_HEIGHT);
739 layer->max_gnl_priority = ((priority + 1) * LAYER_HEIGHT) - 1;
741 ges_timeline_layer_resync_priorities (layer);
746 * ges_timeline_layer_get_auto_transition:
747 * @layer: a #GESTimelineLayer
749 * Get the priority of @layer within the timeline.
751 * Returns: The priority of the @layer within the timeline.
754 ges_timeline_layer_get_auto_transition (GESTimelineLayer * layer)
756 g_return_val_if_fail (GES_IS_TIMELINE_LAYER (layer), 0);
758 return layer->priv->auto_transition;
762 * ges_timeline_layer_set_auto_transition:
763 * @layer: a #GESTimelineLayer
764 * @priority: whether the auto_transition is active
766 * Sets the layer to the given @auto_transition. See the documentation of the
767 * priority auto_transition for more information.
770 ges_timeline_layer_set_auto_transition (GESTimelineLayer * layer,
771 gboolean auto_transition)
775 g_return_if_fail (GES_IS_TIMELINE_LAYER (layer));
777 if (auto_transition) {
778 for (tmp = layer->priv->objects_start; tmp; tmp = tmp->next) {
779 if (GES_IS_TIMELINE_SOURCE (tmp->data)) {
780 g_signal_connect (G_OBJECT (tmp->data), "track-object-added",
781 G_CALLBACK (track_object_added_cb), layer);
782 g_signal_connect (G_OBJECT (tmp->data), "track-object-removed",
783 G_CALLBACK (track_object_removed_cb), layer);
786 /* FIXME calculate all the transitions at that time */
788 layer->priv->auto_transition = auto_transition;
792 * ges_timeline_layer_get_priority:
793 * @layer: a #GESTimelineLayer
795 * Get the priority of @layer within the timeline.
797 * Returns: The priority of the @layer within the timeline.
800 ges_timeline_layer_get_priority (GESTimelineLayer * layer)
802 g_return_val_if_fail (GES_IS_TIMELINE_LAYER (layer), 0);
804 return layer->priv->priority;
808 * ges_timeline_layer_get_objects:
809 * @layer: a #GESTimelineLayer
811 * Get the timeline objects this layer contains.
813 * Returns: (transfer full) (element-type GESTimelineObject): a #GList of
814 * timeline objects. The user is responsible for
815 * unreffing the contained objects and freeing the list.
819 ges_timeline_layer_get_objects (GESTimelineLayer * layer)
823 GESTimelineLayerClass *klass;
825 g_return_val_if_fail (GES_IS_TIMELINE_LAYER (layer), NULL);
827 klass = GES_TIMELINE_LAYER_GET_CLASS (layer);
829 if (klass->get_objects) {
830 return klass->get_objects (layer);
833 for (tmp = layer->priv->objects_start; tmp; tmp = tmp->next) {
834 ret = g_list_prepend (ret, tmp->data);
835 g_object_ref (tmp->data);
838 ret = g_list_reverse (ret);