From 04071e72145a12aa87e02224f05108cf615e4deb Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Fri, 22 Nov 2013 17:36:12 -0300 Subject: [PATCH] layer: Set clip start to the duration of the layer if == TIME_NONE In the provided start of a clip is GST_CLOCK_TIME_NONE in ges_layer_add_asset, it means that we want the clip to be added at the end of the layer --- ges/ges-layer.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ges/ges-layer.c b/ges/ges-layer.c index 98714e2590..67953e701f 100644 --- a/ges/ges-layer.c +++ b/ges/ges-layer.c @@ -595,7 +595,9 @@ ges_layer_add_clip (GESLayer * layer, GESClip * clip) * ges_layer_add_asset: * @layer: a #GESLayer * @asset: The asset to add to - * @start: The start value to set on the new #GESClip + * @start: The start value to set on the new #GESClip, + * if @start == GST_CLOCK_TIME_NONE, it will be set to + * the current duration of @layer * @inpoint: The inpoint value to set on the new #GESClip * @duration: The duration value to set on the new #GESClip * @track_types: The #GESTrackType to set on the the new #GESClip @@ -624,6 +626,15 @@ ges_layer_add_asset (GESLayer * layer, ges_track_type_name (track_types)); clip = GES_CLIP (ges_asset_extract (asset, NULL)); + + if (!GST_CLOCK_TIME_IS_VALID (start)) { + start = ges_layer_get_duration (layer); + + GST_DEBUG_OBJECT (layer, + "No start specified, setting it to %" GST_TIME_FORMAT, + GST_TIME_ARGS (start)); + } + _set_start0 (GES_TIMELINE_ELEMENT (clip), start); _set_inpoint0 (GES_TIMELINE_ELEMENT (clip), inpoint); if (track_types != GES_TRACK_TYPE_UNKNOWN)