From f0359481c04deaa3da745dc4a1b496f46c6c0230 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 15 Jan 2013 10:52:17 -0300 Subject: [PATCH] Add a GESTimelineElement base class + Port GESTrackObject and GESTimelineObject to the new baseclass --- docs/libs/ges-docs.sgml | 1 + docs/libs/ges-sections.txt | 54 +-- ges/Makefile.am | 2 + ges/ges-auto-transition.c | 28 +- ges/ges-internal.h | 17 +- ges/ges-simple-timeline-layer.c | 26 +- ges/ges-timeline-element.c | 593 +++++++++++++++++++++++++++ ges/ges-timeline-element.h | 167 ++++++++ ges/ges-timeline-file-source.c | 79 ++-- ges/ges-timeline-file-source.h | 5 - ges/ges-timeline-layer.c | 23 +- ges/ges-timeline-object.c | 629 ++++++----------------------- ges/ges-timeline-object.h | 68 +--- ges/ges-timeline-test-source.c | 2 +- ges/ges-timeline-text-overlay.c | 2 +- ges/ges-timeline-title-source.c | 2 +- ges/ges-timeline.c | 130 +++--- ges/ges-track-object.c | 489 ++++------------------ ges/ges-track-object.h | 61 +-- ges/ges-track.c | 10 +- ges/ges-types.h | 3 + ges/ges-utils.c | 23 +- ges/ges-xml-formatter.c | 4 +- ges/ges.h | 1 + tests/check/ges/backgroundsource.c | 44 +- tests/check/ges/effects.c | 7 +- tests/check/ges/filesource.c | 26 +- tests/check/ges/layer.c | 601 +++++++++++++-------------- tests/check/ges/overlays.c | 24 +- tests/check/ges/simplelayer.c | 203 +++++----- tests/check/ges/test-utils.h | 5 + tests/check/ges/timelineedition.c | 43 +- tests/check/ges/timelineobject.c | 86 ++-- tests/check/ges/titles.c | 24 +- tests/check/ges/transition.c | 24 +- tests/examples/ges-ui.c | 27 +- 36 files changed, 1706 insertions(+), 1827 deletions(-) create mode 100644 ges/ges-timeline-element.c create mode 100644 ges/ges-timeline-element.h diff --git a/docs/libs/ges-docs.sgml b/docs/libs/ges-docs.sgml index 1b9254b9fa..1a07926ce4 100644 --- a/docs/libs/ges-docs.sgml +++ b/docs/libs/ges-docs.sgml @@ -36,6 +36,7 @@ platform as well as Windows. It is released under the GNU Library General Public Base Classes + diff --git a/docs/libs/ges-sections.txt b/docs/libs/ges-sections.txt index 44349d5fe2..10e7c23b2f 100644 --- a/docs/libs/ges-sections.txt +++ b/docs/libs/ges-sections.txt @@ -93,11 +93,7 @@ GES_TYPE_TRACK GESTrackObject 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_set_active ges_track_object_set_locked ges_track_object_is_locked @@ -105,11 +101,7 @@ ges_track_object_get_track ges_track_object_get_timeline_object ges_track_object_get_gnlobject ges_track_object_get_element -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 ges_track_object_list_children_properties @@ -124,9 +116,6 @@ ges_track_object_get_child_property_by_pspec ges_track_object_edit ges_track_object_copy -GES_TRACK_OBJECT_DURATION -GES_TRACK_OBJECT_INPOINT -GES_TRACK_OBJECT_START GESTrackObjectPrivate ges_track_object_set_timeline_object ges_track_object_set_track @@ -328,6 +317,36 @@ GES_TIMELINE_LAYER_GET_CLASS GES_TYPE_TIMELINE_LAYER +
+ges-timeline-element +GESTimelineElement +GESTimelineElement +GESTimelineElementClass +ges_timeline_element_set_start +ges_timeline_element_set_inpoint +ges_timeline_element_set_duration +ges_timeline_element_set_max_duration +ges_timeline_element_set_priority +ges_timeline_element_ripple +ges_timeline_element_ripple_end +ges_timeline_element_roll_start +ges_timeline_element_roll_end +ges_timeline_element_trim +GES_TIMELINE_ELEMENT_START +GES_TIMELINE_ELEMENT_INPOINT +GES_TIMELINE_ELEMENT_DURATION +GES_TIMELINE_ELEMENT_MAX_DURATION +GES_TIMELINE_ELEMENT_PRIORITY + +GESTimelineElementPrivate +ges_timeline_element_get_type +GES_TYPE_TIMELINE_ELEMENT +GES_TIMELINE_ELEMENT +GES_TIMELINE_ELEMENT_CLASS +GES_IS_TIMELINE_ELEMENT +GES_IS_TIMELINE_ELEMENT_CLASS +GES_TIMELINE_ELEMENT_GET_CLASS +
ges-timeline-object @@ -337,9 +356,6 @@ GESTimelineObjectClass GESCreateTrackObjectFunc GESCreateTrackObjectsFunc GESFillTrackObjectFunc -ges_timeline_object_set_inpoint -ges_timeline_object_set_start -ges_timeline_object_set_duration ges_timeline_object_get_layer ges_timeline_object_find_track_object ges_timeline_object_add_track_object @@ -352,19 +368,10 @@ ges_timeline_object_set_supported_formats ges_timeline_object_get_supported_formats ges_timeline_object_split ges_timeline_object_edit -ges_timeline_object_ripple -ges_timeline_object_ripple_end -ges_timeline_object_roll_start -ges_timeline_object_roll_end -ges_timeline_object_trim_start ges_timeline_object_get_max_duration ges_timeline_object_objects_set_locked ges_timeline_object_set_max_duration -GES_TIMELINE_OBJECT_DURATION -GES_TIMELINE_OBJECT_INPOINT -GES_TIMELINE_OBJECT_PRIORITY -GES_TIMELINE_OBJECT_START GES_TIMELINE_OBJECT_HEIGHT ges_timeline_object_create_track_objects ges_timeline_object_create_track_object @@ -374,7 +381,6 @@ ges_timeline_object_release_track_object ges_timeline_object_get_track_objects ges_timeline_object_set_layer ges_timeline_object_set_moving_from_layer -ges_timeline_object_set_priority ges_timeline_object_lock_track_objects GESTimelineObjectPrivate GES_IS_TIMELINE_OBJECT diff --git a/ges/Makefile.am b/ges/Makefile.am index 92f5953edb..3a136660c9 100644 --- a/ges/Makefile.am +++ b/ges/Makefile.am @@ -56,6 +56,7 @@ libges_@GST_API_VERSION@_la_SOURCES = \ ges-base-xml-formatter.c \ ges-xml-formatter.c \ ges-auto-transition.c \ + ges-timeline-element.c \ ges-utils.c libges_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/ges/ @@ -108,6 +109,7 @@ libges_@GST_API_VERSION@include_HEADERS = \ ges-project.h \ ges-base-xml-formatter.h \ ges-xml-formatter.h \ + ges-timeline-element.h \ ges-utils.h noinst_HEADERS = \ diff --git a/ges/ges-auto-transition.c b/ges/ges-auto-transition.c index 12f2d8014d..cde41ef9c6 100644 --- a/ges/ges-auto-transition.c +++ b/ges/ges-auto-transition.c @@ -41,19 +41,19 @@ neighbour_changed_cb (GESTimelineObject * obj, GParamSpec * arg G_GNUC_UNUSED, { gint64 new_duration; - if (self->next_source->priority / LAYER_HEIGHT != - self->previous_source->priority / LAYER_HEIGHT) { + if (_PRIORITY (self->next_source) / LAYER_HEIGHT != + _PRIORITY (self->previous_source) / LAYER_HEIGHT) { GST_DEBUG_OBJECT (self, "Destroy changed layer"); g_signal_emit (self, auto_transition_signals[DESTROY_ME], 0); return; } new_duration = - (self->previous_source->start + self->previous_source->duration) - - self->next_source->start; + (_START (self->previous_source) + + _DURATION (self->previous_source)) - _START (self->next_source); - if (new_duration <= 0 || new_duration >= self->previous_source->duration || - new_duration >= self->next_source->duration) { + if (new_duration <= 0 || new_duration >= _DURATION (self->previous_source) + || new_duration >= _DURATION (self->next_source)) { GST_DEBUG_OBJECT (self, "Destroy %" G_GINT64_FORMAT " not a valid duration", new_duration); @@ -61,9 +61,10 @@ neighbour_changed_cb (GESTimelineObject * obj, GParamSpec * arg G_GNUC_UNUSED, return; } - ges_timeline_object_set_start (self->timeline_transition, - self->next_source->start); - ges_timeline_object_set_duration (self->timeline_transition, new_duration); + _set_start0 (GES_TIMELINE_ELEMENT (self->timeline_transition), + _START (self->next_source)); + _set_duration0 (GES_TIMELINE_ELEMENT (self->timeline_transition), + new_duration); } static void @@ -72,8 +73,8 @@ _height_changed_cb (GESTimelineObject * obj, GParamSpec * arg G_GNUC_UNUSED, { /* FIXME This is really not smart and we should properly implement timelineobject * priority management at the TimelineLayer level */ - ges_timeline_object_set_priority (self->next_timeline_object, - self->previous_timeline_object->priority + + _set_priority0 (GES_TIMELINE_ELEMENT (self->next_timeline_object), + _PRIORITY (self->previous_timeline_object) + self->previous_timeline_object->height); } @@ -172,8 +173,9 @@ ges_auto_transition_new (GESTrackObject * transition, " in layer nb %i, start: %" GST_TIME_FORMAT " duration: %" GST_TIME_FORMAT, transition, next_source, previous_source, ges_timeline_layer_get_priority (ges_timeline_object_get_layer - (self->previous_timeline_object)), GST_TIME_ARGS (transition->start), - GST_TIME_ARGS (transition->duration)); + (self->previous_timeline_object)), + GST_TIME_ARGS (_START (transition)), + GST_TIME_ARGS (_DURATION (transition))); self->key = g_strdup_printf ("%p%p", self->previous_source, self->next_source); diff --git a/ges/ges-internal.h b/ges/ges-internal.h index 71deb19df8..0568ba5cc3 100644 --- a/ges/ges-internal.h +++ b/ges/ges-internal.h @@ -26,6 +26,7 @@ #include "ges-timeline.h" #include "ges-track-object.h" +#include "ges-timeline-element.h" #include "ges-asset.h" #include "ges-base-xml-formatter.h" @@ -35,6 +36,16 @@ GST_DEBUG_CATEGORY_EXTERN (_ges_debug); #define LAYER_HEIGHT 1000 +#define _START(obj) GES_TIMELINE_ELEMENT_START (obj) +#define _INPOINT(obj) GES_TIMELINE_ELEMENT_INPOINT (obj) +#define _DURATION(obj) GES_TIMELINE_ELEMENT_DURATION (obj) +#define _MAXDURATION(obj) GES_TIMELINE_ELEMENT_MAX_DURATION (obj) +#define _PRIORITY(obj) GES_TIMELINE_ELEMENT_PRIORITY (obj) +#define _set_start0 ges_timeline_element_set_start +#define _set_inpoint0 ges_timeline_element_set_inpoint +#define _set_duration0 ges_timeline_element_set_duration +#define _set_priority0 ges_timeline_element_set_priority + G_GNUC_INTERNAL gboolean timeline_ripple_object (GESTimeline *timeline, GESTrackObject *obj, GList * layers, GESEdge edge, @@ -212,9 +223,7 @@ G_GNUC_INTERNAL void _init_standard_transition_assets (void); G_GNUC_INTERNAL void _init_formatter_assets (void); /* Utilities */ -G_GNUC_INTERNAL gint track_object_start_compare (GESTrackObject * a, - GESTrackObject * b); -G_GNUC_INTERNAL gint timeline_object_start_compare (GESTimelineObject * a, - GESTimelineObject * b); +G_GNUC_INTERNAL gint element_start_compare (GESTimelineElement * a, + GESTimelineElement * b); #endif /* __GES_INTERNAL_H__ */ diff --git a/ges/ges-simple-timeline-layer.c b/ges/ges-simple-timeline-layer.c index 6c22214bed..d03f1251a2 100644 --- a/ges/ges-simple-timeline-layer.c +++ b/ges/ges-simple-timeline-layer.c @@ -184,19 +184,19 @@ gstl_recalculate (GESSimpleTimelineLayer * self) GList *l_next; obj = (GESTimelineObject *) tmp->data; - dur = GES_TIMELINE_OBJECT_DURATION (obj); + dur = _DURATION (obj); height = GES_TIMELINE_OBJECT_HEIGHT (obj); if (GES_IS_TIMELINE_SOURCE (obj)) { GST_LOG ("%p obj: height: %d: priority %d", obj, height, priority); - if (G_UNLIKELY (GES_TIMELINE_OBJECT_START (obj) != pos)) { - ges_timeline_object_set_start (obj, pos); + if (G_UNLIKELY (_START (obj) != pos)) { + _set_start0 (GES_TIMELINE_ELEMENT (obj), pos); } - if (G_UNLIKELY (GES_TIMELINE_OBJECT_PRIORITY (obj) != priority)) { - ges_timeline_object_set_priority (obj, priority); + if (G_UNLIKELY (_PRIORITY (obj) != priority)) { + _set_priority0 (GES_TIMELINE_ELEMENT (obj), priority); } transition_priority = MAX (0, priority - 1); @@ -217,12 +217,11 @@ gstl_recalculate (GESSimpleTimelineLayer * self) g_assert (transition_priority != -1); - if (G_UNLIKELY (GES_TIMELINE_OBJECT_START (obj) != pos)) - ges_timeline_object_set_start (obj, pos); + if (G_UNLIKELY (_START (obj) != pos)) + _set_start0 (GES_TIMELINE_ELEMENT (obj), pos); - if (G_UNLIKELY (GES_TIMELINE_OBJECT_PRIORITY (obj) != - transition_priority)) { - ges_timeline_object_set_priority (obj, transition_priority); + if (G_UNLIKELY (_PRIORITY (obj) != transition_priority)) { + _set_priority0 (GES_TIMELINE_ELEMENT (obj), transition_priority); } /* sanity checks */ @@ -233,20 +232,19 @@ gstl_recalculate (GESSimpleTimelineLayer * self) valid = FALSE; } - if (prev_object && (GES_TIMELINE_OBJECT_DURATION (prev_object) < dur)) { + if (prev_object && (_DURATION (prev_object) < dur)) { GST_ERROR ("transition duration exceeds that of previous neighbor!"); valid = FALSE; } - if (l_next && (GES_TIMELINE_OBJECT_DURATION (l_next->data) < dur)) { + if (l_next && (_DURATION (l_next->data) < dur)) { GST_ERROR ("transition duration exceeds that of next neighbor!"); valid = FALSE; } if (prev_transition) { guint64 start, end; - end = (GES_TIMELINE_OBJECT_DURATION (prev_transition) + - GES_TIMELINE_OBJECT_START (prev_transition)); + end = (_DURATION (prev_transition) + _START (prev_transition)); start = pos; diff --git a/ges/ges-timeline-element.c b/ges/ges-timeline-element.c new file mode 100644 index 0000000000..30c4549924 --- /dev/null +++ b/ges/ges-timeline-element.c @@ -0,0 +1,593 @@ +/* gst-editing-services + * Copyright (C) <2013> Thibault Saunier + * <2013> Collabora Ltd. + * + * gst-editing-services is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * gst-editing-services 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "ges-timeline-element.h" +#include "ges-extractable.h" +#include "ges-meta-container.h" + +static void +extractable_set_asset (GESExtractable * extractable, GESAsset * asset) +{ + GES_TIMELINE_ELEMENT (extractable)->asset = asset; +} + +static void +ges_extractable_interface_init (GESExtractableInterface * iface) +{ + iface->set_asset = extractable_set_asset; +} + +G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GESTimelineElement, ges_timeline_element, + G_TYPE_INITIALLY_UNOWNED, + G_IMPLEMENT_INTERFACE (GES_TYPE_EXTRACTABLE, ges_extractable_interface_init) + G_IMPLEMENT_INTERFACE (GES_TYPE_META_CONTAINER, NULL)); + +enum +{ + PROP_0, + PROP_START, + PROP_INPOINT, + PROP_DURATION, + PROP_MAX_DURATION, + PROP_PRIORITY, + PROP_LAST +}; + +static GParamSpec *properties[PROP_LAST] = { NULL, }; + +struct _GESTimelineElementPrivate +{ + gpointer dummy; +}; + +static void +_get_property (GObject * object, guint property_id, + GValue * value, GParamSpec * pspec) +{ + GESTimelineElement *self = GES_TIMELINE_ELEMENT (object); + + switch (property_id) { + case PROP_START: + g_value_set_uint64 (value, self->start); + break; + case PROP_INPOINT: + g_value_set_uint64 (value, self->inpoint); + break; + case PROP_DURATION: + g_value_set_uint64 (value, self->duration); + break; + case PROP_MAX_DURATION: + g_value_set_uint64 (value, self->maxduration); + break; + case PROP_PRIORITY: + g_value_set_uint (value, self->priority); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (self, property_id, pspec); + } +} + +static void +_set_property (GObject * object, guint property_id, + const GValue * value, GParamSpec * pspec) +{ + GESTimelineElement *self = GES_TIMELINE_ELEMENT (object); + + switch (property_id) { + case PROP_START: + ges_timeline_element_set_start (self, g_value_get_uint64 (value)); + break; + case PROP_INPOINT: + ges_timeline_element_set_inpoint (self, g_value_get_uint64 (value)); + break; + case PROP_DURATION: + ges_timeline_element_set_duration (self, g_value_get_uint64 (value)); + break; + case PROP_PRIORITY: + ges_timeline_element_set_priority (self, g_value_get_uint (value)); + break; + case PROP_MAX_DURATION: + ges_timeline_element_set_max_duration (self, g_value_get_uint64 (value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (self, property_id, pspec); + } +} + +static void +ges_timeline_element_init (GESTimelineElement * ges_timeline_element) +{ + +} + +static void +ges_timeline_element_finalize (GObject * self) +{ + G_OBJECT_CLASS (ges_timeline_element_parent_class)->finalize (self); +} + +static void +ges_timeline_element_class_init (GESTimelineElementClass * klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->get_property = _get_property; + object_class->set_property = _set_property; + + /** + * GESTimelineElement:start: + * + * The position of the object in its container (in nanoseconds). + */ + properties[PROP_START] = g_param_spec_uint64 ("start", "Start", + "The position in the container", 0, G_MAXUINT64, 0, G_PARAM_READWRITE); + + /** + * GESTimelineElement:in-point: + * + * The in-point at which this #GESTimelineElement will start outputting data + * from its contents (in nanoseconds). + * + * Ex : an in-point of 5 seconds means that the first outputted buffer will + * be the one located 5 seconds in the controlled resource. + */ + properties[PROP_INPOINT] = + g_param_spec_uint64 ("in-point", "In-point", "The in-point", 0, + G_MAXUINT64, 0, G_PARAM_READWRITE); + + /** + * GESTimelineElement:duration: + * + * The duration (in nanoseconds) which will be used in the container + */ + properties[PROP_DURATION] = + g_param_spec_uint64 ("duration", "Duration", "The duration to use", 0, + G_MAXUINT64, GST_CLOCK_TIME_NONE, G_PARAM_READWRITE); + + /** + * GESTimelineElement:max-duration: + * + * The maximum duration (in nanoseconds) of the #GESTimelineElement. + * + * Since: 0.10.XX + */ + properties[PROP_MAX_DURATION] = + g_param_spec_uint64 ("max-duration", "Maximum duration", + "The maximum duration of the object", 0, G_MAXUINT64, G_MAXUINT64, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT); + + /** + * GESTimelineElement:priority: + * + * The layer priority of the object. + */ + properties[PROP_PRIORITY] = g_param_spec_uint ("priority", "Priority", + "The priority of the object", 0, G_MAXUINT, 0, G_PARAM_READWRITE); + + g_object_class_install_properties (object_class, PROP_LAST, properties); + + object_class->finalize = ges_timeline_element_finalize; + + klass->set_start = NULL; + klass->set_inpoint = NULL; + klass->set_duration = NULL; + klass->set_max_duration = NULL; + klass->set_priority = NULL; + + klass->ripple = NULL; + klass->ripple_end = NULL; + klass->roll_start = NULL; + klass->roll_end = NULL; + klass->trim = NULL; +} + +/********************************************* + * API implementation * + *********************************************/ + +/** + * ges_timeline_element_set_start: + * @self: a #GESTimelineElement + * @start: the position in #GstClockTime + * + * Set the position of the object in its containing layer + * + * Note that if the timeline snap-distance property of the timeline containing + * @self is set, @self will properly snap to its neighboors. + */ +void +ges_timeline_element_set_start (GESTimelineElement * self, GstClockTime start) +{ + GESTimelineElementClass *klass; + + g_return_if_fail (GES_IS_TIMELINE_ELEMENT (self)); + + klass = GES_TIMELINE_ELEMENT_GET_CLASS (self); + + GST_DEBUG_OBJECT (self, "current start: %" GST_TIME_FORMAT, + " new start: %" GST_TIME_FORMAT, GST_TIME_ARGS (start), + GST_TIME_ARGS (GES_TIMELINE_ELEMENT_START (self))); + + if (klass->set_start) { + if (klass->set_start (self, start)) { + self->start = start; + g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_START]); + } + + return; + } + + GST_WARNING_OBJECT (self, "No set_start virtual method implementation" + " on class %s. Can not set start %" GST_TIME_FORMAT, + G_OBJECT_CLASS_NAME (klass), GST_TIME_ARGS (start)); +} + +/** + * ges_timeline_element_set_inpoint: + * @self: a #GESTimelineElement + * @inpoint: the in-point in #GstClockTime + * + * Set the in-point, that is the moment at which the @self will start + * outputting data from its contents. + */ +void +ges_timeline_element_set_inpoint (GESTimelineElement * self, + GstClockTime inpoint) +{ + GESTimelineElementClass *klass; + + g_return_if_fail (GES_IS_TIMELINE_ELEMENT (self)); + + GST_DEBUG_OBJECT (self, "current inpoint: %" GST_TIME_FORMAT, + " new inpoint: %" GST_TIME_FORMAT, GST_TIME_ARGS (inpoint), + GST_TIME_ARGS (GES_TIMELINE_ELEMENT_INPOINT (self))); + + klass = GES_TIMELINE_ELEMENT_GET_CLASS (self); + + if (klass->set_inpoint) { + if (klass->set_inpoint (self, inpoint)) { + self->inpoint = inpoint; + g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_INPOINT]); + } + + return; + } + + GST_WARNING_OBJECT (self, "No set_inpoint virtual method implementation" + " on class %s. Can not set inpoint %" GST_TIME_FORMAT, + G_OBJECT_CLASS_NAME (klass), GST_TIME_ARGS (inpoint)); +} + +/** + * ges_timeline_element_set_max_duration: + * @self: a #GESTimelineElement + * @maxduration: the maximum duration in #GstClockTime + * + * Set the maximun duration of the object + */ +void +ges_timeline_element_set_max_duration (GESTimelineElement * self, + GstClockTime maxduration) +{ + GESTimelineElementClass *klass; + + g_return_if_fail (GES_IS_TIMELINE_ELEMENT (self)); + + klass = GES_TIMELINE_ELEMENT_GET_CLASS (self); + + GST_DEBUG_OBJECT (self, "current duration: %" GST_TIME_FORMAT, + " new duration: %" GST_TIME_FORMAT, GST_TIME_ARGS (maxduration), + GST_TIME_ARGS (GES_TIMELINE_ELEMENT_MAX_DURATION (self))); + + if (klass->set_max_duration) { + if (klass->set_max_duration (self, maxduration) == FALSE) + return; + + } + + self->maxduration = maxduration; + g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_MAX_DURATION]); +} + +/** + * ges_timeline_element_set_duration: + * @self: a #GESTimelineElement + * @duration: the duration in #GstClockTime + * + * Set the duration of the object + * + * Note that if the timeline snap-distance property of the timeline containing + * @self is set, @self will properly snap to its neighboors. + */ +void +ges_timeline_element_set_duration (GESTimelineElement * self, + GstClockTime duration) +{ + GESTimelineElementClass *klass; + + g_return_if_fail (GES_IS_TIMELINE_ELEMENT (self)); + + klass = GES_TIMELINE_ELEMENT_GET_CLASS (self); + + GST_DEBUG_OBJECT (self, "current duration: %" GST_TIME_FORMAT, + " new duration: %" GST_TIME_FORMAT, GST_TIME_ARGS (duration), + GST_TIME_ARGS (GES_TIMELINE_ELEMENT_DURATION (self))); + + if (klass->set_duration) { + if (klass->set_duration (self, duration)) { + self->duration = duration; + g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_DURATION]); + } + + return; + } + + GST_WARNING_OBJECT (self, "No set_duration virtual method implementation" + " on class %s. Can not set duration %" GST_TIME_FORMAT, + G_OBJECT_CLASS_NAME (klass), GST_TIME_ARGS (duration)); +} + +/** + * ges_timeline_element_set_priority: + * @self: a #GESTimelineElement + * @priority: the priority + * + * Sets the priority of the object within the containing layer + */ +void +ges_timeline_element_set_priority (GESTimelineElement * self, guint32 priority) +{ + GESTimelineElementClass *klass; + + g_return_if_fail (GES_IS_TIMELINE_ELEMENT (self)); + + klass = GES_TIMELINE_ELEMENT_GET_CLASS (self); + + if (klass->set_priority) { + if (klass->set_priority (self, priority)) { + self->priority = priority; + g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PRIORITY]); + } + return; + } + + GST_WARNING_OBJECT (self, "No set_priority virtual method implementation" + " on class %s. Can not set priority %d", G_OBJECT_CLASS_NAME (klass), + priority); +} + +/** + * ges_timeline_element_ripple: + * @self: The #GESTimelineElement to ripple. + * @start: The new start of @self in ripple mode. + * + * Edits @self in ripple mode. It allows you to modify the + * start of @self and move the following neighbours accordingly. + * This will change the overall timeline duration. + * + * Returns: %TRUE if the self as been rippled properly, %FALSE if an error + * occured + */ +gboolean +ges_timeline_element_ripple (GESTimelineElement * self, GstClockTime start) +{ + GESTimelineElementClass *klass; + + g_return_val_if_fail (GES_IS_TIMELINE_ELEMENT (self), FALSE); + + klass = GES_TIMELINE_ELEMENT_GET_CLASS (self); + + if (klass->ripple) + return klass->ripple (self, start); + + GST_WARNING_OBJECT (self, "No ripple virtual method implementation" + " on class %s. Can not ripple to %" GST_TIME_FORMAT, + G_OBJECT_CLASS_NAME (klass), GST_TIME_ARGS (start)); + + return FALSE; +} + +/** + * ges_timeline_element_ripple_end: + * @self: The #GESTimelineElement to ripple. + * @end: The new end (start + duration) of @self in ripple mode. It will + * basically only change the duration of @self. + * + * Edits @self in ripple mode. It allows you to modify the + * duration of a @self and move the following neighbours accordingly. + * This will change the overall timeline duration. + * + * Returns: %TRUE if the self as been rippled properly, %FALSE if an error + * occured + */ +gboolean +ges_timeline_element_ripple_end (GESTimelineElement * self, GstClockTime end) +{ + GESTimelineElementClass *klass; + + g_return_val_if_fail (GES_IS_TIMELINE_ELEMENT (self), FALSE); + + klass = GES_TIMELINE_ELEMENT_GET_CLASS (self); + + if (klass->ripple_end) { + return klass->ripple_end (self, end); + } + + GST_WARNING_OBJECT (self, "No ripple virtual method implementation" + " on class %s. Can not ripple end to %" GST_TIME_FORMAT, + G_OBJECT_CLASS_NAME (klass), GST_TIME_ARGS (end)); + + return FALSE; +} + +/** + * ges_timeline_element_roll_start: + * @self: The #GESTimelineElement to roll + * @start: The new start of @self in roll mode, it will also adapat + * the in-point of @self according + * + * Edits @self in roll mode. It allows you to modify the + * start and inpoint of a @self and "resize" (basicly change the duration + * in this case) of the previous neighbours accordingly. + * This will not change the overall timeline duration. + * + * Returns: %TRUE if the self as been roll properly, %FALSE if an error + * occured + */ +gboolean +ges_timeline_element_roll_start (GESTimelineElement * self, GstClockTime start) +{ + GESTimelineElementClass *klass; + + g_return_val_if_fail (GES_IS_TIMELINE_ELEMENT (self), FALSE); + + klass = GES_TIMELINE_ELEMENT_GET_CLASS (self); + + if (klass->roll_start) { + return klass->roll_start (self, start); + } + + GST_WARNING_OBJECT (self, "No ripple virtual method implementation" + " on class %s. Can not roll to %" GST_TIME_FORMAT, + G_OBJECT_CLASS_NAME (klass), GST_TIME_ARGS (start)); + + return FALSE; +} + +/** + * ges_timeline_element_roll_end: + * @self: The #GESTimelineElement to roll. + * @end: The new end (start + duration) of @self in roll mode + * + * Edits @self in roll mode. It allows you to modify the + * duration of a @self and trim (basicly change the start + inpoint + * in this case) the following neighbours accordingly. + * This will not change the overall timeline duration. + * + * Returns: %TRUE if the self as been rolled properly, %FALSE if an error + * occured + */ +gboolean +ges_timeline_element_roll_end (GESTimelineElement * self, GstClockTime end) +{ + GESTimelineElementClass *klass; + + g_return_val_if_fail (GES_IS_TIMELINE_ELEMENT (self), FALSE); + + klass = GES_TIMELINE_ELEMENT_GET_CLASS (self); + + if (klass->roll_end) + return klass->roll_end (self, end); + + GST_WARNING_OBJECT (self, "No ripple virtual method implementation" + " on class %s. Can not roll end to %" GST_TIME_FORMAT, + G_OBJECT_CLASS_NAME (klass), GST_TIME_ARGS (end)); + + return FALSE; +} + +/** + * ges_timeline_element_trim: + * @self: The #GESTimelineElement to trim. + * @start: The new start of @self in trim mode, will adapt the inpoint + * of @self accordingly + * + * Edits @self in trim mode. It allows you to modify the + * inpoint and start of @self. + * This will not change the overall timeline duration. + * + * Note that to trim the end of an self you can just set its duration. The same way + * as this method, it will take into account the snapping-distance property of the + * timeline in which @self is. + * + * Returns: %TRUE if the self as been trimmed properly, %FALSE if an error + * occured + */ +gboolean +ges_timeline_element_trim (GESTimelineElement * self, GstClockTime start) +{ + GESTimelineElementClass *klass; + + g_return_val_if_fail (GES_IS_TIMELINE_ELEMENT (self), FALSE); + + klass = GES_TIMELINE_ELEMENT_GET_CLASS (self); + + if (klass->trim) + return klass->trim (self, start); + + GST_WARNING_OBJECT (self, "No ripple virtual method implementation" + " on class %s. Can not trim to %" GST_TIME_FORMAT, + G_OBJECT_CLASS_NAME (klass), GST_TIME_ARGS (start)); + + return FALSE; +} + +/** + * ges_timeline_element_copy: + * @self: The #GESTimelineElement to copy + * @deep: whether we want to create the elements @self contains or not + * + * Copies @self + * + * Returns: (transfer floating): The newly create #GESTimelineElement, copied from @self + */ +GESTimelineElement * +ges_timeline_element_copy (GESTimelineElement * self, gboolean deep) +{ + GParameter *params; + GParamSpec **specs; + GESTimelineElementClass *klass; + guint n, n_specs, n_params; + + GESTimelineElement *ret = NULL; + + g_return_val_if_fail (GES_IS_TIMELINE_ELEMENT (self), FALSE); + + klass = GES_TIMELINE_ELEMENT_GET_CLASS (self); + + specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (self), &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 (self), specs[n]->name, + ¶ms[n_params].value); + ++n_params; + } + } + + ret = g_object_newv (G_OBJECT_TYPE (self), n_params, params); + + g_free (specs); + g_free (params); + + + if (deep) { + if (klass->deep_copy) + klass->deep_copy (self, ret); + else + GST_WARNING_OBJECT (self, "No deep_copy virtual method implementation" + " on class %s. Can not finish the copy", G_OBJECT_CLASS_NAME (klass)); + } + + return ret; +} diff --git a/ges/ges-timeline-element.h b/ges/ges-timeline-element.h new file mode 100644 index 0000000000..74b784e01e --- /dev/null +++ b/ges/ges-timeline-element.h @@ -0,0 +1,167 @@ +/* + * gst-editing-services + * Copyright (C) <2013> Thibault Saunier + * <2013> Collabora Ltd. + * + * gst-editing-services is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * gst-editing-services 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef _GES_TIMELINE_ELEMENT_H_ +#define _GES_TIMELINE_ELEMENT_H_ + +#include +#include +#include "ges-enums.h" +#include "ges-types.h" + +G_BEGIN_DECLS + +#define GES_TYPE_TIMELINE_ELEMENT (ges_timeline_element_get_type ()) +#define GES_TIMELINE_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_TIMELINE_ELEMENT, GESTimelineElement)) +#define GES_TIMELINE_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GES_TYPE_TIMELINE_ELEMENT, GESTimelineElementClass)) +#define GES_IS_TIMELINE_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GES_TYPE_TIMELINE_ELEMENT)) +#define GES_IS_TIMELINE_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_TIMELINE_ELEMENT)) +#define GES_TIMELINE_ELEMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_TIMELINE_ELEMENT, GESTimelineElementClass)) + +typedef struct _GESTimelineElementPrivate GESTimelineElementPrivate; + +/** + * GES_TIMELINE_ELEMENT_START: + * @obj: a #GESTimelineElement + * + * The start position of the object (in nanoseconds). + */ +#define GES_TIMELINE_ELEMENT_START(obj) (((GESTimelineElement*)obj)->start) + +/** + * GES_TIMELINE_ELEMENT_INPOINT: + * @obj: a #GESTimelineElement + * + * The in-point of the object (in nanoseconds). + */ +#define GES_TIMELINE_ELEMENT_INPOINT(obj) (((GESTimelineElement*)obj)->inpoint) + +/** + * GES_TIMELINE_ELEMENT_DURATION: + * @obj: a #GESTimelineElement + * + * The duration of the object (in nanoseconds). + */ +#define GES_TIMELINE_ELEMENT_DURATION(obj) (((GESTimelineElement*)obj)->duration) + +/** + * GES_TIMELINE_ELEMENT_MAX_DURATION: + * @obj: a #GESTimelineElement + * + * The maximun duration of the object (in nanoseconds). + */ +#define GES_TIMELINE_ELEMENT_MAX_DURATION(obj) (((GESTimelineElement*)obj)->maxduration) + +/** + * GES_TIMELINE_ELEMENT_PRIORITY: + * @obj: a #GESTimelineElement + * + * The priority of the object. + */ +#define GES_TIMELINE_ELEMENT_PRIORITY(obj) (((GESTimelineElement*)obj)->priority) + + +/** + * GESTimelineElementClass: + * @set_start: method to set the start of a #GESTimelineElement + * @set_duration: method to set the duration of a #GESTimelineElement + * @set_inpoint: method to set the inpoint of a #GESTimelineElement + * @set_max_duration: method to set the maximun duration of a #GESTimelineElement + * @set_priority: method to set the priority of a #GESTimelineElement + * @ripple: method to ripple an object + * @ripple_end: method to ripple an object on its #GES_EDGE_END edge + * @roll_start: method to roll an object on its #GES_EDGE_START edge + * @roll_end: method to roll an object on its #GES_EDGE_END edge + * @trim: method to trim an object + * @deep_copy: Copy the children properties of @self into @copy + * + * The GESTimelineElement base class. Subclasses should override at least + * @set_start @set_inpoint @set_duration @ripple @ripple_end @roll_start + * @roll_end and @trim + */ +struct _GESTimelineElementClass +{ + GInitiallyUnownedClass parent_class; + + gboolean (*set_start) (GESTimelineElement * self, GstClockTime start); + gboolean (*set_inpoint) (GESTimelineElement * self, GstClockTime inpoint); + gboolean (*set_duration) (GESTimelineElement * self, GstClockTime duration); + gboolean (*set_max_duration) (GESTimelineElement * self, GstClockTime maxduration); + gboolean (*set_priority) (GESTimelineElement * self, guint32 priority); + + gboolean (*ripple) (GESTimelineElement *self, guint64 start); + gboolean (*ripple_end) (GESTimelineElement *self, guint64 end); + gboolean (*roll_start) (GESTimelineElement *self, guint64 start); + gboolean (*roll_end) (GESTimelineElement *self, guint64 end); + gboolean (*trim) (GESTimelineElement *self, guint64 start); + void (*deep_copy) (GESTimelineElement *self, GESTimelineElement *copy); + + /* Padding for API extension */ + gpointer _ges_reserved[GES_PADDING_LARGE]; +}; + +/** + * GESTimelineElement: + * @start: position (in time) of the object + * @inpoint: Position in the media from which the object should be used + * @duration: duration of the object to be used + * @maxduration: The maximum duration the object can have + * @priority: priority of the object in the layer (0:top priority) + * + * Those filed can be accessed from outside but in no case should + * be changed from there. Subclasses can write them but should make + * sure to properly call g_object_notify. + */ +struct _GESTimelineElement +{ + GInitiallyUnowned parent_instance; + + /*< protected >*/ + GESAsset *asset; + GstClockTime start; + GstClockTime inpoint; + GstClockTime duration; + GstClockTime maxduration; + guint32 priority; + + /*< private >*/ + GESTimelineElementPrivate *priv; + + /* Padding for API extension */ + gpointer _ges_reserved[GES_PADDING_LARGE]; +}; + +GType ges_timeline_element_get_type (void) G_GNUC_CONST; + +void ges_timeline_element_set_start (GESTimelineElement *self, GstClockTime start); +void ges_timeline_element_set_inpoint (GESTimelineElement *self, GstClockTime inpoint); +void ges_timeline_element_set_duration (GESTimelineElement *self, GstClockTime duration); +void ges_timeline_element_set_max_duration (GESTimelineElement *self, GstClockTime duration); +void ges_timeline_element_set_priority (GESTimelineElement *self, guint32 priority); +gboolean ges_timeline_element_ripple (GESTimelineElement *self, GstClockTime start); +gboolean ges_timeline_element_ripple_end (GESTimelineElement *self, GstClockTime end); +gboolean ges_timeline_element_roll_start (GESTimelineElement *self, GstClockTime start); +gboolean ges_timeline_element_roll_end (GESTimelineElement *self, GstClockTime end); +gboolean ges_timeline_element_trim (GESTimelineElement *self, GstClockTime start); +GESTimelineElement * ges_timeline_element_copy (GESTimelineElement *self, gboolean deep); + +G_END_DECLS + +#endif /* _GES_TIMELINE_ELEMENT_H_ */ + diff --git a/ges/ges-timeline-file-source.c b/ges/ges-timeline-file-source.c index 1fec629ec7..c720f23eac 100644 --- a/ges/ges-timeline-file-source.c +++ b/ges/ges-timeline-file-source.c @@ -38,6 +38,8 @@ static void ges_extractable_interface_init (GESExtractableInterface * iface); +#define parent_class ges_timeline_filesource_parent_class + G_DEFINE_TYPE_WITH_CODE (GESTimelineFileSource, ges_timeline_filesource, GES_TYPE_TIMELINE_SOURCE, G_IMPLEMENT_INTERFACE (GES_TYPE_EXTRACTABLE, @@ -71,8 +73,9 @@ static GESTrackObject void ges_timeline_filesource_set_uri (GESTimelineFileSource * self, gchar * uri); -static void -filesource_set_max_duration (GESTimelineObject * object, guint64 maxduration); +gboolean +filesource_set_max_duration (GESTimelineElement * element, + GstClockTime maxduration); static void ges_timeline_filesource_get_property (GObject * object, guint property_id, @@ -132,7 +135,7 @@ ges_timeline_filesource_finalize (GObject * object) if (priv->uri) g_free (priv->uri); - G_OBJECT_CLASS (ges_timeline_filesource_parent_class)->finalize (object); + G_OBJECT_CLASS (parent_class)->finalize (object); } static void @@ -140,6 +143,7 @@ ges_timeline_filesource_class_init (GESTimelineFileSourceClass * klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GESTimelineObjectClass *timobj_class = GES_TIMELINE_OBJECT_CLASS (klass); + GESTimelineElementClass *element_class = GES_TIMELINE_ELEMENT_CLASS (klass); g_type_class_add_private (klass, sizeof (GESTimelineFileSourcePrivate)); @@ -185,11 +189,12 @@ ges_timeline_filesource_class_init (GESTimelineFileSourceClass * klass) GES_TYPE_TRACK_TYPE, GES_TRACK_TYPE_UNKNOWN, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + element_class->set_max_duration = filesource_set_max_duration; + timobj_class->create_track_objects = ges_timeline_filesource_create_track_objects; 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; } @@ -230,11 +235,11 @@ extractable_set_asset (GESExtractable * self, GESAsset * asset) GESAssetFileSource *filesource_asset = GES_ASSET_FILESOURCE (asset); GESTimelineObject *tlobj = GES_TIMELINE_OBJECT (self); - if (GST_CLOCK_TIME_IS_VALID (tlobj->duration) == FALSE) - ges_timeline_object_set_duration (GES_TIMELINE_OBJECT (tfs), + if (GST_CLOCK_TIME_IS_VALID (GES_TIMELINE_ELEMENT (tlobj)) == FALSE) + _set_duration0 (GES_TIMELINE_ELEMENT (tfs), ges_asset_filesource_get_duration (filesource_asset)); - ges_timeline_filesource_set_max_duration (tfs, + ges_timeline_element_set_max_duration (GES_TIMELINE_ELEMENT (tfs), ges_asset_filesource_get_duration (filesource_asset)); ges_timeline_filesource_set_is_image (tfs, ges_asset_filesource_is_image (filesource_asset)); @@ -247,7 +252,7 @@ extractable_set_asset (GESExtractable * self, GESAsset * asset) (GES_ASSET_TIMELINE_OBJECT (filesource_asset))); } - GES_TIMELINE_OBJECT (tfs)->asset = asset; + GES_TIMELINE_ELEMENT (tfs)->asset = asset; } static void @@ -267,7 +272,7 @@ ges_timeline_filesource_init (GESTimelineFileSource * self) GES_TYPE_TIMELINE_FILE_SOURCE, GESTimelineFileSourcePrivate); /* Setting the duration to -1 by default. */ - GES_TIMELINE_OBJECT (self)->duration = GST_CLOCK_TIME_NONE; + GES_TIMELINE_ELEMENT (self)->duration = GST_CLOCK_TIME_NONE; } /** @@ -301,39 +306,17 @@ ges_timeline_filesource_set_mute (GESTimelineFileSource * self, gboolean mute) g_list_free (trackobjects); } -/** - * ges_timeline_filesource_set_max_duration: - * @self: the #GESTimelineFileSource to set the maximum duration on - * @maxduration: the maximum duration of @self - * - * Sets the maximum duration (in nanoseconds) of the file. - * - */ -void -ges_timeline_filesource_set_max_duration (GESTimelineFileSource * self, - guint64 maxduration) +gboolean +filesource_set_max_duration (GESTimelineElement * element, + GstClockTime maxduration) { - ges_timeline_object_set_max_duration (GES_TIMELINE_OBJECT (self), - maxduration); -} - -void -filesource_set_max_duration (GESTimelineObject * object, guint64 maxduration) -{ - GList *tmp, *tckobjs; - - if (object->duration == GST_CLOCK_TIME_NONE || object->duration == 0) { + if (_DURATION (element) == GST_CLOCK_TIME_NONE || _DURATION (element) == 0) /* If we don't have a valid duration, use the max duration */ - g_object_set (object, "duration", maxduration - object->inpoint, NULL); - } + _set_duration0 (element, maxduration - _INPOINT (element)); - tckobjs = ges_timeline_object_get_track_objects (object); - for (tmp = tckobjs; tmp; tmp = g_list_next (tmp)) { - ges_track_object_set_max_duration (GES_TRACK_OBJECT (tmp->data), - maxduration); - } - - g_list_free_full (tckobjs, g_object_unref); + return + GES_TIMELINE_ELEMENT_CLASS (parent_class)->set_max_duration (element, + maxduration); } /** @@ -364,20 +347,6 @@ ges_timeline_filesource_is_muted (GESTimelineFileSource * self) return self->priv->mute; } -/** - * ges_timeline_filesource_get_max_duration: - * @self: the #GESTimelineFileSource - * - * Get the duration of the object. - * - * Returns: The duration of @self. - */ -guint64 -ges_timeline_filesource_get_max_duration (GESTimelineFileSource * self) -{ - return ges_timeline_object_get_max_duration (GES_TIMELINE_OBJECT (self)); -} - /** * ges_timeline_filesource_is_image: * @self: the #GESTimelineFileSource @@ -413,11 +382,11 @@ ges_timeline_filesource_create_track_objects (GESTimelineObject * obj, GList *res = NULL; const GList *tmp, *stream_assets; - g_return_val_if_fail (obj->asset, NULL); + g_return_val_if_fail (GES_TIMELINE_ELEMENT (obj)->asset, NULL); stream_assets = ges_asset_filesource_get_stream_assets (GES_ASSET_FILESOURCE - (obj->asset)); + (GES_TIMELINE_ELEMENT (obj)->asset)); for (tmp = stream_assets; tmp; tmp = tmp->next) { GESAssetTrackObject *asset = GES_ASSET_TRACK_OBJECT (tmp->data); diff --git a/ges/ges-timeline-file-source.h b/ges/ges-timeline-file-source.h index 4e0a7d5094..359ae0d15b 100644 --- a/ges/ges-timeline-file-source.h +++ b/ges/ges-timeline-file-source.h @@ -74,16 +74,11 @@ GType ges_timeline_filesource_get_type (void); void ges_timeline_filesource_set_mute (GESTimelineFileSource * self, gboolean mute); -void -ges_timeline_filesource_set_max_duration (GESTimelineFileSource * self, - guint64 maxduration); - void ges_timeline_filesource_set_is_image (GESTimelineFileSource * self, gboolean is_image); gboolean ges_timeline_filesource_is_muted (GESTimelineFileSource * self); -guint64 ges_timeline_filesource_get_max_duration (GESTimelineFileSource * self); gboolean ges_timeline_filesource_is_image (GESTimelineFileSource * self); const gchar *ges_timeline_filesource_get_uri (GESTimelineFileSource * self); diff --git a/ges/ges-timeline-layer.c b/ges/ges-timeline-layer.c index c531c92afa..592bdca971 100644 --- a/ges/ges-timeline-layer.c +++ b/ges/ges-timeline-layer.c @@ -218,7 +218,7 @@ static gboolean ges_timeline_layer_resync_priorities (GESTimelineLayer * layer) { GList *tmp; - GESTimelineObject *obj; + GESTimelineElement *obj; GST_DEBUG ("Resync priorities of %p", layer); @@ -227,8 +227,8 @@ ges_timeline_layer_resync_priorities (GESTimelineLayer * layer) * do in the meantime. */ for (tmp = layer->priv->objects_start; tmp; tmp = tmp->next) { - obj = GES_TIMELINE_OBJECT (tmp->data); - ges_timeline_object_set_priority (obj, GES_TIMELINE_OBJECT_PRIORITY (obj)); + obj = GES_TIMELINE_ELEMENT (tmp->data); + _set_priority0 (obj, _PRIORITY (obj)); } return TRUE; @@ -431,7 +431,7 @@ ges_timeline_layer_get_objects (GESTimelineLayer * layer) return g_list_sort (g_list_copy_deep (layer->priv->objects_start, (GCopyFunc) gst_object_ref, NULL), - (GCompareFunc) timeline_object_start_compare); + (GCompareFunc) element_start_compare); } /** @@ -533,26 +533,25 @@ ges_timeline_layer_add_object (GESTimelineLayer * layer, /* Take a reference to the object and store it stored by start/priority */ priv->objects_start = g_list_insert_sorted (priv->objects_start, object, - (GCompareFunc) timeline_object_start_compare); + (GCompareFunc) element_start_compare); /* Inform the object it's now in this layer */ ges_timeline_object_set_layer (object, layer); GST_DEBUG ("current object priority : %d, layer min/max : %d/%d", - GES_TIMELINE_OBJECT_PRIORITY (object), - layer->min_gnl_priority, layer->max_gnl_priority); + _PRIORITY (object), layer->min_gnl_priority, layer->max_gnl_priority); /* Set the priority. */ maxprio = layer->max_gnl_priority; minprio = layer->min_gnl_priority; - prio = GES_TIMELINE_OBJECT_PRIORITY (object); + prio = _PRIORITY (object); if (minprio + prio > (maxprio)) { GST_WARNING_OBJECT (layer, "%p is out of the layer space, setting its priority to " "%d, setting it to the maximum priority of the layer: %d", object, prio, maxprio - minprio); - ges_timeline_object_set_priority (object, LAYER_HEIGHT - 1); + _set_priority0 (GES_TIMELINE_ELEMENT (object), LAYER_HEIGHT - 1); } /* If the object has an acceptable priority, we just let it with its current @@ -599,13 +598,13 @@ ges_timeline_layer_add_asset (GESTimelineLayer * layer, ges_track_type_name (track_types)); tlobj = GES_TIMELINE_OBJECT (ges_asset_extract (asset, NULL)); - ges_timeline_object_set_start (tlobj, start); - ges_timeline_object_set_inpoint (tlobj, inpoint); + _set_start0 (GES_TIMELINE_ELEMENT (tlobj), start); + _set_inpoint0 (GES_TIMELINE_ELEMENT (tlobj), inpoint); if (track_types != GES_TRACK_TYPE_UNKNOWN) ges_timeline_object_set_supported_formats (tlobj, track_types); if (GST_CLOCK_TIME_IS_VALID (duration)) { - ges_timeline_object_set_duration (tlobj, duration); + _set_duration0 (GES_TIMELINE_ELEMENT (tlobj), duration); } if (!ges_timeline_layer_add_object (layer, tlobj)) { diff --git a/ges/ges-timeline-object.c b/ges/ges-timeline-object.c index 91346ea66f..023317859d 100644 --- a/ges/ges-timeline-object.c +++ b/ges/ges-timeline-object.c @@ -44,7 +44,8 @@ ges_timeline_object_fill_track_object_func (GESTimelineObject * object, GList *ges_timeline_object_create_track_objects_func (GESTimelineObject * object, GESTrackType type); -void default_set_max_duration (GESTimelineObject * object, guint64 maxduration); +static gboolean _set_max_duration (GESTimelineElement * element, + GstClockTime maxduration); static void track_object_start_changed_cb (GESTrackObject * child, @@ -66,25 +67,21 @@ static void get_layer_priorities (GESTimelineLayer * layer, guint32 * layer_min_gnl_prio, guint32 * layer_max_gnl_prio); -static gboolean -ges_timeline_object_set_start_internal (GESTimelineObject * object, - guint64 start); -static gboolean ges_timeline_object_set_inpoint_internal (GESTimelineObject * - object, guint64 inpoint); -static gboolean ges_timeline_object_set_duration_internal (GESTimelineObject * - object, guint64 duration); -static gboolean ges_timeline_object_set_priority_internal (GESTimelineObject * - object, guint32 priority); +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 GESTimelineObject *ges_timeline_object_copy (GESTimelineObject * object, - gboolean * deep); +static gboolean _ripple (GESTimelineElement * element, GstClockTime start); +static gboolean _ripple_end (GESTimelineElement * element, GstClockTime end); +static gboolean _roll_start (GESTimelineElement * element, GstClockTime start); +static gboolean _roll_end (GESTimelineElement * element, GstClockTime end); +static gboolean _trim (GESTimelineElement * element, GstClockTime start); -static void ges_extractable_interface_init (GESExtractableInterface * iface); - -G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GESTimelineObject, ges_timeline_object, - G_TYPE_INITIALLY_UNOWNED, - G_IMPLEMENT_INTERFACE (GES_TYPE_EXTRACTABLE, ges_extractable_interface_init) - G_IMPLEMENT_INTERFACE (GES_TYPE_META_CONTAINER, NULL)); +G_DEFINE_ABSTRACT_TYPE (GESTimelineObject, ges_timeline_object, + GES_TYPE_TIMELINE_ELEMENT); /* Mapping of relationship between a TimelineObject and the TrackObjects * it controls @@ -131,8 +128,6 @@ struct _GESTimelineObjectPrivate gboolean ignore_notifies; gboolean is_moving; - guint64 maxduration; - GList *mappings; guint nb_effects; @@ -148,14 +143,9 @@ struct _GESTimelineObjectPrivate enum { PROP_0, - PROP_START, - PROP_INPOINT, - PROP_DURATION, - PROP_PRIORITY, PROP_HEIGHT, PROP_LAYER, PROP_SUPPORTED_FORMATS, - PROP_MAX_DURATION, PROP_LAST }; @@ -168,18 +158,6 @@ ges_timeline_object_get_property (GObject * object, guint property_id, GESTimelineObject *tobj = GES_TIMELINE_OBJECT (object); switch (property_id) { - case PROP_START: - g_value_set_uint64 (value, tobj->start); - break; - case PROP_INPOINT: - g_value_set_uint64 (value, tobj->inpoint); - break; - case PROP_DURATION: - g_value_set_uint64 (value, tobj->duration); - break; - case PROP_PRIORITY: - g_value_set_uint (value, tobj->priority); - break; case PROP_HEIGHT: g_value_set_uint (value, tobj->height); break; @@ -189,9 +167,6 @@ ges_timeline_object_get_property (GObject * object, guint property_id, 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); } @@ -204,28 +179,10 @@ ges_timeline_object_set_property (GObject * object, guint property_id, GESTimelineObject *tobj = GES_TIMELINE_OBJECT (object); switch (property_id) { - case PROP_START: - ges_timeline_object_set_start_internal (tobj, g_value_get_uint64 (value)); - break; - case PROP_INPOINT: - ges_timeline_object_set_inpoint_internal (tobj, - g_value_get_uint64 (value)); - break; - case PROP_DURATION: - ges_timeline_object_set_duration_internal (tobj, - g_value_get_uint64 (value)); - break; - case PROP_PRIORITY: - ges_timeline_object_set_priority_internal (tobj, - g_value_get_uint (value)); - break; case PROP_SUPPORTED_FORMATS: 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); } @@ -235,64 +192,17 @@ static void ges_timeline_object_class_init (GESTimelineObjectClass * klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + GESTimelineElementClass *element_class = GES_TIMELINE_ELEMENT_CLASS (klass); g_type_class_add_private (klass, sizeof (GESTimelineObjectPrivate)); 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->create_track_object = NULL; klass->track_object_added = NULL; klass->track_object_released = NULL; - /** - * GESTimelineObject:start: - * - * The position of the object in the #GESTimelineLayer (in nanoseconds). - */ - properties[PROP_START] = g_param_spec_uint64 ("start", "Start", - "The position in the container", 0, G_MAXUINT64, 0, G_PARAM_READWRITE); - g_object_class_install_property (object_class, PROP_START, - properties[PROP_START]); - - /** - * GESTimelineObject:in-point: - * - * The in-point at which this #GESTimelineObject will start outputting data - * from its contents (in nanoseconds). - * - * Ex : an in-point of 5 seconds means that the first outputted buffer will - * be the one located 5 seconds in the controlled resource. - */ - properties[PROP_INPOINT] = - g_param_spec_uint64 ("in-point", "In-point", "The in-point", 0, - G_MAXUINT64, 0, G_PARAM_READWRITE); - g_object_class_install_property (object_class, PROP_INPOINT, - properties[PROP_INPOINT]); - - /** - * GESTimelineObject:duration: - * - * The duration (in nanoseconds) which will be used in the container #GESTrack - * starting from 'in-point'. - */ - properties[PROP_DURATION] = - g_param_spec_uint64 ("duration", "Duration", "The duration to use", 0, - G_MAXUINT64, GST_CLOCK_TIME_NONE, G_PARAM_READWRITE); - g_object_class_install_property (object_class, PROP_DURATION, - properties[PROP_DURATION]); - - /** - * GESTimelineObject:priority: - * - * The layer priority of the timeline object. - */ - properties[PROP_PRIORITY] = g_param_spec_uint ("priority", "Priority", - "The priority of the object", 0, G_MAXUINT, 0, G_PARAM_READWRITE); - g_object_class_install_property (object_class, PROP_PRIORITY, - properties[PROP_PRIORITY]); - /** * GESTimelineObject:height: * @@ -386,17 +296,19 @@ ges_timeline_object_class_init (GESTimelineObjectClass * klass) G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_generic, 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 maximum duration of the object", 0, G_MAXUINT64, G_MAXUINT64, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + + 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->ripple = _ripple; + element_class->ripple_end = _ripple_end; + element_class->roll_start = _roll_start; + element_class->roll_end = _roll_end; + element_class->trim = _trim; + element_class->set_max_duration = _set_max_duration; +/* TODO implement the deep_copy Virtual method */ klass->need_fill_track = TRUE; klass->snaps = FALSE; @@ -407,25 +319,12 @@ ges_timeline_object_init (GESTimelineObject * self) { self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GES_TYPE_TIMELINE_OBJECT, GESTimelineObjectPrivate); - self->duration = GST_SECOND; + /* FIXME, check why it was done this way _DURATION (self) = GST_SECOND; */ self->height = 1; self->trackobjects = NULL; self->priv->layer = NULL; self->priv->nb_effects = 0; self->priv->is_moving = FALSE; - self->priv->maxduration = G_MAXUINT64; -} - -static void -extractable_set_asset (GESExtractable * extractable, GESAsset * asset) -{ - GES_TIMELINE_OBJECT (extractable)->asset = asset; -} - -static void -ges_extractable_interface_init (GESExtractableInterface * iface) -{ - iface->set_asset = extractable_set_asset; } /** @@ -500,13 +399,17 @@ ges_timeline_object_create_track_objects (GESTimelineObject * object, return klass->create_track_objects (object, type); } -/* Default implementation of default_set_max_duration */ -void -default_set_max_duration (GESTimelineObject * object, guint64 maxduration) +gboolean +_set_max_duration (GESTimelineElement * element, GstClockTime maxduration) { GList *tmp; - for (tmp = object->trackobjects; tmp; tmp = g_list_next (tmp)) - g_object_set (tmp->data, "max-duration", maxduration, NULL); + + for (tmp = GES_TIMELINE_OBJECT (element)->trackobjects; tmp; + tmp = g_list_next (tmp)) + ges_timeline_element_set_max_duration (GES_TIMELINE_ELEMENT (tmp->data), + maxduration); + + return TRUE; } /* @@ -597,8 +500,7 @@ ges_timeline_object_add_track_object (GESTimelineObject * object, GESTrackObject /* We make sure not to move the entire #TimelineObject */ ges_track_object_set_locked (tmpo, FALSE); - ges_track_object_set_priority (tmpo, - ges_track_object_get_priority (tmpo) + 1); + _set_priority0 (GES_TIMELINE_ELEMENT (tmpo), _PRIORITY (tmpo) + 1); ges_track_object_set_locked (tmpo, TRUE); } @@ -609,10 +511,11 @@ ges_timeline_object_add_track_object (GESTimelineObject * object, GESTrackObject g_list_insert_sorted_with_data (object->trackobjects, trobj, (GCompareDataFunc) sort_track_effects, object); - 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); + _set_start0 (GES_TIMELINE_ELEMENT (trobj), _START (object)); + _set_duration0 (GES_TIMELINE_ELEMENT (trobj), _DURATION (object)); + _set_inpoint0 (GES_TIMELINE_ELEMENT (trobj), _INPOINT (object)); + ges_timeline_element_set_max_duration (GES_TIMELINE_ELEMENT (trobj), + _MAXDURATION (object)); klass = GES_TIMELINE_OBJECT_GET_CLASS (object); if (klass->track_object_added) { @@ -631,15 +534,15 @@ ges_timeline_object_add_track_object (GESTimelineObject * object, GESTrackObject g_signal_connect (G_OBJECT (trobj), "notify::duration", G_CALLBACK (track_object_duration_changed_cb), object); mapping->inpoint_notifyid = - g_signal_connect (G_OBJECT (trobj), "notify::in-point", + g_signal_connect (G_OBJECT (trobj), "notify::inpoint", G_CALLBACK (track_object_inpoint_changed_cb), object); mapping->priority_notifyid = g_signal_connect (G_OBJECT (trobj), "notify::priority", G_CALLBACK (track_object_priority_changed_cb), object); get_layer_priorities (priv->layer, &min_prio, &max_prio); - ges_track_object_set_priority (trobj, min_prio + object->priority - + mapping->priority_offset); + _set_priority0 (GES_TIMELINE_ELEMENT (trobj), min_prio + + _PRIORITY (object) + mapping->priority_offset); GST_DEBUG ("Returning trobj:%p", trobj); if (!GES_IS_TRACK_EFFECT (trobj)) { @@ -787,21 +690,16 @@ find_object_mapping (GESTimelineObject * object, GESTrackObject * child) } static gboolean -ges_timeline_object_set_start_internal (GESTimelineObject * object, - guint64 start) +_set_start (GESTimelineElement * element, GstClockTime start) { GList *tmp; GESTrackObject *tr; ObjectMapping *map; - GESTimeline *timeline = NULL; - GESTimelineObjectPrivate *priv = object->priv; gboolean snap = FALSE; + GESTimeline *timeline = NULL; - g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE); - - GST_DEBUG_OBJECT (object, "current start: %" GST_TIME_FORMAT - " new start: %" GST_TIME_FORMAT, GST_TIME_ARGS (start), - GST_TIME_ARGS (object->start)); + GESTimelineObject *object = GES_TIMELINE_OBJECT (element); + GESTimelineObjectPrivate *priv = object->priv; /* If the class has snapping enabled and the object is in a timeline, * we snap */ @@ -830,91 +728,47 @@ ges_timeline_object_set_start_internal (GESTimelineObject * object, ges_timeline_move_object_simple (timeline, tr, NULL, GES_EDGE_NONE, start); else - ges_track_object_set_start (tr, start); + _set_start0 (GES_TIMELINE_ELEMENT (tr), start); } else { /* ... or update the offset */ - map->start_offset = start - tr->start; + map->start_offset = start - _START (tr); } } object->priv->ignore_notifies = FALSE; - object->start = start; return TRUE; } -/** - * ges_timeline_object_set_start: - * @object: a #GESTimelineObject - * @start: the position in #GstClockTime - * - * Set the position of the object in its containing layer - * - * Note that if the timeline snap-distance property of the timeline containing - * @object is set, @object will properly snap to its neighboors. - */ -void -ges_timeline_object_set_start (GESTimelineObject * object, guint64 start) -{ - if (ges_timeline_object_set_start_internal (object, start)) - g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_START]); -} - static gboolean -ges_timeline_object_set_inpoint_internal (GESTimelineObject * object, - guint64 inpoint) +_set_inpoint (GESTimelineElement * element, GstClockTime inpoint) { GList *tmp; GESTrackObject *tr; - g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE); - - GST_DEBUG_OBJECT (object, "current inpoint: %" GST_TIME_FORMAT - " new inpoint: %" GST_TIME_FORMAT, GST_TIME_ARGS (inpoint), - GST_TIME_ARGS (object->inpoint)); + GESTimelineObject *object = GES_TIMELINE_OBJECT (element); for (tmp = object->trackobjects; tmp; tmp = g_list_next (tmp)) { tr = (GESTrackObject *) tmp->data; if (ges_track_object_is_locked (tr)) /* call set_inpoint on each trackobject */ - ges_track_object_set_inpoint (tr, inpoint); + _set_inpoint0 (GES_TIMELINE_ELEMENT (tr), inpoint); } - object->inpoint = inpoint; return TRUE; } -/** - * ges_timeline_object_set_inpoint: - * @object: a #GESTimelineObject - * @inpoint: the in-point in #GstClockTime - * - * Set the in-point, that is the moment at which the @object will start - * outputting data from its contents. - */ -void -ges_timeline_object_set_inpoint (GESTimelineObject * object, guint64 inpoint) -{ - if (ges_timeline_object_set_inpoint_internal (object, inpoint)) - g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_INPOINT]); -} - static gboolean -ges_timeline_object_set_duration_internal (GESTimelineObject * object, - guint64 duration) +_set_duration (GESTimelineElement * element, GstClockTime duration) { GList *tmp; GESTrackObject *tr; GESTimeline *timeline = NULL; - GESTimelineObjectPrivate *priv = object->priv; gboolean snap = FALSE; - g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE); - - GST_DEBUG_OBJECT (object, "current duration: %" GST_TIME_FORMAT - " new duration: %" GST_TIME_FORMAT, GST_TIME_ARGS (duration), - GST_TIME_ARGS (object->duration)); + GESTimelineObject *object = GES_TIMELINE_OBJECT (element); + GESTimelineObjectPrivate *priv = object->priv; if (priv->layer && GES_TIMELINE_OBJECT_GET_CLASS (object)->snaps) timeline = ges_timeline_layer_get_timeline (object->priv->layer); @@ -932,37 +786,18 @@ ges_timeline_object_set_duration_internal (GESTimelineObject * object, * and make the snapping happen if in a timeline */ if (G_LIKELY (snap)) ges_timeline_trim_object_simple (timeline, tr, NULL, GES_EDGE_END, - tr->start + duration, TRUE); + _START (tr) + duration, TRUE); else - ges_track_object_set_duration (tr, duration); + _set_duration0 (GES_TIMELINE_ELEMENT (tr), duration); } } object->priv->ignore_notifies = FALSE; - object->duration = duration; return TRUE; } -/** - * ges_timeline_object_set_duration: - * @object: a #GESTimelineObject - * @duration: the duration in #GstClockTime - * - * Set the duration of the object - * - * Note that if the timeline snap-distance property of the timeline containing - * @object is set, @object will properly snap to its neighboors. - */ -void -ges_timeline_object_set_duration (GESTimelineObject * object, guint64 duration) -{ - if (ges_timeline_object_set_duration_internal (object, duration)) - g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_DURATION]); -} - static gboolean -ges_timeline_object_set_priority_internal (GESTimelineObject * object, - guint priority) +_set_priority (GESTimelineElement * element, guint32 priority) { GList *tmp; GESTrackObject *tr; @@ -970,9 +805,7 @@ ges_timeline_object_set_priority_internal (GESTimelineObject * object, GESTimelineObjectPrivate *priv; guint32 layer_min_gnl_prio, layer_max_gnl_prio; - g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE); - - GST_DEBUG ("object:%p, priority:%" G_GUINT32_FORMAT, object, priority); + GESTimelineObject *object = GES_TIMELINE_OBJECT (element); priv = object->priv; @@ -997,11 +830,11 @@ ges_timeline_object_set_priority_internal (GESTimelineObject * object, real_tck_prio = layer_max_gnl_prio; } - ges_track_object_set_priority (tr, real_tck_prio); + _set_priority0 (GES_TIMELINE_ELEMENT (tr), real_tck_prio); } else { /* ... or update the offset */ - map->priority_offset = tr->priority - layer_min_gnl_prio + priority; + map->priority_offset = _PRIORITY (tr) - layer_min_gnl_prio + priority; } } @@ -1009,7 +842,6 @@ ges_timeline_object_set_priority_internal (GESTimelineObject * object, (GCompareDataFunc) sort_track_effects, object); priv->ignore_notifies = FALSE; - object->priority = priority; return TRUE; } @@ -1100,24 +932,6 @@ ges_timeline_object_move_to_layer (GESTimelineObject * object, GESTimelineLayer return ret; } -/** - * ges_timeline_object_set_priority: - * @object: a #GESTimelineObject - * @priority: the priority - * - * Sets the priority of the object within the containing layer - */ -void -ges_timeline_object_set_priority (GESTimelineObject * object, guint priority) -{ - if (ges_timeline_object_set_priority_internal (object, priority)) -#if GLIB_CHECK_VERSION(2,26,0) - g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_PRIORITY]); -#else - g_object_notify (G_OBJECT (object), "priority"); -#endif -} - /** * ges_timeline_object_find_track_object: * @object: a #GESTimelineObject @@ -1315,7 +1129,7 @@ ges_timeline_object_set_top_effect_priority (GESTimelineObject * object, g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE); tck_obj = GES_TRACK_OBJECT (effect); - current_prio = ges_track_object_get_priority (tck_obj); + current_prio = _PRIORITY (tck_obj); /* We don't change the priority */ if (current_prio == newpriority || @@ -1332,19 +1146,19 @@ ges_timeline_object_set_top_effect_priority (GESTimelineObject * object, return FALSE; } - if (tck_obj->priority < newpriority) + if (_PRIORITY (tck_obj) < newpriority) inc = -1; else inc = +1; - ges_track_object_set_priority (tck_obj, newpriority); + _set_priority0 (GES_TIMELINE_ELEMENT (tck_obj), newpriority); for (tmp = object->trackobjects; tmp; tmp = tmp->next) { GESTrackObject *tmpo = GES_TRACK_OBJECT (tmp->data); - guint tck_priority = ges_track_object_get_priority (tmpo); + guint tck_priority = _PRIORITY (tmpo); if ((inc == +1 && tck_priority >= newpriority) || (inc == -1 && tck_priority <= newpriority)) { - ges_track_object_set_priority (tmpo, tck_priority + inc); + _set_priority0 (GES_TIMELINE_ELEMENT (tmpo), tck_priority + inc); } } @@ -1442,9 +1256,9 @@ ges_timeline_object_split (GESTimelineObject * object, guint64 position) g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), NULL); g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (position), NULL); - duration = GES_TIMELINE_OBJECT_DURATION (object); - start = GES_TIMELINE_OBJECT_START (object); - inpoint = GES_TIMELINE_OBJECT_INPOINT (object); + duration = _DURATION (object); + start = _START (object); + inpoint = _INPOINT (object); if (position >= start + duration || position <= start) { GST_WARNING_OBJECT (object, "Can not split %" GST_TIME_FORMAT @@ -1456,13 +1270,16 @@ ges_timeline_object_split (GESTimelineObject * object, guint64 position) GST_TIME_ARGS (position)); /* Create the new TimelineObject */ - new_object = ges_timeline_object_copy (object, FALSE); + new_object = + GES_TIMELINE_OBJECT (ges_timeline_element_copy (GES_TIMELINE_ELEMENT + (object), FALSE)); /* Set new timing properties on the TimelineObject */ - ges_timeline_object_set_start (new_object, position); - ges_timeline_object_set_inpoint (new_object, object->inpoint + - duration - (duration + start - position)); - ges_timeline_object_set_duration (new_object, duration + start - position); + _set_start0 (GES_TIMELINE_ELEMENT (new_object), position); + _set_inpoint0 (GES_TIMELINE_ELEMENT (new_object), + _INPOINT (object) + duration - (duration + start - position)); + _set_duration0 (GES_TIMELINE_ELEMENT (new_object), + duration + start - position); if (object->priv->layer) { /* We do not want the timeline to create again TrackObject-s */ @@ -1472,26 +1289,30 @@ ges_timeline_object_split (GESTimelineObject * object, guint64 position) } /* We first set the new duration and the child mapping will be updated - * properly in the following loop */ - object->duration = position - object->start; + * properly in the following loop + * FIXME: Avoid setting it oureself reworking the API */ + GES_TIMELINE_ELEMENT (object)->duration = position - _START (object); for (tmp = object->trackobjects; tmp; tmp = tmp->next) { GESTrack *track; GESTrackObject *new_tckobj, *tckobj = GES_TRACK_OBJECT (tmp->data); - duration = ges_track_object_get_duration (tckobj); - start = ges_track_object_get_start (tckobj); - inpoint = ges_track_object_get_inpoint (tckobj); + duration = _DURATION (tckobj); + start = _START (tckobj); + inpoint = _INPOINT (tckobj); if (position <= start || position >= (start + duration)) { GST_DEBUG_OBJECT (tckobj, "Outside %" GST_TIME_FORMAT "the boundaries " "not copying it ( start %" GST_TIME_FORMAT ", end %" GST_TIME_FORMAT - ")", GST_TIME_ARGS (position), GST_TIME_ARGS (tckobj->start), - GST_TIME_ARGS (tckobj->start + tckobj->duration)); + ")", GST_TIME_ARGS (position), + GST_TIME_ARGS (_START (tckobj)), + GST_TIME_ARGS (_START (tckobj) + _DURATION (tckobj))); continue; } - new_tckobj = ges_track_object_copy (tckobj, TRUE); + new_tckobj = + GES_TRACK_OBJECT (ges_timeline_element_copy (GES_TIMELINE_ELEMENT + (tckobj), TRUE)); if (new_tckobj == NULL) { GST_WARNING_OBJECT (tckobj, "Could not create a copy"); continue; @@ -1513,13 +1334,14 @@ ges_timeline_object_split (GESTimelineObject * object, guint64 position) ges_track_object_set_locked (tckobj, FALSE); /* Set 'new' track object timing propeties */ - ges_track_object_set_start (new_tckobj, position); - ges_track_object_set_inpoint (new_tckobj, inpoint + duration - (duration + - start - position)); - ges_track_object_set_duration (new_tckobj, duration + start - position); + _set_start0 (GES_TIMELINE_ELEMENT (new_tckobj), position); + _set_inpoint0 (GES_TIMELINE_ELEMENT (new_tckobj), + inpoint + duration - (duration + start - position)); + _set_duration0 (GES_TIMELINE_ELEMENT (new_tckobj), + duration + start - position); /* Set 'old' track object duration */ - ges_track_object_set_duration (tckobj, position - start); + _set_duration0 (GES_TIMELINE_ELEMENT (tckobj), position - start); /* And let track objects in the same locking state as before. */ ges_track_object_set_locked (tckobj, locked); @@ -1529,41 +1351,6 @@ ges_timeline_object_split (GESTimelineObject * object, guint64 position) return new_object; } -/* TODO implement the deep parameter, and make it public */ -static GESTimelineObject * -ges_timeline_object_copy (GESTimelineObject * object, gboolean * deep) -{ - GESTimelineObject *ret = NULL; - GParameter *params; - GParamSpec **specs; - guint n, n_specs, n_params; - - g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), NULL); - - specs = - g_object_class_list_properties (G_OBJECT_GET_CLASS (object), &n_specs); - params = g_new0 (GParameter, n_specs); - n_params = 0; - - for (n = 0; n < n_specs; ++n) { - if (strcmp (specs[n]->name, "parent") && - (specs[n]->flags & G_PARAM_READWRITE) == G_PARAM_READWRITE) { - params[n_params].name = g_intern_string (specs[n]->name); - g_value_init (¶ms[n_params].value, specs[n]->value_type); - g_object_get_property (G_OBJECT (object), specs[n]->name, - ¶ms[n_params].value); - ++n_params; - } - } - - ret = g_object_newv (G_TYPE_FROM_INSTANCE (object), n_params, params); - - g_free (specs); - g_free (params); - - return ret; -} - /** * ges_timeline_object_set_supported_formats: * @object: the #GESTimelineObject to set supported formats on @@ -1624,73 +1411,13 @@ ges_timeline_object_objects_set_locked (GESTimelineObject * object, } } -/** - * 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); -} - -/** - * ges_timeline_object_ripple: - * @object: The #GESTimeline to ripple. - * @start: The new start of @object in ripple mode. - * - * Edits @object in ripple mode. It allows you to modify the - * start of @object and move the following neighbours accordingly. - * This will change the overall timeline duration. - * - * You could also use: - * - * #ges_timeline_object_edit (@object, @layers, - * new_layer_priority=-1, GES_EDIT_MODE_RIPPLE, GES_EDGE_NONE, - * @position); - * - * Which lets you more control over layer management. - * - * Returns: %TRUE if the object as been rippled properly, %FALSE if an error - * occured - */ gboolean -ges_timeline_object_ripple (GESTimelineObject * object, guint64 start) +_ripple (GESTimelineElement * element, GstClockTime start) { GList *tmp, *tckobjs; gboolean ret = TRUE; GESTimeline *timeline; - - g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE); + GESTimelineObject *object = GES_TIMELINE_OBJECT (element); timeline = ges_timeline_layer_get_timeline (object->priv->layer); @@ -1714,34 +1441,13 @@ ges_timeline_object_ripple (GESTimelineObject * object, guint64 start) return ret; } -/** - * ges_timeline_object_ripple_end: - * @object: The #GESTimeline to ripple. - * @end: The new end (start + duration) of @object in ripple mode. It will - * basically only change the duration of @object. - * - * Edits @object in ripple mode. It allows you to modify the - * duration of a @object and move the following neighbours accordingly. - * This will change the overall timeline duration. - * - * You could also use: - * - * #ges_timeline_object_edit (@object, @layers, - * new_layer_priority=-1, GES_EDIT_MODE_RIPPLE, GES_EDGE_END, @end); - * - * Which lets you more control over layer management. - * - * Returns: %TRUE if the object as been rippled properly, %FALSE if an error - * occured - */ -gboolean -ges_timeline_object_ripple_end (GESTimelineObject * object, guint64 end) +static gboolean +_ripple_end (GESTimelineElement * element, GstClockTime end) { GList *tmp, *tckobjs; gboolean ret = TRUE; GESTimeline *timeline; - - g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE); + GESTimelineObject *object = GES_TIMELINE_OBJECT (element); timeline = ges_timeline_layer_get_timeline (object->priv->layer); @@ -1765,35 +1471,14 @@ ges_timeline_object_ripple_end (GESTimelineObject * object, guint64 end) return ret; } -/** - * ges_timeline_object_roll_start: - * @object: The #GESTimelineObject to roll - * @start: The new start of @object in roll mode, it will also adapat - * the in-point of @object according - * - * Edits @object in roll mode. It allows you to modify the - * start and inpoint of a @object and "resize" (basicly change the duration - * in this case) of the previous neighbours accordingly. - * This will not change the overall timeline duration. - * - * You could also use: - * - * #ges_timeline_object_edit (@object, @layers, - * new_layer_priority=-1, GES_EDIT_MODE_ROLL, GES_EDGE_START, @start); - * - * Which lets you more control over layer management. - * - * Returns: %TRUE if the object as been roll properly, %FALSE if an error - * occured - */ gboolean -ges_timeline_object_roll_start (GESTimelineObject * object, guint64 start) +_roll_start (GESTimelineElement * element, GstClockTime start) { GList *tmp, *tckobjs; gboolean ret = TRUE; GESTimeline *timeline; - g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE); + GESTimelineObject *object = GES_TIMELINE_OBJECT (element); timeline = ges_timeline_layer_get_timeline (object->priv->layer); @@ -1817,37 +1502,16 @@ ges_timeline_object_roll_start (GESTimelineObject * object, guint64 start) return ret; } -/** - * ges_timeline_object_roll_end: - * @object: The #GESTimeline to roll. - * @end: The new end (start + duration) of @object in roll mode - * - * Edits @object in roll mode. It allows you to modify the - * duration of a @object and trim (basicly change the start + inpoint - * in this case) the following neighbours accordingly. - * This will not change the overall timeline duration. - * - * You could also use: - * - * #ges_timeline_object_edit (@object, @layers, - * new_layer_priority=-1, GES_EDIT_MODE_ROLL, GES_EDGE_END, @end); - * - * Which lets you more control over layer management. - * - * Returns: %TRUE if the object as been rolled properly, %FALSE if an error - * occured - */ gboolean -ges_timeline_object_roll_end (GESTimelineObject * object, guint64 end) +_roll_end (GESTimelineElement * element, GstClockTime end) { GList *tmp, *tckobjs; gboolean ret = TRUE; GESTimeline *timeline; - g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE); + GESTimelineObject *object = GES_TIMELINE_OBJECT (element); timeline = ges_timeline_layer_get_timeline (object->priv->layer); - if (timeline == NULL) { GST_DEBUG ("Not in a timeline yet"); return FALSE; @@ -1869,38 +1533,14 @@ ges_timeline_object_roll_end (GESTimelineObject * object, guint64 end) return ret; } -/** - * ges_timeline_object_trim_start: - * @object: The #GESTimeline to trim. - * @start: The new start of @object in trim mode, will adapt the inpoint - * of @object accordingly - * - * Edits @object in trim mode. It allows you to modify the - * inpoint and start of @object. - * This will not change the overall timeline duration. - * - * You could also use: - * - * #ges_timeline_object_edit (@object, @layers, - * new_layer_priority=-1, GES_EDIT_MODE_TRIM, GES_EDGE_START, @start); - * - * Which lets you more control over layer management. - * - * Note that to trim the end of an object you can just set its duration. The same way - * as this method, it will take into account the snapping-distance property of the - * timeline in which @object is. - * - * Returns: %TRUE if the object as been trimmed properly, %FALSE if an error - * occured - */ gboolean -ges_timeline_object_trim_start (GESTimelineObject * object, guint64 start) +_trim (GESTimelineElement * element, GstClockTime start) { GList *tmp, *tckobjs; gboolean ret = TRUE; GESTimeline *timeline; - g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (object), FALSE); + GESTimelineObject *object = GES_TIMELINE_OBJECT (element); timeline = ges_timeline_layer_get_timeline (object->priv->layer); @@ -1957,8 +1597,7 @@ update_height (GESTimelineObject * object) /* Go over all childs and check if height has changed */ for (tmp = object->trackobjects; tmp; tmp = tmp->next) { - guint tck_priority = - ges_track_object_get_priority (GES_TRACK_OBJECT (tmp->data)); + guint tck_priority = _PRIORITY (tmp->data); if (tck_priority < min_prio) min_prio = tck_priority; @@ -1987,6 +1626,7 @@ track_object_start_changed_cb (GESTrackObject * child, GParamSpec * arg G_GNUC_UNUSED, GESTimelineObject * object) { ObjectMapping *map; + GESTimelineElement *element = GES_TIMELINE_ELEMENT (object); if (object->priv->ignore_notifies) return; @@ -1998,11 +1638,11 @@ track_object_start_changed_cb (GESTrackObject * child, if (!ges_track_object_is_locked (child)) { /* Update the internal start_offset */ - map->start_offset = object->start - child->start; + map->start_offset = _START (element) - _START (child); } else { /* Or update the parent start */ object->priv->initiated_move = child; - ges_timeline_object_set_start (object, child->start + map->start_offset); + _set_start0 (element, _START (child) + map->start_offset); object->priv->initiated_move = NULL; } } @@ -2012,23 +1652,23 @@ track_object_inpoint_changed_cb (GESTrackObject * child, GParamSpec * arg G_GNUC_UNUSED, GESTimelineObject * object) { ObjectMapping *map; + GESTimelineElement *element = GES_TIMELINE_ELEMENT (object); if (object->priv->ignore_notifies) return; - map = find_object_mapping (object, child); + map = find_object_mapping (GES_TIMELINE_OBJECT (element), child); if (G_UNLIKELY (map == NULL)) /* something massively screwed up if we get this */ return; if (!ges_track_object_is_locked (child)) { /* Update the internal start_offset */ - map->inpoint_offset = object->inpoint - child->inpoint; + map->inpoint_offset = _INPOINT (element) - _INPOINT (child); } else { /* Or update the parent start */ object->priv->initiated_move = child; - ges_timeline_object_set_inpoint (object, - child->inpoint + map->inpoint_offset); + _set_inpoint0 (element, _INPOINT (child) + map->inpoint_offset); object->priv->initiated_move = NULL; } @@ -2039,6 +1679,7 @@ track_object_duration_changed_cb (GESTrackObject * child, GParamSpec * arg G_GNUC_UNUSED, GESTimelineObject * object) { ObjectMapping *map; + GESTimelineElement *element = GES_TIMELINE_ELEMENT (object); if (object->priv->ignore_notifies) return; @@ -2050,12 +1691,11 @@ track_object_duration_changed_cb (GESTrackObject * child, if (!ges_track_object_is_locked (child)) { /* Update the internal start_offset */ - map->duration_offset = object->duration - child->duration; + map->duration_offset = _DURATION (element) - _DURATION (child); } else { /* Or update the parent start */ object->priv->initiated_move = child; - ges_timeline_object_set_duration (object, - child->duration + map->duration_offset); + _set_duration0 (element, _DURATION (child) + map->duration_offset); object->priv->initiated_move = NULL; } @@ -2066,12 +1706,12 @@ track_object_priority_changed_cb (GESTrackObject * child, GParamSpec * arg G_GNUC_UNUSED, GESTimelineObject * object) { ObjectMapping *map; + GESTimelineElement *element = GES_TIMELINE_ELEMENT (object); guint32 layer_min_gnl_prio, layer_max_gnl_prio; - guint tck_priority = ges_track_object_get_priority (child); + guint tck_priority = _PRIORITY (child); - GST_DEBUG ("TrackObject %p priority changed to %i", child, - ges_track_object_get_priority (child)); + GST_DEBUG ("TrackObject %p priority changed to %i", child, _PRIORITY (child)); if (object->priv->ignore_notifies) return; @@ -2088,31 +1728,30 @@ track_object_priority_changed_cb (GESTrackObject * child, if (!ges_track_object_is_locked (child)) { if (tck_priority < layer_min_gnl_prio || tck_priority > layer_max_gnl_prio) { GST_WARNING ("%p priority of %i, is outside of its containing " - "layer space. (%d/%d). This is a bug in the program.", object, + "layer space. (%d/%d). This is a bug in the program.", element, tck_priority, layer_min_gnl_prio, layer_max_gnl_prio); } /* Update the internal priority_offset */ - map->priority_offset = - tck_priority - (layer_min_gnl_prio + object->priority); + map->priority_offset = tck_priority - (layer_min_gnl_prio + + _PRIORITY (element)); - } else if (tck_priority < layer_min_gnl_prio + object->priority) { - /* Or update the parent priority, the object priority is always the + } else if (tck_priority < layer_min_gnl_prio + _PRIORITY (element)) { + /* Or update the parent priority, the element priority is always the * highest priority (smaller number) */ if (tck_priority < layer_min_gnl_prio || layer_max_gnl_prio < tck_priority) { GST_WARNING ("%p priority of %i, is outside of its containing " - "layer space. (%d/%d). This is a bug in the program.", object, + "layer space. (%d/%d). This is a bug in the program.", element, tck_priority, layer_min_gnl_prio, layer_max_gnl_prio); return; } - ges_timeline_object_set_priority (object, - tck_priority - layer_min_gnl_prio); + _set_priority0 (element, tck_priority - layer_min_gnl_prio); } - GST_DEBUG ("object %p priority %d child %p priority %d", object, - object->priority, child, ges_track_object_get_priority (child)); + GST_DEBUG_OBJECT (element, "priority %d child %p priority %d", + _PRIORITY (element), child, _PRIORITY (child)); } static void diff --git a/ges/ges-timeline-object.h b/ges/ges-timeline-object.h index 8d4a327393..79a1448de7 100644 --- a/ges/ges-timeline-object.h +++ b/ges/ges-timeline-object.h @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -100,38 +101,6 @@ typedef GESTrackObject *(*GESCreateTrackObjectFunc) (GESTimelineObject * object, typedef GList * (*GESCreateTrackObjectsFunc) (GESTimelineObject * object, GESTrackType type); -/** - * GES_TIMELINE_OBJECT_START: - * @obj: a #GESTimelineObject - * - * The start position of the object (in nanoseconds). - */ -#define GES_TIMELINE_OBJECT_START(obj) (((GESTimelineObject*)obj)->start) - -/** - * GES_TIMELINE_OBJECT_INPOINT: - * @obj: a #GESTimelineObject - * - * The in-point of the object (in nanoseconds). - */ -#define GES_TIMELINE_OBJECT_INPOINT(obj) (((GESTimelineObject*)obj)->inpoint) - -/** - * GES_TIMELINE_OBJECT_DURATION: - * @obj: a #GESTimelineObject - * - * The duration position of the object (in nanoseconds). - */ -#define GES_TIMELINE_OBJECT_DURATION(obj) (((GESTimelineObject*)obj)->duration) - -/** - * GES_TIMELINE_OBJECT_PRIORITY: - * @obj: a #GESTimelineObject - * - * The priority of the object. - */ -#define GES_TIMELINE_OBJECT_PRIORITY(obj) (((GESTimelineObject*)obj)->priority) - /** * GES_TIMELINE_OBJECT_HEIGHT: * @obj: a #GESTimelineObject @@ -149,23 +118,16 @@ typedef GList * (*GESCreateTrackObjectsFunc) (GESTimelineObject * object, GESTra */ struct _GESTimelineObject { - GInitiallyUnowned parent; + GESTimelineElement parent; /*< readonly >*/ GList *trackobjects; /* We don't add those properties to the priv struct for optimization purposes * start, inpoint, duration and fullduration are in nanoseconds */ - guint64 start; /* position (in time) of the object in the layer */ - guint64 inpoint; /* in-point */ - guint64 duration; /* duration of the object used in the layer */ - guint32 priority; /* priority of the object in the layer (0:top priority) */ guint32 height; /* the span of priorities this object needs */ guint64 fullduration; /* Full usable duration of the object (-1: no duration) */ - /*< protected >*/ - GESAsset *asset; - /*< private >*/ GESTimelineObjectPrivate *priv; @@ -187,15 +149,13 @@ struct _GESTimelineObject * operation when a #GESTrackObject is added. Since: 0.10.2 * @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. */ struct _GESTimelineObjectClass { /*< private > */ - GInitiallyUnownedClass parent_class; + GESTimelineElementClass parent_class; /*< public > */ GESCreateTrackObjectFunc create_track_object; @@ -210,8 +170,6 @@ struct _GESTimelineObjectClass 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 */ @@ -221,19 +179,6 @@ struct _GESTimelineObjectClass GType ges_timeline_object_get_type (void); /* Setters */ -void ges_timeline_object_set_start (GESTimelineObject *object, - guint64 start); -void ges_timeline_object_set_inpoint (GESTimelineObject *object, - 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); @@ -263,13 +208,10 @@ gboolean ges_timeline_object_set_top_effect_priority (GESTimelineObject *object, /* Editing */ GESTimelineObject *ges_timeline_object_split (GESTimelineObject *object, guint64 position); void ges_timeline_object_objects_set_locked (GESTimelineObject *object, gboolean locked); -gboolean ges_timeline_object_ripple (GESTimelineObject *object, guint64 start); -gboolean ges_timeline_object_ripple_end (GESTimelineObject *object, guint64 end); -gboolean ges_timeline_object_roll_start (GESTimelineObject *object, guint64 start); -gboolean ges_timeline_object_roll_end (GESTimelineObject *object, guint64 end); -gboolean ges_timeline_object_trim_start (GESTimelineObject *object, guint64 start); + gboolean ges_timeline_object_edit (GESTimelineObject *object, GList *layers, gint new_layer_priority, GESEditMode mode, GESEdge edge, guint64 position); + G_END_DECLS #endif /* _GES_TIMELINE_OBJECT */ diff --git a/ges/ges-timeline-test-source.c b/ges/ges-timeline-test-source.c index 47c1010092..90b460c8be 100644 --- a/ges/ges-timeline-test-source.c +++ b/ges/ges-timeline-test-source.c @@ -174,7 +174,7 @@ ges_timeline_test_source_init (GESTimelineTestSource * self) self->priv->freq = 0; self->priv->volume = 0; - GES_TIMELINE_OBJECT (self)->duration = 0; + GES_TIMELINE_ELEMENT (self)->duration = 0; } /** diff --git a/ges/ges-timeline-text-overlay.c b/ges/ges-timeline-text-overlay.c index 7adeb08283..54a1fe6006 100644 --- a/ges/ges-timeline-text-overlay.c +++ b/ges/ges-timeline-text-overlay.c @@ -245,7 +245,7 @@ ges_timeline_text_overlay_init (GESTimelineTextOverlay * self) self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GES_TYPE_TIMELINE_TEXT_OVERLAY, GESTimelineTextOverlayPrivate); - GES_TIMELINE_OBJECT (self)->duration = 0; + GES_TIMELINE_ELEMENT (self)->duration = 0; /* Not 100% needed since gobject contents are memzero'd when created */ self->priv->text = NULL; self->priv->font_desc = NULL; diff --git a/ges/ges-timeline-title-source.c b/ges/ges-timeline-title-source.c index 5319d7720d..0a5c3a2b9e 100644 --- a/ges/ges-timeline-title-source.c +++ b/ges/ges-timeline-title-source.c @@ -290,7 +290,7 @@ ges_timeline_title_source_init (GESTimelineTitleSource * self) self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GES_TYPE_TIMELINE_TITLE_SOURCE, GESTimelineTitleSourcePrivate); - GES_TIMELINE_OBJECT (self)->duration = 0; + GES_TIMELINE_ELEMENT (self)->duration = 0; /* Not 100% required since a new gobject's content will always be memzero'd */ self->priv->mute = FALSE; self->priv->text = NULL; diff --git a/ges/ges-timeline.c b/ges/ges-timeline.c index b8088ba8f8..ea66415ca7 100644 --- a/ges/ges-timeline.c +++ b/ges/ges-timeline.c @@ -508,7 +508,7 @@ ges_timeline_init (GESTimeline * self) priv = self->priv; self->layers = NULL; self->tracks = NULL; - priv->duration = 0; + self->priv->duration = 0; priv->snapping_distance = 0; /* Move context initialization */ @@ -598,7 +598,7 @@ static void sort_track_objects (GESTimeline * timeline, TrackObjIters * iters) { g_sequence_sort_changed (iters->iter_obj, - (GCompareDataFunc) track_object_start_compare, NULL); + (GCompareDataFunc) element_start_compare, NULL); } static gint @@ -623,11 +623,11 @@ custom_find_track (TrackPrivate * tr_priv, GESTrack * track) static inline void sort_starts_ends_end (GESTimeline * timeline, TrackObjIters * iters) { - GESTrackObject *obj = iters->tckobj; + GESTimelineElement *obj = GES_TIMELINE_ELEMENT (iters->tckobj); GESTimelinePrivate *priv = timeline->priv; guint64 *end = g_hash_table_lookup (priv->by_end, obj); - *end = obj->start + obj->duration; + *end = _START (obj) + _DURATION (obj); g_sequence_sort_changed (iters->iter_end, (GCompareDataFunc) compare_uint64, NULL); @@ -637,11 +637,11 @@ sort_starts_ends_end (GESTimeline * timeline, TrackObjIters * iters) static inline void sort_starts_ends_start (GESTimeline * timeline, TrackObjIters * iters) { - GESTrackObject *obj = iters->tckobj; + GESTimelineElement *obj = GES_TIMELINE_ELEMENT (iters->tckobj); GESTimelinePrivate *priv = timeline->priv; guint64 *start = g_hash_table_lookup (priv->by_start, obj); - *start = obj->start; + *start = _START (obj); g_sequence_sort_changed (iters->iter_start, (GCompareDataFunc) compare_uint64, NULL); @@ -749,10 +749,10 @@ _create_auto_transition_from_transitions (GESTimeline * timeline, if (ges_track_object_get_track (maybe_transition) != track) continue; - if (maybe_transition->start > next->start) + if (_START (maybe_transition) > _START (next)) break; - else if (maybe_transition->start != next->start || - maybe_transition->duration != transition_duration) + else if (_START (maybe_transition) != _START (next) || + _DURATION (maybe_transition) != transition_duration) continue; else if (GES_IS_TRACK_TRANSITION (maybe_transition)) /* Use that transition */ @@ -761,7 +761,7 @@ _create_auto_transition_from_transitions (GESTimeline * timeline, * object to use it */ return create_transition (timeline, prev, next, ges_track_object_get_timeline_object (maybe_transition), layer, - next->start, transition_duration); + _START (next), transition_duration); } return NULL; @@ -798,7 +798,7 @@ _create_transitions_on_layer (GESTimeline * timeline, GESTimelineLayer * layer, start_or_end); /* Only object that are in that layer and track */ - if ((next->priority / LAYER_HEIGHT) != layer_prio || + if ((_PRIORITY (next) / LAYER_HEIGHT) != layer_prio || (track && track != ges_track_object_get_track (next))) continue; @@ -825,15 +825,15 @@ _create_transitions_on_layer (GESTimeline * timeline, GESTimelineLayer * layer, if (ctrack != ges_track_object_get_track (prev)) continue; - transition_duration = (prev->start + prev->duration) - next->start; - if (transition_duration > 0 && transition_duration < prev->duration && - transition_duration < next->duration) { + transition_duration = (_START (prev) + _DURATION (prev)) - _START (next); + if (transition_duration > 0 && transition_duration < _DURATION (prev) && + transition_duration < _DURATION (next)) { transition = get_auto_transition (timeline, layer, ctrack, prev, next, transition_duration); if (!transition) transition = create_transition (timeline, prev, next, NULL, layer, - next->start, transition_duration); + _START (next), transition_duration); } } @@ -859,7 +859,7 @@ create_transitions (GESTimeline * timeline, GESTrackObject * tck_obj) track = ges_track_object_get_track (tck_obj); layer_node = g_list_find_custom (timeline->layers, - GINT_TO_POINTER (tck_obj->priority / LAYER_HEIGHT), + GINT_TO_POINTER (_PRIORITY (tck_obj) / LAYER_HEIGHT), (GCompareFunc) find_layer_by_prio); _create_transitions_on_layer (timeline, @@ -931,7 +931,7 @@ start_tracking_track_object (GESTimeline * timeline, GESTrackObject * tckobj) TrackObjIters *iters; GESTimelinePrivate *priv = timeline->priv; - guint layer_prio = tckobj->priority / LAYER_HEIGHT; + guint layer_prio = _PRIORITY (tckobj) / LAYER_HEIGHT; GList *layer_node = g_list_find_custom (timeline->layers, GINT_TO_POINTER (layer_prio), (GCompareFunc) find_layer_by_prio); GESTimelineLayer *layer = layer_node ? layer_node->data : NULL; @@ -956,7 +956,7 @@ start_tracking_track_object (GESTimeline * timeline, GESTrackObject * tckobj) } else { by_layer_sequence = g_hash_table_lookup (priv->by_layer, layer); iters->iter_by_layer = g_sequence_insert_sorted (by_layer_sequence, tckobj, - (GCompareDataFunc) track_object_start_compare, NULL); + (GCompareDataFunc) element_start_compare, NULL); iters->layer = layer; } @@ -964,8 +964,8 @@ start_tracking_track_object (GESTimeline * timeline, GESTrackObject * tckobj) /* Track only sources for timeline edition and snapping */ pstart = g_malloc (sizeof (guint64)); pend = g_malloc (sizeof (guint64)); - *pstart = tckobj->start; - *pend = *pstart + tckobj->duration; + *pstart = _START (tckobj); + *pend = *pstart + _DURATION (tckobj); iters->iter_start = g_sequence_insert_sorted (priv->starts_ends, pstart, (GCompareDataFunc) compare_uint64, NULL); @@ -973,7 +973,7 @@ start_tracking_track_object (GESTimeline * timeline, GESTrackObject * tckobj) (GCompareDataFunc) compare_uint64, NULL); iters->iter_obj = g_sequence_insert_sorted (priv->tracksources, g_object_ref (tckobj), - (GCompareDataFunc) track_object_start_compare, NULL); + (GCompareDataFunc) element_start_compare, NULL); iters->tckobj = tckobj; g_hash_table_insert (priv->by_start, tckobj, pstart); @@ -1170,7 +1170,7 @@ ges_move_context_set_objects (GESTimeline * timeline, GESTrackObject * obj, case GES_EDGE_START: /* set it properly in the context of "trimming" */ mv_ctx->max_trim_pos = 0; - start = obj->start; + start = _START (obj); if (g_sequence_iter_is_begin (tckobj_iter)) break; @@ -1181,10 +1181,10 @@ ges_move_context_set_objects (GESTimeline * timeline, GESTrackObject * obj, iter = g_sequence_iter_prev (iter)) { tmptckobj = GES_TRACK_OBJECT (g_sequence_get (iter)); - tmpend = tmptckobj->start + tmptckobj->duration; + tmpend = _START (tmptckobj) + _DURATION (tmptckobj); if (tmpend <= start) { - mv_ctx->max_trim_pos = MAX (mv_ctx->max_trim_pos, tmptckobj->start); + mv_ctx->max_trim_pos = MAX (mv_ctx->max_trim_pos, _START (tmptckobj)); mv_ctx->moving_tckobjs = g_list_prepend (mv_ctx->moving_tckobjs, tmptckobj); } @@ -1196,9 +1196,7 @@ ges_move_context_set_objects (GESTimeline * timeline, GESTrackObject * obj, case GES_EDGE_END: case GES_EDGE_NONE: /* In this case only works for ripple */ - end = ges_track_object_get_start (obj) + - ges_track_object_get_duration (obj); - + end = _START (obj) + _DURATION (obj); mv_ctx->max_trim_pos = G_MAXUINT64; /* Look for folowing objects */ @@ -1207,8 +1205,8 @@ ges_move_context_set_objects (GESTimeline * timeline, GESTrackObject * obj, iter = g_sequence_iter_next (iter)) { tmptckobj = GES_TRACK_OBJECT (g_sequence_get (iter)); - if (tmptckobj->start >= end) { - tmpend = tmptckobj->start + tmptckobj->duration; + if (_START (tmptckobj) >= end) { + tmpend = _START (tmptckobj) + _DURATION (tmptckobj); mv_ctx->max_trim_pos = MIN (mv_ctx->max_trim_pos, tmpend); mv_ctx->moving_tckobjs = g_list_prepend (mv_ctx->moving_tckobjs, tmptckobj); @@ -1296,13 +1294,13 @@ ges_timeline_trim_object_simple (GESTimeline * timeline, GESTrackObject * obj, GST_DEBUG_OBJECT (obj, "Trimming to %" GST_TIME_FORMAT " %s snaping, edge %i", GST_TIME_ARGS (position), snapping ? "Is" : "Not", edge); - start = ges_track_object_get_start (obj); + start = _START (obj); g_object_get (obj, "max-duration", &max_duration, NULL); switch (edge) { case GES_EDGE_START: - inpoint = obj->inpoint; - duration = obj->duration; + inpoint = _INPOINT (obj); + duration = _DURATION (obj); if (snapping) { cur = g_hash_table_lookup (timeline->priv->by_start, obj); @@ -1323,14 +1321,14 @@ ges_timeline_trim_object_simple (GESTimeline * timeline, GESTrackObject * obj, real_dur = start + duration - nstart; /* FIXME: Why CLAMP (0, real_dur, max_duration) doesn't work? */ duration = MAX (0, real_dur); - duration = MIN (duration, max_duration - obj->inpoint); + duration = MIN (duration, max_duration - _INPOINT (obj)); timeline->priv->needs_transitions_update = FALSE; - ges_track_object_set_start (obj, nstart); - ges_track_object_set_inpoint (obj, inpoint); + _set_start0 (GES_TIMELINE_ELEMENT (obj), nstart); + _set_inpoint0 (GES_TIMELINE_ELEMENT (obj), inpoint); timeline->priv->needs_transitions_update = TRUE; - ges_track_object_set_duration (obj, duration); + _set_duration0 (GES_TIMELINE_ELEMENT (obj), duration); break; case GES_EDGE_END: { @@ -1342,9 +1340,9 @@ ges_timeline_trim_object_simple (GESTimeline * timeline, GESTrackObject * obj, /* Calculate new values */ real_dur = position - start; duration = MAX (0, real_dur); - duration = MIN (duration, max_duration - obj->inpoint); + duration = MIN (duration, max_duration - _INPOINT (obj)); - ges_track_object_set_duration (obj, duration); + _set_duration0 (GES_TIMELINE_ELEMENT (obj), duration); break; } default: @@ -1383,11 +1381,11 @@ timeline_ripple_object (GESTimeline * timeline, GESTrackObject * obj, if (snapped) position = *snapped; - offset = position - obj->start; + offset = position - _START (obj); for (tmp = mv_ctx->moving_tckobjs; tmp; tmp = tmp->next) { tckobj = GES_TRACK_OBJECT (tmp->data); - new_start = tckobj->start + offset; + new_start = _START (tckobj) + offset; tlobj = add_moving_timeline_object (mv_ctx, tckobj); @@ -1395,16 +1393,16 @@ timeline_ripple_object (GESTimeline * timeline, GESTrackObject * obj, /* Make sure not to move 2 times the same TimelineObject */ if (g_list_find (moved_tlobjs, tlobj) == NULL) { - ges_track_object_set_start (tckobj, new_start); + _set_start0 (GES_TIMELINE_ELEMENT (tckobj), new_start); moved_tlobjs = g_list_prepend (moved_tlobjs, tlobj); } } else { - ges_track_object_set_start (tckobj, new_start); + _set_start0 (GES_TIMELINE_ELEMENT (tckobj), new_start); } } g_list_free (moved_tlobjs); - ges_track_object_set_start (obj, position); + _set_start0 (GES_TIMELINE_ELEMENT (obj), position); break; case GES_EDGE_END: @@ -1416,14 +1414,14 @@ timeline_ripple_object (GESTimeline * timeline, GESTrackObject * obj, if (snapped) position = *snapped; - duration = obj->duration; + duration = _DURATION (obj); - ges_track_object_set_duration (obj, position - obj->start); + _set_duration0 (GES_TIMELINE_ELEMENT (obj), position - _START (obj)); - offset = obj->duration - duration; + offset = _DURATION (obj) - duration; for (tmp = mv_ctx->moving_tckobjs; tmp; tmp = tmp->next) { tckobj = GES_TRACK_OBJECT (tmp->data); - new_start = tckobj->start + offset; + new_start = _START (tckobj) + offset; tlobj = add_moving_timeline_object (mv_ctx, tckobj); @@ -1431,12 +1429,12 @@ timeline_ripple_object (GESTimeline * timeline, GESTrackObject * obj, /* Make sure not to move 2 times the same TimelineObject */ if (g_list_find (moved_tlobjs, tlobj) == NULL) { - ges_track_object_set_start (tckobj, new_start); + _set_start0 (GES_TIMELINE_ELEMENT (tckobj), new_start); moved_tlobjs = g_list_prepend (moved_tlobjs, tlobj); } } else { - ges_track_object_set_start (tckobj, new_start); + _set_start0 (GES_TIMELINE_ELEMENT (tckobj), new_start); } } @@ -1516,8 +1514,8 @@ timeline_roll_object (GESTimeline * timeline, GESTrackObject * obj, edge, layers)) goto error; - start = ges_track_object_get_start (obj); - duration = ges_track_object_get_duration (obj); + start = _START (obj); + duration = _DURATION (obj); end = start + duration; timeline->priv->needs_transitions_update = FALSE; @@ -1539,14 +1537,14 @@ timeline_roll_object (GESTimeline * timeline, GESTrackObject * obj, /* In the case we reached max_duration we just make sure to roll * everything to the real new position */ - position = obj->start; + position = _START (obj); /* Send back changes to the neighbourhood */ for (tmp = mv_ctx->moving_tckobjs; tmp; tmp = tmp->next) { GESTrackObject *tmptckobj = GES_TRACK_OBJECT (tmp->data); - tmpstart = ges_track_object_get_start (tmptckobj); - tmpduration = ges_track_object_get_duration (tmptckobj); + tmpstart = _START (tmptckobj); + tmpduration = _DURATION (tmptckobj); tmpend = tmpstart + tmpduration; /* Check that the object should be resized at this position @@ -1564,7 +1562,7 @@ timeline_roll_object (GESTimeline * timeline, GESTrackObject * obj, if (position > mv_ctx->max_trim_pos || position < start) goto error; - end = obj->start + obj->duration; + end = _START (obj) + _DURATION (obj); cur = g_hash_table_lookup (timeline->priv->by_end, obj); snapped = ges_timeline_snap_position (timeline, obj, cur, position, TRUE); @@ -1576,14 +1574,14 @@ timeline_roll_object (GESTimeline * timeline, GESTrackObject * obj, /* In the case we reached max_duration we just make sure to roll * everything to the real new position */ - position = obj->start + obj->duration; + position = _START (obj) + _DURATION (obj); /* Send back changes to the neighbourhood */ for (tmp = mv_ctx->moving_tckobjs; tmp; tmp = tmp->next) { GESTrackObject *tmptckobj = GES_TRACK_OBJECT (tmp->data); - tmpstart = ges_track_object_get_start (tmptckobj); - tmpduration = ges_track_object_get_duration (tmptckobj); + tmpstart = _START (tmptckobj); + tmpduration = _DURATION (tmptckobj); tmpend = tmpstart + tmpduration; /* Check that the object should be resized at this position @@ -1635,7 +1633,7 @@ ges_timeline_move_object_simple (GESTimeline * timeline, { guint64 *snap_end, *snap_st, *cur, off1, off2, end; - end = position + object->duration; + end = position + _DURATION (object); cur = g_hash_table_lookup (timeline->priv->by_end, object); GST_DEBUG_OBJECT (timeline, "Moving to %" GST_TIME_FORMAT " (end %" @@ -1665,7 +1663,7 @@ ges_timeline_move_object_simple (GESTimeline * timeline, ges_timeline_emit_snappig (timeline, object, NULL); - ges_track_object_set_start (object, position); + _set_start0 (GES_TIMELINE_ELEMENT (object), position); return TRUE; } @@ -1816,7 +1814,9 @@ add_object_to_tracks (GESTimeline * timeline, GESTimelineObject * object, continue; } - track_object_copy = ges_track_object_copy (track_object, TRUE); + track_object_copy = + GES_TRACK_OBJECT (ges_timeline_element_copy (GES_TIMELINE_ELEMENT + (track_object), TRUE)); GST_LOG_OBJECT (timeline, "Trying to add %p to track %p", track_object_copy, tmp_track); @@ -1920,7 +1920,7 @@ trackobj_start_changed_cb (GESTrackObject * child, if (G_LIKELY (iters->iter_by_layer)) g_sequence_sort_changed (iters->iter_by_layer, - (GCompareDataFunc) track_object_start_compare, NULL); + (GCompareDataFunc) element_start_compare, NULL); if (GES_IS_TRACK_SOURCE (child)) { sort_track_objects (timeline, iters); @@ -1946,7 +1946,7 @@ trackobj_priority_changed_cb (GESTrackObject * child, GESTimelinePrivate *priv = timeline->priv; GList *layer_node = g_list_find_custom (timeline->layers, - GINT_TO_POINTER (child->priority / LAYER_HEIGHT), + GINT_TO_POINTER (_PRIORITY (child) / LAYER_HEIGHT), (GCompareFunc) find_layer_by_prio); GESTimelineLayer *layer = layer_node ? layer_node->data : NULL; TrackObjIters *iters = g_hash_table_lookup (priv->obj_iters, @@ -1968,11 +1968,11 @@ trackobj_priority_changed_cb (GESTrackObject * child, g_sequence_remove (iters->iter_by_layer); iters->iter_by_layer = g_sequence_insert_sorted (by_layer_sequence, child, - (GCompareDataFunc) track_object_start_compare, NULL); + (GCompareDataFunc) element_start_compare, NULL); iters->layer = layer; } else { g_sequence_sort_changed (iters->iter_by_layer, - (GCompareDataFunc) track_object_start_compare, NULL); + (GCompareDataFunc) element_start_compare, NULL); } } diff --git a/ges/ges-track-object.c b/ges/ges-track-object.c index ac482fab07..29c6ac4a40 100644 --- a/ges/ges-track-object.c +++ b/ges/ges-track-object.c @@ -26,7 +26,7 @@ * #GESTrack. * * 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 + * its container, like the start position, the inpoint, the duration and the * priority. */ @@ -37,16 +37,8 @@ #include "ges-meta-container.h" #include -static void ges_extractable_interface_init (GESExtractableInterface * iface); -static void ges_meta_container_interface_init - (GESMetaContainerInterface * iface); - - -G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GESTrackObject, ges_track_object, - G_TYPE_INITIALLY_UNOWNED, - G_IMPLEMENT_INTERFACE (GES_TYPE_EXTRACTABLE, ges_extractable_interface_init) - G_IMPLEMENT_INTERFACE (GES_TYPE_META_CONTAINER, - ges_meta_container_interface_init)); +G_DEFINE_ABSTRACT_TYPE (GESTrackObject, ges_track_object, + GES_TYPE_TIMELINE_ELEMENT); struct _GESTrackObjectPrivate { @@ -72,8 +64,6 @@ struct _GESTrackObjectPrivate gboolean valid; - guint64 maxduration; - gboolean locked; /* If TRUE, then moves in sync with its controlling * GESTimelineObject */ }; @@ -81,13 +71,8 @@ struct _GESTrackObjectPrivate enum { PROP_0, - PROP_START, - PROP_INPOINT, - PROP_DURATION, - PROP_PRIORITY, PROP_ACTIVE, PROP_LOCKED, - PROP_MAX_DURATION, PROP_TRACK_TYPE, PROP_TRACK, PROP_LAST @@ -126,15 +111,15 @@ 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); -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); +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); + static inline void ges_track_object_set_locked_internal (GESTrackObject * object, gboolean locked); @@ -148,27 +133,12 @@ ges_track_object_get_property (GObject * object, guint property_id, GESTrackObject *tobj = GES_TRACK_OBJECT (object); switch (property_id) { - case PROP_START: - g_value_set_uint64 (value, ges_track_object_get_start (tobj)); - break; - case PROP_INPOINT: - g_value_set_uint64 (value, ges_track_object_get_inpoint (tobj)); - break; - case PROP_DURATION: - g_value_set_uint64 (value, ges_track_object_get_duration (tobj)); - break; - case PROP_PRIORITY: - g_value_set_uint (value, ges_track_object_get_priority (tobj)); - break; case PROP_ACTIVE: g_value_set_boolean (value, ges_track_object_is_active (tobj)); break; 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; case PROP_TRACK_TYPE: g_value_set_flags (value, tobj->priv->track_type); break; @@ -187,27 +157,12 @@ ges_track_object_set_property (GObject * object, guint property_id, 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; case PROP_ACTIVE: ges_track_object_set_active (tobj, g_value_get_boolean (value)); break; 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; case PROP_TRACK_TYPE: tobj->priv->track_type = g_value_get_flags (value); break; @@ -256,6 +211,7 @@ static void ges_track_object_class_init (GESTrackObjectClass * klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + GESTimelineElementClass *element_class = GES_TIMELINE_ELEMENT_CLASS (klass); g_type_class_add_private (klass, sizeof (GESTrackObjectPrivate)); @@ -264,59 +220,6 @@ ges_track_object_class_init (GESTrackObjectClass * klass) object_class->dispose = ges_track_object_dispose; object_class->finalize = ges_track_object_finalize; - /** - * GESTrackObject:start: - * - * The position of the object in the container #GESTrack (in nanoseconds). - */ - properties[PROP_START] = g_param_spec_uint64 ("start", "Start", - "The position in the container", 0, G_MAXUINT64, 0, G_PARAM_READWRITE); - g_object_class_install_property (object_class, PROP_START, - properties[PROP_START]); - - /** - * GESTrackObject:in-point: - * - * The in-point at which this #GESTrackObject will start outputting data - * from its contents (in nanoseconds). - * - * Ex: an in-point of 5 seconds means that the first outputted buffer will - * be the one located 5 seconds in the controlled resource. - */ - properties[PROP_INPOINT] = - g_param_spec_uint64 ("in-point", "In-point", "The in-point", 0, - G_MAXUINT64, 0, G_PARAM_READWRITE); - g_object_class_install_property (object_class, PROP_INPOINT, - properties[PROP_INPOINT]); - - /** - * GESTrackObject:duration: - * - * The duration (in nanoseconds) which will be used in the container #GESTrack - * starting from 'in-point'. - * - */ - properties[PROP_DURATION] = - g_param_spec_uint64 ("duration", "Duration", "The duration to use", 0, - G_MAXUINT64, GST_SECOND, G_PARAM_READWRITE); - g_object_class_install_property (object_class, PROP_DURATION, - properties[PROP_DURATION]); - - /** - * 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). - */ - properties[PROP_PRIORITY] = g_param_spec_uint ("priority", "Priority", - "The priority of the object", 0, G_MAXUINT, 0, G_PARAM_READWRITE); - g_object_class_install_property (object_class, PROP_PRIORITY, - properties[PROP_PRIORITY]); /** * GESTrackObject:active: @@ -342,21 +245,6 @@ ges_track_object_class_init (GESTrackObjectClass * klass) g_object_class_install_property (object_class, PROP_LOCKED, properties[PROP_LOCKED]); - /** - * GESTrackObject:max-duration: - * - * The maximum duration (in nanoseconds) of the #GESTrackObject. - * - * Since: 0.10.XX - */ - properties[PROP_MAX_DURATION] = - g_param_spec_uint64 ("max-duration", "Maximum duration", - "The maximum duration of the object", 0, G_MAXUINT64, G_MAXUINT64, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT); - - g_object_class_install_property (object_class, PROP_MAX_DURATION, - properties[PROP_MAX_DURATION]); - 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); @@ -386,6 +274,12 @@ ges_track_object_class_init (GESTrackObjectClass * klass) G_SIGNAL_NO_HOOKS, 0, NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 2, GST_TYPE_ELEMENT, G_TYPE_PARAM); + 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; + klass->create_gnl_object = ges_track_object_create_gnl_object_func; /* There is no 'get_props_hashtable' default implementation */ klass->get_props_hastable = NULL; @@ -406,61 +300,38 @@ ges_track_object_init (GESTrackObject * self) priv->pending_active = TRUE; priv->locked = TRUE; priv->properties_hashtable = NULL; - priv->maxduration = GST_CLOCK_TIME_NONE; } -static void -ges_extractable_interface_init (GESExtractableInterface * iface) +static gboolean +_set_start (GESTimelineElement * element, GstClockTime start) { -} + GESTrackObject *object = GES_TRACK_OBJECT (element); -static void -ges_meta_container_interface_init (GESMetaContainerInterface * iface) -{ - -} - -static inline gboolean -ges_track_object_set_start_internal (GESTrackObject * object, guint64 start) -{ GST_DEBUG ("object:%p, start:%" GST_TIME_FORMAT, object, GST_TIME_ARGS (start)); if (object->priv->gnlobject != NULL) { - if (G_UNLIKELY (start == object->start)) + if (G_UNLIKELY (start == _START (object))) return FALSE; g_object_set (object->priv->gnlobject, "start", start, NULL); } else object->priv->pending_start = start; + return TRUE; -}; - -/** - * 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) -{ - g_return_if_fail (GES_IS_TRACK_OBJECT (object)); - - if (ges_track_object_set_start_internal (object, start)) - g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_START]); } -static inline gboolean -ges_track_object_set_inpoint_internal (GESTrackObject * object, guint64 inpoint) +static gboolean +_set_inpoint (GESTimelineElement * element, GstClockTime inpoint) { + GESTrackObject *object = GES_TRACK_OBJECT (element); GST_DEBUG ("object:%p, inpoint:%" GST_TIME_FORMAT, object, GST_TIME_ARGS (inpoint)); if (object->priv->gnlobject != NULL) { - if (G_UNLIKELY (inpoint == object->inpoint)) + if (G_UNLIKELY (inpoint == _INPOINT (object))) + return FALSE; g_object_set (object->priv->gnlobject, "media-start", inpoint, NULL); @@ -470,37 +341,21 @@ ges_track_object_set_inpoint_internal (GESTrackObject * object, guint64 inpoint) return TRUE; } -/** - * 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) -{ - g_return_if_fail (GES_IS_TRACK_OBJECT (object)); - - if (ges_track_object_set_inpoint_internal (object, inpoint)) - g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_INPOINT]); -} - -static inline gboolean -ges_track_object_set_duration_internal (GESTrackObject * object, - guint64 duration) +static gboolean +_set_duration (GESTimelineElement * element, GstClockTime duration) { + GESTrackObject *object = GES_TRACK_OBJECT (element); GESTrackObjectPrivate *priv = object->priv; GST_DEBUG ("object:%p, duration:%" GST_TIME_FORMAT, object, GST_TIME_ARGS (duration)); - if (GST_CLOCK_TIME_IS_VALID (priv->maxduration) && - duration > object->inpoint + priv->maxduration) - duration = priv->maxduration - object->inpoint; + if (GST_CLOCK_TIME_IS_VALID (_MAXDURATION (element)) && + duration > _INPOINT (object) + _MAXDURATION (element)) + duration = _MAXDURATION (element) - _INPOINT (object); if (priv->gnlobject != NULL) { - if (G_UNLIKELY (duration == object->duration)) + if (G_UNLIKELY (duration == _DURATION (object))) return FALSE; g_object_set (priv->gnlobject, "duration", duration, @@ -511,60 +366,24 @@ ges_track_object_set_duration_internal (GESTrackObject * object, return TRUE; } -/** - * 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) +static gboolean +_set_priority (GESTimelineElement * element, guint32 priority) { - g_return_if_fail (GES_IS_TRACK_OBJECT (object)); + GESTrackObject *object = GES_TRACK_OBJECT (element); - if (ges_track_object_set_duration_internal (object, duration)) - g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_DURATION]); -} - -static inline gboolean -ges_track_object_set_priority_internal (GESTrackObject * object, - guint32 priority) -{ GST_DEBUG ("object:%p, priority:%" G_GUINT32_FORMAT, object, priority); if (object->priv->gnlobject != NULL) { - if (G_UNLIKELY (priority == object->priority)) + if (G_UNLIKELY (priority == _PRIORITY (object))) return FALSE; g_object_set (object->priv->gnlobject, "priority", priority, NULL); } else object->priv->pending_priority = priority; + return TRUE; } -/** - * 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]); -} - - /** * ges_track_object_set_active: * @object: a #GESTrackObject @@ -617,19 +436,15 @@ gnlobject_start_cb (GstElement * gnlobject, GParamSpec * arg G_GNUC_UNUSED, GESTrackObject * obj) { guint64 start; - GESTrackObjectClass *klass; - - klass = GES_TRACK_OBJECT_GET_CLASS (obj); 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)); + GST_TIME_FORMAT, GST_TIME_ARGS (start), GST_TIME_ARGS (_START (obj))); - if (start != obj->start) { - obj->start = start; - if (klass->start_changed) - klass->start_changed (obj, start); + if (start != _START (obj)) { + _START (obj) = start; + g_object_notify (G_OBJECT (obj), "start"); } } @@ -671,20 +486,16 @@ static void gnlobject_media_start_cb (GstElement * gnlobject, GParamSpec * arg G_GNUC_UNUSED, GESTrackObject * obj) { - guint64 start; - GESTrackObjectClass *klass; + guint64 inpoint; - klass = GES_TRACK_OBJECT_GET_CLASS (obj); - - g_object_get (gnlobject, "media-start", &start, NULL); + g_object_get (gnlobject, "media-start", &inpoint, NULL); GST_DEBUG ("gnlobject in-point : %" GST_TIME_FORMAT " current : %" - GST_TIME_FORMAT, GST_TIME_ARGS (start), GST_TIME_ARGS (obj->inpoint)); + GST_TIME_FORMAT, GST_TIME_ARGS (inpoint), GST_TIME_ARGS (_INPOINT (obj))); - if (start != obj->inpoint) { - obj->inpoint = start; - if (klass->media_start_changed) - klass->media_start_changed (obj, start); + if (inpoint != _INPOINT (obj)) { + _INPOINT (obj) = inpoint; + g_object_notify (G_OBJECT (obj), "in-point"); } } @@ -693,18 +504,14 @@ gnlobject_priority_cb (GstElement * gnlobject, GParamSpec * arg G_GNUC_UNUSED, GESTrackObject * obj) { guint32 priority; - GESTrackObjectClass *klass; - - klass = GES_TRACK_OBJECT_GET_CLASS (obj); g_object_get (gnlobject, "priority", &priority, NULL); - GST_DEBUG ("gnlobject priority : %d current : %d", priority, obj->priority); + GST_DEBUG ("gnlobject priority : %d current : %d", priority, _PRIORITY (obj)); - if (priority != obj->priority) { - obj->priority = priority; - if (klass->gnl_priority_changed) - klass->gnl_priority_changed (obj, priority); + if (priority != _PRIORITY (obj)) { + _PRIORITY (obj) = priority; + g_object_notify (G_OBJECT (obj), "priority"); } } @@ -720,12 +527,14 @@ gnlobject_duration_cb (GstElement * gnlobject, GParamSpec * arg G_GNUC_UNUSED, g_object_get (gnlobject, "duration", &duration, NULL); GST_DEBUG_OBJECT (gnlobject, "duration : %" GST_TIME_FORMAT " current : %" - GST_TIME_FORMAT, GST_TIME_ARGS (duration), GST_TIME_ARGS (obj->duration)); + GST_TIME_FORMAT, GST_TIME_ARGS (duration), + GST_TIME_ARGS (_DURATION (obj))); - if (duration != obj->duration) { - obj->duration = duration; + if (duration != _DURATION (obj)) { + _DURATION (obj) = duration; if (klass->duration_changed) klass->duration_changed (obj, duration); + g_object_notify (G_OBJECT (obj), "duration"); } } @@ -1075,93 +884,6 @@ ges_track_object_is_locked (GESTrackObject * object) return object->priv->locked; } -/** - * ges_track_object_get_start: - * @object: a #GESTrackObject - * - * Get the position of the object in the container #GESTrack. - * - * Returns: the start position (in #GstClockTime) or #GST_CLOCK_TIME_NONE - * if something went wrong. - * - * Since: 0.10.2 - */ -guint64 -ges_track_object_get_start (GESTrackObject * object) -{ - g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), GST_CLOCK_TIME_NONE); - - 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 - * - * Returns: the in-point (in #GstClockTime) or #GST_CLOCK_TIME_NONE - * if something went wrong. - * - * Since: 0.10.2 - */ -guint64 -ges_track_object_get_inpoint (GESTrackObject * object) -{ - g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), GST_CLOCK_TIME_NONE); - - 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' - * - * Returns: the duration (in #GstClockTime) or #GST_CLOCK_TIME_NONE - * if something went wrong. - * - * Since: 0.10.2 - */ -guint64 -ges_track_object_get_duration (GESTrackObject * object) -{ - g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), GST_CLOCK_TIME_NONE); - - 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. - * - * Returns: the priority of @object or -1 if something went wrong - * - * Since: 0.10.2 - */ -guint32 -ges_track_object_get_priority (GESTrackObject * object) -{ - g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), -1); - - if (G_UNLIKELY (object->priv->gnlobject == NULL)) - return object->priv->pending_priority; - else - return object->priority; -} /** * ges_track_object_is_active: @@ -1680,101 +1402,26 @@ prop_hash_not_set: } } -/** - * 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) +_deep_copy (GESTimelineElement * element, GESTimelineElement * elementcopy) { - g_return_if_fail (GES_IS_TRACK_OBJECT (object)); - - object->priv->maxduration = maxduration; -} - -/** - * ges_track_object_copy: - * @object: The #GESTrackObject to copy - * @deep: whether we want to create the gnlobject and copy it properties - * - * Copies @object - * - * Returns: (transfer floating): The newly create #GESTrackObject, copied from @object - * - * Since: 0.10.XX - */ -GESTrackObject * -ges_track_object_copy (GESTrackObject * object, gboolean deep) -{ - GESTrackObject *ret = NULL; - GParameter *params; GParamSpec **specs; - guint n, n_specs, n_params; + guint n, n_specs; GValue val = { 0 }; + GESTrackObject *copy = GES_TRACK_OBJECT (elementcopy); - g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), NULL); - + ensure_gnl_object (copy); 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); - specs = NULL; - params = NULL; - - if (deep == FALSE) - return ret; - - ensure_gnl_object (ret); - specs = ges_track_object_list_children_properties (object, &n_specs); + ges_track_object_list_children_properties (GES_TRACK_OBJECT (element), + &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_object_get_property (G_OBJECT (element), specs[n]->name, &val); + ges_track_object_set_child_property_by_pspec (copy, specs[n], &val); g_value_unset (&val); } g_free (specs); - g_free (params); - - return ret; } /** diff --git a/ges/ges-track-object.h b/ges/ges-track-object.h index e28d68ca9e..bc19ef3a24 100644 --- a/ges/ges-track-object.h +++ b/ges/ges-track-object.h @@ -46,30 +46,6 @@ G_BEGIN_DECLS #define GES_TRACK_OBJECT_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_TRACK_OBJECT, GESTrackObjectClass)) -/** - * GES_TRACK_OBJECT_START: - * @obj: a #GESTrackObject - * - * The start position of the object (in nanoseconds). - */ -#define GES_TRACK_OBJECT_START(obj) (((GESTrackObject*)obj)->start) - -/** - * GES_TRACK_OBJECT_INPOINT: - * @obj: a #GESTrackObject - * - * The in-point of the object (in nanoseconds). - */ -#define GES_TRACK_OBJECT_INPOINT(obj) (((GESTrackObject*)obj)->inpoint) - -/** - * GES_TRACK_OBJECT_DURATION: - * @obj: a #GESTrackObject - * - * The duration position of the object (in nanoseconds). - */ -#define GES_TRACK_OBJECT_DURATION(obj) (((GESTrackObject*)obj)->duration) - typedef struct _GESTrackObjectPrivate GESTrackObjectPrivate; /** @@ -78,13 +54,9 @@ typedef struct _GESTrackObjectPrivate GESTrackObjectPrivate; * The GESTrackObject base class. */ struct _GESTrackObject { - GInitiallyUnowned parent; + GESTimelineElement parent; /*< private >*/ - guint64 start; - guint64 inpoint; - guint64 duration; - guint32 priority; gboolean active; GESTrackObjectPrivate *priv; @@ -100,10 +72,7 @@ struct _GESTrackObject { * @gnlobject_factorytype: name of the GNonLin GStElementFactory type to use. * @create_gnl_object: method to create the GNonLin container object. * @create_element: method to return the GstElement to put in the gnlobject. - * @start_changed: start property of gnlobject has changed - * @media_start_changed: media-start property of gnlobject has changed * @duration_changed: duration property glnobject has changed - * @gnl_priority_changed: duration property glnobject has changed * @active_changed: active property of gnlobject has changed * @get_props_hastable: method to list children properties that user could like * to configure. Since: 0.10.2 @@ -118,7 +87,7 @@ struct _GESTrackObject { */ struct _GESTrackObjectClass { /*< private >*/ - GInitiallyUnownedClass parent_class; + GESTimelineElementClass parent_class; /*< public >*/ /* virtual methods for subclasses */ @@ -126,9 +95,6 @@ struct _GESTrackObjectClass { GstElement* (*create_gnl_object) (GESTrackObject * object); GstElement* (*create_element) (GESTrackObject * object); - void (*start_changed) (GESTrackObject *object, guint64 start); - void (*media_start_changed) (GESTrackObject *object, guint64 media_start); - void (*gnl_priority_changed) (GESTrackObject *object, guint priority); void (*duration_changed) (GESTrackObject *object, guint64 duration); void (*active_changed) (GESTrackObject *object, gboolean active); @@ -170,29 +136,9 @@ void ges_track_object_set_locked (GESTrackObject * object, gboolean ges_track_object_is_locked (GESTrackObject * object); -void ges_track_object_set_start (GESTrackObject * object, - guint64 start); - -void ges_track_object_set_inpoint (GESTrackObject * object, - guint64 inpoint); - -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); - gboolean ges_track_object_set_active (GESTrackObject * object, gboolean active); -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); GParamSpec ** @@ -232,9 +178,6 @@ void ges_track_object_set_child_properties (GESTrackObject * object, const gchar * first_property_name, ...) G_GNUC_NULL_TERMINATED; -GESTrackObject * ges_track_object_copy (GESTrackObject * object, - gboolean deep); - gboolean ges_track_object_set_child_property (GESTrackObject *object, const gchar *property_name, GValue * value); diff --git a/ges/ges-track.c b/ges/ges-track.c index 851a70d184..31d8c932ef 100644 --- a/ges/ges-track.c +++ b/ges/ges-track.c @@ -192,8 +192,8 @@ update_gaps (GESTrack * track) g_sequence_iter_is_end (it) == FALSE; it = g_sequence_iter_next (it)) { tckobj = g_sequence_get (it); - start = GES_TRACK_OBJECT_START (tckobj); - end = start + GES_TRACK_OBJECT_DURATION (tckobj); + start = _START (tckobj); + end = start + _DURATION (tckobj); if (start > duration) { /* 3- Fill gap */ @@ -206,7 +206,7 @@ update_gaps (GESTrack * track) duration = MAX (duration, end); } - /* 4- Add a gap at the end of the timeline if needed */ + /* 3- Add a gap at the end of the timeline if needed */ if (priv->timeline) { g_object_get (priv->timeline, "duration", &timeline_duration, NULL); @@ -227,7 +227,7 @@ static inline void resort_and_fill_gaps (GESTrack * track) { g_sequence_sort (track->priv->tckobjs_by_start, - (GCompareDataFunc) track_object_start_compare, NULL); + (GCompareDataFunc) element_start_compare, NULL); if (track->priv->updating == TRUE) { update_gaps (track); @@ -749,7 +749,7 @@ ges_track_add_object (GESTrack * track, GESTrackObject * object) g_object_ref_sink (object); g_hash_table_insert (track->priv->tckobjs_iter, object, g_sequence_insert_sorted (track->priv->tckobjs_by_start, object, - (GCompareDataFunc) track_object_start_compare, NULL)); + (GCompareDataFunc) element_start_compare, NULL)); g_signal_emit (track, ges_track_signals[TRACK_OBJECT_ADDED], 0, GES_TRACK_OBJECT (object)); diff --git a/ges/ges-types.h b/ges/ges-types.h index a9ffe81915..fad7d89a7c 100644 --- a/ges/ges-types.h +++ b/ges/ges-types.h @@ -41,6 +41,9 @@ typedef struct _GESTimelineClass GESTimelineClass; typedef struct _GESTimelineLayer GESTimelineLayer; typedef struct _GESTimelineLayerClass GESTimelineLayerClass; +typedef struct _GESTimelineElementClass GESTimelineElementClass; +typedef struct _GESTimelineElement GESTimelineElement; + typedef struct _GESTimelineObject GESTimelineObject; typedef struct _GESTimelineObjectClass GESTimelineObjectClass; diff --git a/ges/ges-utils.c b/ges/ges-utils.c index e3ba51b04d..2229b894eb 100644 --- a/ges/ges-utils.c +++ b/ges/ges-utils.c @@ -61,28 +61,7 @@ ges_timeline_new_audio_video (void) /* Internal utilities */ gint -track_object_start_compare (GESTrackObject * a, GESTrackObject * b) -{ - if (a->start == b->start) { - if (a->priority < b->priority) - return -1; - if (a->priority > b->priority) - return 1; - if (a->duration < b->duration) - return -1; - if (a->duration > b->duration) - return 1; - return 0; - } - if (a->start < b->start) - return -1; - if (a->start > b->start) - return 1; - return 0; -} - -gint -timeline_object_start_compare (GESTimelineObject * a, GESTimelineObject * b) +element_start_compare (GESTimelineElement * a, GESTimelineElement * b) { if (a->start == b->start) { if (a->priority < b->priority) diff --git a/ges/ges-xml-formatter.c b/ges/ges-xml-formatter.c index bd2b663091..5ef4c684ec 100644 --- a/ges/ges-xml-formatter.c +++ b/ges/ges-xml-formatter.c @@ -867,8 +867,8 @@ _save_layers (GString * str, GESTimeline * timeline) G_GUINT64_FORMAT "' rate='%d' properties='%s' >\n", nbtlobjs, ges_extractable_get_id (GES_EXTRACTABLE (tlobj)), g_type_name (G_OBJECT_TYPE (tlobj)), priority, - ges_timeline_object_get_supported_formats (tlobj), tlobj->start, - tlobj->duration, tlobj->inpoint, 0, properties); + ges_timeline_object_get_supported_formats (tlobj), _START (tlobj), + _DURATION (tlobj), _INPOINT (tlobj), 0, properties); g_free (properties); for (tmpeffect = effects; tmpeffect; tmpeffect = tmpeffect->next) diff --git a/ges/ges.h b/ges/ges.h index 7e20712d8e..c943122b41 100644 --- a/ges/ges.h +++ b/ges/ges.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/tests/check/ges/backgroundsource.c b/tests/check/ges/backgroundsource.c index 0ae93c9c22..857f1ea8b9 100644 --- a/tests/check/ges/backgroundsource.c +++ b/tests/check/ges/backgroundsource.c @@ -53,9 +53,9 @@ GST_START_TEST (test_test_source_properties) /* Set some properties */ g_object_set (object, "start", (guint64) 42, "duration", (guint64) 51, "in-point", (guint64) 12, NULL); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 42); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object), 51); - assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 12); + assert_equals_uint64 (_START (object), 42); + assert_equals_uint64 (_DURATION (object), 51); + assert_equals_uint64 (_INPOINT (object), 12); trackobject = ges_timeline_object_create_track_object (object, track->type); ges_timeline_object_add_track_object (object, trackobject); @@ -63,9 +63,9 @@ GST_START_TEST (test_test_source_properties) fail_unless (ges_track_object_set_track (trackobject, track)); /* Check that trackobject has the same properties */ - assert_equals_uint64 (GES_TRACK_OBJECT_START (trackobject), 42); - assert_equals_uint64 (GES_TRACK_OBJECT_DURATION (trackobject), 51); - assert_equals_uint64 (GES_TRACK_OBJECT_INPOINT (trackobject), 12); + assert_equals_uint64 (_START (trackobject), 42); + assert_equals_uint64 (_DURATION (trackobject), 51); + assert_equals_uint64 (_INPOINT (trackobject), 12); /* And let's also check that it propagated correctly to GNonLin */ gnl_object_check (ges_track_object_get_gnlobject (trackobject), 42, 51, 12, @@ -74,12 +74,12 @@ GST_START_TEST (test_test_source_properties) /* Change more properties, see if they propagate */ g_object_set (object, "start", (guint64) 420, "duration", (guint64) 510, "in-point", (guint64) 120, NULL); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 420); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object), 510); - assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 120); - assert_equals_uint64 (GES_TRACK_OBJECT_START (trackobject), 420); - assert_equals_uint64 (GES_TRACK_OBJECT_DURATION (trackobject), 510); - assert_equals_uint64 (GES_TRACK_OBJECT_INPOINT (trackobject), 120); + assert_equals_uint64 (_START (object), 420); + assert_equals_uint64 (_DURATION (object), 510); + assert_equals_uint64 (_INPOINT (object), 120); + assert_equals_uint64 (_START (trackobject), 420); + assert_equals_uint64 (_DURATION (trackobject), 510); + assert_equals_uint64 (_INPOINT (trackobject), 120); /* And let's also check that it propagated correctly to GNonLin */ gnl_object_check (ges_track_object_get_gnlobject (trackobject), 420, 510, 120, @@ -256,8 +256,8 @@ GST_START_TEST (test_gap_filling_basic) /* Set some properties */ g_object_set (object, "start", (guint64) 0, "duration", (guint64) 5, NULL); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 0); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object), 5); + assert_equals_uint64 (_START (object), 0); + assert_equals_uint64 (_DURATION (object), 5); trackobject = ges_timeline_object_create_track_object (object, track->type); ges_timeline_object_add_track_object (object, trackobject); @@ -268,8 +268,8 @@ GST_START_TEST (test_gap_filling_basic) fail_unless (gnlsrc != NULL); /* Check that trackobject has the same properties */ - assert_equals_uint64 (GES_TRACK_OBJECT_START (trackobject), 0); - assert_equals_uint64 (GES_TRACK_OBJECT_DURATION (trackobject), 5); + assert_equals_uint64 (_START (trackobject), 0); + assert_equals_uint64 (_DURATION (trackobject), 5); /* Check no gap were wrongly added */ assert_equals_int (g_list_length (GST_BIN_CHILDREN (composition)), 1); @@ -278,8 +278,8 @@ GST_START_TEST (test_gap_filling_basic) fail_unless (object1 != NULL); g_object_set (object1, "start", (guint64) 15, "duration", (guint64) 5, NULL); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object1), 15); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object1), 5); + assert_equals_uint64 (_START (object1), 15); + assert_equals_uint64 (_DURATION (object1), 5); trackobject1 = ges_timeline_object_create_track_object (object1, track->type); ges_timeline_object_add_track_object (object1, trackobject1); @@ -289,8 +289,8 @@ GST_START_TEST (test_gap_filling_basic) fail_unless (gnlsrc1 != NULL); /* Check that trackobject1 has the same properties */ - assert_equals_uint64 (GES_TRACK_OBJECT_START (trackobject1), 15); - assert_equals_uint64 (GES_TRACK_OBJECT_DURATION (trackobject1), 5); + assert_equals_uint64 (_START (trackobject1), 15); + assert_equals_uint64 (_DURATION (trackobject1), 5); /* Check the gap as properly been added */ assert_equals_int (g_list_length (GST_BIN_CHILDREN (composition)), 3); @@ -312,8 +312,8 @@ GST_START_TEST (test_gap_filling_basic) ges_timeline_object_add_track_object (object2, trackobject2); fail_unless (ges_track_add_object (track, trackobject2)); fail_unless (trackobject2 != NULL); - assert_equals_uint64 (GES_TRACK_OBJECT_START (trackobject2), 35); - assert_equals_uint64 (GES_TRACK_OBJECT_DURATION (trackobject2), 5); + assert_equals_uint64 (_START (trackobject2), 35); + assert_equals_uint64 (_DURATION (trackobject2), 5); assert_equals_int (g_list_length (GST_BIN_CHILDREN (composition)), 5); gst_object_unref (track); diff --git a/tests/check/ges/effects.c b/tests/check/ges/effects.c index 06dec15c85..2e972271bd 100644 --- a/tests/check/ges/effects.c +++ b/tests/check/ges/effects.c @@ -17,6 +17,7 @@ * Boston, MA 02110-1301, USA. */ +#include "test-utils.h" #include #include @@ -288,13 +289,11 @@ GST_START_TEST (test_priorities_tl_object) fail_unless (ges_timeline_object_set_top_effect_priority (GES_TIMELINE_OBJECT (tl_effect), GES_TRACK_EFFECT (tck_effect1), 0)); - fail_unless (ges_track_object_get_priority (GES_TRACK_OBJECT (tck_effect)) == - 3); + fail_unless (_PRIORITY (tck_effect), 3); fail_unless (ges_timeline_object_set_top_effect_priority (GES_TIMELINE_OBJECT (tl_effect), GES_TRACK_EFFECT (tck_effect1), 3)); - fail_unless (ges_track_object_get_priority (GES_TRACK_OBJECT (tck_effect)) == - 2); + fail_unless (_PRIORITY (tck_effect) == 2); g_object_get (tl_effect, "height", &tl_object_height, NULL); fail_unless (tl_object_height == 4); diff --git a/tests/check/ges/filesource.c b/tests/check/ges/filesource.c index 06abb65098..456f01ff31 100644 --- a/tests/check/ges/filesource.c +++ b/tests/check/ges/filesource.c @@ -48,7 +48,7 @@ asset_created_cb (GObject * source, GAsyncResult * res, gpointer udata) asset, 0, 0, GST_CLOCK_TIME_NONE, 1, GES_TRACK_TYPE_UNKNOWN)); fail_unless (GES_IS_TIMELINE_FILE_SOURCE (tlfs)); fail_if (g_strcmp0 (ges_timeline_filesource_get_uri (tlfs), av_uri)); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (tlfs), GST_SECOND); + assert_equals_uint64 (_DURATION (tlfs), GST_SECOND); fail_unless (ges_timeline_object_get_supported_formats (GES_TIMELINE_OBJECT (tlfs)) & GES_TRACK_TYPE_VIDEO); @@ -130,9 +130,9 @@ GST_START_TEST (test_filesource_properties) g_object_set (object, "start", (guint64) 42, "duration", (guint64) 51, "in-point", (guint64) 12, "supported-formats", GES_TRACK_TYPE_AUDIO, NULL); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 42); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object), 51); - assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 12); + assert_equals_uint64 (_START (object), 42); + assert_equals_uint64 (_DURATION (object), 51); + assert_equals_uint64 (_INPOINT (object), 12); trackobject = ges_timeline_object_create_track_object (object, track->type); ges_timeline_object_add_track_object (object, trackobject); @@ -140,9 +140,9 @@ GST_START_TEST (test_filesource_properties) fail_unless (ges_track_object_set_track (trackobject, track)); /* Check that trackobject has the same properties */ - assert_equals_uint64 (GES_TRACK_OBJECT_START (trackobject), 42); - assert_equals_uint64 (GES_TRACK_OBJECT_DURATION (trackobject), 51); - assert_equals_uint64 (GES_TRACK_OBJECT_INPOINT (trackobject), 12); + assert_equals_uint64 (_START (trackobject), 42); + assert_equals_uint64 (_DURATION (trackobject), 51); + assert_equals_uint64 (_INPOINT (trackobject), 12); /* And let's also check that it propagated correctly to GNonLin */ gnl_object_check (ges_track_object_get_gnlobject (trackobject), 42, 51, 12, @@ -151,12 +151,12 @@ GST_START_TEST (test_filesource_properties) /* Change more properties, see if they propagate */ g_object_set (object, "start", (guint64) 420, "duration", (guint64) 510, "in-point", (guint64) 120, NULL); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 420); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object), 510); - assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 120); - assert_equals_uint64 (GES_TRACK_OBJECT_START (trackobject), 420); - assert_equals_uint64 (GES_TRACK_OBJECT_DURATION (trackobject), 510); - assert_equals_uint64 (GES_TRACK_OBJECT_INPOINT (trackobject), 120); + assert_equals_uint64 (_START (object), 420); + assert_equals_uint64 (_DURATION (object), 510); + assert_equals_uint64 (_INPOINT (object), 120); + assert_equals_uint64 (_START (trackobject), 420); + assert_equals_uint64 (_DURATION (trackobject), 510); + assert_equals_uint64 (_INPOINT (trackobject), 120); /* And let's also check that it propagated correctly to GNonLin */ gnl_object_check (ges_track_object_get_gnlobject (trackobject), 420, 510, 120, diff --git a/tests/check/ges/layer.c b/tests/check/ges/layer.c index 12f602d3ac..570de30313 100644 --- a/tests/check/ges/layer.c +++ b/tests/check/ges/layer.c @@ -77,10 +77,10 @@ GST_START_TEST (test_layer_properties) /* Set some properties */ g_object_set (object, "start", (guint64) 42, "duration", (guint64) 51, "in-point", (guint64) 12, NULL); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 42); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object), 51); - assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 12); - assert_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (object), 0); + assert_equals_uint64 (_START (object), 42); + assert_equals_uint64 (_DURATION (object), 51); + assert_equals_uint64 (_INPOINT (object), 12); + assert_equals_uint64 (_PRIORITY (object), 0); /* Add the object to the timeline */ fail_unless (g_object_is_floating (object)); @@ -92,31 +92,31 @@ GST_START_TEST (test_layer_properties) fail_unless (trackobject != NULL); /* This is not a SimpleLayer, therefore the properties shouldn't have changed */ - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 42); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object), 51); - assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 12); - assert_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (object), 0); + assert_equals_uint64 (_START (object), 42); + assert_equals_uint64 (_DURATION (object), 51); + assert_equals_uint64 (_INPOINT (object), 12); + assert_equals_uint64 (_PRIORITY (object), 0); gnl_object_check (ges_track_object_get_gnlobject (trackobject), 42, 51, 12, 51, 0, TRUE); /* Change the priority of the layer */ g_object_set (layer, "priority", 1, NULL); assert_equals_int (ges_timeline_layer_get_priority (layer), 1); - assert_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (object), 0); + assert_equals_uint64 (_PRIORITY (object), 0); gnl_object_check (ges_track_object_get_gnlobject (trackobject), 42, 51, 12, 51, LAYER_HEIGHT, TRUE); /* Change it to an insanely high value */ g_object_set (layer, "priority", 31, NULL); assert_equals_int (ges_timeline_layer_get_priority (layer), 31); - assert_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (object), 0); + assert_equals_uint64 (_PRIORITY (object), 0); gnl_object_check (ges_track_object_get_gnlobject (trackobject), 42, 51, 12, 51, LAYER_HEIGHT * 31, TRUE); /* and back to 0 */ g_object_set (layer, "priority", 0, NULL); assert_equals_int (ges_timeline_layer_get_priority (layer), 0); - assert_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (object), 0); + assert_equals_uint64 (_PRIORITY (object), 0); gnl_object_check (ges_track_object_get_gnlobject (trackobject), 42, 51, 12, 51, 0, TRUE); @@ -183,11 +183,11 @@ GST_START_TEST (test_layer_priorities) /* Set priorities on the objects */ g_object_set (object1, "priority", 0, NULL); - assert_equals_int (GES_TIMELINE_OBJECT_PRIORITY (object1), 0); + assert_equals_int (_PRIORITY (object1), 0); g_object_set (object2, "priority", 1, NULL); - assert_equals_int (GES_TIMELINE_OBJECT_PRIORITY (object2), 1); + assert_equals_int (_PRIORITY (object2), 1); g_object_set (object3, "priority", LAYER_HEIGHT + 1, NULL); - assert_equals_int (GES_TIMELINE_OBJECT_PRIORITY (object3), LAYER_HEIGHT + 1); + assert_equals_int (_PRIORITY (object3), LAYER_HEIGHT + 1); /* Add objects to the timeline */ fail_unless (ges_timeline_layer_add_object (layer1, object1)); @@ -202,20 +202,20 @@ GST_START_TEST (test_layer_priorities) tckobj3 = ges_timeline_object_find_track_object (object3, track, G_TYPE_NONE); fail_unless (tckobj3 != NULL); - assert_equals_int (GES_TIMELINE_OBJECT_PRIORITY (object1), 0); + assert_equals_int (_PRIORITY (object1), 0); gnlobj1 = ges_track_object_get_gnlobject (tckobj1); fail_unless (gnlobj1 != NULL); g_object_get (gnlobj1, "priority", &prio1, NULL); assert_equals_int (prio1, 0); - assert_equals_int (GES_TIMELINE_OBJECT_PRIORITY (object2), 1); + assert_equals_int (_PRIORITY (object2), 1); gnlobj2 = ges_track_object_get_gnlobject (tckobj2); fail_unless (gnlobj2 != NULL); g_object_get (gnlobj2, "priority", &prio2, NULL); /* object2 is on the second layer and has a priority of 1 */ assert_equals_int (prio2, LAYER_HEIGHT + 1); - assert_equals_int (GES_TIMELINE_OBJECT_PRIORITY (object3), LAYER_HEIGHT - 1); + assert_equals_int (_PRIORITY (object3), LAYER_HEIGHT - 1); gnlobj3 = ges_track_object_get_gnlobject (tckobj3); fail_unless (gnlobj3 != NULL); /* object3 is on the third layer and has a priority of LAYER_HEIGHT + 1 @@ -232,9 +232,9 @@ GST_START_TEST (test_layer_priorities) assert_equals_int (ges_timeline_layer_get_priority (layer1), 2); assert_equals_int (ges_timeline_layer_get_priority (layer2), 0); assert_equals_int (ges_timeline_layer_get_priority (layer3), 1); - assert_equals_int (GES_TIMELINE_OBJECT_PRIORITY (object1), 0); - assert_equals_int (GES_TIMELINE_OBJECT_PRIORITY (object2), 1); - assert_equals_int (GES_TIMELINE_OBJECT_PRIORITY (object3), LAYER_HEIGHT - 1); + assert_equals_int (_PRIORITY (object1), 0); + assert_equals_int (_PRIORITY (object2), 1); + assert_equals_int (_PRIORITY (object3), LAYER_HEIGHT - 1); g_object_get (gnlobj1, "priority", &prio1, NULL); g_object_get (gnlobj2, "priority", &prio2, NULL); g_object_get (gnlobj3, "priority", &prio3, NULL); @@ -257,9 +257,9 @@ GST_START_TEST (test_layer_priorities) g_list_free (objs); /* Check their priorities (layer1 priority is now 2) */ - assert_equals_int (GES_TIMELINE_OBJECT_PRIORITY (object1), 0); - assert_equals_int (GES_TIMELINE_OBJECT_PRIORITY (object2), 1); - assert_equals_int (GES_TIMELINE_OBJECT_PRIORITY (object3), LAYER_HEIGHT - 1); + assert_equals_int (_PRIORITY (object1), 0); + assert_equals_int (_PRIORITY (object2), 1); + assert_equals_int (_PRIORITY (object3), LAYER_HEIGHT - 1); g_object_get (gnlobj1, "priority", &prio1, NULL); g_object_get (gnlobj2, "priority", &prio2, NULL); g_object_get (gnlobj3, "priority", &prio3, NULL); @@ -269,10 +269,11 @@ GST_START_TEST (test_layer_priorities) /* And change TrackObject-s priorities and check that changes are well * refected on it containing TimelineObject */ - ges_track_object_set_priority (tckobj3, LAYER_HEIGHT * 2); + ges_timeline_element_set_priority (GES_TIMELINE_ELEMENT (tckobj3), + LAYER_HEIGHT * 2); g_object_get (gnlobj3, "priority", &prio3, NULL); assert_equals_int (prio3, 2 * LAYER_HEIGHT); - assert_equals_int (GES_TIMELINE_OBJECT_PRIORITY (object3), 0); + assert_equals_int (_PRIORITY (object3), 0); g_object_unref (tckobj1); g_object_unref (tckobj2); @@ -289,7 +290,7 @@ GST_START_TEST (test_single_layer_automatic_transition) GList *objects, *current; GESTimelineObject *transition; GESTimelineLayer *layer; - GESTimelineObject *src, *src1, *src2; + GESTimelineElement *src, *src1, *src2; ges_init (); @@ -315,12 +316,12 @@ GST_START_TEST (test_single_layer_automatic_transition) GST_DEBUG ("Adding assets to first layer"); GST_DEBUG ("Adding object from 0 -- 1000 to first layer"); - src = GES_TIMELINE_OBJECT (ges_timeline_layer_add_asset (layer, asset, 0, 0, + src = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer, asset, 0, 0, 1000, 1, GES_TRACK_TYPE_UNKNOWN)); fail_unless (GES_IS_TIMELINE_OBJECT (src)); GST_DEBUG ("Adding object from 500 -- 1000 to first layer"); - src1 = GES_TIMELINE_OBJECT (ges_timeline_layer_add_asset (layer, asset, 500, + src1 = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer, asset, 500, 0, 1000, 1, GES_TRACK_TYPE_UNKNOWN)); fail_unless (GES_IS_TIMELINE_OBJECT (src1)); @@ -330,10 +331,10 @@ GST_START_TEST (test_single_layer_automatic_transition) * 500___________src1_________1500 */ GST_DEBUG ("Checking src timing values"); - assert_equals_uint64 (src->start, 0); - assert_equals_uint64 (src->duration, 1000); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1500 - 500); + assert_equals_uint64 (_START (src), 0); + assert_equals_uint64 (_DURATION (src), 1000); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1500 - 500); GST_DEBUG ("Checking that a transition has been added"); objects = ges_timeline_layer_get_objects (layer); @@ -342,18 +343,18 @@ GST_START_TEST (test_single_layer_automatic_transition) transition = objects->next->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 500); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 500); + assert_equals_uint64 (_DURATION (transition), 500); transition = objects->next->next->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 500); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 500); + assert_equals_uint64 (_DURATION (transition), 500); g_list_free_full (objects, gst_object_unref); ASSERT_OBJECT_REFCOUNT (transition, "Only the layer owns a ref", 1); GST_DEBUG ("Moving first source to 250"); - ges_timeline_object_set_start (src, 250); + ges_timeline_element_set_start (src, 250); /* * 500_____transition____1250 @@ -361,10 +362,10 @@ GST_START_TEST (test_single_layer_automatic_transition) * 500___________src1_________1500 */ GST_DEBUG ("Checking src timing values"); - assert_equals_uint64 (src->start, 250); - assert_equals_uint64 (src->duration, 1250 - 250); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1500 - 500); + assert_equals_uint64 (_START (src), 250); + assert_equals_uint64 (_DURATION (src), 1250 - 250); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1500 - 500); objects = ges_timeline_layer_get_objects (layer); assert_equals_int (g_list_length (objects), 4); @@ -372,27 +373,27 @@ GST_START_TEST (test_single_layer_automatic_transition) transition = objects->next->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 500); - assert_equals_uint64 (transition->duration, 750); + assert_equals_uint64 (_START (transition), 500); + assert_equals_uint64 (_DURATION (transition), 750); transition = objects->next->next->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_int (transition->start, 500); - assert_equals_uint64 (transition->duration, 750); + assert_equals_int (_START (transition), 500); + assert_equals_uint64 (_DURATION (transition), 750); g_list_free_full (objects, gst_object_unref); GST_DEBUG ("Moving second source to 250, the transitions should be removed"); - ges_timeline_object_set_start (src1, 250); + ges_timeline_element_set_start (src1, 250); /* The transition should be removed * 250___________src_________1250 * 250___________src1________1250 */ GST_DEBUG ("Checking src timing values"); - assert_equals_uint64 (src->start, 250); - assert_equals_uint64 (src->duration, 1250 - 250); - assert_equals_uint64 (src1->start, 250); - assert_equals_uint64 (src1->duration, 1250 - 250); + assert_equals_uint64 (_START (src), 250); + assert_equals_uint64 (_DURATION (src), 1250 - 250); + assert_equals_uint64 (_START (src1), 250); + assert_equals_uint64 (_DURATION (src1), 1250 - 250); objects = ges_timeline_layer_get_objects (layer); assert_equals_int (g_list_length (objects), 2); @@ -400,45 +401,45 @@ GST_START_TEST (test_single_layer_automatic_transition) GST_DEBUG ("Trimming second source to 500 no transition should be created " "as they have the same end"); - ges_timeline_object_edit (src1, NULL, -1, GES_EDIT_MODE_TRIM, GES_EDGE_START, - 500); + ges_timeline_object_edit (GES_TIMELINE_OBJECT (src1), NULL, -1, + GES_EDIT_MODE_TRIM, GES_EDGE_START, 500); /* 250___________src_________1250 * 500______src1_______1250 */ GST_DEBUG ("Checking src timing values"); - assert_equals_uint64 (src->start, 250); - assert_equals_uint64 (src->duration, 1250 - 250); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1250 - 500); + assert_equals_uint64 (_START (src), 250); + assert_equals_uint64 (_DURATION (src), 1250 - 250); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1250 - 500); objects = ges_timeline_layer_get_objects (layer); assert_equals_int (g_list_length (objects), 2); g_list_free_full (objects, gst_object_unref); GST_DEBUG ("Trimming second source to 500, no transition should be created"); - ges_timeline_object_trim_start (src, 500); + ges_timeline_element_trim (src, 500); /* 500___________src_________1250 * 500___________src1________1250 */ GST_DEBUG ("Checking src timing values"); - assert_equals_uint64 (src->start, 500); - assert_equals_uint64 (src->duration, 1250 - 500); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1250 - 500); + assert_equals_uint64 (_START (src), 500); + assert_equals_uint64 (_DURATION (src), 1250 - 500); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1250 - 500); GST_DEBUG ("Trimming first source to 750, no transition should be created"); - ges_timeline_object_trim_start (src, 750); + ges_timeline_element_trim (src, 750); /* 750_______src_______1250 * 500___________src1________1250 */ GST_DEBUG ("Checking src timing values"); - assert_equals_uint64 (src->start, 750); - assert_equals_uint64 (src->duration, 1250 - 750); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1250 - 500); + assert_equals_uint64 (_START (src), 750); + assert_equals_uint64 (_DURATION (src), 1250 - 750); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1250 - 500); objects = ges_timeline_layer_get_objects (layer); assert_equals_int (g_list_length (objects), 2); @@ -449,16 +450,16 @@ GST_START_TEST (test_single_layer_automatic_transition) g_list_free_full (objects, gst_object_unref); GST_DEBUG ("Moving first source to 500, no transition should be created"); - ges_timeline_object_set_start (src, 500); + ges_timeline_element_set_start (src, 500); /* 500________src______1000 * 500___________src1________1250 */ GST_DEBUG ("Checking src timing values"); - assert_equals_uint64 (src->start, 500); - assert_equals_uint64 (src->duration, 1000 - 500); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1250 - 500); + assert_equals_uint64 (_START (src), 500); + assert_equals_uint64 (_DURATION (src), 1000 - 500); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1250 - 500); objects = ges_timeline_layer_get_objects (layer); assert_equals_int (g_list_length (objects), 2); @@ -469,15 +470,15 @@ GST_START_TEST (test_single_layer_automatic_transition) g_list_free_full (objects, gst_object_unref); GST_DEBUG ("Moving first source to 600, no transition should be created"); - ges_timeline_object_set_start (src, 600); + ges_timeline_element_set_start (src, 600); /* 600____src___1100 * 500___________src1________1250 */ GST_DEBUG ("Checking src timing values"); - assert_equals_uint64 (src->start, 600); - assert_equals_uint64 (src->duration, 1100 - 600); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1250 - 500); + assert_equals_uint64 (_START (src), 600); + assert_equals_uint64 (_DURATION (src), 1100 - 600); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1250 - 500); objects = ges_timeline_layer_get_objects (layer); assert_equals_int (g_list_length (objects), 2); @@ -490,7 +491,7 @@ GST_START_TEST (test_single_layer_automatic_transition) GST_DEBUG ("Adding asset to first layer"); GST_DEBUG ("Adding object from 1250 -- 1000 to first layer"); src2 = - GES_TIMELINE_OBJECT (ges_timeline_layer_add_asset (layer, asset, 1250, 0, + GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer, asset, 1250, 0, 1000, 1, GES_TRACK_TYPE_UNKNOWN)); assert_is_type (src2, GES_TYPE_TIMELINE_TEST_SOURCE); @@ -498,12 +499,12 @@ GST_START_TEST (test_single_layer_automatic_transition) * 500___________src1________1250 * 1250___________src2________2250 */ - assert_equals_uint64 (src->start, 600); - assert_equals_uint64 (src->duration, 1100 - 600); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1250 - 500); - assert_equals_uint64 (src2->start, 1250); - assert_equals_uint64 (src2->duration, 1000); + assert_equals_uint64 (_START (src), 600); + assert_equals_uint64 (_DURATION (src), 1100 - 600); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1250 - 500); + assert_equals_uint64 (_START (src2), 1250); + assert_equals_uint64 (_DURATION (src2), 1000); objects = ges_timeline_layer_get_objects (layer); assert_equals_int (g_list_length (objects), 3); @@ -511,7 +512,7 @@ GST_START_TEST (test_single_layer_automatic_transition) GST_DEBUG ("Changig first source duration to 800 2 transitions should be created"); - ges_timeline_object_set_duration (src, 800); + ges_timeline_element_set_duration (src, 800); /* 600__________________src_____________1400 * 500___________src1________1250 * 1250___________src2________2250 @@ -519,10 +520,10 @@ GST_START_TEST (test_single_layer_automatic_transition) * 1250___trans2___1400 */ GST_DEBUG ("Checking src timing values"); - assert_equals_uint64 (src->start, 600); - assert_equals_uint64 (src->duration, 1400 - 600); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1250 - 500); + assert_equals_uint64 (_START (src), 600); + assert_equals_uint64 (_DURATION (src), 1400 - 600); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1250 - 500); current = objects = ges_timeline_layer_get_objects (layer); assert_equals_int (g_list_length (objects), 7); @@ -532,15 +533,15 @@ GST_START_TEST (test_single_layer_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 600); - assert_equals_uint64 (transition->duration, 1250 - 600); + assert_equals_uint64 (_START (transition), 600); + assert_equals_uint64 (_DURATION (transition), 1250 - 600); ASSERT_OBJECT_REFCOUNT (transition, "The layer and ourself own a ref", 2); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 600); - assert_equals_uint64 (transition->duration, 1250 - 600); + assert_equals_uint64 (_START (transition), 600); + assert_equals_uint64 (_DURATION (transition), 1250 - 600); ASSERT_OBJECT_REFCOUNT (transition, "The layer and ourself own a ref", 2); current = current->next; @@ -549,15 +550,15 @@ GST_START_TEST (test_single_layer_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1250); - assert_equals_uint64 (transition->duration, 1400 - 1250); + assert_equals_uint64 (_START (transition), 1250); + assert_equals_uint64 (_DURATION (transition), 1400 - 1250); ASSERT_OBJECT_REFCOUNT (transition, "The layer and ourself own a ref", 2); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1250); - assert_equals_uint64 (transition->duration, 1400 - 1250); + assert_equals_uint64 (_START (transition), 1250); + assert_equals_uint64 (_DURATION (transition), 1400 - 1250); ASSERT_OBJECT_REFCOUNT (transition, "The layer and ourself own a ref", 2); current = current->next; @@ -565,17 +566,17 @@ GST_START_TEST (test_single_layer_automatic_transition) g_list_free_full (objects, gst_object_unref); GST_DEBUG ("Back to previous state"); - ges_timeline_object_set_duration (src, 1100 - 600); + ges_timeline_element_set_duration (src, 1100 - 600); /* 600____src___1100 * 500___________src1________1250 * 1250___________src2________2250 */ - assert_equals_uint64 (src->start, 600); - assert_equals_uint64 (src->duration, 1100 - 600); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1250 - 500); - assert_equals_uint64 (src2->start, 1250); - assert_equals_uint64 (src2->duration, 1000); + assert_equals_uint64 (_START (src), 600); + assert_equals_uint64 (_DURATION (src), 1100 - 600); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1250 - 500); + assert_equals_uint64 (_START (src2), 1250); + assert_equals_uint64 (_DURATION (src2), 1000); /* We check that the transition as actually been freed */ fail_if (GES_IS_TIMELINE_STANDARD_TRANSITION (transition)); @@ -586,18 +587,18 @@ GST_START_TEST (test_single_layer_automatic_transition) GST_DEBUG ("Set third object start to 1100, 1 new transition should be created"); - ges_timeline_object_set_start (src2, 1100); + ges_timeline_element_set_start (src2, 1100); /* 600____src___1100 * 500___________src1________1250 * 1100___________src2________2100 * ^__trans___^ */ - assert_equals_uint64 (src->start, 600); - assert_equals_uint64 (src->duration, 1100 - 600); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1250 - 500); - assert_equals_uint64 (src2->start, 1100); - assert_equals_uint64 (src2->duration, 1000); + assert_equals_uint64 (_START (src), 600); + assert_equals_uint64 (_DURATION (src), 1100 - 600); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1250 - 500); + assert_equals_uint64 (_START (src2), 1100); + assert_equals_uint64 (_DURATION (src2), 1000); current = objects = ges_timeline_layer_get_objects (layer); assert_equals_int (g_list_length (objects), 5); @@ -610,34 +611,34 @@ GST_START_TEST (test_single_layer_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1100); - assert_equals_uint64 (transition->duration, 1250 - 1100); + assert_equals_uint64 (_START (transition), 1100); + assert_equals_uint64 (_DURATION (transition), 1250 - 1100); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1100); - assert_equals_uint64 (transition->duration, 1250 - 1100); + assert_equals_uint64 (_START (transition), 1100); + assert_equals_uint64 (_DURATION (transition), 1250 - 1100); current = current->next; fail_unless (current->data == src2); g_list_free_full (objects, gst_object_unref); GST_DEBUG ("Set third object start to 1000, Transition should be updated"); - ges_timeline_object_edit (src2, NULL, -1, GES_EDIT_MODE_NORMAL, - GES_EDGE_START, 1000); + ges_timeline_object_edit (GES_TIMELINE_OBJECT (src2), NULL, -1, + GES_EDIT_MODE_NORMAL, GES_EDGE_START, 1000); /* 600____src___1100 * !_tr__^ * 500___________src1________1250 * 1000___________src2________2000 * ^____trans____^ */ - assert_equals_uint64 (src->start, 600); - assert_equals_uint64 (src->duration, 500); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1250 - 500); - assert_equals_uint64 (src2->start, 1000); - assert_equals_uint64 (src2->duration, 1000); + assert_equals_uint64 (_START (src), 600); + assert_equals_uint64 (_DURATION (src), 500); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1250 - 500); + assert_equals_uint64 (_START (src2), 1000); + assert_equals_uint64 (_DURATION (src2), 1000); current = objects = ges_timeline_layer_get_objects (layer); current = objects; @@ -651,26 +652,26 @@ GST_START_TEST (test_single_layer_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1000); - assert_equals_uint64 (transition->duration, 1100 - 1000); + assert_equals_uint64 (_START (transition), 1000); + assert_equals_uint64 (_DURATION (transition), 1100 - 1000); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1000); - assert_equals_uint64 (transition->duration, 1100 - 1000); + assert_equals_uint64 (_START (transition), 1000); + assert_equals_uint64 (_DURATION (transition), 1100 - 1000); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1000); - assert_equals_uint64 (transition->duration, 1250 - 1000); + assert_equals_uint64 (_START (transition), 1000); + assert_equals_uint64 (_DURATION (transition), 1250 - 1000); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1000); - assert_equals_uint64 (transition->duration, 1250 - 1000); + assert_equals_uint64 (_START (transition), 1000); + assert_equals_uint64 (_DURATION (transition), 1250 - 1000); current = current->next; fail_unless (current->data == src2); @@ -688,7 +689,7 @@ GST_START_TEST (test_multi_layer_automatic_transition) GList *objects, *current; GESTimelineObject *transition; GESTimelineLayer *layer, *layer1; - GESTimelineObject *src, *src1, *src2, *src3; + GESTimelineElement *src, *src1, *src2, *src3; ges_init (); @@ -719,12 +720,12 @@ GST_START_TEST (test_multi_layer_automatic_transition) GST_DEBUG ("Adding assets to first layer"); GST_DEBUG ("Adding object from 0 -- 1000 to first layer"); - src = GES_TIMELINE_OBJECT (ges_timeline_layer_add_asset (layer, asset, 0, 0, + src = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer, asset, 0, 0, 1000, 1, GES_TRACK_TYPE_UNKNOWN)); fail_unless (GES_IS_TIMELINE_OBJECT (src)); GST_DEBUG ("Adding object from 500 -- 1000 to first layer"); - src1 = GES_TIMELINE_OBJECT (ges_timeline_layer_add_asset (layer, asset, 500, + src1 = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer, asset, 500, 0, 1000, 1, GES_TRACK_TYPE_UNKNOWN)); fail_unless (GES_IS_TIMELINE_OBJECT (src1)); @@ -734,10 +735,10 @@ GST_START_TEST (test_multi_layer_automatic_transition) * 500___________src1_________1500 */ GST_DEBUG ("Checking src timing values"); - assert_equals_uint64 (src->start, 0); - assert_equals_uint64 (src->duration, 1000); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1500 - 500); + assert_equals_uint64 (_START (src), 0); + assert_equals_uint64 (_DURATION (src), 1000); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1500 - 500); GST_DEBUG ("Checking that a transition has been added"); current = objects = ges_timeline_layer_get_objects (layer); @@ -747,22 +748,22 @@ GST_START_TEST (test_multi_layer_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 500); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 500); + assert_equals_uint64 (_DURATION (transition), 500); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 500); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 500); + assert_equals_uint64 (_DURATION (transition), 500); g_list_free_full (objects, gst_object_unref); ASSERT_OBJECT_REFCOUNT (transition, "Only the layer owns a ref", 1); GST_DEBUG ("Adding object 2 from 500 -- 1000 to second layer"); - src2 = GES_TIMELINE_OBJECT (ges_timeline_layer_add_asset (layer1, asset, 0, + src2 = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer1, asset, 0, 0, 1000, 1, GES_TRACK_TYPE_UNKNOWN)); GST_DEBUG ("Adding object 3 from 500 -- 1000 to second layer"); - src3 = GES_TIMELINE_OBJECT (ges_timeline_layer_add_asset (layer1, asset, 500, + src3 = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer1, asset, 500, 0, 1000, 1, GES_TRACK_TYPE_UNKNOWN)); assert_is_type (src3, GES_TYPE_TIMELINE_TEST_SOURCE); @@ -774,14 +775,14 @@ GST_START_TEST (test_multi_layer_automatic_transition) * 500___________src3_________1500 Layer1 */ GST_DEBUG ("Checking src timing values"); - assert_equals_uint64 (src->start, 0); - assert_equals_uint64 (src->duration, 1000); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1500 - 500); - assert_equals_uint64 (src2->start, 0); - assert_equals_uint64 (src2->duration, 1000); - assert_equals_uint64 (src3->start, 500); - assert_equals_uint64 (src3->duration, 1500 - 500); + assert_equals_uint64 (_START (src), 0); + assert_equals_uint64 (_DURATION (src), 1000); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1500 - 500); + assert_equals_uint64 (_START (src2), 0); + assert_equals_uint64 (_DURATION (src2), 1000); + assert_equals_uint64 (_START (src3), 500); + assert_equals_uint64 (_DURATION (src3), 1500 - 500); GST_DEBUG ("Checking transitions on first layer"); current = objects = ges_timeline_layer_get_objects (layer); @@ -791,14 +792,14 @@ GST_START_TEST (test_multi_layer_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 500); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 500); + assert_equals_uint64 (_DURATION (transition), 500); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 500); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 500); + assert_equals_uint64 (_DURATION (transition), 500); g_list_free_full (objects, gst_object_unref); ASSERT_OBJECT_REFCOUNT (transition, "Only the layer owns a ref", 1); @@ -822,14 +823,14 @@ GST_START_TEST (test_multi_layer_automatic_transition) * 500___________src3_________1500 Layer1 */ GST_DEBUG ("Checking src timing values"); - assert_equals_uint64 (src->start, 0); - assert_equals_uint64 (src->duration, 1000); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1500 - 500); - assert_equals_uint64 (src2->start, 0); - assert_equals_uint64 (src2->duration, 1000); - assert_equals_uint64 (src3->start, 500); - assert_equals_uint64 (src3->duration, 1500 - 500); + assert_equals_uint64 (_START (src), 0); + assert_equals_uint64 (_DURATION (src), 1000); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1500 - 500); + assert_equals_uint64 (_START (src2), 0); + assert_equals_uint64 (_DURATION (src2), 1000); + assert_equals_uint64 (_START (src3), 500); + assert_equals_uint64 (_DURATION (src3), 1500 - 500); GST_DEBUG ("Checking transitions on first layer"); current = objects = ges_timeline_layer_get_objects (layer); @@ -839,14 +840,14 @@ GST_START_TEST (test_multi_layer_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 500); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 500); + assert_equals_uint64 (_DURATION (transition), 500); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 500); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 500); + assert_equals_uint64 (_DURATION (transition), 500); g_list_free_full (objects, gst_object_unref); ASSERT_OBJECT_REFCOUNT (transition, "Only the layer owns a ref", 1); @@ -858,19 +859,19 @@ GST_START_TEST (test_multi_layer_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 500); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 500); + assert_equals_uint64 (_DURATION (transition), 500); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 500); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 500); + assert_equals_uint64 (_DURATION (transition), 500); g_list_free_full (objects, gst_object_unref); ASSERT_OBJECT_REFCOUNT (transition, "Only the layer owns a ref", 1); GST_DEBUG ("Moving src3 to 1000. should remove transition"); - ges_timeline_object_set_start (src3, 1000); + ges_timeline_element_set_start (src3, 1000); /* 500__transition__1000 * 0___________src_________1000 @@ -880,14 +881,14 @@ GST_START_TEST (test_multi_layer_automatic_transition) * 1000___________src3_________2000 Layer1 */ GST_DEBUG ("Checking src timing values"); - assert_equals_uint64 (src->start, 0); - assert_equals_uint64 (src->duration, 1000); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1500 - 500); - assert_equals_uint64 (src2->start, 0); - assert_equals_uint64 (src2->duration, 1000); - assert_equals_uint64 (src3->start, 1000); - assert_equals_uint64 (src3->duration, 2000 - 1000); + assert_equals_uint64 (_START (src), 0); + assert_equals_uint64 (_DURATION (src), 1000); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1500 - 500); + assert_equals_uint64 (_START (src2), 0); + assert_equals_uint64 (_DURATION (src2), 1000); + assert_equals_uint64 (_START (src3), 1000); + assert_equals_uint64 (_DURATION (src3), 2000 - 1000); GST_DEBUG ("Checking transitions on first layer"); current = objects = ges_timeline_layer_get_objects (layer); @@ -897,14 +898,14 @@ GST_START_TEST (test_multi_layer_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 500); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 500); + assert_equals_uint64 (_DURATION (transition), 500); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 500); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 500); + assert_equals_uint64 (_DURATION (transition), 500); g_list_free_full (objects, gst_object_unref); ASSERT_OBJECT_REFCOUNT (transition, "Only the layer owns a ref", 1); @@ -917,7 +918,7 @@ GST_START_TEST (test_multi_layer_automatic_transition) ASSERT_OBJECT_REFCOUNT (transition, "Only the layer owns a ref", 1); GST_DEBUG ("Moving src3 to first layer, should add a transition"); - ges_timeline_object_move_to_layer (src3, layer); + ges_timeline_object_move_to_layer (GES_TIMELINE_OBJECT (src3), layer); /* 500__transition__1000 * 0___________src_________1000 @@ -928,14 +929,14 @@ GST_START_TEST (test_multi_layer_automatic_transition) * 0__________src2_________1000 Layer1 */ GST_DEBUG ("Checking src timing values"); - assert_equals_uint64 (src->start, 0); - assert_equals_uint64 (src->duration, 1000); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1500 - 500); - assert_equals_uint64 (src2->start, 0); - assert_equals_uint64 (src2->duration, 1000); - assert_equals_uint64 (src3->start, 1000); - assert_equals_uint64 (src3->duration, 2000 - 1000); + assert_equals_uint64 (_START (src), 0); + assert_equals_uint64 (_DURATION (src), 1000); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1500 - 500); + assert_equals_uint64 (_START (src2), 0); + assert_equals_uint64 (_DURATION (src2), 1000); + assert_equals_uint64 (_START (src3), 1000); + assert_equals_uint64 (_DURATION (src3), 2000 - 1000); GST_DEBUG ("Checking transitions on first layer"); current = objects = ges_timeline_layer_get_objects (layer); @@ -945,14 +946,14 @@ GST_START_TEST (test_multi_layer_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 500); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 500); + assert_equals_uint64 (_DURATION (transition), 500); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 500); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 500); + assert_equals_uint64 (_DURATION (transition), 500); current = current->next; fail_unless (current->data == src1); @@ -960,14 +961,14 @@ GST_START_TEST (test_multi_layer_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1000); - assert_equals_uint64 (transition->duration, 1500 - 1000); + assert_equals_uint64 (_START (transition), 1000); + assert_equals_uint64 (_DURATION (transition), 1500 - 1000); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1000); - assert_equals_uint64 (transition->duration, 1500 - 1000); + assert_equals_uint64 (_START (transition), 1000); + assert_equals_uint64 (_DURATION (transition), 1500 - 1000); current = current->next; fail_unless (current->data == src3); @@ -984,7 +985,7 @@ GST_START_TEST (test_multi_layer_automatic_transition) GST_DEBUG ("Moving src to second layer, should remove first transition on first layer"); - ges_timeline_object_move_to_layer (src, layer1); + ges_timeline_object_move_to_layer (GES_TIMELINE_OBJECT (src), layer1); /* 500___________src1_________1500 * 1000___________src3_________2000 Layer @@ -994,14 +995,14 @@ GST_START_TEST (test_multi_layer_automatic_transition) * 0__________src2_________1000 Layer1 */ GST_DEBUG ("Checking src timing values"); - assert_equals_uint64 (src->start, 0); - assert_equals_uint64 (src->duration, 1000); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1500 - 500); - assert_equals_uint64 (src2->start, 0); - assert_equals_uint64 (src2->duration, 1000); - assert_equals_uint64 (src3->start, 1000); - assert_equals_uint64 (src3->duration, 2000 - 1000); + assert_equals_uint64 (_START (src), 0); + assert_equals_uint64 (_DURATION (src), 1000); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1500 - 500); + assert_equals_uint64 (_START (src2), 0); + assert_equals_uint64 (_DURATION (src2), 1000); + assert_equals_uint64 (_START (src3), 1000); + assert_equals_uint64 (_DURATION (src3), 2000 - 1000); GST_DEBUG ("Checking transitions on first layer"); current = objects = ges_timeline_layer_get_objects (layer); @@ -1011,14 +1012,14 @@ GST_START_TEST (test_multi_layer_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1000); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 1000); + assert_equals_uint64 (_DURATION (transition), 500); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1000); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 1000); + assert_equals_uint64 (_DURATION (transition), 500); current = current->next; fail_unless (current->data == src3); @@ -1034,8 +1035,8 @@ GST_START_TEST (test_multi_layer_automatic_transition) ASSERT_OBJECT_REFCOUNT (transition, "Only the layer owns a ref", 1); GST_DEBUG ("Edit src to first layer start=1500"); - ges_timeline_object_edit (src, NULL, 0, GES_EDIT_MODE_NORMAL, GES_EDGE_NONE, - 1500); + ges_timeline_object_edit (GES_TIMELINE_OBJECT (src), NULL, 0, + GES_EDIT_MODE_NORMAL, GES_EDGE_NONE, 1500); /* 1500___________src_________2500 * 1500______tr______2000 * 500___________src1_________1500 ^ @@ -1045,14 +1046,14 @@ GST_START_TEST (test_multi_layer_automatic_transition) * 0__________src2_________1000 Layer1 */ GST_DEBUG ("Checking src timing values"); - assert_equals_uint64 (src->start, 1500); - assert_equals_uint64 (src->duration, 1000); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1500 - 500); - assert_equals_uint64 (src2->start, 0); - assert_equals_uint64 (src2->duration, 1000); - assert_equals_uint64 (src3->start, 1000); - assert_equals_uint64 (src3->duration, 2000 - 1000); + assert_equals_uint64 (_START (src), 1500); + assert_equals_uint64 (_DURATION (src), 1000); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1500 - 500); + assert_equals_uint64 (_START (src2), 0); + assert_equals_uint64 (_DURATION (src2), 1000); + assert_equals_uint64 (_START (src3), 1000); + assert_equals_uint64 (_DURATION (src3), 2000 - 1000); GST_DEBUG ("Checking transitions on first layer"); current = objects = ges_timeline_layer_get_objects (layer); @@ -1062,14 +1063,14 @@ GST_START_TEST (test_multi_layer_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1000); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 1000); + assert_equals_uint64 (_DURATION (transition), 500); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1000); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 1000); + assert_equals_uint64 (_DURATION (transition), 500); current = current->next; fail_unless (current->data == src3); @@ -1077,14 +1078,14 @@ GST_START_TEST (test_multi_layer_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1500); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 1500); + assert_equals_uint64 (_DURATION (transition), 500); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1500); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 1500); + assert_equals_uint64 (_DURATION (transition), 500); current = current->next; fail_unless (current->data == src); @@ -1099,8 +1100,8 @@ GST_START_TEST (test_multi_layer_automatic_transition) ASSERT_OBJECT_REFCOUNT (transition, "Only the layer owns a ref", 1); GST_DEBUG ("Ripple src1 to 700"); - ges_timeline_object_edit (src1, NULL, 0, GES_EDIT_MODE_RIPPLE, GES_EDGE_NONE, - 700); + ges_timeline_object_edit (GES_TIMELINE_OBJECT (src1), NULL, 0, + GES_EDIT_MODE_RIPPLE, GES_EDGE_NONE, 700); /* 1700___________src_________2700 * 1700__tr__2000 * 700___________src1_________1700 @@ -1110,14 +1111,14 @@ GST_START_TEST (test_multi_layer_automatic_transition) * 0__________src2_________1000 Layer1 */ GST_DEBUG ("Checking src timing values"); - assert_equals_uint64 (src->start, 1700); - assert_equals_uint64 (src->duration, 1000); - assert_equals_uint64 (src1->start, 700); - assert_equals_uint64 (src1->duration, 1700 - 700); - assert_equals_uint64 (src2->start, 0); - assert_equals_uint64 (src2->duration, 1000); - assert_equals_uint64 (src3->start, 1000); - assert_equals_uint64 (src3->duration, 2000 - 1000); + assert_equals_uint64 (_START (src), 1700); + assert_equals_uint64 (_DURATION (src), 1000); + assert_equals_uint64 (_START (src1), 700); + assert_equals_uint64 (_DURATION (src1), 1700 - 700); + assert_equals_uint64 (_START (src2), 0); + assert_equals_uint64 (_DURATION (src2), 1000); + assert_equals_uint64 (_START (src3), 1000); + assert_equals_uint64 (_DURATION (src3), 2000 - 1000); GST_DEBUG ("Checking transitions on first layer"); current = objects = ges_timeline_layer_get_objects (layer); @@ -1127,14 +1128,14 @@ GST_START_TEST (test_multi_layer_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1000); - assert_equals_uint64 (transition->duration, 1700 - 1000); + assert_equals_uint64 (_START (transition), 1000); + assert_equals_uint64 (_DURATION (transition), 1700 - 1000); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1000); - assert_equals_uint64 (transition->duration, 1700 - 1000); + assert_equals_uint64 (_START (transition), 1000); + assert_equals_uint64 (_DURATION (transition), 1700 - 1000); current = current->next; fail_unless (current->data == src3); @@ -1142,14 +1143,14 @@ GST_START_TEST (test_multi_layer_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1700); - assert_equals_uint64 (transition->duration, 2000 - 1700); + assert_equals_uint64 (_START (transition), 1700); + assert_equals_uint64 (_DURATION (transition), 2000 - 1700); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1700); - assert_equals_uint64 (transition->duration, 2000 - 1700); + assert_equals_uint64 (_START (transition), 1700); + assert_equals_uint64 (_DURATION (transition), 2000 - 1700); current = current->next; fail_unless (current->data == src); @@ -1175,7 +1176,7 @@ GST_START_TEST (test_layer_activate_automatic_transition) GESTimelineLayer *layer; GList *objects, *current; GESTimelineObject *transition; - GESTimelineObject *src, *src1, *src2, *src3; + GESTimelineElement *src, *src1, *src2, *src3; ges_init (); @@ -1194,22 +1195,22 @@ GST_START_TEST (test_layer_activate_automatic_transition) assert_is_type (layer, GES_TYPE_TIMELINE_LAYER); GST_DEBUG ("Adding object from 0 -- 1000 to layer"); - src = GES_TIMELINE_OBJECT (ges_timeline_layer_add_asset (layer, asset, 0, 0, + src = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer, asset, 0, 0, 1000, 1, GES_TRACK_TYPE_UNKNOWN)); fail_unless (GES_IS_TIMELINE_OBJECT (src)); GST_DEBUG ("Adding object from 500 -- 1000 to first layer"); - src1 = GES_TIMELINE_OBJECT (ges_timeline_layer_add_asset (layer, asset, 500, + src1 = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer, asset, 500, 0, 1000, 1, GES_TRACK_TYPE_UNKNOWN)); fail_unless (GES_IS_TIMELINE_OBJECT (src1)); GST_DEBUG ("Adding object from 1000 -- 2000 to layer"); - src2 = GES_TIMELINE_OBJECT (ges_timeline_layer_add_asset (layer, asset, 1000, + src2 = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer, asset, 1000, 0, 1000, 1, GES_TRACK_TYPE_UNKNOWN)); fail_unless (GES_IS_TIMELINE_OBJECT (src2)); GST_DEBUG ("Adding object from 2000 -- 2500 to layer"); - src3 = GES_TIMELINE_OBJECT (ges_timeline_layer_add_asset (layer, asset, 2000, + src3 = GES_TIMELINE_ELEMENT (ges_timeline_layer_add_asset (layer, asset, 2000, 0, 500, 1, GES_TRACK_TYPE_UNKNOWN)); fail_unless (GES_IS_TIMELINE_OBJECT (src3)); @@ -1220,14 +1221,14 @@ GST_START_TEST (test_layer_activate_automatic_transition) * 2000_______src2_____2500 */ GST_DEBUG ("Checking src timing values"); - assert_equals_uint64 (src->start, 0); - assert_equals_uint64 (src->duration, 1000); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1500 - 500); - assert_equals_uint64 (src2->start, 1000); - assert_equals_uint64 (src2->duration, 1000); - assert_equals_uint64 (src3->start, 2000); - assert_equals_uint64 (src3->duration, 500); + assert_equals_uint64 (_START (src), 0); + assert_equals_uint64 (_DURATION (src), 1000); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1500 - 500); + assert_equals_uint64 (_START (src2), 1000); + assert_equals_uint64 (_DURATION (src2), 1000); + assert_equals_uint64 (_START (src3), 2000); + assert_equals_uint64 (_DURATION (src3), 500); GST_DEBUG ("Checking that no transition has been added"); current = objects = ges_timeline_layer_get_objects (layer); @@ -1275,14 +1276,14 @@ GST_START_TEST (test_layer_activate_automatic_transition) */ current = objects = ges_timeline_layer_get_objects (layer); assert_equals_int (g_list_length (objects), 8); - assert_equals_uint64 (src->start, 0); - assert_equals_uint64 (src->duration, 1000); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1500 - 500); - assert_equals_uint64 (src2->start, 1000); - assert_equals_uint64 (src2->duration, 1000); - assert_equals_uint64 (src3->start, 2000); - assert_equals_uint64 (src3->duration, 500); + assert_equals_uint64 (_START (src), 0); + assert_equals_uint64 (_DURATION (src), 1000); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1500 - 500); + assert_equals_uint64 (_START (src2), 1000); + assert_equals_uint64 (_DURATION (src2), 1000); + assert_equals_uint64 (_START (src3), 2000); + assert_equals_uint64 (_DURATION (src3), 500); GST_DEBUG ("Checking transitions"); fail_unless (current->data == src); @@ -1290,14 +1291,14 @@ GST_START_TEST (test_layer_activate_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 500); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 500); + assert_equals_uint64 (_DURATION (transition), 500); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 500); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 500); + assert_equals_uint64 (_DURATION (transition), 500); current = current->next; fail_unless (current->data == src1); @@ -1305,14 +1306,14 @@ GST_START_TEST (test_layer_activate_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1000); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 1000); + assert_equals_uint64 (_DURATION (transition), 500); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1000); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 1000); + assert_equals_uint64 (_DURATION (transition), 500); current = current->next; fail_unless (current->data == src2); @@ -1323,7 +1324,7 @@ GST_START_TEST (test_layer_activate_automatic_transition) ASSERT_OBJECT_REFCOUNT (transition, "Only the layer owns a ref", 1); GST_DEBUG ("Moving src2 to 1200, check everything updates properly"); - ges_timeline_object_set_start (src2, 1200); + ges_timeline_element_set_start (src2, 1200); /* * 0___________src_________1000 * 500______tr______1000 @@ -1335,14 +1336,14 @@ GST_START_TEST (test_layer_activate_automatic_transition) */ current = objects = ges_timeline_layer_get_objects (layer); assert_equals_int (g_list_length (objects), 10); - assert_equals_uint64 (src->start, 0); - assert_equals_uint64 (src->duration, 1000); - assert_equals_uint64 (src1->start, 500); - assert_equals_uint64 (src1->duration, 1500 - 500); - assert_equals_uint64 (src2->start, 1200); - assert_equals_uint64 (src2->duration, 1000); - assert_equals_uint64 (src3->start, 2000); - assert_equals_uint64 (src3->duration, 500); + assert_equals_uint64 (_START (src), 0); + assert_equals_uint64 (_DURATION (src), 1000); + assert_equals_uint64 (_START (src1), 500); + assert_equals_uint64 (_DURATION (src1), 1500 - 500); + assert_equals_uint64 (_START (src2), 1200); + assert_equals_uint64 (_DURATION (src2), 1000); + assert_equals_uint64 (_START (src3), 2000); + assert_equals_uint64 (_DURATION (src3), 500); GST_DEBUG ("Checking transitions"); fail_unless (current->data == src); @@ -1350,14 +1351,14 @@ GST_START_TEST (test_layer_activate_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 500); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 500); + assert_equals_uint64 (_DURATION (transition), 500); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 500); - assert_equals_uint64 (transition->duration, 500); + assert_equals_uint64 (_START (transition), 500); + assert_equals_uint64 (_DURATION (transition), 500); current = current->next; fail_unless (current->data == src1); @@ -1365,14 +1366,14 @@ GST_START_TEST (test_layer_activate_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1200); - assert_equals_uint64 (transition->duration, 300); + assert_equals_uint64 (_START (transition), 1200); + assert_equals_uint64 (_DURATION (transition), 300); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 1200); - assert_equals_uint64 (transition->duration, 300); + assert_equals_uint64 (_START (transition), 1200); + assert_equals_uint64 (_DURATION (transition), 300); current = current->next; fail_unless (current->data == src2); @@ -1380,14 +1381,14 @@ GST_START_TEST (test_layer_activate_automatic_transition) current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 2000); - assert_equals_uint64 (transition->duration, 200); + assert_equals_uint64 (_START (transition), 2000); + assert_equals_uint64 (_DURATION (transition), 200); current = current->next; transition = current->data; assert_is_type (transition, GES_TYPE_TIMELINE_STANDARD_TRANSITION); - assert_equals_uint64 (transition->start, 2000); - assert_equals_uint64 (transition->duration, 200); + assert_equals_uint64 (_START (transition), 2000); + assert_equals_uint64 (_DURATION (transition), 200); current = current->next; fail_unless (current->data == src3); diff --git a/tests/check/ges/overlays.c b/tests/check/ges/overlays.c index 2641c35ce2..eb100615ba 100644 --- a/tests/check/ges/overlays.c +++ b/tests/check/ges/overlays.c @@ -53,9 +53,9 @@ GST_START_TEST (test_overlay_properties) /* Set some properties */ g_object_set (object, "start", (guint64) 42, "duration", (guint64) 51, "in-point", (guint64) 12, NULL); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 42); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object), 51); - assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 12); + assert_equals_uint64 (_START (object), 42); + assert_equals_uint64 (_DURATION (object), 51); + assert_equals_uint64 (_INPOINT (object), 12); trackobject = ges_timeline_object_create_track_object (object, track->type); ges_timeline_object_add_track_object (object, trackobject); @@ -63,9 +63,9 @@ GST_START_TEST (test_overlay_properties) fail_unless (ges_track_object_set_track (trackobject, track)); /* Check that trackobject has the same properties */ - assert_equals_uint64 (GES_TRACK_OBJECT_START (trackobject), 42); - assert_equals_uint64 (GES_TRACK_OBJECT_DURATION (trackobject), 51); - assert_equals_uint64 (GES_TRACK_OBJECT_INPOINT (trackobject), 12); + assert_equals_uint64 (_START (trackobject), 42); + assert_equals_uint64 (_DURATION (trackobject), 51); + assert_equals_uint64 (_INPOINT (trackobject), 12); /* And let's also check that it propagated correctly to GNonLin */ gnl_object_check (ges_track_object_get_gnlobject (trackobject), 42, 51, 12, @@ -74,12 +74,12 @@ GST_START_TEST (test_overlay_properties) /* Change more properties, see if they propagate */ g_object_set (object, "start", (guint64) 420, "duration", (guint64) 510, "in-point", (guint64) 120, NULL); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 420); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object), 510); - assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 120); - assert_equals_uint64 (GES_TRACK_OBJECT_START (trackobject), 420); - assert_equals_uint64 (GES_TRACK_OBJECT_DURATION (trackobject), 510); - assert_equals_uint64 (GES_TRACK_OBJECT_INPOINT (trackobject), 120); + assert_equals_uint64 (_START (object), 420); + assert_equals_uint64 (_DURATION (object), 510); + assert_equals_uint64 (_INPOINT (object), 120); + assert_equals_uint64 (_START (trackobject), 420); + assert_equals_uint64 (_DURATION (trackobject), 510); + assert_equals_uint64 (_INPOINT (trackobject), 120); /* And let's also check that it propagated correctly to GNonLin */ gnl_object_check (ges_track_object_get_gnlobject (trackobject), 420, 510, 120, diff --git a/tests/check/ges/simplelayer.c b/tests/check/ges/simplelayer.c index c9dc81f68b..c8a8c987e4 100644 --- a/tests/check/ges/simplelayer.c +++ b/tests/check/ges/simplelayer.c @@ -17,6 +17,7 @@ * Boston, MA 02110-1301, USA. */ +#include "test-utils.h" #include #include @@ -82,15 +83,15 @@ GST_START_TEST (test_gsl_add) source = ges_custom_timeline_source_new (my_fill_track_func, NULL); fail_unless (source != NULL); g_object_set (source, "duration", GST_SECOND, "start", (guint64) 42, NULL); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source), GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source), 42); + fail_unless_equals_uint64 (_DURATION (source), GST_SECOND); + fail_unless_equals_uint64 (_START (source), 42); fail_unless (ges_simple_timeline_layer_add_object (GES_SIMPLE_TIMELINE_LAYER (layer), GES_TIMELINE_OBJECT (source), -1)); fail_unless (ges_timeline_object_get_layer (GES_TIMELINE_OBJECT (source)) == layer); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source), GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source), 0); + fail_unless_equals_uint64 (_DURATION (source), GST_SECOND); + fail_unless_equals_uint64 (_START (source), 0); /* test nth */ source2 = @@ -157,47 +158,45 @@ GST_START_TEST (test_gsl_move_simple) /* Create two 1s sources */ source1 = ges_custom_timeline_source_new (my_fill_track_func, NULL); g_object_set (source1, "duration", GST_SECOND, "start", (guint64) 42, NULL); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1), - GST_SECOND); + fail_unless_equals_uint64 (_DURATION (source1), GST_SECOND); source2 = ges_custom_timeline_source_new (my_fill_track_func, NULL); g_object_set (source2, "duration", GST_SECOND, "start", (guint64) 42, NULL); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source2), - GST_SECOND); + fail_unless_equals_uint64 (_DURATION (source2), GST_SECOND); /* Add source to any position */ GST_DEBUG ("Adding the source to the timeline layer"); fail_unless (ges_simple_timeline_layer_add_object (GES_SIMPLE_TIMELINE_LAYER (layer), GES_TIMELINE_OBJECT (source1), -1)); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); + fail_unless_equals_uint64 (_START (source1), 0); /* Add source2 to the end */ GST_DEBUG ("Adding the source to the timeline layer"); fail_unless (ges_simple_timeline_layer_add_object (GES_SIMPLE_TIMELINE_LAYER (layer), GES_TIMELINE_OBJECT (source2), -1)); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), GST_SECOND); + fail_unless_equals_uint64 (_START (source1), 0); + fail_unless_equals_uint64 (_START (source2), GST_SECOND); /* Move source2 before source 1 (newpos:0) */ fail_unless (ges_simple_timeline_layer_move_object (GES_SIMPLE_TIMELINE_LAYER (layer), GES_TIMELINE_OBJECT (source2), 0)); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), 0); + fail_unless_equals_uint64 (_START (source1), GST_SECOND); + fail_unless_equals_uint64 (_START (source2), 0); fail_unless_equals_int (info.new, 0); fail_unless_equals_int (info.old, 1); /* Move source2 after source 1 (newpos:0) */ fail_unless (ges_simple_timeline_layer_move_object (GES_SIMPLE_TIMELINE_LAYER (layer), GES_TIMELINE_OBJECT (source2), 1)); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), GST_SECOND); + fail_unless_equals_uint64 (_START (source1), 0); + fail_unless_equals_uint64 (_START (source2), GST_SECOND); fail_unless_equals_int (info.new, 1); fail_unless_equals_int (info.old, 0); /* Move source1 to end (newpos:-1) */ fail_unless (ges_simple_timeline_layer_move_object (GES_SIMPLE_TIMELINE_LAYER (layer), GES_TIMELINE_OBJECT (source1), -1)); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), 0); + fail_unless_equals_uint64 (_START (source1), GST_SECOND); + fail_unless_equals_uint64 (_START (source2), 0); /* position will be decremented, this is expected */ fail_unless_equals_int (info.new, -1); fail_unless_equals_int (info.old, 0); @@ -206,20 +205,20 @@ GST_START_TEST (test_gsl_move_simple) g_object_ref (source1); fail_unless (ges_timeline_layer_remove_object (layer, GES_TIMELINE_OBJECT (source1))); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), 0); + fail_unless_equals_uint64 (_START (source2), 0); g_object_set (source1, "start", (guint64) 42, NULL); /* re-add source1... using the normal API, it should be added to the end */ fail_unless (ges_timeline_layer_add_object (layer, GES_TIMELINE_OBJECT (source1))); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), 0); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), GST_SECOND); + fail_unless_equals_uint64 (_START (source2), 0); + fail_unless_equals_uint64 (_START (source1), GST_SECOND); /* remove source1 ... */ fail_unless (ges_timeline_layer_remove_object (layer, GES_TIMELINE_OBJECT (source1))); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), 0); + fail_unless_equals_uint64 (_START (source2), 0); /* ... and source2 */ fail_unless (ges_timeline_layer_remove_object (layer, GES_TIMELINE_OBJECT (source2))); @@ -273,8 +272,7 @@ GST_START_TEST (test_gsl_with_transitions) source1 = ges_custom_timeline_source_new (arbitrary_fill_track_func, (gpointer) ELEMENT); g_object_set (source1, "duration", GST_SECOND, "start", (guint64) 42, NULL); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1), - GST_SECOND); + fail_unless_equals_uint64 (_DURATION (source1), GST_SECOND); /* make this source taller than the others, so we can check that * gstlrecalculate handles this properly */ @@ -283,20 +281,17 @@ GST_START_TEST (test_gsl_with_transitions) (gpointer) ELEMENT); g_object_set (source2, "duration", GST_SECOND, "start", (guint64) 42, NULL); GES_TIMELINE_OBJECT (source2)->height = 4; - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source2), - GST_SECOND); + fail_unless_equals_uint64 (_DURATION (source2), GST_SECOND); source3 = ges_custom_timeline_source_new (arbitrary_fill_track_func, (gpointer) ELEMENT); g_object_set (source3, "duration", GST_SECOND, "start", (guint64) 42, NULL); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source3), - GST_SECOND); + fail_unless_equals_uint64 (_DURATION (source3), GST_SECOND); source4 = ges_custom_timeline_source_new (arbitrary_fill_track_func, (gpointer) ELEMENT); g_object_set (source4, "duration", GST_SECOND, "start", (guint64) 42, NULL); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source4), - GST_SECOND); + fail_unless_equals_uint64 (_DURATION (source4), GST_SECOND); /* create half-second transitions */ @@ -307,31 +302,31 @@ GST_START_TEST (test_gsl_with_transitions) ges_timeline_standard_transition_new (GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE); g_object_set (tr1, "duration", HALF_SECOND, "start", (guint64) 42, NULL); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (tr1), HALF_SECOND); + fail_unless_equals_uint64 (_DURATION (tr1), HALF_SECOND); tr2 = ges_timeline_standard_transition_new (GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE); g_object_set (tr2, "duration", HALF_SECOND, "start", (guint64) 42, NULL); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (tr2), HALF_SECOND); + fail_unless_equals_uint64 (_DURATION (tr2), HALF_SECOND); tr3 = ges_timeline_standard_transition_new (GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE); g_object_set (tr3, "duration", HALF_SECOND, "start", (guint64) 42, NULL); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (tr3), HALF_SECOND); + fail_unless_equals_uint64 (_DURATION (tr3), HALF_SECOND); tr4 = ges_timeline_standard_transition_new (GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE); g_object_set (tr4, "duration", HALF_SECOND, "start", (guint64) 42, NULL); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (tr4), HALF_SECOND); + fail_unless_equals_uint64 (_DURATION (tr4), HALF_SECOND); tr5 = ges_timeline_standard_transition_new (GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE); g_object_set (tr5, "duration", HALF_SECOND, "start", (guint64) 42, NULL); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (tr5), HALF_SECOND); + fail_unless_equals_uint64 (_DURATION (tr5), HALF_SECOND); /* simple test scenario with several sources in layer */ /* [0 0.5 1 1.5 2 2.5 3] */ @@ -354,38 +349,34 @@ GST_START_TEST (test_gsl_with_transitions) fail_unless (ges_simple_timeline_layer_add_object (gstl, GES_TIMELINE_OBJECT (source1), -1)); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1), - GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source1), 2); + fail_unless_equals_uint64 (_DURATION (source1), GST_SECOND); + fail_unless_equals_uint64 (_START (source1), 0); + fail_unless_equals_uint64 (_PRIORITY (source1), 2); GST_DEBUG ("Adding tr1"); fail_unless (ges_simple_timeline_layer_add_object (gstl, GES_TIMELINE_OBJECT (tr1), -1)); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1), - GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source1), 2); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (tr1), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (tr1), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr1), 1); + fail_unless_equals_uint64 (_DURATION (source1), GST_SECOND); + fail_unless_equals_uint64 (_START (source1), 0); + fail_unless_equals_uint64 (_PRIORITY (source1), 2); + fail_unless_equals_uint64 (_DURATION (tr1), HALF_SECOND); + fail_unless_equals_uint64 (_START (tr1), HALF_SECOND); + fail_unless_equals_uint64 (_PRIORITY (tr1), 1); GST_DEBUG ("Adding source2"); fail_unless (ges_simple_timeline_layer_add_object (gstl, GES_TIMELINE_OBJECT (source2), -1)); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1), - GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source1), 2); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (tr1), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (tr1), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr1), 1); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source2), - GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source2), 3); + fail_unless_equals_uint64 (_DURATION (source1), GST_SECOND); + fail_unless_equals_uint64 (_START (source1), 0); + fail_unless_equals_uint64 (_PRIORITY (source1), 2); + fail_unless_equals_uint64 (_DURATION (tr1), HALF_SECOND); + fail_unless_equals_uint64 (_START (tr1), HALF_SECOND); + fail_unless_equals_uint64 (_PRIORITY (tr1), 1); + fail_unless_equals_uint64 (_DURATION (source2), GST_SECOND); + fail_unless_equals_uint64 (_START (source2), HALF_SECOND); + fail_unless_equals_uint64 (_PRIORITY (source2), 3); /* add the third source before the second transition */ @@ -393,21 +384,18 @@ GST_START_TEST (test_gsl_with_transitions) fail_unless (ges_simple_timeline_layer_add_object (gstl, GES_TIMELINE_OBJECT (source3), -1)); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1), - GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source1), 2); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (tr1), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (tr1), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr1), 1); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source2), - GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source2), 3); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source3), - GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source3), SECOND (1.5)); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source3), 7); + fail_unless_equals_uint64 (_DURATION (source1), GST_SECOND); + fail_unless_equals_uint64 (_START (source1), 0); + fail_unless_equals_uint64 (_PRIORITY (source1), 2); + fail_unless_equals_uint64 (_DURATION (tr1), HALF_SECOND); + fail_unless_equals_uint64 (_START (tr1), HALF_SECOND); + fail_unless_equals_uint64 (_PRIORITY (tr1), 1); + fail_unless_equals_uint64 (_DURATION (source2), GST_SECOND); + fail_unless_equals_uint64 (_START (source2), HALF_SECOND); + fail_unless_equals_uint64 (_PRIORITY (source2), 3); + fail_unless_equals_uint64 (_DURATION (source3), GST_SECOND); + fail_unless_equals_uint64 (_START (source3), SECOND (1.5)); + fail_unless_equals_uint64 (_PRIORITY (source3), 7); /* now add the second transition */ @@ -415,24 +403,21 @@ GST_START_TEST (test_gsl_with_transitions) fail_unless (ges_simple_timeline_layer_add_object (gstl, GES_TIMELINE_OBJECT (tr2), 3)); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1), - GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source1), 2); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (tr1), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (tr1), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr1), 1); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source2), - GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source2), 3); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (tr2), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (tr2), GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr2), 2); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source3), - GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source3), GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source3), 7); + fail_unless_equals_uint64 (_DURATION (source1), GST_SECOND); + fail_unless_equals_uint64 (_START (source1), 0); + fail_unless_equals_uint64 (_PRIORITY (source1), 2); + fail_unless_equals_uint64 (_DURATION (tr1), HALF_SECOND); + fail_unless_equals_uint64 (_START (tr1), HALF_SECOND); + fail_unless_equals_uint64 (_PRIORITY (tr1), 1); + fail_unless_equals_uint64 (_DURATION (source2), GST_SECOND); + fail_unless_equals_uint64 (_START (source2), HALF_SECOND); + fail_unless_equals_uint64 (_PRIORITY (source2), 3); + fail_unless_equals_uint64 (_DURATION (tr2), HALF_SECOND); + fail_unless_equals_uint64 (_START (tr2), GST_SECOND); + fail_unless_equals_uint64 (_PRIORITY (tr2), 2); + fail_unless_equals_uint64 (_DURATION (source3), GST_SECOND); + fail_unless_equals_uint64 (_START (source3), GST_SECOND); + fail_unless_equals_uint64 (_PRIORITY (source3), 7); /* fourth source */ @@ -440,28 +425,24 @@ GST_START_TEST (test_gsl_with_transitions) fail_unless (ges_simple_timeline_layer_add_object (gstl, GES_TIMELINE_OBJECT (source4), -1)); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1), - GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source1), 2); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (tr1), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (tr1), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr1), 1); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source2), - GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source2), 3); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (tr2), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (tr2), GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr2), 2); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source3), - GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source3), GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source3), 7); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source4), - GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source4), SECOND (2)); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source4), 8); + fail_unless_equals_uint64 (_DURATION (source1), GST_SECOND); + fail_unless_equals_uint64 (_START (source1), 0); + fail_unless_equals_uint64 (_PRIORITY (source1), 2); + fail_unless_equals_uint64 (_DURATION (tr1), HALF_SECOND); + fail_unless_equals_uint64 (_START (tr1), HALF_SECOND); + fail_unless_equals_uint64 (_PRIORITY (tr1), 1); + fail_unless_equals_uint64 (_DURATION (source2), GST_SECOND); + fail_unless_equals_uint64 (_START (source2), HALF_SECOND); + fail_unless_equals_uint64 (_PRIORITY (source2), 3); + fail_unless_equals_uint64 (_DURATION (tr2), HALF_SECOND); + fail_unless_equals_uint64 (_START (tr2), GST_SECOND); + fail_unless_equals_uint64 (_PRIORITY (tr2), 2); + fail_unless_equals_uint64 (_DURATION (source3), GST_SECOND); + fail_unless_equals_uint64 (_START (source3), GST_SECOND); + fail_unless_equals_uint64 (_PRIORITY (source3), 7); + fail_unless_equals_uint64 (_DURATION (source4), GST_SECOND); + fail_unless_equals_uint64 (_START (source4), SECOND (2)); + fail_unless_equals_uint64 (_PRIORITY (source4), 8); /* check that any insertion which might result in two adjacent transitions * will fail */ diff --git a/tests/check/ges/test-utils.h b/tests/check/ges/test-utils.h index b5c912041a..5d9477e211 100644 --- a/tests/check/ges/test-utils.h +++ b/tests/check/ges/test-utils.h @@ -73,4 +73,9 @@ G_STMT_START { \ g_type_name (type)); \ } G_STMT_END; +#define _START(obj) GES_TIMELINE_ELEMENT_START (obj) +#define _DURATION(obj) GES_TIMELINE_ELEMENT_DURATION (obj) +#define _INPOINT(obj) GES_TIMELINE_ELEMENT_INPOINT (obj) +#define _PRIORITY(obj) GES_TIMELINE_ELEMENT_PRIORITY (obj) + #endif /* _GES_TEST_UTILS */ diff --git a/tests/check/ges/timelineedition.c b/tests/check/ges/timelineedition.c index a7bffa11e2..c36012e681 100644 --- a/tests/check/ges/timelineedition.c +++ b/tests/check/ges/timelineedition.c @@ -18,6 +18,7 @@ * Boston, MA 02110-1301, USA. */ +#include "test-utils.h" #include #include @@ -48,9 +49,9 @@ create_custom_tlobj (void) } #define CHECK_OBJECT_PROPS(obj, start, inpoint, duration) {\ - assert_equals_uint64 (ges_track_object_get_start (obj), start);\ - assert_equals_uint64 (ges_track_object_get_inpoint (obj), inpoint);\ - assert_equals_uint64 (ges_track_object_get_duration (obj), duration);\ + assert_equals_uint64 (_START (obj), start);\ + assert_equals_uint64 (_INPOINT (obj), inpoint);\ + assert_equals_uint64 (_DURATION (obj), duration);\ } GST_START_TEST (test_basic_timeline_edition) @@ -95,19 +96,19 @@ GST_START_TEST (test_basic_timeline_edition) fail_unless (tckobj != NULL); fail_unless (ges_timeline_object_add_track_object (obj, tckobj)); fail_unless (ges_track_add_object (track, tckobj)); - assert_equals_uint64 (ges_track_object_get_duration (tckobj), 10); + assert_equals_uint64 (_DURATION (tckobj), 10); tckobj1 = ges_timeline_object_create_track_object (obj1, track->type); fail_unless (tckobj1 != NULL); fail_unless (ges_timeline_object_add_track_object (obj1, tckobj1)); fail_unless (ges_track_add_object (track, tckobj1)); - assert_equals_uint64 (ges_track_object_get_duration (tckobj1), 10); + assert_equals_uint64 (_DURATION (tckobj1), 10); tckobj2 = ges_timeline_object_create_track_object (obj2, track->type); fail_unless (ges_timeline_object_add_track_object (obj2, tckobj2)); fail_unless (tckobj2 != NULL); fail_unless (ges_track_add_object (track, tckobj2)); - assert_equals_uint64 (ges_track_object_get_duration (tckobj2), 60); + assert_equals_uint64 (_DURATION (tckobj2), 60); /** * Simple rippling obj to: 10 @@ -298,7 +299,7 @@ GST_START_TEST (test_snapping) fail_unless ((tckobjs = ges_timeline_object_get_track_objects (obj)) != NULL); fail_unless ((tckobj = GES_TRACK_OBJECT (tckobjs->data)) != NULL); fail_unless (ges_track_object_get_track (tckobj) == track); - assert_equals_uint64 (ges_track_object_get_duration (tckobj), 37); + assert_equals_uint64 (_DURATION (tckobj), 37); g_list_free_full (tckobjs, g_object_unref); /* We have 3 references to tckobj from: @@ -313,7 +314,7 @@ GST_START_TEST (test_snapping) ges_timeline_object_get_track_objects (obj1)) != NULL); fail_unless ((tckobj1 = GES_TRACK_OBJECT (tckobjs->data)) != NULL); fail_unless (ges_track_object_get_track (tckobj1) == track); - assert_equals_uint64 (ges_track_object_get_duration (tckobj1), 15); + assert_equals_uint64 (_DURATION (tckobj1), 15); g_list_free_full (tckobjs, g_object_unref); /* Same ref logic */ @@ -325,7 +326,7 @@ GST_START_TEST (test_snapping) ges_timeline_object_get_track_objects (obj2)) != NULL); fail_unless ((tckobj2 = GES_TRACK_OBJECT (tckobjs->data)) != NULL); fail_unless (ges_track_object_get_track (tckobj2) == track); - assert_equals_uint64 (ges_track_object_get_duration (tckobj2), 60); + assert_equals_uint64 (_DURATION (tckobj2), 60); g_list_free_full (tckobjs, g_object_unref); /* Same ref logic */ @@ -356,7 +357,7 @@ GST_START_TEST (test_snapping) * time 20----------30 */ g_object_set (timeline, "snapping-distance", (guint64) 0, NULL); - ges_timeline_object_set_duration (obj1, 10); + ges_timeline_element_set_duration (GES_TIMELINE_ELEMENT (obj1), 10); CHECK_OBJECT_PROPS (tckobj, 25, 0, 37); CHECK_OBJECT_PROPS (tckobj1, 20, 0, 10); CHECK_OBJECT_PROPS (tckobj2, 62, 0, 60); @@ -372,8 +373,9 @@ GST_START_TEST (test_snapping) * time 20---------------------- 72 --------122 */ /* Rolling involves only neighbour that are currently snapping */ - fail_unless (ges_timeline_object_roll_end (obj1, 62)); - fail_unless (ges_timeline_object_roll_end (obj1, 72) == TRUE); + fail_unless (ges_timeline_element_roll_end (GES_TIMELINE_ELEMENT (obj1), 62)); + fail_unless (ges_timeline_element_roll_end (GES_TIMELINE_ELEMENT (obj1), + 72) == TRUE); CHECK_OBJECT_PROPS (tckobj, 25, 0, 37); CHECK_OBJECT_PROPS (tckobj1, 20, 0, 52); CHECK_OBJECT_PROPS (tckobj2, 72, 10, 50); @@ -387,7 +389,8 @@ GST_START_TEST (test_snapping) * time 25------------- 72 --------122 */ g_object_set (timeline, "snapping-distance", (guint64) 4, NULL); - fail_unless (ges_timeline_object_trim_start (obj1, 28) == TRUE); + fail_unless (ges_timeline_element_trim (GES_TIMELINE_ELEMENT (obj1), + 28) == TRUE); CHECK_OBJECT_PROPS (tckobj, 25, 0, 37); CHECK_OBJECT_PROPS (tckobj1, 25, 5, 47); CHECK_OBJECT_PROPS (tckobj2, 72, 10, 50); @@ -400,7 +403,8 @@ GST_START_TEST (test_snapping) * | obj1 || obj2 | * time 25-------- 62 --------122 */ - fail_unless (ges_timeline_object_roll_start (obj2, 59) == TRUE); + fail_unless (ges_timeline_element_roll_start (GES_TIMELINE_ELEMENT (obj2), + 59) == TRUE); CHECK_OBJECT_PROPS (tckobj, 25, 0, 37); CHECK_OBJECT_PROPS (tckobj1, 25, 5, 37); CHECK_OBJECT_PROPS (tckobj2, 62, 0, 60); @@ -410,7 +414,8 @@ GST_START_TEST (test_snapping) * | obj || obj1 || obj2 | * time 25---------62-------- 99 --------170 */ - fail_unless (ges_timeline_object_ripple (obj1, 58) == TRUE); + fail_unless (ges_timeline_element_ripple (GES_TIMELINE_ELEMENT (obj1), + 58) == TRUE); CHECK_OBJECT_PROPS (tckobj, 25, 0, 37); CHECK_OBJECT_PROPS (tckobj1, 62, 5, 37); CHECK_OBJECT_PROPS (tckobj2, 99, 0, 60); @@ -420,7 +425,7 @@ GST_START_TEST (test_snapping) * | obj || obj1 | | obj2 | * time 25---------62-------- 99 110--------170 */ - ges_timeline_object_set_start (obj2, 110); + ges_timeline_element_set_start (GES_TIMELINE_ELEMENT (obj2), 110); CHECK_OBJECT_PROPS (tckobj, 25, 0, 37); CHECK_OBJECT_PROPS (tckobj1, 62, 5, 37); CHECK_OBJECT_PROPS (tckobj2, 110, 0, 60); @@ -542,7 +547,7 @@ GST_START_TEST (test_timeline_edition_mode) fail_unless ((tckobjs = ges_timeline_object_get_track_objects (obj)) != NULL); fail_unless ((tckobj = GES_TRACK_OBJECT (tckobjs->data)) != NULL); fail_unless (ges_track_object_get_track (tckobj) == track); - assert_equals_uint64 (ges_track_object_get_duration (tckobj), 10); + assert_equals_uint64 (_DURATION (tckobj), 10); g_list_free_full (tckobjs, g_object_unref); /* Add a new layer and add objects to it */ @@ -555,7 +560,7 @@ GST_START_TEST (test_timeline_edition_mode) ges_timeline_object_get_track_objects (obj1)) != NULL); fail_unless ((tckobj1 = GES_TRACK_OBJECT (tckobjs->data)) != NULL); fail_unless (ges_track_object_get_track (tckobj1) == track); - assert_equals_uint64 (ges_track_object_get_duration (tckobj1), 10); + assert_equals_uint64 (_DURATION (tckobj1), 10); g_list_free_full (tckobjs, g_object_unref); fail_unless (ges_timeline_layer_add_object (layer1, obj2)); @@ -563,7 +568,7 @@ GST_START_TEST (test_timeline_edition_mode) ges_timeline_object_get_track_objects (obj2)) != NULL); fail_unless ((tckobj2 = GES_TRACK_OBJECT (tckobjs->data)) != NULL); fail_unless (ges_track_object_get_track (tckobj2) == track); - assert_equals_uint64 (ges_track_object_get_duration (tckobj2), 60); + assert_equals_uint64 (_DURATION (tckobj2), 60); g_list_free_full (tckobjs, g_object_unref); /** diff --git a/tests/check/ges/timelineobject.c b/tests/check/ges/timelineobject.c index 1a0b93ea15..7be6350ef7 100644 --- a/tests/check/ges/timelineobject.c +++ b/tests/check/ges/timelineobject.c @@ -58,9 +58,9 @@ GST_START_TEST (test_object_properties) /* Set some properties */ g_object_set (object, "start", (guint64) 42, "duration", (guint64) 51, "in-point", (guint64) 12, NULL); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 42); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object), 51); - assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 12); + assert_equals_uint64 (_START (object), 42); + assert_equals_uint64 (_DURATION (object), 51); + assert_equals_uint64 (_INPOINT (object), 12); trackobject = ges_timeline_object_create_track_object (object, track->type); ges_timeline_object_add_track_object (object, trackobject); @@ -68,9 +68,9 @@ GST_START_TEST (test_object_properties) fail_unless (ges_track_object_set_track (trackobject, track)); /* Check that trackobject has the same properties */ - assert_equals_uint64 (GES_TRACK_OBJECT_START (trackobject), 42); - assert_equals_uint64 (GES_TRACK_OBJECT_DURATION (trackobject), 51); - assert_equals_uint64 (GES_TRACK_OBJECT_INPOINT (trackobject), 12); + assert_equals_uint64 (_START (trackobject), 42); + assert_equals_uint64 (_DURATION (trackobject), 51); + assert_equals_uint64 (_INPOINT (trackobject), 12); /* And let's also check that it propagated correctly to GNonLin */ gnl_object_check (ges_track_object_get_gnlobject (trackobject), 42, 51, 12, @@ -79,12 +79,12 @@ GST_START_TEST (test_object_properties) /* Change more properties, see if they propagate */ g_object_set (object, "start", (guint64) 420, "duration", (guint64) 510, "in-point", (guint64) 120, NULL); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 420); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object), 510); - assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 120); - assert_equals_uint64 (GES_TRACK_OBJECT_START (trackobject), 420); - assert_equals_uint64 (GES_TRACK_OBJECT_DURATION (trackobject), 510); - assert_equals_uint64 (GES_TRACK_OBJECT_INPOINT (trackobject), 120); + assert_equals_uint64 (_START (object), 420); + assert_equals_uint64 (_DURATION (object), 510); + assert_equals_uint64 (_INPOINT (object), 120); + assert_equals_uint64 (_START (trackobject), 420); + assert_equals_uint64 (_DURATION (trackobject), 510); + assert_equals_uint64 (_INPOINT (trackobject), 120); /* And let's also check that it propagated correctly to GNonLin */ gnl_object_check (ges_track_object_get_gnlobject (trackobject), 420, 510, 120, @@ -94,8 +94,8 @@ GST_START_TEST (test_object_properties) /* This time, we move the trackobject to see if the changes move * along to the parent and the gnonlin object */ g_object_set (trackobject, "start", (guint64) 400, NULL); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 400); - assert_equals_uint64 (GES_TRACK_OBJECT_START (trackobject), 400); + assert_equals_uint64 (_START (object), 400); + assert_equals_uint64 (_START (trackobject), 400); gnl_object_check (ges_track_object_get_gnlobject (trackobject), 400, 510, 120, 510, 0, TRUE); @@ -126,9 +126,9 @@ GST_START_TEST (test_object_properties_unlocked) /* Set some properties */ g_object_set (object, "start", (guint64) 42, "duration", (guint64) 51, "in-point", (guint64) 12, NULL); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 42); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object), 51); - assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 12); + assert_equals_uint64 (_START (object), 42); + assert_equals_uint64 (_DURATION (object), 51); + assert_equals_uint64 (_INPOINT (object), 12); trackobject = ges_timeline_object_create_track_object (object, track->type); ges_timeline_object_add_track_object (object, trackobject); @@ -136,9 +136,9 @@ GST_START_TEST (test_object_properties_unlocked) fail_unless (ges_track_object_set_track (trackobject, track)); /* Check that trackobject has the same properties */ - assert_equals_uint64 (GES_TRACK_OBJECT_START (trackobject), 42); - assert_equals_uint64 (GES_TRACK_OBJECT_DURATION (trackobject), 51); - assert_equals_uint64 (GES_TRACK_OBJECT_INPOINT (trackobject), 12); + assert_equals_uint64 (_START (trackobject), 42); + assert_equals_uint64 (_DURATION (trackobject), 51); + assert_equals_uint64 (_INPOINT (trackobject), 12); /* And let's also check that it propagated correctly to GNonLin */ gnl_object_check (ges_track_object_get_gnlobject (trackobject), 42, 51, 12, @@ -150,13 +150,13 @@ GST_START_TEST (test_object_properties_unlocked) /* Change more properties, they will be set on the GESTimelineObject */ g_object_set (object, "start", (guint64) 420, "duration", (guint64) 510, "in-point", (guint64) 120, NULL); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 420); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object), 510); - assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 120); + assert_equals_uint64 (_START (object), 420); + assert_equals_uint64 (_DURATION (object), 510); + assert_equals_uint64 (_INPOINT (object), 120); /* ... but not on the GESTrackObject since it was unlocked... */ - assert_equals_uint64 (GES_TRACK_OBJECT_START (trackobject), 42); - assert_equals_uint64 (GES_TRACK_OBJECT_DURATION (trackobject), 51); - assert_equals_uint64 (GES_TRACK_OBJECT_INPOINT (trackobject), 12); + assert_equals_uint64 (_START (trackobject), 42); + assert_equals_uint64 (_DURATION (trackobject), 51); + assert_equals_uint64 (_INPOINT (trackobject), 12); /* ... and neither on the GNonLin object */ gnl_object_check (ges_track_object_get_gnlobject (trackobject), 42, 51, 12, 51, 0, TRUE); @@ -166,8 +166,8 @@ GST_START_TEST (test_object_properties_unlocked) /* This time, we move the trackobject to see if the changes move * along to the parent and the gnonlin object */ g_object_set (trackobject, "start", (guint64) 400, NULL); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 420); - assert_equals_uint64 (GES_TRACK_OBJECT_START (trackobject), 400); + assert_equals_uint64 (_START (object), 420); + assert_equals_uint64 (_START (trackobject), 400); gnl_object_check (ges_track_object_get_gnlobject (trackobject), 400, 51, 12, 51, 0, TRUE); @@ -200,9 +200,9 @@ GST_START_TEST (test_split_object) /* Set some properties */ g_object_set (object, "start", (guint64) 42, "duration", (guint64) 50, "in-point", (guint64) 12, NULL); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 42); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object), 50); - assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 12); + assert_equals_uint64 (_START (object), 42); + assert_equals_uint64 (_DURATION (object), 50); + assert_equals_uint64 (_INPOINT (object), 12); trackobject = ges_timeline_object_create_track_object (object, track->type); ges_timeline_object_add_track_object (object, trackobject); @@ -210,9 +210,9 @@ GST_START_TEST (test_split_object) fail_unless (ges_track_object_set_track (trackobject, track)); /* Check that trackobject has the same properties */ - assert_equals_uint64 (GES_TRACK_OBJECT_START (trackobject), 42); - assert_equals_uint64 (GES_TRACK_OBJECT_DURATION (trackobject), 50); - assert_equals_uint64 (GES_TRACK_OBJECT_INPOINT (trackobject), 12); + assert_equals_uint64 (_START (trackobject), 42); + assert_equals_uint64 (_DURATION (trackobject), 50); + assert_equals_uint64 (_INPOINT (trackobject), 12); /* And let's also check that it propagated correctly to GNonLin */ gnl_object_check (ges_track_object_get_gnlobject (trackobject), 42, 50, 12, @@ -221,22 +221,22 @@ GST_START_TEST (test_split_object) splitobj = ges_timeline_object_split (object, 67); fail_unless (GES_IS_TIMELINE_OBJECT (splitobj)); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 42); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object), 25); - assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 12); + assert_equals_uint64 (_START (object), 42); + assert_equals_uint64 (_DURATION (object), 25); + assert_equals_uint64 (_INPOINT (object), 12); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (splitobj), 67); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (splitobj), 25); - assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (splitobj), 37); + assert_equals_uint64 (_START (splitobj), 67); + assert_equals_uint64 (_DURATION (splitobj), 25); + assert_equals_uint64 (_INPOINT (splitobj), 37); splittckobjs = ges_timeline_object_get_track_objects (splitobj); fail_unless_equals_int (g_list_length (splittckobjs), 1); splittckobj = GES_TRACK_OBJECT (splittckobjs->data); fail_unless (GES_IS_TRACK_OBJECT (splittckobj)); - assert_equals_uint64 (GES_TRACK_OBJECT_START (splittckobj), 67); - assert_equals_uint64 (GES_TRACK_OBJECT_DURATION (splittckobj), 25); - assert_equals_uint64 (GES_TRACK_OBJECT_INPOINT (splittckobj), 37); + assert_equals_uint64 (_START (splittckobj), 67); + assert_equals_uint64 (_DURATION (splittckobj), 25); + assert_equals_uint64 (_INPOINT (splittckobj), 37); fail_unless (splittckobj != trackobject); fail_unless (splitobj != object); diff --git a/tests/check/ges/titles.c b/tests/check/ges/titles.c index 83fd3459c7..d32422c14c 100644 --- a/tests/check/ges/titles.c +++ b/tests/check/ges/titles.c @@ -53,9 +53,9 @@ GST_START_TEST (test_title_source_properties) /* Set some properties */ g_object_set (object, "start", (guint64) 42, "duration", (guint64) 51, "in-point", (guint64) 12, NULL); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 42); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object), 51); - assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 12); + assert_equals_uint64 (_START (object), 42); + assert_equals_uint64 (_DURATION (object), 51); + assert_equals_uint64 (_INPOINT (object), 12); trackobject = ges_timeline_object_create_track_object (object, track->type); ges_timeline_object_add_track_object (object, trackobject); @@ -63,9 +63,9 @@ GST_START_TEST (test_title_source_properties) fail_unless (ges_track_object_set_track (trackobject, track)); /* Check that trackobject has the same properties */ - assert_equals_uint64 (GES_TRACK_OBJECT_START (trackobject), 42); - assert_equals_uint64 (GES_TRACK_OBJECT_DURATION (trackobject), 51); - assert_equals_uint64 (GES_TRACK_OBJECT_INPOINT (trackobject), 12); + assert_equals_uint64 (_START (trackobject), 42); + assert_equals_uint64 (_DURATION (trackobject), 51); + assert_equals_uint64 (_INPOINT (trackobject), 12); /* And let's also check that it propagated correctly to GNonLin */ gnl_object_check (ges_track_object_get_gnlobject (trackobject), 42, 51, 12, @@ -74,12 +74,12 @@ GST_START_TEST (test_title_source_properties) /* Change more properties, see if they propagate */ g_object_set (object, "start", (guint64) 420, "duration", (guint64) 510, "in-point", (guint64) 120, NULL); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 420); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object), 510); - assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 120); - assert_equals_uint64 (GES_TRACK_OBJECT_START (trackobject), 420); - assert_equals_uint64 (GES_TRACK_OBJECT_DURATION (trackobject), 510); - assert_equals_uint64 (GES_TRACK_OBJECT_INPOINT (trackobject), 120); + assert_equals_uint64 (_START (object), 420); + assert_equals_uint64 (_DURATION (object), 510); + assert_equals_uint64 (_INPOINT (object), 120); + assert_equals_uint64 (_START (trackobject), 420); + assert_equals_uint64 (_DURATION (trackobject), 510); + assert_equals_uint64 (_INPOINT (trackobject), 120); /* And let's also check that it propagated correctly to GNonLin */ gnl_object_check (ges_track_object_get_gnlobject (trackobject), 420, 510, 120, diff --git a/tests/check/ges/transition.c b/tests/check/ges/transition.c index df0a920f66..cc39617f8a 100644 --- a/tests/check/ges/transition.c +++ b/tests/check/ges/transition.c @@ -85,9 +85,9 @@ GST_START_TEST (test_transition_properties) g_object_set (object, "start", (guint64) 42, "duration", (guint64) 51, "in-point", (guint64) 12, NULL); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 42); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object), 51); - assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 12); + assert_equals_uint64 (_START (object), 42); + assert_equals_uint64 (_DURATION (object), 51); + assert_equals_uint64 (_INPOINT (object), 12); trackobject = ges_timeline_object_create_track_object (object, track->type); ges_timeline_object_add_track_object (object, trackobject); @@ -95,9 +95,9 @@ GST_START_TEST (test_transition_properties) fail_unless (ges_track_object_set_track (trackobject, track)); /* Check that trackobject has the same properties */ - assert_equals_uint64 (GES_TRACK_OBJECT_START (trackobject), 42); - assert_equals_uint64 (GES_TRACK_OBJECT_DURATION (trackobject), 51); - assert_equals_uint64 (GES_TRACK_OBJECT_INPOINT (trackobject), 12); + assert_equals_uint64 (_START (trackobject), 42); + assert_equals_uint64 (_DURATION (trackobject), 51); + assert_equals_uint64 (_INPOINT (trackobject), 12); /* And let's also check that it propagated correctly to GNonLin */ gnl_object_check (ges_track_object_get_gnlobject (trackobject), 42, 51, 12, @@ -106,12 +106,12 @@ GST_START_TEST (test_transition_properties) /* Change more properties, see if they propagate */ g_object_set (object, "start", (guint64) 420, "duration", (guint64) 510, "in-point", (guint64) 120, NULL); - assert_equals_uint64 (GES_TIMELINE_OBJECT_START (object), 420); - assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object), 510); - assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 120); - assert_equals_uint64 (GES_TRACK_OBJECT_START (trackobject), 420); - assert_equals_uint64 (GES_TRACK_OBJECT_DURATION (trackobject), 510); - assert_equals_uint64 (GES_TRACK_OBJECT_INPOINT (trackobject), 120); + assert_equals_uint64 (_START (object), 420); + assert_equals_uint64 (_DURATION (object), 510); + assert_equals_uint64 (_INPOINT (object), 120); + assert_equals_uint64 (_START (trackobject), 420); + assert_equals_uint64 (_DURATION (trackobject), 510); + assert_equals_uint64 (_INPOINT (trackobject), 120); /* And let's also check that it propagated correctly to GNonLin */ gnl_object_check (ges_track_object_get_gnlobject (trackobject), 420, 510, 120, diff --git a/tests/examples/ges-ui.c b/tests/examples/ges-ui.c index 8e3ff7a2e2..c9a6706ee9 100644 --- a/tests/examples/ges-ui.c +++ b/tests/examples/ges-ui.c @@ -271,15 +271,13 @@ filesource_notify_duration_cb (GESTimelineObject * object, GParamSpec * arg G_GNUC_UNUSED, App * app) { guint64 duration, max_inpoint; - duration = GES_TIMELINE_OBJECT_DURATION (object); - max_inpoint = - ges_timeline_filesource_get_max_duration (GES_TIMELINE_FILE_SOURCE - (object)) - duration; + duration = GES_TIMELINE_ELEMENT_DURATION (object); + max_inpoint = GES_TIMELINE_ELEMENT_MAX_DURATION (object) - duration; gtk_range_set_value (GTK_RANGE (app->duration), duration); gtk_range_set_fill_level (GTK_RANGE (app->in_point), max_inpoint); - if (max_inpoint < GES_TIMELINE_OBJECT_INPOINT (object)) + if (max_inpoint < GES_TIMELINE_ELEMENT_INPOINT (object)) g_object_set (object, "in-point", max_inpoint, NULL); } @@ -289,11 +287,9 @@ filesource_notify_max_duration_cb (GESTimelineObject * object, GParamSpec * arg G_GNUC_UNUSED, App * app) { gtk_range_set_range (GTK_RANGE (app->duration), 0, (gdouble) - ges_timeline_filesource_get_max_duration (GES_TIMELINE_FILE_SOURCE - (object))); + GES_TIMELINE_ELEMENT_MAX_DURATION (object)); gtk_range_set_range (GTK_RANGE (app->in_point), 0, (gdouble) - ges_timeline_filesource_get_max_duration (GES_TIMELINE_FILE_SOURCE - (object))); + GES_TIMELINE_ELEMENT_MAX_DURATION (object)); } static void @@ -301,7 +297,7 @@ filesource_notify_in_point_cb (GESTimelineObject * object, GParamSpec * arg G_GNUC_UNUSED, App * app) { gtk_range_set_value (GTK_RANGE (app->in_point), - GES_TIMELINE_OBJECT_INPOINT (object)); + GES_TIMELINE_ELEMENT_INPOINT (object)); } static void @@ -683,7 +679,7 @@ connect_to_object (GESTimelineObject * object, App * app) app->ignore_input = TRUE; - duration = GES_TIMELINE_OBJECT_DURATION (object); + duration = GES_TIMELINE_ELEMENT_DURATION (object); g_snprintf (buf, sizeof (buf), "%02u:%02u:%02u.%09u", GST_TIME_ARGS (duration)); gtk_entry_set_text (app->seconds, buf); @@ -1633,9 +1629,7 @@ duration_scale_change_value_cb (GtkRange * range, GtkScrollType unused, for (i = app->selected_objects; i; i = i->next) { guint64 duration, maxduration; - maxduration = - ges_timeline_filesource_get_max_duration (GES_TIMELINE_FILE_SOURCE - (i->data)); + maxduration = GES_TIMELINE_ELEMENT_MAX_DURATION (i->data); duration = (value < maxduration ? (value > 0 ? value : 0) : maxduration); g_object_set (G_OBJECT (i->data), "duration", (guint64) duration, NULL); } @@ -1650,9 +1644,8 @@ in_point_scale_change_value_cb (GtkRange * range, GtkScrollType unused, for (i = app->selected_objects; i; i = i->next) { guint64 in_point, maxduration; - maxduration = - ges_timeline_filesource_get_max_duration (GES_TIMELINE_FILE_SOURCE - (i->data)) - GES_TIMELINE_OBJECT_DURATION (i->data); + maxduration = GES_TIMELINE_ELEMENT_MAX_DURATION (i->data) - + GES_TIMELINE_ELEMENT_DURATION (i->data); in_point = (value < maxduration ? (value > 0 ? value : 0) : maxduration); g_object_set (G_OBJECT (i->data), "in-point", (guint64) in_point, NULL); }