mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 20:51:13 +00:00
validate: Use a GList to store action types instead of hashtable
It is more adapted and allows us to print the action types in a stable maneer.
This commit is contained in:
parent
eb6739c91b
commit
7cfdb5372c
1 changed files with 24 additions and 12 deletions
|
@ -155,7 +155,7 @@ enum
|
||||||
PROP_LAST
|
PROP_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
static GHashTable *action_types_table;
|
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 GRegex *clean_action_str;
|
static GRegex *clean_action_str;
|
||||||
|
@ -305,6 +305,19 @@ gst_validate_action_type_new (void)
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GstValidateActionType *
|
||||||
|
_find_action_type (const gchar * type_name)
|
||||||
|
{
|
||||||
|
GList *tmp;
|
||||||
|
|
||||||
|
for (tmp = action_types; tmp; tmp = tmp->next) {
|
||||||
|
if (g_strcmp0 (((GstValidateActionType *) tmp->data)->name, type_name) == 0)
|
||||||
|
return tmp->data;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_set_variable_func (const gchar * name, double *value, gpointer user_data)
|
_set_variable_func (const gchar * name, double *value, gpointer user_data)
|
||||||
{
|
{
|
||||||
|
@ -946,7 +959,7 @@ get_position (GstValidateScenario * scenario)
|
||||||
(GST_STATE (pipeline) < GST_STATE_PAUSED))) {
|
(GST_STATE (pipeline) < GST_STATE_PAUSED))) {
|
||||||
GstValidateActionType *type;
|
GstValidateActionType *type;
|
||||||
|
|
||||||
type = g_hash_table_lookup (action_types_table, act->type);
|
type = _find_action_type (act->type);
|
||||||
|
|
||||||
if (act->repeat == -1 &&
|
if (act->repeat == -1 &&
|
||||||
!gst_structure_get_int (act->structure, "repeat", &act->repeat)) {
|
!gst_structure_get_int (act->structure, "repeat", &act->repeat)) {
|
||||||
|
@ -1484,7 +1497,7 @@ _load_scenario_file (GstValidateScenario * scenario,
|
||||||
gst_structure_get_boolean (structure, "handles-states",
|
gst_structure_get_boolean (structure, "handles-states",
|
||||||
&priv->handles_state);
|
&priv->handles_state);
|
||||||
continue;
|
continue;
|
||||||
} else if (!(action_type = g_hash_table_lookup (action_types_table, type))) {
|
} else if (!(action_type = _find_action_type (type))) {
|
||||||
GST_ERROR_OBJECT (scenario, "We do not handle action types %s", type);
|
GST_ERROR_OBJECT (scenario, "We do not handle action types %s", type);
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
@ -1989,6 +2002,7 @@ gst_validate_add_action_type (const gchar * type_name,
|
||||||
GstValidateActionParameter * parameters,
|
GstValidateActionParameter * parameters,
|
||||||
const gchar * description, gboolean is_config)
|
const gchar * description, gboolean is_config)
|
||||||
{
|
{
|
||||||
|
GstValidateActionType *tmptype;
|
||||||
GstValidateActionType *type = gst_validate_action_type_new ();
|
GstValidateActionType *type = gst_validate_action_type_new ();
|
||||||
gint n_params = is_config ? 0 : 2;
|
gint n_params = is_config ? 0 : 2;
|
||||||
|
|
||||||
|
@ -2019,25 +2033,23 @@ gst_validate_add_action_type (const gchar * type_name,
|
||||||
type->parameters[n_params - 1].def = "0.0";
|
type->parameters[n_params - 1].def = "0.0";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action_types_table == NULL)
|
|
||||||
action_types_table = g_hash_table_new_full (g_str_hash, g_str_equal,
|
|
||||||
g_free, (GDestroyNotify) gst_mini_object_unref);
|
|
||||||
|
|
||||||
type->execute = function;
|
type->execute = function;
|
||||||
type->name = g_strdup (type_name);
|
type->name = g_strdup (type_name);
|
||||||
type->description = g_strdup (description);
|
type->description = g_strdup (description);
|
||||||
type->is_config = is_config;
|
type->is_config = is_config;
|
||||||
|
|
||||||
g_hash_table_insert (action_types_table, g_strdup (type_name), type);
|
if ((tmptype = _find_action_type (type_name))) {
|
||||||
|
action_types = g_list_remove (action_types, tmptype);
|
||||||
|
gst_mini_object_unref (GST_MINI_OBJECT (tmptype));
|
||||||
|
}
|
||||||
|
|
||||||
|
action_types = g_list_append (action_types, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GList *
|
static GList *
|
||||||
gst_validate_list_action_types (void)
|
gst_validate_list_action_types (void)
|
||||||
{
|
{
|
||||||
if (action_types_table)
|
return action_types;
|
||||||
return g_hash_table_get_values (action_types_table);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue