)
)
+(define-method set_max_duration
+ (of-object "GESTimelineObject")
+ (c-name "ges_timeline_object_set_max_duration")
+ (return-type "none")
+ (parameters
+ '("guint64" "duration")
+ )
+)
+
+(define-method get_max_duration
+ (of-object "GESTimelineObject")
+ (c-name "ges_timeline_object_get_max_duration")
+ (return-type "guint64")
+)
+
(define-method set_priority
(of-object "GESTimelineObject")
(c-name "ges_timeline_object_set_priority")
(return-type "guint64")
)
+(define-method get_max_duration
+ (of-object "GESTrackObject")
+ (c-name "ges_track_object_get_max_duration")
+ (return-type "guint64")
+)
+
+(define-method set_max_duration
+ (of-object "GESTrackObject")
+ (c-name "ges_track_object_set_max_duration")
+ (return-type "none")
+ (parameters
+ '("guint64" "duration")
+ )
+)
+
(define-method get_duration
(of-object "GESTrackObject")
(c-name "ges_track_object_get_duration")
GESTrackObject
GESTrackObjectClass
ges_track_object_set_duration
+ges_track_object_set_max_duration
ges_track_object_set_inpoint
ges_track_object_set_priority
ges_track_object_set_start
ges_track_object_get_start
ges_track_object_get_inpoint
ges_track_object_get_duration
+ges_track_object_get_max_duration
ges_track_object_get_priority
ges_track_object_is_active
ges_track_object_lookup_child
gboolean mute;
gboolean is_image;
-
- guint64 maxduration;
};
enum
{
PROP_0,
PROP_URI,
- PROP_MAX_DURATION,
PROP_MUTE,
PROP_IS_IMAGE,
};
ges_timeline_filesource_set_uri (GESTimelineFileSource * self, gchar * uri);
static void
+filesource_set_max_duration (GESTimelineObject * object, guint64 maxduration);
+
+static void
ges_timeline_filesource_get_property (GObject * object, guint property_id,
GValue * value, GParamSpec * pspec)
{
case PROP_MUTE:
g_value_set_boolean (value, priv->mute);
break;
- case PROP_MAX_DURATION:
- g_value_set_uint64 (value, priv->maxduration);
- break;
case PROP_IS_IMAGE:
g_value_set_boolean (value, priv->is_image);
break;
case PROP_MUTE:
ges_timeline_filesource_set_mute (tfs, g_value_get_boolean (value));
break;
- case PROP_MAX_DURATION:
- ges_timeline_filesource_set_max_duration (tfs,
- g_value_get_uint64 (value));
- break;
case PROP_IS_IMAGE:
ges_timeline_filesource_set_is_image (tfs, g_value_get_boolean (value));
break;
NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
/**
- * GESTimelineFileSource:max-duration:
- *
- * The maximum duration (in nanoseconds) of the file.
- *
- * If not set before adding the object to a layer, it will be discovered
- * asynchronously. Connect to 'notify::max-duration' to be notified of it.
- */
- g_object_class_install_property (object_class, PROP_MAX_DURATION,
- g_param_spec_uint64 ("max-duration", "Maximum duration",
- "The duration of the file", 0, G_MAXUINT64, GST_CLOCK_TIME_NONE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
- /**
* GESTimelineFileSource:mute:
*
* Whether the sound will be played or not.
timobj_class->create_track_object =
ges_timeline_filesource_create_track_object;
+ timobj_class->set_max_duration = filesource_set_max_duration;
timobj_class->need_fill_track = FALSE;
}
ges_timeline_filesource_set_max_duration (GESTimelineFileSource * self,
guint64 maxduration)
{
- GESTimelineObject *object = GES_TIMELINE_OBJECT (self);
+ ges_timeline_object_set_max_duration (GES_TIMELINE_OBJECT (self),
+ maxduration);
+}
+
+void
+filesource_set_max_duration (GESTimelineObject * object, guint64 maxduration)
+{
GList *tmp, *tckobjs;
- self->priv->maxduration = maxduration;
if (object->duration == GST_CLOCK_TIME_NONE || object->duration == 0) {
/* If we don't have a valid duration, use the max duration */
- g_object_set (self, "duration", self->priv->maxduration - object->inpoint,
- NULL);
+ g_object_set (object, "duration", maxduration - object->inpoint, NULL);
}
- tckobjs = ges_timeline_object_get_track_objects (GES_TIMELINE_OBJECT (self));
+ tckobjs = ges_timeline_object_get_track_objects (object);
for (tmp = tckobjs; tmp; tmp = g_list_next (tmp)) {
g_object_set (tmp->data, "max-duration", maxduration, NULL);
-
- /* We free the list in the same loop */
- g_object_unref (tmp->data);
- g_list_free_1 (tmp);
}
+
+ g_list_free_full (tckobjs, g_object_unref);
}
/**
guint64
ges_timeline_filesource_get_max_duration (GESTimelineFileSource * self)
{
- return self->priv->maxduration;
+ return ges_timeline_object_get_max_duration (GES_TIMELINE_OBJECT (self));
}
/**
ges_timeline_object_create_track_objects_func (GESTimelineObject
* object, GESTrack * track);
+void default_set_max_duration (GESTimelineObject * object, guint64 maxduration);
+
static void
track_object_start_changed_cb (GESTrackObject * child,
GParamSpec * arg G_GNUC_UNUSED, GESTimelineObject * object);
gboolean ignore_notifies;
gboolean is_moving;
+ guint64 maxduration;
+
GList *mappings;
guint nb_effects;
PROP_HEIGHT,
PROP_LAYER,
PROP_SUPPORTED_FORMATS,
+ PROP_MAX_DURATION,
PROP_LAST
};
case PROP_SUPPORTED_FORMATS:
g_value_set_flags (value, tobj->priv->supportedformats);
break;
+ case PROP_MAX_DURATION:
+ g_value_set_uint64 (value, tobj->priv->maxduration);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
ges_timeline_object_set_supported_formats (tobj,
g_value_get_flags (value));
break;
+ case PROP_MAX_DURATION:
+ ges_timeline_object_set_max_duration (tobj, g_value_get_uint64 (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
object_class->get_property = ges_timeline_object_get_property;
object_class->set_property = ges_timeline_object_set_property;
klass->create_track_objects = ges_timeline_object_create_track_objects_func;
+ klass->set_max_duration = default_set_max_duration;
klass->track_object_added = NULL;
klass->track_object_released = NULL;
G_SIGNAL_RUN_FIRST, 0, NULL, NULL, ges_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, GES_TYPE_TRACK_OBJECT);
+ /**
+ * GESTimelineObject:max-duration:
+ *
+ * The maximum duration (in nanoseconds) of the #GESTimelineObject.
+ *
+ * Since: 0.10.XX
+ */
+ g_object_class_install_property (object_class, PROP_MAX_DURATION,
+ g_param_spec_uint64 ("max-duration", "Maximum duration",
+ "The duration of the object", 0, G_MAXUINT64, G_MAXUINT64,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
klass->need_fill_track = TRUE;
}
self->priv->layer = NULL;
self->priv->nb_effects = 0;
self->priv->is_moving = FALSE;
+ self->priv->maxduration = G_MAXUINT64;
}
/**
return klass->create_track_objects (object, track);
}
+/* Default implementation of default_set_max_duration */
+void
+default_set_max_duration (GESTimelineObject * object, guint64 maxduration)
+{
+ GList *tmp;
+ for (tmp = object->priv->trackobjects; tmp; tmp = g_list_next (tmp))
+ g_object_set (tmp->data, "max-duration", maxduration, NULL);
+}
+
/*
* default implementation of GESTimelineObjectClass::create_track_objects
*/
ges_track_object_set_start (trobj, object->start);
ges_track_object_set_duration (trobj, object->duration);
ges_track_object_set_inpoint (trobj, object->inpoint);
+ ges_track_object_set_max_duration (trobj, object->priv->maxduration);
if (klass->track_object_added) {
GST_DEBUG ("Calling track_object_added subclass method");
}
}
+/**
+ * ges_timeline_object_get_max_duration:
+ * @object: The #GESTimelineObject to retrieve max duration from
+ *
+ * Get the max duration of @object.
+ *
+ * Returns: The max duration of @object
+ *
+ * Since: 0.10.XX
+ */
+guint64
+ges_timeline_object_get_max_duration (GESTimelineObject * object)
+{
+ g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), 0);
+
+ return object->priv->maxduration;
+}
+
+/**
+ * ges_timeline_object_set_max_duration:
+ * @object: The #GESTimelineObject to retrieve max duration from
+ * @maxduration: The maximum duration of @object
+ *
+ * Returns: Set the max duration of @object
+ *
+ * Since: 0.10.XX
+ */
+void
+ges_timeline_object_set_max_duration (GESTimelineObject * object,
+ guint64 maxduration)
+{
+ GESTimelineObjectClass *klass = GES_TIMELINE_OBJECT_GET_CLASS (object);
+
+ g_return_if_fail (GES_IS_TIMELINE_OBJECT (object));
+
+ object->priv->maxduration = maxduration;
+ klass->set_max_duration (object, maxduration);
+}
+
static void
update_height (GESTimelineObject * object)
{
* @need_fill_track: Set to TRUE if @fill_track_object needs to be called.
* @track_object_added: Should be overridden by subclasses if they need to perform an
* operation when a #GESTrackObject is added. Since: 0.10.2
- * @track_object_released: Should be overridden by subclassed if they need to perform
+ * @track_object_released: Should be overridden by subclasses if they need to perform
* action when a #GESTrackObject is released. Since: 0.10.2
+ * @set_max_duration: Should be overridden by subclasses if they need to perform
+ * action when a changing the maximum duration. Since: 0.10.XX
*
* Subclasses can override the @create_track_object and @fill_track_object methods.
*/
GESTrackObject *tck_object);
void (*track_object_released) (GESTimelineObject *object,
GESTrackObject *tck_object);
+ void (*set_max_duration ) (GESTimelineObject *object,
+ guint64 maxduration);
/*< private >*/
/* Padding for API extension */
- gpointer _ges_reserved[GES_PADDING - 2];
+ gpointer _ges_reserved[GES_PADDING - 3];
};
GType ges_timeline_object_get_type (void);
guint64 inpoint);
void ges_timeline_object_set_duration (GESTimelineObject * object,
guint64 duration);
+void ges_timeline_object_set_max_duration (GESTimelineObject * object,
+ guint64 maxduration);
void ges_timeline_object_set_priority (GESTimelineObject * object,
guint priority);
+guint64 ges_timeline_object_get_max_duration (GESTimelineObject * object);
+
void ges_timeline_object_set_layer (GESTimelineObject * object,
GESTimelineLayer * layer);
struct _GESTrackFileSourcePrivate
{
- guint64 maxduration;
+ void *dummy;
};
enum
{
PROP_0,
- PROP_URI,
- PROP_MAX_DURATION
+ PROP_URI
};
static void
case PROP_URI:
g_value_set_string (value, tfs->uri);
break;
- case PROP_MAX_DURATION:
- g_value_set_uint64 (value, tfs->priv->maxduration);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
case PROP_URI:
tfs->uri = g_value_dup_string (value);
break;
- case PROP_MAX_DURATION:
- tfs->priv->maxduration = g_value_get_uint64 (value);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
object_class->dispose = ges_track_filesource_dispose;
/**
- * GESTrackFileSource:max-duration:
- *
- * The maximum duration (in nanoseconds) of the file.
- *
- * If not set before adding the object to a layer, it will be discovered
- * asynchronously. Connect to 'notify::max-duration' to be notified of it.
- */
- g_object_class_install_property (object_class, PROP_MAX_DURATION,
- g_param_spec_uint64 ("max-duration", "Maximum duration",
- "The duration of the file", 0, G_MAXUINT64, GST_CLOCK_TIME_NONE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
- /**
* GESTrackFileSource:uri
*
* The location of the file/resource to use.
gboolean valid;
+ guint64 maxduration;
+
gboolean locked; /* If TRUE, then moves in sync with its controlling
* GESTimelineObject */
};
PROP_PRIORITY,
PROP_ACTIVE,
PROP_LOCKED,
+ PROP_MAX_DURATION,
PROP_LAST
};
case PROP_LOCKED:
g_value_set_boolean (value, ges_track_object_is_locked (tobj));
break;
+ case PROP_MAX_DURATION:
+ g_value_set_uint64 (value, tobj->priv->maxduration);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
case PROP_LOCKED:
ges_track_object_set_locked_internal (tobj, g_value_get_boolean (value));
break;
+ case PROP_MAX_DURATION:
+ ges_track_object_set_max_duration (tobj, g_value_get_uint64 (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
properties[PROP_LOCKED]);
/**
+ * 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",
+ "The duration of the object", 0, G_MAXUINT64, G_MAXUINT64,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+ /**
* GESTrackObject::deep-notify:
* @track_object: a #GESTrackObject
* @prop_object: the object that originated the signal
return object->priv->track;
}
-
void
ges_track_object_set_timeline_object (GESTrackObject * object,
GESTimelineObject * tlobj)
return NULL;
}
}
+
+/**
+ * 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;
+}
void ges_track_object_set_duration (GESTrackObject * object,
guint64 duration);
+void ges_track_object_set_max_duration (GESTrackObject * object,
+ guint64 maxduration);
+
void ges_track_object_set_priority (GESTrackObject * object,
guint32 priority);
guint64 ges_track_object_get_start (GESTrackObject * object);
guint64 ges_track_object_get_inpoint (GESTrackObject * object);
guint64 ges_track_object_get_duration (GESTrackObject * object);
+guint64 ges_track_object_get_max_duration (GESTrackObject * object);
guint32 ges_track_object_get_priority (GESTrackObject * object);
gboolean ges_track_object_is_active (GESTrackObject * object);
KEY ("Object0", "duration", "2000000000");
KEY ("Object0", "priority", "2");
KEY ("Object0", "supported-formats", "GES_TRACK_TYPE_UNKNOWN");
+ KEY ("Object0", "max-duration", "18446744073709551615");
KEY ("Object0", "mute", "false");
KEY ("Object0", "vpattern", "100% Black");
KEY ("Object0", "freq", "440");
KEY ("Object1", "duration", "500000000");
KEY ("Object1", "priority", "1");
KEY ("Object1", "supported-formats", "GES_TRACK_TYPE_UNKNOWN");
+ KEY ("Object1", "max-duration", "18446744073709551615");
KEY ("Object1", "vtype", "A bar moves from left to right");
COMPARE;
KEY ("Object2", "duration", "2000000000");
KEY ("Object2", "priority", "3");
KEY ("Object2", "supported-formats", "GES_TRACK_TYPE_UNKNOWN");
+ KEY ("Object2", "max-duration", "18446744073709551615");
KEY ("Object2", "mute", "false");
KEY ("Object2", "vpattern", "100% Black");
KEY ("Object2", "freq", "440");
KEY ("Object3", "duration", "1000000000");
KEY ("Object3", "priority", "0");
KEY ("Object3", "supported-formats", "GES_TRACK_TYPE_UNKNOWN");
+ KEY ("Object3", "max-duration", "18446744073709551615");
KEY ("Object3", "mute", "false");
KEY ("Object3", "text", "\"the\\\\ quick\\\\ brown\\\\ fox\"");
KEY ("Object3", "font-desc", "\"Serif\\\\ 36\"");