mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
validate: Add SCENARIO_NAME and CONFIG_NAME vars in configs/scenarios
This commit is contained in:
parent
7d471ee25e
commit
ade8ba3fcb
4 changed files with 17 additions and 4 deletions
|
@ -20,10 +20,10 @@ set them in [gst-validate-scenarios](gst-validate-scenarios.md).
|
|||
|
||||
Defaults variables are:
|
||||
|
||||
- `$(TMPDIR)`: The default temporary directory as returned by
|
||||
[g_get_tmp_dir()](g_get_tmp_dir).
|
||||
- `$(TMPDIR)`: The default temporary directory as returned by `g_get_tmp_dir`.
|
||||
- `$(CONFIG_PATH)`: The path of the running scenario.
|
||||
- `$(CONFIG_DIR)`: The directory the running scenario is in.
|
||||
- `$(CONFIG_NAME)`: The name of the config file
|
||||
- `$(LOGSDIR)`: The directory where to place log files. This uses the
|
||||
`GST_VALIDATE_LOGSDIR` environment variable if avalaible or `$(TMPDIR)`
|
||||
if the variables hasn't been set. (Note that the
|
||||
|
|
|
@ -101,10 +101,10 @@ Any action can use the default variables:
|
|||
[gst_element_query_position()](gst_element_query_position)
|
||||
- `$(duration)`: The current duration of the pipeline as reported by
|
||||
[gst_element_query_duration()](gst_element_query_duration)
|
||||
- `$(TMPDIR)`: The default temporary directory as returned by
|
||||
[g_get_tmp_dir()](g_get_tmp_dir).
|
||||
- `$(TMPDIR)`: The default temporary directory as returned by `g_get_tmp_dir`.
|
||||
- `$(SCENARIO_PATH)`: The path of the running scenario.
|
||||
- `$(SCENARIO_DIR)`: The directory the running scenario is in.
|
||||
- `$(SCENARIO_NAME)`: The name the running scenario
|
||||
|
||||
|
||||
It is also possible to set variables in scenario with the `set-vars` action.
|
|
@ -2918,6 +2918,7 @@ gst_validate_action_default_prepare_func (GstValidateAction * action)
|
|||
GstValidateActionType *type = gst_validate_get_action_type (action->type);
|
||||
GstValidateScenario *scenario = gst_validate_action_get_scenario (action);
|
||||
|
||||
_update_well_known_vars (scenario);
|
||||
gst_validate_structure_resolve_variables (action->structure,
|
||||
scenario->priv->vars);
|
||||
for (i = 0; type->parameters[i].name; i++) {
|
||||
|
@ -3546,12 +3547,18 @@ gst_validate_scenario_load (GstValidateScenario * scenario,
|
|||
check_scenario:
|
||||
if (!is_config) {
|
||||
gchar *scenario_dir = g_path_get_dirname (scenario_file);
|
||||
gchar *scenario_fname = g_path_get_basename (scenario_file);
|
||||
gchar **scenario_name =
|
||||
g_regex_split_simple ("\\.scenario", scenario_fname, 0, 0);
|
||||
|
||||
gst_structure_set (scenario->priv->vars,
|
||||
"SCENARIO_DIR", G_TYPE_STRING, scenario_dir,
|
||||
"SCENARIO_NAME", G_TYPE_STRING, scenario_name[0],
|
||||
"SCENARIO_PATH", G_TYPE_STRING, scenario_file, NULL);
|
||||
|
||||
g_free (scenario_dir);
|
||||
g_free (scenario_fname);
|
||||
g_strfreev (scenario_name);
|
||||
}
|
||||
|
||||
g_free (tldir);
|
||||
|
|
|
@ -171,12 +171,18 @@ create_config (const gchar * config, const gchar * suffix)
|
|||
|
||||
if (config_file) {
|
||||
gchar *config_dir = g_path_get_dirname (config_file);
|
||||
gchar *config_fname = g_path_get_basename (config_file);
|
||||
gchar **config_name =
|
||||
g_regex_split_simple ("\\.config", config_fname, 0, 0);
|
||||
|
||||
gst_structure_set (local_vars,
|
||||
"CONFIG_DIR", G_TYPE_STRING, config_dir,
|
||||
"CONFIG_NAME", G_TYPE_STRING, config_name[0],
|
||||
"CONFIG_PATH", G_TYPE_STRING, config_file, NULL);
|
||||
|
||||
g_free (config_dir);
|
||||
g_free (config_fname);
|
||||
g_strfreev (config_name);
|
||||
}
|
||||
|
||||
g_free (config_file);
|
||||
|
|
Loading…
Reference in a new issue