diff --git a/docs/gst-validate-config.md b/docs/gst-validate-config.md index ae20f3cf5c..99e56ff821 100644 --- a/docs/gst-validate-config.md +++ b/docs/gst-validate-config.md @@ -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 diff --git a/docs/gst-validate-scenarios.md b/docs/gst-validate-scenarios.md index f215130359..18e9701b29 100644 --- a/docs/gst-validate-scenarios.md +++ b/docs/gst-validate-scenarios.md @@ -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. \ No newline at end of file diff --git a/validate/gst/validate/gst-validate-scenario.c b/validate/gst/validate/gst-validate-scenario.c index 30718e9b9a..795f2ba994 100644 --- a/validate/gst/validate/gst-validate-scenario.c +++ b/validate/gst/validate/gst-validate-scenario.c @@ -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); diff --git a/validate/gst/validate/validate.c b/validate/gst/validate/validate.c index 2ca337efb2..48dd177aaa 100644 --- a/validate/gst/validate/validate.c +++ b/validate/gst/validate/validate.c @@ -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);