validate:scenario: Make the action->prepare function return a GstValidateExecuteActio...
authorThibault Saunier <tsaunier@igalia.com>
Wed, 4 Mar 2020 00:36:21 +0000 (21:36 -0300)
committerThibault Saunier <tsaunier@igalia.com>
Thu, 12 Mar 2020 15:35:45 +0000 (12:35 -0300)
Implementers might want to report the error themselves

validate/gst/validate/gst-validate-scenario.c
validate/gst/validate/gst-validate-scenario.h

index 503d3f0..ff41b32 100644 (file)
@@ -1833,12 +1833,13 @@ gst_validate_execute_action (GstValidateActionType * action_type,
   scenario = gst_validate_action_get_scenario (action);
 
   if (action_type->prepare) {
-    if (action_type->prepare (action) == FALSE) {
+    res = action_type->prepare (action);
+    if (res != GST_VALIDATE_EXECUTE_ACTION_OK) {
       GST_ERROR_OBJECT (scenario, "Action %" GST_PTR_FORMAT
           " could not be prepared", action->structure);
 
       gst_object_unref (scenario);
-      return GST_VALIDATE_EXECUTE_ACTION_ERROR;
+      return res;
     }
   }
 
@@ -2996,7 +2997,7 @@ gst_validate_scenario_update_segment_from_seek (GstValidateScenario * scenario,
   }
 }
 
-static gboolean
+static GstValidateExecuteActionReturn
 gst_validate_action_default_prepare_func (GstValidateAction * action)
 {
   gint i;
@@ -3017,17 +3018,17 @@ gst_validate_action_default_prepare_func (GstValidateAction * action)
   }
 
   if (action->repeat > 0)
-    return TRUE;
+    return GST_VALIDATE_EXECUTE_ACTION_OK;
 
   if (!gst_structure_has_field (action->structure, "repeat"))
-    return TRUE;
+    return GST_VALIDATE_EXECUTE_ACTION_OK;
 
   if (gst_structure_get_int (action->structure, "repeat", &action->repeat))
-    return TRUE;
+    return GST_VALIDATE_EXECUTE_ACTION_OK;
 
   if (gst_structure_get_double (action->structure, "repeat",
           (gdouble *) & action->repeat))
-    return TRUE;
+    return GST_VALIDATE_EXECUTE_ACTION_OK;
 
   repeat_expr =
       g_strdup (gst_structure_get_string (action->structure, "repeat"));
@@ -3035,7 +3036,7 @@ gst_validate_action_default_prepare_func (GstValidateAction * action)
     g_error ("Invalid value for 'repeat' in %s",
         gst_structure_to_string (action->structure));
 
-    return FALSE;
+    return GST_VALIDATE_EXECUTE_ACTION_ERROR;
   }
 
   action->repeat =
@@ -3045,7 +3046,7 @@ gst_validate_action_default_prepare_func (GstValidateAction * action)
     g_error ("Invalid value for 'repeat' in %s: %s",
         gst_structure_to_string (action->structure), error);
 
-    return FALSE;
+    return GST_VALIDATE_EXECUTE_ACTION_ERROR;
   }
   g_free (repeat_expr);
 
@@ -3057,7 +3058,7 @@ gst_validate_action_default_prepare_func (GstValidateAction * action)
   if (scenario)
     gst_object_unref (scenario);
 
-  return TRUE;
+  return GST_VALIDATE_EXECUTE_ACTION_OK;
 }
 
 static void
index 668b7f9..e09973b 100644 (file)
@@ -84,7 +84,7 @@ typedef GstValidateExecuteActionReturn (*GstValidateExecuteAction) (GstValidateS
  * Returns: %TRUE if the action could be prepared and is ready to be run
  *          , %FALSE otherwise
  */
-typedef gboolean (*GstValidatePrepareAction) (GstValidateAction * action);
+typedef GstValidateExecuteActionReturn (*GstValidatePrepareAction) (GstValidateAction * action);
 
 
 typedef struct _GstValidateActionPrivate          GstValidateActionPrivate;