structured-interface: Properly check that setting keyframe works

Fixes CID: 1455490
This commit is contained in:
Thibault Saunier 2020-04-09 11:02:26 -04:00
parent f55aeb2323
commit 9b430c22a5

View file

@ -154,6 +154,7 @@ _ges_add_remove_keyframe_from_struct (GESTimeline * timeline,
gchar *element_name = NULL, *property_name = NULL; gchar *element_name = NULL, *property_name = NULL;
gboolean ret = FALSE; gboolean ret = FALSE;
gboolean setting_value;
const gchar *valid_fields[] = const gchar *valid_fields[] =
{ "element-name", "property-name", "value", "timestamp", "project-uri", { "element-name", "property-name", "value", "timestamp", "project-uri",
@ -249,17 +250,18 @@ _ges_add_remove_keyframe_from_struct (GESTimeline * timeline,
} else } else
GET_AND_CHECK ("value", G_TYPE_DOUBLE, &value, done); GET_AND_CHECK ("value", G_TYPE_DOUBLE, &value, done);
if (!g_strcmp0 (gst_structure_get_name (structure), "add-keyframe")) setting_value
= !g_strcmp0 (gst_structure_get_name (structure), "add-keyframe");
if (setting_value)
ret = gst_timed_value_control_source_set (source, timestamp, value); ret = gst_timed_value_control_source_set (source, timestamp, value);
else { else
ret = gst_timed_value_control_source_unset (source, timestamp); ret = gst_timed_value_control_source_unset (source, timestamp);
if (!ret) { if (!ret) {
*error = *error =
g_error_new (GES_ERROR, 0, g_error_new (GES_ERROR, 0,
"Could not unset value for timestamp: %" GST_TIME_FORMAT, "Could not %sset value for timestamp: %" GST_TIME_FORMAT,
GST_TIME_ARGS (timestamp)); setting_value ? "" : "un", GST_TIME_ARGS (timestamp));
}
} }
ret = _ges_save_timeline_if_needed (timeline, structure, error); ret = _ges_save_timeline_if_needed (timeline, structure, error);