static void ges_track_video_transition_duration_changed (GESTrackObject * object, guint64 duration) { GstElement *gnlobj = ges_track_object_get_gnlobject (object); GESTrackVideoTransition *self = GES_TRACK_VIDEO_TRANSITION (object); GESTrackVideoTransitionPrivate *priv = self->priv; GstTimedValueControlSource *ts; GST_LOG ("updating controller"); if (G_UNLIKELY (!gnlobj || !priv->control_source)) return; ts = GST_TIMED_VALUE_CONTROL_SOURCE (priv->control_source); GST_INFO ("duration: %" G_GUINT64_FORMAT, duration); GST_LOG ("setting values on controller"); gst_timed_value_control_source_unset_all (ts); gst_timed_value_control_source_set (ts, 0, priv->start_value); gst_timed_value_control_source_set (ts, duration, priv->end_value); priv->dur = duration; GST_LOG ("done updating controller"); }
/** * ges_track_remove_object: * @track: a #GESTrack * @object: the #GESTrackObject to remove * * Removes the object from the track and unparents it. * Unparenting it means the reference owned by @track on the @object will be * removed. If you wish to use the @object after this function, make sure you * call g_object_ref() before removing it from the @track. * * Returns: #TRUE if the object was removed, else #FALSE if the track * could not remove the object (like if it didn't belong to the track). */ gboolean ges_track_remove_object (GESTrack * track, GESTrackObject * object) { GESTrackPrivate *priv; GstElement *gnlobject; g_return_val_if_fail (GES_IS_TRACK (track), FALSE); g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), FALSE); GST_DEBUG ("track:%p, object:%p", track, object); priv = track->priv; if (G_UNLIKELY (ges_track_object_get_track (object) != track)) { GST_WARNING ("Object belongs to another track"); return FALSE; } if ((gnlobject = ges_track_object_get_gnlobject (object))) { GST_DEBUG ("Removing GnlObject '%s' from composition '%s'", GST_ELEMENT_NAME (gnlobject), GST_ELEMENT_NAME (priv->composition)); if (!gst_bin_remove (GST_BIN (priv->composition), gnlobject)) { GST_WARNING ("Failed to remove gnlobject from composition"); return FALSE; } } ges_track_object_set_track (object, NULL); priv->trackobjects = g_list_remove (priv->trackobjects, object); g_object_unref (object); return TRUE; }
static void ges_track_video_transition_duration_changed (GESTrackObject * object, guint64 duration) { GValue start_value = { 0, }; GValue end_value = { 0, }; GstElement *gnlobj = ges_track_object_get_gnlobject (object); GESTrackVideoTransition *self = GES_TRACK_VIDEO_TRANSITION (object); GESTrackVideoTransitionPrivate *priv = self->priv; GST_LOG ("updating controller"); if (G_UNLIKELY (!gnlobj || !priv->control_source)) return; GST_INFO ("duration: %" G_GUINT64_FORMAT, duration); g_value_init (&start_value, G_TYPE_DOUBLE); g_value_init (&end_value, G_TYPE_DOUBLE); g_value_set_double (&start_value, priv->start_value); g_value_set_double (&end_value, priv->end_value); GST_LOG ("setting values on controller"); gst_interpolation_control_source_unset_all (priv->control_source); gst_interpolation_control_source_set (priv->control_source, 0, &start_value); gst_interpolation_control_source_set (priv->control_source, duration, &end_value); GST_LOG ("done updating controller"); }
/** * ges_track_add_object: * @track: a #GESTrack * @object: (transfer full): the #GESTrackObject to add * * Adds the given object to the track. Sets the object's controlling track, * and thus takes ownership of the @object. * * An object can only be added to one track. * * Returns: #TRUE if the object was properly added. #FALSE if the track does not * want to accept the object. */ gboolean ges_track_add_object (GESTrack * track, GESTrackObject * object) { g_return_val_if_fail (GES_IS_TRACK (track), FALSE); g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), FALSE); GST_DEBUG ("track:%p, object:%p", track, object); if (G_UNLIKELY (ges_track_object_get_track (object) != NULL)) { GST_WARNING ("Object already belongs to another track"); return FALSE; } /* At this point, the track object shouldn't have any gnlobject since * it hasn't been added to a track yet. * FIXME : This check seems a bit obsolete */ if (G_UNLIKELY (ges_track_object_get_gnlobject (object) != NULL)) { GST_ERROR ("TrackObject already controls a gnlobject !"); return FALSE; } if (G_UNLIKELY (!ges_track_object_set_track (object, track))) { GST_ERROR ("Couldn't properly add the object to the Track"); return FALSE; } GST_DEBUG ("Adding object to ourself"); if (G_UNLIKELY (!gst_bin_add (GST_BIN (track->priv->composition), ges_track_object_get_gnlobject (object)))) { GST_WARNING ("Couldn't add object to the GnlComposition"); return FALSE; } g_object_ref_sink (object); track->priv->trackobjects = g_list_append (track->priv->trackobjects, object); return TRUE; }