From f24ca377943864b7cb5879f7ae7177481c151d9d Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 3 Mar 2020 21:36:21 -0300 Subject: [PATCH] validate:scenario: Make the action->prepare function return a GstValidateExecuteActionReturn Implementers might want to report the error themselves --- validate/gst/validate/gst-validate-scenario.c | 21 ++++++++++--------- validate/gst/validate/gst-validate-scenario.h | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/validate/gst/validate/gst-validate-scenario.c b/validate/gst/validate/gst-validate-scenario.c index 503d3f0bfd..ff41b3208e 100644 --- a/validate/gst/validate/gst-validate-scenario.c +++ b/validate/gst/validate/gst-validate-scenario.c @@ -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 diff --git a/validate/gst/validate/gst-validate-scenario.h b/validate/gst/validate/gst-validate-scenario.h index 668b7f9e28..e09973b583 100644 --- a/validate/gst/validate/gst-validate-scenario.h +++ b/validate/gst/validate/gst-validate-scenario.h @@ -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;