Commit 9e18e039 authored by Henry Wilkes's avatar Henry Wilkes

track-element: use out-point for updating control bindings

The out-point, which is an internal time, is used instead of the
duration for determining the control binding value at the end of the
element.

Also, allow the user to switch off the auto-clamping of control sources
if they are not desired. And allow them to clamp specific control sources
individually.

Also, fix a lot of memory leaks related to control sources. In
particular, releasing the extra ref gained by source in
g_object_get (binding, "control-source", &source, NULL);

Part-of: <!177>
parent 73852466
......@@ -1081,8 +1081,7 @@ ges_base_xml_formatter_add_control_binding (GESBaseXmlFormatter * self,
if (priv->state != STATE_LOADING_CLIPS) {
GST_DEBUG_OBJECT (self, "Not loading control bindings in %s state.",
loading_state_name (priv->state));
g_slist_free_full (timed_values, g_free);
return;
goto done;
}
if (track_id[0] != '-' && priv->current_clip)
......@@ -1092,23 +1091,28 @@ ges_base_xml_formatter_add_control_binding (GESBaseXmlFormatter * self,
if (element == NULL) {
GST_WARNING ("No current track element to which we can append a binding");
return;
goto done;
}
if (!g_strcmp0 (source_type, "interpolation")) {
GstControlSource *source;
source = gst_interpolation_control_source_new ();
/* add first before setting values to avoid clamping */
ges_track_element_set_control_source (element, source,
property_name, binding_type);
g_object_set (source, "mode", mode, NULL);
gst_timed_value_control_source_set_from_list (GST_TIMED_VALUE_CONTROL_SOURCE
(source), timed_values);
g_slist_free_full (timed_values, g_free);
gst_object_unref (source);
} else
GST_WARNING ("This interpolation type is not supported\n");
done:
g_slist_free_full (timed_values, g_free);
}
void
......
This diff is collapsed.
......@@ -454,6 +454,9 @@ G_GNUC_INTERNAL void ges_track_element_set_layer_active (GESTrackElement
G_GNUC_INTERNAL void ges_track_element_copy_bindings (GESTrackElement *element,
GESTrackElement *new_element,
guint64 position);
G_GNUC_INTERNAL void ges_track_element_freeze_control_sources (GESTrackElement * object,
gboolean freeze);
G_GNUC_INTERNAL void ges_track_element_update_outpoint (GESTrackElement * self);
G_GNUC_INTERNAL void
ges_track_element_set_creator_asset (GESTrackElement * self,
......
......@@ -1861,6 +1861,12 @@ timeline_tree_perform_edits (GNode * root, GHashTable * edits)
/* freeze the auto-transitions whilst we edit */
ges_timeline_freeze_auto_transitions (root->data, TRUE);
g_hash_table_iter_init (&iter, edits);
while (g_hash_table_iter_next (&iter, &key, &value)) {
if (GES_IS_TRACK_ELEMENT (key))
ges_track_element_freeze_control_sources (GES_TRACK_ELEMENT (key), TRUE);
}
g_hash_table_iter_init (&iter, edits);
while (g_hash_table_iter_next (&iter, &key, &value)) {
GESTimelineElement *element = key;
......@@ -1868,6 +1874,13 @@ timeline_tree_perform_edits (GNode * root, GHashTable * edits)
if (!perform_element_edit (element, edit_data))
no_errors = FALSE;
}
g_hash_table_iter_init (&iter, edits);
while (g_hash_table_iter_next (&iter, &key, &value)) {
if (GES_IS_TRACK_ELEMENT (key))
ges_track_element_freeze_control_sources (GES_TRACK_ELEMENT (key), FALSE);
}
/* allow the transitions to update if they can */
ges_timeline_freeze_auto_transitions (root->data, FALSE);
......
This diff is collapsed.
......@@ -161,6 +161,16 @@ ges_track_element_set_control_source (GESTrackElement *object,
const gchar *property_name,
const gchar *binding_type);
GES_API void
ges_track_element_clamp_control_source (GESTrackElement * object,
const gchar * property_name);
GES_API void
ges_track_element_set_auto_clamp_control_sources (GESTrackElement * object,
gboolean auto_clamp);
GES_API gboolean
ges_track_element_get_auto_clamp_control_sources (GESTrackElement * object);
GES_API GstControlBinding *
ges_track_element_get_control_binding (GESTrackElement *object,
const gchar *property_name);
......
......@@ -1511,6 +1511,8 @@ _save_keyframes (GString * str, GESTrackElement * trackelement, gint index,
append_escaped (str, g_markup_printf_escaped ("'/>\n"), depth);
} else
GST_DEBUG ("control source not in [interpolation]");
gst_object_unref (source);
} else
GST_DEBUG ("Binding type not in [direct, direct-absolute]");
}
......
This diff is collapsed.
......@@ -342,6 +342,8 @@ _add_properties (GESTimeline * timeline)
(source), 5 * GST_SECOND, 0.);
gst_timed_value_control_source_set (GST_TIMED_VALUE_CONTROL_SOURCE
(source), 10 * GST_SECOND, 1.);
gst_object_unref (source);
} else if (GES_IS_VIDEO_SOURCE (element)) {
/* Adding children properties */
gint64 posx = 42;
......@@ -412,6 +414,7 @@ _check_properties (GESTimeline * timeline)
fail_unless (value->value == 1.);
fail_unless (value->timestamp == 10 * GST_SECOND);
g_list_free (timed_values);
gst_object_unref (source);
}
/* Checking children properties */
else if (GES_IS_VIDEO_SOURCE (element)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment