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
|
2012-11-04 00:25:20 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2009-08-04 15:16:31 +00:00
|
|
|
*/
|
|
|
|
|
2009-09-10 16:40:51 +00:00
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* SECTION:ges-track-element
|
2012-12-21 23:17:41 +00:00
|
|
|
* @short_description: Base Class for objects contained in a GESTrack
|
2009-09-10 16:40:51 +00:00
|
|
|
*
|
2013-01-26 15:31:33 +00:00
|
|
|
* #GESTrackElement is the Base Class for any object that can be contained in a
|
2009-09-10 16:40:51 +00:00
|
|
|
* #GESTrack.
|
2009-09-14 14:33:25 +00:00
|
|
|
*
|
|
|
|
* It contains the basic information as to the location of the object within
|
2013-01-15 13:52:17 +00:00
|
|
|
* its container, like the start position, the inpoint, the duration and the
|
2009-09-14 14:33:25 +00:00
|
|
|
* priority.
|
2009-09-10 16:40:51 +00:00
|
|
|
*/
|
|
|
|
|
2009-08-06 17:51:29 +00:00
|
|
|
#include "ges-internal.h"
|
2012-11-20 02:42:47 +00:00
|
|
|
#include "ges-extractable.h"
|
2013-01-26 15:31:33 +00:00
|
|
|
#include "ges-track-element.h"
|
2013-01-20 15:42:29 +00:00
|
|
|
#include "ges-clip.h"
|
2012-11-20 21:25:31 +00:00
|
|
|
#include "ges-meta-container.h"
|
2011-02-25 11:13:03 +00:00
|
|
|
#include <gobject/gvaluecollector.h>
|
2009-08-04 15:16:31 +00:00
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
G_DEFINE_ABSTRACT_TYPE (GESTrackElement, ges_track_element,
|
2013-01-15 13:52:17 +00:00
|
|
|
GES_TYPE_TIMELINE_ELEMENT);
|
2009-08-06 10:14:37 +00:00
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
struct _GESTrackElementPrivate
|
2010-12-04 18:54:13 +00:00
|
|
|
{
|
2012-12-20 23:23:54 +00:00
|
|
|
GESTrackType track_type;
|
|
|
|
|
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;
|
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
GESClip *timelineobj;
|
2010-12-16 14:00:46 +00:00
|
|
|
GESTrack *track;
|
|
|
|
|
|
|
|
gboolean valid;
|
|
|
|
|
2010-12-16 15:27:26 +00:00
|
|
|
gboolean locked; /* If TRUE, then moves in sync with its controlling
|
2013-01-20 15:42:29 +00:00
|
|
|
* GESClip */
|
2010-12-04 18:54:13 +00:00
|
|
|
};
|
|
|
|
|
2009-08-06 10:14:37 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
2010-12-16 17:20:47 +00:00
|
|
|
PROP_ACTIVE,
|
2011-12-19 10:21:18 +00:00
|
|
|
PROP_LOCKED,
|
2012-12-20 23:23:54 +00:00
|
|
|
PROP_TRACK_TYPE,
|
2013-01-10 21:09:23 +00:00
|
|
|
PROP_TRACK,
|
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
|
|
|
|
};
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
static guint ges_track_element_signals[LAST_SIGNAL] = { 0 };
|
2011-02-08 14:29:21 +00:00
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
static GstElement *ges_track_element_create_gnl_object_func (GESTrackElement *
|
2010-12-16 14:00:46 +00:00
|
|
|
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
|
2013-02-15 02:34:48 +00:00
|
|
|
G_GNUC_UNUSED, GESTrackElement * track_element);
|
2010-06-09 14:27:43 +00:00
|
|
|
|
2011-01-11 15:35:05 +00:00
|
|
|
static void gnlobject_media_start_cb (GstElement * gnlobject, GParamSpec * arg
|
2013-02-15 02:34:48 +00:00
|
|
|
G_GNUC_UNUSED, GESTrackElement * track_element);
|
2010-06-09 14:27:43 +00:00
|
|
|
|
2011-01-11 15:35:05 +00:00
|
|
|
static void gnlobject_priority_cb (GstElement * gnlobject, GParamSpec * arg
|
2013-02-15 02:34:48 +00:00
|
|
|
G_GNUC_UNUSED, GESTrackElement * track_element);
|
2010-06-09 14:27:43 +00:00
|
|
|
|
2011-01-11 15:35:05 +00:00
|
|
|
static void gnlobject_duration_cb (GstElement * gnlobject, GParamSpec * arg
|
2013-02-15 02:34:48 +00:00
|
|
|
G_GNUC_UNUSED, GESTrackElement * track_element);
|
2010-06-09 14:27:43 +00:00
|
|
|
|
2011-01-11 15:35:05 +00:00
|
|
|
static void gnlobject_active_cb (GstElement * gnlobject, GParamSpec * arg
|
2013-02-15 02:34:48 +00:00
|
|
|
G_GNUC_UNUSED, GESTrackElement * track_element);
|
2010-06-09 14:27:43 +00:00
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
static void connect_properties_signals (GESTrackElement * object);
|
2011-02-08 14:29:21 +00:00
|
|
|
static void connect_signal (gpointer key, gpointer value, gpointer user_data);
|
|
|
|
static void gst_element_prop_changed_cb (GstElement * element, GParamSpec * arg
|
2013-02-15 02:34:48 +00:00
|
|
|
G_GNUC_UNUSED, GESTrackElement * track_element);
|
2011-02-08 14:29:21 +00:00
|
|
|
|
2013-01-15 13:52:17 +00:00
|
|
|
static gboolean _set_start (GESTimelineElement * element, GstClockTime start);
|
|
|
|
static gboolean _set_inpoint (GESTimelineElement * element,
|
|
|
|
GstClockTime inpoint);
|
|
|
|
static gboolean _set_duration (GESTimelineElement * element,
|
|
|
|
GstClockTime duration);
|
|
|
|
static gboolean _set_priority (GESTimelineElement * element, guint32 priority);
|
|
|
|
static void _deep_copy (GESTimelineElement * element,
|
|
|
|
GESTimelineElement * copy);
|
|
|
|
|
2011-12-19 10:21:18 +00:00
|
|
|
static inline void
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_set_locked_internal (GESTrackElement * object,
|
|
|
|
gboolean locked);
|
2010-07-08 16:51:38 +00:00
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
static GParamSpec **default_list_children_properties (GESTrackElement * object,
|
2011-02-25 16:10:00 +00:00
|
|
|
guint * n_properties);
|
|
|
|
|
2009-08-06 10:14:37 +00:00
|
|
|
static void
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_get_property (GObject * object, guint property_id,
|
2009-08-06 10:14:37 +00:00
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2013-02-15 02:34:48 +00:00
|
|
|
GESTrackElement *track_element = GES_TRACK_ELEMENT (object);
|
2009-08-06 10:14:37 +00:00
|
|
|
|
|
|
|
switch (property_id) {
|
2009-09-30 14:40:59 +00:00
|
|
|
case PROP_ACTIVE:
|
2013-02-15 02:34:48 +00:00
|
|
|
g_value_set_boolean (value, ges_track_element_is_active (track_element));
|
2009-09-30 14:40:59 +00:00
|
|
|
break;
|
2011-12-19 10:21:18 +00:00
|
|
|
case PROP_LOCKED:
|
2013-02-15 02:34:48 +00:00
|
|
|
g_value_set_boolean (value, ges_track_element_is_locked (track_element));
|
2011-12-19 10:21:18 +00:00
|
|
|
break;
|
2012-12-20 23:23:54 +00:00
|
|
|
case PROP_TRACK_TYPE:
|
2013-02-15 02:34:48 +00:00
|
|
|
g_value_set_flags (value, track_element->priv->track_type);
|
2012-12-20 23:23:54 +00:00
|
|
|
break;
|
2013-01-10 21:09:23 +00:00
|
|
|
case PROP_TRACK:
|
2013-02-15 02:34:48 +00:00
|
|
|
g_value_set_object (value, track_element->priv->track);
|
2013-01-10 21:09:23 +00:00
|
|
|
break;
|
2009-08-06 10:14:37 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_set_property (GObject * object, guint property_id,
|
2009-08-06 10:14:37 +00:00
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2013-02-15 02:34:48 +00:00
|
|
|
GESTrackElement *track_element = GES_TRACK_ELEMENT (object);
|
2009-08-06 10:14:37 +00:00
|
|
|
|
|
|
|
switch (property_id) {
|
2009-09-30 14:40:59 +00:00
|
|
|
case PROP_ACTIVE:
|
2013-02-15 02:34:48 +00:00
|
|
|
ges_track_element_set_active (track_element, g_value_get_boolean (value));
|
2009-09-30 14:40:59 +00:00
|
|
|
break;
|
2011-12-19 10:21:18 +00:00
|
|
|
case PROP_LOCKED:
|
2013-02-15 02:34:48 +00:00
|
|
|
ges_track_element_set_locked_internal (track_element,
|
|
|
|
g_value_get_boolean (value));
|
2011-12-19 10:21:18 +00:00
|
|
|
break;
|
2012-12-20 23:23:54 +00:00
|
|
|
case PROP_TRACK_TYPE:
|
2013-02-15 02:34:48 +00:00
|
|
|
track_element->priv->track_type = g_value_get_flags (value);
|
2012-12-20 23:23:54 +00:00
|
|
|
break;
|
2009-08-06 10:14:37 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_dispose (GObject * object)
|
2009-08-06 10:14:37 +00:00
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElementPrivate *priv = GES_TRACK_ELEMENT (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"
|
2013-01-26 15:31:33 +00:00
|
|
|
" to remove a GESTrackElement from its track before dropping the last"
|
2012-05-10 16:40:23 +00:00
|
|
|
" 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;
|
|
|
|
}
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
G_OBJECT_CLASS (ges_track_element_parent_class)->dispose (object);
|
2009-08-06 10:14:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_finalize (GObject * object)
|
2009-08-06 10:14:37 +00:00
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
G_OBJECT_CLASS (ges_track_element_parent_class)->finalize (object);
|
2009-08-06 10:14:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_class_init (GESTrackElementClass * klass)
|
2009-08-06 10:14:37 +00:00
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2013-01-15 13:52:17 +00:00
|
|
|
GESTimelineElementClass *element_class = GES_TIMELINE_ELEMENT_CLASS (klass);
|
2009-08-06 10:14:37 +00:00
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
g_type_class_add_private (klass, sizeof (GESTrackElementPrivate));
|
2010-12-04 18:54:13 +00:00
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
object_class->get_property = ges_track_element_get_property;
|
|
|
|
object_class->set_property = ges_track_element_set_property;
|
|
|
|
object_class->dispose = ges_track_element_dispose;
|
|
|
|
object_class->finalize = ges_track_element_finalize;
|
2009-08-06 10:14:37 +00:00
|
|
|
|
2009-08-06 15:38:43 +00:00
|
|
|
|
2009-09-30 14:40:59 +00:00
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* GESTrackElement:active:
|
2009-09-30 14:40:59 +00:00
|
|
|
*
|
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
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* GESTrackElement:locked:
|
2011-12-19 10:21:18 +00:00
|
|
|
*
|
2013-01-20 15:42:29 +00:00
|
|
|
* If %TRUE, then moves in sync with its controlling #GESClip
|
2011-12-19 10:21:18 +00:00
|
|
|
*/
|
|
|
|
properties[PROP_LOCKED] =
|
|
|
|
g_param_spec_boolean ("locked", "Locked",
|
2013-01-20 15:42:29 +00:00
|
|
|
"Moves in sync with its controling Clip", TRUE, G_PARAM_READWRITE);
|
2011-12-19 10:21:18 +00:00
|
|
|
g_object_class_install_property (object_class, PROP_LOCKED,
|
|
|
|
properties[PROP_LOCKED]);
|
|
|
|
|
2012-12-20 23:23:54 +00:00
|
|
|
properties[PROP_TRACK_TYPE] = g_param_spec_flags ("track-type", "Track Type",
|
|
|
|
"The track type of the object", GES_TYPE_TRACK_TYPE,
|
|
|
|
GES_TRACK_TYPE_UNKNOWN, G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
|
|
|
g_object_class_install_property (object_class, PROP_TRACK_TYPE,
|
|
|
|
properties[PROP_TRACK_TYPE]);
|
|
|
|
|
2013-01-10 21:09:23 +00:00
|
|
|
properties[PROP_TRACK] = g_param_spec_object ("track", "Track",
|
|
|
|
"The track the object is in", GES_TYPE_TRACK, G_PARAM_READABLE);
|
|
|
|
g_object_class_install_property (object_class, PROP_TRACK,
|
|
|
|
properties[PROP_TRACK]);
|
|
|
|
|
2012-01-16 12:37:22 +00:00
|
|
|
|
2011-02-08 14:29:21 +00:00
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* GESTrackElement::deep-notify:
|
|
|
|
* @track_element: a #GESTrackElement
|
2011-02-08 14:29:21 +00:00
|
|
|
* @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
|
2013-01-26 15:31:33 +00:00
|
|
|
* the childs of @track_element
|
2011-08-13 22:52:23 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.2
|
2011-02-08 14:29:21 +00:00
|
|
|
*/
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_signals[DEEP_NOTIFY] =
|
2011-02-08 14:29:21 +00:00
|
|
|
g_signal_new ("deep-notify", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE | G_SIGNAL_DETAILED |
|
2012-03-12 15:46:42 +00:00
|
|
|
G_SIGNAL_NO_HOOKS, 0, NULL, NULL, g_cclosure_marshal_generic,
|
2011-02-08 14:29:21 +00:00
|
|
|
G_TYPE_NONE, 2, GST_TYPE_ELEMENT, G_TYPE_PARAM);
|
|
|
|
|
2013-01-15 13:52:17 +00:00
|
|
|
element_class->set_start = _set_start;
|
|
|
|
element_class->set_duration = _set_duration;
|
|
|
|
element_class->set_inpoint = _set_inpoint;
|
|
|
|
element_class->set_priority = _set_priority;
|
|
|
|
element_class->deep_copy = _deep_copy;
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
klass->create_gnl_object = ges_track_element_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
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_init (GESTrackElement * self)
|
2009-08-06 10:14:37 +00:00
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElementPrivate *priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
|
|
|
GES_TYPE_TRACK_ELEMENT, GESTrackElementPrivate);
|
2010-12-04 18:54:13 +00:00
|
|
|
|
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;
|
2012-11-20 02:42:47 +00:00
|
|
|
}
|
|
|
|
|
2013-01-15 13:52:17 +00:00
|
|
|
static gboolean
|
|
|
|
_set_start (GESTimelineElement * element, GstClockTime start)
|
2012-11-20 21:25:31 +00:00
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElement *object = GES_TRACK_ELEMENT (element);
|
2012-11-20 21:25:31 +00:00
|
|
|
|
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) {
|
2013-01-15 13:52:17 +00:00
|
|
|
if (G_UNLIKELY (start == _START (object)))
|
2009-12-11 14:13:19 +00:00
|
|
|
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;
|
2012-04-23 23:20:18 +00:00
|
|
|
|
2013-01-15 13:52:17 +00:00
|
|
|
return TRUE;
|
2010-12-16 17:20:47 +00:00
|
|
|
}
|
|
|
|
|
2013-01-15 13:52:17 +00:00
|
|
|
static gboolean
|
|
|
|
_set_inpoint (GESTimelineElement * element, GstClockTime inpoint)
|
2009-08-06 10:14:37 +00:00
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElement *object = GES_TRACK_ELEMENT (element);
|
2009-08-06 10:14:37 +00:00
|
|
|
|
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) {
|
2013-01-15 13:52:17 +00:00
|
|
|
if (G_UNLIKELY (inpoint == _INPOINT (object)))
|
|
|
|
|
2009-12-11 14:13:19 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2013-01-15 13:52:17 +00:00
|
|
|
static gboolean
|
|
|
|
_set_duration (GESTimelineElement * element, GstClockTime duration)
|
2009-08-06 10:14:37 +00:00
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElement *object = GES_TRACK_ELEMENT (element);
|
|
|
|
GESTrackElementPrivate *priv = object->priv;
|
2012-04-24 00:17:42 +00:00
|
|
|
|
2009-08-07 18:33:40 +00:00
|
|
|
GST_DEBUG ("object:%p, duration:%" GST_TIME_FORMAT,
|
|
|
|
object, GST_TIME_ARGS (duration));
|
|
|
|
|
2013-01-15 13:52:17 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (_MAXDURATION (element)) &&
|
|
|
|
duration > _INPOINT (object) + _MAXDURATION (element))
|
|
|
|
duration = _MAXDURATION (element) - _INPOINT (object);
|
2012-04-24 00:17:42 +00:00
|
|
|
|
|
|
|
if (priv->gnlobject != NULL) {
|
2013-01-15 13:52:17 +00:00
|
|
|
if (G_UNLIKELY (duration == _DURATION (object)))
|
2009-12-11 14:13:19 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2013-01-15 13:52:17 +00:00
|
|
|
static gboolean
|
|
|
|
_set_priority (GESTimelineElement * element, guint32 priority)
|
2010-12-16 17:20:47 +00:00
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElement *object = GES_TRACK_ELEMENT (element);
|
2010-12-16 17:20:47 +00:00
|
|
|
|
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) {
|
2013-01-15 13:52:17 +00:00
|
|
|
if (G_UNLIKELY (priority == _PRIORITY (object)))
|
2010-12-16 18:24:25 +00:00
|
|
|
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
|
|
|
|
2013-01-15 13:52:17 +00:00
|
|
|
return TRUE;
|
2010-12-16 17:20:47 +00:00
|
|
|
}
|
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* ges_track_element_set_active:
|
|
|
|
* @object: a #GESTrackElement
|
2010-12-16 14:00:46 +00:00
|
|
|
* @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
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_set_active (GESTrackElement * object, gboolean active)
|
2009-09-30 14:40:59 +00:00
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_ELEMENT (object), FALSE);
|
2012-04-23 23:20:18 +00:00
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2012-12-20 23:23:54 +00:00
|
|
|
void
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_set_track_type (GESTrackElement * object, GESTrackType type)
|
2012-12-20 23:23:54 +00:00
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
g_return_if_fail (GES_IS_TRACK_ELEMENT (object));
|
2012-12-20 23:23:54 +00:00
|
|
|
|
|
|
|
if (object->priv->track_type != type) {
|
|
|
|
object->priv->track_type = type;
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_TRACK_TYPE]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GESTrackType
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_get_track_type (GESTrackElement * object)
|
2012-12-20 23:23:54 +00:00
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_ELEMENT (object), GES_TRACK_TYPE_UNKNOWN);
|
2012-12-20 23:23:54 +00:00
|
|
|
|
|
|
|
return object->priv->track_type;
|
|
|
|
}
|
|
|
|
|
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,
|
2013-02-15 02:34:48 +00:00
|
|
|
GESTrackElement * track_element)
|
2009-09-30 14:43:12 +00:00
|
|
|
{
|
|
|
|
guint64 start;
|
2010-07-08 10:35:41 +00:00
|
|
|
|
2009-09-30 14:43:12 +00:00
|
|
|
g_object_get (gnlobject, "start", &start, NULL);
|
|
|
|
|
|
|
|
GST_DEBUG ("gnlobject start : %" GST_TIME_FORMAT " current : %"
|
2013-02-15 02:34:48 +00:00
|
|
|
GST_TIME_FORMAT, GST_TIME_ARGS (start),
|
|
|
|
GST_TIME_ARGS (_START (track_element)));
|
2009-09-30 14:43:12 +00:00
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
if (start != _START (track_element)) {
|
|
|
|
_START (track_element) = start;
|
|
|
|
g_object_notify (G_OBJECT (track_element), "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
|
2013-02-15 02:34:48 +00:00
|
|
|
G_GNUC_UNUSED, GESTrackElement * track_element)
|
2011-02-08 14:29:21 +00:00
|
|
|
{
|
2013-02-15 02:34:48 +00:00
|
|
|
g_signal_emit (track_element, ges_track_element_signals[DEEP_NOTIFY], 0,
|
2011-02-08 14:29:21 +00:00
|
|
|
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),
|
2013-01-26 15:31:33 +00:00
|
|
|
GES_TRACK_ELEMENT (user_data));
|
2011-02-08 14:29:21 +00:00
|
|
|
|
|
|
|
g_free (signame);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-26 15:31:33 +00:00
|
|
|
connect_properties_signals (GESTrackElement * object)
|
2011-02-08 14:29:21 +00:00
|
|
|
{
|
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,
|
2013-02-15 02:34:48 +00:00
|
|
|
GParamSpec * arg G_GNUC_UNUSED, GESTrackElement * track_element)
|
2009-09-30 14:43:12 +00:00
|
|
|
{
|
2013-01-15 13:52:17 +00:00
|
|
|
guint64 inpoint;
|
2010-07-08 10:35:41 +00:00
|
|
|
|
2013-01-15 13:52:17 +00:00
|
|
|
g_object_get (gnlobject, "media-start", &inpoint, NULL);
|
2009-09-30 14:43:12 +00:00
|
|
|
|
|
|
|
GST_DEBUG ("gnlobject in-point : %" GST_TIME_FORMAT " current : %"
|
2013-02-15 02:34:48 +00:00
|
|
|
GST_TIME_FORMAT, GST_TIME_ARGS (inpoint),
|
|
|
|
GST_TIME_ARGS (_INPOINT (track_element)));
|
2009-09-30 14:43:12 +00:00
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
if (inpoint != _INPOINT (track_element)) {
|
|
|
|
_INPOINT (track_element) = inpoint;
|
|
|
|
g_object_notify (G_OBJECT (track_element), "in-point");
|
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,
|
2013-02-15 02:34:48 +00:00
|
|
|
GESTrackElement * track_element)
|
2009-09-30 14:43:12 +00:00
|
|
|
{
|
2009-11-25 12:11:32 +00:00
|
|
|
guint32 priority;
|
2010-07-08 10:35:41 +00:00
|
|
|
|
2009-09-30 14:43:12 +00:00
|
|
|
g_object_get (gnlobject, "priority", &priority, NULL);
|
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
GST_DEBUG ("gnlobject priority : %d current : %d", priority,
|
|
|
|
_PRIORITY (track_element));
|
2009-09-30 14:43:12 +00:00
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
if (priority != _PRIORITY (track_element)) {
|
|
|
|
_PRIORITY (track_element) = priority;
|
|
|
|
g_object_notify (G_OBJECT (track_element), "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,
|
2013-02-15 02:34:48 +00:00
|
|
|
GESTrackElement * track_element)
|
2009-09-30 14:43:12 +00:00
|
|
|
{
|
|
|
|
guint64 duration;
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElementClass *klass;
|
2010-07-08 10:35:41 +00:00
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
klass = GES_TRACK_ELEMENT_GET_CLASS (track_element);
|
2010-07-08 10:35:41 +00:00
|
|
|
|
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 : %"
|
2013-01-15 13:52:17 +00:00
|
|
|
GST_TIME_FORMAT, GST_TIME_ARGS (duration),
|
2013-02-15 02:34:48 +00:00
|
|
|
GST_TIME_ARGS (_DURATION (track_element)));
|
2009-09-30 14:43:12 +00:00
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
if (duration != _DURATION (track_element)) {
|
|
|
|
_DURATION (track_element) = duration;
|
2010-07-08 10:35:41 +00:00
|
|
|
if (klass->duration_changed)
|
2013-02-15 02:34:48 +00:00
|
|
|
klass->duration_changed (track_element, duration);
|
|
|
|
g_object_notify (G_OBJECT (track_element), "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,
|
2013-02-15 02:34:48 +00:00
|
|
|
GESTrackElement * track_element)
|
2009-09-30 14:43:12 +00:00
|
|
|
{
|
|
|
|
gboolean active;
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElementClass *klass;
|
2010-07-08 10:35:41 +00:00
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
klass = GES_TRACK_ELEMENT_GET_CLASS (track_element);
|
2010-07-08 10:35:41 +00:00
|
|
|
|
2009-09-30 14:43:12 +00:00
|
|
|
g_object_get (gnlobject, "active", &active, NULL);
|
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
GST_DEBUG ("gnlobject active : %d current : %d", active,
|
|
|
|
track_element->active);
|
2009-09-30 14:43:12 +00:00
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
if (active != track_element->active) {
|
|
|
|
track_element->active = active;
|
2010-07-08 10:35:41 +00:00
|
|
|
if (klass->active_changed)
|
2013-02-15 02:34:48 +00:00
|
|
|
klass->active_changed (track_element, 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 *
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_create_gnl_object_func (GESTrackElement * self)
|
2009-08-06 15:38:43 +00:00
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElementClass *klass = NULL;
|
2010-12-10 11:15:54 +00:00
|
|
|
GstElement *child = NULL;
|
|
|
|
GstElement *gnlobject;
|
2009-08-06 15:38:43 +00:00
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
klass = GES_TRACK_ELEMENT_GET_CLASS (self);
|
2010-12-10 11:15:54 +00:00
|
|
|
|
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:
|
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
GST_ERROR ("No GESTrackElement::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
|
2013-01-26 15:31:33 +00:00
|
|
|
ensure_gnl_object (GESTrackElement * object)
|
2009-08-06 15:38:43 +00:00
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElementClass *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");
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
class = GES_TRACK_ELEMENT_GET_CLASS (object);
|
2009-08-06 15:38:43 +00:00
|
|
|
|
|
|
|
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)
|
2013-01-26 15:31:33 +00:00
|
|
|
res = ges_clip_fill_track_element (object->priv->timelineobj,
|
2012-01-26 10:53:54 +00:00
|
|
|
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
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_set_track (GESTrackElement * object, GESTrack * track)
|
2009-08-06 15:38:43 +00:00
|
|
|
{
|
2013-01-10 21:09:23 +00:00
|
|
|
gboolean ret = TRUE;
|
2009-08-06 15:38:43 +00:00
|
|
|
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);
|
|
|
|
} else {
|
2013-01-10 21:09:23 +00:00
|
|
|
ret = ensure_gnl_object (object);
|
2012-04-17 22:42:41 +00:00
|
|
|
}
|
|
|
|
}
|
2009-08-07 14:43:01 +00:00
|
|
|
|
2013-01-10 21:09:23 +00:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_TRACK]);
|
|
|
|
return ret;
|
2009-08-06 15:38:43 +00:00
|
|
|
}
|
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* ges_track_element_get_track:
|
|
|
|
* @object: a #GESTrackElement
|
2010-12-16 14:00:46 +00:00
|
|
|
*
|
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 *
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_get_track (GESTrackElement * object)
|
2010-12-16 14:00:46 +00:00
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_ELEMENT (object), NULL);
|
2010-12-16 14:00:46 +00:00
|
|
|
|
|
|
|
return object->priv->track;
|
|
|
|
}
|
|
|
|
|
2012-04-05 00:47:04 +00:00
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* ges_track_element_set_clip:
|
|
|
|
* @object: The #GESTrackElement to set the parent to
|
2013-01-20 15:42:29 +00:00
|
|
|
* @clipect: The #GESClip, parent of @clip or %NULL
|
2012-04-05 00:47:04 +00:00
|
|
|
*
|
2013-01-20 15:42:29 +00:00
|
|
|
* Set the #GESClip to which @object belongs.
|
2012-04-05 00:47:04 +00:00
|
|
|
*/
|
2009-08-06 15:38:43 +00:00
|
|
|
void
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_set_clip (GESTrackElement * object, GESClip * clipect)
|
2009-08-06 15:38:43 +00:00
|
|
|
{
|
2013-01-20 15:42:29 +00:00
|
|
|
GST_DEBUG ("object:%p, clip:%p", object, clipect);
|
2009-08-06 15:38:43 +00:00
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
object->priv->timelineobj = clipect;
|
2010-12-16 14:00:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* ges_track_element_get_clip:
|
|
|
|
* @object: a #GESTrackElement
|
2010-12-16 14:00:46 +00:00
|
|
|
*
|
2013-02-08 19:39:18 +00:00
|
|
|
* Get the #GESClip which is controlling this track element
|
2011-01-10 13:28:35 +00:00
|
|
|
*
|
2013-01-20 15:42:29 +00:00
|
|
|
* Returns: (transfer none): the #GESClip which is controlling
|
2013-02-08 19:39:18 +00:00
|
|
|
* this track element
|
2010-12-16 14:00:46 +00:00
|
|
|
*/
|
2013-01-20 15:42:29 +00:00
|
|
|
GESClip *
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_get_clip (GESTrackElement * object)
|
2010-12-16 14:00:46 +00:00
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_ELEMENT (object), NULL);
|
2010-12-16 14:00:46 +00:00
|
|
|
|
|
|
|
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
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* ges_track_element_get_gnlobject:
|
|
|
|
* @object: a #GESTrackElement
|
2010-12-16 14:00:46 +00:00
|
|
|
*
|
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 *
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_get_gnlobject (GESTrackElement * object)
|
2010-12-16 14:00:46 +00:00
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_ELEMENT (object), NULL);
|
2012-05-10 16:40:23 +00:00
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
return object->priv->gnlobject;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* ges_track_element_get_element:
|
|
|
|
* @object: a #GESTrackElement
|
2010-12-16 14:00:46 +00:00
|
|
|
*
|
2013-02-08 19:39:18 +00:00
|
|
|
* Get the #GstElement this track element is controlling within GNonLin.
|
2011-01-10 13:28:35 +00:00
|
|
|
*
|
2013-02-08 19:39:18 +00:00
|
|
|
* Returns: (transfer none): the #GstElement this track element is controlling
|
2010-12-16 14:00:46 +00:00
|
|
|
* within GNonLin.
|
|
|
|
*/
|
|
|
|
GstElement *
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_get_element (GESTrackElement * object)
|
2010-12-16 14:00:46 +00:00
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_ELEMENT (object), NULL);
|
2012-05-10 16:40:23 +00:00
|
|
|
|
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
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_set_locked_internal (GESTrackElement * object,
|
|
|
|
gboolean locked)
|
2011-12-19 10:21:18 +00:00
|
|
|
{
|
|
|
|
object->priv->locked = locked;
|
|
|
|
}
|
|
|
|
|
2010-12-16 15:27:26 +00:00
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* ges_track_element_set_locked:
|
|
|
|
* @object: a #GESTrackElement
|
2010-12-16 15:27:26 +00:00
|
|
|
* @locked: whether the object is lock to its parent
|
|
|
|
*
|
|
|
|
* Set the locking status of the @object in relationship to its controlling
|
2013-01-20 15:42:29 +00:00
|
|
|
* #GESClip. If @locked is %TRUE, then this object will move synchronously
|
|
|
|
* with its controlling #GESClip.
|
2011-05-07 14:59:06 +00:00
|
|
|
*/
|
2010-12-16 15:27:26 +00:00
|
|
|
void
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_set_locked (GESTrackElement * object, gboolean locked)
|
2010-12-16 15:27:26 +00:00
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
g_return_if_fail (GES_IS_TRACK_ELEMENT (object));
|
2011-12-16 08:54:58 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (object, "%s object", locked ? "Locking" : "Unlocking");
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_set_locked_internal (object, locked);
|
2011-12-19 10:21:18 +00:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_LOCKED]);
|
|
|
|
|
2010-12-16 15:27:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* ges_track_element_is_locked:
|
|
|
|
* @object: a #GESTrackElement
|
2010-12-16 15:27:26 +00:00
|
|
|
*
|
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
|
2013-01-20 15:42:29 +00:00
|
|
|
* #GESClip, else %FALSE.
|
2010-12-16 15:27:26 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_is_locked (GESTrackElement * object)
|
2010-12-16 15:27:26 +00:00
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_ELEMENT (object), FALSE);
|
2012-04-23 23:20:18 +00:00
|
|
|
|
2010-12-16 15:27:26 +00:00
|
|
|
return object->priv->locked;
|
|
|
|
}
|
2011-02-03 14:11:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* ges_track_element_is_active:
|
|
|
|
* @object: a #GESTrackElement
|
2011-02-03 14:11:54 +00:00
|
|
|
*
|
|
|
|
* 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
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_is_active (GESTrackElement * object)
|
2011-02-03 14:11:54 +00:00
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_ELEMENT (object), FALSE);
|
2012-04-23 23:20:18 +00:00
|
|
|
|
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
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* ges_track_element_lookup_child:
|
2011-02-25 10:32:44 +00:00
|
|
|
* @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
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_lookup_child (GESTrackElement * object,
|
|
|
|
const gchar * prop_name, GstElement ** element, GParamSpec ** pspec)
|
2011-02-25 10:32:44 +00:00
|
|
|
{
|
|
|
|
GHashTableIter iter;
|
|
|
|
gpointer key, value;
|
|
|
|
gchar **names, *name, *classename;
|
|
|
|
gboolean res;
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElementPrivate *priv;
|
2012-04-23 23:20:18 +00:00
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_ELEMENT (object), FALSE);
|
2012-04-23 23:20:18 +00:00
|
|
|
|
|
|
|
priv = object->priv;
|
2011-02-25 10:32:44 +00:00
|
|
|
|
2012-12-19 13:37:02 +00:00
|
|
|
if (!priv->properties_hashtable)
|
|
|
|
goto prop_hash_not_set;
|
|
|
|
|
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;
|
2012-12-19 13:37:02 +00:00
|
|
|
|
|
|
|
prop_hash_not_set:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (object, "The child properties haven't been set yet");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-02-25 10:32:44 +00:00
|
|
|
}
|
|
|
|
|
2011-02-08 09:25:41 +00:00
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* ges_track_element_set_child_property_by_pspec:
|
|
|
|
* @object: a #GESTrackElement
|
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
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_set_child_property_by_pspec (GESTrackElement * object,
|
2011-02-25 11:13:03 +00:00
|
|
|
GParamSpec * pspec, GValue * value)
|
2011-02-08 09:25:41 +00:00
|
|
|
{
|
2011-02-25 11:13:03 +00:00
|
|
|
GstElement *element;
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElementPrivate *priv;
|
2011-02-25 11:13:03 +00:00
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
g_return_if_fail (GES_IS_TRACK_ELEMENT (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
|
|
|
|
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* ges_track_element_set_child_property_valist:
|
|
|
|
* @object: The #GESTrackElement parent object
|
2011-02-25 11:13:03 +00:00
|
|
|
* @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
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_set_child_property_valist (GESTrackElement * object,
|
2011-02-25 11:13:03 +00:00
|
|
|
const gchar * first_property_name, va_list var_args)
|
|
|
|
{
|
|
|
|
const gchar *name;
|
|
|
|
GParamSpec *pspec;
|
|
|
|
GstElement *element;
|
|
|
|
|
|
|
|
gchar *error = NULL;
|
|
|
|
GValue value = { 0, };
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
g_return_if_fail (GES_IS_TRACK_ELEMENT (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) {
|
2013-01-26 15:31:33 +00:00
|
|
|
if (!ges_track_element_lookup_child (object, name, &element, &pspec))
|
2011-02-25 11:13:03 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* ges_track_element_set_child_properties:
|
|
|
|
* @object: The #GESTrackElement parent object
|
2011-02-25 11:13:03 +00:00
|
|
|
* @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
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_set_child_properties (GESTrackElement * object,
|
2011-02-25 11:13:03 +00:00
|
|
|
const gchar * first_property_name, ...)
|
|
|
|
{
|
|
|
|
va_list var_args;
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
g_return_if_fail (GES_IS_TRACK_ELEMENT (object));
|
2012-04-23 23:20:18 +00:00
|
|
|
|
2011-02-25 11:13:03 +00:00
|
|
|
va_start (var_args, first_property_name);
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_set_child_property_valist (object, first_property_name,
|
2011-02-25 11:13:03 +00:00
|
|
|
var_args);
|
|
|
|
va_end (var_args);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* ges_track_element_get_child_property_valist:
|
|
|
|
* @object: The #GESTrackElement parent object
|
2011-02-25 11:13:03 +00:00
|
|
|
* @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
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_get_child_property_valist (GESTrackElement * object,
|
2011-02-25 11:13:03 +00:00
|
|
|
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) {
|
2013-01-26 15:31:33 +00:00
|
|
|
if (!ges_track_element_lookup_child (object, name, &element, &pspec))
|
2011-02-25 11:13:03 +00:00
|
|
|
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
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* ges_track_element_list_children_properties:
|
|
|
|
* @object: The #GESTrackElement to get the list of children properties from
|
2012-08-15 00:33:57 +00:00
|
|
|
* @n_properties: (out): return location for the length of the returned array
|
2011-02-25 16:10:00 +00:00
|
|
|
*
|
|
|
|
* Gets an array of #GParamSpec* for all configurable properties of the
|
|
|
|
* children of @object.
|
|
|
|
*
|
2012-08-15 00:33:57 +00:00
|
|
|
* Returns: (transfer full) (array length=n_properties): an array of #GParamSpec* which should be freed after use or
|
2011-05-07 14:59:06 +00:00
|
|
|
* %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 **
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_list_children_properties (GESTrackElement * object,
|
2011-02-25 16:10:00 +00:00
|
|
|
guint * n_properties)
|
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElementClass *class;
|
2011-05-06 17:41:38 +00:00
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_ELEMENT (object), NULL);
|
2011-05-06 17:41:38 +00:00
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
class = GES_TRACK_ELEMENT_GET_CLASS (object);
|
2011-02-25 16:10:00 +00:00
|
|
|
|
|
|
|
return class->list_children_properties (object, n_properties);
|
|
|
|
}
|
|
|
|
|
2011-02-25 11:13:03 +00:00
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* ges_track_element_get_child_properties:
|
|
|
|
* @object: The origin #GESTrackElement
|
2011-02-25 11:13:03 +00:00
|
|
|
* @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
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_get_child_properties (GESTrackElement * 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;
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
g_return_if_fail (GES_IS_TRACK_ELEMENT (object));
|
2012-04-23 23:20:18 +00:00
|
|
|
|
2011-02-25 11:13:03 +00:00
|
|
|
va_start (var_args, first_property_name);
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_get_child_property_valist (object, first_property_name,
|
2011-02-25 11:13:03 +00:00
|
|
|
var_args);
|
|
|
|
va_end (var_args);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* ges_track_element_get_child_property_by_pspec:
|
|
|
|
* @object: a #GESTrackElement
|
2011-02-25 11:13:03 +00:00
|
|
|
* @pspec: The #GParamSpec that specifies the property you want to get
|
2012-12-18 22:47:50 +00:00
|
|
|
* @value: (out): return location for the value
|
2011-02-25 11:13:03 +00:00
|
|
|
*
|
|
|
|
* 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
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_get_child_property_by_pspec (GESTrackElement * object,
|
2011-02-25 11:13:03 +00:00
|
|
|
GParamSpec * pspec, GValue * value)
|
|
|
|
{
|
|
|
|
GstElement *element;
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElementPrivate *priv;
|
2011-02-25 11:13:03 +00:00
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
g_return_if_fail (GES_IS_TRACK_ELEMENT (object));
|
2012-04-23 23:20:18 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2012-12-19 13:37:02 +00:00
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* ges_track_element_set_child_property:
|
|
|
|
* @object: The origin #GESTrackElement
|
2012-12-19 13:37:02 +00:00
|
|
|
* @property_name: The name of the property
|
|
|
|
* @value: the value
|
|
|
|
*
|
|
|
|
* Sets a property of a GstElement contained in @object.
|
|
|
|
*
|
2013-01-26 15:31:33 +00:00
|
|
|
* Note that #ges_track_element_set_child_property is really
|
|
|
|
* intended for language bindings, #ges_track_element_set_child_properties
|
2012-12-19 13:37:02 +00:00
|
|
|
* is much more convenient for C programming.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the property was set, %FALSE otherwize
|
|
|
|
*/
|
|
|
|
gboolean
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_set_child_property (GESTrackElement * object,
|
2012-12-19 13:37:02 +00:00
|
|
|
const gchar * property_name, GValue * value)
|
|
|
|
{
|
|
|
|
GParamSpec *pspec;
|
|
|
|
GstElement *element;
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_ELEMENT (object), FALSE);
|
2012-12-19 13:37:02 +00:00
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
if (!ges_track_element_lookup_child (object, property_name, &element, &pspec))
|
2012-12-19 13:37:02 +00:00
|
|
|
goto not_found;
|
|
|
|
|
|
|
|
g_object_set_property (G_OBJECT (element), pspec->name, value);
|
|
|
|
|
|
|
|
g_object_unref (element);
|
|
|
|
g_param_spec_unref (pspec);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
not_found:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (object, "The %s property doesn't exist", property_name);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* ges_track_element_get_child_property:
|
|
|
|
* @object: The origin #GESTrackElement
|
2012-12-19 13:37:02 +00:00
|
|
|
* @property_name: The name of the property
|
|
|
|
* @value: (out): return location for the property value, it will
|
|
|
|
* be initialized if it is initialized with 0
|
|
|
|
*
|
|
|
|
* In general, a copy is made of the property contents and
|
|
|
|
* the caller is responsible for freeing the memory by calling
|
|
|
|
* g_value_unset().
|
|
|
|
*
|
|
|
|
* Gets a property of a GstElement contained in @object.
|
|
|
|
*
|
2013-01-26 15:31:33 +00:00
|
|
|
* Note that #ges_track_element_get_child_property is really
|
|
|
|
* intended for language bindings, #ges_track_element_get_child_properties
|
2012-12-19 13:37:02 +00:00
|
|
|
* is much more convenient for C programming.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the property was found, %FALSE otherwize
|
|
|
|
*/
|
|
|
|
gboolean
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_get_child_property (GESTrackElement * object,
|
2012-12-19 13:37:02 +00:00
|
|
|
const gchar * property_name, GValue * value)
|
|
|
|
{
|
|
|
|
GParamSpec *pspec;
|
|
|
|
GstElement *element;
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_ELEMENT (object), FALSE);
|
2012-12-19 13:37:02 +00:00
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
if (!ges_track_element_lookup_child (object, property_name, &element, &pspec))
|
2012-12-19 13:37:02 +00:00
|
|
|
goto not_found;
|
|
|
|
|
|
|
|
if (G_VALUE_TYPE (value) == G_TYPE_INVALID)
|
|
|
|
g_value_init (value, pspec->value_type);
|
|
|
|
|
|
|
|
g_object_get_property (G_OBJECT (element), pspec->name, value);
|
|
|
|
|
|
|
|
g_object_unref (element);
|
|
|
|
g_param_spec_unref (pspec);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
not_found:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (object, "The %s property doesn't exist", property_name);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-06 17:41:16 +00:00
|
|
|
static GParamSpec **
|
2013-01-26 15:31:33 +00:00
|
|
|
default_list_children_properties (GESTrackElement * object,
|
|
|
|
guint * n_properties)
|
2011-02-25 16:10:00 +00:00
|
|
|
{
|
|
|
|
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;
|
2013-01-22 19:51:25 +00:00
|
|
|
GST_DEBUG_OBJECT (object, "No child properties have been set yet");
|
2011-02-25 16:10:00 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
2012-01-16 12:37:22 +00:00
|
|
|
|
|
|
|
void
|
2013-01-15 13:52:17 +00:00
|
|
|
_deep_copy (GESTimelineElement * element, GESTimelineElement * elementcopy)
|
2012-04-19 04:34:59 +00:00
|
|
|
{
|
|
|
|
GParamSpec **specs;
|
2013-01-15 13:52:17 +00:00
|
|
|
guint n, n_specs;
|
2012-04-19 04:34:59 +00:00
|
|
|
GValue val = { 0 };
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElement *copy = GES_TRACK_ELEMENT (elementcopy);
|
2012-04-19 04:34:59 +00:00
|
|
|
|
2013-01-15 13:52:17 +00:00
|
|
|
ensure_gnl_object (copy);
|
2012-04-19 04:34:59 +00:00
|
|
|
specs =
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_list_children_properties (GES_TRACK_ELEMENT (element),
|
2013-01-15 13:52:17 +00:00
|
|
|
&n_specs);
|
2012-04-19 04:34:59 +00:00
|
|
|
for (n = 0; n < n_specs; ++n) {
|
|
|
|
g_value_init (&val, specs[n]->value_type);
|
2013-01-15 13:52:17 +00:00
|
|
|
g_object_get_property (G_OBJECT (element), specs[n]->name, &val);
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_set_child_property_by_pspec (copy, specs[n], &val);
|
2012-04-19 04:34:59 +00:00
|
|
|
g_value_unset (&val);
|
|
|
|
}
|
|
|
|
|
2012-04-23 23:17:51 +00:00
|
|
|
g_free (specs);
|
2012-04-19 04:34:59 +00:00
|
|
|
}
|
2012-04-24 00:52:45 +00:00
|
|
|
|
|
|
|
/**
|
2013-01-26 15:31:33 +00:00
|
|
|
* ges_track_element_edit:
|
|
|
|
* @object: the #GESTrackElement to edit
|
2012-04-24 00:52:45 +00:00
|
|
|
* @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
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_edit (GESTrackElement * object,
|
2012-04-24 00:52:45 +00:00
|
|
|
GList * layers, GESEditMode mode, GESEdge edge, guint64 position)
|
|
|
|
{
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrack *track = ges_track_element_get_track (object);
|
2012-04-24 00:52:45 +00:00
|
|
|
GESTimeline *timeline;
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
g_return_val_if_fail (GES_IS_TRACK_ELEMENT (object), FALSE);
|
2012-04-23 23:20:18 +00:00
|
|
|
|
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;
|
|
|
|
}
|