clip: Rework the splitting method

+ Avoid setting clip duration of our parent ourself

Now each and every TrackElement inside a clip have the same
start/inpoint/duration
This commit is contained in:
Thibault Saunier 2013-04-18 21:45:18 -03:00
parent 858a630e65
commit 10c25fef13

View file

@ -1070,27 +1070,11 @@ ges_clip_split (GESClip * clip, guint64 position)
ges_timeline_layer_add_clip (clip->priv->layer, new_object);
ges_clip_set_moving_from_layer (new_object, FALSE);
/* We first set the new duration and the child mapping will be updated
* properly in the following loop
* FIXME: Avoid setting it oureself reworking the API */
GES_TIMELINE_ELEMENT (clip)->duration = position - _START (clip);
_set_duration0 (GES_TIMELINE_ELEMENT (clip), position - _START (clip));
for (tmp = GES_CONTAINER_CHILDREN (clip); tmp; tmp = tmp->next) {
GESTrackElement *new_trackelement, *trackelement =
GES_TRACK_ELEMENT (tmp->data);
duration = _DURATION (trackelement);
start = _START (trackelement);
inpoint = _INPOINT (trackelement);
if (position <= start || position >= (start + duration)) {
GST_DEBUG_OBJECT (trackelement,
"Outside %" GST_TIME_FORMAT "the boundaries "
"not copying it ( start %" GST_TIME_FORMAT ", end %" GST_TIME_FORMAT
")", GST_TIME_ARGS (position), GST_TIME_ARGS (_START (trackelement)),
GST_TIME_ARGS (_START (trackelement) + _DURATION (trackelement)));
continue;
}
new_trackelement =
GES_TRACK_ELEMENT (ges_timeline_element_copy (GES_TIMELINE_ELEMENT
(trackelement), TRUE));
@ -1106,9 +1090,6 @@ ges_clip_split (GESClip * clip, guint64 position)
_set_duration0 (GES_TIMELINE_ELEMENT (new_trackelement),
duration + start - position);
/* Set 'old' track element duration */
_set_duration0 (GES_TIMELINE_ELEMENT (trackelement), position - start);
ges_container_add (GES_CONTAINER (new_object),
GES_TIMELINE_ELEMENT (new_trackelement));
}