mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 23:18:52 +00:00
validate:scenario: Make gst_validate_action_new public
Mainly so it can be used in unit tests.
This commit is contained in:
parent
be854d4be8
commit
b7616e5fab
2 changed files with 21 additions and 13 deletions
|
@ -104,6 +104,9 @@ static GList *action_types = NULL;
|
||||||
static void gst_validate_scenario_dispose (GObject * object);
|
static void gst_validate_scenario_dispose (GObject * object);
|
||||||
static void gst_validate_scenario_finalize (GObject * object);
|
static void gst_validate_scenario_finalize (GObject * object);
|
||||||
static GstValidateActionType *_find_action_type (const gchar * type_name);
|
static GstValidateActionType *_find_action_type (const gchar * type_name);
|
||||||
|
static GstValidateExecuteActionReturn
|
||||||
|
_fill_action (GstValidateScenario * scenario, GstValidateAction * action,
|
||||||
|
GstStructure * structure, gboolean add_to_lists);
|
||||||
|
|
||||||
/* GstValidateScenario is not really thread safe and
|
/* GstValidateScenario is not really thread safe and
|
||||||
* everything should be done from the thread GstValidate
|
* everything should be done from the thread GstValidate
|
||||||
|
@ -279,8 +282,6 @@ gst_validate_action_get_type (void)
|
||||||
return _gst_validate_action_type;
|
return _gst_validate_action_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstValidateAction *gst_validate_action_new (GstValidateScenario *
|
|
||||||
scenario, GstValidateActionType * type);
|
|
||||||
static gboolean execute_next_action (GstValidateScenario * scenario);
|
static gboolean execute_next_action (GstValidateScenario * scenario);
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_validate_scenario_load (GstValidateScenario * scenario,
|
gst_validate_scenario_load (GstValidateScenario * scenario,
|
||||||
|
@ -291,7 +292,7 @@ _action_copy (GstValidateAction * act)
|
||||||
{
|
{
|
||||||
GstValidateScenario *scenario = gst_validate_action_get_scenario (act);
|
GstValidateScenario *scenario = gst_validate_action_get_scenario (act);
|
||||||
GstValidateAction *copy = gst_validate_action_new (scenario,
|
GstValidateAction *copy = gst_validate_action_new (scenario,
|
||||||
_find_action_type (act->type));
|
_find_action_type (act->type), NULL, FALSE);
|
||||||
|
|
||||||
gst_object_unref (scenario);
|
gst_object_unref (scenario);
|
||||||
|
|
||||||
|
@ -345,9 +346,10 @@ gst_validate_action_unref (GstValidateAction * action)
|
||||||
gst_mini_object_unref (GST_MINI_OBJECT (action));
|
gst_mini_object_unref (GST_MINI_OBJECT (action));
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstValidateAction *
|
GstValidateAction *
|
||||||
gst_validate_action_new (GstValidateScenario * scenario,
|
gst_validate_action_new (GstValidateScenario * scenario,
|
||||||
GstValidateActionType * action_type)
|
GstValidateActionType * action_type, GstStructure * structure,
|
||||||
|
gboolean add_to_lists)
|
||||||
{
|
{
|
||||||
GstValidateAction *action = g_slice_new0 (GstValidateAction);
|
GstValidateAction *action = g_slice_new0 (GstValidateAction);
|
||||||
|
|
||||||
|
@ -358,6 +360,9 @@ gst_validate_action_new (GstValidateScenario * scenario,
|
||||||
action->repeat = -1;
|
action->repeat = -1;
|
||||||
|
|
||||||
g_weak_ref_set (&action->priv->scenario, scenario);
|
g_weak_ref_set (&action->priv->scenario, scenario);
|
||||||
|
if (structure)
|
||||||
|
action->priv->state =
|
||||||
|
_fill_action (scenario, action, structure, add_to_lists);
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
@ -3140,9 +3145,9 @@ message_cb (GstBus * bus, GstMessage * message, GstValidateScenario * scenario)
|
||||||
GST_DEBUG_OBJECT (scenario, "Got EOS; generate 'stop' action");
|
GST_DEBUG_OBJECT (scenario, "Got EOS; generate 'stop' action");
|
||||||
|
|
||||||
stop_action_type = _find_action_type ("stop");
|
stop_action_type = _find_action_type ("stop");
|
||||||
stop_action = gst_validate_action_new (scenario, stop_action_type);
|
stop_action = gst_validate_action_new (scenario, stop_action_type,
|
||||||
s = gst_structure_from_string ("stop, generated-after-eos=true;", NULL);
|
gst_structure_from_string ("stop, generated-after-eos=true;", NULL),
|
||||||
_fill_action (scenario, stop_action, s, FALSE);
|
FALSE);
|
||||||
gst_structure_free (s);
|
gst_structure_free (s);
|
||||||
gst_validate_execute_action (stop_action_type, stop_action);
|
gst_validate_execute_action (stop_action_type, stop_action);
|
||||||
gst_mini_object_unref (GST_MINI_OBJECT (stop_action));
|
gst_mini_object_unref (GST_MINI_OBJECT (stop_action));
|
||||||
|
@ -3340,9 +3345,8 @@ _load_scenario_file (GstValidateScenario * scenario,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
action = gst_validate_action_new (scenario, action_type);
|
action = gst_validate_action_new (scenario, action_type, structure, TRUE);
|
||||||
if (_fill_action (scenario, action,
|
if (action->priv->state == GST_VALIDATE_EXECUTE_ACTION_ERROR)
|
||||||
structure, TRUE) == GST_VALIDATE_EXECUTE_ACTION_ERROR)
|
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
action->action_number = priv->num_actions++;
|
action->action_number = priv->num_actions++;
|
||||||
|
@ -5139,8 +5143,7 @@ init_scenarios (void)
|
||||||
gst_structure_set (plug_conf, "as-config", G_TYPE_BOOLEAN, TRUE, NULL);
|
gst_structure_set (plug_conf, "as-config", G_TYPE_BOOLEAN, TRUE, NULL);
|
||||||
gst_structure_set_name (plug_conf, action_typename);
|
gst_structure_set_name (plug_conf, action_typename);
|
||||||
|
|
||||||
action = gst_validate_action_new (NULL, atype);
|
action = gst_validate_action_new (NULL, atype, plug_conf, FALSE);
|
||||||
_fill_action (NULL, action, plug_conf, FALSE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,6 +119,11 @@ GST_VALIDATE_API
|
||||||
void gst_validate_action_set_done (GstValidateAction *action);
|
void gst_validate_action_set_done (GstValidateAction *action);
|
||||||
GST_VALIDATE_API
|
GST_VALIDATE_API
|
||||||
GstValidateScenario * gst_validate_action_get_scenario (GstValidateAction *action);
|
GstValidateScenario * gst_validate_action_get_scenario (GstValidateAction *action);
|
||||||
|
GST_VALIDATE_API
|
||||||
|
GstValidateAction * gst_validate_action_new (GstValidateScenario * scenario,
|
||||||
|
GstValidateActionType * action_type,
|
||||||
|
GstStructure *structure,
|
||||||
|
gboolean add_to_lists);
|
||||||
|
|
||||||
#define GST_TYPE_VALIDATE_ACTION (gst_validate_action_get_type ())
|
#define GST_TYPE_VALIDATE_ACTION (gst_validate_action_get_type ())
|
||||||
#define GST_IS_VALIDATE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_ACTION))
|
#define GST_IS_VALIDATE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_ACTION))
|
||||||
|
|
Loading…
Reference in a new issue