2009-08-04 15:16:31 +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:16:31 +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-track-object
|
|
|
|
* @short_description: Base Class for objects contained in a #GESTrack
|
|
|
|
*
|
|
|
|
* #GESTrackObject is the Base Class for any object that can be contained in a
|
|
|
|
* #GESTrack.
|
2009-09-14 14:33:25 +00:00
|
|
|
*
|
|
|
|
* It contains the basic information as to the location of the object within
|
|
|
|
* its container, like the start position, the in-point, the duration and the
|
|
|
|
* priority.
|
2009-09-10 16:40:51 +00:00
|
|
|
*/
|
|
|
|
|
2009-08-06 17:51:29 +00:00
|
|
|
#include "ges-internal.h"
|
2011-02-08 14:29:21 +00:00
|
|
|
#include "gesmarshal.h"
|
2009-08-04 15:16:31 +00:00
|
|
|
#include "ges-track-object.h"
|
2009-08-06 15:38:43 +00:00
|
|
|
#include "ges-timeline-object.h"
|
2011-02-25 11:13:03 +00:00
|
|
|
#include <gobject/gvaluecollector.h>
|
2009-08-04 15:16:31 +00:00
|
|
|
|
2010-12-20 10:58:21 +00:00
|
|
|
G_DEFINE_ABSTRACT_TYPE (GESTrackObject, ges_track_object,
|
|
|
|
G_TYPE_INITIALLY_UNOWNED);
|
2009-08-06 10:14:37 +00:00
|
|
|
|
2010-12-04 18:54:13 +00:00
|
|
|
struct _GESTrackObjectPrivate
|
|
|
|
{
|
2010-12-16 14:00:46 +00:00
|
|
|
/* These fields are only used before the gnlobject is available */
|
|
|
|
guint64 pending_start;
|
|
|
|
guint64 pending_inpoint;
|
|
|
|
guint64 pending_duration;
|
2010-12-16 18:24:25 +00:00
|
|
|
guint32 pending_priority;
|
2010-12-16 14:00:46 +00:00
|
|
|
gboolean pending_active;
|
|
|
|
|
|
|
|
GstElement *gnlobject; /* The GnlObject */
|
|
|
|
GstElement *element; /* The element contained in the gnlobject (can be NULL) */
|
|
|
|
|
2011-02-07 16:06:01 +00:00
|
|
|
/* We keep a link between properties name and elements internally
|
|
|
|
* The hashtable should look like
|
2011-02-23 19:30:04 +00:00
|
|
|
* {GParamaSpec ---> element,}*/
|
2011-02-07 16:06:01 +00:00
|
|
|
GHashTable *properties_hashtable;
|
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
GESTimelineObject *timelineobj;
|
|
|
|
GESTrack *track;
|
|
|
|
|
|
|
|
gboolean valid;
|
|
|
|
|
2012-01-16 12:37:22 +00:00
|
|
|
guint64 maxduration;
|
|
|
|
|
2010-12-16 15:27:26 +00:00
|
|
|
gboolean locked; /* If TRUE, then moves in sync with its controlling
|
|
|
|
* GESTimelineObject */
|
2010-12-04 18:54:13 +00:00
|
|
|
};
|
|
|
|
|
2009-08-06 10:14:37 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_START,
|
|
|
|
PROP_INPOINT,
|
|
|
|
PROP_DURATION,
|
|
|
|
PROP_PRIORITY,
|
2010-12-16 17:20:47 +00:00
|
|
|
PROP_ACTIVE,
|
2011-12-19 10:21:18 +00:00
|
|
|
PROP_LOCKED,
|
2012-01-16 12:37:22 +00:00
|
|
|
PROP_MAX_DURATION,
|
2010-12-16 17:20:47 +00:00
|
|
|
PROP_LAST
|
2009-08-06 10:14:37 +00:00
|
|
|
};
|
|
|
|
|
2010-12-16 17:20:47 +00:00
|
|
|
static GParamSpec *properties[PROP_LAST];
|
|
|
|
|
2011-02-08 14:29:21 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
DEEP_NOTIFY,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
static guint ges_track_object_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
static GstElement *ges_track_object_create_gnl_object_func (GESTrackObject *
|
|
|
|
object);
|
2009-08-06 15:38:43 +00:00
|
|
|
|
2011-01-11 15:35:05 +00:00
|
|
|
static void gnlobject_start_cb (GstElement * gnlobject, GParamSpec * arg
|
2010-06-09 14:27:43 +00:00
|
|
|
G_GNUC_UNUSED, GESTrackObject * obj);
|
|
|
|
|
2011-01-11 15:35:05 +00:00
|
|
|
static void gnlobject_media_start_cb (GstElement * gnlobject, GParamSpec * arg
|
2010-06-09 14:27:43 +00:00
|
|
|
G_GNUC_UNUSED, GESTrackObject * obj);
|
|
|
|
|
2011-01-11 15:35:05 +00:00
|
|
|
static void gnlobject_priority_cb (GstElement * gnlobject, GParamSpec * arg
|
2010-06-09 14:27:43 +00:00
|
|
|
G_GNUC_UNUSED, GESTrackObject * obj);
|
|
|
|
|
2011-01-11 15:35:05 +00:00
|
|
|
static void gnlobject_duration_cb (GstElement * gnlobject, GParamSpec * arg
|
2010-06-09 14:27:43 +00:00
|
|
|
G_GNUC_UNUSED, GESTrackObject * obj);
|
|
|
|
|
2011-01-11 15:35:05 +00:00
|
|
|
static void gnlobject_active_cb (GstElement * gnlobject, GParamSpec * arg
|
2010-06-09 14:27:43 +00:00
|
|
|
G_GNUC_UNUSED, GESTrackObject * obj);
|
|
|
|
|
2011-02-08 14:29:21 +00:00
|
|
|
static void connect_properties_signals (GESTrackObject * object);
|
|
|
|
static void connect_signal (gpointer key, gpointer value, gpointer user_data);
|
|
|
|
static void gst_element_prop_changed_cb (GstElement * element, GParamSpec * arg
|
|
|
|
G_GNUC_UNUSED, GESTrackObject * obj);
|
|
|
|
|
2010-12-16 17:20:47 +00:00
|
|
|
static inline gboolean
|
|
|
|
ges_track_object_set_start_internal (GESTrackObject * object, guint64 start);
|
|
|
|
static inline gboolean
|
|
|
|
ges_track_object_set_inpoint_internal (GESTrackObject * object,
|
|
|
|
guint64 inpoint);
|
|
|
|
static inline gboolean ges_track_object_set_duration_internal (GESTrackObject *
|
|
|
|
object, guint64 duration);
|
|
|
|
static inline gboolean ges_track_object_set_priority_internal (GESTrackObject *
|
|
|
|
object, guint32 priority);
|
2011-12-19 10:21:18 +00:00
|
|
|
static inline void
|
|
|
|
ges_track_object_set_locked_internal (GESTrackObject * object, gboolean locked);
|
2010-07-08 16:51:38 +00:00
|
|
|
|
2011-05-06 17:41:16 +00:00
|
|
|
static GParamSpec **default_list_children_properties (GESTrackObject * object,
|
2011-02-25 16:10:00 +00:00
|
|
|
guint * n_properties);
|
|
|
|
|
2009-08-06 10:14:37 +00:00
|
|
|
static void
|
|
|
|
ges_track_object_get_property (GObject * object, guint property_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GESTrackObject *tobj = GES_TRACK_OBJECT (object);
|
|
|
|
|
|
|
|
switch (property_id) {
|
|
|
|
case PROP_START:
|
2011-02-03 14:11:54 +00:00
|
|
|
g_value_set_uint64 (value, ges_track_object_get_start (tobj));
|
2009-08-06 10:14:37 +00:00
|
|
|
break;
|
|
|
|
case PROP_INPOINT:
|
2011-02-03 14:11:54 +00:00
|
|
|
g_value_set_uint64 (value, ges_track_object_get_inpoint (tobj));
|
2009-08-06 10:14:37 +00:00
|
|
|
break;
|
|
|
|
case PROP_DURATION:
|
2011-02-03 14:11:54 +00:00
|
|
|
g_value_set_uint64 (value, ges_track_object_get_duration (tobj));
|
2009-08-06 10:14:37 +00:00
|
|
|
break;
|
|
|
|
case PROP_PRIORITY:
|
2011-02-03 14:11:54 +00:00
|
|
|
g_value_set_uint (value, ges_track_object_get_priority (tobj));
|
2010-07-08 17:01:46 +00:00
|
|
|
break;
|
2009-09-30 14:40:59 +00:00
|
|
|
case PROP_ACTIVE:
|
2011-02-03 14:11:54 +00:00
|
|
|
g_value_set_boolean (value, ges_track_object_is_active (tobj));
|
2009-09-30 14:40:59 +00:00
|
|
|
break;
|
2011-12-19 10:21:18 +00:00
|
|
|
case PROP_LOCKED:
|
|
|
|
g_value_set_boolean (value, ges_track_object_is_locked (tobj));
|
|
|
|
break;
|
2012-01-16 12:37:22 +00:00
|
|
|
case PROP_MAX_DURATION:
|
|
|
|
g_value_set_uint64 (value, tobj->priv->maxduration);
|
|
|
|
break;
|
2009-08-06 10:14:37 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ges_track_object_set_property (GObject * object, guint property_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GESTrackObject *tobj = GES_TRACK_OBJECT (object);
|
|
|
|
|
|
|
|
switch (property_id) {
|
|
|
|
case PROP_START:
|
|
|
|
ges_track_object_set_start_internal (tobj, g_value_get_uint64 (value));
|
|
|
|
break;
|
|
|
|
case PROP_INPOINT:
|
|
|
|
ges_track_object_set_inpoint_internal (tobj, g_value_get_uint64 (value));
|
|
|
|
break;
|
|
|
|
case PROP_DURATION:
|
|
|
|
ges_track_object_set_duration_internal (tobj, g_value_get_uint64 (value));
|
|
|
|
break;
|
|
|
|
case PROP_PRIORITY:
|
|
|
|
ges_track_object_set_priority_internal (tobj, g_value_get_uint (value));
|
|
|
|
break;
|
2009-09-30 14:40:59 +00:00
|
|
|
case PROP_ACTIVE:
|
|
|
|
ges_track_object_set_active (tobj, g_value_get_boolean (value));
|
|
|
|
break;
|
2011-12-19 10:21:18 +00:00
|
|
|
case PROP_LOCKED:
|
|
|
|
ges_track_object_set_locked_internal (tobj, g_value_get_boolean (value));
|
|
|
|
break;
|
2012-01-16 12:37:22 +00:00
|
|
|
case PROP_MAX_DURATION:
|
|
|
|
ges_track_object_set_max_duration (tobj, g_value_get_uint64 (value));
|
|
|
|
break;
|
2009-08-06 10:14:37 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ges_track_object_dispose (GObject * object)
|
|
|
|
{
|
2011-02-07 16:06:01 +00:00
|
|
|
GESTrackObjectPrivate *priv = GES_TRACK_OBJECT (object)->priv;
|
2012-05-10 16:40:23 +00:00
|
|
|
|
2011-02-07 16:06:01 +00:00
|
|
|
if (priv->properties_hashtable)
|
|
|
|
g_hash_table_destroy (priv->properties_hashtable);
|
|
|
|
|
2012-05-10 16:40:23 +00:00
|
|
|
if (priv->gnlobject) {
|
|
|
|
GstState cstate;
|
|
|
|
|
|
|
|
if (priv->track != NULL) {
|
|
|
|
GST_ERROR_OBJECT (object, "Still in %p, this means that you forgot"
|
|
|
|
" to remove it from the GESTrack it is contained in. You always need"
|
|
|
|
" to remove a GESTrackObject from its track before dropping the last"
|
|
|
|
" reference\n"
|
|
|
|
"This problem may also be caused by a refcounting bug in"
|
|
|
|
" the application or GES itself.", priv->track);
|
|
|
|
gst_element_get_state (priv->gnlobject, &cstate, NULL, 0);
|
|
|
|
if (cstate != GST_STATE_NULL)
|
|
|
|
gst_element_set_state (priv->gnlobject, GST_STATE_NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_object_unref (priv->gnlobject);
|
|
|
|
priv->gnlobject = NULL;
|
|
|
|
}
|
|
|
|
|
2009-08-06 10:14:37 +00:00
|
|
|
G_OBJECT_CLASS (ges_track_object_parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ges_track_object_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
G_OBJECT_CLASS (ges_track_object_parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ges_track_object_class_init (GESTrackObjectClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
2010-12-04 18:54:13 +00:00
|
|
|
g_type_class_add_private (klass, sizeof (GESTrackObjectPrivate));
|
|
|
|
|
2009-08-06 10:14:37 +00:00
|
|
|
object_class->get_property = ges_track_object_get_property;
|
|
|
|
object_class->set_property = ges_track_object_set_property;
|
|
|
|
object_class->dispose = ges_track_object_dispose;
|
|
|
|
object_class->finalize = ges_track_object_finalize;
|
|
|
|
|
2009-09-14 14:33:25 +00:00
|
|
|
/**
|
|
|
|
* GESTrackObject:start
|
|
|
|
*
|
|
|
|
* The position of the object in the container #GESTrack (in nanoseconds).
|
|
|
|
*/
|
2010-12-16 17:20:47 +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-06 10:14:37 +00:00
|
|
|
g_object_class_install_property (object_class, PROP_START,
|
2010-12-16 17:20:47 +00:00
|
|
|
properties[PROP_START]);
|
2009-09-14 14:33:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GESTrackObject:in-point
|
|
|
|
*
|
|
|
|
* The in-point at which this #GESTrackObject will start outputting data
|
|
|
|
* from its contents (in nanoseconds).
|
|
|
|
*
|
2011-08-13 22:52:23 +00:00
|
|
|
* Ex: an in-point of 5 seconds means that the first outputted buffer will
|
2009-09-14 14:33:25 +00:00
|
|
|
* be the one located 5 seconds in the controlled resource.
|
|
|
|
*/
|
2010-12-16 17:20:47 +00:00
|
|
|
properties[PROP_INPOINT] =
|
2009-09-14 14:33:25 +00:00
|
|
|
g_param_spec_uint64 ("in-point", "In-point", "The in-point", 0,
|
2010-12-16 17:20:47 +00:00
|
|
|
G_MAXUINT64, 0, G_PARAM_READWRITE);
|
|
|
|
g_object_class_install_property (object_class, PROP_INPOINT,
|
|
|
|
properties[PROP_INPOINT]);
|
2009-09-14 14:33:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GESTrackObject:duration
|
|
|
|
*
|
|
|
|
* The duration (in nanoseconds) which will be used in the container #GESTrack
|
|
|
|
* starting from 'in-point'.
|
|
|
|
*
|
|
|
|
*/
|
2010-12-16 17:20:47 +00:00
|
|
|
properties[PROP_DURATION] =
|
|
|
|
g_param_spec_uint64 ("duration", "Duration", "The duration to use", 0,
|
|
|
|
G_MAXUINT64, GST_SECOND, G_PARAM_READWRITE);
|
2009-08-06 10:14:37 +00:00
|
|
|
g_object_class_install_property (object_class, PROP_DURATION,
|
2010-12-16 17:20:47 +00:00
|
|
|
properties[PROP_DURATION]);
|
2009-09-14 14:33:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GESTrackObject:priority
|
|
|
|
*
|
|
|
|
* The priority of the object within the containing #GESTrack.
|
|
|
|
* If two objects intersect over the same region of time, the @priority
|
|
|
|
* property is used to decide which one takes precedence.
|
|
|
|
*
|
|
|
|
* The highest priority (that supercedes everything) is 0, and then lowering
|
|
|
|
* priorities go in increasing numerical value (with #G_MAXUINT64 being the
|
|
|
|
* lowest priority).
|
|
|
|
*/
|
2010-12-16 17:20:47 +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-06 10:14:37 +00:00
|
|
|
g_object_class_install_property (object_class, PROP_PRIORITY,
|
2010-12-16 17:20:47 +00:00
|
|
|
properties[PROP_PRIORITY]);
|
2009-08-06 15:38:43 +00:00
|
|
|
|
2009-09-30 14:40:59 +00:00
|
|
|
/**
|
|
|
|
* GESTrackObject:active
|
|
|
|
*
|
2010-07-01 14:48:45 +00:00
|
|
|
* Whether the object should be taken into account in the #GESTrack output.
|
2009-09-30 14:40:59 +00:00
|
|
|
* If #FALSE, then its contents will not be used in the resulting track.
|
|
|
|
*/
|
2010-12-16 17:20:47 +00:00
|
|
|
properties[PROP_ACTIVE] =
|
|
|
|
g_param_spec_boolean ("active", "Active", "Use object in output", TRUE,
|
|
|
|
G_PARAM_READWRITE);
|
2009-09-30 14:40:59 +00:00
|
|
|
g_object_class_install_property (object_class, PROP_ACTIVE,
|
2010-12-16 17:20:47 +00:00
|
|
|
properties[PROP_ACTIVE]);
|
2009-09-30 14:40:59 +00:00
|
|
|
|
2011-12-19 10:21:18 +00:00
|
|
|
/**
|
|
|
|
* GESTrackObject:locked
|
|
|
|
*
|
|
|
|
* If %TRUE, then moves in sync with its controlling #GESTimelineObject
|
|
|
|
*/
|
|
|
|
properties[PROP_LOCKED] =
|
|
|
|
g_param_spec_boolean ("locked", "Locked",
|
|
|
|
"Moves in sync with its controling TimelineObject", TRUE,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
g_object_class_install_property (object_class, PROP_LOCKED,
|
|
|
|
properties[PROP_LOCKED]);
|
|
|
|
|
2012-01-16 12:37:22 +00:00
|
|
|
/**
|
|
|
|
* GESTrackObject:max-duration:
|
|
|
|
*
|
|
|
|
* The maximum duration (in nanoseconds) of the #GESTrackObject.
|
|
|
|
*
|
|
|
|
* 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,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
2012-01-16 12:37:22 +00:00
|
|
|
|
2011-02-08 14:29:21 +00:00
|
|
|
/**
|
|
|
|
* GESTrackObject::deep-notify:
|
|
|
|
* @track_object: a #GESTrackObject
|
|
|
|
* @prop_object: the object that originated the signal
|
|
|
|
* @prop: the property that changed
|
|
|
|
*
|
|
|
|
* The deep notify signal is used to be notified of property changes of all
|
|
|
|
* the childs of @track_object
|
2011-08-13 22:52:23 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
2011-02-08 14:29:21 +00:00
|
|
|
*/
|
|
|
|
ges_track_object_signals[DEEP_NOTIFY] =
|
|
|
|
g_signal_new ("deep-notify", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE | G_SIGNAL_DETAILED |
|
|
|
|
G_SIGNAL_NO_HOOKS, 0, NULL, NULL, gst_marshal_VOID__OBJECT_PARAM,
|
|
|
|
G_TYPE_NONE, 2, GST_TYPE_ELEMENT, G_TYPE_PARAM);
|
|
|
|
|
2009-08-06 15:38:43 +00:00
|
|
|
klass->create_gnl_object = ges_track_object_create_gnl_object_func;
|
2011-05-06 17:38:26 +00:00
|
|
|
/* There is no 'get_props_hashtable' default implementation */
|
2011-02-16 14:51:20 +00:00
|
|
|
klass->get_props_hastable = NULL;
|
2011-02-25 16:10:00 +00:00
|
|
|
klass->list_children_properties = default_list_children_properties;
|
2009-08-06 10:14:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ges_track_object_init (GESTrackObject * self)
|
|
|
|
{
|
2012-04-24 00:17:42 +00:00
|
|
|
GESTrackObjectPrivate *priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
2010-12-04 18:54:13 +00:00
|
|
|
GES_TYPE_TRACK_OBJECT, GESTrackObjectPrivate);
|
|
|
|
|
2009-09-30 14:42:08 +00:00
|
|
|
/* Sane default values */
|
2012-04-24 00:17:42 +00:00
|
|
|
priv->pending_start = 0;
|
|
|
|
priv->pending_inpoint = 0;
|
|
|
|
priv->pending_duration = GST_SECOND;
|
|
|
|
priv->pending_priority = 1;
|
|
|
|
priv->pending_active = TRUE;
|
|
|
|
priv->locked = TRUE;
|
|
|
|
priv->properties_hashtable = NULL;
|
|
|
|
priv->maxduration = GST_CLOCK_TIME_NONE;
|
2009-08-06 10:14:37 +00:00
|
|
|
}
|
|
|
|
|
2010-12-16 17:20:47 +00:00
|
|
|
static inline gboolean
|
2009-08-06 10:14:37 +00:00
|
|
|
ges_track_object_set_start_internal (GESTrackObject * object, guint64 start)
|
|
|
|
{
|
2009-08-07 18:33:40 +00:00
|
|
|
GST_DEBUG ("object:%p, start:%" GST_TIME_FORMAT,
|
|
|
|
object, GST_TIME_ARGS (start));
|
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
if (object->priv->gnlobject != NULL) {
|
2009-12-11 14:13:19 +00:00
|
|
|
if (G_UNLIKELY (start == object->start))
|
|
|
|
return FALSE;
|
2009-08-06 10:14:37 +00:00
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
g_object_set (object->priv->gnlobject, "start", start, NULL);
|
2009-12-11 14:13:19 +00:00
|
|
|
} else
|
2010-12-16 14:00:46 +00:00
|
|
|
object->priv->pending_start = start;
|
2009-08-06 10:14:37 +00:00
|
|
|
return TRUE;
|
|
|
|
};
|
|
|
|
|
2010-12-16 17:20:47 +00:00
|
|
|
/**
|
|
|
|
* ges_track_object_set_start:
|
|
|
|
* @object: a #GESTrackObject
|
|
|
|
* @start: the start position (in #GstClockTime)
|
|
|
|
*
|
|
|
|
* Sets the position of the object in the container #GESTrack.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ges_track_object_set_start (GESTrackObject * object, guint64 start)
|
|
|
|
{
|
2012-04-23 23:20:18 +00:00
|
|
|
g_return_if_fail (GES_IS_TRACK_OBJECT (object));
|
|
|
|
|
2010-12-16 17:20:47 +00:00
|
|
|
if (ges_track_object_set_start_internal (object, start))
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_START]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline gboolean
|
2009-08-06 10:14:37 +00:00
|
|
|
ges_track_object_set_inpoint_internal (GESTrackObject * object, guint64 inpoint)
|
|
|
|
{
|
|
|
|
|
2009-08-07 18:33:40 +00:00
|
|
|
GST_DEBUG ("object:%p, inpoint:%" GST_TIME_FORMAT,
|
|
|
|
object, GST_TIME_ARGS (inpoint));
|
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
if (object->priv->gnlobject != NULL) {
|
2009-12-11 14:13:19 +00:00
|
|
|
if (G_UNLIKELY (inpoint == object->inpoint))
|
|
|
|
return FALSE;
|
2009-08-06 10:14:37 +00:00
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
g_object_set (object->priv->gnlobject, "media-start", inpoint, NULL);
|
2009-12-11 14:13:19 +00:00
|
|
|
} else
|
2010-12-16 14:00:46 +00:00
|
|
|
object->priv->pending_inpoint = inpoint;
|
2009-08-06 10:14:37 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-12-16 17:20:47 +00:00
|
|
|
/**
|
|
|
|
* ges_track_object_set_inpoint:
|
|
|
|
* @object: a #GESTrackObject
|
|
|
|
* @inpoint: the in-point (in #GstClockTime)
|
|
|
|
*
|
|
|
|
* Set the offset within the contents of this #GESTrackObject
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ges_track_object_set_inpoint (GESTrackObject * object, guint64 inpoint)
|
|
|
|
{
|
2012-04-23 23:20:18 +00:00
|
|
|
g_return_if_fail (GES_IS_TRACK_OBJECT (object));
|
|
|
|
|
2010-12-16 17:20:47 +00:00
|
|
|
if (ges_track_object_set_inpoint_internal (object, inpoint))
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_INPOINT]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline gboolean
|
2009-08-06 10:14:37 +00:00
|
|
|
ges_track_object_set_duration_internal (GESTrackObject * object,
|
|
|
|
guint64 duration)
|
|
|
|
{
|
2012-04-24 00:17:42 +00:00
|
|
|
GESTrackObjectPrivate *priv = object->priv;
|
|
|
|
|
2009-08-07 18:33:40 +00:00
|
|
|
GST_DEBUG ("object:%p, duration:%" GST_TIME_FORMAT,
|
|
|
|
object, GST_TIME_ARGS (duration));
|
|
|
|
|
2012-04-24 00:17:42 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (priv->maxduration) &&
|
|
|
|
duration > object->inpoint + priv->maxduration)
|
|
|
|
duration = priv->maxduration - object->inpoint;
|
|
|
|
|
|
|
|
if (priv->gnlobject != NULL) {
|
2009-12-11 14:13:19 +00:00
|
|
|
if (G_UNLIKELY (duration == object->duration))
|
|
|
|
return FALSE;
|
2009-08-06 10:14:37 +00:00
|
|
|
|
2012-04-24 00:17:42 +00:00
|
|
|
g_object_set (priv->gnlobject, "duration", duration,
|
2010-12-16 14:00:46 +00:00
|
|
|
"media-duration", duration, NULL);
|
2009-12-11 14:13:19 +00:00
|
|
|
} else
|
2012-04-24 00:17:42 +00:00
|
|
|
priv->pending_duration = duration;
|
|
|
|
|
2009-08-06 10:14:37 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-12-16 17:20:47 +00:00
|
|
|
/**
|
|
|
|
* ges_track_object_set_duration:
|
|
|
|
* @object: a #GESTrackObject
|
|
|
|
* @duration: the duration (in #GstClockTime)
|
|
|
|
*
|
|
|
|
* Set the duration which will be used in the container #GESTrack
|
|
|
|
* starting from the 'in-point'
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ges_track_object_set_duration (GESTrackObject * object, guint64 duration)
|
|
|
|
{
|
2012-04-23 23:20:18 +00:00
|
|
|
g_return_if_fail (GES_IS_TRACK_OBJECT (object));
|
|
|
|
|
2010-12-16 17:20:47 +00:00
|
|
|
if (ges_track_object_set_duration_internal (object, duration))
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_DURATION]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline gboolean
|
2009-08-06 10:14:37 +00:00
|
|
|
ges_track_object_set_priority_internal (GESTrackObject * object,
|
|
|
|
guint32 priority)
|
|
|
|
{
|
2011-03-01 16:38:52 +00:00
|
|
|
GST_DEBUG ("object:%p, priority:%" G_GUINT32_FORMAT, object, priority);
|
2010-12-16 17:20:47 +00:00
|
|
|
|
2010-12-16 18:24:25 +00:00
|
|
|
if (object->priv->gnlobject != NULL) {
|
|
|
|
if (G_UNLIKELY (priority == object->priority))
|
|
|
|
return FALSE;
|
2009-08-07 18:33:40 +00:00
|
|
|
|
2010-12-16 18:24:25 +00:00
|
|
|
g_object_set (object->priv->gnlobject, "priority", priority, NULL);
|
|
|
|
} else
|
|
|
|
object->priv->pending_priority = priority;
|
2010-07-08 16:51:38 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-12-16 17:20:47 +00:00
|
|
|
/**
|
|
|
|
* ges_track_object_set_priority:
|
|
|
|
* @object: a #GESTrackObject
|
|
|
|
* @priority: the priority
|
|
|
|
*
|
|
|
|
* Sets the priority of the object withing the containing #GESTrack.
|
|
|
|
* If two objects intersect over the same region of time, the priority
|
|
|
|
* property is used to decide which one takes precedence.
|
|
|
|
*
|
|
|
|
* The highest priority (that supercedes everything) is 0, and then
|
|
|
|
* lowering priorities go in increasing numerical value (with G_MAXUINT32
|
|
|
|
* being the lowest priority).
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ges_track_object_set_priority (GESTrackObject * object, guint32 priority)
|
|
|
|
{
|
|
|
|
if (ges_track_object_set_priority_internal (object, priority))
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_PRIORITY]);
|
|
|
|
}
|
|
|
|
|
2009-08-06 15:38:43 +00:00
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
/**
|
|
|
|
* ges_track_object_set_active:
|
|
|
|
* @object: a #GESTrackObject
|
|
|
|
* @active: visibility
|
|
|
|
*
|
|
|
|
* Sets the usage of the @object. If @active is %TRUE, the object will be used for
|
|
|
|
* playback and rendering, else it will be ignored.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the property was toggled, else %FALSE
|
|
|
|
*/
|
2009-09-30 14:40:59 +00:00
|
|
|
gboolean
|
|
|
|
ges_track_object_set_active (GESTrackObject * object, gboolean active)
|
|
|
|
{
|
2012-04-23 23:20:18 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), FALSE);
|
|
|
|
|
2009-09-30 14:40:59 +00:00
|
|
|
GST_DEBUG ("object:%p, active:%d", object, active);
|
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
if (object->priv->gnlobject != NULL) {
|
2009-12-11 14:13:19 +00:00
|
|
|
if (G_UNLIKELY (active == object->active))
|
|
|
|
return FALSE;
|
2009-09-30 14:40:59 +00:00
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
g_object_set (object->priv->gnlobject, "active", active, NULL);
|
2009-12-11 14:13:19 +00:00
|
|
|
} else
|
2010-12-16 14:00:46 +00:00
|
|
|
object->priv->pending_active = active;
|
2009-09-30 14:40:59 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2009-09-30 14:43:12 +00:00
|
|
|
/* Callbacks from the GNonLin object */
|
2011-01-11 15:35:05 +00:00
|
|
|
static void
|
2009-09-30 14:43:12 +00:00
|
|
|
gnlobject_start_cb (GstElement * gnlobject, GParamSpec * arg G_GNUC_UNUSED,
|
|
|
|
GESTrackObject * obj)
|
|
|
|
{
|
|
|
|
guint64 start;
|
2010-07-08 10:35:41 +00:00
|
|
|
GESTrackObjectClass *klass;
|
|
|
|
|
|
|
|
klass = GES_TRACK_OBJECT_GET_CLASS (obj);
|
|
|
|
|
2009-09-30 14:43:12 +00:00
|
|
|
g_object_get (gnlobject, "start", &start, NULL);
|
|
|
|
|
|
|
|
GST_DEBUG ("gnlobject start : %" GST_TIME_FORMAT " current : %"
|
|
|
|
GST_TIME_FORMAT, GST_TIME_ARGS (start), GST_TIME_ARGS (obj->start));
|
|
|
|
|
|
|
|
if (start != obj->start) {
|
|
|
|
obj->start = start;
|
2010-07-08 10:35:41 +00:00
|
|
|
if (klass->start_changed)
|
|
|
|
klass->start_changed (obj, start);
|
2009-09-30 14:43:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-08 14:29:21 +00:00
|
|
|
static void
|
|
|
|
gst_element_prop_changed_cb (GstElement * element, GParamSpec * arg
|
|
|
|
G_GNUC_UNUSED, GESTrackObject * obj)
|
|
|
|
{
|
|
|
|
g_signal_emit (obj, ges_track_object_signals[DEEP_NOTIFY], 0,
|
|
|
|
GST_ELEMENT (element), arg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
connect_signal (gpointer key, gpointer value, gpointer user_data)
|
|
|
|
{
|
2011-03-16 20:23:53 +00:00
|
|
|
gchar *signame = g_strconcat ("notify::", G_PARAM_SPEC (key)->name, NULL);
|
2011-02-08 14:29:21 +00:00
|
|
|
|
|
|
|
g_signal_connect (G_OBJECT (value),
|
|
|
|
signame, G_CALLBACK (gst_element_prop_changed_cb),
|
|
|
|
GES_TRACK_OBJECT (user_data));
|
|
|
|
|
|
|
|
g_free (signame);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
connect_properties_signals (GESTrackObject * object)
|
|
|
|
{
|
2011-02-25 09:54:55 +00:00
|
|
|
if (G_UNLIKELY (!object->priv->properties_hashtable)) {
|
2011-02-08 14:29:21 +00:00
|
|
|
GST_WARNING ("The properties_hashtable hasn't been set");
|
2011-02-25 09:54:55 +00:00
|
|
|
return;
|
2011-02-08 14:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_hash_table_foreach (object->priv->properties_hashtable,
|
|
|
|
(GHFunc) connect_signal, object);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-09-30 14:43:12 +00:00
|
|
|
/* Callbacks from the GNonLin object */
|
2011-01-11 15:35:05 +00:00
|
|
|
static void
|
2009-09-30 14:43:12 +00:00
|
|
|
gnlobject_media_start_cb (GstElement * gnlobject,
|
|
|
|
GParamSpec * arg G_GNUC_UNUSED, GESTrackObject * obj)
|
|
|
|
{
|
|
|
|
guint64 start;
|
2010-07-08 10:35:41 +00:00
|
|
|
GESTrackObjectClass *klass;
|
|
|
|
|
|
|
|
klass = GES_TRACK_OBJECT_GET_CLASS (obj);
|
|
|
|
|
2009-09-30 14:43:12 +00:00
|
|
|
g_object_get (gnlobject, "media-start", &start, NULL);
|
|
|
|
|
|
|
|
GST_DEBUG ("gnlobject in-point : %" GST_TIME_FORMAT " current : %"
|
|
|
|
GST_TIME_FORMAT, GST_TIME_ARGS (start), GST_TIME_ARGS (obj->inpoint));
|
|
|
|
|
|
|
|
if (start != obj->inpoint) {
|
|
|
|
obj->inpoint = start;
|
2010-07-08 10:35:41 +00:00
|
|
|
if (klass->media_start_changed)
|
|
|
|
klass->media_start_changed (obj, start);
|
2009-09-30 14:43:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-11 15:35:05 +00:00
|
|
|
static void
|
2009-09-30 14:43:12 +00:00
|
|
|
gnlobject_priority_cb (GstElement * gnlobject, GParamSpec * arg G_GNUC_UNUSED,
|
|
|
|
GESTrackObject * obj)
|
|
|
|
{
|
2009-11-25 12:11:32 +00:00
|
|
|
guint32 priority;
|
2010-07-08 10:35:41 +00:00
|
|
|
GESTrackObjectClass *klass;
|
|
|
|
|
|
|
|
klass = GES_TRACK_OBJECT_GET_CLASS (obj);
|
|
|
|
|
2009-09-30 14:43:12 +00:00
|
|
|
g_object_get (gnlobject, "priority", &priority, NULL);
|
|
|
|
|
2010-12-16 18:24:25 +00:00
|
|
|
GST_DEBUG ("gnlobject priority : %d current : %d", priority, obj->priority);
|
2009-09-30 14:43:12 +00:00
|
|
|
|
2010-12-16 18:24:25 +00:00
|
|
|
if (priority != obj->priority) {
|
|
|
|
obj->priority = priority;
|
2010-07-08 16:51:38 +00:00
|
|
|
if (klass->gnl_priority_changed)
|
|
|
|
klass->gnl_priority_changed (obj, priority);
|
2009-09-30 14:43:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-11 15:35:05 +00:00
|
|
|
static void
|
2009-09-30 14:43:12 +00:00
|
|
|
gnlobject_duration_cb (GstElement * gnlobject, GParamSpec * arg G_GNUC_UNUSED,
|
|
|
|
GESTrackObject * obj)
|
|
|
|
{
|
|
|
|
guint64 duration;
|
2010-07-08 10:35:41 +00:00
|
|
|
GESTrackObjectClass *klass;
|
|
|
|
|
|
|
|
klass = GES_TRACK_OBJECT_GET_CLASS (obj);
|
|
|
|
|
2009-09-30 14:43:12 +00:00
|
|
|
g_object_get (gnlobject, "duration", &duration, NULL);
|
|
|
|
|
2012-04-23 23:20:18 +00:00
|
|
|
GST_DEBUG_OBJECT (gnlobject, "duration : %" GST_TIME_FORMAT " current : %"
|
2009-09-30 14:43:12 +00:00
|
|
|
GST_TIME_FORMAT, GST_TIME_ARGS (duration), GST_TIME_ARGS (obj->duration));
|
|
|
|
|
|
|
|
if (duration != obj->duration) {
|
|
|
|
obj->duration = duration;
|
2010-07-08 10:35:41 +00:00
|
|
|
if (klass->duration_changed)
|
|
|
|
klass->duration_changed (obj, duration);
|
2009-09-30 14:43:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-11 15:35:05 +00:00
|
|
|
static void
|
2009-09-30 14:43:12 +00:00
|
|
|
gnlobject_active_cb (GstElement * gnlobject, GParamSpec * arg G_GNUC_UNUSED,
|
|
|
|
GESTrackObject * obj)
|
|
|
|
{
|
|
|
|
gboolean active;
|
2010-07-08 10:35:41 +00:00
|
|
|
GESTrackObjectClass *klass;
|
|
|
|
|
|
|
|
klass = GES_TRACK_OBJECT_GET_CLASS (obj);
|
|
|
|
|
2009-09-30 14:43:12 +00:00
|
|
|
g_object_get (gnlobject, "active", &active, NULL);
|
|
|
|
|
|
|
|
GST_DEBUG ("gnlobject active : %d current : %d", active, obj->active);
|
|
|
|
|
|
|
|
if (active != obj->active) {
|
|
|
|
obj->active = active;
|
2010-07-08 10:35:41 +00:00
|
|
|
if (klass->active_changed)
|
|
|
|
klass->active_changed (obj, active);
|
2009-09-30 14:43:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-06 15:38:43 +00:00
|
|
|
/* default 'create_gnl_object' virtual method implementation */
|
2010-12-16 14:00:46 +00:00
|
|
|
static GstElement *
|
2010-12-10 11:15:54 +00:00
|
|
|
ges_track_object_create_gnl_object_func (GESTrackObject * self)
|
2009-08-06 15:38:43 +00:00
|
|
|
{
|
2010-12-10 11:15:54 +00:00
|
|
|
GESTrackObjectClass *klass = NULL;
|
|
|
|
GstElement *child = NULL;
|
|
|
|
GstElement *gnlobject;
|
2009-08-06 15:38:43 +00:00
|
|
|
|
2010-12-10 11:15:54 +00:00
|
|
|
klass = GES_TRACK_OBJECT_GET_CLASS (self);
|
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
if (G_UNLIKELY (self->priv->gnlobject != NULL))
|
2010-12-10 11:15:54 +00:00
|
|
|
goto already_have_gnlobject;
|
|
|
|
|
|
|
|
if (G_UNLIKELY (klass->gnlobject_factorytype == NULL))
|
|
|
|
goto no_gnlfactory;
|
|
|
|
|
|
|
|
GST_DEBUG ("Creating a supporting gnlobject of type '%s'",
|
|
|
|
klass->gnlobject_factorytype);
|
|
|
|
|
|
|
|
gnlobject = gst_element_factory_make (klass->gnlobject_factorytype, NULL);
|
|
|
|
|
|
|
|
if (G_UNLIKELY (gnlobject == NULL))
|
|
|
|
goto no_gnlobject;
|
|
|
|
|
|
|
|
if (klass->create_element) {
|
|
|
|
GST_DEBUG ("Calling subclass 'create_element' vmethod");
|
|
|
|
child = klass->create_element (self);
|
|
|
|
|
|
|
|
if (G_UNLIKELY (!child))
|
|
|
|
goto child_failure;
|
|
|
|
|
|
|
|
if (!gst_bin_add (GST_BIN (gnlobject), child))
|
|
|
|
goto add_failure;
|
|
|
|
|
|
|
|
GST_DEBUG ("Succesfully got the element to put in the gnlobject");
|
2010-12-16 14:00:46 +00:00
|
|
|
self->priv->element = child;
|
2010-12-10 11:15:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG ("done");
|
2010-12-16 14:00:46 +00:00
|
|
|
return gnlobject;
|
2010-12-10 11:15:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* ERROR CASES */
|
|
|
|
|
|
|
|
already_have_gnlobject:
|
|
|
|
{
|
|
|
|
GST_ERROR ("Already controlling a GnlObject %s",
|
2010-12-16 14:00:46 +00:00
|
|
|
GST_ELEMENT_NAME (self->priv->gnlobject));
|
|
|
|
return NULL;
|
2010-12-10 11:15:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
no_gnlfactory:
|
|
|
|
{
|
|
|
|
GST_ERROR ("No GESTrackObject::gnlobject_factorytype implementation!");
|
2010-12-16 14:00:46 +00:00
|
|
|
return NULL;
|
2010-12-10 11:15:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
no_gnlobject:
|
|
|
|
{
|
|
|
|
GST_ERROR ("Error creating a gnlobject of type '%s'",
|
|
|
|
klass->gnlobject_factorytype);
|
2010-12-16 14:00:46 +00:00
|
|
|
return NULL;
|
2010-12-10 11:15:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
child_failure:
|
|
|
|
{
|
|
|
|
GST_ERROR ("create_element returned NULL");
|
|
|
|
gst_object_unref (gnlobject);
|
2010-12-16 14:00:46 +00:00
|
|
|
return NULL;
|
2010-12-10 11:15:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
add_failure:
|
|
|
|
{
|
|
|
|
GST_ERROR ("Error adding the contents to the gnlobject");
|
|
|
|
gst_object_unref (child);
|
|
|
|
gst_object_unref (gnlobject);
|
2010-12-16 14:00:46 +00:00
|
|
|
return NULL;
|
2010-12-10 11:15:54 +00:00
|
|
|
}
|
2009-08-06 15:38:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
ensure_gnl_object (GESTrackObject * object)
|
|
|
|
{
|
|
|
|
GESTrackObjectClass *class;
|
2010-12-16 14:00:46 +00:00
|
|
|
GstElement *gnlobject;
|
2011-02-07 16:06:01 +00:00
|
|
|
GHashTable *props_hash;
|
2012-01-26 10:53:54 +00:00
|
|
|
gboolean res = TRUE;
|
2009-08-06 15:38:43 +00:00
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
if (object->priv->gnlobject && object->priv->valid)
|
|
|
|
return FALSE;
|
2009-08-06 15:38:43 +00:00
|
|
|
|
2009-08-07 14:43:01 +00:00
|
|
|
/* 1. Create the GnlObject */
|
|
|
|
GST_DEBUG ("Creating GnlObject");
|
|
|
|
|
2009-08-06 15:38:43 +00:00
|
|
|
class = GES_TRACK_OBJECT_GET_CLASS (object);
|
|
|
|
|
|
|
|
if (G_UNLIKELY (class->create_gnl_object == NULL)) {
|
|
|
|
GST_ERROR ("No 'create_gnl_object' implementation !");
|
2011-01-10 14:10:01 +00:00
|
|
|
goto done;
|
2009-08-06 15:38:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG ("Calling virtual method");
|
|
|
|
|
2012-04-17 22:42:41 +00:00
|
|
|
/* 2. Fill in the GnlObject */
|
|
|
|
if (object->priv->gnlobject == NULL) {
|
2009-08-06 15:38:43 +00:00
|
|
|
|
2012-04-17 22:42:41 +00:00
|
|
|
/* call the create_gnl_object virtual method */
|
|
|
|
gnlobject = class->create_gnl_object (object);
|
2009-08-06 15:38:43 +00:00
|
|
|
|
2012-04-17 22:42:41 +00:00
|
|
|
if (G_UNLIKELY (gnlobject == NULL)) {
|
|
|
|
GST_ERROR
|
|
|
|
("'create_gnl_object' implementation returned TRUE but no GnlObject is available");
|
|
|
|
goto done;
|
|
|
|
}
|
2010-12-16 14:00:46 +00:00
|
|
|
|
2012-04-17 22:42:41 +00:00
|
|
|
GST_DEBUG_OBJECT (object, "Got a valid GnlObject, now filling it in");
|
|
|
|
|
2012-05-10 16:40:23 +00:00
|
|
|
object->priv->gnlobject = gst_object_ref (gnlobject);
|
2009-08-06 15:38:43 +00:00
|
|
|
|
2012-01-26 10:53:54 +00:00
|
|
|
if (object->priv->timelineobj)
|
|
|
|
res = ges_timeline_object_fill_track_object (object->priv->timelineobj,
|
|
|
|
object, object->priv->gnlobject);
|
|
|
|
else
|
|
|
|
res = TRUE;
|
|
|
|
|
2009-08-07 16:18:42 +00:00
|
|
|
if (res) {
|
2011-01-10 14:10:01 +00:00
|
|
|
/* Connect to property notifications */
|
|
|
|
/* FIXME : remember the signalids so we can remove them later on !!! */
|
|
|
|
g_signal_connect (G_OBJECT (object->priv->gnlobject), "notify::start",
|
|
|
|
G_CALLBACK (gnlobject_start_cb), object);
|
|
|
|
g_signal_connect (G_OBJECT (object->priv->gnlobject),
|
|
|
|
"notify::media-start", G_CALLBACK (gnlobject_media_start_cb), object);
|
|
|
|
g_signal_connect (G_OBJECT (object->priv->gnlobject), "notify::duration",
|
|
|
|
G_CALLBACK (gnlobject_duration_cb), object);
|
|
|
|
g_signal_connect (G_OBJECT (object->priv->gnlobject), "notify::priority",
|
|
|
|
G_CALLBACK (gnlobject_priority_cb), object);
|
|
|
|
g_signal_connect (G_OBJECT (object->priv->gnlobject), "notify::active",
|
|
|
|
G_CALLBACK (gnlobject_active_cb), object);
|
|
|
|
|
2009-08-07 16:18:42 +00:00
|
|
|
/* Set some properties on the GnlObject */
|
2010-12-16 14:00:46 +00:00
|
|
|
g_object_set (object->priv->gnlobject,
|
|
|
|
"duration", object->priv->pending_duration,
|
|
|
|
"media-duration", object->priv->pending_duration,
|
|
|
|
"start", object->priv->pending_start,
|
|
|
|
"media-start", object->priv->pending_inpoint,
|
2010-12-16 18:24:25 +00:00
|
|
|
"priority", object->priv->pending_priority,
|
2010-12-16 14:00:46 +00:00
|
|
|
"active", object->priv->pending_active, NULL);
|
2009-12-11 14:13:19 +00:00
|
|
|
|
2012-04-17 22:42:41 +00:00
|
|
|
if (object->priv->track != NULL)
|
|
|
|
g_object_set (object->priv->gnlobject,
|
|
|
|
"caps", ges_track_get_caps (object->priv->track), NULL);
|
|
|
|
|
2011-02-07 16:06:01 +00:00
|
|
|
/* We feed up the props_hashtable if possible */
|
|
|
|
if (class->get_props_hastable) {
|
|
|
|
props_hash = class->get_props_hastable (object);
|
|
|
|
|
|
|
|
if (props_hash == NULL) {
|
2011-05-06 09:56:30 +00:00
|
|
|
GST_DEBUG ("'get_props_hastable' implementation returned TRUE but no"
|
|
|
|
"properties_hashtable is available");
|
2011-02-07 16:06:01 +00:00
|
|
|
} else {
|
|
|
|
object->priv->properties_hashtable = props_hash;
|
2011-02-08 14:29:21 +00:00
|
|
|
connect_properties_signals (object);
|
2011-02-07 16:06:01 +00:00
|
|
|
}
|
|
|
|
}
|
2009-08-07 16:18:42 +00:00
|
|
|
}
|
2009-08-06 15:38:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-10 14:10:01 +00:00
|
|
|
done:
|
2010-12-16 14:00:46 +00:00
|
|
|
object->priv->valid = res;
|
2009-08-07 14:43:01 +00:00
|
|
|
|
2009-08-06 15:38:43 +00:00
|
|
|
GST_DEBUG ("Returning res:%d", res);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
/* INTERNAL USAGE */
|
2009-08-07 14:43:01 +00:00
|
|
|
gboolean
|
2009-08-06 15:38:43 +00:00
|
|
|
ges_track_object_set_track (GESTrackObject * object, GESTrack * track)
|
|
|
|
{
|
|
|
|
GST_DEBUG ("object:%p, track:%p", object, track);
|
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
object->priv->track = track;
|
2009-08-06 15:38:43 +00:00
|
|
|
|
2012-04-17 22:42:41 +00:00
|
|
|
if (object->priv->track) {
|
|
|
|
/* If we already have a gnlobject, we just set its caps properly */
|
|
|
|
if (object->priv->gnlobject) {
|
|
|
|
g_object_set (object->priv->gnlobject,
|
|
|
|
"caps", ges_track_get_caps (object->priv->track), NULL);
|
|
|
|
return TRUE;
|
|
|
|
} else {
|
|
|
|
return ensure_gnl_object (object);
|
|
|
|
}
|
|
|
|
}
|
2009-08-07 14:43:01 +00:00
|
|
|
|
|
|
|
return TRUE;
|
2009-08-06 15:38:43 +00:00
|
|
|
}
|
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
/**
|
|
|
|
* ges_track_object_get_track:
|
|
|
|
* @object: a #GESTrackObject
|
|
|
|
*
|
2011-02-25 09:54:55 +00:00
|
|
|
* Get the #GESTrack to which this object belongs.
|
2011-01-10 13:28:35 +00:00
|
|
|
*
|
2010-12-16 14:00:46 +00:00
|
|
|
* Returns: (transfer none): The #GESTrack to which this object belongs. Can be %NULL if it
|
|
|
|
* is not in any track
|
|
|
|
*/
|
|
|
|
GESTrack *
|
|
|
|
ges_track_object_get_track (GESTrackObject * object)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), NULL);
|
|
|
|
|
|
|
|
return object->priv->track;
|
|
|
|
}
|
|
|
|
|
2012-04-05 00:47:04 +00:00
|
|
|
/**
|
|
|
|
* ges_track_object_set_timeline_object:
|
|
|
|
* @object: The #GESTrackObject to set the parent to
|
2012-01-30 21:55:59 +00:00
|
|
|
* @tlobject: The #GESTimelineObject, parent of @tlobj or %NULL
|
2012-04-05 00:47:04 +00:00
|
|
|
*
|
|
|
|
* Set the #GESTimelineObject to which @object belongs.
|
|
|
|
*/
|
2009-08-06 15:38:43 +00:00
|
|
|
void
|
|
|
|
ges_track_object_set_timeline_object (GESTrackObject * object,
|
2012-01-30 21:55:59 +00:00
|
|
|
GESTimelineObject * tlobject)
|
2009-08-06 15:38:43 +00:00
|
|
|
{
|
2012-01-30 21:55:59 +00:00
|
|
|
GST_DEBUG ("object:%p, timeline-object:%p", object, tlobject);
|
2009-08-06 15:38:43 +00:00
|
|
|
|
2012-01-30 21:55:59 +00:00
|
|
|
object->priv->timelineobj = tlobject;
|
2010-12-16 14:00:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_track_object_get_timeline_object:
|
|
|
|
* @object: a #GESTrackObject
|
|
|
|
*
|
2011-01-10 13:28:35 +00:00
|
|
|
* Get the #GESTimelineObject which is controlling this track object
|
|
|
|
*
|
2010-12-16 14:00:46 +00:00
|
|
|
* Returns: (transfer none): the #GESTimelineObject which is controlling
|
|
|
|
* this track object
|
|
|
|
*/
|
|
|
|
GESTimelineObject *
|
|
|
|
ges_track_object_get_timeline_object (GESTrackObject * object)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), NULL);
|
|
|
|
|
|
|
|
return object->priv->timelineobj;
|
2009-08-06 15:38:43 +00:00
|
|
|
}
|
2010-12-14 16:38:55 +00:00
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
/**
|
|
|
|
* ges_track_object_get_gnlobject:
|
|
|
|
* @object: a #GESTrackObject
|
|
|
|
*
|
2011-01-10 13:28:35 +00:00
|
|
|
* Get the GNonLin object this object is controlling.
|
|
|
|
*
|
2010-12-16 14:00:46 +00:00
|
|
|
* Returns: (transfer none): the GNonLin object this object is controlling.
|
|
|
|
*/
|
|
|
|
GstElement *
|
|
|
|
ges_track_object_get_gnlobject (GESTrackObject * object)
|
|
|
|
{
|
2012-05-10 16:40:23 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), NULL);
|
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
return object->priv->gnlobject;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_track_object_get_element:
|
|
|
|
* @object: a #GESTrackObject
|
|
|
|
*
|
2011-01-10 13:28:35 +00:00
|
|
|
* Get the #GstElement this track object is controlling within GNonLin.
|
|
|
|
*
|
2010-12-16 14:00:46 +00:00
|
|
|
* Returns: (transfer none): the #GstElement this track object is controlling
|
|
|
|
* within GNonLin.
|
|
|
|
*/
|
|
|
|
GstElement *
|
|
|
|
ges_track_object_get_element (GESTrackObject * object)
|
|
|
|
{
|
2012-05-10 16:40:23 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), NULL);
|
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
return object->priv->element;
|
|
|
|
}
|
2010-12-16 15:27:26 +00:00
|
|
|
|
2011-12-19 10:21:18 +00:00
|
|
|
static inline void
|
|
|
|
ges_track_object_set_locked_internal (GESTrackObject * object, gboolean locked)
|
|
|
|
{
|
|
|
|
object->priv->locked = locked;
|
|
|
|
}
|
|
|
|
|
2010-12-16 15:27:26 +00:00
|
|
|
/**
|
|
|
|
* ges_track_object_set_locked:
|
|
|
|
* @object: a #GESTrackObject
|
|
|
|
* @locked: whether the object is lock to its parent
|
|
|
|
*
|
|
|
|
* Set the locking status of the @object in relationship to its controlling
|
|
|
|
* #GESTimelineObject. If @locked is %TRUE, then this object will move synchronously
|
|
|
|
* with its controlling #GESTimelineObject.
|
2011-05-07 14:59:06 +00:00
|
|
|
*/
|
2010-12-16 15:27:26 +00:00
|
|
|
void
|
|
|
|
ges_track_object_set_locked (GESTrackObject * object, gboolean locked)
|
|
|
|
{
|
2011-12-16 08:54:58 +00:00
|
|
|
g_return_if_fail (GES_IS_TRACK_OBJECT (object));
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (object, "%s object", locked ? "Locking" : "Unlocking");
|
|
|
|
|
2011-12-19 10:21:18 +00:00
|
|
|
ges_track_object_set_locked_internal (object, locked);
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_LOCKED]);
|
|
|
|
|
2010-12-16 15:27:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_track_object_is_locked:
|
|
|
|
* @object: a #GESTrackObject
|
|
|
|
*
|
2011-01-10 13:28:35 +00:00
|
|
|
* Let you know if object us locked or not (moving synchronously).
|
|
|
|
*
|
2010-12-16 15:27:26 +00:00
|
|
|
* Returns: %TRUE if the object is moving synchronously to its controlling
|
|
|
|
* #GESTimelineObject, else %FALSE.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
ges_track_object_is_locked (GESTrackObject * object)
|
|
|
|
{
|
2012-04-23 23:20:18 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), FALSE);
|
|
|
|
|
2010-12-16 15:27:26 +00:00
|
|
|
return object->priv->locked;
|
|
|
|
}
|
2011-02-03 14:11:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_track_object_get_start:
|
|
|
|
* @object: a #GESTrackObject
|
|
|
|
*
|
|
|
|
* Get the position of the object in the container #GESTrack.
|
|
|
|
*
|
2012-04-23 23:20:18 +00:00
|
|
|
* Returns: the start position (in #GstClockTime) or #GST_CLOCK_TIME_NONE
|
|
|
|
* if something went wrong.
|
2011-05-20 14:02:58 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
2011-02-03 14:11:54 +00:00
|
|
|
*/
|
|
|
|
guint64
|
|
|
|
ges_track_object_get_start (GESTrackObject * object)
|
|
|
|
{
|
2012-04-23 23:20:18 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), GST_CLOCK_TIME_NONE);
|
|
|
|
|
2011-02-03 14:11:54 +00:00
|
|
|
if (G_UNLIKELY (object->priv->gnlobject == NULL))
|
|
|
|
return object->priv->pending_start;
|
|
|
|
else
|
|
|
|
return object->start;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_track_object_get_inpoint:
|
|
|
|
* @object: a #GESTrackObject
|
|
|
|
*
|
|
|
|
* Get the offset within the contents of this #GESTrackObject
|
|
|
|
*
|
2012-04-23 23:20:18 +00:00
|
|
|
* Returns: the in-point (in #GstClockTime) or #GST_CLOCK_TIME_NONE
|
|
|
|
* if something went wrong.
|
2011-05-20 14:02:58 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
2011-02-03 14:11:54 +00:00
|
|
|
*/
|
|
|
|
guint64
|
|
|
|
ges_track_object_get_inpoint (GESTrackObject * object)
|
|
|
|
{
|
2012-04-23 23:20:18 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), GST_CLOCK_TIME_NONE);
|
|
|
|
|
2011-02-03 14:11:54 +00:00
|
|
|
if (G_UNLIKELY (object->priv->gnlobject == NULL))
|
|
|
|
return object->priv->pending_inpoint;
|
|
|
|
else
|
|
|
|
return object->inpoint;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_track_object_get_duration:
|
|
|
|
* @object: a #GESTrackObject
|
|
|
|
*
|
|
|
|
* Get the duration which will be used in the container #GESTrack
|
|
|
|
* starting from the 'in-point'
|
|
|
|
*
|
2012-04-23 23:20:18 +00:00
|
|
|
* Returns: the duration (in #GstClockTime) or #GST_CLOCK_TIME_NONE
|
|
|
|
* if something went wrong.
|
2011-05-20 14:02:58 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
2011-02-03 14:11:54 +00:00
|
|
|
*/
|
|
|
|
guint64
|
|
|
|
ges_track_object_get_duration (GESTrackObject * object)
|
|
|
|
{
|
2012-04-23 23:20:18 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), GST_CLOCK_TIME_NONE);
|
|
|
|
|
2011-02-03 14:11:54 +00:00
|
|
|
if (G_UNLIKELY (object->priv->gnlobject == NULL))
|
|
|
|
return object->priv->pending_duration;
|
|
|
|
else
|
|
|
|
return object->duration;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_track_object_get_priority:
|
|
|
|
* @object: a #GESTrackObject
|
|
|
|
*
|
|
|
|
* Get the priority of the object withing the containing #GESTrack.
|
|
|
|
*
|
2012-04-23 23:20:18 +00:00
|
|
|
* Returns: the priority of @object or -1 if something went wrong
|
2011-05-20 14:02:58 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
2011-02-03 14:11:54 +00:00
|
|
|
*/
|
|
|
|
guint32
|
|
|
|
ges_track_object_get_priority (GESTrackObject * object)
|
|
|
|
{
|
2012-04-23 23:20:18 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), -1);
|
|
|
|
|
2011-02-03 14:11:54 +00:00
|
|
|
if (G_UNLIKELY (object->priv->gnlobject == NULL))
|
|
|
|
return object->priv->pending_priority;
|
|
|
|
else
|
|
|
|
return object->priority;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_track_object_is_active:
|
|
|
|
* @object: a #GESTrackObject
|
|
|
|
*
|
|
|
|
* Lets you know if @object will be used for playback and rendering,
|
|
|
|
* or not.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if @object is active, %FALSE otherwize
|
2011-05-20 14:02:58 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
2011-02-03 14:11:54 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
ges_track_object_is_active (GESTrackObject * object)
|
|
|
|
{
|
2012-04-23 23:20:18 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), FALSE);
|
|
|
|
|
2011-02-03 14:11:54 +00:00
|
|
|
if (G_UNLIKELY (object->priv->gnlobject == NULL))
|
|
|
|
return object->priv->pending_active;
|
|
|
|
else
|
|
|
|
return object->active;
|
|
|
|
}
|
2011-02-08 09:25:41 +00:00
|
|
|
|
2011-05-06 17:38:26 +00:00
|
|
|
/**
|
2011-02-25 10:32:44 +00:00
|
|
|
* ges_track_object_lookup_child:
|
|
|
|
* @object: object to lookup the property in
|
|
|
|
* @prop_name: name of the property to look up. You can specify the name of the
|
2011-05-06 17:38:26 +00:00
|
|
|
* class as such: "ClassName::property-name", to guarantee that you get the
|
2011-02-25 10:32:44 +00:00
|
|
|
* proper GParamSpec in case various GstElement-s contain the same property
|
|
|
|
* name. If you don't do so, you will get the first element found, having
|
|
|
|
* this property and the and the corresponding GParamSpec.
|
|
|
|
* @element: (out) (allow-none) (transfer full): pointer to a #GstElement that
|
|
|
|
* takes the real object to set property on
|
|
|
|
* @pspec: (out) (allow-none) (transfer full): pointer to take the #GParamSpec
|
|
|
|
* describing the property
|
|
|
|
*
|
|
|
|
* Looks up which @element and @pspec would be effected by the given @name. If various
|
|
|
|
* contained elements have this property name you will get the first one, unless you
|
|
|
|
* specify the class name in @name.
|
|
|
|
*
|
|
|
|
* Returns: TRUE if @element and @pspec could be found. FALSE otherwise. In that
|
|
|
|
* case the values for @pspec and @element are not modified. Unref @element after
|
|
|
|
* usage.
|
2011-05-20 14:02:58 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
2011-02-25 10:32:44 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
ges_track_object_lookup_child (GESTrackObject * object, const gchar * prop_name,
|
|
|
|
GstElement ** element, GParamSpec ** pspec)
|
|
|
|
{
|
|
|
|
GHashTableIter iter;
|
|
|
|
gpointer key, value;
|
|
|
|
gchar **names, *name, *classename;
|
|
|
|
gboolean res;
|
2012-04-23 23:20:18 +00:00
|
|
|
GESTrackObjectPrivate *priv;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), FALSE);
|
|
|
|
|
|
|
|
priv = object->priv;
|
2011-02-25 10:32:44 +00:00
|
|
|
|
|
|
|
classename = NULL;
|
|
|
|
res = FALSE;
|
|
|
|
|
|
|
|
names = g_strsplit (prop_name, "::", 2);
|
|
|
|
if (names[1] != NULL) {
|
|
|
|
classename = names[0];
|
|
|
|
name = names[1];
|
|
|
|
} else
|
|
|
|
name = names[0];
|
|
|
|
|
|
|
|
g_hash_table_iter_init (&iter, priv->properties_hashtable);
|
|
|
|
while (g_hash_table_iter_next (&iter, &key, &value)) {
|
|
|
|
if (g_strcmp0 (G_PARAM_SPEC (key)->name, name) == 0) {
|
|
|
|
if (classename == NULL ||
|
|
|
|
g_strcmp0 (G_OBJECT_TYPE_NAME (G_OBJECT (value)), classename) == 0) {
|
2011-11-16 18:22:33 +00:00
|
|
|
GST_DEBUG ("The %s property from %s has been found", name, classename);
|
2011-02-25 10:32:44 +00:00
|
|
|
if (element)
|
|
|
|
*element = g_object_ref (value);
|
|
|
|
|
|
|
|
*pspec = g_param_spec_ref (key);
|
|
|
|
res = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_strfreev (names);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2011-02-08 09:25:41 +00:00
|
|
|
/**
|
2011-02-25 11:13:03 +00:00
|
|
|
* ges_track_object_set_child_property_by_pspec:
|
2011-02-08 09:25:41 +00:00
|
|
|
* @object: a #GESTrackObject
|
2011-02-25 11:13:03 +00:00
|
|
|
* @pspec: The #GParamSpec that specifies the property you want to set
|
2011-02-08 09:25:41 +00:00
|
|
|
* @value: the value
|
|
|
|
*
|
2011-02-25 11:13:03 +00:00
|
|
|
* Sets a property of a child of @object.
|
2011-05-20 14:02:58 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
2011-02-08 09:25:41 +00:00
|
|
|
*/
|
|
|
|
void
|
2011-02-25 11:13:03 +00:00
|
|
|
ges_track_object_set_child_property_by_pspec (GESTrackObject * object,
|
|
|
|
GParamSpec * pspec, GValue * value)
|
2011-02-08 09:25:41 +00:00
|
|
|
{
|
2011-02-25 11:13:03 +00:00
|
|
|
GstElement *element;
|
2012-04-23 23:20:18 +00:00
|
|
|
GESTrackObjectPrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (GES_IS_TRACK_OBJECT (object));
|
2011-02-25 11:13:03 +00:00
|
|
|
|
2012-04-23 23:20:18 +00:00
|
|
|
priv = object->priv;
|
2011-02-08 09:25:41 +00:00
|
|
|
|
2011-02-25 11:13:03 +00:00
|
|
|
if (!priv->properties_hashtable)
|
|
|
|
goto prop_hash_not_set;
|
|
|
|
|
|
|
|
element = g_hash_table_lookup (priv->properties_hashtable, pspec);
|
|
|
|
if (!element)
|
|
|
|
goto not_found;
|
|
|
|
|
|
|
|
g_object_set_property (G_OBJECT (element), pspec->name, value);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
not_found:
|
|
|
|
{
|
|
|
|
GST_ERROR ("The %s property doesn't exist", pspec->name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
prop_hash_not_set:
|
|
|
|
{
|
2011-02-08 09:25:41 +00:00
|
|
|
GST_DEBUG ("The child properties haven't been set on %p", object);
|
2011-02-25 11:13:03 +00:00
|
|
|
return;
|
2011-02-08 09:25:41 +00:00
|
|
|
}
|
|
|
|
}
|
2011-02-08 10:06:57 +00:00
|
|
|
|
|
|
|
/**
|
2011-02-25 11:13:03 +00:00
|
|
|
* ges_track_object_set_child_property_valist:
|
|
|
|
* @object: The #GESTrackObject parent object
|
|
|
|
* @first_property_name: The name of the first property to set
|
|
|
|
* @var_args: value for the first property, followed optionally by more
|
|
|
|
* name/return location pairs, followed by NULL
|
|
|
|
*
|
|
|
|
* Sets a property of a child of @object. If there are various child elements
|
|
|
|
* that have the same property name, you can distinguish them using the following
|
2011-08-13 22:52:23 +00:00
|
|
|
* syntax: 'ClasseName::property_name' as property name. If you don't, the
|
2011-02-25 11:13:03 +00:00
|
|
|
* corresponding property of the first element found will be set.
|
2011-05-20 14:02:58 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
2011-02-25 11:13:03 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
ges_track_object_set_child_property_valist (GESTrackObject * object,
|
|
|
|
const gchar * first_property_name, va_list var_args)
|
|
|
|
{
|
|
|
|
const gchar *name;
|
|
|
|
GParamSpec *pspec;
|
|
|
|
GstElement *element;
|
|
|
|
|
|
|
|
gchar *error = NULL;
|
|
|
|
GValue value = { 0, };
|
|
|
|
|
2012-04-23 23:20:18 +00:00
|
|
|
g_return_if_fail (GES_IS_TRACK_OBJECT (object));
|
2011-02-25 11:13:03 +00:00
|
|
|
|
|
|
|
name = first_property_name;
|
|
|
|
|
|
|
|
/* Note: This part is in big part copied from the gst_child_object_set_valist
|
|
|
|
* method. */
|
|
|
|
|
|
|
|
/* iterate over pairs */
|
|
|
|
while (name) {
|
|
|
|
if (!ges_track_object_lookup_child (object, name, &element, &pspec))
|
|
|
|
goto not_found;
|
|
|
|
|
|
|
|
#if GLIB_CHECK_VERSION(2,23,3)
|
|
|
|
G_VALUE_COLLECT_INIT (&value, pspec->value_type, var_args,
|
|
|
|
G_VALUE_NOCOPY_CONTENTS, &error);
|
|
|
|
#else
|
|
|
|
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
|
|
|
|
G_VALUE_COLLECT (&value, var_args, G_VALUE_NOCOPY_CONTENTS, &error);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (error)
|
|
|
|
goto cant_copy;
|
|
|
|
|
|
|
|
g_object_set_property (G_OBJECT (element), pspec->name, &value);
|
|
|
|
|
|
|
|
g_object_unref (element);
|
|
|
|
g_value_unset (&value);
|
|
|
|
|
|
|
|
name = va_arg (var_args, gchar *);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
|
|
|
|
not_found:
|
|
|
|
{
|
|
|
|
GST_WARNING ("No property %s in OBJECT\n", name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
cant_copy:
|
|
|
|
{
|
|
|
|
GST_WARNING ("error copying value %s in object %p: %s", pspec->name, object,
|
|
|
|
error);
|
|
|
|
g_value_unset (&value);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_track_object_set_child_property:
|
|
|
|
* @object: The #GESTrackObject parent object
|
|
|
|
* @first_property_name: The name of the first property to set
|
|
|
|
* @...: value for the first property, followed optionally by more
|
|
|
|
* name/return location pairs, followed by NULL
|
|
|
|
*
|
|
|
|
* Sets a property of a child of @object. If there are various child elements
|
|
|
|
* that have the same property name, you can distinguish them using the following
|
2011-08-13 22:52:23 +00:00
|
|
|
* syntax: 'ClasseName::property_name' as property name. If you don't, the
|
2011-02-25 11:13:03 +00:00
|
|
|
* corresponding property of the first element found will be set.
|
2011-05-20 14:02:58 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
2011-02-25 11:13:03 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
ges_track_object_set_child_property (GESTrackObject * object,
|
|
|
|
const gchar * first_property_name, ...)
|
|
|
|
{
|
|
|
|
va_list var_args;
|
|
|
|
|
2012-04-23 23:20:18 +00:00
|
|
|
g_return_if_fail (GES_IS_TRACK_OBJECT (object));
|
|
|
|
|
2011-02-25 11:13:03 +00:00
|
|
|
va_start (var_args, first_property_name);
|
|
|
|
ges_track_object_set_child_property_valist (object, first_property_name,
|
|
|
|
var_args);
|
|
|
|
va_end (var_args);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_track_object_get_child_property_valist:
|
|
|
|
* @object: The #GESTrackObject parent object
|
|
|
|
* @first_property_name: The name of the first property to get
|
|
|
|
* @var_args: value for the first property, followed optionally by more
|
|
|
|
* name/return location pairs, followed by NULL
|
|
|
|
*
|
|
|
|
* Gets a property of a child of @object. If there are various child elements
|
|
|
|
* that have the same property name, you can distinguish them using the following
|
2011-08-13 22:52:23 +00:00
|
|
|
* syntax: 'ClasseName::property_name' as property name. If you don't, the
|
2011-02-25 11:13:03 +00:00
|
|
|
* corresponding property of the first element found will be set.
|
2011-05-20 14:02:58 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
2011-02-25 11:13:03 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
ges_track_object_get_child_property_valist (GESTrackObject * object,
|
|
|
|
const gchar * first_property_name, va_list var_args)
|
|
|
|
{
|
|
|
|
const gchar *name;
|
|
|
|
gchar *error = NULL;
|
|
|
|
GValue value = { 0, };
|
|
|
|
GParamSpec *pspec;
|
|
|
|
GstElement *element;
|
|
|
|
|
|
|
|
g_return_if_fail (G_IS_OBJECT (object));
|
|
|
|
|
|
|
|
name = first_property_name;
|
|
|
|
|
|
|
|
/* This part is in big part copied from the gst_child_object_get_valist method */
|
|
|
|
while (name) {
|
|
|
|
if (!ges_track_object_lookup_child (object, name, &element, &pspec))
|
|
|
|
goto not_found;
|
|
|
|
|
|
|
|
g_value_init (&value, pspec->value_type);
|
|
|
|
g_object_get_property (G_OBJECT (element), pspec->name, &value);
|
|
|
|
g_object_unref (element);
|
|
|
|
|
|
|
|
G_VALUE_LCOPY (&value, var_args, 0, &error);
|
|
|
|
if (error)
|
|
|
|
goto cant_copy;
|
|
|
|
g_value_unset (&value);
|
|
|
|
name = va_arg (var_args, gchar *);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
|
|
|
|
not_found:
|
|
|
|
{
|
|
|
|
GST_WARNING ("no property %s in object", name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
cant_copy:
|
|
|
|
{
|
|
|
|
GST_WARNING ("error copying value %s in object %p: %s", pspec->name, object,
|
|
|
|
error);
|
|
|
|
g_value_unset (&value);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-25 16:10:00 +00:00
|
|
|
/**
|
|
|
|
* ges_track_object_list_children_properties:
|
|
|
|
* @object: The #GESTrackObject to get the list of children properties from
|
|
|
|
* @n_properties: return location for the length of the returned array
|
|
|
|
*
|
|
|
|
* Gets an array of #GParamSpec* for all configurable properties of the
|
|
|
|
* children of @object.
|
|
|
|
*
|
2011-05-07 14:59:06 +00:00
|
|
|
* Returns: (transfer full) (array): an array of #GParamSpec* which should be freed after use or
|
|
|
|
* %NULL if something went wrong
|
2011-05-20 14:02:58 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
2011-02-25 16:10:00 +00:00
|
|
|
*/
|
|
|
|
GParamSpec **
|
|
|
|
ges_track_object_list_children_properties (GESTrackObject * object,
|
|
|
|
guint * n_properties)
|
|
|
|
{
|
|
|
|
GESTrackObjectClass *class;
|
2011-05-06 17:41:38 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), NULL);
|
|
|
|
|
2011-02-25 16:10:00 +00:00
|
|
|
class = GES_TRACK_OBJECT_GET_CLASS (object);
|
|
|
|
|
|
|
|
return class->list_children_properties (object, n_properties);
|
|
|
|
}
|
|
|
|
|
2011-02-25 11:13:03 +00:00
|
|
|
/**
|
|
|
|
* ges_track_object_get_child_property:
|
|
|
|
* @object: The origin #GESTrackObject
|
|
|
|
* @first_property_name: The name of the first property to get
|
|
|
|
* @...: return location for the first property, followed optionally by more
|
|
|
|
* name/return location pairs, followed by NULL
|
|
|
|
*
|
|
|
|
* Gets properties of a child of @object.
|
2011-05-20 14:02:58 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
2011-02-25 11:13:03 +00:00
|
|
|
*/
|
2011-02-08 10:06:57 +00:00
|
|
|
void
|
|
|
|
ges_track_object_get_child_property (GESTrackObject * object,
|
2011-02-25 11:13:03 +00:00
|
|
|
const gchar * first_property_name, ...)
|
2011-02-08 10:06:57 +00:00
|
|
|
{
|
2011-02-25 11:13:03 +00:00
|
|
|
va_list var_args;
|
|
|
|
|
2012-04-23 23:20:18 +00:00
|
|
|
g_return_if_fail (GES_IS_TRACK_OBJECT (object));
|
|
|
|
|
2011-02-25 11:13:03 +00:00
|
|
|
va_start (var_args, first_property_name);
|
|
|
|
ges_track_object_get_child_property_valist (object, first_property_name,
|
|
|
|
var_args);
|
|
|
|
va_end (var_args);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_track_object_get_child_property_by_pspec:
|
|
|
|
* @object: a #GESTrackObject
|
|
|
|
* @pspec: The #GParamSpec that specifies the property you want to get
|
|
|
|
* @value: return location for the value
|
|
|
|
*
|
|
|
|
* Gets a property of a child of @object.
|
2011-05-20 14:02:58 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
2011-02-25 11:13:03 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
ges_track_object_get_child_property_by_pspec (GESTrackObject * object,
|
|
|
|
GParamSpec * pspec, GValue * value)
|
|
|
|
{
|
|
|
|
GstElement *element;
|
2012-04-23 23:20:18 +00:00
|
|
|
GESTrackObjectPrivate *priv;
|
2011-02-25 11:13:03 +00:00
|
|
|
|
2012-04-23 23:20:18 +00:00
|
|
|
g_return_if_fail (GES_IS_TRACK_OBJECT (object));
|
|
|
|
|
|
|
|
priv = object->priv;
|
2011-02-08 10:06:57 +00:00
|
|
|
|
2011-02-25 11:13:03 +00:00
|
|
|
if (!priv->properties_hashtable)
|
|
|
|
goto prop_hash_not_set;
|
|
|
|
|
|
|
|
element = g_hash_table_lookup (priv->properties_hashtable, pspec);
|
|
|
|
if (!element)
|
|
|
|
goto not_found;
|
|
|
|
|
|
|
|
g_object_get_property (G_OBJECT (element), pspec->name, value);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
not_found:
|
|
|
|
{
|
|
|
|
GST_ERROR ("The %s property doesn't exist", pspec->name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
prop_hash_not_set:
|
|
|
|
{
|
|
|
|
GST_ERROR ("The child properties haven't been set on %p", object);
|
|
|
|
return;
|
2011-02-08 10:06:57 +00:00
|
|
|
}
|
|
|
|
}
|
2011-02-25 16:10:00 +00:00
|
|
|
|
2011-05-06 17:41:16 +00:00
|
|
|
static GParamSpec **
|
2011-02-25 16:10:00 +00:00
|
|
|
default_list_children_properties (GESTrackObject * object, guint * n_properties)
|
|
|
|
{
|
|
|
|
GParamSpec **pspec, *spec;
|
|
|
|
GHashTableIter iter;
|
|
|
|
gpointer key, value;
|
|
|
|
|
|
|
|
guint i = 0;
|
|
|
|
|
|
|
|
if (!object->priv->properties_hashtable)
|
|
|
|
goto prop_hash_not_set;
|
|
|
|
|
|
|
|
*n_properties = g_hash_table_size (object->priv->properties_hashtable);
|
|
|
|
pspec = g_new (GParamSpec *, *n_properties);
|
|
|
|
|
|
|
|
g_hash_table_iter_init (&iter, object->priv->properties_hashtable);
|
|
|
|
while (g_hash_table_iter_next (&iter, &key, &value)) {
|
|
|
|
spec = G_PARAM_SPEC (key);
|
|
|
|
pspec[i] = g_param_spec_ref (spec);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return pspec;
|
|
|
|
|
|
|
|
prop_hash_not_set:
|
|
|
|
{
|
2011-06-06 22:49:58 +00:00
|
|
|
*n_properties = 0;
|
2011-02-25 16:10:00 +00:00
|
|
|
GST_ERROR ("The child properties haven't been set on %p", object);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
2012-01-16 12:37:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_track_object_get_max_duration:
|
|
|
|
* @object: The #GESTrackObject to retrieve max duration from
|
|
|
|
*
|
|
|
|
* Get the max duration of @object.
|
|
|
|
*
|
|
|
|
* Returns: The max duration of @object
|
|
|
|
*
|
|
|
|
* Since: 0.10.XX
|
|
|
|
*/
|
|
|
|
guint64
|
|
|
|
ges_track_object_get_max_duration (GESTrackObject * object)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), 0);
|
|
|
|
|
|
|
|
return object->priv->maxduration;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_track_object_set_max_duration:
|
|
|
|
* @object: The #GESTrackObject to retrieve max duration from
|
|
|
|
* @maxduration: The maximum duration of @object
|
|
|
|
*
|
|
|
|
* Returns: Set the max duration of @object
|
|
|
|
*
|
|
|
|
* Since: 0.10.XX
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ges_track_object_set_max_duration (GESTrackObject * object, guint64 maxduration)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GES_IS_TRACK_OBJECT (object));
|
|
|
|
|
|
|
|
object->priv->maxduration = maxduration;
|
|
|
|
}
|
2012-04-19 04:34:59 +00:00
|
|
|
|
2012-04-23 23:17:51 +00:00
|
|
|
/**
|
|
|
|
* ges_track_object_copy:
|
|
|
|
* @object: The #GESTrackObject to copy
|
|
|
|
* @deep: whether we want to create the gnlobject and copy it properties
|
|
|
|
*
|
|
|
|
* Copies @object
|
|
|
|
*
|
2012-05-09 16:12:38 +00:00
|
|
|
* Returns: (transfer full): The newly create #GESTrackObject, copied from @object
|
2012-04-23 23:17:51 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.XX
|
|
|
|
*/
|
2012-04-19 04:34:59 +00:00
|
|
|
GESTrackObject *
|
|
|
|
ges_track_object_copy (GESTrackObject * object, gboolean deep)
|
|
|
|
{
|
|
|
|
GESTrackObject *ret = NULL;
|
|
|
|
GParameter *params;
|
|
|
|
GParamSpec **specs;
|
|
|
|
guint n, n_specs, n_params;
|
|
|
|
GValue val = { 0 };
|
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_TRACK_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 (g_strcmp0 (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);
|
|
|
|
g_free (specs);
|
|
|
|
g_free (params);
|
2012-04-23 23:17:51 +00:00
|
|
|
specs = NULL;
|
|
|
|
params = NULL;
|
2012-04-19 04:34:59 +00:00
|
|
|
|
|
|
|
if (deep == FALSE)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ensure_gnl_object (ret);
|
|
|
|
specs = ges_track_object_list_children_properties (object, &n_specs);
|
|
|
|
for (n = 0; n < n_specs; ++n) {
|
|
|
|
g_value_init (&val, specs[n]->value_type);
|
|
|
|
g_object_get_property (G_OBJECT (object), specs[n]->name, &val);
|
|
|
|
ges_track_object_set_child_property_by_pspec (ret, specs[n], &val);
|
|
|
|
g_value_unset (&val);
|
|
|
|
}
|
|
|
|
|
2012-04-23 23:17:51 +00:00
|
|
|
g_free (specs);
|
|
|
|
g_free (params);
|
|
|
|
|
2012-04-19 04:34:59 +00:00
|
|
|
return ret;
|
|
|
|
}
|
2012-04-24 00:52:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_track_object_edit:
|
|
|
|
* @object: the #GESTrackObject 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.
|
|
|
|
* FIXME: This is not implemented yet.
|
|
|
|
* @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_track_object_edit (GESTrackObject * object,
|
|
|
|
GList * layers, GESEditMode mode, GESEdge edge, guint64 position)
|
|
|
|
{
|
|
|
|
GESTrack *track = ges_track_object_get_track (object);
|
|
|
|
GESTimeline *timeline;
|
|
|
|
|
2012-04-23 23:20:18 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), FALSE);
|
|
|
|
|
2012-04-24 00:52:45 +00:00
|
|
|
if (G_UNLIKELY (!track)) {
|
|
|
|
GST_WARNING_OBJECT (object, "Trying to edit in %d mode but not in"
|
|
|
|
"any Track yet.", mode);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
timeline = GES_TIMELINE (ges_track_get_timeline (track));
|
|
|
|
|
|
|
|
if (G_UNLIKELY (!timeline)) {
|
|
|
|
GST_WARNING_OBJECT (object, "Trying to edit in %d mode but not in"
|
|
|
|
"track %p no in any timeline yet.", mode, track);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (mode) {
|
|
|
|
case GES_EDIT_MODE_NORMAL:
|
|
|
|
timeline_move_object (timeline, object, layers, edge, position);
|
|
|
|
break;
|
|
|
|
case GES_EDIT_MODE_TRIM:
|
|
|
|
timeline_trim_object (timeline, object, layers, edge, position);
|
|
|
|
break;
|
|
|
|
case GES_EDIT_MODE_RIPPLE:
|
|
|
|
timeline_ripple_object (timeline, object, layers, edge, position);
|
|
|
|
break;
|
|
|
|
case GES_EDIT_MODE_ROLL:
|
|
|
|
timeline_roll_object (timeline, object, layers, edge, position);
|
|
|
|
break;
|
|
|
|
case GES_EDIT_MODE_SLIDE:
|
|
|
|
timeline_slide_object (timeline, object, layers, edge, position);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
GST_ERROR ("Unkown edit mode: %d", mode);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|