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"
|
|
|
|
|
2012-03-12 15:46:42 +00:00
|
|
|
#include <string.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
|
|
|
|
2012-01-16 12:37:22 +00:00
|
|
|
void default_set_max_duration (GESTimelineObject * object, guint64 maxduration);
|
|
|
|
|
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);
|
2011-02-01 20:14:29 +00:00
|
|
|
static void update_height (GESTimelineObject * object);
|
2010-07-09 11:49:23 +00:00
|
|
|
|
2011-02-16 13:30:22 +00:00
|
|
|
static gint sort_track_effects (gpointer a, gpointer b,
|
|
|
|
GESTimelineObject * object);
|
2011-04-15 23:34:28 +00:00
|
|
|
static void
|
|
|
|
get_layer_priorities (GESTimelineLayer * layer, guint32 * layer_min_gnl_prio,
|
|
|
|
guint32 * layer_max_gnl_prio);
|
2011-01-31 10:15:33 +00:00
|
|
|
|
2011-11-08 22:29:38 +00:00
|
|
|
static gboolean
|
|
|
|
ges_timeline_object_set_start_internal (GESTimelineObject * object,
|
|
|
|
guint64 start);
|
|
|
|
static gboolean ges_timeline_object_set_inpoint_internal (GESTimelineObject *
|
|
|
|
object, guint64 inpoint);
|
|
|
|
static gboolean ges_timeline_object_set_duration_internal (GESTimelineObject *
|
|
|
|
object, guint64 duration);
|
|
|
|
static gboolean ges_timeline_object_set_priority_internal (GESTimelineObject *
|
|
|
|
object, guint32 priority);
|
|
|
|
|
2011-06-09 00:36:58 +00:00
|
|
|
static GESTimelineObject *ges_timeline_object_copy (GESTimelineObject * object,
|
|
|
|
gboolean * deep);
|
|
|
|
|
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;
|
|
|
|
|
2011-02-08 13:04:39 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
EFFECT_ADDED,
|
|
|
|
EFFECT_REMOVED,
|
2011-08-28 04:25:37 +00:00
|
|
|
TRACK_OBJECT_ADDED,
|
2011-12-06 17:10:14 +00:00
|
|
|
TRACK_OBJECT_REMOVED,
|
2011-02-08 13:04:39 +00:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
static guint ges_timeline_object_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
2010-11-28 12:24:07 +00:00
|
|
|
struct _GESTimelineObjectPrivate
|
|
|
|
{
|
|
|
|
/*< public > */
|
|
|
|
GESTimelineLayer *layer;
|
|
|
|
|
|
|
|
/*< private > */
|
2011-02-16 13:30:22 +00:00
|
|
|
/* A list of TrackObject controlled by this TimelineObject sorted by
|
|
|
|
* priority */
|
2010-11-28 12:24:07 +00:00
|
|
|
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;
|
2011-06-06 19:55:47 +00:00
|
|
|
gboolean is_moving;
|
2010-12-16 18:29:14 +00:00
|
|
|
|
2012-01-16 12:37:22 +00:00
|
|
|
guint64 maxduration;
|
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
GList *mappings;
|
2011-01-31 10:10:35 +00:00
|
|
|
|
|
|
|
guint nb_effects;
|
2011-12-01 03:18:30 +00:00
|
|
|
|
2011-12-16 07:23:58 +00:00
|
|
|
GESTrackObject *initiated_move;
|
|
|
|
|
2011-12-01 03:18:30 +00:00
|
|
|
/* The formats supported by this TimelineObject */
|
|
|
|
GESTrackType supportedformats;
|
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,
|
2011-12-01 03:18:30 +00:00
|
|
|
PROP_SUPPORTED_FORMATS,
|
2012-01-16 12:37:22 +00:00
|
|
|
PROP_MAX_DURATION,
|
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;
|
2011-12-01 03:18:30 +00:00
|
|
|
case PROP_SUPPORTED_FORMATS:
|
|
|
|
g_value_set_flags (value, tobj->priv->supportedformats);
|
|
|
|
break;
|
2012-01-16 12:37:22 +00:00
|
|
|
case PROP_MAX_DURATION:
|
|
|
|
g_value_set_uint64 (value, tobj->priv->maxduration);
|
|
|
|
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:
|
2011-11-08 22:29:38 +00:00
|
|
|
ges_timeline_object_set_start_internal (tobj, g_value_get_uint64 (value));
|
2009-08-07 18:33:18 +00:00
|
|
|
break;
|
|
|
|
case PROP_INPOINT:
|
2011-11-08 22:29:38 +00:00
|
|
|
ges_timeline_object_set_inpoint_internal (tobj,
|
|
|
|
g_value_get_uint64 (value));
|
2009-08-07 18:33:18 +00:00
|
|
|
break;
|
|
|
|
case PROP_DURATION:
|
2011-11-08 22:29:38 +00:00
|
|
|
ges_timeline_object_set_duration_internal (tobj,
|
|
|
|
g_value_get_uint64 (value));
|
2009-08-07 18:33:18 +00:00
|
|
|
break;
|
|
|
|
case PROP_PRIORITY:
|
2011-11-08 22:29:38 +00:00
|
|
|
ges_timeline_object_set_priority_internal (tobj,
|
|
|
|
g_value_get_uint (value));
|
2009-08-07 18:33:18 +00:00
|
|
|
break;
|
2011-12-01 03:18:30 +00:00
|
|
|
case PROP_SUPPORTED_FORMATS:
|
|
|
|
ges_timeline_object_set_supported_formats (tobj,
|
|
|
|
g_value_get_flags (value));
|
|
|
|
break;
|
2012-01-16 12:37:22 +00:00
|
|
|
case PROP_MAX_DURATION:
|
|
|
|
ges_timeline_object_set_max_duration (tobj, g_value_get_uint64 (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;
|
2012-01-16 12:37:22 +00:00
|
|
|
klass->set_max_duration = default_set_max_duration;
|
2011-04-26 23:39:56 +00:00
|
|
|
klass->track_object_added = NULL;
|
|
|
|
klass->track_object_released = NULL;
|
2009-08-07 18:33:18 +00:00
|
|
|
|
2009-09-16 10:37:45 +00:00
|
|
|
/**
|
2012-08-10 16:39:10 +00:00
|
|
|
* GESTimelineObject:start:
|
2009-09-16 10:37:45 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
|
|
/**
|
2012-08-10 16:39:10 +00:00
|
|
|
* GESTimelineObject:in-point:
|
2009-09-16 10:37:45 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
|
|
/**
|
2012-08-10 16:39:10 +00:00
|
|
|
* GESTimelineObject:duration:
|
2009-09-16 10:37:45 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
|
|
/**
|
2012-08-10 16:39:10 +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
|
|
|
/**
|
2012-08-10 16:39:10 +00:00
|
|
|
* GESTimelineObject:height:
|
2010-07-09 09:51:21 +00:00
|
|
|
*
|
|
|
|
* 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-12-01 03:18:30 +00:00
|
|
|
/**
|
|
|
|
* GESTimelineObject:supported-formats:
|
|
|
|
*
|
|
|
|
* The formats supported by the object.
|
|
|
|
*
|
|
|
|
* Since: 0.10.XX
|
|
|
|
*/
|
|
|
|
properties[PROP_SUPPORTED_FORMATS] = g_param_spec_flags ("supported-formats",
|
|
|
|
"Supported formats", "Formats supported by the file",
|
|
|
|
GES_TYPE_TRACK_TYPE, GES_TRACK_TYPE_UNKNOWN,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
|
|
|
|
|
|
|
g_object_class_install_property (object_class, PROP_SUPPORTED_FORMATS,
|
|
|
|
properties[PROP_SUPPORTED_FORMATS]);
|
|
|
|
|
2011-02-09 10:21:02 +00:00
|
|
|
/**
|
2012-08-10 16:39:10 +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
|
|
|
|
2011-02-08 13:04:39 +00:00
|
|
|
/**
|
2012-08-10 16:39:10 +00:00
|
|
|
* GESTimelineObject::effect-added:
|
2011-02-08 13:04:39 +00:00
|
|
|
* @object: the #GESTimelineObject
|
2011-02-16 13:05:14 +00:00
|
|
|
* @effect: the #GESTrackEffect that was added.
|
2011-02-08 13:04:39 +00:00
|
|
|
*
|
|
|
|
* Will be emitted after an effect was added to the object.
|
2011-05-06 17:55:31 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
2011-02-08 13:04:39 +00:00
|
|
|
*/
|
|
|
|
ges_timeline_object_signals[EFFECT_ADDED] =
|
|
|
|
g_signal_new ("effect-added", G_TYPE_FROM_CLASS (klass),
|
2012-03-12 15:46:42 +00:00
|
|
|
G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_generic,
|
2011-02-16 13:05:14 +00:00
|
|
|
G_TYPE_NONE, 1, GES_TYPE_TRACK_EFFECT);
|
2011-02-08 13:04:39 +00:00
|
|
|
|
|
|
|
/**
|
2012-08-10 16:39:10 +00:00
|
|
|
* GESTimelineObject::effect-removed:
|
2011-02-08 13:04:39 +00:00
|
|
|
* @object: the #GESTimelineObject
|
2011-02-16 13:05:14 +00:00
|
|
|
* @effect: the #GESTrackEffect that was added.
|
2011-02-08 13:04:39 +00:00
|
|
|
*
|
|
|
|
* Will be emitted after an effect was remove from the object.
|
2011-05-06 17:55:31 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
2011-02-08 13:04:39 +00:00
|
|
|
*/
|
|
|
|
ges_timeline_object_signals[EFFECT_REMOVED] =
|
|
|
|
g_signal_new ("effect-removed", G_TYPE_FROM_CLASS (klass),
|
2012-03-12 15:46:42 +00:00
|
|
|
G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_generic,
|
2011-02-16 13:05:14 +00:00
|
|
|
G_TYPE_NONE, 1, GES_TYPE_TRACK_EFFECT);
|
2011-02-08 13:04:39 +00:00
|
|
|
|
2011-08-28 04:25:37 +00:00
|
|
|
/**
|
2012-08-10 16:39:10 +00:00
|
|
|
* GESTimelineObject::track-object-added:
|
2011-08-28 04:25:37 +00:00
|
|
|
* @object: the #GESTimelineObject
|
2011-12-06 17:10:14 +00:00
|
|
|
* @tckobj: the #GESTrackObject that was added.
|
2011-08-28 04:25:37 +00:00
|
|
|
*
|
|
|
|
* Will be emitted after a track object was added to the object.
|
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
|
|
|
*/
|
|
|
|
ges_timeline_object_signals[TRACK_OBJECT_ADDED] =
|
|
|
|
g_signal_new ("track-object-added", G_TYPE_FROM_CLASS (klass),
|
2012-03-12 15:46:42 +00:00
|
|
|
G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_generic,
|
2011-08-28 04:25:37 +00:00
|
|
|
G_TYPE_NONE, 1, GES_TYPE_TRACK_OBJECT);
|
|
|
|
|
2011-12-06 17:10:14 +00:00
|
|
|
/**
|
2012-08-10 16:39:10 +00:00
|
|
|
* GESTimelineObject::track-object-removed:
|
2011-12-06 17:10:14 +00:00
|
|
|
* @object: the #GESTimelineObject
|
|
|
|
* @tckobj: the #GESTrackObject that was removed.
|
|
|
|
*
|
2011-12-07 02:11:25 +00:00
|
|
|
* Will be emitted after a track object was removed from @object.
|
2011-12-06 17:10:14 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
|
|
|
*/
|
|
|
|
ges_timeline_object_signals[TRACK_OBJECT_REMOVED] =
|
|
|
|
g_signal_new ("track-object-removed", G_TYPE_FROM_CLASS (klass),
|
2012-03-12 15:46:42 +00:00
|
|
|
G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_generic,
|
2011-12-06 17:10:14 +00:00
|
|
|
G_TYPE_NONE, 1, GES_TYPE_TRACK_OBJECT);
|
|
|
|
|
2012-01-16 12:37:22 +00:00
|
|
|
/**
|
|
|
|
* GESTimelineObject:max-duration:
|
|
|
|
*
|
|
|
|
* The maximum duration (in nanoseconds) of the #GESTimelineObject.
|
|
|
|
*
|
|
|
|
* Since: 0.10.XX
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class, PROP_MAX_DURATION,
|
|
|
|
g_param_spec_uint64 ("max-duration", "Maximum duration",
|
2012-05-05 16:31:28 +00:00
|
|
|
"The maximum duration of the object", 0, G_MAXUINT64, G_MAXUINT64,
|
2012-01-16 12:37:22 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
|
|
|
|
2009-09-21 10:51:16 +00:00
|
|
|
klass->need_fill_track = TRUE;
|
2012-04-22 17:09:11 +00:00
|
|
|
klass->snaps = FALSE;
|
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;
|
2011-01-31 10:10:35 +00:00
|
|
|
self->priv->nb_effects = 0;
|
2011-06-06 19:55:47 +00:00
|
|
|
self->priv->is_moving = FALSE;
|
2012-01-16 12:37:22 +00:00
|
|
|
self->priv->maxduration = G_MAXUINT64;
|
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
|
|
|
|
2011-12-07 23:50:13 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), NULL);
|
|
|
|
g_return_val_if_fail (GES_IS_TRACK (track), NULL);
|
|
|
|
|
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);
|
|
|
|
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;
|
|
|
|
|
2011-12-07 23:50:13 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE);
|
|
|
|
g_return_val_if_fail (GES_IS_TRACK (track), FALSE);
|
|
|
|
|
2010-07-07 14:51:39 +00:00
|
|
|
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;
|
|
|
|
}
|
2012-04-20 23:02:19 +00:00
|
|
|
|
2010-07-07 14:51:39 +00:00
|
|
|
return klass->create_track_objects (object, track);
|
|
|
|
}
|
|
|
|
|
2012-01-16 12:37:22 +00:00
|
|
|
/* Default implementation of default_set_max_duration */
|
|
|
|
void
|
|
|
|
default_set_max_duration (GESTimelineObject * object, guint64 maxduration)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
for (tmp = object->priv->trackobjects; tmp; tmp = g_list_next (tmp))
|
|
|
|
g_object_set (tmp->data, "max-duration", maxduration, NULL);
|
|
|
|
}
|
|
|
|
|
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) {
|
2011-12-01 00:47:54 +00:00
|
|
|
GST_DEBUG ("Did not create track object");
|
2010-07-07 14:51:39 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2012-01-30 16:47:42 +00:00
|
|
|
|
2012-03-29 22:57:47 +00:00
|
|
|
if (ges_timeline_object_add_track_object (object, result) == FALSE)
|
|
|
|
return FALSE;
|
2012-01-30 16:47:42 +00:00
|
|
|
|
2012-03-29 22:57:47 +00:00
|
|
|
return ges_track_add_object (track, result);
|
2010-07-07 14:51:39 +00:00
|
|
|
}
|
|
|
|
|
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;
|
2011-01-31 10:22:31 +00:00
|
|
|
GList *tmp;
|
2011-04-15 23:34:28 +00:00
|
|
|
guint max_prio, min_prio;
|
2011-01-31 10:22:31 +00:00
|
|
|
GESTimelineObjectPrivate *priv = object->priv;
|
2011-02-16 13:05:14 +00:00
|
|
|
gboolean is_effect = GES_IS_TRACK_EFFECT (trobj);
|
2011-04-26 23:39:56 +00:00
|
|
|
GESTimelineObjectClass *klass = GES_TIMELINE_OBJECT_GET_CLASS (object);
|
2010-12-16 18:29:14 +00:00
|
|
|
|
2011-12-07 23:50:13 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE);
|
|
|
|
g_return_val_if_fail (GES_IS_TRACK_OBJECT (trobj), FALSE);
|
|
|
|
|
2010-07-07 15:07:33 +00:00
|
|
|
GST_LOG ("Got a TrackObject : %p , setting the timeline object as its"
|
2011-02-16 13:05:14 +00:00
|
|
|
"creator. Is a TrackEffect %i", trobj, is_effect);
|
2010-07-07 15:07:33 +00:00
|
|
|
|
|
|
|
if (!trobj)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
ges_track_object_set_timeline_object (trobj, object);
|
2011-07-27 00:02:20 +00:00
|
|
|
|
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;
|
2011-01-31 10:22:31 +00:00
|
|
|
priv->mappings = g_list_append (priv->mappings, mapping);
|
2010-12-16 18:29:14 +00:00
|
|
|
|
2010-07-07 15:07:33 +00:00
|
|
|
GST_DEBUG ("Adding TrackObject to the list of controlled track objects");
|
|
|
|
/* We steal the initial reference */
|
|
|
|
|
|
|
|
GST_DEBUG ("Setting properties on newly created TrackObject");
|
|
|
|
|
2011-01-31 10:22:31 +00:00
|
|
|
mapping->priority_offset = priv->nb_effects;
|
|
|
|
|
2011-02-16 13:05:14 +00:00
|
|
|
/* If the trackobject is an effect:
|
|
|
|
* - We add it on top of the list of TrackEffect
|
2011-02-03 14:40:05 +00:00
|
|
|
* - We put all TrackObject present in the TimelineObject
|
2011-01-31 10:22:31 +00:00
|
|
|
* which are not TrackEffect on top of them
|
|
|
|
*
|
|
|
|
* FIXME: Let the full control over priorities to the user
|
|
|
|
*/
|
2011-02-16 13:05:14 +00:00
|
|
|
if (is_effect) {
|
2011-02-03 14:30:30 +00:00
|
|
|
GST_DEBUG
|
|
|
|
("Moving non on top effect under other TrackObject-s, nb effects %i",
|
|
|
|
priv->nb_effects);
|
2011-01-31 10:22:31 +00:00
|
|
|
for (tmp = g_list_nth (priv->trackobjects, priv->nb_effects); tmp;
|
|
|
|
tmp = tmp->next) {
|
|
|
|
GESTrackObject *tmpo = GES_TRACK_OBJECT (tmp->data);
|
|
|
|
|
|
|
|
/* We make sure not to move the entire #TimelineObject */
|
|
|
|
ges_track_object_set_locked (tmpo, FALSE);
|
2011-02-03 14:40:05 +00:00
|
|
|
ges_track_object_set_priority (tmpo,
|
|
|
|
ges_track_object_get_priority (tmpo) + 1);
|
2011-01-31 10:22:31 +00:00
|
|
|
ges_track_object_set_locked (tmpo, TRUE);
|
|
|
|
}
|
2011-02-01 20:14:29 +00:00
|
|
|
|
2011-01-31 10:22:31 +00:00
|
|
|
priv->nb_effects++;
|
|
|
|
}
|
|
|
|
|
|
|
|
object->priv->trackobjects =
|
|
|
|
g_list_insert_sorted_with_data (object->priv->trackobjects, trobj,
|
|
|
|
(GCompareDataFunc) sort_track_effects, object);
|
|
|
|
|
2010-12-16 17:20:47 +00:00
|
|
|
ges_track_object_set_start (trobj, object->start);
|
|
|
|
ges_track_object_set_duration (trobj, object->duration);
|
|
|
|
ges_track_object_set_inpoint (trobj, object->inpoint);
|
2012-01-16 12:37:22 +00:00
|
|
|
ges_track_object_set_max_duration (trobj, object->priv->maxduration);
|
2010-07-07 15:07:33 +00:00
|
|
|
|
2011-04-26 23:39:56 +00:00
|
|
|
if (klass->track_object_added) {
|
|
|
|
GST_DEBUG ("Calling track_object_added subclass method");
|
|
|
|
klass->track_object_added (object, trobj);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG ("%s doesn't have any track_object_added vfunc implementation",
|
|
|
|
G_OBJECT_CLASS_NAME (klass));
|
|
|
|
}
|
|
|
|
|
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 =
|
2012-04-22 19:24:25 +00:00
|
|
|
g_signal_connect (G_OBJECT (trobj), "notify::in-point",
|
2010-12-16 18:29:14 +00:00
|
|
|
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
|
|
|
|
2011-04-15 23:34:28 +00:00
|
|
|
get_layer_priorities (priv->layer, &min_prio, &max_prio);
|
|
|
|
ges_track_object_set_priority (trobj, min_prio + object->priority
|
|
|
|
+ mapping->priority_offset);
|
2011-02-03 14:40:05 +00:00
|
|
|
|
2011-02-03 14:30:30 +00:00
|
|
|
GST_DEBUG ("Returning trobj:%p", trobj);
|
2012-01-25 14:12:05 +00:00
|
|
|
if (!GES_IS_TRACK_EFFECT (trobj)) {
|
2011-08-28 04:25:37 +00:00
|
|
|
g_signal_emit (object, ges_timeline_object_signals[TRACK_OBJECT_ADDED], 0,
|
|
|
|
GES_TRACK_OBJECT (trobj));
|
2011-12-18 00:49:24 +00:00
|
|
|
} else {
|
|
|
|
/* emit 'effect-added' */
|
|
|
|
g_signal_emit (object, ges_timeline_object_signals[EFFECT_ADDED], 0,
|
|
|
|
GES_TRACK_EFFECT (trobj));
|
2011-08-28 04:25:37 +00:00
|
|
|
}
|
2011-12-18 00:49:24 +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;
|
2012-04-20 23:02:19 +00:00
|
|
|
GESTimelineObjectClass *klass;
|
2010-12-16 18:29:14 +00:00
|
|
|
|
2011-12-07 23:50:13 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE);
|
|
|
|
g_return_val_if_fail (GES_IS_TRACK_OBJECT (trackobject), FALSE);
|
|
|
|
|
2010-12-15 12:27:39 +00:00
|
|
|
GST_DEBUG ("object:%p, trackobject:%p", object, trackobject);
|
2012-04-20 23:02:19 +00:00
|
|
|
klass = GES_TIMELINE_OBJECT_GET_CLASS (object);
|
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-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
|
|
|
|
2011-02-16 13:05:14 +00:00
|
|
|
if (GES_IS_TRACK_EFFECT (trackobject)) {
|
2011-02-08 13:04:39 +00:00
|
|
|
/* emit 'object-removed' */
|
2012-01-27 16:09:08 +00:00
|
|
|
object->priv->nb_effects--;
|
2011-02-08 13:04:39 +00:00
|
|
|
g_signal_emit (object, ges_timeline_object_signals[EFFECT_REMOVED], 0,
|
2011-02-16 13:05:14 +00:00
|
|
|
GES_TRACK_EFFECT (trackobject));
|
2011-12-06 17:10:14 +00:00
|
|
|
} else
|
|
|
|
g_signal_emit (object, ges_timeline_object_signals[TRACK_OBJECT_REMOVED], 0,
|
|
|
|
GES_TRACK_OBJECT (trackobject));
|
2011-02-08 13:04:39 +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);
|
|
|
|
|
2011-04-26 23:39:56 +00:00
|
|
|
if (klass->track_object_released) {
|
|
|
|
GST_DEBUG ("Calling track_object_released subclass method");
|
|
|
|
klass->track_object_released (object, 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;
|
|
|
|
}
|
|
|
|
|
2011-11-08 22:29:38 +00:00
|
|
|
static gboolean
|
|
|
|
ges_timeline_object_set_start_internal (GESTimelineObject * object,
|
|
|
|
guint64 start)
|
2009-08-07 18:33:18 +00:00
|
|
|
{
|
2010-12-16 15:27:26 +00:00
|
|
|
GList *tmp;
|
|
|
|
GESTrackObject *tr;
|
2010-12-16 18:29:14 +00:00
|
|
|
ObjectMapping *map;
|
2012-04-22 17:09:11 +00:00
|
|
|
GESTimeline *timeline = NULL;
|
|
|
|
GESTimelineObjectPrivate *priv = object->priv;
|
|
|
|
gboolean snap = FALSE;
|
2010-12-16 15:27:26 +00:00
|
|
|
|
2011-12-07 23:50:13 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE);
|
|
|
|
|
2009-08-07 18:33:18 +00:00
|
|
|
GST_DEBUG ("object:%p, start:%" GST_TIME_FORMAT,
|
|
|
|
object, GST_TIME_ARGS (start));
|
|
|
|
|
2012-04-22 17:09:11 +00:00
|
|
|
/* If the class has snapping enabled and the object is in a timeline,
|
|
|
|
* we snap */
|
|
|
|
if (priv->layer && GES_TIMELINE_OBJECT_GET_CLASS (object)->snaps)
|
|
|
|
timeline = ges_timeline_layer_get_timeline (object->priv->layer);
|
|
|
|
snap = timeline && priv->initiated_move == NULL ? TRUE : FALSE;
|
|
|
|
|
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);
|
|
|
|
|
2011-12-16 07:23:58 +00:00
|
|
|
if (ges_track_object_is_locked (tr) && tr != object->priv->initiated_move) {
|
|
|
|
gint64 new_start = start - map->start_offset;
|
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
/* Move the child... */
|
2011-12-16 07:23:58 +00:00
|
|
|
if (new_start < 0) {
|
|
|
|
GST_ERROR ("Trying to set start to a negative value %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (-(start + map->start_offset)));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-04-22 17:09:11 +00:00
|
|
|
/* Make the snapping happen if in a timeline */
|
|
|
|
if (snap)
|
|
|
|
ges_timeline_move_object_simple (timeline, tr, NULL, GES_EDGE_NONE,
|
|
|
|
start);
|
|
|
|
else
|
|
|
|
ges_track_object_set_start (tr, start);
|
2010-12-16 18:29:14 +00:00
|
|
|
} 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;
|
2011-11-08 22:29:38 +00:00
|
|
|
return TRUE;
|
2009-08-07 18:33:18 +00:00
|
|
|
}
|
|
|
|
|
2010-12-15 18:40:11 +00:00
|
|
|
/**
|
2011-11-08 22:29:38 +00:00
|
|
|
* ges_timeline_object_set_start:
|
2010-12-15 18:40:11 +00:00
|
|
|
* @object: a #GESTimelineObject
|
2011-11-08 22:29:38 +00:00
|
|
|
* @start: the position in #GstClockTime
|
2010-12-15 18:40:11 +00:00
|
|
|
*
|
2011-11-08 22:29:38 +00:00
|
|
|
* Set the position of the object in its containing layer
|
2012-04-22 17:09:11 +00:00
|
|
|
*
|
|
|
|
* Note that if the timeline snap-distance property of the timeline containing
|
|
|
|
* @object is set, @object will properly snap to its neighboors.
|
2010-12-15 18:40:11 +00:00
|
|
|
*/
|
2009-08-07 18:33:18 +00:00
|
|
|
void
|
2011-11-08 22:29:38 +00:00
|
|
|
ges_timeline_object_set_start (GESTimelineObject * object, guint64 start)
|
|
|
|
{
|
|
|
|
if (ges_timeline_object_set_start_internal (object, start))
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_START]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
ges_timeline_object_set_inpoint_internal (GESTimelineObject * object,
|
|
|
|
guint64 inpoint)
|
2009-08-07 18:33:18 +00:00
|
|
|
{
|
2010-12-16 15:27:26 +00:00
|
|
|
GList *tmp;
|
|
|
|
GESTrackObject *tr;
|
|
|
|
|
2011-12-07 23:50:13 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE);
|
|
|
|
|
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;
|
2011-11-08 22:29:38 +00:00
|
|
|
return TRUE;
|
2009-08-07 18:33:18 +00:00
|
|
|
}
|
|
|
|
|
2010-12-15 18:40:11 +00:00
|
|
|
/**
|
2011-11-08 22:29:38 +00:00
|
|
|
* ges_timeline_object_set_inpoint:
|
2010-12-15 18:40:11 +00:00
|
|
|
* @object: a #GESTimelineObject
|
2011-11-08 22:29:38 +00:00
|
|
|
* @inpoint: the in-point in #GstClockTime
|
2010-12-15 18:40:11 +00:00
|
|
|
*
|
2011-11-08 22:29:38 +00:00
|
|
|
* Set the in-point, that is the moment at which the @object will start
|
|
|
|
* outputting data from its contents.
|
2010-12-15 18:40:11 +00:00
|
|
|
*/
|
2009-08-07 18:33:18 +00:00
|
|
|
void
|
2011-11-08 22:29:38 +00:00
|
|
|
ges_timeline_object_set_inpoint (GESTimelineObject * object, guint64 inpoint)
|
|
|
|
{
|
|
|
|
if (ges_timeline_object_set_inpoint_internal (object, inpoint))
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_INPOINT]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
ges_timeline_object_set_duration_internal (GESTimelineObject * object,
|
|
|
|
guint64 duration)
|
2009-08-07 18:33:18 +00:00
|
|
|
{
|
2010-12-16 15:27:26 +00:00
|
|
|
GList *tmp;
|
|
|
|
GESTrackObject *tr;
|
2012-04-22 17:09:11 +00:00
|
|
|
GESTimeline *timeline = NULL;
|
|
|
|
GESTimelineObjectPrivate *priv = object->priv;
|
|
|
|
gboolean snap = FALSE;
|
2010-12-16 15:27:26 +00:00
|
|
|
|
2011-12-07 23:50:13 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE);
|
|
|
|
|
2009-08-07 18:33:18 +00:00
|
|
|
GST_DEBUG ("object:%p, duration:%" GST_TIME_FORMAT,
|
|
|
|
object, GST_TIME_ARGS (duration));
|
|
|
|
|
2012-04-22 17:09:11 +00:00
|
|
|
if (priv->layer && GES_TIMELINE_OBJECT_GET_CLASS (object)->snaps)
|
|
|
|
timeline = ges_timeline_layer_get_timeline (object->priv->layer);
|
|
|
|
|
2012-04-23 23:10:16 +00:00
|
|
|
/* If the class has snapping enabled, the object is in a timeline,
|
|
|
|
* and we are not following a moved TrackObject, we snap */
|
2012-04-22 17:09:11 +00:00
|
|
|
snap = timeline && priv->initiated_move == NULL ? TRUE : FALSE;
|
|
|
|
|
2012-04-23 23:10:16 +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;
|
2009-08-07 18:33:18 +00:00
|
|
|
|
2012-04-22 17:09:11 +00:00
|
|
|
if (ges_track_object_is_locked (tr)) {
|
|
|
|
/* call set_duration on each trackobject
|
|
|
|
* and make the snapping happen if in a timeline */
|
|
|
|
if (G_LIKELY (snap))
|
|
|
|
ges_timeline_trim_object_simple (timeline, tr, NULL, GES_EDGE_END,
|
|
|
|
tr->start + duration, TRUE);
|
|
|
|
else
|
|
|
|
ges_track_object_set_duration (tr, duration);
|
|
|
|
}
|
2009-08-07 18:33:18 +00:00
|
|
|
}
|
2012-04-23 23:10:16 +00:00
|
|
|
object->priv->ignore_notifies = FALSE;
|
2009-08-07 18:33:18 +00:00
|
|
|
|
|
|
|
object->duration = duration;
|
2011-11-08 22:29:38 +00:00
|
|
|
return TRUE;
|
2009-08-07 18:33:18 +00:00
|
|
|
}
|
|
|
|
|
2010-12-15 18:40:11 +00:00
|
|
|
/**
|
2011-11-08 22:29:38 +00:00
|
|
|
* ges_timeline_object_set_duration:
|
2010-12-15 18:40:11 +00:00
|
|
|
* @object: a #GESTimelineObject
|
2011-11-08 22:29:38 +00:00
|
|
|
* @duration: the duration in #GstClockTime
|
2010-12-15 18:40:11 +00:00
|
|
|
*
|
2011-11-08 22:29:38 +00:00
|
|
|
* Set the duration of the object
|
2012-04-22 17:09:11 +00:00
|
|
|
*
|
|
|
|
* Note that if the timeline snap-distance property of the timeline containing
|
|
|
|
* @object is set, @object will properly snap to its neighboors.
|
2010-12-15 18:40:11 +00:00
|
|
|
*/
|
2009-08-07 18:33:18 +00:00
|
|
|
void
|
2011-11-08 22:29:38 +00:00
|
|
|
ges_timeline_object_set_duration (GESTimelineObject * object, guint64 duration)
|
|
|
|
{
|
|
|
|
if (ges_timeline_object_set_duration_internal (object, duration))
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_DURATION]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
ges_timeline_object_set_priority_internal (GESTimelineObject * object,
|
|
|
|
guint priority)
|
2009-08-07 18:33:18 +00:00
|
|
|
{
|
2010-12-16 15:27:26 +00:00
|
|
|
GList *tmp;
|
|
|
|
GESTrackObject *tr;
|
2010-12-16 18:29:14 +00:00
|
|
|
ObjectMapping *map;
|
2011-12-07 23:50:13 +00:00
|
|
|
GESTimelineObjectPrivate *priv;
|
2011-04-15 23:34:28 +00:00
|
|
|
guint32 layer_min_gnl_prio, layer_max_gnl_prio;
|
2010-12-16 18:29:14 +00:00
|
|
|
|
2011-12-07 23:50:13 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE);
|
|
|
|
|
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
|
|
|
|
2011-12-07 23:50:13 +00:00
|
|
|
priv = object->priv;
|
2011-04-15 23:34:28 +00:00
|
|
|
|
|
|
|
get_layer_priorities (priv->layer, &layer_min_gnl_prio, &layer_max_gnl_prio);
|
|
|
|
|
2012-04-23 23:10:16 +00:00
|
|
|
priv->ignore_notifies = TRUE;
|
2011-02-16 13:30:22 +00:00
|
|
|
for (tmp = priv->trackobjects; tmp; tmp = g_list_next (tmp)) {
|
2010-12-16 15:27:26 +00:00
|
|
|
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)) {
|
2011-04-15 23:34:28 +00:00
|
|
|
guint32 real_tck_prio;
|
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
/* Move the child... */
|
2011-04-15 23:34:28 +00:00
|
|
|
real_tck_prio = layer_min_gnl_prio + priority + map->priority_offset;
|
|
|
|
|
|
|
|
if (real_tck_prio > layer_max_gnl_prio) {
|
|
|
|
GST_WARNING ("%p priority of %i, is outside of the its containing "
|
|
|
|
"layer space. (%d/%d) setting it to the maximum it can be", object,
|
|
|
|
priority, layer_min_gnl_prio, layer_max_gnl_prio);
|
|
|
|
|
|
|
|
real_tck_prio = layer_max_gnl_prio;
|
|
|
|
}
|
|
|
|
|
|
|
|
ges_track_object_set_priority (tr, real_tck_prio);
|
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
} else {
|
|
|
|
/* ... or update the offset */
|
2011-08-26 16:39:39 +00:00
|
|
|
map->priority_offset = tr->priority - layer_min_gnl_prio + priority;
|
2010-12-16 18:29:14 +00:00
|
|
|
}
|
2009-08-07 18:33:18 +00:00
|
|
|
}
|
|
|
|
|
2011-02-16 13:30:22 +00:00
|
|
|
priv->trackobjects = g_list_sort_with_data (priv->trackobjects,
|
|
|
|
(GCompareDataFunc) sort_track_effects, object);
|
|
|
|
priv->ignore_notifies = FALSE;
|
2010-12-16 18:29:14 +00:00
|
|
|
|
2009-08-07 18:33:18 +00:00
|
|
|
object->priority = priority;
|
2011-11-08 22:29:38 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-06-06 19:55:47 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_object_set_moving_from_layer:
|
|
|
|
* @object: a #GESTimelineObject
|
|
|
|
* @is_moving: %TRUE if you want to start moving @object to another layer
|
|
|
|
* %FALSE when you finished moving it.
|
|
|
|
*
|
|
|
|
* Sets the object in a moving to layer state. You might rather use the
|
|
|
|
* ges_timeline_object_move_to_layer function to move #GESTimelineObject-s
|
|
|
|
* from a layer to another.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
ges_timeline_object_set_moving_from_layer (GESTimelineObject * object,
|
|
|
|
gboolean is_moving)
|
|
|
|
{
|
2012-04-20 23:02:19 +00:00
|
|
|
g_return_if_fail (GES_IS_TIMELINE_OBJECT (object));
|
2011-12-07 23:50:13 +00:00
|
|
|
|
2011-06-06 19:55:47 +00:00
|
|
|
object->priv->is_moving = is_moving;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_timeline_object_is_moving_from_layer:
|
|
|
|
* @object: a #GESTimelineObject
|
|
|
|
*
|
|
|
|
* Tells you if the object is currently moving from a layer to another.
|
|
|
|
* You might rather use the ges_timeline_object_move_to_layer function to
|
|
|
|
* move #GESTimelineObject-s from a layer to another.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if @object is currently moving from its current layer
|
|
|
|
* %FALSE otherwize
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
ges_timeline_object_is_moving_from_layer (GESTimelineObject * object)
|
|
|
|
{
|
2012-04-20 23:02:19 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE);
|
|
|
|
|
2011-06-06 19:55:47 +00:00
|
|
|
return object->priv->is_moving;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_timeline_object_move_to_layer:
|
|
|
|
* @object: a #GESTimelineObject
|
|
|
|
* @layer: the new #GESTimelineLayer
|
|
|
|
*
|
|
|
|
* Moves @object to @layer. If @object is not in any layer, it adds it to
|
|
|
|
* @layer, else, it removes it from its current layer, and adds it to @layer.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if @object could be moved %FALSE otherwize
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
ges_timeline_object_move_to_layer (GESTimelineObject * object, GESTimelineLayer
|
|
|
|
* layer)
|
|
|
|
{
|
|
|
|
gboolean ret;
|
2011-12-07 23:50:13 +00:00
|
|
|
GESTimelineLayer *current_layer;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE);
|
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_LAYER (layer), FALSE);
|
|
|
|
|
|
|
|
current_layer = object->priv->layer;
|
2011-06-06 19:55:47 +00:00
|
|
|
|
|
|
|
if (current_layer == NULL) {
|
|
|
|
GST_DEBUG ("Not moving %p, only adding it to %p", object, layer);
|
|
|
|
|
|
|
|
return ges_timeline_layer_add_object (layer, object);
|
|
|
|
}
|
|
|
|
|
2012-01-20 20:03:58 +00:00
|
|
|
GST_DEBUG_OBJECT (object, "moving to layer %p, priority: %d", layer,
|
|
|
|
ges_timeline_layer_get_priority (layer));
|
|
|
|
|
2011-06-06 19:55:47 +00:00
|
|
|
object->priv->is_moving = TRUE;
|
|
|
|
g_object_ref (object);
|
|
|
|
ret = ges_timeline_layer_remove_object (current_layer, object);
|
|
|
|
|
|
|
|
if (!ret) {
|
|
|
|
g_object_unref (object);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = ges_timeline_layer_add_object (layer, object);
|
|
|
|
object->priv->is_moving = FALSE;
|
|
|
|
|
|
|
|
g_object_unref (object);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-11-08 22:29:38 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_object_set_priority:
|
|
|
|
* @object: a #GESTimelineObject
|
|
|
|
* @priority: the priority
|
|
|
|
*
|
|
|
|
* Sets the priority of the object within the containing layer
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ges_timeline_object_set_priority (GESTimelineObject * object, guint priority)
|
|
|
|
{
|
|
|
|
if (ges_timeline_object_set_priority_internal (object, priority))
|
|
|
|
#if GLIB_CHECK_VERSION(2,26,0)
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_PRIORITY]);
|
|
|
|
#else
|
|
|
|
g_object_notify (G_OBJECT (object), "priority");
|
|
|
|
#endif
|
2009-08-07 18:33:18 +00:00
|
|
|
}
|
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
|
|
|
*
|
2011-05-06 17:38:26 +00:00
|
|
|
* Note: If many objects match, then the one with the highest priority will be
|
|
|
|
* returned.
|
2010-03-12 16:17:30 +00:00
|
|
|
*
|
2011-05-09 12:24:26 +00:00
|
|
|
* Returns: (transfer full): The #GESTrackObject used by @track, else %NULL.
|
2011-05-06 17:38:26 +00:00
|
|
|
* Unref after usage.
|
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
|
|
|
|
2011-05-06 17:40:22 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), NULL);
|
|
|
|
g_return_val_if_fail (GES_IS_TRACK (track), NULL);
|
|
|
|
|
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) {
|
2011-05-06 17:40:22 +00:00
|
|
|
if ((type != G_TYPE_NONE) &&
|
|
|
|
!G_TYPE_CHECK_INSTANCE_TYPE (tmp->data, type))
|
2010-12-16 15:27:26 +00:00
|
|
|
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
|
|
|
|
*
|
2011-05-06 17:38:26 +00:00
|
|
|
* Get the #GESTimelineLayer to which this object belongs.
|
2010-11-28 12:24:07 +00:00
|
|
|
*
|
2011-05-06 17:38:26 +00:00
|
|
|
* Returns: (transfer full): The #GESTimelineLayer where this @object is being
|
2011-05-09 12:24:26 +00:00
|
|
|
* used, or %NULL if it is not used on any layer. The caller should unref it
|
2011-05-06 17:38:26 +00:00
|
|
|
* usage.
|
2010-11-28 12:24:07 +00:00
|
|
|
*/
|
|
|
|
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.
|
2011-01-31 10:33:56 +00:00
|
|
|
* The user is responsible for unreffing the contained objects
|
2010-11-28 12:24:07 +00:00
|
|
|
* 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;
|
|
|
|
}
|
|
|
|
|
2011-02-16 13:30:22 +00:00
|
|
|
static gint
|
2011-01-31 10:15:33 +00:00
|
|
|
sort_track_effects (gpointer a, gpointer b, GESTimelineObject * object)
|
|
|
|
{
|
|
|
|
guint prio_offset_a, prio_offset_b;
|
|
|
|
ObjectMapping *map_a, *map_b;
|
|
|
|
GESTrackObject *obj_a, *obj_b;
|
|
|
|
|
|
|
|
obj_a = GES_TRACK_OBJECT (a);
|
|
|
|
obj_b = GES_TRACK_OBJECT (b);
|
|
|
|
|
|
|
|
map_a = find_object_mapping (object, obj_a);
|
|
|
|
map_b = find_object_mapping (object, obj_b);
|
|
|
|
|
|
|
|
prio_offset_a = map_a->priority_offset;
|
|
|
|
prio_offset_b = map_b->priority_offset;
|
|
|
|
|
|
|
|
if ((gint) prio_offset_a > (guint) prio_offset_b)
|
|
|
|
return 1;
|
|
|
|
if ((guint) prio_offset_a < (guint) prio_offset_b)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-01-31 10:32:14 +00:00
|
|
|
/**
|
2011-05-07 14:59:06 +00:00
|
|
|
* ges_timeline_object_get_top_effects:
|
|
|
|
* @object: The origin #GESTimelineObject
|
|
|
|
*
|
|
|
|
* Get effects applied on @object
|
|
|
|
*
|
|
|
|
* Returns: (transfer full) (element-type GESTrackObject): a #GList of the
|
|
|
|
* #GESTrackEffect that are applied on @object order by ascendant priorities.
|
|
|
|
* The refcount of the objects will be increased. The user will have to
|
|
|
|
* unref each #GESTrackEffect and free the #GList.
|
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
|
|
|
*/
|
2011-01-31 10:32:14 +00:00
|
|
|
GList *
|
2011-02-16 16:45:05 +00:00
|
|
|
ges_timeline_object_get_top_effects (GESTimelineObject * object)
|
2011-01-31 10:32:14 +00:00
|
|
|
{
|
|
|
|
GList *tmp, *ret;
|
2011-02-16 16:45:05 +00:00
|
|
|
guint i;
|
2011-01-31 10:32:14 +00:00
|
|
|
|
2011-12-07 23:50:13 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), NULL);
|
|
|
|
|
2011-12-18 00:49:24 +00:00
|
|
|
GST_DEBUG_OBJECT (object, "Getting the %i top effects",
|
|
|
|
object->priv->nb_effects);
|
2011-01-31 10:32:14 +00:00
|
|
|
ret = NULL;
|
|
|
|
|
2011-02-16 16:45:05 +00:00
|
|
|
for (tmp = object->priv->trackobjects, i = 0; i < object->priv->nb_effects;
|
|
|
|
tmp = tmp->next, i++) {
|
2011-12-18 00:49:24 +00:00
|
|
|
ret = g_list_append (ret, g_object_ref (tmp->data));
|
2011-01-31 10:32:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2010-12-16 15:27:26 +00:00
|
|
|
|
2011-01-31 10:41:37 +00:00
|
|
|
/**
|
2011-05-07 14:59:06 +00:00
|
|
|
* ges_timeline_object_get_top_effect_position:
|
|
|
|
* @object: The origin #GESTimelineObject
|
|
|
|
* @effect: The #GESTrackEffect we want to get the top position from
|
|
|
|
*
|
|
|
|
* Gets the top position of an effect.
|
|
|
|
*
|
|
|
|
* Returns: The top position of the effect, -1 if something went wrong.
|
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
|
|
|
*/
|
2011-01-31 10:41:37 +00:00
|
|
|
gint
|
|
|
|
ges_timeline_object_get_top_effect_position (GESTimelineObject * object,
|
2011-02-16 13:05:14 +00:00
|
|
|
GESTrackEffect * effect)
|
2011-01-31 10:41:37 +00:00
|
|
|
{
|
2011-12-07 23:50:13 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), -1);
|
|
|
|
|
2011-01-31 10:41:37 +00:00
|
|
|
return find_object_mapping (object,
|
|
|
|
GES_TRACK_OBJECT (effect))->priority_offset;
|
|
|
|
}
|
|
|
|
|
2011-02-04 10:44:19 +00:00
|
|
|
/**
|
2011-05-07 14:59:06 +00:00
|
|
|
* ges_timeline_object_set_top_effect_priority:
|
|
|
|
* @object: The origin #GESTimelineObject
|
|
|
|
* @effect: The #GESTrackEffect to move
|
|
|
|
* @newpriority: the new position at which to move the @effect inside this
|
|
|
|
* #GESTimelineObject
|
|
|
|
*
|
|
|
|
* This is a convenience method that lets you set the priority of a top effect.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if @effect was successfuly moved, %FALSE otherwise.
|
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
|
|
|
*/
|
2011-02-04 10:44:19 +00:00
|
|
|
gboolean
|
|
|
|
ges_timeline_object_set_top_effect_priority (GESTimelineObject * object,
|
2011-02-16 13:05:14 +00:00
|
|
|
GESTrackEffect * effect, guint newpriority)
|
2011-02-04 10:44:19 +00:00
|
|
|
{
|
2011-02-16 16:51:21 +00:00
|
|
|
gint inc;
|
2011-12-07 23:50:13 +00:00
|
|
|
GList *tmp;
|
|
|
|
guint current_prio;
|
|
|
|
GESTrackObject *tck_obj;
|
|
|
|
GESTimelineObjectPrivate *priv;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE);
|
|
|
|
|
|
|
|
tck_obj = GES_TRACK_OBJECT (effect);
|
|
|
|
priv = object->priv;
|
|
|
|
current_prio = ges_track_object_get_priority (tck_obj);
|
2011-02-04 10:44:19 +00:00
|
|
|
|
|
|
|
/* We don't change the priority */
|
2011-02-16 16:51:21 +00:00
|
|
|
if (current_prio == newpriority ||
|
|
|
|
(G_UNLIKELY (ges_track_object_get_timeline_object (tck_obj) != object)))
|
2011-02-04 10:44:19 +00:00
|
|
|
return FALSE;
|
2011-02-16 16:51:21 +00:00
|
|
|
|
|
|
|
if (newpriority > (object->priv->nb_effects - 1)) {
|
|
|
|
GST_DEBUG ("You are trying to make %p not a top effect", effect);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (current_prio > object->priv->nb_effects) {
|
2012-04-17 15:18:21 +00:00
|
|
|
GST_DEBUG ("%p is not a top effect", effect);
|
2011-02-16 16:51:21 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tck_obj->priority < newpriority)
|
2011-02-04 10:44:19 +00:00
|
|
|
inc = -1;
|
|
|
|
else
|
|
|
|
inc = +1;
|
|
|
|
|
|
|
|
ges_track_object_set_priority (tck_obj, newpriority);
|
|
|
|
for (tmp = priv->trackobjects; tmp; tmp = tmp->next) {
|
|
|
|
GESTrackObject *tmpo = GES_TRACK_OBJECT (tmp->data);
|
|
|
|
guint tck_priority = ges_track_object_get_priority (tmpo);
|
|
|
|
|
|
|
|
if ((inc == +1 && tck_priority >= newpriority) ||
|
|
|
|
(inc == -1 && tck_priority <= newpriority)) {
|
|
|
|
ges_track_object_set_priority (tmpo, tck_priority + inc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
priv->trackobjects = g_list_sort_with_data (priv->trackobjects,
|
|
|
|
(GCompareDataFunc) sort_track_effects, object);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2012-04-24 00:52:45 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_object_edit:
|
|
|
|
* @object: the #GESTimelineObject to edit
|
|
|
|
* @layers: (element-type GESTimelineLayer): The layers you want the edit to
|
|
|
|
* happen in, %NULL means that the edition is done in all the
|
|
|
|
* #GESTimelineLayers contained in the current timeline.
|
|
|
|
* @new_layer_priority: The priority of the layer @object should land in.
|
|
|
|
* If the layer you're trying to move the object to doesn't exist, it will
|
|
|
|
* be created automatically. -1 means no move.
|
|
|
|
* @mode: The #GESEditMode in which the editition will happen.
|
|
|
|
* @edge: The #GESEdge the edit should happen on.
|
|
|
|
* @position: The position at which to edit @object (in nanosecond)
|
|
|
|
*
|
|
|
|
* Edit @object in the different exisiting #GESEditMode modes. In the case of
|
|
|
|
* slide, and roll, you need to specify a #GESEdge
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the object as been edited properly, %FALSE if an error
|
|
|
|
* occured
|
|
|
|
*
|
|
|
|
* Since: 0.10.XX
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
ges_timeline_object_edit (GESTimelineObject * object, GList * layers,
|
|
|
|
gint new_layer_priority, GESEditMode mode, GESEdge edge, guint64 position)
|
2011-08-24 09:48:14 +00:00
|
|
|
{
|
|
|
|
GList *tmp;
|
2012-04-24 00:52:45 +00:00
|
|
|
gboolean ret = TRUE;
|
|
|
|
GESTimelineLayer *layer;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE);
|
2011-08-24 09:48:14 +00:00
|
|
|
|
2012-04-24 00:52:45 +00:00
|
|
|
if (!G_UNLIKELY (object->priv->trackobjects)) {
|
|
|
|
GST_WARNING_OBJECT (object, "Trying to edit, but not containing"
|
|
|
|
"any TrackObject yet.");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (tmp = object->priv->trackobjects; tmp; tmp = g_list_next (tmp)) {
|
|
|
|
if (ges_track_object_is_locked (tmp->data)) {
|
|
|
|
ret &= ges_track_object_edit (tmp->data, layers, mode, edge, position);
|
|
|
|
break;
|
2011-08-24 09:48:14 +00:00
|
|
|
}
|
|
|
|
}
|
2012-04-24 00:52:45 +00:00
|
|
|
|
|
|
|
/* Moving to layer */
|
|
|
|
if (new_layer_priority == -1) {
|
|
|
|
GST_DEBUG_OBJECT (object, "Not moving new prio %d", new_layer_priority);
|
|
|
|
} else {
|
|
|
|
gint priority_offset;
|
|
|
|
|
|
|
|
layer = object->priv->layer;
|
|
|
|
if (layer == NULL) {
|
|
|
|
GST_WARNING_OBJECT (object, "Not in any layer yet, not moving");
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
priority_offset = new_layer_priority -
|
|
|
|
ges_timeline_layer_get_priority (layer);
|
|
|
|
|
2012-04-22 17:09:11 +00:00
|
|
|
ret &= timeline_context_to_layer (layer->timeline, priority_offset);
|
2012-04-24 00:52:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
2011-08-24 09:48:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_timeline_object_split:
|
|
|
|
* @object: the #GESTimelineObject to split
|
2012-04-20 23:22:56 +00:00
|
|
|
* @position: a #GstClockTime representing the position at which to split
|
|
|
|
* @object
|
2011-08-24 09:48:14 +00:00
|
|
|
*
|
|
|
|
* The function modifies @object, and creates another #GESTimelineObject so
|
|
|
|
* we have two clips at the end, splitted at the time specified by @position.
|
|
|
|
*
|
2012-08-10 16:39:10 +00:00
|
|
|
* Returns: (transfer floating): The newly created #GESTimelineObject resulting from the splitting
|
2011-08-24 09:48:14 +00:00
|
|
|
*/
|
|
|
|
GESTimelineObject *
|
2012-04-20 23:22:56 +00:00
|
|
|
ges_timeline_object_split (GESTimelineObject * object, guint64 position)
|
2011-08-24 09:48:14 +00:00
|
|
|
{
|
2012-04-20 23:19:49 +00:00
|
|
|
GList *tmp;
|
|
|
|
gboolean locked;
|
2011-08-24 09:48:14 +00:00
|
|
|
GESTimelineObject *new_object;
|
2012-04-20 23:19:49 +00:00
|
|
|
GESTimelineObjectPrivate *priv;
|
|
|
|
|
|
|
|
GstClockTime start, inpoint, duration;
|
2011-08-24 09:48:14 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), NULL);
|
2012-04-20 23:22:56 +00:00
|
|
|
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (position), NULL);
|
2011-08-24 09:48:14 +00:00
|
|
|
|
2012-04-20 23:19:49 +00:00
|
|
|
priv = object->priv;
|
2011-08-24 09:48:14 +00:00
|
|
|
|
2012-04-20 23:19:49 +00:00
|
|
|
duration = GES_TIMELINE_OBJECT_DURATION (object);
|
|
|
|
start = GES_TIMELINE_OBJECT_START (object);
|
|
|
|
inpoint = GES_TIMELINE_OBJECT_INPOINT (object);
|
2011-08-24 09:48:14 +00:00
|
|
|
|
2012-04-20 23:19:49 +00:00
|
|
|
if (position >= start + duration || position <= start) {
|
|
|
|
GST_WARNING_OBJECT (object, "Can not split %" GST_TIME_FORMAT
|
|
|
|
" out of boundaries", GST_TIME_ARGS (position));
|
|
|
|
return NULL;
|
|
|
|
}
|
2011-08-24 09:48:14 +00:00
|
|
|
|
2012-04-20 23:19:49 +00:00
|
|
|
GST_DEBUG_OBJECT (object, "Spliting at %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (position));
|
2011-08-24 09:48:14 +00:00
|
|
|
|
2012-04-20 23:19:49 +00:00
|
|
|
/* Create the new TimelineObject */
|
2011-08-24 09:48:14 +00:00
|
|
|
new_object = ges_timeline_object_copy (object, FALSE);
|
|
|
|
|
2012-04-20 23:19:49 +00:00
|
|
|
/* Set new timing properties on the TimelineObject */
|
|
|
|
ges_timeline_object_set_start (new_object, position);
|
|
|
|
ges_timeline_object_set_inpoint (new_object, object->inpoint +
|
|
|
|
duration - (duration + start - position));
|
|
|
|
ges_timeline_object_set_duration (new_object, duration + start - position);
|
|
|
|
|
|
|
|
if (object->priv->layer) {
|
|
|
|
/* We do not want the timeline to create again TrackObject-s */
|
|
|
|
ges_timeline_object_set_moving_from_layer (new_object, TRUE);
|
|
|
|
ges_timeline_layer_add_object (object->priv->layer, new_object);
|
|
|
|
ges_timeline_object_set_moving_from_layer (new_object, FALSE);
|
2011-08-24 09:48:14 +00:00
|
|
|
}
|
|
|
|
|
2012-04-20 23:19:49 +00:00
|
|
|
/* We first set the new duration and the child mapping will be updated
|
|
|
|
* properly in the following loop */
|
|
|
|
object->duration = position - object->start;
|
|
|
|
for (tmp = priv->trackobjects; tmp; tmp = tmp->next) {
|
|
|
|
GESTrack *track;
|
|
|
|
|
|
|
|
GESTrackObject *new_tckobj, *tckobj = GES_TRACK_OBJECT (tmp->data);
|
|
|
|
|
|
|
|
duration = ges_track_object_get_duration (tckobj);
|
|
|
|
start = ges_track_object_get_start (tckobj);
|
|
|
|
inpoint = ges_track_object_get_inpoint (tckobj);
|
|
|
|
|
|
|
|
if (position <= start || position >= (start + duration)) {
|
|
|
|
GST_DEBUG_OBJECT (tckobj, "Outside %" GST_TIME_FORMAT "the boundaries "
|
|
|
|
"not copying it ( start %" GST_TIME_FORMAT ", end %" GST_TIME_FORMAT
|
|
|
|
")", GST_TIME_ARGS (position), GST_TIME_ARGS (tckobj->start),
|
|
|
|
GST_TIME_ARGS (tckobj->start + tckobj->duration));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
new_tckobj = ges_track_object_copy (tckobj, TRUE);
|
|
|
|
if (new_tckobj == NULL) {
|
|
|
|
GST_WARNING_OBJECT (tckobj, "Could not create a copy");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
ges_timeline_object_add_track_object (new_object, new_tckobj);
|
|
|
|
|
|
|
|
track = ges_track_object_get_track (tckobj);
|
|
|
|
if (track == NULL)
|
|
|
|
GST_DEBUG_OBJECT (tckobj, "Was not in a track, not adding %p to"
|
|
|
|
"any track", new_tckobj);
|
|
|
|
else
|
|
|
|
ges_track_add_object (track, new_tckobj);
|
|
|
|
|
|
|
|
/* Unlock TrackObject-s as we do not want the container to move
|
|
|
|
* syncronously */
|
|
|
|
locked = ges_track_object_is_locked (tckobj);
|
|
|
|
ges_track_object_set_locked (new_tckobj, FALSE);
|
|
|
|
ges_track_object_set_locked (tckobj, FALSE);
|
|
|
|
|
|
|
|
/* Set 'new' track object timing propeties */
|
|
|
|
ges_track_object_set_start (new_tckobj, position);
|
|
|
|
ges_track_object_set_inpoint (new_tckobj, inpoint + duration - (duration +
|
|
|
|
start - position));
|
|
|
|
ges_track_object_set_duration (new_tckobj, duration + start - position);
|
|
|
|
|
|
|
|
/* Set 'old' track object duration */
|
|
|
|
ges_track_object_set_duration (tckobj, position - start);
|
|
|
|
|
|
|
|
/* And let track objects in the same locking state as before. */
|
|
|
|
ges_track_object_set_locked (tckobj, locked);
|
|
|
|
ges_track_object_set_locked (new_tckobj, locked);
|
|
|
|
}
|
2011-08-24 09:48:14 +00:00
|
|
|
|
|
|
|
return new_object;
|
|
|
|
}
|
|
|
|
|
2011-06-09 00:36:58 +00:00
|
|
|
/* TODO implement the deep parameter, and make it public */
|
|
|
|
static GESTimelineObject *
|
|
|
|
ges_timeline_object_copy (GESTimelineObject * object, gboolean * deep)
|
|
|
|
{
|
|
|
|
GESTimelineObject *ret = NULL;
|
|
|
|
GParameter *params;
|
|
|
|
GParamSpec **specs;
|
|
|
|
guint n, n_specs, n_params;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), NULL);
|
|
|
|
|
|
|
|
specs =
|
|
|
|
g_object_class_list_properties (G_OBJECT_GET_CLASS (object), &n_specs);
|
|
|
|
params = g_new0 (GParameter, n_specs);
|
|
|
|
n_params = 0;
|
|
|
|
|
|
|
|
for (n = 0; n < n_specs; ++n) {
|
|
|
|
if (strcmp (specs[n]->name, "parent") &&
|
|
|
|
(specs[n]->flags & G_PARAM_READWRITE) == G_PARAM_READWRITE) {
|
|
|
|
params[n_params].name = g_intern_string (specs[n]->name);
|
|
|
|
g_value_init (¶ms[n_params].value, specs[n]->value_type);
|
|
|
|
g_object_get_property (G_OBJECT (object), specs[n]->name,
|
|
|
|
¶ms[n_params].value);
|
|
|
|
++n_params;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = g_object_newv (G_TYPE_FROM_INSTANCE (object), n_params, params);
|
2011-08-24 09:48:14 +00:00
|
|
|
|
2011-06-09 00:36:58 +00:00
|
|
|
g_free (specs);
|
|
|
|
g_free (params);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-12-07 23:17:55 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_object_set_supported_formats:
|
|
|
|
* @object: the #GESTimelineObject to set supported formats on
|
|
|
|
* @supportedformats: the #GESTrackType defining formats supported by @object
|
|
|
|
*
|
|
|
|
* Sets the formats supported by the file.
|
|
|
|
*
|
|
|
|
* Since: 0.10.XX
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ges_timeline_object_set_supported_formats (GESTimelineObject * object,
|
|
|
|
GESTrackType supportedformats)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GES_IS_TIMELINE_OBJECT (object));
|
|
|
|
|
|
|
|
object->priv->supportedformats = supportedformats;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_timeline_object_get_supported_formats:
|
|
|
|
* @object: the #GESTimelineObject
|
|
|
|
*
|
|
|
|
* Get the formats supported by @object.
|
|
|
|
*
|
|
|
|
* Returns: The formats supported by @object.
|
|
|
|
*
|
|
|
|
* Since: 0.10.XX
|
|
|
|
*/
|
|
|
|
GESTrackType
|
|
|
|
ges_timeline_object_get_supported_formats (GESTimelineObject * object)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object),
|
|
|
|
GES_TRACK_TYPE_UNKNOWN);
|
|
|
|
|
|
|
|
return object->priv->supportedformats;
|
|
|
|
}
|
|
|
|
|
2011-12-07 23:36:24 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_object_objects_set_locked:
|
|
|
|
* @object: the #GESTimelineObject
|
|
|
|
* @locked: whether the #GESTrackObject contained in @object are locked to it.
|
|
|
|
*
|
|
|
|
* Set the locking status of all the #GESTrackObject contained in @object to @locked.
|
|
|
|
* See the ges_track_object_set_locked documentation for more details.
|
|
|
|
*
|
|
|
|
* Since: 0.10.XX
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ges_timeline_object_objects_set_locked (GESTimelineObject * object,
|
|
|
|
gboolean locked)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
g_return_if_fail (GES_IS_TIMELINE_OBJECT (object));
|
|
|
|
|
|
|
|
for (tmp = object->priv->mappings; tmp; tmp = g_list_next (tmp)) {
|
|
|
|
ges_track_object_set_locked (((ObjectMapping *) tmp->data)->object, locked);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-16 12:37:22 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_object_get_max_duration:
|
|
|
|
* @object: The #GESTimelineObject to retrieve max duration from
|
|
|
|
*
|
|
|
|
* Get the max duration of @object.
|
|
|
|
*
|
|
|
|
* Returns: The max duration of @object
|
|
|
|
*
|
|
|
|
* Since: 0.10.XX
|
|
|
|
*/
|
|
|
|
guint64
|
|
|
|
ges_timeline_object_get_max_duration (GESTimelineObject * object)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), 0);
|
|
|
|
|
|
|
|
return object->priv->maxduration;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_timeline_object_set_max_duration:
|
|
|
|
* @object: The #GESTimelineObject to retrieve max duration from
|
|
|
|
* @maxduration: The maximum duration of @object
|
|
|
|
*
|
|
|
|
* Returns: Set the max duration of @object
|
|
|
|
*
|
|
|
|
* Since: 0.10.XX
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ges_timeline_object_set_max_duration (GESTimelineObject * object,
|
|
|
|
guint64 maxduration)
|
|
|
|
{
|
|
|
|
GESTimelineObjectClass *klass = GES_TIMELINE_OBJECT_GET_CLASS (object);
|
|
|
|
|
|
|
|
g_return_if_fail (GES_IS_TIMELINE_OBJECT (object));
|
|
|
|
|
|
|
|
object->priv->maxduration = maxduration;
|
|
|
|
klass->set_max_duration (object, maxduration);
|
|
|
|
}
|
|
|
|
|
2012-04-24 00:52:45 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_object_ripple:
|
|
|
|
* @object: The #GESTimeline to ripple.
|
|
|
|
* @start: The new start of @object in ripple mode.
|
|
|
|
*
|
|
|
|
* Edits @object in ripple mode. It allows you to modify the
|
|
|
|
* start of @object and move the following neighbours accordingly.
|
|
|
|
* This will change the overall timeline duration.
|
|
|
|
*
|
|
|
|
* You could also use:
|
|
|
|
*
|
|
|
|
* #ges_timeline_object_edit (@object, @layers,
|
|
|
|
* new_layer_priority=-1, GES_EDIT_MODE_RIPPLE, GES_EDGE_NONE,
|
|
|
|
* @position);
|
|
|
|
*
|
|
|
|
* Which lets you more control over layer management.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the object as been rippled properly, %FALSE if an error
|
|
|
|
* occured
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
ges_timeline_object_ripple (GESTimelineObject * object, guint64 start)
|
|
|
|
{
|
|
|
|
GList *tmp, *tckobjs;
|
|
|
|
gboolean ret = TRUE;
|
|
|
|
GESTimeline *timeline;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE);
|
|
|
|
|
|
|
|
timeline = ges_timeline_layer_get_timeline (object->priv->layer);
|
|
|
|
|
|
|
|
if (timeline == NULL) {
|
|
|
|
GST_DEBUG ("Not in a timeline yet");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
tckobjs = ges_timeline_object_get_track_objects (object);
|
|
|
|
for (tmp = tckobjs; tmp; tmp = g_list_next (tmp)) {
|
|
|
|
if (ges_track_object_is_locked (tmp->data)) {
|
|
|
|
ret = timeline_ripple_object (timeline, GES_TRACK_OBJECT (tmp->data),
|
|
|
|
NULL, GES_EDGE_NONE, start);
|
|
|
|
/* As we work only with locked objects, the changes will be reflected
|
|
|
|
* to others controlled TrackObjects */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_list_free_full (tckobjs, g_object_unref);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_timeline_object_ripple_end:
|
|
|
|
* @object: The #GESTimeline to ripple.
|
|
|
|
* @end: The new end (start + duration) of @object in ripple mode. It will
|
|
|
|
* basically only change the duration of @object.
|
|
|
|
*
|
|
|
|
* Edits @object in ripple mode. It allows you to modify the
|
|
|
|
* duration of a @object and move the following neighbours accordingly.
|
|
|
|
* This will change the overall timeline duration.
|
|
|
|
*
|
|
|
|
* You could also use:
|
|
|
|
*
|
|
|
|
* #ges_timeline_object_edit (@object, @layers,
|
|
|
|
* new_layer_priority=-1, GES_EDIT_MODE_RIPPLE, GES_EDGE_END, @end);
|
|
|
|
*
|
|
|
|
* Which lets you more control over layer management.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the object as been rippled properly, %FALSE if an error
|
|
|
|
* occured
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
ges_timeline_object_ripple_end (GESTimelineObject * object, guint64 end)
|
|
|
|
{
|
|
|
|
GList *tmp, *tckobjs;
|
|
|
|
gboolean ret = TRUE;
|
|
|
|
GESTimeline *timeline;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE);
|
|
|
|
|
|
|
|
timeline = ges_timeline_layer_get_timeline (object->priv->layer);
|
|
|
|
|
|
|
|
if (timeline == NULL) {
|
|
|
|
GST_DEBUG ("Not in a timeline yet");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
tckobjs = ges_timeline_object_get_track_objects (object);
|
|
|
|
for (tmp = tckobjs; tmp; tmp = g_list_next (tmp)) {
|
|
|
|
if (ges_track_object_is_locked (tmp->data)) {
|
|
|
|
ret = timeline_ripple_object (timeline, GES_TRACK_OBJECT (tmp->data),
|
|
|
|
NULL, GES_EDGE_END, end);
|
|
|
|
/* As we work only with locked objects, the changes will be reflected
|
|
|
|
* to others controlled TrackObjects */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_list_free_full (tckobjs, g_object_unref);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_timeline_object_roll_start:
|
2012-05-09 16:12:38 +00:00
|
|
|
* @object: The #GESTimelineObject to roll
|
2012-04-24 00:52:45 +00:00
|
|
|
* @start: The new start of @object in roll mode, it will also adapat
|
|
|
|
* the in-point of @object according
|
|
|
|
*
|
|
|
|
* Edits @object in roll mode. It allows you to modify the
|
|
|
|
* start and inpoint of a @object and "resize" (basicly change the duration
|
|
|
|
* in this case) of the previous neighbours accordingly.
|
|
|
|
* This will not change the overall timeline duration.
|
|
|
|
*
|
|
|
|
* You could also use:
|
|
|
|
*
|
|
|
|
* #ges_timeline_object_edit (@object, @layers,
|
|
|
|
* new_layer_priority=-1, GES_EDIT_MODE_ROLL, GES_EDGE_START, @start);
|
|
|
|
*
|
|
|
|
* Which lets you more control over layer management.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the object as been roll properly, %FALSE if an error
|
|
|
|
* occured
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
ges_timeline_object_roll_start (GESTimelineObject * object, guint64 start)
|
|
|
|
{
|
|
|
|
GList *tmp, *tckobjs;
|
|
|
|
gboolean ret = TRUE;
|
|
|
|
GESTimeline *timeline;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE);
|
|
|
|
|
|
|
|
timeline = ges_timeline_layer_get_timeline (object->priv->layer);
|
|
|
|
|
|
|
|
if (timeline == NULL) {
|
|
|
|
GST_DEBUG ("Not in a timeline yet");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
tckobjs = ges_timeline_object_get_track_objects (object);
|
|
|
|
for (tmp = tckobjs; tmp; tmp = g_list_next (tmp)) {
|
|
|
|
if (ges_track_object_is_locked (tmp->data)) {
|
|
|
|
ret = timeline_roll_object (timeline, GES_TRACK_OBJECT (tmp->data),
|
|
|
|
NULL, GES_EDGE_START, start);
|
|
|
|
/* As we work only with locked objects, the changes will be reflected
|
|
|
|
* to others controlled TrackObjects */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_list_free_full (tckobjs, g_object_unref);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_timeline_object_roll_end:
|
|
|
|
* @object: The #GESTimeline to roll.
|
|
|
|
* @end: The new end (start + duration) of @object in roll mode
|
|
|
|
*
|
|
|
|
* Edits @object in roll mode. It allows you to modify the
|
|
|
|
* duration of a @object and trim (basicly change the start + inpoint
|
|
|
|
* in this case) the following neighbours accordingly.
|
|
|
|
* This will not change the overall timeline duration.
|
|
|
|
*
|
|
|
|
* You could also use:
|
|
|
|
*
|
|
|
|
* #ges_timeline_object_edit (@object, @layers,
|
|
|
|
* new_layer_priority=-1, GES_EDIT_MODE_ROLL, GES_EDGE_END, @end);
|
|
|
|
*
|
|
|
|
* Which lets you more control over layer management.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the object as been rolled properly, %FALSE if an error
|
|
|
|
* occured
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
ges_timeline_object_roll_end (GESTimelineObject * object, guint64 end)
|
|
|
|
{
|
|
|
|
GList *tmp, *tckobjs;
|
|
|
|
gboolean ret = TRUE;
|
|
|
|
GESTimeline *timeline;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE);
|
|
|
|
|
|
|
|
timeline = ges_timeline_layer_get_timeline (object->priv->layer);
|
|
|
|
|
|
|
|
if (timeline == NULL) {
|
|
|
|
GST_DEBUG ("Not in a timeline yet");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tckobjs = ges_timeline_object_get_track_objects (object);
|
|
|
|
for (tmp = tckobjs; tmp; tmp = g_list_next (tmp)) {
|
|
|
|
if (ges_track_object_is_locked (tmp->data)) {
|
|
|
|
ret = timeline_roll_object (timeline, GES_TRACK_OBJECT (tmp->data),
|
|
|
|
NULL, GES_EDGE_END, end);
|
|
|
|
/* As we work only with locked objects, the changes will be reflected
|
|
|
|
* to others controlled TrackObjects */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_list_free_full (tckobjs, g_object_unref);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_timeline_object_trim_start:
|
|
|
|
* @object: The #GESTimeline to trim.
|
|
|
|
* @start: The new start of @object in trim mode, will adapt the inpoint
|
|
|
|
* of @object accordingly
|
|
|
|
*
|
|
|
|
* Edits @object in trim mode. It allows you to modify the
|
|
|
|
* inpoint and start of @object.
|
|
|
|
* This will not change the overall timeline duration.
|
|
|
|
*
|
|
|
|
* You could also use:
|
|
|
|
*
|
|
|
|
* #ges_timeline_object_edit (@object, @layers,
|
|
|
|
* new_layer_priority=-1, GES_EDIT_MODE_TRIM, GES_EDGE_START, @start);
|
|
|
|
*
|
|
|
|
* Which lets you more control over layer management.
|
|
|
|
*
|
|
|
|
* Note that to trim the end of an object you can just set its duration. The same way
|
|
|
|
* as this method, it will take into account the snapping-distance property of the
|
|
|
|
* timeline in which @object is.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the object as been trimmed properly, %FALSE if an error
|
|
|
|
* occured
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
ges_timeline_object_trim_start (GESTimelineObject * object, guint64 start)
|
|
|
|
{
|
|
|
|
GList *tmp, *tckobjs;
|
|
|
|
gboolean ret = TRUE;
|
|
|
|
GESTimeline *timeline;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE);
|
|
|
|
|
|
|
|
timeline = ges_timeline_layer_get_timeline (object->priv->layer);
|
|
|
|
|
|
|
|
if (timeline == NULL) {
|
|
|
|
GST_DEBUG ("Not in a timeline yet");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
tckobjs = ges_timeline_object_get_track_objects (object);
|
|
|
|
for (tmp = tckobjs; tmp; tmp = g_list_next (tmp)) {
|
|
|
|
if (ges_track_object_is_locked (tmp->data)) {
|
|
|
|
ret = timeline_trim_object (timeline, GES_TRACK_OBJECT (tmp->data),
|
|
|
|
NULL, GES_EDGE_START, start);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_list_free_full (tckobjs, g_object_unref);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-02-01 20:14:29 +00:00
|
|
|
static void
|
|
|
|
update_height (GESTimelineObject * object)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
guint32 min_prio = G_MAXUINT32, max_prio = 0;
|
|
|
|
|
|
|
|
/* Go over all childs and check if height has changed */
|
|
|
|
for (tmp = object->priv->trackobjects; tmp; tmp = tmp->next) {
|
2011-02-03 14:40:05 +00:00
|
|
|
guint tck_priority =
|
|
|
|
ges_track_object_get_priority (GES_TRACK_OBJECT (tmp->data));
|
2011-02-01 20:14:29 +00:00
|
|
|
|
2011-02-03 14:40:05 +00:00
|
|
|
if (tck_priority < min_prio)
|
|
|
|
min_prio = tck_priority;
|
|
|
|
if (tck_priority > max_prio)
|
|
|
|
max_prio = tck_priority;
|
2011-02-01 20:14:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME : We only grow the height */
|
|
|
|
if (object->height < (max_prio - min_prio + 1)) {
|
|
|
|
object->height = max_prio - min_prio + 1;
|
2011-02-03 14:30:30 +00:00
|
|
|
GST_DEBUG ("Updating height %i", object->height);
|
2011-02-01 20:14:29 +00:00
|
|
|
#if GLIB_CHECK_VERSION(2,26,0)
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_HEIGHT]);
|
|
|
|
#else
|
|
|
|
g_object_notify (G_OBJECT (object), "height");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 */
|
2011-12-16 07:23:58 +00:00
|
|
|
object->priv->initiated_move = child;
|
2010-12-16 18:29:14 +00:00
|
|
|
ges_timeline_object_set_start (object, child->start + map->start_offset);
|
2011-12-16 07:23:58 +00:00
|
|
|
object->priv->initiated_move = NULL;
|
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_inpoint_changed_cb (GESTrackObject * child,
|
|
|
|
GParamSpec * arg G_GNUC_UNUSED, GESTimelineObject * object)
|
|
|
|
{
|
2012-03-30 07:40:50 +00:00
|
|
|
ObjectMapping *map;
|
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
if (object->priv->ignore_notifies)
|
|
|
|
return;
|
2010-07-09 11:49:23 +00:00
|
|
|
|
2012-03-30 07:40:50 +00:00
|
|
|
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->inpoint_offset = object->inpoint - child->inpoint;
|
|
|
|
} else {
|
|
|
|
/* Or update the parent start */
|
|
|
|
object->priv->initiated_move = child;
|
|
|
|
ges_timeline_object_set_inpoint (object,
|
|
|
|
child->inpoint + map->inpoint_offset);
|
|
|
|
object->priv->initiated_move = NULL;
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
{
|
2012-03-30 07:40:50 +00:00
|
|
|
ObjectMapping *map;
|
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
if (object->priv->ignore_notifies)
|
|
|
|
return;
|
|
|
|
|
2012-03-30 07:40:50 +00:00
|
|
|
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->duration_offset = object->duration - child->duration;
|
|
|
|
} else {
|
|
|
|
/* Or update the parent start */
|
|
|
|
object->priv->initiated_move = child;
|
|
|
|
ges_timeline_object_set_duration (object,
|
|
|
|
child->duration + map->duration_offset);
|
|
|
|
object->priv->initiated_move = NULL;
|
|
|
|
}
|
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
track_object_priority_changed_cb (GESTrackObject * child,
|
|
|
|
GParamSpec * arg G_GNUC_UNUSED, GESTimelineObject * object)
|
|
|
|
{
|
|
|
|
ObjectMapping *map;
|
2011-04-15 23:34:28 +00:00
|
|
|
guint32 layer_min_gnl_prio, layer_max_gnl_prio;
|
|
|
|
|
2011-02-03 14:40:05 +00:00
|
|
|
guint tck_priority = ges_track_object_get_priority (child);
|
|
|
|
|
2011-06-03 02:01:43 +00:00
|
|
|
GST_DEBUG ("TrackObject %p priority changed to %i", child,
|
|
|
|
ges_track_object_get_priority (child));
|
2010-12-16 18:29:14 +00:00
|
|
|
|
|
|
|
if (object->priv->ignore_notifies)
|
|
|
|
return;
|
|
|
|
|
2011-02-03 14:40:05 +00:00
|
|
|
update_height (object);
|
2010-12-16 18:29:14 +00:00
|
|
|
map = find_object_mapping (object, child);
|
2011-04-15 23:34:28 +00:00
|
|
|
get_layer_priorities (object->priv->layer, &layer_min_gnl_prio,
|
|
|
|
&layer_max_gnl_prio);
|
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
if (G_UNLIKELY (map == NULL))
|
|
|
|
/* something massively screwed up if we get this */
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!ges_track_object_is_locked (child)) {
|
2011-04-15 23:34:28 +00:00
|
|
|
if (tck_priority < layer_min_gnl_prio || tck_priority > layer_max_gnl_prio) {
|
|
|
|
GST_WARNING ("%p priority of %i, is outside of its containing "
|
|
|
|
"layer space. (%d/%d). This is a bug in the program.", object,
|
|
|
|
tck_priority, layer_min_gnl_prio, layer_max_gnl_prio);
|
|
|
|
}
|
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
/* Update the internal priority_offset */
|
2011-04-15 23:34:28 +00:00
|
|
|
map->priority_offset =
|
2011-08-26 16:39:39 +00:00
|
|
|
tck_priority - (layer_min_gnl_prio + object->priority);
|
2011-04-15 23:34:28 +00:00
|
|
|
|
|
|
|
} else if (tck_priority < layer_min_gnl_prio + object->priority) {
|
2011-02-03 14:40:05 +00:00
|
|
|
/* Or update the parent priority, the object priority is always the
|
|
|
|
* highest priority (smaller number) */
|
2012-03-06 14:35:51 +00:00
|
|
|
if (tck_priority < layer_min_gnl_prio || layer_max_gnl_prio < tck_priority) {
|
2011-04-15 23:34:28 +00:00
|
|
|
|
|
|
|
GST_WARNING ("%p priority of %i, is outside of its containing "
|
|
|
|
"layer space. (%d/%d). This is a bug in the program.", object,
|
|
|
|
tck_priority, layer_min_gnl_prio, layer_max_gnl_prio);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-12-16 18:29:14 +00:00
|
|
|
ges_timeline_object_set_priority (object,
|
2011-04-15 23:34:28 +00:00
|
|
|
tck_priority - layer_min_gnl_prio);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG ("object %p priority %d child %p priority %d", object,
|
|
|
|
object->priority, child, ges_track_object_get_priority (child));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
get_layer_priorities (GESTimelineLayer * layer, guint32 * layer_min_gnl_prio,
|
|
|
|
guint32 * layer_max_gnl_prio)
|
|
|
|
{
|
|
|
|
if (layer) {
|
|
|
|
*layer_min_gnl_prio = layer->min_gnl_priority;
|
|
|
|
*layer_max_gnl_prio = layer->max_gnl_priority;
|
|
|
|
} else {
|
|
|
|
*layer_min_gnl_prio = 0;
|
|
|
|
*layer_max_gnl_prio = G_MAXUINT32;
|
2010-07-09 11:49:23 +00:00
|
|
|
}
|
|
|
|
}
|