GST_ERROR ("Asset could not be created for uri %s, error: %s",
ges_asset_get_id (asset), error->message);
-
} else {
GESProject *project = udata->layer->timeline ?
GES_PROJECT (ges_extractable_get_asset (GES_EXTRACTABLE
ges_extractable_set_asset (GES_EXTRACTABLE (udata->clip), asset);
ges_project_add_asset (project, asset);
+
+ /* clip was already ref-sinked when creating udata,
+ * gst_layer_add_clip() creates a new ref as such and
+ * below we unref the ref from udata */
ges_layer_add_clip (udata->layer, udata->clip);
}
gst_object_unref (asset);
+ gst_object_unref (udata->clip);
g_slice_free (NewAssetUData, udata);
}
/**
* ges_layer_add_clip:
* @layer: a #GESLayer
- * @clip: (transfer full): the #GESClip to add.
+ * @clip: (transfer floating): the #GESClip to add.
*
* Adds the given clip to the layer. Sets the clip's parent, and thus
* takes ownership of the clip.
current_layer = ges_clip_get_layer (clip);
if (G_UNLIKELY (current_layer)) {
GST_WARNING ("Clip %p already belongs to another layer", clip);
+ gst_object_ref_sink (clip);
gst_object_unref (current_layer);
return FALSE;
gchar *id;
NewAssetUData *mudata = g_slice_new (NewAssetUData);
- mudata->clip = clip;
+ mudata->clip = gst_object_ref_sink (clip);
mudata->layer = layer;
GST_DEBUG_OBJECT (layer, "%" GST_PTR_FORMAT " as no reference to any "
ges_extractable_set_asset (GES_EXTRACTABLE (clip), asset);
g_slice_free (NewAssetUData, mudata);
+ } else {
+ gst_object_ref_sink (clip);
}
-
- gst_object_ref_sink (clip);
-
/* Take a reference to the clip and store it stored by start/priority */
priv->clips_start = g_list_insert_sorted (priv->clips_start, clip,
(GCompareFunc) element_start_compare);
}
if (!ges_layer_add_clip (layer, clip)) {
- gst_object_unref (clip);
-
return NULL;
}
* @self: a #GESTimelineElement
* @parent: new parent of self
*
- * Sets the parent of @self to @parent. The object's reference count will
- * be incremented, and any floating reference will be removed (see gst_object_ref_sink()).
+ * Sets the parent of @self to @parent. The parents needs to already
+ * own a hard reference on @self.
*
* Returns: %TRUE if @parent could be set or %FALSE when @self
* already had a parent or @self and @parent are the same.
if (self == parent) {
GST_INFO_OBJECT (self, "Trying to add %p in itself, not a good idea!",
self);
-
+ gst_object_ref_sink (self);
+ gst_object_unref (self);
return FALSE;
}
had_parent:
{
GST_WARNING_OBJECT (self, "set parent failed, object already had a parent");
+ gst_object_ref_sink (self);
+ gst_object_unref (self);
return FALSE;
}
}
/**
* ges_timeline_add_layer:
* @timeline: a #GESTimeline
- * @layer: (transfer full): the #GESLayer to add
+ * @layer: (transfer floating): the #GESLayer to add
*
* Add the layer to the timeline. The reference to the @layer will be stolen
* by the @timeline.
/* We can only add a layer that doesn't already belong to another timeline */
if (G_UNLIKELY (layer->timeline)) {
GST_WARNING ("Layer belongs to another timeline, can't add it");
+ gst_object_ref_sink (layer);
+ gst_object_unref (layer);
return FALSE;
}
/* Add to the list of layers, make sure we don't already control it */
if (G_UNLIKELY (g_list_find (timeline->layers, (gconstpointer) layer))) {
GST_WARNING ("Layer is already controlled by this timeline");
+ gst_object_ref_sink (layer);
+ gst_object_unref (layer);
return FALSE;
}
/**
* ges_track_add_element:
* @track: a #GESTrack
- * @object: (transfer full): the #GESTrackElement to add
+ * @object: (transfer floating): the #GESTrackElement to add
*
* Adds the given object to the track. Sets the object's controlling track,
* and thus takes ownership of the @object.
if (G_UNLIKELY (ges_track_element_get_track (object) != NULL)) {
GST_WARNING ("Object already belongs to another track");
+ gst_object_ref_sink (object);
+ gst_object_unref (object);
return FALSE;
}
if (G_UNLIKELY (!ges_track_element_set_track (object, track))) {
GST_ERROR ("Couldn't properly add the object to the Track");
+ gst_object_ref_sink (object);
+ gst_object_unref (object);
return FALSE;
}
if (G_UNLIKELY (!ges_nle_composition_add_object (track->priv->composition,
ges_track_element_get_nleobject (object)))) {
GST_WARNING ("Couldn't add object to the NleComposition");
+ gst_object_ref_sink (object);
+ gst_object_unref (object);
return FALSE;
}