structured-interface: Properly check that setting keyframe works
authorThibault Saunier <tsaunier@igalia.com>
Thu, 9 Apr 2020 15:02:26 +0000 (11:02 -0400)
committerThibault Saunier <tsaunier@igalia.com>
Fri, 10 Apr 2020 15:12:12 +0000 (11:12 -0400)
Fixes CID: 1455490

ges/ges-structured-interface.c

index 3b50299fd06457e96f7ba771c1c0707ba25614c6..f72701a19cc62d75d36bdb2446ceebcfef1c4705 100644 (file)
@@ -154,6 +154,7 @@ _ges_add_remove_keyframe_from_struct (GESTimeline * timeline,
   gchar *element_name = NULL, *property_name = NULL;
 
   gboolean ret = FALSE;
+  gboolean setting_value;
 
   const gchar *valid_fields[] =
       { "element-name", "property-name", "value", "timestamp", "project-uri",
@@ -249,17 +250,18 @@ _ges_add_remove_keyframe_from_struct (GESTimeline * timeline,
   } else
     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);
-  else {
+  else
     ret = gst_timed_value_control_source_unset (source, timestamp);
 
-    if (!ret) {
-      *error =
-          g_error_new (GES_ERROR, 0,
-          "Could not unset value for timestamp: %" GST_TIME_FORMAT,
-          GST_TIME_ARGS (timestamp));
-    }
+  if (!ret) {
+    *error =
+        g_error_new (GES_ERROR, 0,
+        "Could not %sset value for timestamp: %" GST_TIME_FORMAT,
+        setting_value ? "" : "un", GST_TIME_ARGS (timestamp));
   }
   ret = _ges_save_timeline_if_needed (timeline, structure, error);