2009-08-04 15:13:11 +00:00
|
|
|
/* GStreamer Editing Services
|
2009-11-30 14:14:25 +00:00
|
|
|
* Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
|
|
|
|
* 2009 Nokia Corporation
|
2009-08-04 15:13:11 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2009-09-10 16:40:51 +00:00
|
|
|
* SECTION:ges-timeline-layer
|
|
|
|
* @short_description: Non-overlaping sequence of #GESTimelineObject
|
2009-08-04 15:13:11 +00:00
|
|
|
*
|
2010-05-31 16:59:12 +00:00
|
|
|
* Responsible for the ordering of the various contained TimelineObject(s). A
|
|
|
|
* timeline layer has a "priority" property, which is used to manage the
|
|
|
|
* priorities of individual TimelineObjects. Two layers should not have the
|
|
|
|
* same priority within a given timeline.
|
2009-08-04 15:13:11 +00:00
|
|
|
*/
|
|
|
|
|
2009-09-10 16:40:51 +00:00
|
|
|
#include "ges-internal.h"
|
|
|
|
#include "gesmarshal.h"
|
|
|
|
#include "ges-timeline-layer.h"
|
|
|
|
#include "ges.h"
|
|
|
|
|
2010-12-20 11:00:06 +00:00
|
|
|
G_DEFINE_TYPE (GESTimelineLayer, ges_timeline_layer, G_TYPE_INITIALLY_UNOWNED);
|
2009-08-06 15:38:43 +00:00
|
|
|
|
2010-12-04 18:54:13 +00:00
|
|
|
struct _GESTimelineLayerPrivate
|
|
|
|
{
|
2010-12-16 11:41:26 +00:00
|
|
|
/*< private > */
|
|
|
|
GSList *objects_start; /* The TimelineObjects sorted by start and
|
|
|
|
* priority */
|
|
|
|
|
|
|
|
guint32 priority; /* The priority of the layer within the
|
|
|
|
* containing timeline */
|
2010-12-04 18:54:13 +00:00
|
|
|
};
|
|
|
|
|
2010-03-12 18:06:42 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_PRIORITY,
|
|
|
|
};
|
|
|
|
|
2009-08-06 15:38:43 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
OBJECT_ADDED,
|
|
|
|
OBJECT_REMOVED,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
static guint ges_timeline_layer_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
2010-06-09 14:27:43 +00:00
|
|
|
static gboolean ges_timeline_layer_resync_priorities (GESTimelineLayer * layer);
|
|
|
|
|
2009-08-06 15:38:43 +00:00
|
|
|
static void
|
|
|
|
ges_timeline_layer_get_property (GObject * object, guint property_id,
|
2009-08-04 15:16:31 +00:00
|
|
|
GValue * value, GParamSpec * pspec)
|
2009-08-04 15:13:11 +00:00
|
|
|
{
|
2010-03-12 18:06:42 +00:00
|
|
|
GESTimelineLayer *layer = GES_TIMELINE_LAYER (object);
|
|
|
|
|
2009-08-04 15:13:11 +00:00
|
|
|
switch (property_id) {
|
2010-03-12 18:06:42 +00:00
|
|
|
case PROP_PRIORITY:
|
2010-12-16 11:41:26 +00:00
|
|
|
g_value_set_uint (value, layer->priv->priority);
|
2010-03-12 18:06:42 +00:00
|
|
|
break;
|
2009-08-04 15:16:31 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
2009-08-04 15:13:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-08-04 15:16:31 +00:00
|
|
|
ges_timeline_layer_set_property (GObject * object, guint property_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
2009-08-04 15:13:11 +00:00
|
|
|
{
|
2010-03-12 18:06:42 +00:00
|
|
|
GESTimelineLayer *layer = GES_TIMELINE_LAYER (object);
|
|
|
|
|
2009-08-04 15:13:11 +00:00
|
|
|
switch (property_id) {
|
2010-03-12 18:06:42 +00:00
|
|
|
case PROP_PRIORITY:
|
|
|
|
ges_timeline_layer_set_priority (layer, g_value_get_uint (value));
|
|
|
|
break;
|
2009-08-04 15:16:31 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
2009-08-04 15:13:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-08-04 15:16:31 +00:00
|
|
|
ges_timeline_layer_dispose (GObject * object)
|
2009-08-04 15:13:11 +00:00
|
|
|
{
|
2009-09-14 17:23:52 +00:00
|
|
|
GESTimelineLayer *layer = GES_TIMELINE_LAYER (object);
|
2010-12-16 11:41:26 +00:00
|
|
|
GESTimelineLayerPrivate *priv = layer->priv;
|
2009-09-14 17:23:52 +00:00
|
|
|
|
2010-06-09 11:52:08 +00:00
|
|
|
GST_DEBUG ("Disposing layer");
|
|
|
|
|
2010-12-16 11:41:26 +00:00
|
|
|
while (priv->objects_start)
|
|
|
|
ges_timeline_layer_remove_object (layer,
|
|
|
|
(GESTimelineObject *) priv->objects_start->data);
|
2010-06-09 11:52:08 +00:00
|
|
|
|
2009-08-04 15:13:11 +00:00
|
|
|
G_OBJECT_CLASS (ges_timeline_layer_parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-08-04 15:16:31 +00:00
|
|
|
ges_timeline_layer_class_init (GESTimelineLayerClass * klass)
|
2009-08-04 15:13:11 +00:00
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
2010-12-04 18:54:13 +00:00
|
|
|
g_type_class_add_private (klass, sizeof (GESTimelineLayerPrivate));
|
|
|
|
|
2009-08-04 15:13:11 +00:00
|
|
|
object_class->get_property = ges_timeline_layer_get_property;
|
|
|
|
object_class->set_property = ges_timeline_layer_set_property;
|
|
|
|
object_class->dispose = ges_timeline_layer_dispose;
|
2009-08-06 15:38:43 +00:00
|
|
|
|
2010-03-12 18:06:42 +00:00
|
|
|
/**
|
|
|
|
* GESTimelineLayer:priority
|
|
|
|
*
|
|
|
|
* The priority of the layer in the #GESTimeline. 0 is the highest
|
2010-05-31 16:59:12 +00:00
|
|
|
* priority. Conceptually, a #GESTimeline is a stack of GESTimelineLayers,
|
|
|
|
* and the priority of the layer represents its position in the stack. Two
|
|
|
|
* layers should not have the same priority within a given GESTimeline.
|
2010-03-12 18:06:42 +00:00
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class, PROP_PRIORITY,
|
|
|
|
g_param_spec_uint ("priority", "Priority",
|
|
|
|
"The priority of the layer", 0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
|
|
|
|
2009-09-16 10:37:45 +00:00
|
|
|
/**
|
|
|
|
* GESTimelineLayer::object-added
|
|
|
|
* @layer: the #GESTimelineLayer
|
|
|
|
* @object: the #GESTimelineObject that was added.
|
|
|
|
*
|
|
|
|
* Will be emitted after the object was added to the layer.
|
|
|
|
*/
|
2009-08-06 15:38:43 +00:00
|
|
|
ges_timeline_layer_signals[OBJECT_ADDED] =
|
|
|
|
g_signal_new ("object-added", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GESTimelineLayerClass, object_added),
|
|
|
|
NULL, NULL, ges_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
|
|
|
|
GES_TYPE_TIMELINE_OBJECT);
|
|
|
|
|
2009-09-16 10:37:45 +00:00
|
|
|
/**
|
|
|
|
* GESTimelineLayer::object-removed
|
|
|
|
* @layer: the #GESTimelineLayer
|
|
|
|
* @object: the #GESTimelineObject that was removed
|
|
|
|
*
|
|
|
|
* Will be emitted after the object was removed from the layer.
|
|
|
|
*/
|
2009-08-06 15:38:43 +00:00
|
|
|
ges_timeline_layer_signals[OBJECT_REMOVED] =
|
|
|
|
g_signal_new ("object-removed", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GESTimelineLayerClass,
|
|
|
|
object_removed), NULL, NULL, ges_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
|
|
|
|
GES_TYPE_TIMELINE_OBJECT);
|
|
|
|
|
2009-08-04 15:13:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-08-04 15:16:31 +00:00
|
|
|
ges_timeline_layer_init (GESTimelineLayer * self)
|
2009-08-04 15:13:11 +00:00
|
|
|
{
|
2010-12-04 18:54:13 +00:00
|
|
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
|
|
|
GES_TYPE_TIMELINE_LAYER, GESTimelineLayerPrivate);
|
|
|
|
|
2010-03-12 18:06:42 +00:00
|
|
|
/* TODO : Keep those 3 values in sync */
|
2010-12-16 11:41:26 +00:00
|
|
|
self->priv->priority = 0;
|
2010-03-12 18:06:42 +00:00
|
|
|
self->min_gnl_priority = 0;
|
|
|
|
self->max_gnl_priority = 9;
|
2009-08-04 15:13:11 +00:00
|
|
|
}
|
|
|
|
|
2009-09-16 10:37:45 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_layer_new:
|
|
|
|
*
|
|
|
|
* Creates a new #GESTimelineLayer.
|
|
|
|
*
|
|
|
|
* Returns: A new #GESTimelineLayer
|
|
|
|
*/
|
2009-08-04 15:16:31 +00:00
|
|
|
GESTimelineLayer *
|
2009-08-04 15:13:11 +00:00
|
|
|
ges_timeline_layer_new (void)
|
|
|
|
{
|
|
|
|
return g_object_new (GES_TYPE_TIMELINE_LAYER, NULL);
|
|
|
|
}
|
2009-08-06 15:38:43 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
ges_timeline_layer_set_timeline (GESTimelineLayer * layer,
|
|
|
|
GESTimeline * timeline)
|
|
|
|
{
|
|
|
|
GST_DEBUG ("layer:%p, timeline:%p", layer, timeline);
|
|
|
|
|
|
|
|
layer->timeline = timeline;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
objects_start_compare (GESTimelineObject * a, GESTimelineObject * b)
|
|
|
|
{
|
|
|
|
if (a->start == b->start) {
|
|
|
|
if (a->priority < b->priority)
|
|
|
|
return -1;
|
|
|
|
if (a->priority > b->priority)
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (a->start < b->start)
|
|
|
|
return -1;
|
|
|
|
if (a->start > b->start)
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-09-14 17:23:52 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_layer_add_object:
|
|
|
|
* @layer: a #GESTimelineLayer
|
2010-12-20 11:01:04 +00:00
|
|
|
* @object: (transfer full): the #GESTimelineObject to add.
|
2009-09-14 17:23:52 +00:00
|
|
|
*
|
2010-12-20 11:01:04 +00:00
|
|
|
* Adds the given object to the layer. Sets the object's parent, and thus
|
|
|
|
* takes ownership of the object.
|
|
|
|
*
|
|
|
|
* An object can only be added to one layer.
|
2009-09-14 17:23:52 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE if the object was properly added to the layer, or FALSE
|
2010-12-20 11:01:04 +00:00
|
|
|
* if the @layer refuses to add the object.
|
2009-09-14 17:23:52 +00:00
|
|
|
*/
|
|
|
|
|
2009-08-06 15:38:43 +00:00
|
|
|
gboolean
|
|
|
|
ges_timeline_layer_add_object (GESTimelineLayer * layer,
|
|
|
|
GESTimelineObject * object)
|
|
|
|
{
|
2010-11-28 12:24:07 +00:00
|
|
|
GESTimelineLayer *tl_obj_layer;
|
|
|
|
|
2009-08-06 15:38:43 +00:00
|
|
|
GST_DEBUG ("layer:%p, object:%p", layer, object);
|
|
|
|
|
2010-11-28 12:24:07 +00:00
|
|
|
tl_obj_layer = ges_timeline_object_get_layer (object);
|
2010-12-20 11:01:04 +00:00
|
|
|
|
2010-11-28 12:24:07 +00:00
|
|
|
if (G_UNLIKELY (tl_obj_layer)) {
|
2011-01-31 19:00:49 +00:00
|
|
|
GST_WARNING ("TimelineObject %p already belongs to another layer", object);
|
2010-11-28 12:24:07 +00:00
|
|
|
g_object_unref (tl_obj_layer);
|
2009-08-06 15:38:43 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-12-20 11:01:04 +00:00
|
|
|
g_object_ref_sink (object);
|
|
|
|
|
2009-08-06 15:38:43 +00:00
|
|
|
/* Take a reference to the object and store it stored by start/priority */
|
2010-12-16 11:41:26 +00:00
|
|
|
layer->priv->objects_start =
|
|
|
|
g_slist_insert_sorted (layer->priv->objects_start, object,
|
2009-08-06 15:38:43 +00:00
|
|
|
(GCompareFunc) objects_start_compare);
|
|
|
|
|
|
|
|
/* Inform the object it's now in this layer */
|
|
|
|
ges_timeline_object_set_layer (object, layer);
|
|
|
|
|
2010-11-26 12:02:48 +00:00
|
|
|
GST_DEBUG ("current object priority : %d, layer min/max : %d/%d",
|
|
|
|
GES_TIMELINE_OBJECT_PRIORITY (object),
|
|
|
|
layer->min_gnl_priority, layer->max_gnl_priority);
|
|
|
|
|
2010-03-12 18:06:42 +00:00
|
|
|
/* Set the priority. */
|
2010-05-25 11:44:57 +00:00
|
|
|
if (GES_TIMELINE_OBJECT_PRIORITY (object) > (layer->max_gnl_priority)) {
|
|
|
|
ges_timeline_object_set_priority (object, layer->max_gnl_priority);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (GES_TIMELINE_OBJECT_PRIORITY (object) < (layer->min_gnl_priority)) {
|
|
|
|
ges_timeline_object_set_priority (object, layer->min_gnl_priority);
|
|
|
|
}
|
2010-03-12 18:06:42 +00:00
|
|
|
|
2009-08-06 15:38:43 +00:00
|
|
|
/* emit 'object-added' */
|
|
|
|
g_signal_emit (layer, ges_timeline_layer_signals[OBJECT_ADDED], 0, object);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2009-08-07 14:39:09 +00:00
|
|
|
|
2009-09-14 17:23:52 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_layer_remove_object:
|
|
|
|
* @layer: a #GESTimelineLayer
|
|
|
|
* @object: the #GESTimelineObject to remove
|
|
|
|
*
|
2010-12-20 11:01:04 +00:00
|
|
|
* Removes the given @object from the @layer and unparents it.
|
|
|
|
* Unparenting it means the reference owned by @layer on the @object will be
|
|
|
|
* removed. If you wish to use the @object after this function, make sure you
|
|
|
|
* call g_object_ref() before removing it from the @layer.
|
2009-09-14 17:23:52 +00:00
|
|
|
*
|
2010-12-20 11:01:04 +00:00
|
|
|
* Returns: TRUE if the object could be removed, FALSE if the layer does
|
|
|
|
* not want to remove the object.
|
2009-09-14 17:23:52 +00:00
|
|
|
*/
|
2009-08-07 14:39:09 +00:00
|
|
|
gboolean
|
|
|
|
ges_timeline_layer_remove_object (GESTimelineLayer * layer,
|
|
|
|
GESTimelineObject * object)
|
|
|
|
{
|
2010-11-28 12:24:07 +00:00
|
|
|
GESTimelineLayer *tl_obj_layer;
|
2010-12-20 11:01:04 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_LAYER (layer), FALSE);
|
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE);
|
|
|
|
|
2009-08-07 14:39:09 +00:00
|
|
|
GST_DEBUG ("layer:%p, object:%p", layer, object);
|
|
|
|
|
2010-11-28 12:24:07 +00:00
|
|
|
tl_obj_layer = ges_timeline_object_get_layer (object);
|
|
|
|
if (G_UNLIKELY (tl_obj_layer != layer)) {
|
2009-08-07 14:39:09 +00:00
|
|
|
GST_WARNING ("TimelineObject doesn't belong to this layer");
|
2010-11-28 12:24:07 +00:00
|
|
|
if (tl_obj_layer != NULL)
|
|
|
|
g_object_unref (tl_obj_layer);
|
2009-08-07 14:39:09 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2010-11-28 12:24:07 +00:00
|
|
|
g_object_unref (tl_obj_layer);
|
2009-08-07 14:39:09 +00:00
|
|
|
|
|
|
|
/* emit 'object-removed' */
|
|
|
|
g_signal_emit (layer, ges_timeline_layer_signals[OBJECT_REMOVED], 0, object);
|
|
|
|
|
|
|
|
/* inform the object it's no longer in a layer */
|
|
|
|
ges_timeline_object_set_layer (object, NULL);
|
|
|
|
|
|
|
|
/* Remove it from our list of controlled objects */
|
2010-12-16 11:41:26 +00:00
|
|
|
layer->priv->objects_start =
|
|
|
|
g_slist_remove (layer->priv->objects_start, object);
|
2009-08-07 14:39:09 +00:00
|
|
|
|
|
|
|
/* Remove our reference to the object */
|
|
|
|
g_object_unref (object);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2010-03-12 18:06:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_timeline_layer_resync_priorities:
|
|
|
|
* @layer: a #GESTimelineLayer
|
|
|
|
*
|
|
|
|
* Resyncs the priorities of the objects controlled by @layer.
|
2010-12-16 11:41:26 +00:00
|
|
|
* This method
|
|
|
|
*/
|
2010-03-12 18:06:42 +00:00
|
|
|
gboolean
|
|
|
|
ges_timeline_layer_resync_priorities (GESTimelineLayer * layer)
|
|
|
|
{
|
|
|
|
GSList *tmp;
|
|
|
|
|
|
|
|
/* TODO : Inhibit composition updates while doing this.
|
|
|
|
* Ideally we want to do it from an even higher level, but here will
|
|
|
|
* do in the meantime. */
|
|
|
|
|
|
|
|
/* TODO : This is the dumb version where we put everything linearly,
|
|
|
|
* will need to be adjusted for more complex usages (like with
|
|
|
|
* transitions). */
|
2010-12-16 11:41:26 +00:00
|
|
|
for (tmp = layer->priv->objects_start; tmp; tmp = tmp->next) {
|
2010-03-12 18:06:42 +00:00
|
|
|
ges_timeline_object_set_priority ((GESTimelineObject *) tmp->data,
|
|
|
|
layer->min_gnl_priority);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-07-06 14:27:08 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_layer_set_priority:
|
|
|
|
* @layer: a #GESTimelineLayer
|
|
|
|
* @priority: the priority to set
|
|
|
|
*
|
2010-12-16 11:41:26 +00:00
|
|
|
* Sets the layer to the given @priority. See the documentation of the
|
|
|
|
* priority property for more information.
|
2010-07-06 14:27:08 +00:00
|
|
|
*/
|
2010-03-12 18:06:42 +00:00
|
|
|
void
|
|
|
|
ges_timeline_layer_set_priority (GESTimelineLayer * layer, guint priority)
|
|
|
|
{
|
2010-12-16 11:41:26 +00:00
|
|
|
g_return_if_fail (GES_IS_TIMELINE_LAYER (layer));
|
|
|
|
|
2010-03-12 18:06:42 +00:00
|
|
|
GST_DEBUG ("layer:%p, priority:%d", layer, priority);
|
|
|
|
|
2010-12-16 11:41:26 +00:00
|
|
|
if (priority != layer->priv->priority) {
|
|
|
|
layer->priv->priority = priority;
|
2010-03-12 18:06:42 +00:00
|
|
|
layer->min_gnl_priority = (priority * 10);
|
|
|
|
layer->max_gnl_priority = ((priority + 1) * 10) - 1;
|
|
|
|
|
|
|
|
/* FIXME : Update controlled object's gnl priority accordingly */
|
|
|
|
ges_timeline_layer_resync_priorities (layer);
|
|
|
|
}
|
|
|
|
}
|
2010-09-22 11:29:26 +00:00
|
|
|
|
2010-12-16 11:41:26 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_layer_get_priority:
|
|
|
|
* @layer: a #GESTimelineLayer
|
|
|
|
*
|
2011-01-10 13:28:35 +00:00
|
|
|
* Get the priority of @layer within the timeline.
|
|
|
|
*
|
|
|
|
* Returns: The priority of the @layer within the timeline.
|
2010-12-16 11:41:26 +00:00
|
|
|
*/
|
|
|
|
guint
|
|
|
|
ges_timeline_layer_get_priority (GESTimelineLayer * layer)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_LAYER (layer), 0);
|
|
|
|
|
|
|
|
return layer->priv->priority;
|
|
|
|
}
|
|
|
|
|
2010-09-22 11:29:26 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_layer_get_objects:
|
|
|
|
* @layer: a #GESTimelineLayer
|
|
|
|
*
|
|
|
|
* Get the timeline objects this layer contains.
|
|
|
|
*
|
2010-12-15 18:40:11 +00:00
|
|
|
* Returns: (transfer full) (element-type GESTimelineObject): a #GList of
|
|
|
|
* timeline objects. The user is responsible for
|
2010-09-22 11:29:26 +00:00
|
|
|
* unreffing the contained objects and freeing the list.
|
|
|
|
*/
|
|
|
|
|
|
|
|
GList *
|
|
|
|
ges_timeline_layer_get_objects (GESTimelineLayer * layer)
|
|
|
|
{
|
|
|
|
GList *ret = NULL;
|
|
|
|
GSList *tmp;
|
|
|
|
GESTimelineLayerClass *klass;
|
|
|
|
|
2010-12-16 11:41:26 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_LAYER (layer), NULL);
|
|
|
|
|
2010-09-22 11:29:26 +00:00
|
|
|
klass = GES_TIMELINE_LAYER_GET_CLASS (layer);
|
|
|
|
|
|
|
|
if (klass->get_objects) {
|
|
|
|
return klass->get_objects (layer);
|
|
|
|
}
|
|
|
|
|
2010-12-16 11:41:26 +00:00
|
|
|
for (tmp = layer->priv->objects_start; tmp; tmp = tmp->next) {
|
2010-09-22 11:29:26 +00:00
|
|
|
ret = g_list_prepend (ret, tmp->data);
|
|
|
|
g_object_ref (tmp->data);
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = g_list_reverse (ret);
|
|
|
|
return ret;
|
|
|
|
}
|