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-object
|
|
|
|
* @short_description: Base Class for objects in a #GESTimelineLayer
|
2009-08-04 15:13:11 +00:00
|
|
|
*
|
2010-12-09 11:53:07 +00:00
|
|
|
* A #GESTimelineObject is a 'natural' object which controls one or more
|
|
|
|
* #GESTrackObject(s) in one or more #GESTrack(s).
|
2009-08-04 15:13:11 +00:00
|
|
|
*
|
2010-12-09 11:53:07 +00:00
|
|
|
* Keeps a reference to the #GESTrackObject(s) it created and
|
|
|
|
* sets/updates their properties.
|
2009-08-04 15:13:11 +00:00
|
|
|
*/
|
|
|
|
|
2009-09-10 16:40:51 +00:00
|
|
|
#include "ges-timeline-object.h"
|
|
|
|
#include "ges.h"
|
|
|
|
#include "ges-internal.h"
|
|
|
|
|
2010-06-09 14:27:43 +00:00
|
|
|
gboolean
|
|
|
|
ges_timeline_object_fill_track_object_func (GESTimelineObject * object,
|
|
|
|
GESTrackObject * trackobj, GstElement * gnlobj);
|
|
|
|
|
2010-07-07 14:51:39 +00:00
|
|
|
gboolean
|
|
|
|
ges_timeline_object_create_track_objects_func (GESTimelineObject
|
|
|
|
* object, GESTrack * track);
|
2009-08-04 15:13:11 +00:00
|
|
|
|
2010-07-09 11:49:23 +00:00
|
|
|
static void
|
2010-12-16 18:29:14 +00:00
|
|
|
track_object_start_changed_cb (GESTrackObject * child,
|
|
|
|
GParamSpec * arg G_GNUC_UNUSED, GESTimelineObject * object);
|
|
|
|
static void
|
|
|
|
track_object_inpoint_changed_cb (GESTrackObject * child,
|
|
|
|
GParamSpec * arg G_GNUC_UNUSED, GESTimelineObject * object);
|
|
|
|
static void
|
|
|
|
track_object_duration_changed_cb (GESTrackObject * child,
|
|
|
|
GParamSpec * arg G_GNUC_UNUSED, GESTimelineObject * object);
|
|
|
|
static void
|
|
|
|
track_object_priority_changed_cb (GESTrackObject * child,
|
|
|
|
GParamSpec * arg G_GNUC_UNUSED, GESTimelineObject * object);
|
2010-07-09 11:49:23 +00:00
|
|
|
|
2010-12-20 11:01:04 +00:00
|
|
|
G_DEFINE_ABSTRACT_TYPE (GESTimelineObject, ges_timeline_object,
|
|
|
|
G_TYPE_INITIALLY_UNOWNED);
|
2009-08-06 10:14:37 +00:00
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
/* Mapping of relationship between a TimelineObject and the TrackObjects
|
|
|
|
* it controls
|
|
|
|
*
|
|
|
|
* NOTE : how do we make this public in the future ?
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GESTrackObject *object;
|
|
|
|
gint64 start_offset;
|
|
|
|
gint64 duration_offset;
|
|
|
|
gint64 inpoint_offset;
|
|
|
|
gint32 priority_offset;
|
|
|
|
|
|
|
|
guint start_notifyid;
|
|
|
|
guint duration_notifyid;
|
|
|
|
guint inpoint_notifyid;
|
|
|
|
guint priority_notifyid;
|
|
|
|
|
|
|
|
/* track mapping ?? */
|
|
|
|
} ObjectMapping;
|
|
|
|
|
2010-11-28 12:24:07 +00:00
|
|
|
struct _GESTimelineObjectPrivate
|
|
|
|
{
|
|
|
|
/*< public > */
|
|
|
|
GESTimelineLayer *layer;
|
|
|
|
|
|
|
|
/*< private > */
|
|
|
|
/* A list of TrackObject controlled by this TimelineObject */
|
|
|
|
GList *trackobjects;
|
2010-12-16 18:29:14 +00:00
|
|
|
|
|
|
|
/* Set to TRUE when the timelineobject is doing updates of track object
|
|
|
|
* properties so we don't end up in infinite property update loops
|
|
|
|
*/
|
|
|
|
gboolean ignore_notifies;
|
|
|
|
|
|
|
|
GList *mappings;
|
2010-11-28 12:24:07 +00:00
|
|
|
};
|
|
|
|
|
2009-08-07 18:33:18 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_START,
|
|
|
|
PROP_INPOINT,
|
|
|
|
PROP_DURATION,
|
|
|
|
PROP_PRIORITY,
|
2010-07-09 09:51:21 +00:00
|
|
|
PROP_HEIGHT,
|
2010-11-28 12:24:07 +00:00
|
|
|
PROP_LAYER,
|
2010-12-16 18:29:14 +00:00
|
|
|
PROP_LAST
|
2009-08-07 18:33:18 +00:00
|
|
|
};
|
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
static GParamSpec *properties[PROP_LAST];
|
|
|
|
|
2009-08-06 10:14:37 +00:00
|
|
|
static void
|
|
|
|
ges_timeline_object_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
|
|
|
{
|
2009-08-07 18:33:18 +00:00
|
|
|
GESTimelineObject *tobj = GES_TIMELINE_OBJECT (object);
|
|
|
|
|
2009-08-04 15:13:11 +00:00
|
|
|
switch (property_id) {
|
2009-08-07 18:33:18 +00:00
|
|
|
case PROP_START:
|
|
|
|
g_value_set_uint64 (value, tobj->start);
|
|
|
|
break;
|
|
|
|
case PROP_INPOINT:
|
|
|
|
g_value_set_uint64 (value, tobj->inpoint);
|
|
|
|
break;
|
|
|
|
case PROP_DURATION:
|
|
|
|
g_value_set_uint64 (value, tobj->duration);
|
|
|
|
break;
|
|
|
|
case PROP_PRIORITY:
|
|
|
|
g_value_set_uint (value, tobj->priority);
|
2010-11-25 13:01:15 +00:00
|
|
|
break;
|
2010-07-09 09:51:21 +00:00
|
|
|
case PROP_HEIGHT:
|
|
|
|
g_value_set_uint (value, tobj->height);
|
2009-08-07 18:33:18 +00:00
|
|
|
break;
|
2010-11-28 12:24:07 +00:00
|
|
|
case PROP_LAYER:
|
|
|
|
g_value_set_object (value, tobj->priv->layer);
|
|
|
|
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_object_set_property (GObject * object, guint property_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
2009-08-04 15:13:11 +00:00
|
|
|
{
|
2009-08-07 18:33:18 +00:00
|
|
|
GESTimelineObject *tobj = GES_TIMELINE_OBJECT (object);
|
|
|
|
|
2009-08-04 15:13:11 +00:00
|
|
|
switch (property_id) {
|
2009-08-07 18:33:18 +00:00
|
|
|
case PROP_START:
|
|
|
|
ges_timeline_object_set_start (tobj, g_value_get_uint64 (value));
|
|
|
|
break;
|
|
|
|
case PROP_INPOINT:
|
|
|
|
ges_timeline_object_set_inpoint (tobj, g_value_get_uint64 (value));
|
|
|
|
break;
|
|
|
|
case PROP_DURATION:
|
|
|
|
ges_timeline_object_set_duration (tobj, g_value_get_uint64 (value));
|
|
|
|
break;
|
|
|
|
case PROP_PRIORITY:
|
|
|
|
ges_timeline_object_set_priority (tobj, 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_object_class_init (GESTimelineObjectClass * klass)
|
2009-08-04 15:13:11 +00:00
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
2010-11-28 12:24:07 +00:00
|
|
|
g_type_class_add_private (klass, sizeof (GESTimelineObjectPrivate));
|
|
|
|
|
2009-08-04 15:13:11 +00:00
|
|
|
object_class->get_property = ges_timeline_object_get_property;
|
|
|
|
object_class->set_property = ges_timeline_object_set_property;
|
2010-07-07 14:51:39 +00:00
|
|
|
klass->create_track_objects = ges_timeline_object_create_track_objects_func;
|
2009-08-07 18:33:18 +00:00
|
|
|
|
2009-09-16 10:37:45 +00:00
|
|
|
/**
|
|
|
|
* GESTimelineObject:start
|
|
|
|
*
|
|
|
|
* The position of the object in the #GESTimelineLayer (in nanoseconds).
|
|
|
|
*/
|
2010-12-16 18:29:14 +00:00
|
|
|
properties[PROP_START] = g_param_spec_uint64 ("start", "Start",
|
|
|
|
"The position in the container", 0, G_MAXUINT64, 0, G_PARAM_READWRITE);
|
2009-08-07 18:33:18 +00:00
|
|
|
g_object_class_install_property (object_class, PROP_START,
|
2010-12-16 18:29:14 +00:00
|
|
|
properties[PROP_START]);
|
2009-09-16 10:37:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GESTimelineObject:in-point
|
|
|
|
*
|
|
|
|
* The in-point at which this #GESTimelineObject will start outputting data
|
|
|
|
* from its contents (in nanoseconds).
|
|
|
|
*
|
|
|
|
* Ex : an in-point of 5 seconds means that the first outputted buffer will
|
|
|
|
* be the one located 5 seconds in the controlled resource.
|
|
|
|
*/
|
2010-12-16 18:29:14 +00:00
|
|
|
properties[PROP_INPOINT] =
|
2009-09-16 10:37:45 +00:00
|
|
|
g_param_spec_uint64 ("in-point", "In-point", "The in-point", 0,
|
2010-12-16 18:29:14 +00:00
|
|
|
G_MAXUINT64, 0, G_PARAM_READWRITE);
|
|
|
|
g_object_class_install_property (object_class, PROP_INPOINT,
|
|
|
|
properties[PROP_INPOINT]);
|
2009-09-16 10:37:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GESTimelineObject:duration
|
|
|
|
*
|
|
|
|
* The duration (in nanoseconds) which will be used in the container #GESTrack
|
|
|
|
* starting from 'in-point'.
|
|
|
|
*/
|
2010-12-16 18:29:14 +00:00
|
|
|
properties[PROP_DURATION] =
|
|
|
|
g_param_spec_uint64 ("duration", "Duration", "The duration to use", 0,
|
|
|
|
G_MAXUINT64, GST_CLOCK_TIME_NONE, G_PARAM_READWRITE);
|
2009-08-07 18:33:18 +00:00
|
|
|
g_object_class_install_property (object_class, PROP_DURATION,
|
2010-12-16 18:29:14 +00:00
|
|
|
properties[PROP_DURATION]);
|
2010-07-09 09:50:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GESTimelineObject:priority
|
2010-11-28 12:24:07 +00:00
|
|
|
*
|
2010-07-09 09:50:31 +00:00
|
|
|
* The layer priority of the timeline object.
|
|
|
|
*/
|
2010-12-16 18:29:14 +00:00
|
|
|
properties[PROP_PRIORITY] = g_param_spec_uint ("priority", "Priority",
|
|
|
|
"The priority of the object", 0, G_MAXUINT, 0, G_PARAM_READWRITE);
|
2009-08-07 18:33:18 +00:00
|
|
|
g_object_class_install_property (object_class, PROP_PRIORITY,
|
2010-12-16 18:29:14 +00:00
|
|
|
properties[PROP_PRIORITY]);
|
2009-09-21 10:51:16 +00:00
|
|
|
|
2010-07-09 09:51:21 +00:00
|
|
|
/**
|
|
|
|
* GESTimelineObject:height
|
|
|
|
*
|
|
|
|
* The span of layer priorities which this object occupies.
|
|
|
|
*/
|
2011-02-09 10:21:02 +00:00
|
|
|
properties[PROP_HEIGHT] = g_param_spec_uint ("height", "Height",
|
|
|
|
"The span of priorities this object occupies", 0, G_MAXUINT, 1,
|
|
|
|
G_PARAM_READABLE);
|
2010-07-09 09:51:21 +00:00
|
|
|
g_object_class_install_property (object_class, PROP_HEIGHT,
|
2011-02-09 10:21:02 +00:00
|
|
|
properties[PROP_HEIGHT]);
|
2010-07-09 09:51:21 +00:00
|
|
|
|
2011-02-09 10:21:02 +00:00
|
|
|
/**
|
|
|
|
* GESTimelineObject:layer
|
2010-11-28 12:24:07 +00:00
|
|
|
*
|
|
|
|
* The GESTimelineLayer where this object is being used.
|
|
|
|
*/
|
2011-02-09 10:21:02 +00:00
|
|
|
properties[PROP_LAYER] = g_param_spec_object ("layer", "Layer",
|
|
|
|
"The GESTimelineLayer where this object is being used.",
|
|
|
|
GES_TYPE_TIMELINE_LAYER, G_PARAM_READABLE);
|
2010-11-28 12:24:07 +00:00
|
|
|
g_object_class_install_property (object_class, PROP_LAYER,
|
2011-02-09 10:21:02 +00:00
|
|
|
properties[PROP_LAYER]);
|
2010-11-28 12:24:07 +00:00
|
|
|
|
2009-09-21 10:51:16 +00:00
|
|
|
klass->need_fill_track = TRUE;
|
2009-08-04 15:13:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-08-04 15:16:31 +00:00
|
|
|
ges_timeline_object_init (GESTimelineObject * self)
|
2009-08-04 15:13:11 +00:00
|
|
|
{
|
2010-11-28 12:24:07 +00:00
|
|
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
|
|
|
GES_TYPE_TIMELINE_OBJECT, GESTimelineObjectPrivate);
|
2010-05-19 10:19:37 +00:00
|
|
|
self->duration = GST_SECOND;
|
2010-07-09 10:09:29 +00:00
|
|
|
self->height = 1;
|
2010-11-28 12:24:07 +00:00
|
|
|
self->priv->trackobjects = NULL;
|
|
|
|
self->priv->layer = NULL;
|
2009-08-04 15:13:11 +00:00
|
|
|
}
|
|
|
|
|
2009-08-06 09:23:01 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_object_create_track_object:
|
|
|
|
* @object: The origin #GESTimelineObject
|
|
|
|
* @track: The #GESTrack to create a #GESTrackObject for.
|
|
|
|
*
|
2009-09-21 10:51:16 +00:00
|
|
|
* Creates a #GESTrackObject for the provided @track. The timeline object
|
|
|
|
* keep a reference to the newly created trackobject, you therefore need to
|
|
|
|
* call @ges_timeline_object_release_track_object when you are done with it.
|
2009-08-06 09:23:01 +00:00
|
|
|
*
|
2010-12-15 18:40:11 +00:00
|
|
|
* Returns: (transfer none): A #GESTrackObject. Returns NULL if the #GESTrackObject could not
|
2009-08-06 09:23:01 +00:00
|
|
|
* be created.
|
|
|
|
*/
|
|
|
|
|
|
|
|
GESTrackObject *
|
|
|
|
ges_timeline_object_create_track_object (GESTimelineObject * object,
|
|
|
|
GESTrack * track)
|
|
|
|
{
|
2009-08-06 15:38:43 +00:00
|
|
|
GESTimelineObjectClass *class;
|
|
|
|
GESTrackObject *res;
|
2009-08-06 09:23:01 +00:00
|
|
|
|
2009-08-06 15:38:43 +00:00
|
|
|
class = GES_TIMELINE_OBJECT_GET_CLASS (object);
|
2009-08-06 09:23:01 +00:00
|
|
|
|
2009-08-06 15:38:43 +00:00
|
|
|
if (G_UNLIKELY (class->create_track_object == NULL)) {
|
|
|
|
GST_ERROR ("No 'create_track_object' implementation available");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
res = class->create_track_object (object, track);
|
2010-07-07 15:07:33 +00:00
|
|
|
ges_timeline_object_add_track_object (object, res);
|
2009-08-06 15:38:43 +00:00
|
|
|
return res;
|
2010-07-07 15:07:33 +00:00
|
|
|
|
2009-08-06 15:38:43 +00:00
|
|
|
}
|
|
|
|
|
2010-07-07 14:51:39 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_object_create_track_objects:
|
|
|
|
* @object: The origin #GESTimelineObject
|
|
|
|
* @track: The #GESTrack to create each #GESTrackObject for.
|
|
|
|
*
|
|
|
|
* Creates all #GESTrackObjects supported by this object and adds them to the
|
2010-12-09 11:53:07 +00:00
|
|
|
* provided track. The track is responsible for calling
|
2010-07-07 14:51:39 +00:00
|
|
|
* #ges_timeline_release_track_object on these objects when it is finished
|
|
|
|
* with them.
|
|
|
|
*
|
2010-12-09 11:53:07 +00:00
|
|
|
* Returns: %TRUE if each track object was created successfully, or %FALSE if an
|
2010-07-07 14:51:39 +00:00
|
|
|
* error occured.
|
|
|
|
*/
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
ges_timeline_object_create_track_objects (GESTimelineObject * object,
|
|
|
|
GESTrack * track)
|
|
|
|
{
|
|
|
|
GESTimelineObjectClass *klass;
|
|
|
|
|
|
|
|
klass = GES_TIMELINE_OBJECT_GET_CLASS (object);
|
|
|
|
|
|
|
|
if (!(klass->create_track_objects)) {
|
2010-12-09 11:53:07 +00:00
|
|
|
GST_WARNING ("no GESTimelineObject::create_track_objects implentation");
|
2010-07-07 14:51:39 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return klass->create_track_objects (object, track);
|
|
|
|
}
|
|
|
|
|
2010-12-09 11:53:07 +00:00
|
|
|
/*
|
|
|
|
* default implementation of GESTimelineObjectClass::create_track_objects
|
|
|
|
*/
|
2010-07-07 14:51:39 +00:00
|
|
|
gboolean
|
|
|
|
ges_timeline_object_create_track_objects_func (GESTimelineObject * object,
|
|
|
|
GESTrack * track)
|
|
|
|
{
|
|
|
|
GESTrackObject *result;
|
|
|
|
|
|
|
|
result = ges_timeline_object_create_track_object (object, track);
|
|
|
|
if (!result) {
|
|
|
|
GST_WARNING ("couldn't create track object");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return ges_track_add_object (track, result);
|
|
|
|
}
|
|
|
|
|
2010-07-07 15:07:33 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_object_add_track_object:
|
|
|
|
* @object: a #GESTimelineObject
|
|
|
|
* @trobj: the GESTrackObject
|
2010-11-28 12:24:07 +00:00
|
|
|
*
|
2010-07-07 15:07:33 +00:00
|
|
|
* Add a track object to the timeline object. Should only be called by
|
|
|
|
* subclasses implementing the create_track_objects (plural) vmethod.
|
|
|
|
*
|
2010-12-20 10:56:37 +00:00
|
|
|
* Takes a reference on @trobj.
|
|
|
|
*
|
2010-07-07 15:07:33 +00:00
|
|
|
* Returns: %TRUE on success, %FALSE on failure.
|
|
|
|
*/
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
ges_timeline_object_add_track_object (GESTimelineObject * object, GESTrackObject
|
|
|
|
* trobj)
|
|
|
|
{
|
2010-12-16 18:29:14 +00:00
|
|
|
ObjectMapping *mapping;
|
|
|
|
|
2010-07-07 15:07:33 +00:00
|
|
|
GST_LOG ("Got a TrackObject : %p , setting the timeline object as its"
|
|
|
|
"creator", trobj);
|
|
|
|
|
|
|
|
if (!trobj)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
ges_track_object_set_timeline_object (trobj, object);
|
2010-12-20 10:56:37 +00:00
|
|
|
g_object_ref (trobj);
|
2010-07-07 15:07:33 +00:00
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
mapping = g_slice_new0 (ObjectMapping);
|
|
|
|
mapping->object = trobj;
|
|
|
|
object->priv->mappings = g_list_append (object->priv->mappings, mapping);
|
|
|
|
|
2010-07-07 15:07:33 +00:00
|
|
|
GST_DEBUG ("Adding TrackObject to the list of controlled track objects");
|
|
|
|
/* We steal the initial reference */
|
2010-11-28 12:24:07 +00:00
|
|
|
object->priv->trackobjects =
|
|
|
|
g_list_append (object->priv->trackobjects, trobj);
|
2010-07-07 15:07:33 +00:00
|
|
|
|
|
|
|
GST_DEBUG ("Setting properties on newly created TrackObject");
|
|
|
|
|
2010-12-16 17:20:47 +00:00
|
|
|
ges_track_object_set_start (trobj, object->start);
|
|
|
|
ges_track_object_set_priority (trobj, object->priority);
|
|
|
|
ges_track_object_set_duration (trobj, object->duration);
|
|
|
|
ges_track_object_set_inpoint (trobj, object->inpoint);
|
2010-07-07 15:07:33 +00:00
|
|
|
|
|
|
|
GST_DEBUG ("Returning trobj:%p", trobj);
|
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
/* Listen to all property changes */
|
|
|
|
mapping->start_notifyid =
|
|
|
|
g_signal_connect (G_OBJECT (trobj), "notify::start",
|
|
|
|
G_CALLBACK (track_object_start_changed_cb), object);
|
|
|
|
mapping->duration_notifyid =
|
|
|
|
g_signal_connect (G_OBJECT (trobj), "notify::duration",
|
|
|
|
G_CALLBACK (track_object_duration_changed_cb), object);
|
|
|
|
mapping->inpoint_notifyid =
|
|
|
|
g_signal_connect (G_OBJECT (trobj), "notify::inpoint",
|
|
|
|
G_CALLBACK (track_object_inpoint_changed_cb), object);
|
|
|
|
mapping->priority_notifyid =
|
|
|
|
g_signal_connect (G_OBJECT (trobj), "notify::priority",
|
|
|
|
G_CALLBACK (track_object_priority_changed_cb), object);
|
2010-07-09 11:49:23 +00:00
|
|
|
|
2010-07-07 15:07:33 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2009-09-21 10:51:16 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_object_release_track_object:
|
|
|
|
* @object: a #GESTimelineObject
|
2010-12-15 12:27:39 +00:00
|
|
|
* @trackobject: the #GESTrackObject to release
|
2010-12-16 18:29:14 +00:00
|
|
|
*
|
|
|
|
* Release the @trackobject from the control of @object.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the @trackobject was properly released, else %FALSE.
|
2009-09-21 10:51:16 +00:00
|
|
|
*/
|
2009-08-07 14:39:45 +00:00
|
|
|
gboolean
|
|
|
|
ges_timeline_object_release_track_object (GESTimelineObject * object,
|
2010-12-15 12:27:39 +00:00
|
|
|
GESTrackObject * trackobject)
|
2009-08-07 14:39:45 +00:00
|
|
|
{
|
2010-12-16 18:29:14 +00:00
|
|
|
GList *tmp;
|
|
|
|
ObjectMapping *mapping = NULL;
|
|
|
|
|
2010-12-15 12:27:39 +00:00
|
|
|
GST_DEBUG ("object:%p, trackobject:%p", object, trackobject);
|
2009-08-07 14:39:45 +00:00
|
|
|
|
2010-12-15 12:27:39 +00:00
|
|
|
if (!(g_list_find (object->priv->trackobjects, trackobject))) {
|
2009-08-07 14:39:45 +00:00
|
|
|
GST_WARNING ("TrackObject isn't controlled by this object");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-12-09 11:53:07 +00:00
|
|
|
/* FIXME : Do we need to tell the subclasses ?
|
|
|
|
* If so, add a new virtual-method */
|
2009-08-07 14:39:45 +00:00
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
for (tmp = object->priv->mappings; tmp; tmp = tmp->next) {
|
|
|
|
mapping = (ObjectMapping *) tmp->data;
|
|
|
|
if (mapping->object == trackobject)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tmp && mapping) {
|
|
|
|
|
|
|
|
/* Disconnect all notify listeners */
|
|
|
|
g_signal_handler_disconnect (trackobject, mapping->start_notifyid);
|
|
|
|
g_signal_handler_disconnect (trackobject, mapping->duration_notifyid);
|
|
|
|
g_signal_handler_disconnect (trackobject, mapping->inpoint_notifyid);
|
|
|
|
g_signal_handler_disconnect (trackobject, mapping->priority_notifyid);
|
|
|
|
|
|
|
|
g_slice_free (ObjectMapping, mapping);
|
|
|
|
|
|
|
|
object->priv->mappings = g_list_delete_link (object->priv->mappings, tmp);
|
|
|
|
}
|
|
|
|
|
2010-11-28 12:24:07 +00:00
|
|
|
object->priv->trackobjects =
|
2010-12-15 12:27:39 +00:00
|
|
|
g_list_remove (object->priv->trackobjects, trackobject);
|
2009-08-07 14:39:45 +00:00
|
|
|
|
2010-12-15 12:27:39 +00:00
|
|
|
ges_track_object_set_timeline_object (trackobject, NULL);
|
2009-08-07 14:39:45 +00:00
|
|
|
|
2010-12-20 10:56:37 +00:00
|
|
|
GST_DEBUG ("Removing reference to track object %p", trackobject);
|
|
|
|
|
2010-12-15 12:27:39 +00:00
|
|
|
g_object_unref (trackobject);
|
2009-09-21 10:51:16 +00:00
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
/* FIXME : resync properties ? */
|
|
|
|
|
2009-08-07 14:39:45 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2009-08-06 15:38:43 +00:00
|
|
|
void
|
|
|
|
ges_timeline_object_set_layer (GESTimelineObject * object,
|
|
|
|
GESTimelineLayer * layer)
|
|
|
|
{
|
|
|
|
GST_DEBUG ("object:%p, layer:%p", object, layer);
|
|
|
|
|
2010-11-28 12:24:07 +00:00
|
|
|
object->priv->layer = layer;
|
2009-08-06 15:38:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
ges_timeline_object_fill_track_object (GESTimelineObject * object,
|
|
|
|
GESTrackObject * trackobj, GstElement * gnlobj)
|
|
|
|
{
|
|
|
|
GESTimelineObjectClass *class;
|
2009-09-21 10:51:16 +00:00
|
|
|
gboolean res = TRUE;
|
2009-08-06 15:38:43 +00:00
|
|
|
|
|
|
|
GST_DEBUG ("object:%p, trackobject:%p, gnlobject:%p",
|
|
|
|
object, trackobj, gnlobj);
|
|
|
|
|
|
|
|
class = GES_TIMELINE_OBJECT_GET_CLASS (object);
|
|
|
|
|
2009-09-21 10:51:16 +00:00
|
|
|
if (class->need_fill_track) {
|
|
|
|
if (G_UNLIKELY (class->fill_track_object == NULL)) {
|
|
|
|
GST_WARNING ("No 'fill_track_object' implementation available");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2009-08-06 15:38:43 +00:00
|
|
|
|
2009-09-21 10:51:16 +00:00
|
|
|
res = class->fill_track_object (object, trackobj, gnlobj);
|
|
|
|
}
|
2009-08-06 15:38:43 +00:00
|
|
|
|
|
|
|
GST_DEBUG ("Returning res:%d", res);
|
2009-08-06 09:23:01 +00:00
|
|
|
|
2009-08-06 15:38:43 +00:00
|
|
|
return res;
|
2009-08-06 09:23:01 +00:00
|
|
|
}
|
2009-08-07 14:39:45 +00:00
|
|
|
|
|
|
|
gboolean
|
|
|
|
ges_timeline_object_fill_track_object_func (GESTimelineObject * object,
|
|
|
|
GESTrackObject * trackobj, GstElement * gnlobj)
|
|
|
|
{
|
|
|
|
GST_WARNING ("No 'fill_track_object' implementation !");
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
2009-08-07 18:33:18 +00:00
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
static ObjectMapping *
|
|
|
|
find_object_mapping (GESTimelineObject * object, GESTrackObject * child)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
for (tmp = object->priv->mappings; tmp; tmp = tmp->next) {
|
|
|
|
ObjectMapping *map = (ObjectMapping *) tmp->data;
|
|
|
|
if (map->object == child)
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-12-15 18:40:11 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_object_set_start:
|
|
|
|
* @object: a #GESTimelineObject
|
|
|
|
* @start: the position in #GstClockTime
|
|
|
|
*
|
|
|
|
* Set the position of the object in its containing layer
|
|
|
|
*/
|
2009-08-07 18:33:18 +00:00
|
|
|
void
|
|
|
|
ges_timeline_object_set_start (GESTimelineObject * object, guint64 start)
|
|
|
|
{
|
2010-12-16 15:27:26 +00:00
|
|
|
GList *tmp;
|
|
|
|
GESTrackObject *tr;
|
2010-12-16 18:29:14 +00:00
|
|
|
ObjectMapping *map;
|
2010-12-16 15:27:26 +00:00
|
|
|
|
2009-08-07 18:33:18 +00:00
|
|
|
GST_DEBUG ("object:%p, start:%" GST_TIME_FORMAT,
|
|
|
|
object, GST_TIME_ARGS (start));
|
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
object->priv->ignore_notifies = TRUE;
|
|
|
|
|
2010-12-16 15:27:26 +00:00
|
|
|
for (tmp = object->priv->trackobjects; tmp; tmp = g_list_next (tmp)) {
|
|
|
|
tr = (GESTrackObject *) tmp->data;
|
2010-12-16 18:29:14 +00:00
|
|
|
map = find_object_mapping (object, tr);
|
|
|
|
|
|
|
|
if (ges_track_object_is_locked (tr)) {
|
|
|
|
/* Move the child... */
|
|
|
|
ges_track_object_set_start (tr, start + map->start_offset);
|
|
|
|
} else {
|
|
|
|
/* ... or update the offset */
|
|
|
|
map->start_offset = start - tr->start;
|
|
|
|
}
|
2009-08-07 18:33:18 +00:00
|
|
|
}
|
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
object->priv->ignore_notifies = FALSE;
|
|
|
|
|
2009-08-07 18:33:18 +00:00
|
|
|
object->start = start;
|
|
|
|
}
|
|
|
|
|
2010-12-15 18:40:11 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_object_set_inpoint:
|
|
|
|
* @object: a #GESTimelineObject
|
|
|
|
* @inpoint: the in-point in #GstClockTime
|
|
|
|
*
|
|
|
|
* Set the in-point, that is the moment at which the @object will start
|
|
|
|
* outputting data from its contents.
|
|
|
|
*/
|
2009-08-07 18:33:18 +00:00
|
|
|
void
|
|
|
|
ges_timeline_object_set_inpoint (GESTimelineObject * object, guint64 inpoint)
|
|
|
|
{
|
2010-12-16 15:27:26 +00:00
|
|
|
GList *tmp;
|
|
|
|
GESTrackObject *tr;
|
|
|
|
|
2009-08-07 18:33:18 +00:00
|
|
|
GST_DEBUG ("object:%p, inpoint:%" GST_TIME_FORMAT,
|
|
|
|
object, GST_TIME_ARGS (inpoint));
|
|
|
|
|
2010-12-16 15:27:26 +00:00
|
|
|
for (tmp = object->priv->trackobjects; tmp; tmp = g_list_next (tmp)) {
|
|
|
|
tr = (GESTrackObject *) tmp->data;
|
2009-08-07 18:33:18 +00:00
|
|
|
|
2010-12-16 15:27:26 +00:00
|
|
|
if (ges_track_object_is_locked (tr))
|
2010-12-16 17:20:47 +00:00
|
|
|
/* call set_inpoint on each trackobject */
|
|
|
|
ges_track_object_set_inpoint (tr, inpoint);
|
2009-08-07 18:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
object->inpoint = inpoint;
|
|
|
|
}
|
|
|
|
|
2010-12-15 18:40:11 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_object_set_duration:
|
|
|
|
* @object: a #GESTimelineObject
|
|
|
|
* @duration: the duration in #GstClockTime
|
|
|
|
*
|
|
|
|
* Set the duration of the object
|
|
|
|
*/
|
2009-08-07 18:33:18 +00:00
|
|
|
void
|
|
|
|
ges_timeline_object_set_duration (GESTimelineObject * object, guint64 duration)
|
|
|
|
{
|
2010-12-16 15:27:26 +00:00
|
|
|
GList *tmp;
|
|
|
|
GESTrackObject *tr;
|
|
|
|
|
2009-08-07 18:33:18 +00:00
|
|
|
GST_DEBUG ("object:%p, duration:%" GST_TIME_FORMAT,
|
|
|
|
object, GST_TIME_ARGS (duration));
|
|
|
|
|
2010-12-16 15:27:26 +00:00
|
|
|
for (tmp = object->priv->trackobjects; tmp; tmp = g_list_next (tmp)) {
|
|
|
|
tr = (GESTrackObject *) tmp->data;
|
2009-08-07 18:33:18 +00:00
|
|
|
|
2010-12-16 15:27:26 +00:00
|
|
|
if (ges_track_object_is_locked (tr))
|
2010-12-16 17:20:47 +00:00
|
|
|
/* call set_duration on each trackobject */
|
|
|
|
ges_track_object_set_duration (tr, duration);
|
2009-08-07 18:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
object->duration = duration;
|
|
|
|
}
|
|
|
|
|
2010-12-15 18:40:11 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_object_set_priority:
|
|
|
|
* @object: a #GESTimelineObject
|
|
|
|
* @priority: the priority
|
|
|
|
*
|
|
|
|
* Sets the priority of the object within the containing layer
|
|
|
|
*/
|
2009-08-07 18:33:18 +00:00
|
|
|
void
|
|
|
|
ges_timeline_object_set_priority (GESTimelineObject * object, guint priority)
|
|
|
|
{
|
2010-12-16 15:27:26 +00:00
|
|
|
GList *tmp;
|
|
|
|
GESTrackObject *tr;
|
2010-12-16 18:29:14 +00:00
|
|
|
ObjectMapping *map;
|
|
|
|
|
2011-03-01 16:38:52 +00:00
|
|
|
GST_DEBUG ("object:%p, priority:%" G_GUINT32_FORMAT, object, priority);
|
2009-08-07 18:33:18 +00:00
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
object->priv->ignore_notifies = TRUE;
|
2009-08-07 18:33:18 +00:00
|
|
|
|
2010-12-16 15:27:26 +00:00
|
|
|
for (tmp = object->priv->trackobjects; tmp; tmp = g_list_next (tmp)) {
|
|
|
|
tr = (GESTrackObject *) tmp->data;
|
2010-12-16 18:29:14 +00:00
|
|
|
map = find_object_mapping (object, tr);
|
|
|
|
|
|
|
|
if (ges_track_object_is_locked (tr)) {
|
|
|
|
/* Move the child... */
|
|
|
|
ges_track_object_set_priority (tr, priority + map->priority_offset);
|
|
|
|
} else {
|
|
|
|
/* ... or update the offset */
|
|
|
|
map->priority_offset = priority - tr->priority;
|
|
|
|
}
|
2009-08-07 18:33:18 +00:00
|
|
|
}
|
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
object->priv->ignore_notifies = FALSE;
|
|
|
|
|
2009-08-07 18:33:18 +00:00
|
|
|
object->priority = priority;
|
|
|
|
}
|
2010-03-12 16:17:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_timeline_object_find_track_object:
|
|
|
|
* @object: a #GESTimelineObject
|
2010-07-13 16:42:46 +00:00
|
|
|
* @track: a #GESTrack or NULL
|
|
|
|
* @type: a #GType indicating the type of track object you are looking
|
|
|
|
* for or %G_TYPE_NONE if you do not care about the track type.
|
2010-03-12 16:17:30 +00:00
|
|
|
*
|
2010-07-13 16:42:46 +00:00
|
|
|
* Finds the #GESTrackObject controlled by @object that is used in @track. You
|
|
|
|
* may optionally specify a GType to further narrow search criteria.
|
2010-03-12 16:17:30 +00:00
|
|
|
*
|
|
|
|
* Note: The reference count of the returned #GESTrackObject will be increased,
|
|
|
|
* unref when done with it.
|
|
|
|
*
|
2010-12-15 18:40:11 +00:00
|
|
|
* Returns: (transfer full): The #GESTrackObject used by @track, else #NULL.
|
2010-03-12 16:17:30 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
GESTrackObject *
|
|
|
|
ges_timeline_object_find_track_object (GESTimelineObject * object,
|
2010-07-13 16:42:46 +00:00
|
|
|
GESTrack * track, GType type)
|
2010-03-12 16:17:30 +00:00
|
|
|
{
|
|
|
|
GESTrackObject *ret = NULL;
|
2010-12-16 15:27:26 +00:00
|
|
|
GList *tmp;
|
|
|
|
GESTrackObject *otmp;
|
2010-03-12 16:17:30 +00:00
|
|
|
|
2010-12-16 15:27:26 +00:00
|
|
|
for (tmp = object->priv->trackobjects; tmp; tmp = g_list_next (tmp)) {
|
|
|
|
otmp = (GESTrackObject *) tmp->data;
|
2010-12-16 14:00:46 +00:00
|
|
|
|
2010-12-16 15:27:26 +00:00
|
|
|
if (ges_track_object_get_track (otmp) == track) {
|
|
|
|
if ((type != G_TYPE_NONE) && !G_TYPE_CHECK_INSTANCE_TYPE (tmp->data,
|
|
|
|
type))
|
|
|
|
continue;
|
2010-07-13 16:42:46 +00:00
|
|
|
|
2010-12-16 15:27:26 +00:00
|
|
|
ret = GES_TRACK_OBJECT (tmp->data);
|
|
|
|
g_object_ref (ret);
|
|
|
|
break;
|
2010-12-16 14:00:46 +00:00
|
|
|
}
|
2010-03-12 16:17:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2010-07-09 11:49:23 +00:00
|
|
|
|
2010-11-28 12:24:07 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_object_get_layer:
|
|
|
|
* @object: a #GESTimelineObject
|
|
|
|
*
|
|
|
|
* Note: The reference count of the returned #GESTimelineLayer will be increased,
|
|
|
|
* The user is responsible for unreffing it.
|
|
|
|
*
|
2010-12-15 18:40:11 +00:00
|
|
|
* Returns: (transfer full): The #GESTimelineLayer where this @object is being used, #NULL if
|
2010-11-28 12:24:07 +00:00
|
|
|
* it is not used on any layer.
|
|
|
|
*/
|
|
|
|
GESTimelineLayer *
|
|
|
|
ges_timeline_object_get_layer (GESTimelineObject * object)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), NULL);
|
|
|
|
|
|
|
|
if (object->priv->layer != NULL)
|
|
|
|
g_object_ref (G_OBJECT (object->priv->layer));
|
|
|
|
|
|
|
|
return object->priv->layer;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_timeline_object_get_track_objects:
|
2010-12-15 12:27:39 +00:00
|
|
|
* @object: a #GESTimelineObject
|
2010-11-28 12:24:07 +00:00
|
|
|
*
|
2011-01-10 13:28:35 +00:00
|
|
|
* Get the list of #GESTrackObject contained in @object
|
|
|
|
*
|
2010-12-15 18:40:11 +00:00
|
|
|
* Returns: (transfer full) (element-type GESTrackObject): The list of
|
|
|
|
* trackobject contained in @object.
|
2010-11-28 12:24:07 +00:00
|
|
|
* The user is responsible for unreffing the contained objects
|
|
|
|
* and freeing the list.
|
|
|
|
*/
|
|
|
|
GList *
|
|
|
|
ges_timeline_object_get_track_objects (GESTimelineObject * object)
|
|
|
|
{
|
|
|
|
GList *ret;
|
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), NULL);
|
|
|
|
|
|
|
|
ret = g_list_copy (object->priv->trackobjects);
|
|
|
|
|
|
|
|
for (tmp = ret; tmp; tmp = tmp->next) {
|
|
|
|
g_object_ref (tmp->data);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-12-16 15:27:26 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* PROPERTY NOTIFICATIONS FROM TRACK OBJECTS
|
|
|
|
*/
|
2010-12-16 18:29:14 +00:00
|
|
|
|
2010-07-09 11:49:23 +00:00
|
|
|
static void
|
2010-12-16 18:29:14 +00:00
|
|
|
track_object_start_changed_cb (GESTrackObject * child,
|
2010-12-16 15:27:26 +00:00
|
|
|
GParamSpec * arg G_GNUC_UNUSED, GESTimelineObject * object)
|
2010-07-09 11:49:23 +00:00
|
|
|
{
|
2010-12-16 18:29:14 +00:00
|
|
|
ObjectMapping *map;
|
|
|
|
|
|
|
|
if (object->priv->ignore_notifies)
|
|
|
|
return;
|
|
|
|
|
|
|
|
map = find_object_mapping (object, child);
|
|
|
|
if (G_UNLIKELY (map == NULL))
|
|
|
|
/* something massively screwed up if we get this */
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!ges_track_object_is_locked (child)) {
|
|
|
|
/* Update the internal start_offset */
|
|
|
|
map->start_offset = object->start - child->start;
|
|
|
|
} else {
|
|
|
|
/* Or update the parent start */
|
|
|
|
ges_timeline_object_set_start (object, child->start + map->start_offset);
|
|
|
|
}
|
|
|
|
}
|
2010-07-09 11:49:23 +00:00
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
static void
|
|
|
|
track_object_inpoint_changed_cb (GESTrackObject * child,
|
|
|
|
GParamSpec * arg G_GNUC_UNUSED, GESTimelineObject * object)
|
|
|
|
{
|
|
|
|
if (object->priv->ignore_notifies)
|
|
|
|
return;
|
2010-07-09 11:49:23 +00:00
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
}
|
2010-07-09 11:49:23 +00:00
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
static void
|
|
|
|
track_object_duration_changed_cb (GESTrackObject * child,
|
|
|
|
GParamSpec * arg G_GNUC_UNUSED, GESTimelineObject * object)
|
|
|
|
{
|
|
|
|
if (object->priv->ignore_notifies)
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
track_object_priority_changed_cb (GESTrackObject * child,
|
|
|
|
GParamSpec * arg G_GNUC_UNUSED, GESTimelineObject * object)
|
|
|
|
{
|
|
|
|
ObjectMapping *map;
|
|
|
|
|
|
|
|
if (object->priv->ignore_notifies)
|
|
|
|
return;
|
|
|
|
|
|
|
|
map = find_object_mapping (object, child);
|
|
|
|
if (G_UNLIKELY (map == NULL))
|
|
|
|
/* something massively screwed up if we get this */
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!ges_track_object_is_locked (child)) {
|
|
|
|
GList *tmp;
|
|
|
|
guint32 min_prio = G_MAXUINT32, max_prio = 0;
|
|
|
|
|
|
|
|
/* Update the internal priority_offset */
|
|
|
|
map->priority_offset = object->priority - child->priority;
|
|
|
|
|
|
|
|
/* Go over all childs and check if height has changed */
|
|
|
|
for (tmp = object->priv->trackobjects; tmp; tmp = tmp->next) {
|
|
|
|
GESTrackObject *tmpo = (GESTrackObject *) tmp->data;
|
|
|
|
|
|
|
|
if (tmpo->priority < min_prio)
|
|
|
|
min_prio = tmpo->priority;
|
|
|
|
if (tmpo->priority > max_prio)
|
|
|
|
max_prio = tmpo->priority;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME : We only grow the height */
|
|
|
|
if (object->height < (max_prio - min_prio + 1)) {
|
|
|
|
object->height = max_prio - min_prio + 1;
|
2010-12-17 10:27:37 +00:00
|
|
|
#if GLIB_CHECK_VERSION(2,26,0)
|
2010-12-16 18:29:14 +00:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_HEIGHT]);
|
2010-12-17 10:27:37 +00:00
|
|
|
#else
|
|
|
|
g_object_notify (G_OBJECT (object), "height");
|
|
|
|
#endif
|
2010-12-16 18:29:14 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Or update the parent priority */
|
|
|
|
ges_timeline_object_set_priority (object,
|
|
|
|
child->priority + map->priority_offset);
|
|
|
|
/* For the locked situation, we don't need to check the height,
|
|
|
|
* since all object priorities are moving together */
|
2010-07-09 11:49:23 +00:00
|
|
|
}
|
|
|
|
}
|